Restructure repository to include all source folders

Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 20:17:20 +09:00
parent 5d3cd64a25
commit dd97ddec92
11602 changed files with 1446576 additions and 0 deletions

View File

@@ -0,0 +1,164 @@
#include "stdafx.h"
#include "SendAttack.h"
#include "SendPacket.h"
#include <Network/ClientSocket/ClientSocket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/CharAttackPacket.h>
#include <Network/Packet/PacketStruct/CharItemPacket.h>
#include <Network/Packet/PacketStruct/CharStatusPacket.h>
#include <Network/ClientNetwork/NetworkMsgBlock.h>
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <GameGuardLib/NPGameLib.h>
#include <mmsystem.h>
#include "GMMemory.h"
bool SendPacket::CharAttack(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In,
POS* lpPos_In, float Dir_In, AtType &AtType_In, AtNode &AtNode_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktAt) + ClientSocket::MAX_GAME_GUARD_CRYPT_HEADER_SIZE, lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktAt* lpAtPt = reinterpret_cast<PktAt *>(lpMsgBlock->wr_ptr());
lpAtPt->m_dwCharID = CharID_In;
lpAtPt->m_Postion = *lpPos_In;
lpAtPt->m_fDir = Dir_In;
lpAtPt->m_AtType = AtType_In;
lpAtPt->m_AtNode = AtNode_In;
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><>Ŷ <20><>ȣȭ
unsigned short wPacketSize = static_cast<unsigned short>(
EncryptPacket(lpMsgBlock->wr_ptr() + sizeof(PktBase), sizeof(PktAt) - sizeof(PktBase)));
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktBase) + wPacketSize, CmdCharAttack, timeGetTime());
}
bool SendPacket::CharRespawn(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In,
unsigned char cCmd_In, POS& Pos_In, unsigned long dwTownID_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, true);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktRs), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktRs* lpRsPt = reinterpret_cast<PktRs *>(lpMsgBlock->wr_ptr());
lpRsPt->m_dwCharID = CharID_In;
lpRsPt->m_cCmd = cCmd_In;
lpRsPt->m_Position = Pos_In;
lpRsPt->m_dwTownID = dwTownID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktRs), CmdCharRespawn, 0, 0);
}
bool SendPacket::CharRespawnInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, true);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktRs), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktRsInfo* lpPktRsInfo = reinterpret_cast<PktRsInfo*>(lpMsgBlock->wr_ptr());
lpPktRsInfo->m_dwCharID = CharID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktRsInfo), CmdCharRespawnInfo, 0, 0);
}
bool SendPacket::CharRespawnAreaInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, unsigned long TownID_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, true);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktRs), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktRsAreaInfo* lpPktRsAreaInfo = reinterpret_cast<PktRsAreaInfo*>(lpMsgBlock->wr_ptr());
lpPktRsAreaInfo->m_dwCharID = CharID_In;
lpPktRsAreaInfo->m_dwTownID = TownID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktRsAreaInfo), CmdCharRespawnAreaInfo, 0, 0);
}
bool SendPacket::CharRespawnWaitQueue(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktRsWaitQueue), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktRsWaitQueue* lpRsWQPt = reinterpret_cast<PktRsWaitQueue *>(lpMsgBlock->wr_ptr());
lpRsWQPt->m_dwCharID = CharID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktRsWaitQueue), CmdCharRespawnWaitQueue, 0, 0);
}
bool SendPacket::CharSwitchHand(ClientNet::CClientEventHandler* lpHandler, unsigned char SelectHand_In)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktSwEQ), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSwEQ* lpSwHPt = reinterpret_cast<PktSwEQ *>(lpMsgBlock->wr_ptr());
lpSwHPt->m_cType = 0;
lpSwHPt->m_cSelect = SelectHand_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSwEQ), CmdCharSwitchEQ, 0, 0);
}
bool SendPacket::CharPeaceMode(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID_In, bool bPeace_In)
{
CHECK_TRUE_RETURN(0 == dwCharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktPeace), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktPeace* lpPeacePt = reinterpret_cast<PktPeace *>(lpMsgBlock->wr_ptr());
lpPeacePt->m_dwCharID = dwCharID_In;
lpPeacePt->m_bPeace = bPeace_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktPeace), CmdCharPeaceMode, 0, 0);
}
bool SendPacket::CharDuelCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long SenderID_In,
unsigned long RecverID_In, unsigned char Cmd_In)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktDuC), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktDuC* lpDuCPt = reinterpret_cast<PktDuC *>(lpMsgBlock->wr_ptr());
lpDuCPt->m_dwSenderID = SenderID_In;
lpDuCPt->m_dwRecverID = RecverID_In;
lpDuCPt->m_cCmd = Cmd_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktDuC), CmdCharDuelCmd, 0, 0);
}

View File

@@ -0,0 +1,30 @@
#ifndef _GAMA_CLIENT_SEND_ATTACK_PACKET_H_
#define _GAMA_CLIENT_SEND_ATTACK_PACKET_H_
#include <DB/DBdefine.h>
#include <Network/Packet/PacketStruct/CharAttackPacketStruct.h>
// forward decl.
struct CHAR_CREATE;
class ClientSocket;
namespace ClientNet
{
// forward decl.
class CClientEventHandler;
}
namespace SendPacket
{
bool CharAttack(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, POS* lpPos_In, float Dir_In, AtType &AtType_In, AtNode &AtNode_In);
bool CharRespawn(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, unsigned char cCmd_In, POS& Pos_In, unsigned long dwTownID_In);
bool CharRespawnInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In);
bool CharRespawnAreaInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, unsigned long TownID_In);
bool CharRespawnWaitQueue(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In);
bool CharPeaceMode(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID_In, bool bPeace_In);
bool CharSwitchHand(ClientNet::CClientEventHandler* lpHandler, unsigned char SelectHand_In);
bool CharDuelCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long SenderID_In, unsigned long RecverID_In, unsigned char Cmd_In);
}
#endif

View File

@@ -0,0 +1,211 @@
#include "stdafx.h"
#include <winsock2.h>
#include <windows.h>
#include "SendPacket.h"
#include "SendAuthServer.h"
#include <DB/DBDefine.h>
#include <Network/ClientSocket/ClientSocket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/ClientToAuthServer.h>
#include <Network/Packet/PacketStruct/UnifiedCharPacket.h>
#include <Network/ClientNetwork/NetworkMsgBlock.h>
#include <Network/ClientNetwork/ClientEventHandler.h>
#include "GMMemory.h"
unsigned long GetDiskSerial(char Drv_In)
{
unsigned long VolumeSerial = 0;
char Root[10] = "";
sprintf(Root, "%c:\\", Drv_In);
if(!GetVolumeInformation(Root, 0, 0, &VolumeSerial, 0, 0, 0, 0))
return 0;
return VolumeSerial;
}
bool SendPacket::AuthAccount(ClientSocket& clientSocket, char* UserID_In, char* UserPW_In,
unsigned long ClientVer_In, unsigned long CheckSum_In, unsigned short Flag_In)
{
clientSocket.ClearAddress(ClientSocket::MoveZoneAddr);
ClientNet::CClientEventHandler* lpHandler = &clientSocket.GetHandler(ClientSocket::AuthEventHandler);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktAU), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktAU* lpAUPt = reinterpret_cast<PktAU *>(lpMsgBlock->wr_ptr());
strncpy(lpAUPt->m_UserAccount, UserID_In, PktAU::ID_LEN);
strncpy(lpAUPt->m_UserPassword, UserPW_In, PktAU::PASS_LEN);
lpAUPt->m_dwSessionID = GetDiskSerial('C');
lpAUPt->m_dwClientVer = ClientVer_In;
lpAUPt->m_dwCheckSum = CheckSum_In;
lpAUPt->m_usFlag = Flag_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktAU), CmdAuthAccount, 0, PktBase::NO_SERVER_ERR);
}
bool SendPacket::JapanAuthAccount(ClientSocket& clientSocket, char* UserID_In,
unsigned long dwUID, unsigned long ClientVer_In,
unsigned long CheckSum_In, unsigned short Flag_In)
{
clientSocket.ClearAddress(ClientSocket::MoveZoneAddr);
ClientNet::CClientEventHandler* lpHandler =
&clientSocket.GetHandler(ClientSocket::AuthEventHandler);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktJPAU), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktJPAU* lpJPAUPt = reinterpret_cast<PktJPAU *>(lpMsgBlock->wr_ptr());
strncpy(lpJPAUPt->m_szUserAccount, UserID_In, 16);
lpJPAUPt->m_dwUserID = dwUID;
lpJPAUPt->m_dwSessionID = GetDiskSerial('C');
lpJPAUPt->m_dwClientVer = ClientVer_In;
lpJPAUPt->m_dwCheckSum = CheckSum_In;
lpJPAUPt->m_usFlag = Flag_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktJPAU), CmdJapanAuthAccount, 0, 0);
}
bool SendPacket::UserLogin(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In, unsigned char cLoginType_In)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktULi), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktULi* lpULiPt = reinterpret_cast<PktULi *>(lpMsgBlock->wr_ptr());
lpULiPt->m_dwUserID = UserID_In;
lpULiPt->m_cLoginType = cLoginType_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktULi), CmdUserLogin, 0);
}
bool SendPacket::CharCreate(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In,
unsigned long SlotNum_In, CHAR_CREATE &Create_In)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktCC), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCC* lpCCPt = reinterpret_cast<PktCC *>(lpMsgBlock->wr_ptr());
lpCCPt->m_dwUserID = UserID_In;
lpCCPt->m_dwSlotNum = SlotNum_In;
lpCCPt->m_CreateChar = Create_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCC), CmdCharCreate, 0, 0);
}
bool SendPacket::CharSelect(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In,unsigned long CharID_In)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktCS), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCS* lpCSPt = reinterpret_cast<PktCS *>(lpMsgBlock->wr_ptr());
lpCSPt->m_dwUserID = UserID_In;
lpCSPt->m_dwCharID = CharID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCS), CmdCharSelect, 0, 0);
}
bool SendPacket::CharDelete(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In,
unsigned long CharID_In, unsigned long SlotNum_In, char* szPassword)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktCD), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCD* lpCDPt = reinterpret_cast<PktCD *>(lpMsgBlock->wr_ptr());
lpCDPt->m_dwUserID = UserID_In;
lpCDPt->m_dwCharID = CharID_In;
lpCDPt->m_dwSlotNum = SlotNum_In;
memset(lpCDPt->m_szPassword, 0, STORE_INFO::MAX_PASS_LEN);
memcpy(lpCDPt->m_szPassword, szPassword, STORE_INFO::MAX_PASS_LEN);
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCD), CmdCharDelete, 0, 0);
}
// WORK_LIST 2.1 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>
bool SendPacket::SelectAccountNation(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In,
unsigned char cType, unsigned char cAccountNation_In)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktSelectAccountNation), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSelectAccountNation* lpSANPt = reinterpret_cast<PktSelectAccountNation*>(lpMsgBlock->wr_ptr());
lpSANPt->m_dwUserID = UserID_In;
lpSANPt->m_cType = cType;
lpSANPt->m_cAccountNation = cAccountNation_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSelectAccountNation), CmdSelectAccountNation, 0, 0);
}
bool SendPacket::UnifiedCharSelect(ClientNet::CClientEventHandler* lpHandler, const char* szPassword,
unsigned long* lpdwCID, unsigned long dwCIDNum,
unsigned char cSelectedStoreServerGroup,
unsigned char cSelectedNation)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktUnifiedCharSelectReq), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
memset(lpMsgBlock->wr_ptr(), 0, sizeof(PktUnifiedCharSelectReq));
PktUnifiedCharSelectReq* lpPktUnifiedCharSelectReq =
reinterpret_cast<PktUnifiedCharSelectReq*>(lpMsgBlock->wr_ptr());
strncpy(lpPktUnifiedCharSelectReq->szPassword,
szPassword, PktUnifiedCharSelectReq::MAX_PASSWORD_LEN);
lpPktUnifiedCharSelectReq->szPassword[PktUnifiedCharSelectReq::MAX_PASSWORD_LEN - 1] = 0;
memcpy(lpPktUnifiedCharSelectReq->dwCID, lpdwCID,
sizeof(unsigned long) * min(USER_INFO::MAX_CHAR_NUM, dwCIDNum));
lpPktUnifiedCharSelectReq->cSelectedServerGroupID = cSelectedStoreServerGroup;
lpPktUnifiedCharSelectReq->cSelectedNation = cSelectedNation;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktUnifiedCharSelectReq), CmdUnifiedCharSelect, 0, 0);
}

