int PartyMatchRegister(LPMSG_PARTYMATCHING_REG_REQ lpMsg) { char szQuery[256]; int retCode = -1; #ifdef ZTEAMDB sprintf(szQuery,"EXEC PartyMatching_Register %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d", lpMsg->ServerCode,lpMsg->szName,lpMsg->szDesc,lpMsg->szPass, lpMsg->MinLevel,lpMsg->MaxLevel,lpMsg->MoveReqId,lpMsg->ClassInfo,lpMsg->btAutoAccept, lpMsg->Gens); #else sprintf(szQuery,"EXEC WZ_PM_Register %d, '%s', '%s', '%s', %d, %d, %d, %d, %d", lpMsg->ServerCode,lpMsg->szName,lpMsg->szDesc,lpMsg->szPass, lpMsg->MinLevel,lpMsg->MaxLevel,lpMsg->MoveReqId,lpMsg->ClassInfo,lpMsg->btAutoAccept); #endif if( !g_PartyMatchDB.Exec(szQuery) || g_PartyMatchDB.Fetch() == SQL_NO_DATA ) { g_PartyMatchDB.Clear(); return retCode; } retCode = g_PartyMatchDB.GetInt("RegResult"); g_PartyMatchDB.Clear(); return retCode; }
void EGAnsPCBangUserConnect(LPBYTE aRecv,int aIndex) { PMSG_PCBANGUSER_CONNECT* lpMsg = (PMSG_PCBANGUSER_CONNECT*)aRecv; char szAccountId[MAX_IDSTRING+1]; szAccountId[MAX_IDSTRING] = '\0'; memcpy(szAccountId,lpMsg->szAccountID,MAX_IDSTRING); char szQuery[256]; sprintf(szQuery,"SELECT pcbang_id,pcbang_points FROM PCBANG_USER WHERE pcbang_id = '%s'",szAccountId); PMSG_PCBANG_USERDATA_GETINFO pMsg ={0}; PHeadSetB((LPBYTE)&pMsg,0x23,sizeof(pMsg)); pMsg.aIndex = lpMsg->aIndex; pMsg.Points = 0; if( g_EventDB.Exec(szQuery) == TRUE ) { if( g_EventDB.Fetch() != SQL_NO_DATA ) { pMsg.Points = g_EventDB.GetInt("pcbang_points"); } else { g_EventDB.Clear(); sprintf(szQuery,"INSERT INTO PCBANG_USER (pcbang_id,pcbang_points,reset_date) VALUES ('%s',0,getdate()+7)",szAccountId); g_EventDB.Exec(szQuery); } } g_EventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
void EGUpdateDoubleGoer(LPBYTE aRecv,int aIndex) { LPMSG_DOUBLEGOER_UPDATE_EVENT lpMsg = (LPMSG_DOUBLEGOER_UPDATE_EVENT)aRecv; char szName[MAX_IDSTRING+1]; memcpy(szName,lpMsg->szName,MAX_IDSTRING); szName[MAX_IDSTRING] = '\0'; char szQuery[512]; wsprintf(szQuery,"SELECT * FROM DG_ROOM WHERE CHAR_NAME = '%s'",szName); if( g_EventDB.Exec(szQuery) != FALSE ) { if( g_EventDB.Fetch() == SQL_NO_DATA ) { g_EventDB.Clear(); wsprintf(szQuery,"INSERT INTO DG_ROOM (CHAR_NAME,NEXT_EVENT) VALUES ('%s',DATEADD(DAY,1,GETDATE()))",szName); g_EventDB.Exec(szQuery); } else { g_EventDB.Clear(); wsprintf(szQuery,"UPDATE DG_ROOM SET NEXT_EVENT = DATEADD(DAY,1,GETDATE()) WHERE CHAR_NAME = '%s'",szName); g_EventDB.Exec(szQuery); } } g_EventDB.Clear(); }
int PartyMatchJoin(LPMSG_PARTYMATCHING_JOIN_REQ lpMsg) { int iResult = 0; char szQuery[256]; #ifdef ZTEAMDB sprintf(szQuery,"EXEC PartyMatching_JoinRequest %d,%d,'%s','%s','%s',%d,%d,%d", lpMsg->RequestType,lpMsg->ServerCode,lpMsg->szPartyLeader,lpMsg->szPassword, lpMsg->szName,lpMsg->Level,lpMsg->Class,lpMsg->Gens); #else sprintf(szQuery,"EXEC WZ_PM_JoinRequest %d,%d,'%s','%s','%s',%d,%d,%d", lpMsg->RequestType,lpMsg->ServerCode,lpMsg->szPartyLeader,lpMsg->szPassword, lpMsg->szName,lpMsg->Level,lpMsg->Class,lpMsg->Gens); #endif if( !g_PartyMatchDB.Exec(szQuery) || g_PartyMatchDB.Fetch() == SQL_NO_DATA ) { g_PartyMatchDB.Clear(); return -8; } iResult = g_PartyMatchDB.GetInt("RequestResult"); g_PartyMatchDB.Clear(); return iResult; }
void EGAnsEnterDoubleGoer(LPBYTE aRecv,int aIndex) { LPMSG_DOUBLEGOER_REQ_ENTER_EVENT lpMsg = (LPMSG_DOUBLEGOER_REQ_ENTER_EVENT)aRecv; PMSG_DOUBLEGOER_ANS_ENTER_EVENT pMsg; PHeadSetB((LPBYTE)&pMsg,0x40,sizeof(pMsg)); pMsg.btPos = lpMsg->btPos; pMsg.aIndex = lpMsg->aIndex; pMsg.iResult = 0; char szQuery[512]; wsprintf(szQuery,"SELECT DATEDIFF(mi,getdate(),NEXT_EVENT) as LeftHour FROM DG_ROOM WHERE CHAR_NAME = '%s' AND NEXT_EVENT > getdate()",lpMsg->szName); if( g_EventDB.Exec(szQuery) != FALSE ) { if( g_EventDB.Fetch() != SQL_NO_DATA ) { pMsg.iResult = g_EventDB.GetInt("LeftHour"); } } else { pMsg.iResult = -1; } g_EventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
void EGAns2AnivRegSerial(LPMSG_REQ_2ANIV_SERIAL lpMsg,int aIndex) { char szQuery[256]; char szAccount[MAX_IDSTRING+1] = {0}; memcpy(szAccount,lpMsg->szUID,MAX_IDSTRING); PMSG_ANS_2ANIV_SERIAL pMsg; pMsg.h.c = 0xC1; pMsg.h.headcode = 0x08; pMsg.h.size = sizeof( pMsg ); pMsg.iINDEX = lpMsg->iINDEX; strcpy(pMsg.szUID,szAccount); sprintf(szQuery,"EXEC SP_REG_SERIAL '%s', '%d', '%s', '%s', '%s'", szAccount,lpMsg->iMEMB_GUID,lpMsg->SERIAL1,lpMsg->SERIAL2,lpMsg->SERIAL3); pMsg.btIsRegistered = 4; if(g_EventDB.Exec(szQuery) && g_EventDB.Fetch() != SQL_NO_DATA) { pMsg.btIsRegistered = g_EventDB.GetInt("RegResult"); pMsg.iGiftNumber = g_EventDB.GetInt("F_Register_Section"); if(pMsg.iGiftNumber == -1) { pMsg.btIsRegistered = 4; } } g_EventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
void OlympStatsRequest(LPOLP_REQ_STATS lpMsg,int aIndex) { char szName[MAX_IDSTRING+1]; memcpy(szName,lpMsg->szName,MAX_IDSTRING); szName[MAX_IDSTRING] = '\0'; OLP_ANS_STATS pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.headcode = 0x68; pMsg.h.size = sizeof(pMsg); pMsg.h.subcode = 0x06; pMsg.iIndex = lpMsg->iIndex; memcpy(pMsg.szName,szName,MAX_IDSTRING); pMsg.btResult = FALSE; pMsg.iBattles = 0; pMsg.iPts = 0; char szQuery[512]; sprintf(szQuery,"SELECT BATTLE_COUNT,BATTLE_POINTS FROM OLYMP_USERS WHERE CHAR_NAME = '%s' AND MAP_SVR_GROUP = %d", szName,lpMsg->wMapSvrNum); if( g_MyEventDB.Exec(szQuery) && g_MyEventDB.Fetch() != SQL_NO_DATA ) { pMsg.btResult = TRUE; pMsg.iBattles = g_MyEventDB.GetInt("BATTLE_COUNT"); pMsg.iPts = g_MyEventDB.GetInt("BATTLE_POINTS"); } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
void OlympRewardRequest(LPOLP_REQ_REWARD lpMsg,int aIndex) { char szName[MAX_IDSTRING+1]; memcpy(szName,lpMsg->szName,MAX_IDSTRING); szName[MAX_IDSTRING] = '\0'; OLP_ANS_REWARD pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.headcode = 0x68; pMsg.h.size = sizeof( pMsg ); pMsg.h.subcode = 0x05; pMsg.iIndex = lpMsg->iIndex; memcpy(pMsg.szName,szName,10); pMsg.btResult = 0; pMsg.btRank = 0; pMsg.btReward = 0; char szQuery[512]; sprintf(szQuery,"EXEC WZ_OG_UserReward %d, '%s'", lpMsg->wMapSvrNum,szName); if( g_MyEventDB.Exec(szQuery) == TRUE && g_MyEventDB.Fetch() != SQL_NO_DATA ) { pMsg.btResult = g_MyEventDB.GetInt("qResult"); pMsg.btRank = g_MyEventDB.GetInt("USER_RANK"); pMsg.btReward = g_MyEventDB.GetInt("IS_REWARDED"); } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
void ReqRegOlymp(LPOLP_REQ_REGFIGHT lpMsg,int aIndex) { char szName[MAX_IDSTRING+1]; memcpy(szName,lpMsg->szName,MAX_IDSTRING); szName[MAX_IDSTRING] = '\0'; OLP_ANS_REGFIGHT pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x68; pMsg.h.subcode = 0x02; pMsg.iIndex = lpMsg->iIndex; memcpy(pMsg.szName,szName,MAX_IDSTRING); pMsg.iBattleCount = 0; pMsg.iBattlePts = 0; pMsg.btResult = 0; char szQuery[512]; sprintf(szQuery,"EXEC WZ_OG_UserInfo %d, '%s',%d",lpMsg->wMapSvrNum,szName,lpMsg->iClass); if( g_MyEventDB.Exec(szQuery) && g_MyEventDB.Fetch() != SQL_NO_DATA ) { pMsg.btResult = TRUE; pMsg.iBattleCount = g_MyEventDB.GetInt("BATTLE_COUNT"); pMsg.iBattlePts = g_MyEventDB.GetInt("BATTLE_POINTS"); pMsg.iLastRegTime = g_MyEventDB.GetInt("LAST_REG"); } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
void ReqOlympChangeDate(LPOLP_REQ_SDEDCHANGE lpMsg,int aIndex) { OLP_ANS_SDEDCHANGE pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x68; pMsg.h.subcode = 0x01; pMsg.iIndex = lpMsg->iIndex; pMsg.wMapSvrNum = lpMsg->wMapSvrNum; pMsg.wStartYear = lpMsg->wStartYear; pMsg.btStartMonth = lpMsg->btStartMonth; pMsg.btStartDay = lpMsg->btStartDay; pMsg.wEndYear = lpMsg->wEndYear; pMsg.btEndMonth = lpMsg->btEndMonth; pMsg.btEndDay = lpMsg->btEndDay; pMsg.iResult = FALSE; char szQuery[512]; sprintf(szQuery,"EXEC WZ_OG_ModifyOlympSchedule %d, '%d-%d-%d 00:00:00', '%d-%d-%d 00:00:00'", lpMsg->wMapSvrNum,lpMsg->wStartYear,lpMsg->btStartMonth,lpMsg->btStartDay, lpMsg->wEndYear,lpMsg->btEndMonth,lpMsg->btEndDay); if( g_MyEventDB.Exec(szQuery) == TRUE && g_MyEventDB.Fetch() != SQL_NO_DATA ) { pMsg.iResult = g_MyEventDB.GetInt("QueryResult"); } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
void LoadOlympInfo(LOLP_REQ_OLYMPINITDATA lpMsg,int aIndex) { OLP_ANS_OLYMPINITDATA pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof(pMsg); pMsg.h.headcode = 0x68; pMsg.h.subcode = 0x00; pMsg.wMapSvrNum = lpMsg->wMapSvrNum; pMsg.iResult = FALSE; char szQuery[512]; sprintf(szQuery,"EXEC WZ_OG_GetOlympTotalInfo %d, %d", lpMsg->wMapSvrNum,lpMsg->iOlympEventCycle); if( g_MyEventDB.Exec(szQuery) == TRUE && g_MyEventDB.Fetch() != SQL_NO_DATA ) { pMsg.wStartYear = (WORD)g_MyEventDB.GetInt("SYEAR"); pMsg.btStartMonth = (BYTE)g_MyEventDB.GetInt("SMONTH"); pMsg.btStartDay = (BYTE)g_MyEventDB.GetInt("SDAY"); pMsg.wEndYear = (WORD)g_MyEventDB.GetInt("EYEAR"); pMsg.btEndMonth = (BYTE)g_MyEventDB.GetInt("EMONTH"); pMsg.btEndDay = (BYTE)g_MyEventDB.GetInt("EDAY"); pMsg.btFirstCreate = g_MyEventDB.GetInt("FIRST_CREATE"); pMsg.iResult = TRUE; } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
void EGAnsEventChipInfo(LPMSG_REQ_VIEW_EC_MN lpMsg,int aIndex) { char szQuery[256]; char szAccountID[MAX_IDSTRING+1] = {0}; memcpy(szAccountID,lpMsg->szUID, MAX_IDSTRING); PMSG_ANS_VIEW_EC_MN pMsg; pMsg.h.c = 0xC1; pMsg.h.headcode = 0x01; pMsg.h.size = sizeof( pMsg ); pMsg.iINDEX = lpMsg->iINDEX; strcpy(pMsg.szUID,szAccountID); pMsg.szUID[10] = 0; sprintf(szQuery,"SELECT EventChips, Check_Code, MuttoNumber FROM T_MU2003_EVENT WHERE AccountID='%s'",szAccountID); if(g_EventDB.Exec(szQuery) != TRUE) { pMsg.bSUCCESS = FALSE; } else { if(g_EventDB.Fetch() != SQL_NO_DATA) { if(g_EventDB.GetInt("Check_Code") != 0) { pMsg.nEVENT_CHIPS = 0; } else { pMsg.nEVENT_CHIPS = g_EventDB.GetInt("EventChips"); } pMsg.iMUTO_NUM = g_EventDB.GetInt("MuttonNumber"); pMsg.bSUCCESS = TRUE; } else { g_EventDB.Clear(); sprintf(szQuery,"INSERT INTO T_MU2003_EVENT (AccountID) VALUES ('%s')",szAccountID); if(g_EventDB.Exec(szQuery) == FALSE) { pMsg.bSUCCESS = FALSE; } else { pMsg.nEVENT_CHIPS = 0; pMsg.iMUTO_NUM = 0; pMsg.bSUCCESS = TRUE; } } } g_EventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
void CustomQuestReqInfo(LPMSG_CUSTOMQUEST_REQUSER lpMsg,int aIndex) { char szName[MAX_IDSTRING+1]; szName[MAX_IDSTRING] = '\0'; memcpy(szName,lpMsg->szUserName,MAX_IDSTRING); PMSG_CUSTOMQUEST_ANSUSER pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof(pMsg); pMsg.h.headcode = 0x65; pMsg.h.subcode = 0x01; pMsg.result = FALSE; pMsg.aIndex = lpMsg->aIndex; memcpy(pMsg.szUserName,lpMsg->szUserName,MAX_IDSTRING); pMsg.QuestGroup = -1; pMsg.QuestIndex = -1; pMsg.QuestItem[0] = 0; pMsg.QuestItem[1] = 0; pMsg.QuestItem[2] = 0; char szQuery[256]; sprintf(szQuery,"SELECT QuestGroup,QuestIndex,QuestState,QuestItem_1,QuestItem_2,QuestItem_3 FROM T_CustomQuest WHERE CHAR_NAME = '%s'",szName); if( g_MyEventDB.Exec(szQuery) == TRUE ) { if( g_MyEventDB.Fetch() == SQL_NO_DATA ) { g_MyEventDB.Clear(); sprintf(szQuery,"INSERT INTO T_CustomQuest (CHAR_NAME,QuestGroup,QuestIndex,QuestState,QuestItem_1,QuestItem_2,QuestItem_3) VALUES ('%s',-1,-1,0,0,0,0)",szName); if( g_MyEventDB.Exec(szQuery) == TRUE ) { pMsg.result = TRUE; } } else { pMsg.result = TRUE; pMsg.QuestGroup = g_MyEventDB.GetInt("QuestGroup"); pMsg.QuestIndex = g_MyEventDB.GetInt("QuestIndex"); pMsg.QuestState = g_MyEventDB.GetInt("QuestState"); pMsg.QuestItem[0] = g_MyEventDB.GetInt("QuestItem_1"); pMsg.QuestItem[1] = g_MyEventDB.GetInt("QuestItem_2"); pMsg.QuestItem[2] = g_MyEventDB.GetInt("QuestItem_3"); } } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
int PartyMatchInfo(LPMSG_PARTYMATCHING_INFO_REQ lpMsg,PARTYMATCH_INFO* pBodyMsg,int& count,int& pages) { char szQuery[256]; long dwLen = 0; int TotalPages = 0; #ifdef ZTEAMDB sprintf(szQuery,"EXEC PartyMatching_GetList ?,%d,%d,'%s',%d,%d,%d", lpMsg->RequestPage,lpMsg->ReqType,lpMsg->szSearch, lpMsg->Level,lpMsg->Class,lpMsg->Gens); #else sprintf(szQuery,"EXEC WZ_PM_Listinfo ?,%d,%d,'%s',%d,%d,%d", lpMsg->RequestPage,lpMsg->ReqType,lpMsg->szSearch, lpMsg->Level,lpMsg->Class,lpMsg->Gens); #endif g_PartyMatchDB.BindParameterIntOutput(1,&TotalPages,&dwLen); if( !g_PartyMatchDB.Exec(szQuery) ) { g_PartyMatchDB.Clear(); return -1; } count = 0; int fResult; while( (fResult = g_PartyMatchDB.Fetch()) != SQL_NO_DATA && fResult != SQL_ERROR ) { pBodyMsg[count].btPartyCount = g_PartyMatchDB.GetInt("PartyCount"); pBodyMsg[count].LeaderLevel = g_PartyMatchDB.GetInt("LeaderLevel"); pBodyMsg[count].LeaderClass = g_PartyMatchDB.GetInt("LeaderClass"); pBodyMsg[count].LeaderChannel = g_PartyMatchDB.GetInt("LeaderChannel"); pBodyMsg[count].btClass = g_PartyMatchDB.GetInt("Class"); pBodyMsg[count].MinLevel = g_PartyMatchDB.GetInt("MinLevel"); pBodyMsg[count].MaxLevel = g_PartyMatchDB.GetInt("MaxLevel"); pBodyMsg[count].MoveReqId = g_PartyMatchDB.GetInt("MoveReqId"); pBodyMsg[count].Gens = g_PartyMatchDB.GetInt("Gens"); char szTmpPassword[8] = {0}; g_PartyMatchDB.GetStr("Password",szTmpPassword); pBodyMsg[count].btIsPassword = (strlen(szTmpPassword) > 1) ? TRUE : FALSE; g_PartyMatchDB.GetStr("PartyLeader",pBodyMsg[count].szLeader); g_PartyMatchDB.GetStr("Description",pBodyMsg[count].szDescription); count++; } while( g_PartyMatchDB.MoreResults() != SQL_NO_DATA ) { } pages = TotalPages; g_PartyMatchDB.Clear(); return 0; }
void CAccountTimeLimitDBCtrl::Handler( LPDB_OVERLAPPED_PLUS pov, DWORD dwCompletionKey ) { CAr ar( pov->lpBuf, pov->uBufSize ); switch( pov->nQueryMode ) { case QUERY_TIMELIMIT_LOAD: { DWORD dwPlayerId; int nPlayTime = -1; char szAccount[MAX_ACCOUNT]; ar >> dwPlayerId; ar.ReadString( szAccount, MAX_ACCOUNT ); CQuery* pQuery = GetQueryObject(); if( pQuery->Execute( "USP_AccountPlay_Select '%s'", szAccount ) ) { if( pQuery->Fetch() ) { nPlayTime = pQuery->GetInt( "PlayTime" ) * SEC( 1 ); // 초단위를 ms단위로 변환 DWORD dwLastPlayDate = static_cast<DWORD>( pQuery->GetInt( "PlayDate" ) ); int nYear = dwLastPlayDate/10000; dwLastPlayDate%=10000; int nMonth = dwLastPlayDate/100; dwLastPlayDate%=100; int nDay = dwLastPlayDate; CTime time( nYear, nMonth, nDay+1, 0, 0, 0 ); // 하루를 더한 값이 더 작으면 초기화.. if( time < CTime::GetCurrentTime() ) nPlayTime = 0; if( !prj.m_EventLua.IsTimeLimit() ) // 루아이벤트 스크립트에 베트남 제한 여부 설정 nPlayTime = 0; } } if( nPlayTime < 0 ) Error( "PlayTime is wrong - PlayerId : %d, PlayTime : %d", dwPlayerId, nPlayTime ); CDPTrans::GetInstance()->SendTimeLimitAck( dwPlayerId, nPlayTime, dwCompletionKey ); } break; case QUERY_TIMELIMIT_UPDATE: { char szAccount[MAX_ACCOUNT]; int nPlayTime; ar.ReadString( szAccount, MAX_ACCOUNT ); ar >> nPlayTime; nPlayTime /= SEC( 1 ); // ms 단위를 초단위로 변환 CTime time = CTime::GetCurrentTime(); DWORD dwLastDate = (time.GetYear()*10000) + (time.GetMonth()*100) + time.GetDay(); GetQueryObject()->Execute( "USP_AccountPlay_Update '%s', %d, %d", szAccount, dwLastDate, nPlayTime ); } break; } }
void CRainbowRaceDBCtrl::LoadRainbowRace( DPID dpId ) { CQuery* pQuery = GetQueryObject(); char szQuery[QUERY_SIZE] = {0,}; // m_nTimes 정보 가져오기.. 없으면 0 sprintf( szQuery, "RAINBOWRACE_STR 'S1', '%02d', 0, '0000000', 0", g_appInfo.dwSys ); if( pQuery->Exec( szQuery ) == FALSE ) { WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; } if( pQuery->Fetch() ) m_nTimes = pQuery->GetInt( "nTimes" ); if( m_nTimes == 0 ) { m_nTimes = 1; return; } // 신청자 목록 vector<DWORD> vec_dwNowPlayerId; sprintf( szQuery, "RAINBOWRACE_STR 'S2', '%02d', %d, '0000000', 0", g_appInfo.dwSys, m_nTimes ); if( pQuery->Exec( szQuery ) == FALSE ) { WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; } while( pQuery->Fetch() ) vec_dwNowPlayerId.push_back( static_cast<DWORD>( pQuery->GetInt( "m_idPlayer" ) ) ); if( vec_dwNowPlayerId.size() == 0 ) // 현재 신청자가 없으면 다음 회 진행... m_nTimes++; // 이전 대회 랭킹 vector<DWORD> vec_dwPrevRanking; if( m_nTimes > 1 ) // 현재가 2회 이상일때만..( 1회 이상 진행했을 경우 ) { sprintf( szQuery, "RAINBOWRACE_STR 'S3', '%02d', %d, '0000000', 0", g_appInfo.dwSys, m_nTimes ); if( pQuery->Exec( szQuery ) == FALSE ) { WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; } while( pQuery->Fetch() ) vec_dwPrevRanking.push_back( static_cast<DWORD>( pQuery->GetInt( "m_idPlayer" ) ) ); } CDPTrans::GetInstance()->SendRainbowRaceInfo( vec_dwNowPlayerId, vec_dwPrevRanking, dpId ); }
void ReqMarry(LPMSG_REQ_MARRYINFO lpMsg,int aIndex) { char szQuery[256]; char szName[MAX_IDSTRING+1] = {0}; char szTargetName[MAX_IDSTRING+1] = {0}; memcpy(szName,lpMsg->ReqName,MAX_IDSTRING); PMSG_ANS_MARRY pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x66; pMsg.h.subcode = 0x02; pMsg.Result = FALSE; pMsg.ReqIndex = lpMsg->ReqIndex; memcpy(pMsg.ReqName,szName,MAX_IDSTRING); sprintf(szQuery,"SELECT * FROM wedding WHERE husband = '%s' OR wife = '%s'", szName,szName); if( g_MyEventDB.Exec(szQuery) == TRUE ) { if( g_MyEventDB.Fetch() != SQL_NO_DATA ) { pMsg.Result = 2; char szWife[11] = {0}; char szHusband[11] = {0}; g_MyEventDB.GetStr("husband",szHusband); g_MyEventDB.GetStr("wife",szWife); if( strcmp(szWife,szName) == NULL) { memcpy(pMsg.MarriedName,szHusband,MAX_IDSTRING); } else { memcpy(pMsg.MarriedName,szWife,MAX_IDSTRING); } } else { pMsg.Result = 1; } } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof( pMsg )); }
void EGAnsEventStoneInfo(LPMSG_REQ_VIEW_EC_MN lpMsg,int aIndex) { char szQuery[256]; char szAccount[MAX_IDSTRING+1] = {0}; memcpy(szAccount,lpMsg->szUID,MAX_IDSTRING); PMSG_ANS_VIEW_STONES pMsg; pMsg.h.c = 0xC1; pMsg.h.headcode = 0x05; pMsg.h.size = sizeof(pMsg); strcpy(pMsg.szUID,szAccount); pMsg.iINDEX = lpMsg->iINDEX; pMsg.szUID[10] = 0; sprintf(szQuery,"SELECT StoneCount, Check_Code FROM T_BLOOD_CASTLE WHERE AccountID='%s'",szAccount); pMsg.bSUCCESS = FALSE; if(g_EventDB.Exec(szQuery) == TRUE) { if(g_EventDB.Fetch() != SQL_NO_DATA) { if(g_EventDB.GetInt("Check_Code") != 0) { pMsg.iStoneCount = 0; } else { pMsg.iStoneCount = g_EventDB.GetInt("StoneCount"); } pMsg.bSUCCESS = TRUE; } else { g_EventDB.Clear(); sprintf(szQuery,"INSERT INTO T_BLOOD_CASTLE (AccountID) VALUES ('%s')",szAccount); if(g_EventDB.Exec(szQuery) == TRUE) { pMsg.bSUCCESS = TRUE; pMsg.iStoneCount = 0; } } } g_EventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
void CHousingDBCtrl::LoadHousingInfo( DWORD dwPlayerId, DPID dpId ) { CHousing* pHousing = CHousingMng::GetInstance()->GetHousing( dwPlayerId ); if( !pHousing ) { pHousing = CHousingMng::GetInstance()->CreateHousing( dwPlayerId ); if( !pHousing ) // 생성 실패시 그냥 리턴.. return; // DB 로딩... CQuery* pQuery = GetQueryObject(); if( pQuery->Execute( "usp_Housing_Load '%02d', '%07d'", g_appInfo.dwSys, dwPlayerId ) ) { while( pQuery->Fetch() ) { HOUSINGINFO housingInfo; housingInfo.dwItemId = static_cast<DWORD>( pQuery->GetInt( "ItemIndex" ) ); housingInfo.tKeepTime = static_cast<time_t>( pQuery->GetInt64( "tKeepTime" ) ); housingInfo.bSetup = static_cast<BOOL>( pQuery->GetInt( "bSetup" ) ); housingInfo.vPos.x = pQuery->GetFloat( "x_Pos" ); housingInfo.vPos.y = pQuery->GetFloat( "y_Pos" ); housingInfo.vPos.z = pQuery->GetFloat( "z_Pos" ); housingInfo.fAngle = pQuery->GetFloat( "fAngle" ); ItemProp* pItemProp = prj.GetItemProp( housingInfo.dwItemId ); if( pItemProp && pItemProp->dwItemKind1 == IK1_HOUSING ) pHousing->SetFurnitureList( housingInfo, TRUE ); } if( pQuery->MoreResults() ) { while( pQuery->Fetch() ) pHousing->SetVisitAllow( pQuery->GetInt( "f_idPlayer" ), TRUE ); } } } // 하우징 정보를 월드서버에 전달... CDPTrans::GetInstance()->SendHousingLoadInfo( dwPlayerId, pHousing, dpId ); }
void DGPartyMatchReqList(PARTYMATCH_GDREQ_REQUESTLIST* lpData, int aIndex) { const int MaxSize = sizeof(PARTYMATCH_DGANS_REQUESTLIST_COUNT) + sizeof(PARTYMATCH_DGANS_REQUESTLIST_INFO) * 80; BYTE Buffer[MaxSize + 1] = { 0 }; int Offset = sizeof(PARTYMATCH_DGANS_REQUESTLIST_COUNT); // ---- PARTYMATCH_DGANS_REQUESTLIST_COUNT* lpAnswerCount = (PARTYMATCH_DGANS_REQUESTLIST_COUNT*)Buffer; PARTYMATCH_DGANS_REQUESTLIST_INFO* lpAnswerInfo = (PARTYMATCH_DGANS_REQUESTLIST_INFO*)&Buffer[Offset]; // ---- lpAnswerCount->h.c = PMHC_WORD; lpAnswerCount->h.headcode = 0xEF; lpAnswerCount->h.subcode = 0x04; lpAnswerCount->h.sizeH = SET_NUMBERH(Offset); lpAnswerCount->h.sizeL = SET_NUMBERL(Offset); lpAnswerCount->UserIndex = lpData->UserIndex; // ---- char Query[256]; long Len = 0; // ---- sprintf(Query, "EXEC PartyMatching_GetRequestList '%s'", lpData->PartyLeader); // ---- if( !g_PartyMatchDB.Exec(Query) ) { g_PartyMatchDB.Clear(); DataSend(aIndex, (LPBYTE)lpAnswerCount, Offset); return; } // ---- int Result, Count = 0; // ---- while( (Result = g_PartyMatchDB.Fetch()) != SQL_NO_DATA && Result != SQL_ERROR ) { g_PartyMatchDB.GetStr("Name", lpAnswerInfo[Count].Character); lpAnswerInfo[Count].Class = g_PartyMatchDB.GetInt("SenderClass"); lpAnswerInfo[Count].Level = g_PartyMatchDB.GetInt("SenderLevel"); Offset += sizeof(PARTYMATCH_DGANS_REQUESTLIST_INFO); Count++; } // ---- while( g_PartyMatchDB.MoreResults() != SQL_NO_DATA ) { } // ---- g_PartyMatchDB.Clear(); // ---- lpAnswerCount->h.sizeH = SET_NUMBERH(Offset); lpAnswerCount->h.sizeL = SET_NUMBERL(Offset); lpAnswerCount->Count = Count; // ---- DataSend(aIndex, (LPBYTE)Buffer, Offset); }
void LoadNoblessInfo(LPMSG_REQ_NOBLESSINFO lpMsg,int aIndex) { char szName[MAX_IDSTRING+1]; memcpy(szName,lpMsg->szName,MAX_IDSTRING); szName[MAX_IDSTRING] = '\0'; PMSG_ANS_NOBLESSINFO pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof(pMsg); pMsg.h.headcode = 0x66; pMsg.h.subcode = 0x10; pMsg.aIndex = lpMsg->aIndex; memcpy(pMsg.szName,szName,MAX_IDSTRING); pMsg.btResult = TRUE; char szQuery[512]; sprintf(szQuery,"SELECT NoblessRank,NoblessPts FROM NoblessInfo WHERE CHAR_NAME = '%s'", szName); if( !g_MyEventDB.Exec(szQuery) ) { pMsg.btResult = FALSE; } else { if( g_MyEventDB.Fetch() == SQL_NO_DATA ) { g_MyEventDB.Clear(); sprintf(szQuery,"INSERT INTO NoblessInfo (CHAR_NAME,NoblessRank,NoblessPts) VALUES ('%s',0,0)", szName); g_MyEventDB.Exec(szQuery); pMsg.NoblessRank = 0; pMsg.NoblessPts = 0; } else { pMsg.NoblessRank = g_MyEventDB.GetInt("NoblessRank"); pMsg.NoblessPts = g_MyEventDB.GetInt("NoblessPts"); } } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
BOOL CCoupleController::Restore() { CQuery* pQuery = CreateQuery(); if( !pQuery ) return FALSE; if( !pQuery->Execute( "uspRestoreCouple %d", g_appInfo.dwSys ) ) { Error( "couldn't execute uspRestoreCouple" ); return FALSE; } while( pQuery->Fetch() ) { int nExperience = pQuery->GetInt( "nExperience" ); u_long idFirst = pQuery->GetInt( "idFirst" ); u_long idSecond = pQuery->GetInt( "idSecond" ); CCouple* pCouple = new CCouple( idFirst, idSecond ); m_pHelper->Couple( pCouple ); pCouple->AddExperience( nExperience ); } pQuery->Clear(); if( !pQuery->Execute( "uspRestorePropose %d", g_appInfo.dwSys ) ) { Error( "couldn't execute uspRestorePropose" ); return FALSE; } while( pQuery->Fetch() ) { u_long idProposer = pQuery->GetInt( "idProposer" ); time_t tPropose = pQuery->GetInt( "tPropose" ); bool bResult = m_pHelper->AddPropose( idProposer, tPropose ); ASSERT( bResult ); } SAFE_DELETE( pQuery ); return FALSE; }
void PartyMatchUpdateStatus(LPSTR szName, BYTE Status) { char szQuery[256]; sprintf(szQuery,"SELECT * FROM PartyMatching_InfoData WHERE PartyLeader = '%s'", szName); g_PartyMatchDB.Exec(szQuery); if( g_PartyMatchDB.Fetch() != SQL_NO_DATA ) { g_PartyMatchDB.Clear(); ZeroMemory(szQuery, sizeof(szQuery)); sprintf(szQuery,"UPDATE PartyMatching_InfoData SET Status = %d WHERE PartyLeader = '%s'", Status, szName); g_PartyMatchDB.Exec(szQuery); } g_PartyMatchDB.Clear(); }
void ReqSummonPetInfo(LPBMSG_REQSUMMONINFO lpMsg,int aIndex) { char szQuery[256]; char szName[MAX_IDSTRING+1] = {0}; memcpy(szName,lpMsg->szName,MAX_IDSTRING); g_Window.ServerLogAdd(ST_EVENTSERVER,"[SUMMON PET] Data request (%s)",szName); PBMSG_ANSSUMMONINFO pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x66; pMsg.h.subcode = 0; pMsg.aIndex = lpMsg->aIndex; strcpy(pMsg.szName,szName); pMsg.result = FALSE; sprintf(szQuery,"SELECT summon_level, summon_exp FROM T_SummonPet_Info WHERE memb__char = '%s'",szName); if( g_MyEventDB.Exec(szQuery) == TRUE ) { pMsg.result = TRUE; pMsg.Level = 0; pMsg.Exp = 0; if( g_MyEventDB.Fetch() != SQL_NO_DATA ) { pMsg.Level = g_MyEventDB.GetInt("summon_level"); pMsg.Exp = g_MyEventDB.GetInt64("summon_exp"); } else { g_MyEventDB.Clear(); sprintf(szQuery,"INSERT INTO T_SummonPet_Info (memb__char,summon_level,summon_exp) VALUES ('%s',1,0)",szName); g_MyEventDB.Exec(szQuery); } } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof( pMsg )); }
//--------------------Database Operations---------------------- BOOL CArena::Load( void ) { CQuery* pQuery = new CQuery; if( pQuery->Connect( 3, "Character01", "", "" ) == FALSE ) { pQuery->DisConnect(); SAFE_DELETE( pQuery ); return FALSE; } if( pQuery->Exec( "SELECT * FROM dbo.ARENA" ) == FALSE ) { pQuery->DisConnect(); SAFE_DELETE( pQuery ); return FALSE; } while( pQuery->Fetch() ) { char szQryName[MAX_NAME] = { 0, }; ARENAPLAYER dbPlayer; u_long idPlayer = static_cast<u_long>( pQuery->GetInt64( "m_idPlayer" ) ); dbPlayer.nKill = static_cast<u_int>( pQuery->GetInt64( "m_nKill" ) ); dbPlayer.nDeath = static_cast<u_int>( pQuery->GetInt64( "m_nDeath" ) ); dbPlayer.nRow = static_cast<u_int>( pQuery->GetInt64( "m_nRow" ) ); dbPlayer.nJob = static_cast<u_int>( pQuery->GetInt64( "m_nJob" ) ); dbPlayer.nDeathMatchWin = static_cast<u_int>( pQuery->GetInt64( "m_nDeathMatchWin" ) ); dbPlayer.nDeathMatchLose = static_cast<u_int>( pQuery->GetInt64( "m_nDeathMatchLose" ) ); dbPlayer.nDuelWin = static_cast<u_int>( pQuery->GetInt64( "m_nDuelWin" ) ); dbPlayer.nDuelLose = static_cast<u_int>( pQuery->GetInt64( "m_nDuelLose" ) ); dbPlayer.n64ArenaPoint = pQuery->GetInt64( "m_nArenaPoint" ); pQuery->GetStr( "m_szName", szQryName ); dbPlayer.szName = CString( szQryName ); m_mArenaMap.insert( make_pair( idPlayer, dbPlayer ) ); } pQuery->DisConnect(); SAFE_DELETE( pQuery ); return TRUE; }
void Divorce(LPMSG_REQ_DIVORCE lpMsg,int aIndex) { char szQuery[256]; char szName[MAX_IDSTRING+1] = {0}; memcpy(szName,lpMsg->szName,MAX_IDSTRING); sprintf(szQuery,"SELECT * FROM wedding WHERE husband = '%s' OR wife = '%s'", szName,szName); PMSG_ANS_DIVORCE pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof(pMsg); pMsg.h.headcode = 0x66; pMsg.h.subcode = 0x04; pMsg.btResult = FALSE; if( g_MyEventDB.Exec(szQuery) == TRUE ) { if( g_MyEventDB.Fetch() == SQL_NO_DATA ) { pMsg.btResult =2; } else { g_MyEventDB.GetStr("wife",pMsg.Wife); g_MyEventDB.GetStr("husband",pMsg.Husband); g_MyEventDB.Clear(); sprintf(szQuery,"DELETE FROM wedding WHERE husband = '%s' OR wife = '%s'",szName,szName); if( g_MyEventDB.Exec(szQuery) == TRUE ) { pMsg.btResult = TRUE; } } } g_MyEventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,sizeof( pMsg )); }
void EGAnsDeleteStones(LPMSG_REQ_DELETE_STONES lpMsg,int aIndex) { char szQuery[256]; char szAccount[MAX_IDSTRING+1] = {0}; memcpy(szAccount,lpMsg->szUID,MAX_IDSTRING); PMSG_ANS_DELETE_STONES pMsg; pMsg.h.c = 0xC1; pMsg.h.headcode = 0x07; pMsg.h.size = sizeof( pMsg ); strcpy(pMsg.szUID,szAccount); pMsg.szUID[10] = 0; pMsg.iINDEX = lpMsg->iINDEX; pMsg.bSUCCESS = FALSE; sprintf(szQuery,"SELECT StoneCount FROM T_BLOOD_CASTLE WHERE AccountID='%s'",szAccount); if( g_EventDB.Exec(szQuery) == TRUE && g_EventDB.Fetch() != SQL_NO_DATA ) { int Stones = g_EventDB.GetInt("StoneCount"); g_EventDB.Clear(); if(Stones >= lpMsg->iStoneCount) { sprintf(szQuery,"UPDATE T_BLOOD_CASTLE SET StoneCount = StoneCount - %d WHERE AccountID='%s'",Stones,szAccount); if(g_EventDB.Exec(szQuery) == TRUE) { pMsg.bSUCCESS = TRUE; pMsg.iStoneCount = Stones; } } } g_EventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
int PartyMatchCancel(char* szName,int Type) { int iResult = 0; char szQuery[256]; #ifdef ZTEAMDB sprintf(szQuery,"EXEC PartyMatching_Cancel '%s',%d",szName,Type); #else sprintf(szQuery,"EXEC WZ_PM_Cancel '%s',%d",szName,Type); #endif if( !g_PartyMatchDB.Exec(szQuery) || g_PartyMatchDB.Fetch() == SQL_NO_DATA ) { g_PartyMatchDB.Clear(); return 2; } iResult = g_PartyMatchDB.GetInt("CancelResult"); g_PartyMatchDB.Clear(); return iResult; }
int PartyMatchWaitInfo(char* szName,int& ServerCode,char* szPartyLeader) { char szQuery[256]; #ifdef ZTEAMDB sprintf(szQuery,"EXEC PartyMatching_Waiting '%s'",szName); #else sprintf(szQuery,"EXEC WZ_PM_Waiting '%s'",szName); #endif if( !g_PartyMatchDB.Exec(szQuery) || g_PartyMatchDB.Fetch() == SQL_NO_DATA ) { g_PartyMatchDB.Clear(); return -1; } ServerCode = g_PartyMatchDB.GetInt("PartyChannel"); g_PartyMatchDB.GetStr("PartyLeader",szPartyLeader); g_PartyMatchDB.Clear(); return 0; }
void EGAnsRegEventChipInfo(LPMSG_REQ_REGISTER_EVENTCHIP lpMsg,int aIndex) { char szQuery[256]; char szAccount[MAX_IDSTRING+1] = {0}; memcpy(szAccount,lpMsg->szUID,MAX_IDSTRING); PMSG_ANS_REGISTER_EVENTCHIP pMsg; pMsg.h.c = 0xC1; pMsg.h.headcode = 0x02; pMsg.h.size = sizeof( pMsg ); pMsg.iINDEX = lpMsg->iINDEX; pMsg.Pos = lpMsg->Pos; strcpy(pMsg.szUID,szAccount); pMsg.szUID[10] = 0; pMsg.bSUCCESS = FALSE; sprintf(szQuery,"UPDATE T_MU2003_EVENT SET EventChips = EventChips + 1 WHERE AccountID = '%s'",szAccount); if(g_EventDB.Exec(szQuery) == TRUE) { g_EventDB.Clear(); sprintf(szQuery,"SELECT EventChips FROM T_MU2003_EVENT WHERE AccountID='%s'",szAccount); if(g_EventDB.Exec(szQuery) == TRUE && g_EventDB.Fetch() != SQL_NO_DATA) { pMsg.bSUCCESS = TRUE; pMsg.nEVENT_CHIPS = g_EventDB.GetInt("EventChips"); } } g_EventDB.Clear(); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }