void ProtocolCoreSend(int aIndex, PBYTE aSend, int aLen) { OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex); if(aSend[0] == 0xC1 || aSend[0] == 0xC3) { switch(aSend[2]) { case 0x24: { Protocol.CheckRingSend(gObj, aSend); } break; } } DataSend(aIndex,aSend,aLen); }
BOOL NpcCastleHuntZoneGuard(LPOBJ lpNpc, LPOBJ lpObj) { if(gObjIsConnected(lpObj->m_Index) == FALSE) return TRUE; if((lpObj->m_IfState.use) > 0) return TRUE; PMSG_ANS_GUARD_IN_CASTLE_HUNTZONE pResult = {0}; PHeadSubSetB((PBYTE)&pResult,0xB9,0x03,sizeof(pResult)); pResult.btResult = 1; pResult.iMaxPrice = 300000; pResult.iUnitOfPrice = 10000; pResult.btUsable = FALSE; pResult.iCurrentPrice = 0; pResult.iCurrentPrice = g_CastleSiegeSync.GetTaxHuntZone(lpObj->m_Index,FALSE); if(g_CastleSiege.GetHuntZoneEnter() != FALSE) { pResult.btUsable = TRUE; } if(lpObj->lpGuild != FALSE) { if(g_CastleSiege.CheckCastleOwnerUnionMember(lpObj->m_Index) != FALSE) { pResult.btResult = 2; } if(g_CastleSiege.CheckCastleOwnerMember(lpObj->m_Index) != FALSE && lpObj->GuildStatus == G_MASTER) { pResult.btResult = 3; } } else if(g_CastleSiege.GetHuntZoneEnter()) { pResult.btResult = 1; } DataSend(lpObj->m_Index,(PBYTE)&pResult,pResult.h.size); return TRUE; }
BOOL NpcDarkSpiritTrainer(LPOBJ lpNpc, LPOBJ lpObj) { if ( bCanChaosBox == TRUE ) { PMSG_TALKRESULT pMsg; pMsg.h.c = 0xC3; pMsg.h.headcode = 0x30; pMsg.h.size = sizeof(pMsg); if ( lpObj->m_bPShopOpen == true ) { LogAdd("[%s][%s] is Already Opening PShop, ChaosBox Failed", lpObj->AccountID, lpObj->Name); GCServerMsgStringSend(lMsg.Get(MSGGET(4, 194)), lpObj->m_Index, 1); return TRUE; } lpObj->m_IfState.type = 13; lpObj->m_IfState.state = 0; lpObj->m_IfState.use = 1; pMsg.result = 0x07; lpObj->bIsChaosMixCompleted = false; pMsg.level1 = gDQChaosSuccessRateLevel1; pMsg.level2 = gDQChaosSuccessRateLevel2; pMsg.level3 = gDQChaosSuccessRateLevel3; pMsg.level4 = gDQChaosSuccessRateLevel4; pMsg.level5 = gDQChaosSuccessRateLevel5; pMsg.level6 = gDQChaosSuccessRateLevel6; DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); GCAnsCsMapSvrTaxInfo(lpObj->m_Index, 1, g_CastleSiegeSync.GetTaxRateChaos(lpObj->m_Index)); gObjInventoryTrans(lpObj->m_Index); LogAddTD("[%s][%s] Open Chaos Box", lpObj->AccountID, lpObj->Name); gObjItemTextSave(lpObj); gObjWarehouseTextSave(lpObj); } return TRUE; }
void CGReqQuestSwitch(PMSG_REQ_QUESTEXP *pMsg, int aIndex) { if( !OBJMAX_RANGE(aIndex) ) return; OBJECTSTRUCT* lpObj = &gObj[aIndex]; if( !gObjIsConnected(aIndex) ) return; if( !g_QuestExpProgMng.ChkQuestIndexIDToEpLimit(pMsg->quest_info_index_id, aIndex) ) { LogAddTD("[QuestExp] - Error - [%s] [%d]", __FILE__, __LINE__); return; } LogAddTD( "[QuestExp] Selection Episode List Choose One [%s][%s] QuestInfoIndexID[0x%x] Choose[%d]", gObj[aIndex].AccountID, gObj[aIndex].Name, pMsg->quest_info_index_id, pMsg->choose); lua_State* L = g_MuLuaQuestExp.GetLua(); if( !L ) { LogAddTD("[QuestExp] - Error - [%s] [%d]", __FILE__, __LINE__); return; } if( g_QuestExpUserMng.IsQuestAccept(pMsg->quest_info_index_id, aIndex) ) { g_Generic_Call(L, "CGReqQuestSwitch", "iii>", pMsg->quest_info_index_id, pMsg->choose, aIndex); } else { PMSG_ANS_QUESTEXP pAnsMsg; pAnsMsg.result = 1; PHeadSubSetB((LPBYTE)&pAnsMsg, 0xF6u, 0, 5); DataSend(gObj[aIndex].m_Index, (LPBYTE)&pAnsMsg, sizeof(pAnsMsg)); } }
void cDuelSystem::SendSpectatorRemove(short iSpecIndex, int iRoom) { if(iRoom < 0 || iRoom >= MAX_DUEL_ROOMS) { return; } if(iSpecIndex < 0 || iSpecIndex >= MAX_DUEL_SEPARATORS) { return; } if(this->g_DuelRooms[iRoom].szSeparators[iSpecIndex] == NULL) { return; } if(this->g_DuelRooms[iRoom].szlpObjOne == NULL || this->g_DuelRooms[iRoom].szlpObjTy == NULL) { return; } PMSG_DUEL_SPEC_ADD pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof(pMsg); pMsg.h.headcode = 0xAA; pMsg.h.subcode = 0x0A; memcpy(pMsg.szName, this->g_DuelRooms[iRoom].szSeparators[iSpecIndex]->Name, 10); for(short i = 0; i < MAX_DUEL_SEPARATORS; ++i) { if(i == iSpecIndex) { continue; } if(this->g_DuelRooms[iRoom].szSeparators[i] != NULL) { DataSend(this->g_DuelRooms[iRoom].szSeparators[i]->m_Index, (BYTE*)&pMsg, pMsg.h.size); } } }
//00554960 -> 100% void CMasterLevelSystem::GCMasterLevelUpInfo(LPOBJ lpObj) //OK { PMSG_MASTERLEVEL_UP pMsg; PHeadSubSetB(&pMsg.h.c, 0xF3, 0x51, 0x20); // ---- pMsg.nMLevel = lpObj->m_nMasterLevel; pMsg.nAddMLPoint = 1; pMsg.nMLPoint = lpObj->m_iMasterLevelPoint; pMsg.nMaxMLPoint = MASTER_MAX_POINT; pMsg.wMaxLife = (double)lpObj->AddLife + lpObj->MaxLife; pMsg.wMaxMana = (double)lpObj->AddMana + lpObj->MaxMana; pMsg.wMaxShield = LOWORD(lpObj->iAddShield) + LOWORD(lpObj->iMaxShield); pMsg.wMaxBP = LOWORD(lpObj->AddBP) + LOWORD(lpObj->MaxBP); // ---- DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); GCSendEffectInfo(lpObj->m_Index, 16); // ---- LogAddTD("[%s][%s] Master Level Up :%d, MLPoint:%d/%d", lpObj->AccountID, lpObj->Name, lpObj->m_nMasterLevel, lpObj->m_iMasterLevelPoint, MASTER_MAX_POINT); }
void TNotice::SendToAllUser(LPSTR szMsg, ...) { #ifdef GS_UNICODE unsigned char szTempMsg[4096]={0}; #endif va_list pArguments; #ifdef GS_UNICODE memset(this->m_Notice.Notice , 0, sizeof(this->m_Notice.Notice )); #endif va_start(pArguments, szMsg); #ifdef GS_UNICODE vsprintf((char*)szTempMsg, (char*)szMsg, pArguments); #else vsprintf_s(this->m_Notice.Notice, (char*)szMsg, pArguments); #endif va_end(pArguments); #ifdef GS_UNICODE MultiByteToWideChar( 1258, 0, (char*)szTempMsg, strlen((char*)szTempMsg), (unsigned short*)this->m_Notice.Notice, sizeof(this->m_Notice.Notice) ); this->m_Notice.Notice[254] = 0; this->m_Notice.Notice[255] =0; PHeadSetB( &this->m_pNotice.PacketHeader, 0x0D, wcslen((unsigned short*)this->m_Notice.Notice )*2 + 0x12); #else PHeadSetB((LPBYTE)&this->m_Notice, 0x0D, strlen(this->m_Notice.Notice) + sizeof(PMSG_NOTICE) - sizeof(this->m_Notice.Notice) + 1); #endif for ( int n = OBJ_STARTUSERINDEX ; n < OBJMAX ; n++) { if ( gObj[n].Connected == PLAYER_PLAYING ) { if ( gObj[n].Type == OBJ_USER ) { DataSend(n, (LPBYTE)&this->m_Notice , this->m_Notice.h.size ); } } } }
void DGRequestGensInfo(PMSG_REQ_GENS_INFO* lpMsg,int aIndex) { char szName[MAX_IDSTRING+1]; memcpy(szName,lpMsg->szName,MAX_IDSTRING); szName[10] = '\0'; PMSG_ANS_GENS_INFO pMsg = {0}; pMsg.h.c = 0xC1; pMsg.h.size = sizeof(pMsg); pMsg.h.headcode = 0x40; pMsg.h.subcode = 0x01; pMsg.aIndex = lpMsg->aIndex; GetGensInfo(szName,&pMsg); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
BOOL NpcEventChipNPC(LPOBJ lpNpc, LPOBJ lpObj) { if ( (lpObj->m_IfState.use) > 0 ) { return TRUE; } if ( lpNpc->MapNumber == 0 ) { PMSG_REQ_VIEW_EC_MN pMsgTha; PHeadSetB((LPBYTE)&pMsgTha, 0x01, sizeof(pMsgTha)); pMsgTha.iINDEX = lpObj->m_Index; strcpy(pMsgTha.szUID, lpObj->AccountID); pEventObj = lpNpc; DataSendEventChip((char*)&pMsgTha, sizeof(pMsgTha)); lpObj->m_IfState.type = 9; lpObj->m_IfState.state = 0; lpObj->m_IfState.use = 1; return TRUE; } if ( lpNpc->MapNumber == 2 ) { PMSG_EVENTCHIPINFO Result; PHeadSetB((LPBYTE)&Result, 0x94, sizeof(Result)); Result.Type = 2; DataSend(lpObj->m_Index, (LPBYTE)&Result, Result.h.size); lpObj->m_IfState.type = 9; lpObj->m_IfState.state = 0; lpObj->m_IfState.use = 1; return TRUE; } return FALSE; }
void DGAnsCastleTributeMoney(LPCSP_REQ_CASTLETRIBUTEMONEY lpMsg,int aIndex) { CSP_ANS_MONEYCHANGE pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x80; pMsg.h.subcode = 0x18; pMsg.wMapSvrNum = lpMsg->wMapSvrNum; pMsg.iResult = FALSE; if(lpMsg->iCastleTributeMoney > 0) { pMsg.iResult = CastleTributeMoney(lpMsg->wMapSvrNum,lpMsg->iCastleTributeMoney,&pMsg.i64CastleMoney); } DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
void DGAnsCastleNpcBuy(LPCSP_REQ_NPCBUY lpMsg,int aIndex) { CSP_ANS_NPCBUY pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x80; pMsg.h.subcode = 0x03; pMsg.iIndex = lpMsg->iIndex; pMsg.wMapSvrNum = lpMsg->wMapSvrNum; pMsg.iBuyCost = lpMsg->iBuyCost; pMsg.iNpcIndex = lpMsg->iNpcIndex; pMsg.iNpcNumber = lpMsg->iNpcNumber; pMsg.iResult = CastleNpcBuy(lpMsg); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
void DGRequestLeaveGens(PMSG_REQ_LEAVE_GENS* lpMsg,int aIndex) { char szName[MAX_IDSTRING+1]; memcpy(szName,lpMsg->szName,MAX_IDSTRING); szName[10] = '\0'; PMSG_ANS_LEAVE_GENS pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof(pMsg); pMsg.h.headcode = 0x40; pMsg.h.subcode = 0x04; pMsg.aIndex = lpMsg->aIndex; LeaveGens(szName,lpMsg->btGens,&pMsg); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
void DGAnsCastleNpcRepair(LPCSP_REQ_NPCREPAIR lpMsg,int aIndex) { CSP_ANS_NPCREPAIR pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x80; pMsg.h.subcode = 0x04; pMsg.iIndex = lpMsg->iIndex; pMsg.wMapSvrNum = lpMsg->wMapSvrNum; pMsg.iNpcIndex = lpMsg->iNpcIndex; pMsg.iNpcNumber = lpMsg->iNpcNumber; pMsg.iRepairCost = lpMsg->iRepairCost; pMsg.iResult = CastleNpcRepair(lpMsg,&pMsg); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
void PCPointShop::DecreasePoints(DWORD PlayerID,int Points) { int ID=PlayerID-MIN_PLAYERID; if(pObjGS[ID].PCPlayerPoints-Points<0) { pObjGS[ID].PCPlayerPoints=0; } else { pObjGS[ID].PCPlayerPoints-=Points; //this->SendPoints(PlayerID); } pObjGS[ID].PCInfoMod=1; pObjGS[ID].PCInfoReceived=1; BYTE Packet[8] = {0xC1, 0x08 , 0xD0 , 0x04 , LOBYTE(pObjGS[ID].PCPlayerPoints) , HIBYTE(pObjGS[ID].PCPlayerPoints) , LOBYTE(MaxPlayerPoints) , HIBYTE(MaxPlayerPoints)}; DataSend(PlayerID,(PBYTE)Packet,Packet[1]); }
void GuildMatch::DGAnsJoinReqDelete(GUILDMATCH_DGANS_OFFERDELETE* lpData) { if( !OBJMAX_RANGE(lpData->UserIndex) || gObj[lpData->UserIndex].Connected != PLAYER_PLAYING ) { return; } // ---- GUILDMATCH_GCANS_JOINREQDELETE lpAnswer = { 0 }; lpAnswer.h.c = 0xC1; lpAnswer.h.headcode = 0xED; lpAnswer.h.subcode = 0x05; lpAnswer.h.size = sizeof(GUILDMATCH_GCANS_JOINREQDELETE); // ---- if( lpData->Result == 1 ) { DataSend(lpData->UserIndex, (LPBYTE)&lpAnswer, sizeof(GUILDMATCH_GCANS_JOINREQDELETE)); } }
void DGAnsCastleOwnerChange(LPCSP_REQ_CASTLEOWNERCHANGE lpMsg,int aIndex) { CSP_ANS_CASTLEOWNERCHANGE pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x80; pMsg.h.subcode = 0x0C; pMsg.bIsCastleOccupied = lpMsg->bIsCastleOccupied; char szOwnerGuildName[9] = {0}; memcpy(szOwnerGuildName,lpMsg->szOwnerGuildName,0x08); memcpy(pMsg.szOwnerGuildName,lpMsg->szOwnerGuildName,0x08); pMsg.iResult = CastleOwnerChange(lpMsg->wMapSvrNum,lpMsg->bIsCastleOccupied,szOwnerGuildName); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
void JGGetMasterInfo(LPSDHP_DBMASTERINFOREQUEST lpMsg,int aIndex) { char szName[MAX_IDSTRING+1]; memcpy(szName,lpMsg->szName,MAX_IDSTRING); szName[10] = 0; PMSG_ANS_MASTERINFO pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof(pMsg); pMsg.h.headcode = 0x30; pMsg.Index = lpMsg->Index; memcpy(pMsg.szName,szName,MAX_IDSTRING); pMsg.szName[10] = 0; pMsg.result = GetMasterInfo(&pMsg,szName); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }
void DGAnsPeriodItemInsert(LPMSG_REQ_PERIODITEM_INSERT lpMsg,int aIndex) { PMSG_ANS_PERIODITEM_INSERT pMsg; pMsg.head.c = PMHC_BYTE; pMsg.head.size = sizeof( pMsg ); pMsg.head.headcode = 0xD0; pMsg.head.subcode = 0x04; pMsg.iUserIndex = lpMsg->iUserIndex; pMsg.iItemPeriodDate = lpMsg->iItemPeriodDate; pMsg.btItemEffectType1 = lpMsg->btItemEffectType1; pMsg.btItemEffectType2 = lpMsg->btItemEffectType2; pMsg.iItemCode = lpMsg->iItemCode; pMsg.btResult = InsertPeriodItem(lpMsg); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.head.size); }
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 )); }
BOOL NpcChaosCardMaster(LPOBJ lpNpc, LPOBJ lpObj) { if ( g_bUseLotterySystem == FALSE ) return FALSE; if ( bCanChaosBox == TRUE ) { if ( lpObj->m_IfState.use > 0 ) return FALSE; if ( lpObj->m_bPShopOpen == true ) { LogAdd("[%s][%s] is Already Opening PShop, ChaosBox Failed", lpObj->AccountID, lpObj->Name); GCServerMsgStringSend(lMsg.Get(MSGGET(4,194)), lpObj->m_Index, 1); return TRUE; } PMSG_TALKRESULT pMsg; pMsg.h.c = 0xC3; pMsg.h.headcode = 0x30; pMsg.h.size = sizeof(pMsg); pMsg.result = 0x15; DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size); lpObj->m_IfState.use = 1; lpObj->m_IfState.type = 7; gObjInventoryTrans(lpObj->m_Index); LogAddTD("[JewelMix] [%s][%s] Jewel Mix Dealer Start", lpObj->AccountID, lpObj->Name); gObjItemTextSave(lpObj); gObjWarehouseTextSave(lpObj); } return TRUE; }
BOOL NpcLugard(LPOBJ lpNpc,LPOBJ lpObj) { if( !gObjIsConnected(lpObj->m_Index) ) return true; PMSG_TALKRESULT pMsg; pMsg.h.c = 0xC3; pMsg.h.headcode = 0x30; pMsg.h.size = sizeof(pMsg); pMsg.result = 35; pMsg.level1 = gDoubleGoer.GetOpenTime()/60; pMsg.level2 = gDoubleGoer.GetOpenTime()%60; lpObj->m_IfState.use = 1; lpObj->m_IfState.type = 21; DataSend(lpObj->m_Index,(LPBYTE)&pMsg,pMsg.h.size); return true; }
void ConnectEx::SendClose(int UserIndex) { /*if( g_License.GetLicenseID() != Customer::Zeon && g_License.GetLicenseID() != Customer::Refinery && g_License.GetLicenseID() != Customer::Bereznuk && g_License.GetLicenseID() != Customer::Reedlan && g_License.GetLicenseID() != Customer::MUAngel && g_License.GetLicenseID() != Customer::MUAngel2 && g_License.GetLicenseID() != Customer::White && g_License.GetLicenseID() != Customer::White2 && g_License.GetLicenseID() != Customer::drynea && g_License.GetLicenseID() != Customer::virnet ) { return; }*/ // ---- CONNECTEX_CLOSE pRequest; pRequest.h.set((LPBYTE)&pRequest, 0xFB, 0xC, sizeof(CONNECTEX_CLOSE)); DataSend(UserIndex, (LPBYTE)&pRequest, pRequest.h.size); }
void DGAnsGuildMarkRegInfo(LPCSP_REQ_GUILDREGINFO lpMsg,int aIndex) { CSP_ANS_GUILDREGINFO pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x80; pMsg.h.subcode = 0x0A; pMsg.iIndex = lpMsg->iIndex; pMsg.wMapSvrNum = lpMsg->wMapSvrNum; char szGuildName[9] = {0}; memcpy(szGuildName,lpMsg->szGuildName,8); memcpy(pMsg.szGuildName,lpMsg->szGuildName,8); pMsg.iResult = GuildMarkRegInfo(lpMsg->wMapSvrNum,szGuildName,&pMsg); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
void CCrywolfUtil::SendCrywolfUserAnyMsg(int iType, LPSTR lpszMsg, ...) { if ( !lpszMsg ) return; char szBuffer[512] = ""; va_list pArguments; va_start(pArguments, lpszMsg); vsprintf(szBuffer, lpszMsg, pArguments); va_end(pArguments); PMSG_NOTICE pNotice; switch ( iType ) { case 1: TNotice::MakeNoticeMsg(&pNotice, 0, szBuffer); TNotice::SetNoticeProperty(&pNotice, 10, _ARGB(255, 255, 200, 80), 1, 0, 20); break; case 2: TNotice::MakeNoticeMsg(&pNotice, 0, szBuffer); break; } for ( int i=OBJ_STARTUSERINDEX;i<OBJMAX;i++) { if ( gObj[i].Connected == PLAYER_PLAYING ) { if ( gObj[i].Type == OBJ_USER ) { if ( gObj[i].MapNumber == MAP_INDEX_CRYWOLF_FIRSTZONE ) { DataSend(i, (LPBYTE)&pNotice, pNotice.h.size); } } } } }
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); }
void cDuelSystem::SendDuelStatus(LPOBJ lpObj) { PMSG_DUEL_STATUS pMsg; pMsg.h.c = 0xC1; pMsg.h.size = sizeof(pMsg); pMsg.h.headcode = 0xAA; pMsg.h.subcode = 0x06; ZeroMemory(&pMsg.pRoomStatus, sizeof(pMsg.pRoomStatus)); for(short i = 0; i < MAX_DUEL_ROOMS; ++i) { if(this->g_DuelRooms[i].RoomFree == FALSE) { if(this->g_DuelRooms[i].szlpObjOne == NULL || this->g_DuelRooms[i].szlpObjTy == NULL) { continue; } pMsg.pRoomStatus[i].btDuelRunning = TRUE; int szSeparatorCount = this->GetSpectatorCount(i); if(szSeparatorCount < 0 || szSeparatorCount >= 10) { pMsg.pRoomStatus[i].btDuelOpen = FALSE; } else { pMsg.pRoomStatus[i].btDuelOpen = TRUE; } memcpy(&pMsg.pRoomStatus[i].szName1[0], &this->g_DuelRooms[i].szlpObjOne->Name[0], 10); memcpy(&pMsg.pRoomStatus[i].szName2[0], &this->g_DuelRooms[i].szlpObjTy->Name[0], 10); } } DataSend(lpObj->m_Index, (BYTE*)&pMsg, pMsg.h.size); }
void DGAnsRegAttackGuild(LPCSP_REQ_REGATTACKGUILD lpMsg,int aIndex) { CSP_ANS_REGATTACKGUILD pMsg; pMsg.h.c = PMHC_BYTE; pMsg.h.size = sizeof( pMsg ); pMsg.h.headcode = 0x80; pMsg.h.subcode = 0x0D; pMsg.iResult = 0; pMsg.iIndex = lpMsg->iIndex; pMsg.wMapSvrNum = lpMsg->wMapSvrNum; char szEnemyGuildName[9] = {0}; memcpy(szEnemyGuildName,lpMsg->szEnemyGuildName,0x08); memcpy(pMsg.szEnemyGuildName,lpMsg->szEnemyGuildName,0x08); pMsg.iResult = RegAttackGuild(lpMsg->wMapSvrNum,szEnemyGuildName); DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size); }
void JoinServerLogin(LPSDHP_SERVERINFO lpMsg,int aIndex) { SDHP_RESULT pResult; pResult.h.c = PMHC_BYTE; pResult.h.headcode = 0x00; pResult.h.size = sizeof(pResult); pResult.Result = 0x01; g_JSData.Set(aIndex,lpMsg->ServerCode); if( gSObjSetInfo(aIndex, lpMsg->Port, lpMsg->Type, lpMsg->ServerName) == FALSE ) { pResult.Result = 0x00; g_Window.ServerLogAdd(ST_JOINSERVER,"Client Authentication Fail"); } gSObj[aIndex].ServerCode = lpMsg->ServerCode; gSObj[aIndex].Flag = 1; DataSend(aIndex,(LPBYTE)&pResult,pResult.h.size); }
void DataServerLogin(LPSDHP_SERVERINFO lpMsg,int aIndex) { SDHP_RESULT pResult; pResult.h.size = sizeof( pResult ); pResult.h.c = PMHC_BYTE; pResult.h.headcode = 0x00; pResult.Result = 0x01; pResult.ItemCount = GetItemCount(lpMsg->ServerCode / 20); gSObj[aIndex].ServerCode = lpMsg->ServerCode; if( gSObjSetInfo(aIndex, lpMsg->Port, lpMsg->Type, lpMsg->ServerName) == FALSE ) { pResult.Result = 0x00; g_Window.ServerLogAdd(ST_DATASERVER,"Client Authentication Fail"); } DataSend(aIndex,(LPBYTE)&pResult,pResult.h.size); }
void DGReqQuestExInfo(PMSG_REQ_QUESTEXINFO* lpMsg,int aIndex) { char szName[MAX_IDSTRING+1]; memcpy(szName,lpMsg->szName,MAX_IDSTRING); szName[10] = 0; PMSG_ANS_QUESTEXINFO pMsg = {0}; pMsg.h.c = 0xC2; pMsg.h.headcode = 0x16; pMsg.h.sizeL = SET_NUMBERL(sizeof(pMsg)); pMsg.h.sizeH = SET_NUMBERH(sizeof(pMsg)); strcpy(pMsg.szName,szName); pMsg.aIndex = lpMsg->aIndex; ReadQuestInfoEx(szName,&pMsg); DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg)); }