View File

@@ -0,0 +1,33 @@
#ifndef _GAMA_CLIENT_SEND_PACKET_H_
#define _GAMA_CLIENT_SEND_PACKET_H_
// forward decl.
class ClientSocket;
struct CHAR_CREATE;
namespace ClientNet
{
// forward decl.
class CClientEventHandler;
}
namespace SendPacket
{
bool AuthAccount(ClientSocket& clientSocket, char* UserID_In, char* UserPW_In, unsigned long ClientVer_In, unsigned long CheckSum_In, unsigned short Flag_In = 0);
bool JapanAuthAccount(ClientSocket& clientSocket, char* UserID_In, unsigned long dwUID, unsigned long ClientVer_In, unsigned long CheckSum_In, unsigned short Flag_In = 0);
bool UserLogin(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In, unsigned char cLoginType_In);
bool CharSelect(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In, unsigned long CharID_In);
bool CharCreate(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In, unsigned long SlotNum_In, CHAR_CREATE &Create_In);
bool CharDelete(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In, unsigned long CharID_In, unsigned long SlotNum_In, char* szPassword);
// WORK_LIST 2.1 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>
bool SelectAccountNation(ClientNet::CClientEventHandler* lpHandler, unsigned long UserID_In, unsigned char cType, unsigned char cAccountNation_In);
// <20><><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
bool UnifiedCharSelect(ClientNet::CClientEventHandler* lpHandler, const char* szPassword,
unsigned long* lpdwCID, unsigned long dwCIDNum,
unsigned char cSelectedStoreServerGroup, unsigned char cSelectedNation);
}
#endif

View File

@@ -0,0 +1,103 @@
#include "stdafx.h"
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/ClientSocket/ClientSocket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/BGServerPacket.h>
#include "SendPacket.h"
#include "SendBGServer.h"
#include "GMMemory.h"
bool SendPacket::CharBGServerMapList(ClientNet::CClientEventHandler* lpHandler)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktBGServerMapList), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktBGServerMapList* lpBGSMLPt = reinterpret_cast<PktBGServerMapList *>(lpMsgBlock->wr_ptr());
lpBGSMLPt->m_bAll = true;
lpBGSMLPt->m_cMapInfoNodeNum = PktBGServerMapList::MAX_MAP_NUM;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktBGServerMapList), CmdBGServerMapList, 0, 0);
}
bool SendPacket::CharBGServerResultList(ClientNet::CClientEventHandler* lpHandler)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktBGServerResultList), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktBGServerResultList* lpBGSRLPt = reinterpret_cast<PktBGServerResultList *>(lpMsgBlock->wr_ptr());
lpBGSRLPt->m_bAll = true;
lpBGSRLPt->m_cResultInfoNodeNum = PktBGServerResultList::MAX_MAP_NUM;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktBGServerResultList), CmdBGServerResultList, 0, 0);
}
bool SendPacket::CharBGServerMoveZone(ClientNet::CClientEventHandler* lpHandler, unsigned short wMapNumber, unsigned char cMoveType)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktBGServerMoveZone), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktBGServerMoveZone* lpBGSMZPt = reinterpret_cast<PktBGServerMoveZone *>(lpMsgBlock->wr_ptr());
lpBGSMZPt->m_wMapNumber = wMapNumber;
lpBGSMZPt->m_cMoveType = cMoveType;
lpBGSMZPt->m_cZone = 0;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktBGServerMoveZone), CmdBGServerMoveZone, 0, 0);
}
bool SendPacket::CharBGServerCharSlot(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cGroup)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktBGServerCharSlot), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktBGServerCharSlot* lpBGSCSPt = reinterpret_cast<PktBGServerCharSlot *>(lpMsgBlock->wr_ptr());
lpBGSCSPt->m_dwCID = dwCID;
lpBGSCSPt->m_dwUID = 0;
lpBGSCSPt->m_cGroup = cGroup;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktBGServerCharSlot), CmdBGServerCharSlot, 0, 0);
}
bool SendPacket::CharBGServerMileageChange(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cGroup, unsigned char cCmd,
unsigned long dwMileage)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktBGServerMileageChange), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktBGServerMileageChange* lpBGSMCPt = reinterpret_cast<PktBGServerMileageChange *>(lpMsgBlock->wr_ptr());
lpBGSMCPt->m_dwCID = dwCID;
lpBGSMCPt->m_cGroup = cGroup;
lpBGSMCPt->m_cCmd = cCmd;
lpBGSMCPt->m_dwGold = 0;
lpBGSMCPt->m_dwMileage = dwMileage;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktBGServerMileageChange), CmdBGServerMileageChange, 0, 0);
}

View File

@@ -0,0 +1,22 @@
#ifndef _GAMA_CLIENT_SEND_BATTLEGROUND_SERVER_H_
#define _GAMA_CLIENT_SEND_BATTLEGROUND_SERVER_H_
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
class ClientSocket;
namespace ClientNet
{
class CClientEventHandler;
}
namespace SendPacket
{
bool CharBGServerMapList(ClientNet::CClientEventHandler* lpHandler);
bool CharBGServerResultList(ClientNet::CClientEventHandler* lpHandler);
bool CharBGServerMoveZone(ClientNet::CClientEventHandler* lpHandler, unsigned short wMapNumber, unsigned char cMoveType);
bool CharBGServerCharSlot(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cGroup);
bool CharBGServerMileageChange(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cGroup, unsigned char cCmd, unsigned long dwMileage);
};
#endif

View File

@@ -0,0 +1,169 @@
#include "stdafx.h"
#include "SendPacket.h"
#include "SendCastle.h"
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/CastlePacket.h>
#include "GMMemory.h"
bool SendPacket::CharCastleCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCastleID,
unsigned long dwCastleObjectID, unsigned long dwValue1, unsigned long dwValue2, unsigned char cSubCmd)
{
CHECK_TRUE_RETURN(0 == dwCID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktCastleCmd), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
LPPktCastleCmd lpCCPt = reinterpret_cast<LPPktCastleCmd>(lpMsgBlock->wr_ptr());
lpCCPt->m_dwCID = dwCID;
lpCCPt->m_dwCastleID = dwCastleID;
lpCCPt->m_dwCastleObjectID = dwCastleObjectID;
lpCCPt->m_dwValue1 = dwValue1;
lpCCPt->m_dwValue2 = dwValue2;
lpCCPt->m_cSubCmd = cSubCmd;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCastleCmd), CmdCastleCmd, 0, 0);
}
bool SendPacket::CharCampCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCampID,
unsigned long dwValue, unsigned long dwValue2, unsigned char cSubCmd)
{
CHECK_TRUE_RETURN(0 == dwCID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktCampCmd), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
LPPktCampCmd lpCCPt = reinterpret_cast<LPPktCampCmd>(lpMsgBlock->wr_ptr());
lpCCPt->m_dwCID = dwCID;
lpCCPt->m_dwCampID = dwCampID;
lpCCPt->m_cState = 0;
lpCCPt->m_dwValue1 = dwValue;
lpCCPt->m_dwValue2 = dwValue2;
lpCCPt->m_cSubCmd = cSubCmd;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCampCmd), CmdCampCmd, 0, 0);
}
bool SendPacket::CharSiegeArmsCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwArmsID, unsigned char cSubCmd)
{
CHECK_TRUE_RETURN(0 == dwCID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktCampCmd), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
LPPktSiegeArmsCmd lpSACPt = reinterpret_cast<LPPktSiegeArmsCmd>(lpMsgBlock->wr_ptr());
lpSACPt->m_dwCID = dwCID;
lpSACPt->m_dwArmsID = dwArmsID;
lpSACPt->m_cSubCmd = cSubCmd;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSiegeArmsCmd), CmdSiegeArmsCmd, 0, 0);
}
bool SendPacket::CharCastleRight(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCastleID, CastleRight castleRight)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktCastleRight), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCastleRight* lpCRPt = reinterpret_cast<PktCastleRight *>(lpMsgBlock->wr_ptr());
lpCRPt->m_dwCID = dwCID;
lpCRPt->m_dwCastleID = dwCastleID;
lpCRPt->m_CastleRight = castleRight;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCastleRight), CmdCastleRight, 0, 0);
}
bool SendPacket::CharCampRight(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCampID, CampRight campRight)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktCampRight), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCampRight* lpCRPt = reinterpret_cast<PktCampRight *>(lpMsgBlock->wr_ptr());
lpCRPt->m_dwCID = dwCID;
lpCRPt->m_dwCampID = dwCampID;
lpCRPt->m_CampRight = campRight;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCampRight), CmdCampRight, 0, 0);
}
// <20><> <20><>¡<EFBFBD><C2A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֱ<EFBFBD>/<2F><><EFBFBD><EFBFBD>
bool SendPacket::CharTakeCastleJewel(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCastleID, unsigned char cSubCmd,
unsigned short wItemID, unsigned char cIndex, unsigned char cNum, Item::ItemPos pos)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktTakeCastleJewel), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktTakeCastleJewel* lpPktTCJ = reinterpret_cast<PktTakeCastleJewel *>(lpMsgBlock->wr_ptr());
lpPktTCJ->m_dwCID = dwCID;
lpPktTCJ->m_dwCastleID = dwCastleID;
lpPktTCJ->m_cSubCmd = cSubCmd;
lpPktTCJ->m_wItemID = wItemID;
lpPktTCJ->m_cIndex = cIndex;
lpPktTCJ->m_cNum = cNum;
lpPktTCJ->m_Pos = pos;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktTakeCastleJewel), CmdTakeCastleJewel, 0, 0);
}
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ֱ<EFBFBD>/<2F><><EFBFBD><EFBFBD>
bool SendPacket::CharTakeMaterial(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCampID, unsigned char cSubCmd,
unsigned char cNum, Item::ItemPos pos)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktTakeMaterial), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktTakeMaterial* lpPktTM = reinterpret_cast<PktTakeMaterial *>(lpMsgBlock->wr_ptr());
lpPktTM->m_dwCID = dwCID;
lpPktTM->m_dwCampID = dwCampID;
lpPktTM->m_cSubCmd = cSubCmd;
lpPktTM->m_cNum = cNum;
lpPktTM->m_Pos = pos;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktTakeMaterial), CmdTakeMaterial, 0, 0);
}
bool SendPacket::WarOnOff(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cFlag, unsigned char cType)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktWarOnOff), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktWarOnOff* lpPktWarOnOff = reinterpret_cast<PktWarOnOff*>(lpMsgBlock->wr_ptr());
lpPktWarOnOff->m_dwCID = dwCID;
lpPktWarOnOff->m_cType = cType;
lpPktWarOnOff->m_cFlag = cFlag;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktWarOnOff), CmdWarOnOff, 0, 0);
}

View File

@@ -0,0 +1,44 @@
#ifndef _GAMA_CLIENT_SEND_CASTLE_PACKET_H_
#define _GAMA_CLIENT_SEND_CASTLE_PACKET_H_
#include <Network/Packet/PacketStruct/CastlePacket.h>
namespace ClientNet
{
// forward decl.
class CClientEventHandler;
}
namespace SendPacket
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>Ŷ
bool CharCastleCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCastleID,
unsigned long dwCastleObjectID, unsigned long dwValue1, unsigned long dwValue2, unsigned char cSubCmd);
bool CharCampCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCampID,
unsigned long dwValue, unsigned long dwValue2, unsigned char cSubCmd);
bool CharSiegeArmsCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwArmsID, unsigned char cSubCmd);
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>Ŷ
bool CharCastleRight(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCastleID, CastleRight castleRight);
bool CharCampRight(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCampID, CampRight campRight);
// <20><> <20><>¡<EFBFBD><C2A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֱ<EFBFBD>/<2F><><EFBFBD><EFBFBD>
bool CharTakeCastleJewel(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCastleID, unsigned char cSubCmd,
unsigned short wItemID, unsigned char cIndex, unsigned char cNum, Item::ItemPos pos);
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ֱ<EFBFBD>/<2F><><EFBFBD><EFBFBD>
bool CharTakeMaterial(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCampID, unsigned char cSubCmd,
unsigned char cNum, Item::ItemPos pos);
// <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
bool WarOnOff(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cFlag, unsigned char cType);
};
#endif

View File

@@ -0,0 +1,623 @@
#include "stdafx.h"
#include <Utility/CheckSum/Crc32Static.h>
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/ClientSocket/ClientSocket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
#include <Network/Packet/PacketStruct/PartyPacket.h>
#include <Network/Packet/PacketStruct/GuildPacket.h>
#include "SendPacket.h"
#include "SendCommunity.h"
#include "GMMemory.h"
//--------------------------------------------------------------------------------------------------------------
// <20><><EFBFBD><EFBFBD>
bool SendPacket::CharCreateGuild(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, char* szGuildName)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktCreateGuild), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCreateGuild* lpCGPt = reinterpret_cast<PktCreateGuild *>(lpMsgBlock->wr_ptr());
lpCGPt->m_dwCID = dwCID;
lpCGPt->m_dwGID = 0; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޴´<DEB4>.
lpCGPt->m_cInclination = 0; // <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD>Ѵ<EFBFBD>.
strncpy(lpCGPt->m_szGuildName, szGuildName, Guild::MAX_GUILD_NAME_LEN);
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCreateGuild), CmdCreateGuild, 0, 0);
}
bool SendPacket::CharGuildCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwGID,
unsigned long dwSenderID, unsigned long dwReferenceID, unsigned short wCmd)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(
sizeof(PktGuildCmd), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildCmd* lpGCPt = reinterpret_cast<PktGuildCmd *>(lpMsgBlock->wr_ptr());
lpGCPt->m_dwGID = dwGID & ~Guild::MEMBER_WAIT_BIT;
lpGCPt->m_dwSenderID = dwSenderID;
lpGCPt->m_dwReferenceID = dwReferenceID;
lpGCPt->m_wCmd = wCmd;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildCmd), CmdGuildCmd, 0, 0);
}
bool SendPacket::CharGuildMark(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwGID, char* szMark)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktGuildMark), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildMark* lpGMPt= reinterpret_cast<PktGuildMark *>(lpMsgBlock->wr_ptr());
lpGMPt->m_dwCID = dwCID;
lpGMPt->m_dwGID = dwGID;
::memcpy(lpGMPt->m_szMark, szMark, Guild::MAX_MARK_SIZE);
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildMark), CmdGuildMark, 0, 0);
}
bool SendPacket::CharGuildLevel(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cLevel)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktGuildLevel), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildLevel* lpGLPt = reinterpret_cast<PktGuildLevel *>(lpMsgBlock->wr_ptr());
lpGLPt->m_dwUID = dwCID;
lpGLPt->m_cLevel = cLevel;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildLevel), CmdGuildLevel, 0, 0);
}
bool SendPacket::CharGuildRelation(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID,
unsigned long dwGID, unsigned long dwTargetGID, unsigned long dwValue, unsigned char cSubCmd)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktGuildRelation), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildRelation* lpGRPt = reinterpret_cast<PktGuildRelation *>(lpMsgBlock->wr_ptr());
lpGRPt->m_dwCID = dwCID;
lpGRPt->m_dwGID = dwGID;
lpGRPt->m_dwTargetGID = dwTargetGID;
lpGRPt->m_dwValue = dwValue;
lpGRPt->m_cSubCmd = cSubCmd;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildRelation), CmdGuildRelation, 0, 0);
}
bool SendPacket::CharGuildInclination(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cInclination)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktGuildInclination), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildInclination* lpGIPt = reinterpret_cast<PktGuildInclination *>(lpMsgBlock->wr_ptr());
lpGIPt->m_dwUID = dwCID;
lpGIPt->m_cInclination = cInclination;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildInclination), CmdGuildInclination, 0, 0);
}
bool SendPacket::CharGuildList(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID,
unsigned char cSortCmd, unsigned char cPage, unsigned char cNodeNum, GuildSmallInfoNode* lpNode)
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
unsigned short usPacketSize = sizeof(PktGuildList) + sizeof(GuildCheckSumNode) * cNodeNum;
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(usPacketSize, lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildList* lpGLPt = reinterpret_cast<PktGuildList *>(lpMsgBlock->wr_ptr());
lpGLPt->m_dwCID = dwCID;
lpGLPt->m_cSortCmd = cSortCmd;
lpGLPt->m_cPage = cPage;
lpGLPt->m_cSmallNodeNum = cNodeNum;
unsigned short wBufferSize = sizeof(PktGuildList);
for (int nIndex = 0; nIndex < cNodeNum; ++nIndex, ++lpNode)
{
// üũ<C3BC><C5A9><EFBFBD><EFBFBD> <20>̾Ƴ<CCBE><C6B3><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
GuildCheckSumNode tempNode;
tempNode.m_dwGID = lpNode->m_dwGID & ~Guild::MEMBER_WAIT_BIT;
CCrc32Static::BufferCrc32(reinterpret_cast<const char *>(lpNode), sizeof(GuildSmallInfoNode),
tempNode.m_dwCheckSum);
CopyMemory(lpMsgBlock->wr_ptr() + wBufferSize, &tempNode, sizeof(GuildCheckSumNode));
wBufferSize += sizeof(GuildCheckSumNode);
}
return SendPacket(lpHandler, lpMsgBlock, usPacketSize, CmdGuildList, 0, 0);
}
bool SendPacket::CharGuildRight(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, GuildRight guildRight)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktGuildRight), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildRight* lpGRPt = reinterpret_cast<PktGuildRight *>(lpMsgBlock->wr_ptr());
lpGRPt->m_dwUID = dwCID;
lpGRPt->m_GuildRight = guildRight;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildRight), CmdGuildRight, 0, 0);
}
bool SendPacket::CharGuildMemberList(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID,
unsigned char cMemberType, unsigned char cSortCmd, unsigned char cPage)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktGuildMemberList), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildMemberList* lpGMLPt = reinterpret_cast<PktGuildMemberList *>(lpMsgBlock->wr_ptr());
lpGMLPt->m_dwCID = dwCID;
lpGMLPt->m_cMemberType = cMemberType;
lpGMLPt->m_cSortCmd = cSortCmd;
lpGMLPt->m_cPage = cPage;
lpGMLPt->m_cTotalMemberNum = 0;
lpGMLPt->m_cNodeNum = 0;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildMemberList), CmdGuildMemberList, 0, 0);
}
bool SendPacket::CharGuildSafe(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwGold, unsigned char cCmd)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktGuildSafe), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildSafe* lpGSPt = reinterpret_cast<PktGuildSafe *>(lpMsgBlock->wr_ptr());
lpGSPt->m_dwCID = dwCID;
lpGSPt->m_dwGold = dwGold;
lpGSPt->m_cCmd = cCmd;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildSafe), CmdGuildSafe, 0, 0);
}
bool SendPacket::CharGuildHostilityList(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID,
unsigned char cCurrentPage, unsigned char cPageState)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktGuildHostilityList), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildHostilityList* lpGHLPt = reinterpret_cast<PktGuildHostilityList *>(lpMsgBlock->wr_ptr());
lpGHLPt->m_dwCID = dwCID;
lpGHLPt->m_cCurrentPage = cCurrentPage;
lpGHLPt->m_cPageState = cPageState;
lpGHLPt->m_cNodeNum = 0;
lpGHLPt->m_wTotalItemNum = 0;
::memset(lpGHLPt->m_szHostility, 0, Guild::MAX_GUILD_NAME_LEN);
::memset(lpGHLPt->m_szAlert, 0, Guild::MAX_GUILD_NAME_LEN);
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildHostilityList), CmdGuildHostilityList, 0, 0);
}
bool SendPacket::CharGuildRelationInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwGID)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktGuildRelationInfo), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktGuildRelationInfo* lpGRIPt = reinterpret_cast<PktGuildRelationInfo *>(lpMsgBlock->wr_ptr());
lpGRIPt->m_dwCID = dwCID;
lpGRIPt->m_dwGID = dwGID;
lpGRIPt->m_wNodeNum = 0;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktGuildRelationInfo), CmdGuildRelationInfo, 0, 0);
}
//--------------------------------------------------------------------------------------------------------------
// <20><>Ƽ
bool SendPacket::CharPartyCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long SenderID,
unsigned long ReferenceID, unsigned long PartyID, unsigned short Cmd)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktPC), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktPC* lpPCPt = reinterpret_cast<PktPC *>(lpMsgBlock->wr_ptr());
lpPCPt->m_wCmd = Cmd;
lpPCPt->m_dwPartyID = PartyID;
lpPCPt->m_dwSenderID = SenderID;
lpPCPt->m_dwReferenceID = ReferenceID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktPC), CmdCharPartyCmd, 0, 0);
}
bool SendPacket::CharPartyFind(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktPF), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktPF* lpPFPt = reinterpret_cast<PktPF *>(lpMsgBlock->wr_ptr());
lpPFPt->m_dwCharID = CharID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktPF), CmdCharPartyFind, 0, 0);
}
/*
bool SendPacket::CharPartyMemInfo(ClientSocket& clientSocket, unsigned long CharID,
unsigned long PartyID, unsigned char Class,
char Level, POS Pos,
unsigned short MaxHP, short CurHP,
unsigned short MaxMP, short CurMP,
unsigned long Chant, unsigned long Enchant)
{
ClientNet::CSession& Session = clientSocket.GetSession(ClientSocket::UDPSession);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktPM), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktPM* lpPMPt = reinterpret_cast<PktPM *>(lpMsgBlock->wr_ptr());
lpPMPt->m_dwCharID = CharID;
lpPMPt->m_dwPartyID = PartyID;
lpPMPt->m_cClass = Class;
lpPMPt->m_cLevel = Level;
lpPMPt->m_Position = Pos;
lpPMPt->m_wMaxHP = MaxHP;
lpPMPt->m_sCurrHP = CurHP;
lpPMPt->m_wMaxMP = MaxMP;
lpPMPt->m_sCurrMP = CurMP;
lpPMPt->m_dwChant = Chant;
lpPMPt->m_dwEnchant = Enchant;
lpPMPt->m_PublicAddress = clientSocket.GetAddress(ClientSocket::PublicAddr);
lpPMPt->m_PrivateAddress = clientSocket.GetAddress(ClientSocket::PrivateAddr);
SendUDPList(Session, clientSocket.GetUDPList(ClientSocket::ListType_Party),
clientSocket.IsRealIP(), lpMsgBlock, sizeof(PktPM), CmdCharPartyMemInfo, 0, 0);
return true;
}
bool SendPacket::CharPartyMemAddress(ClientSocket& clientSocket, unsigned long CharID,
unsigned long PartyID, const SOCKADDR_IN& PublicAddress,
const SOCKADDR_IN& PrivateAddress)
{
ClientNet::CSession& Session = clientSocket.GetSession(ClientSocket::UDPSession);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktPMA), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktPMA* lpPMAPt = reinterpret_cast<PktPMA *>(lpMsgBlock->wr_ptr());
lpPMAPt->m_dwCharID = CharID;
lpPMAPt->m_dwPartyID = PartyID;
lpPMAPt->m_PublicAddress = PublicAddress;
lpPMAPt->m_PrivateAddress = PrivateAddress;
SendUDPList(Session, clientSocket.GetUDPList(ClientSocket::ListType_Party),
clientSocket.IsRealIP(), lpMsgBlock, sizeof(PktPMA), CmdCharPartyMemAddress, 0, 0);
return true;
}
*/
//--------------------------------------------------------------------------------------------------------------
// ģ<><C4A3>
bool SendPacket::CharFriendAddRequest(ClientNet::CClientEventHandler* lpHandler, char* szName, PktFriendAddReq::CMD addType)
{
CHECK_NULL_RETURN(szName, false);
// ģ<><C4A3> <20>Ǵ<EFBFBD> <20>ź<EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>߰<EFBFBD><DFB0>Ѵ<EFBFBD>.
switch(addType)
{
case PktFriendAddReq::ADD_FRIEND_REQ:
case PktFriendAddReq::BAN_FRIEND_REQ:
break;
default:
return false;
}
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktFriendAddReq), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktFriendAddReq* lpPktFriendAddRequest = reinterpret_cast<PktFriendAddReq*>(lpMsgBlock->wr_ptr());
memset(lpPktFriendAddRequest->m_szName, 0, PktFriendAddReq::MAX_NAME);
memcpy(lpPktFriendAddRequest->m_szName, szName, PktFriendAddReq::MAX_NAME);
lpPktFriendAddRequest->m_dwCID = 0;
lpPktFriendAddRequest->m_cCmd = addType;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktFriendAddReq), CmdFriendAddRequest, 0);
}
bool SendPacket::CharFriendRemoveRequest(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID,
PktFriendRemoveReq::CMD removeType)
{
// ģ<><C4A3> <20>Ǵ<EFBFBD> <20>ź<EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktFriendRemoveReq), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktFriendRemoveReq* lpPktFriendRemoveRequest = reinterpret_cast<PktFriendRemoveReq*>(lpMsgBlock->wr_ptr());
lpPktFriendRemoveRequest->m_cCmd = removeType;
lpPktFriendRemoveRequest->m_dwCID = dwCID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktFriendRemoveReq), CmdFriendRemoveRequest, 0);
}
bool SendPacket::CharFriendEtcRequest(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID,
unsigned long dwData, PktFriendEtc::CMD etcType)
{
switch(etcType)
{
case PktFriendEtc::SETGROUP:
break;
default:
return false;
}
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktFriendEtc), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktFriendEtc* lpPktFriendEtc = reinterpret_cast<PktFriendEtc*>(lpMsgBlock->wr_ptr());
lpPktFriendEtc->m_dwCID = dwCID;
lpPktFriendEtc->m_dwData = dwData;
lpPktFriendEtc->m_cCmd = etcType;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktFriendEtc), CmdFriendEtcRequest, 0);
}
//--------------------------------------------------------------------------------------------------------------
// <20><>Ÿ
bool SendPacket::CharFameInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktFI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktFI* lpFIPt = reinterpret_cast<PktFI *>(lpMsgBlock->wr_ptr());
lpFIPt->m_dwCharID = CharID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktFI), CmdCharFameInfo, 0, 0);
}
bool SendPacket::CharRankingInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned char cClass, unsigned char cPage)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktRankingInfo), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktRankingInfo* lpRankingInfo = reinterpret_cast<PktRankingInfo* >(lpMsgBlock->wr_ptr());
lpRankingInfo->m_dwCharID = dwCharID;
lpRankingInfo->m_cClass = cClass;
lpRankingInfo->m_cPage = cPage;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktRankingInfo), CmdRankingInfo, 0, 0);
}
bool SendPacket::CharAuthorizePanel(ClientNet::CClientEventHandler* lpHandler, unsigned long dwAffectedID,
unsigned long dwCasterID, unsigned char cCmd)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktAP), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktAP* lpAPPt = reinterpret_cast<PktAP *>(lpMsgBlock->wr_ptr());
lpAPPt->m_dwAffectedID = dwAffectedID;
lpAPPt->m_dwCasterID = dwCasterID;
lpAPPt->m_cCmd = cCmd;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktAP), CmdCharAuthorizePanel, 0, 0);
}
// NewChat - ä<>ü<EFBFBD><C3BC><EFBFBD>
bool SendPacket::CharChat(ClientNet::CClientEventHandler* lpHandler, unsigned char Cmd, char* Message, int MessageSize)
{
unsigned short usPacketLen = static_cast<unsigned short>(sizeof(PktChat) + MessageSize + 1);
CHECK_TRUE_RETURN(NULL == Message || MessageSize <= 0 || PktMaxLen <= usPacketLen, false);
switch (Cmd)
{
case PktChat::NORMAL: // <20><><EFBFBD><EFBFBD>
case PktChat::PARTY: // <20><>Ƽ
case PktChat::DICE: // <20>ֻ<EFBFBD><D6BB><EFBFBD>
case PktChat::GUILD: // <20><><EFBFBD><EFBFBD>
case PktChat::CLIENT_LOG: // <20>α<EFBFBD>
case PktChat::TRADE : // <20>ŷ<EFBFBD>
case PktChat::SHOUT: // <20><>ġ<EFBFBD><C4A1>
case PktChat::ADMIN_NORMAL_CHAT: // <20><EFBFBD><EEBFB5> <20><><EFBFBD><EFBFBD> <20><>
case PktChat::ADMIN_SHOUT: // <20><EFBFBD><EEBFB5> <20><>ġ<EFBFBD><C4A1>
case PktChat::FIND_PARTY: // <20><>Ƽ ã<><C3A3>
break;
case PktChat::NOTICE: // <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
default:
return false;
}
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(usPacketLen, lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktChat* lpPktChat = reinterpret_cast<PktChat *>(lpMsgBlock->wr_ptr());
lpPktChat->m_dwSenderCID = 0;
lpPktChat->m_usLang = 0;
lpPktChat->m_cCmd = Cmd;
lpPktChat->m_cNum = 0;
*(Message + MessageSize) = NULL;
strncpy(lpMsgBlock->wr_ptr() + sizeof(PktChat), Message, MessageSize + 1);
*(lpMsgBlock->wr_ptr() + sizeof(PktChat) + MessageSize) = NULL;
return SendPacket(lpHandler, lpMsgBlock, usPacketLen, CmdCharChat, 0, 0);
}
bool SendPacket::CharTargetedChat(ClientNet::CClientEventHandler* lpHandler, unsigned char Cmd,
char* TargetNames, int nTargetNamesNum,
char* Message, int MessageSize)
{
const int NAME_LENGTH = 16;
unsigned short usPacketLen = static_cast<unsigned short>(sizeof(PktChat) +
nTargetNamesNum * NAME_LENGTH + MessageSize + 1);
CHECK_TRUE_RETURN(NULL == TargetNames || nTargetNamesNum <= 0 || 100 < nTargetNamesNum ||
NULL == Message || MessageSize <= 0 || PktMaxLen <= usPacketLen, false);
switch (Cmd)
{
case PktChat::FRIEND: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
case PktChat::STALL: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȭ<EFBFBD><C8AD>
case PktChat::CAMP_SHOP: // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȭ<EFBFBD><C8AD>
break;
default:
return false;
}
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(usPacketLen, lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktChat* lpPktChat = reinterpret_cast<PktChat *>(lpMsgBlock->wr_ptr());
lpPktChat->m_usLang = 0;
lpPktChat->m_cCmd = Cmd;
lpPktChat->m_cNum = nTargetNamesNum;
*(Message + MessageSize) = NULL;
memcpy(lpMsgBlock->wr_ptr() + sizeof(PktChat), TargetNames, nTargetNamesNum * NAME_LENGTH);
strncpy(lpMsgBlock->wr_ptr() + sizeof(PktChat) + nTargetNamesNum * NAME_LENGTH, Message, MessageSize + 1);
*(lpMsgBlock->wr_ptr() + sizeof(PktChat) + nTargetNamesNum * NAME_LENGTH + MessageSize) = NULL;
return SendPacket(lpHandler, lpMsgBlock, usPacketLen, CmdCharChat, 0, 0);
}
bool SendPacket::CharWhisper(ClientNet::CClientEventHandler* lpHandler, char* SenderName,
char *RecverName, char* Message, int MessageSize)
{
unsigned short usPacketLen = static_cast<unsigned short>(sizeof(PktWh) + MessageSize + 1);
CHECK_TRUE_RETURN(SenderName == NULL || RecverName == NULL ||
Message == NULL || MessageSize <= 0 || usPacketLen <= MessageSize, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(usPacketLen, lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktWh* lpWhPt = reinterpret_cast<PktWh *>(lpMsgBlock->wr_ptr());
strncpy(lpWhPt->m_SenderName, SenderName, 16);
strncpy(lpWhPt->m_RecverName, RecverName, 16);
*(Message + MessageSize) = NULL;
CopyMemory(lpMsgBlock->wr_ptr() + sizeof(PktWh), Message, MessageSize);
*(lpMsgBlock->wr_ptr() + sizeof(PktWh) + MessageSize) = NULL;
return SendPacket(lpHandler, lpMsgBlock, usPacketLen, CmdCharWhisper, 0, 0);
}
/* NOT USE
bool SendPacket::CharPartyData(ClientSocket& clientSocket, unsigned long CharID,
unsigned short Cmd, unsigned short Len, void *Data)
{
ClientNet::CSession& Session = clientSocket.GetSession(ClientSocket::UDPSession);
CHECK_TRUE_RETURN(0 == CharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktPMD) + Len, lpHandler->GetPeerAddress());
PktMD* lpMDPt = reinterpret_cast<PktMD *>(lpMsgBlock->wr_ptr());
lpMDPt->m_dwCharID = CharID;
lpMDPt->m_wCmd = Cmd;
lpMDPt->m_wLen = Len;
CopyMemory(lpMsgBlock->wr_ptr() + sizeof(PktMD), Data, Len);
SendUDPList(Session, clientSocket.GetUDPList(ClientSocket::ListType_Party),
clientSocket.IsRealIP(), lpMsgBlock, sizeof(PktPMD) + Len, CmdCharPartyMemData, 0, 0);
return true;
}
*/

View File

@@ -0,0 +1,72 @@
#ifndef _GAMA_CLIENT_COMMUNITY_SEND_H_
#define _GAMA_CLIENT_COMMUNITY_SEND_H_
#include <Network/Packet/PacketStruct/FriendPacket.h>
#include <Network/Packet/PacketStruct/RankingPacket.h>
// forward decl.
class ClientSocket;
struct GuildSmallInfoNode;
struct GuildRight;
struct POS;
namespace ClientNet
{
// forward decl.
class CClientEventHandler;
}
namespace SendPacket
{
// <20><><EFBFBD><EFBFBD>
bool CharCreateGuild(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, char* szGuildName);
bool CharGuildCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwGID, unsigned long dwSenderID, unsigned long dwReferenceID, unsigned short wCmd);
bool CharGuildMark(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwGID, char* szMark);
bool CharGuildLevel(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cLevel);
bool CharGuildRelation(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwGID, unsigned long dwTargetGID, unsigned long dwValue, unsigned char cSubCmd);
bool CharGuildInclination(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cInclination);
bool CharGuildList(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cSortCmd, unsigned char cPage, unsigned char cNodeNum, GuildSmallInfoNode* lpNode);
bool CharGuildRight(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, GuildRight guildRight);
bool CharGuildMemberList(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cMemberType, unsigned char cSortCmd, unsigned char cPage);
bool CharGuildSafe(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwGold, unsigned char cCmd);
bool CharGuildHostilityList(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned char cCurrentPage, unsigned char cPageState);
bool CharGuildRelationInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwGID);
// <20><>Ƽ
bool CharPartyCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long SenderID, unsigned long ReferenceID, unsigned long PartyID, unsigned short Cmd);
bool CharPartyFind(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID);
// ģ<><C4A3>
bool CharFriendAddRequest(ClientNet::CClientEventHandler* lpHandler, char* szName, PktFriendAddReq::CMD addType);
bool CharFriendRemoveRequest(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, PktFriendRemoveReq::CMD removeType);
bool CharFriendEtcRequest(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwData, PktFriendEtc::CMD etcType);
// <20><>Ÿ Ŀ<>´<EFBFBD>Ƽ
bool CharFameInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID);
bool CharRankingInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID, unsigned char cClass, unsigned char cPage);
bool CharAuthorizePanel(ClientNet::CClientEventHandler* lpHandler, unsigned long dwAffectedID, unsigned long dwCasterID, unsigned char cCmd);
bool CharChat(ClientNet::CClientEventHandler* lpHandler, unsigned char Cmd, char* Message, int MessageSize);
bool CharTargetedChat(ClientNet::CClientEventHandler* lpHandler, unsigned char Cmd, char* TargetNames, int nTargetNamesNum, char* Message, int MessageSize);
bool CharWhisper(ClientNet::CClientEventHandler* lpHandler, char* SenderName, char *RecverName, char* Message, int MessageSize);
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------
// UDP Packets
/* NOT USE
// TODO : REMOVE UDP Packets
bool CharPartyMemInfo(ClientSocket& clientSocket, unsigned long CharID,
unsigned long PartyID, unsigned char Class, char Level, POS Pos,
unsigned short MaxHP, short CurHP, unsigned short MaxMP, short CurMP,
unsigned long Chant, unsigned long Enchant);
bool CharPartyMemAddress(ClientSocket& clientSocket, unsigned long CharID,
unsigned long PartyID, const SOCKADDR_IN& PublicAddress,
const SOCKADDR_IN& PrivateAddress);
bool CharPartyData(ClientSocket& clientSocket, unsigned long CharID,
unsigned short Cmd, unsigned short Len, void *Data);
*/
}
#endif

View File

@@ -0,0 +1,207 @@
#include "stdafx.h"
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/ClientSocket/ClientSocket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Network/Packet/PacketStruct/CharStatusPacket.h>
#include <Network/Packet/PacketStruct/CharConfigPacket.h>
#include <Network/Packet/PacketStruct/CharAdminPacket.h>
#include "SendPacket.h"
#include "SendEtc.h"
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ö󰡸<C3B6> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
#include <mmsystem.h>
#include "GMMemory.h"
bool SendPacket::SendSysPing(ClientNet::CClientEventHandler* lpHandler)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSyP), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSyP* lpSyPAckPt = reinterpret_cast<PktSyP *>(lpMsgBlock->wr_ptr());
lpSyPAckPt->m_dwTickTime = timeGetTime();
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSyP), CmdSysPing, 0);
}
bool SendPacket::CharSuicide(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSC), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSC* lpSCPt = reinterpret_cast<PktSC *>(lpMsgBlock->wr_ptr());
lpSCPt->m_dwCharID = CharID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSC), CmdCharSuicide, 0, 0);
}
bool SendPacket::CharBindPos(ClientNet::CClientEventHandler* lpHandler, unsigned long NPCID_In,
unsigned char Cmd_In, POS* lpPos_In, char Zone_In)
{
CHECK_TRUE_RETURN(0 == NPCID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktBP), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktBP* lpBPPt = reinterpret_cast<PktBP *>(lpMsgBlock->wr_ptr());
lpBPPt->m_Pos = *lpPos_In;
lpBPPt->m_dwNPCID = NPCID_In;
lpBPPt->m_cCmd = Cmd_In;
lpBPPt->m_cZone = Zone_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktBP), CmdCharBindPosition, 0, 0);
}
bool SendPacket::CharIncreasePoint(ClientNet::CClientEventHandler* lpHandler,
unsigned long CharID_In, unsigned char StateType_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktIP), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktIP* lpIPPt = reinterpret_cast<PktIP *>(lpMsgBlock->wr_ptr());
lpIPPt->m_dwCharID = CharID_In;
lpIPPt->m_cStateType = StateType_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktIP), CmdCharIncreasePoint, 0, 0);
}
bool SendPacket::CharClassUpgrade(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, unsigned char ClassID_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktCU), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCU* lpCUPt = reinterpret_cast<PktCU *>(lpMsgBlock->wr_ptr());
lpCUPt->m_dwCharID = CharID_In;
lpCUPt->m_cClass = ClassID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCU), CmdCharClassUpgrade, 0, 0);
}
bool SendPacket::CharControlOption(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, RejectOption &Reject_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktCOp), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCOp* lpCOpPt = reinterpret_cast<PktCOp *>(lpMsgBlock->wr_ptr());
lpCOpPt->m_dwCharID = CharID_In;
lpCOpPt->m_RejectOption = Reject_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCOp), CmdCharControlOption, 0, 0);
}
bool SendPacket::CharAdmin(ClientNet::CClientEventHandler* lpHandler, unsigned short Cmd_In,
char* Name_In, char Zone_In, char Channel_In,
unsigned short ProtoTypeID, POS& Pos_In, unsigned long dwAmount,unsigned long dwAmount2, unsigned long dwAmount3)
{
CHECK_TRUE_RETURN(NULL == Name_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktAdmin), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktAdmin* lpAdmin = reinterpret_cast<PktAdmin*>(lpMsgBlock->wr_ptr());
lpAdmin->m_usCmd = Cmd_In;
memcpy(lpAdmin->m_stName, Name_In, PktAdmin::MAX_NAME_LEN);
if (0 != ProtoTypeID)
{
lpAdmin->m_usProtoTypeID = ProtoTypeID;
}
else
{
lpAdmin->m_ZoneInfo.m_cZone = Zone_In;
lpAdmin->m_ZoneInfo.m_cChannel = Channel_In;
}
lpAdmin->m_Position = Pos_In;
lpAdmin->m_dwAmount = dwAmount;
lpAdmin->m_dwAmount2 = dwAmount2;
lpAdmin->m_dwAmount3 = dwAmount3;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktAdmin), CmdCharAdminCmd, 0);
}
bool SendPacket::CharStateRedistribution(ClientNet::CClientEventHandler* lpHandler, ChState* lpState_In)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSR), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSR* lpSRPt = reinterpret_cast<PktSR *>(lpMsgBlock->wr_ptr());
lpSRPt->m_State = *lpState_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSR), CmdCharStateRedistribution, 0, 0);
}
bool SendPacket::CharStatusRetrain(ClientNet::CClientEventHandler* lpHandler, ChState* lpState_In, Item::ItemPos* lpIndex_In)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSRT), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSRT* lpSRTPt = reinterpret_cast<PktSRT *>(lpMsgBlock->wr_ptr());
lpSRTPt->m_State = *lpState_In;
lpSRTPt->m_ItemPos = *lpIndex_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSRT), CmdCharStatusRetrain, 0, 0);
}
bool SendPacket::CharNameChange(ClientNet::CClientEventHandler* lpHandler, unsigned long dwUID,
unsigned long dwCID, const char* szChangeName)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktCharNameChange), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCharNameChange* lpCharNameChange =
reinterpret_cast<PktCharNameChange*>(lpMsgBlock->wr_ptr());
lpCharNameChange->m_dwUID = dwUID;
lpCharNameChange->m_dwCID = dwCID;
lpCharNameChange->m_cNameChangeCount = 0;
strncpy(lpCharNameChange->m_szCharName, szChangeName, CHAR_INFOST::MAX_NAME_LEN);
lpCharNameChange->m_szCharName[CHAR_INFOST::MAX_NAME_LEN - 1] = 0;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCharNameChange), CmdCharNameChange, 0, 0);
}

View File

@@ -0,0 +1,38 @@
#ifndef _GAMA_CLIENT_ETC_SEND_PACKET_H_
#define _GAMA_CLIENT_ETC_SEND_PACKET_H_
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
struct ChState;
struct POS;
struct RejectOption;
class ClientSocket;
namespace ClientNet
{
class CClientEventHandler;
}
namespace Item
{
struct ItemPos;
}
namespace SendPacket
{
bool SendSysPing(ClientNet::CClientEventHandler* lpHandler);
bool CharAdmin(ClientNet::CClientEventHandler* lpHandler, unsigned short Cmd_In, char* Name_In, char Zone_In, char Channel_In, unsigned short ProtoTypeID, POS& Pos_In, unsigned long dwAmount, unsigned long dwAmount2 = 0, unsigned long dwAmount3 = 0);
bool CharSuicide(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In);
bool CharBindPos(ClientNet::CClientEventHandler* lpHandler, unsigned long NPCID_In, unsigned char Cmd_In, POS* lpPos_In, char Zone_In);
bool CharStateRedistribution(ClientNet::CClientEventHandler* lpHandler, ChState* lpState_In);
bool CharControlOption(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, RejectOption &Reject_In);
bool CharIncreasePoint(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, unsigned char StateType_In);
bool CharClassUpgrade(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, unsigned char ClassID_In);
bool CharStatusRetrain(ClientNet::CClientEventHandler* lpHandler, ChState* lpState_In, Item::ItemPos* lpIndex_In);
bool CharNameChange(ClientNet::CClientEventHandler* lpHandler, unsigned long dwUID,
unsigned long dwCID, const char* szChangeName);
}
#endif

View File

@@ -0,0 +1,637 @@
#include "stdafx.h"
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/ClientSocket/ClientSocket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/CharItemPacket.h>
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
#include <Item/Item.h>
#include "SendPacket.h"
#include "SendItem.h"
#include "GMMemory.h"
bool SendPacket::CharPickUp(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID,
unsigned __int64 nObjectID, Item::ItemPos Index)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktPU), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktPU* lpPUPt = reinterpret_cast<PktPU *>(lpMsgBlock->wr_ptr());
lpPUPt->m_dwCharID = dwCharID;
lpPUPt->m_nObjectID = nObjectID;
lpPUPt->m_itemPos = Index;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktPU), CmdCharPickUp, 0, 0);
}
bool SendPacket::CharPullDown(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID,
Item::ItemPos Index, unsigned char cNum)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktPD), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktPD* lpPDPt = reinterpret_cast<PktPD *>(lpMsgBlock->wr_ptr());
lpPDPt->m_dwCharID = dwCharID;
lpPDPt->m_itemPos = Index;
lpPDPt->m_cNum = cNum;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktPD), CmdCharPullDown, 0, 0);
}
bool SendPacket::CharTakeItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, TakeType TakeType)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktTI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktTI* lpTIPt = reinterpret_cast<PktTI *>(lpMsgBlock->wr_ptr());
lpTIPt->m_dwCharID = dwCharID;
lpTIPt->m_TakeType = TakeType;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktTI), CmdCharTakeItem, 0, 0);
}
bool SendPacket::CharSwapItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID,
TakeType SrcType, TakeType DstType)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSwI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSwI* lpSwIPt = reinterpret_cast<PktSwI *>(lpMsgBlock->wr_ptr());
lpSwIPt->m_dwCharID = dwCharID;
lpSwIPt->m_SwapSrc = SrcType;
lpSwIPt->m_SwapDst = DstType;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSwI), CmdCharSwapItem, 0, 0);
}
bool SendPacket::CharTradeItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID,
unsigned long dwNPCID, unsigned char cCmd,
unsigned short wItemID, TakeType TakeType, Item::ItemPos CouponPos,
Item::CItem* lpItem)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktTr) + Item::MAX_ITEM_SIZE, lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktTr* lpTrPt = reinterpret_cast<PktTr *>(lpMsgBlock->wr_ptr());
lpTrPt->m_dwCustomerID = dwCharID;
lpTrPt->m_dwOwnerID = dwNPCID;
lpTrPt->m_cCmd = cCmd;
lpTrPt->m_wBuyItemID = wItemID;
lpTrPt->m_TakeType = TakeType;
lpTrPt->m_CouponPos = CouponPos;
size_t nItemSize = 0;
if (NULL != lpItem)
{
nItemSize = Item::MAX_ITEM_SIZE;
if (false == lpItem->SerializeOut(lpMsgBlock->wr_ptr() + sizeof(PktTr), nItemSize))
{
return false;
}
}
lpTrPt->m_wSize = static_cast<unsigned short>(nItemSize);
return SendPacket(lpHandler, lpMsgBlock, static_cast<unsigned short>(sizeof(PktTr) + nItemSize),
CmdCharTradeItem, 0, 0);
}
bool SendPacket::CharEquipShopInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned long dwNPCID,
unsigned char cRace, unsigned char cTabPage)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktEquipShopInfo), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktEquipShopInfo* lpESIPt = reinterpret_cast<PktEquipShopInfo *>(lpMsgBlock->wr_ptr());
lpESIPt->m_dwCharID = dwCharID;
lpESIPt->m_dwNPCID = dwNPCID;
lpESIPt->m_cRace = cRace;
lpESIPt->m_cTabPage = cTabPage;
lpESIPt->m_cNum = 0;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktEquipShopInfo), CmdCharEquipShopInfo, 0, 0);
}
bool SendPacket::CharRepairItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwNPCID, Item::ItemPos* lpIndex)
{
CHECK_TRUE_RETURN(0 == dwNPCID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktRpI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktRpI* lpRpIPt = reinterpret_cast<PktRpI *>(lpMsgBlock->wr_ptr());
lpRpIPt->m_dwCharID = dwNPCID;
lpRpIPt->m_itemPos = *lpIndex;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktRpI), CmdCharRepairItem, 0, 0);
}
bool SendPacket::CharRepairAllItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwNPCID)
{
CHECK_TRUE_RETURN(0 == dwNPCID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktRpAI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktRpAI* lpRpAIPt = reinterpret_cast<PktRpAI *>(lpMsgBlock->wr_ptr());
lpRpAIPt->m_dwCharID = dwNPCID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktRpAI), CmdCharRepairAllItem, 0, 0);
}
bool SendPacket::CharUseItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwSenderID,
unsigned long dwRecverID, Item::ItemPos* lpIndex)
{
CHECK_TRUE_RETURN(0 == dwSenderID || 0 == dwRecverID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktUI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktUI* lpUIPt = reinterpret_cast<PktUI *>(lpMsgBlock->wr_ptr());
lpUIPt->m_dwSender = dwSenderID;
lpUIPt->m_dwRecver = dwRecverID;
lpUIPt->m_itemPos = *lpIndex;
lpUIPt->m_cRemainItemNum = 0; // <20>ǹ<EFBFBD> <20><><EFBFBD><EFBFBD>
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktUI), CmdCharUseItem, 0, 0);
}
bool SendPacket::CharCastObject(ClientNet::CClientEventHandler* lpHandler, unsigned long dwSenderID,
unsigned long dwRecverID, CastObject &CastObject)
{
CHECK_TRUE_RETURN(0 == dwSenderID || 0 == dwRecverID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktCO), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCO* lpCOPt = reinterpret_cast<PktCO *>(lpMsgBlock->wr_ptr());
lpCOPt->m_dwSenderID = dwSenderID;
lpCOPt->m_dwReceiverID = dwRecverID;
lpCOPt->m_sCastObject = CastObject;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCO), CmdCharCastObject, 0, 0);
}
bool SendPacket::CharInstallSocket(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID,
Item::ItemPos* lpEquipIndex, Item::ItemPos* lpSocket)
{
CHECK_TRUE_RETURN(0 == dwCharID || NULL == lpEquipIndex || NULL == lpSocket, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktIS), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktIS* lpISPt = reinterpret_cast<PktIS *>(lpMsgBlock->wr_ptr());
lpISPt->m_dwCharID = dwCharID;
lpISPt->m_equipPos = *lpEquipIndex;
lpISPt->m_gemPos = *lpSocket;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktIS), CmdCharInstallSocket, 0, 0);
}
bool SendPacket::CharRuneInstallSocket(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned char ucRunePos,
Item::ItemPos* lpEquipIndex, Item::ItemPos* lpSocket)
{
CHECK_TRUE_RETURN(0 == dwCharID || NULL == lpEquipIndex || NULL == lpSocket, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktIRS), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktIRS* lpIRSPt = reinterpret_cast<PktIRS *>(lpMsgBlock->wr_ptr());
/*char pos = PktIRS::RUNE_POS_RUNE1;
if( ucRunePos == 1 )
pos = PktIRS::RUNE_POS_RUNE2;*/
lpIRSPt->m_dwCharID = dwCharID;
lpIRSPt->m_equipPos = *lpEquipIndex;
lpIRSPt->m_runePos = *lpSocket;
//lpIRSPt->m_cRuneSocketPos = pos ;
lpIRSPt->m_cType = PktIRS::RUNE_INSTALL ;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktIRS), CmdCharInstallRuneSocket, 0, 0);
}
bool SendPacket::CharRuneRemoveSocket(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned char ucRunePos,
Item::ItemPos* lpEquipIndex, Item::ItemPos* lpSocket)
{
CHECK_TRUE_RETURN(0 == dwCharID || NULL == lpEquipIndex || NULL == lpSocket, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktIRS), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktIRS* lpIRSPt = reinterpret_cast<PktIRS *>(lpMsgBlock->wr_ptr());
/*char pos = PktIRS::RUNE_POS_RUNE1;
if( ucRunePos == 1 )
pos = PktIRS::RUNE_POS_RUNE2;*/
lpIRSPt->m_dwCharID = dwCharID;
lpIRSPt->m_equipPos = *lpEquipIndex;
lpIRSPt->m_runePos = *lpSocket;
//lpIRSPt->m_cRuneSocketPos = pos ;
lpIRSPt->m_cType = PktIRS::RUNE_UNINSTALL ;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktIRS), CmdCharInstallRuneSocket, 0, 0);
}
bool SendPacket::CharItemChemical(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID,
Item::ItemPos* lpPickkingPos, Item::ItemPos* lpTargetPos, unsigned char cPickkingNum)
{
CHECK_TRUE_RETURN(0 == dwCharID || NULL == lpPickkingPos || NULL == lpTargetPos, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktItemChemical), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktItemChemical* lpICPt = reinterpret_cast<PktItemChemical *>(lpMsgBlock->wr_ptr());
lpICPt->m_dwCharID = dwCharID;
lpICPt->m_pickkingPos = *lpPickkingPos;
lpICPt->m_targetPos = *lpTargetPos;
lpICPt->m_cPickkingNum = cPickkingNum;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktItemChemical), CmdCharItemChemical, 0, 0);
}
bool SendPacket::CharUpgradeItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwNPCID)
{
CHECK_TRUE_RETURN(0 == dwNPCID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktUgI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktUgI* lpUgIPt = reinterpret_cast<PktUgI *>(lpMsgBlock->wr_ptr());
lpUgIPt->m_dwNPCID = dwNPCID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktUgI), CmdCharUpgradeItem, 0, 0);
}
bool SendPacket::CharItemOptionGraft(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned char cAttributeType)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktItemOptionGraft), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktItemOptionGraft* lpIOGPt = reinterpret_cast<PktItemOptionGraft *>(lpMsgBlock->wr_ptr());
lpIOGPt->m_dwCharID = dwCharID;
lpIOGPt->m_cAttributeType = cAttributeType;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktItemOptionGraft), CmdCharItemOptionGraft, 0, 0);
}
bool SendPacket::CharItemCompensation(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktItemCompensation), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktItemCompensation* lpICPt = reinterpret_cast<PktItemCompensation *>(lpMsgBlock->wr_ptr());
lpICPt->m_dwCharID = dwCharID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktItemCompensation), CmdCharItemCompensation, 0, 0);
}
bool SendPacket::CharSplitItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, TakeType &TakeType)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSplt), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSplt* lpSpltPt = reinterpret_cast<PktSplt *>(lpMsgBlock->wr_ptr());
lpSpltPt->m_dwCharID = dwCharID;
lpSpltPt->m_TakeType = TakeType;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSplt), CmdCharSplitItem, 0, 0);
}
bool SendPacket::CharAutoRouting(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID,
unsigned __int64 nObjectID, unsigned short wItemID, Item::ItemPos Index)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktAutoRouting), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktAutoRouting* lpARPt = reinterpret_cast<PktAutoRouting *>(lpMsgBlock->wr_ptr());
lpARPt->m_dwCharID = dwCharID;
lpARPt->m_nObjectID = nObjectID;
lpARPt->m_wItemID = wItemID;
lpARPt->m_itemPos = Index;
lpARPt->m_cCmd = (TakeType::TS_INVEN == Index.m_cPos) ?
PktAutoRouting::ARC_POSSIBLE : PktAutoRouting::ARC_IMPOSSIBLE;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktAutoRouting), CmdCharAutoRouting, 0, 0);
}
bool SendPacket::StoreLogin(ClientNet::CClientEventHandler* lpHandler, char *Password, char PassSave)
{
CHECK_TRUE_RETURN(NULL == Password, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktDeposit), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktDeposit* lpDeposit = reinterpret_cast<PktDeposit*>(lpMsgBlock->wr_ptr());
lpDeposit->m_cCmd = PktDeposit::LOGIN;
memcpy(&lpDeposit->m_szData[0], Password, Deposit::PASSWORD_LENGTH);
lpDeposit->m_szData[4] = PassSave;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktDeposit), CmdDeposit, 0);
}
bool SendPacket::StoreLogout(ClientNet::CClientEventHandler* lpHandler)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktDeposit), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktDeposit* lpDeposit = reinterpret_cast<PktDeposit*>(lpMsgBlock->wr_ptr());
lpDeposit->m_cCmd = PktDeposit::LOGOUT;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktDeposit), CmdDeposit, 0);
}
bool SendPacket::StoreBuyTab(ClientNet::CClientEventHandler* lpHandler, char TabNum)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktDeposit), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktDeposit* lpDeposit = reinterpret_cast<PktDeposit*>(lpMsgBlock->wr_ptr());
lpDeposit->m_cCmd = PktDeposit::BUY_TAB;
lpDeposit->m_szData[0] = TabNum;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktDeposit), CmdDeposit, 0);
}
bool SendPacket::StoreChangePass(ClientNet::CClientEventHandler* lpHandler, char *Password, char *NewPassword)
{
CHECK_TRUE_RETURN(NULL == Password || NULL == NewPassword, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktDeposit), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktDeposit* lpDeposit = reinterpret_cast<PktDeposit*>(lpMsgBlock->wr_ptr());
lpDeposit->m_cCmd = PktDeposit::CHANGE_PASS;
memcpy(&lpDeposit->m_szData[0], Password, Deposit::PASSWORD_LENGTH);
memcpy(&lpDeposit->m_szData[4], NewPassword, Deposit::PASSWORD_LENGTH);
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktDeposit), CmdDeposit, 0);
}
bool SendPacket::CharStallOpen(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, char* StallName)
{
CHECK_TRUE_RETURN(NULL == StallName || 0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktStO), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktStO* lpStOPt = reinterpret_cast<PktStO *>(lpMsgBlock->wr_ptr());
lpStOPt->m_dwCharID = dwCharID;
strncpy(lpStOPt->m_StallName, StallName, PktStO::MAX_STALL_NAME_LEN);
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktStO), CmdCharStallOpen, 0, 0);
}
bool SendPacket::CharStallRegisterItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned long dwShopID,
TakeType TakeType, unsigned long dwPrice, unsigned char cCmd)
{
CHECK_TRUE_RETURN(0 == dwCharID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktStRI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktStRI* lpStRIPt = reinterpret_cast<PktStRI *>(lpMsgBlock->wr_ptr());
lpStRIPt->m_dwCharID = dwCharID;
lpStRIPt->m_dwShopID = dwShopID;
lpStRIPt->m_TakeType = TakeType;
lpStRIPt->m_dwPrice = dwPrice;
lpStRIPt->m_cCmd = cCmd;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktStRI), CmdCharStallRegisterItem, 0, 0);
}
bool SendPacket::CharStallEnter(ClientNet::CClientEventHandler* lpHandler,
unsigned long dwCustomerID, unsigned long dwOwner)
{
CHECK_TRUE_RETURN(0 == dwCustomerID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktStE), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktStE* lpStEPt = reinterpret_cast<PktStE *>(lpMsgBlock->wr_ptr());
lpStEPt->m_dwCustomerID = dwCustomerID;
lpStEPt->m_dwOwnerID = dwOwner;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktStE), CmdCharStallEnter, 0, 0);
}
bool SendPacket::CharTakeItems(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID,
unsigned char cTakeNum, TakeType* lpTakeTypes)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktTIs) + sizeof(TakeType) * cTakeNum, lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktTIs* lpTIsPt = reinterpret_cast<PktTIs *>(lpMsgBlock->wr_ptr());
lpTIsPt->m_dwCharID = dwCharID;
lpTIsPt->m_TakeNum = cTakeNum;
CopyMemory(lpMsgBlock->wr_ptr() + sizeof(PktTIs), lpTakeTypes, sizeof(TakeType) * cTakeNum);
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktTIs) + sizeof(TakeType) * cTakeNum, CmdCharTakeItems, 0, 0);
}
bool SendPacket::CharTakeGold(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID,
unsigned char cSrcPos, unsigned char cDstPos, unsigned long dwGold)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktTG), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktTG* lpTGPt = reinterpret_cast<PktTG *>(lpMsgBlock->wr_ptr());
lpTGPt->m_dwCharID = dwCharID;
lpTGPt->m_cSrcPos = cSrcPos;
lpTGPt->m_cDstPos = cDstPos;
lpTGPt->m_dwGold = dwGold;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktTG), CmdCharTakeGold, 0, 0);
}
bool SendPacket::CharExchangeCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwSenderID,
unsigned long dwRecverID, unsigned char cCmd)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktExC), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktExC* lpExCPt = reinterpret_cast<PktExC *>(lpMsgBlock->wr_ptr());
lpExCPt->m_dwSenderID = dwSenderID;
lpExCPt->m_dwRecverID = dwRecverID;
lpExCPt->m_cCmd = cCmd;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktExC), CmdCharExchangeCmd, 0, 0);
}
bool SendPacket::CharQuickSlotMove(ClientNet::CClientEventHandler* lpHandler,
TakeType &TakeType, unsigned short usSkillID)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktQSM), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktQSM* lpQSMPt = reinterpret_cast<PktQSM *>(lpMsgBlock->wr_ptr());
lpQSMPt->m_TakeType = TakeType;
lpQSMPt->m_usSkillID = usSkillID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktQSM), CmdCharQuickSlotMove, 0, 0);
}
bool SendPacket::CharCastObjectInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long dwSenderID,
unsigned long dwRecverID, CastObject &CastObject)
{
CHECK_TRUE_RETURN(0 == dwSenderID || 0 == dwRecverID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktCOInfo), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCOInfo* lpCOInfoPt = reinterpret_cast<PktCOInfo *>(lpMsgBlock->wr_ptr());
lpCOInfoPt->m_dwSenderID = dwSenderID;
lpCOInfoPt->m_dwReceiverID = dwRecverID;
lpCOInfoPt->m_sCastObject = CastObject;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCOInfo), CmdCharCastObjectInfo, 0, 0);
}

View File

@@ -0,0 +1,63 @@
#ifndef _GAMA_CLIENT_SEND_ITEM_H_
#define _GAMA_CLIENT_SEND_ITEM_H_
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
struct TakeType;
struct CastObject;
class ClientSocket;
namespace ClientNet
{
class CClientEventHandler;
}
namespace Item
{
class CItem;
struct ItemPos;
}
namespace SendPacket
{
bool CharPickUp(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned __int64 nObjectID, Item::ItemPos Index);
bool CharPullDown(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, Item::ItemPos Index, unsigned char cNum);
bool CharTakeItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, TakeType TakeType);
bool CharSwapItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, TakeType SrcType, TakeType DstType);
bool CharTradeItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned long dwNPCID, unsigned char cCmd, unsigned short wItemID, TakeType TakeType, Item::ItemPos CouponPos, Item::CItem* lpItem);
bool CharEquipShopInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned long dwNPCID, unsigned char cRace, unsigned char cTabPage);
bool CharRepairItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwNPCID, Item::ItemPos* lpIndex);
bool CharRepairAllItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwNPCID);
bool CharUseItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwSenderID, unsigned long dwRecver, Item::ItemPos* lpIndex);
bool CharCastObject(ClientNet::CClientEventHandler* lpHandler, unsigned long dwSenderID, unsigned long dwRecverID, CastObject &CastObject);
bool CharInstallSocket(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, Item::ItemPos* lpEquipIndex, Item::ItemPos* lpSocket);
bool CharRuneInstallSocket(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned char ucRunePos, Item::ItemPos* lpEquipIndex, Item::ItemPos* lpSocket);
bool CharRuneRemoveSocket(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned char ucRunePos, Item::ItemPos* lpEquipIndex, Item::ItemPos* lpSocket);
bool CharItemChemical(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, Item::ItemPos* lpPickkingPos, Item::ItemPos* lpTargetPos, unsigned char cPickkingNum);
bool CharUpgradeItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwNPCID);
bool CharItemOptionGraft(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned char cAttributeType);
bool CharItemCompensation(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID);
bool CharSplitItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, TakeType &TakeType);
bool CharAutoRouting(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned __int64 nObjectID, unsigned short wItemID, Item::ItemPos Index);
bool StoreLogin(ClientNet::CClientEventHandler* lpHandler, char *Password, char PassSave);
bool StoreLogout(ClientNet::CClientEventHandler* lpHandler);
bool StoreBuyTab(ClientNet::CClientEventHandler* lpHandler, char TabNum);
bool StoreChangePass(ClientNet::CClientEventHandler* lpHandler, char *Password, char *NewPassword);
bool CharStallOpen(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, char* StallName);
bool CharStallRegisterItem(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned long dwShopID, TakeType TakeType, unsigned long dwPrice, unsigned char cCmd);
bool CharStallEnter(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCustomerID, unsigned long dwOwner);
bool CharTakeItems(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned char cTakeNum, TakeType* lpTakeTypes);
bool CharTakeGold(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID, unsigned char cSrcPos, unsigned char cDstPos, unsigned long dwGold);
bool CharExchangeCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long dwSenderID, unsigned long dwRecverID, unsigned char cCmd);
bool CharQuickSlotMove(ClientNet::CClientEventHandler* lpHandler, TakeType &TakeType, unsigned short usSkillID);
bool CharCastObjectInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long dwSenderID,
unsigned long dwRecverID, CastObject &CastObject);
};
#endif

View File

@@ -0,0 +1,126 @@
#include "stdafx.h"
#include <Network/ClientSocket/ClientSocket.h>
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
#include <Network/Packet/PacketStruct/CharLoginoutPacket.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Network/Packet/PacketStruct/GuildPacket.h>
#include "SendPacket.h"
#include "SendLoginout.h"
#include "GMMemory.h"
bool SendPacket::CharLogin(ClientSocket& clientSocket, unsigned long dwUID,
unsigned long dwCID, unsigned long dwSessionID)
{
clientSocket.ClearAddress(ClientSocket::MoveZoneAddr);
CHECK_TRUE_RETURN(0 == dwUID || 0 == dwCID, false);
ClientNet::CClientEventHandler* lpHandler =
&clientSocket.GetHandler(ClientSocket::GameEventHandler);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktCLi), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCLi* lpCLiPt = reinterpret_cast<PktCLi *>(lpMsgBlock->wr_ptr());
lpCLiPt->m_dwSessionID = dwSessionID;
lpCLiPt->m_dwUserID = dwUID;
lpCLiPt->m_dwCharID = dwCID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCLi), CmdCharLogin, 0, 0);
}
bool SendPacket::CharLogout(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCloseReason)
{
CHECK_TRUE_RETURN(0 == dwCID, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktCLo), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCLo* lpCLoPt = reinterpret_cast<PktCLo *>(lpMsgBlock->wr_ptr());
lpCLoPt->m_dwCharID = dwCID;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCLo), CmdCharLogout, 0, 0);
}
// sphawk : ä<><C3A4> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1<><31> <20>־<EFBFBD> <20>ּ<EFBFBD><D6BC><EFBFBD>.
bool SendPacket::CharMoveZone(ClientNet::CClientEventHandler* lpHandler, char cZone, char cChannel, POS& NewPos_In)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSZMv), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSZMv* lpSZMvPt = reinterpret_cast<PktSZMv *>(lpMsgBlock->wr_ptr());
lpSZMvPt->m_cChannel = cChannel;
lpSZMvPt->m_cZone = cZone;
lpSZMvPt->m_NewPos = NewPos_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSZMv), CmdCharMoveZone, 0, 0);
}
bool SendPacket::ServerZone(ClientNet::CClientEventHandler* lpHandler, char cZone,char cChannel)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSZ), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktSZ* lpSZPt = reinterpret_cast<PktSZ *>(lpMsgBlock->wr_ptr());
lpSZPt->m_cZone = cZone;
lpSZPt->m_cChannel = cChannel;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSZ), CmdServerZone, 0, 0);
}
bool SendPacket::CSAuthReturnCode(ClientNet::CClientEventHandler* lpHandler,
unsigned long dwCID, unsigned long dwAuthCodeType,
unsigned long dwReturnCode, const _GG_AUTH_DATA* lpAnswerCode)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktCSAuth), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCSAuth* lpCSAuthPt = reinterpret_cast<PktCSAuth *>(lpMsgBlock->wr_ptr());
lpCSAuthPt->m_dwCharID = dwCID;
lpCSAuthPt->m_AuthCodeType = dwAuthCodeType;
lpCSAuthPt->m_dwAuthCode = dwReturnCode;
lpCSAuthPt->m_AuthCode2 = *lpAnswerCode;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCSAuth), CmdCSAuth, 0, 0);
}
bool SendPacket::KeyInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long* pKeyInfo)
{
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktKeyInfo), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktKeyInfo* lpKeyInfo = reinterpret_cast<PktKeyInfo*>(lpMsgBlock->wr_ptr());
lpKeyInfo->m_dwCID = dwCID;
memcpy(lpKeyInfo->m_dwKeyInfo, pKeyInfo, sizeof(unsigned long)*PktKeyInfo::MAX_KEY_INFO);
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktKeyInfo), CmdKeyInfo, 0, 0);
}

View File

@@ -0,0 +1,29 @@
#ifndef _GAMA_CLIENT_SEND_LOGIN_OUT_H_
#define _GAMA_CLIENT_SEND_LOGIN_OUT_H_
#include <DB/DBDefine.h>
struct _GG_AUTH_DATA;
class ClientSocket;
namespace ClientNet
{
class CClientEventHandler;
}
namespace SendPacket
{
bool CharLogin(ClientSocket& clientSocket, unsigned long dwUID, unsigned long dwCID, unsigned long dwSessionID);
bool CharLogout(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long dwCloseReason);
bool CharMoveZone(ClientNet::CClientEventHandler* lpHandler, char cZone, char cChannel, POS& NewPos_In);
bool ServerZone(ClientNet::CClientEventHandler* lpHandler, char cZone, char cChannel);
// AuthCodeType<70><65><31><C8A4> 2<><32>
bool CSAuthReturnCode(ClientNet::CClientEventHandler* lpHandler,
unsigned long dwCID, unsigned long dwAuthCodeType,
unsigned long dwReturnCode, const _GG_AUTH_DATA* lpAnswerCode);
bool KeyInfo(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCID, unsigned long* pKeyInfo);
};
#endif

View File

@@ -0,0 +1,160 @@
#include "stdafx.h"
#include "SendMove.h"
#include "SendPacket.h"
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/ClientSocket/ClientSocket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/AddressPacket.h>
#include <Network/Packet/PacketStruct/CharMovePacket.h>
#include <Network/Packet/PacketStruct/CharStatusPacket.h>
#include <mmsystem.h>
#include "GMMemory.h"
// TODO : ä<>ü<EFBFBD><C3BC><EFBFBD><EFBFBD>ε<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD> <20>ܺο<DCBA><CEBF><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>.
// TODO : 1<>и<EFBFBD><D0B8><EFBFBD> <20>ѹ<EFBFBD><D1B9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UDP<44><50>Ŷ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20>ϵ<EFBFBD><CFB5><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>.
/*
bool SendPacket::CharMoveUpdate(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In,
bool SitMode_In, POS* Pos_In, float Dir_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktMU), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktMU* lpMUPt = reinterpret_cast<PktMU *>(lpMsgBlock->wr_ptr());
lpMUPt->m_dwTick = timeGetTime(); // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ƾ
lpMUPt->m_bSitMode = SitMode_In;
lpMUPt->m_Position = *Pos_In;
lpMUPt->m_fDir = Dir_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktMU), CmdCharMoveUpdate, 0, 0);
}
bool SendPacket::CharUpdateAddress(ClientSocket& clientSocket, unsigned long CharID_In)
{
ClientNet::CSession& Session = clientSocket.GetSession(ClientSocket::UDPSession);
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktUA), INET_Addr(
reinterpret_cast<SOCKADDR&>(clientSocket.GetAddress(ClientSocket::GameServerUDPAddr)), sizeof(SOCKADDR_IN)), CmdCharUpdateAddress);
CHECK_NULL_RETURN(lpMsgBlock, false);
PktUA* lpUAPt = reinterpret_cast<PktUA *>(lpMsgBlock->wr_ptr());
lpUAPt->m_dwCharID = CharID_In;
lpUAPt->m_PrivateAddress = clientSocket.GetAddress(ClientSocket::PrivateAddr);
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktUA), CmdCharUpdateAddress, 0, 0);
}
bool SendPacket::CharAddressInfo(ClientSocket& clientSocket, unsigned long CharID_In, unsigned long TargetID_In)
{
ClientNet::CSession& Session = clientSocket.GetSession(ClientSocket::UDPSession);
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktAI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktAI* lpAIPt = reinterpret_cast<PktAI *>(lpMsgBlock->wr_ptr());
lpAIPt->m_AddressInfo.m_dwCharID = CharID_In;
lpAIPt->m_AddressInfo.m_PublicAddress = clientSocket.GetAddress(ClientSocket::PublicAddr);
lpAIPt->m_AddressInfo.m_PrivateAddress = clientSocket.GetAddress(ClientSocket::PrivateAddr);
SendUDPList(Session, clientSocket.GetUDPList(ClientSocket::ListType_Client),
TargetID_In, lpMsgBlock, sizeof(PktAI), CmdCharAddressInfo, 0, 0);
return true;
}
bool SendPacket::CharMove(ClientSocket& clientSocket, unsigned long CharID_In, POS* Pos_In,
float Dir_In, unsigned short UAct_In, unsigned short LAct_In,
char Level_In, unsigned long ChantEf_In, unsigned long EnchantEf_In)
{
ClientNet::CSession& Session = clientSocket.GetSession(ClientSocket::UDPSession);
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktMV), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktMV* lpMVPt = reinterpret_cast<PktMV *>(lpMsgBlock->wr_ptr());
lpMVPt->m_dwCharID = CharID_In;
lpMVPt->m_Position = *Pos_In;
lpMVPt->m_fDir = Dir_In;
lpMVPt->m_wUAct = UAct_In;
lpMVPt->m_wLAct = LAct_In;
lpMVPt->m_wLevel = Level_In;
lpMVPt->m_dwChantEf = ChantEf_In;
lpMVPt->m_dwEnchantEf = EnchantEf_In;
SendUDPList(Session, clientSocket.GetUDPList(ClientSocket::ListType_Instance),
clientSocket.IsRealIP(), lpMsgBlock, sizeof(PktMV), CmdCharMove, 0, 0);
clientSocket.DeleteInstanceUDPList();
return true;
}
*/
bool SendPacket::CharMoveEx(ClientSocket& clientSocket, unsigned long CharID_In,
CNetworkPos& netPos, unsigned char UAct_In, unsigned char LAct_In)
{
ClientNet::CClientEventHandler* lpHandler = &clientSocket.GetHandler(ClientSocket::GameEventHandler);
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktMVEx), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktMVEx* lpPktMVEx = reinterpret_cast<PktMVEx*>(lpMsgBlock->wr_ptr());
lpPktMVEx->m_NetworkPos = netPos;
lpPktMVEx->m_cUAct = UAct_In;
lpPktMVEx->m_cLAct = LAct_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktMVEx), CmdCharMove, CharID_In);
}
/* NOT USE
bool SendPacket::CharRequireInfo(ClientSocket& clientSocket, unsigned long SenderID_In,
unsigned long TargetID_In, unsigned char Cmd_In)
{
ClientNet::CSession& Session = clientSocket.GetSession(ClientSocket::UDPSession);
CHECK_TRUE_RETURN(0 == SenderID_In || 0 == TargetID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktRI), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktRI* lpRIPt = reinterpret_cast<PktRI *>(lpMsgBlock->wr_ptr());
lpRIPt->m_dwCharID = SenderID_In;
lpRIPt->m_cCmd = Cmd_In;
lpRIPt->m_PublicAddress = clientSocket.GetAddress(ClientSocket::PublicAddr);
lpRIPt->m_PrivateAddress = clientSocket.GetAddress(ClientSocket::PrivateAddr);
SendUDPList(Session, clientSocket.GetUDPList(ClientSocket::ListType_Client),
TargetID_In, lpMsgBlock, sizeof(PktRI), CmdCharRequireInfo, 0, 0);
return true;
}
*/

View File

@@ -0,0 +1,34 @@
#ifndef _GAMA_CLIENT_SEND_MOVE_H_
#define _GAMA_CLIENT_SEND_MOVE_H_
#include <Network/Address/INET_Addr.h>
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
class ClientSocket;
class CNetworkPos;
struct POS;
namespace ClientNet
{
// forward decl.
class CClientEventHandler;
}
namespace SendPacket
{
bool CharMoveUpdate(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, bool SitMode_In, POS* Pos_In, float Dir_In);
bool CharMoveEx(ClientSocket& clientSocket, unsigned long CharID_In,
CNetworkPos& netPos, unsigned char UAct_In, unsigned char LAct_In);
/* DEPLECATED
// TODO : REMOVE UDP Packets
bool CharUpdateAddress(ClientSocket& clientSocket, unsigned long CharID_In);
bool CharAddressInfo(ClientSocket& clientSocket, unsigned long CharID_In, unsigned long TargetID_In);
bool CharMove(ClientSocket& clientSocket, unsigned long CharID_In, POS* Pos_In, float Dir_In, unsigned short UAct_In,
unsigned short LAct_In, char Level_In, unsigned long ChantEf_In, unsigned long EnchantEf_In);
bool CharRequireInfo(ClientSocket& clientSocket, unsigned long SenderID_In, unsigned long TargetID_In, unsigned char Cmd_In);
*/
};
#endif

View File

@@ -0,0 +1,41 @@
#include "stdafx.h"
#include "../ClientSocket.h"
#include "SendPacket.h"
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/ClientNetwork/NetworkMsgBlock.h>
#include "GMMemory.h"
bool SendPacket::SendPacket(ClientNet::CClientEventHandler* lpHandler,
ClientNet::CNetworkMsgBlock* lpNetworkMsgBlock,
unsigned short Len_In, unsigned char Cmd_In,
unsigned short State_In, unsigned short Error_In)
{
if (0 != lpNetworkMsgBlock &&
lpNetworkMsgBlock->WrapCrypt(Len_In, Cmd_In, State_In, Error_In) &&
!ClientSocket::IsNSFlagChainChecked(Cmd_In))
{
ClientSocket::SetNSFlagOn( Cmd_In );
lpHandler->SendPacket(lpNetworkMsgBlock);
return true;
}
ClientNet::CNetworkMsgPool::GetInstance().FreeNetworkMsgBlock(lpNetworkMsgBlock);
return false;
}
bool SendPacket::SendPacket(ClientNet::CClientEventHandler* lpHandler,
ClientNet::CNetworkMsgBlock* lpNetworkMsgBlock,
unsigned short Len_In, unsigned char Cmd_In, unsigned long Tick_In)
{
if (0 != lpNetworkMsgBlock &&
lpNetworkMsgBlock->WrapCrypt(Len_In, Cmd_In, Tick_In) &&
!ClientSocket::IsNSFlagChainChecked(Cmd_In))
{
ClientSocket::SetNSFlagOn( Cmd_In );
lpHandler->SendPacket(lpNetworkMsgBlock);
return true;
}
ClientNet::CNetworkMsgPool::GetInstance().FreeNetworkMsgBlock(lpNetworkMsgBlock);
return false;
}

View File

@@ -0,0 +1,45 @@
#ifndef _GAMA_CLIENT_PACKET_SEND_H_
#define _GAMA_CLIENT_PACKET_SEND_H_
#include <cstdio>
#define _QUOTE(x) # x
#define QUOTE(x) _QUOTE(x)
#ifdef _DEBUG
#define CHECK_NULL_RETURN(value, retval)\
if(0 == (value)) { fprintf(stderr, QUOTE(__FUNCTION__) " - " QUOTE(value) " is NULL\n"); return (retval); }
#define CHECK_TRUE_RETURN(value, retval)\
if((value)) { fprintf(stderr, QUOTE(__FUNCTION__) " - " QUOTE(value) " is TRUE\n"); return (retval); }
#else
#define CHECK_NULL_RETURN(value, retval) if(0 == (value)) { return (retval); }
#define CHECK_TRUE_RETURN(value, retval) if((value)) { return (retval); }
#endif
namespace ClientNet
{
// forward decl.
class CClientEventHandler;
class CNetworkMsgBlock;
}
namespace SendPacket
{
bool SendPacket(ClientNet::CClientEventHandler* lpHandler,
ClientNet::CNetworkMsgBlock* lpNetworkMsgBlock,
unsigned short Len_In, unsigned char Cmd_In,
unsigned short State_In, unsigned short Error_In);
bool SendPacket(ClientNet::CClientEventHandler* lpHandler,
ClientNet::CNetworkMsgBlock* lpNetworkMsgBlock,
unsigned short Len_In, unsigned char Cmd_In, unsigned long Tick_In);
};
#endif

View File

@@ -0,0 +1,69 @@
#include "stdafx.h"
#include "SendPacket.h"
#include "SendQuest.h"
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/CharQuestPacket.h>
#include "GMMemory.h"
bool SendPacket::CharStartQuest(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID_In,
unsigned long dwNPCID_In, unsigned short wQuestID_In)
{
CHECK_TRUE_RETURN(0 == dwCharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktStartQuest), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktStartQuest* lpSQPt = reinterpret_cast<PktStartQuest *>(lpMsgBlock->wr_ptr());
lpSQPt->m_dwCharID = dwCharID_In;
lpSQPt->m_dwNPCID = dwNPCID_In;
lpSQPt->m_wQuestID = wQuestID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktStartQuest), CmdCharStartQuest, 0, 0);
}
bool SendPacket::CharCancelQuest(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID_In, unsigned short wQuestID_In)
{
CHECK_TRUE_RETURN(0 == dwCharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktCancelQuest), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktCancelQuest* lpCQPt = reinterpret_cast<PktCancelQuest *>(lpMsgBlock->wr_ptr());
lpCQPt->m_dwCharID = dwCharID_In;
lpCQPt->m_wQuestID = wQuestID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktCancelQuest), CmdCharCancelQuest, 0, 0);
}
bool SendPacket::CharOperateTrigger(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID_In, unsigned short wQuestID_In,
unsigned char cPhase_In, unsigned char cTriggerKind_In, unsigned char cTrigger_In, unsigned char cCount_In)
{
CHECK_TRUE_RETURN(0 == dwCharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktOperateTrigger), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
PktOperateTrigger* lpOTPt = reinterpret_cast<PktOperateTrigger *>(lpMsgBlock->wr_ptr());
lpOTPt->m_dwCharID = dwCharID_In;
lpOTPt->m_wQuestID = wQuestID_In;
lpOTPt->m_cPhase = cPhase_In;
lpOTPt->m_cTriggerKind = cTriggerKind_In;
lpOTPt->m_cTrigger = cTrigger_In;
lpOTPt->m_cCount = cCount_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktOperateTrigger), CmdCharOperateTrigger, 0, 0);
}

View File

@@ -0,0 +1,19 @@
#ifndef _GAMA_CLIENT_SEND_QUEST_H_
#define _GAMA_CLIENT_SEND_QUEST_H_
namespace ClientNet
{
// forward decl.
class CClientEventHandler;
}
namespace SendPacket
{
// <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
bool CharStartQuest(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID_In, unsigned long dwNPCID_In, unsigned short wQuestID_In);
bool CharCancelQuest(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID_In, unsigned short wQuestID_In);
bool CharOperateTrigger(ClientNet::CClientEventHandler* lpHandler, unsigned long dwCharID_In, unsigned short wQuestID_In, unsigned char cPhase_In,
unsigned char cTriggerKind_In, unsigned char cTrigger_In, unsigned char cCount_In);
}
#endif

View File

@@ -0,0 +1,69 @@
#include "stdafx.h"
#include "SendPacket.h"
#include "SendSkill.h"
#include <Network/ClientNetwork/ClientEventHandler.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/CharStatusPacket.h>
#include <Network/Packet/PacketStruct/CharAttackPacket.h>
#include "GMMemory.h"
bool SendPacket::CharSkillCreate(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In,
unsigned short SkillID_In, unsigned char Index_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSk), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
LPPktSk lpSkPt = reinterpret_cast<LPPktSk>(lpMsgBlock->wr_ptr());
lpSkPt->m_dwCharID = CharID_In;
lpSkPt->m_wSkill = SkillID_In;
lpSkPt->m_cIndex = Index_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSk), CmdCharSkillCreate, 0, 0);
}
bool SendPacket::CharSkillErase(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In,
unsigned short SkillID_In, unsigned char Index_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSk), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
LPPktSk lpSkPt = reinterpret_cast<LPPktSk>(lpMsgBlock->wr_ptr());
lpSkPt->m_dwCharID = CharID_In;
lpSkPt->m_wSkill = SkillID_In;
lpSkPt->m_cIndex = Index_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSk), CmdCharSkillErase, 0, 0);
}
bool SendPacket::CharSummonCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In,
unsigned char Cmd_In, unsigned long TargetID_In)
{
CHECK_TRUE_RETURN(0 == CharID_In, false);
ClientNet::CNetworkMsgBlock* lpMsgBlock =
ClientNet::CNetworkMsgPool::GetInstance().GetNetworkMsgBlock(sizeof(PktSummonCmd), lpHandler->GetPeerAddress());
CHECK_NULL_RETURN(lpMsgBlock, false);
LPPktSummonCmd lpSuCPt = reinterpret_cast<LPPktSummonCmd>(lpMsgBlock->wr_ptr());
lpSuCPt->m_dwCharID = CharID_In;
lpSuCPt->m_cCmd = Cmd_In;
lpSuCPt->m_dwTargetID = TargetID_In;
return SendPacket(lpHandler, lpMsgBlock, sizeof(PktSummonCmd), CmdCharSummonCmd, 0, 0);
}

View File

@@ -0,0 +1,21 @@
#ifndef _GAMA_CLIENT_SEND_SKILL_PACKET_H_
#define _GAMA_CLIENT_SEND_SKILL_PACKET_H_
#include <Item/ItemStructure.h>
namespace ClientNet
{
// forward decl.
class CClientEventHandler;
}
namespace SendPacket
{
bool CharSkillCreate(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, unsigned short SkillID_In, unsigned char Index_In);
bool CharSkillErase(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, unsigned short SkillID_In, unsigned char Index_In);
bool CharSummonCmd(ClientNet::CClientEventHandler* lpHandler, unsigned long CharID_In, unsigned char Cmd_In, unsigned long TargetID_In = 0);
};
#endif