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:
@@ -0,0 +1,244 @@
|
||||
#include "stdafx.h"
|
||||
#include "SendAdminTool.h"
|
||||
|
||||
#include <Network/Packet/PacketStruct/CharAdminPacket.h>
|
||||
#include <Network/Packet/PacketStruct/GameEventPacket.h>
|
||||
#include <Network/Packet/PacketStruct/CharLoginOutPacketStruct.h>
|
||||
#include <Network/Dispatch/AdminToolDispatch.h>
|
||||
|
||||
#include <Network/Packet/WrapPacket.h>
|
||||
#include <Network/Packet/PacketCommand.h>
|
||||
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
|
||||
#include <DataStorage/StoreData.h>
|
||||
#include <DataStorage/CharacterData.h>
|
||||
|
||||
#include <Log/ServerLog.h>
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
|
||||
bool ItemQtyCheck(unsigned long dwItemTypeID, unsigned long dwItemQty,
|
||||
unsigned long dwCurrentItemQty, time_t tStartTime, time_t tEndTime,
|
||||
unsigned char cType, unsigned short usError)
|
||||
{
|
||||
PktItemQtyControl pktItemQtyControl;
|
||||
memset(&pktItemQtyControl, 0, sizeof(PktItemQtyControl));
|
||||
|
||||
pktItemQtyControl.m_dwItemTypeID = dwItemTypeID;
|
||||
pktItemQtyControl.m_dwItemQty = dwItemQty;
|
||||
pktItemQtyControl.m_dwCurrentItemQty = dwCurrentItemQty;
|
||||
pktItemQtyControl.m_tStartTime = tStartTime;
|
||||
pktItemQtyControl.m_tEndTime = tEndTime;
|
||||
|
||||
pktItemQtyControl.m_cType = cType;
|
||||
pktItemQtyControl.m_cGroup = CServerSetup::GetInstance().GetServerGroup();
|
||||
|
||||
if(PacketWrap::WrapHeader(reinterpret_cast<char*>(&pktItemQtyControl),
|
||||
sizeof(PktItemQtyControl), CmdItemQtyCheck, 0, usError))
|
||||
{
|
||||
DBAgent::CAdminToolDispatch::GetDispatchTable().Process(
|
||||
CSendPacketAllServer(reinterpret_cast<char*>(&pktItemQtyControl),
|
||||
sizeof(PktItemQtyControl), CmdItemQtyCheck));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AdminToolGetDataAck(CSendStream& SendStream, PktAdminToolGetData::GetDataType dataType,
|
||||
unsigned long dwRequestKey, unsigned long dwUID, unsigned long dwCID,
|
||||
const char* lpData, unsigned long dwDataSize, unsigned short usError,
|
||||
unsigned char cOldServerGroupID)
|
||||
{
|
||||
// <20>ִ<EFBFBD> <20><>Ŷ ũ<>⺸<EFBFBD><E2BAB8> ũ<><C5A9> <20><><EFBFBD><EFBFBD>
|
||||
if(sizeof(PktAdminToolGetDataAck) + dwDataSize <= MAX_PACKET_LEN)
|
||||
{
|
||||
char szPacket[PktMaxLen];
|
||||
|
||||
PktAdminToolGetDataAck* lpPktAdminToolGetDataAck =
|
||||
reinterpret_cast<PktAdminToolGetDataAck*>(szPacket);
|
||||
|
||||
lpPktAdminToolGetDataAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktAdminToolGetDataAck->m_dwUID = dwUID;
|
||||
lpPktAdminToolGetDataAck->m_dwCID = dwCID;
|
||||
lpPktAdminToolGetDataAck->m_cType = dataType;
|
||||
lpPktAdminToolGetDataAck->m_cOldServerGroupID = cOldServerGroupID; // Part2Selectable Ÿ<>Կ<EFBFBD><D4BF><EFBFBD> <20>ʿ<EFBFBD>.
|
||||
|
||||
if(0 != lpData && 0 < dwDataSize)
|
||||
{
|
||||
memcpy(lpPktAdminToolGetDataAck + 1, lpData, dwDataSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
dwDataSize = 0;
|
||||
}
|
||||
|
||||
return SendStream.WrapCompress(szPacket,
|
||||
static_cast<unsigned short>(sizeof(PktAdminToolGetDataAck) + dwDataSize),
|
||||
CmdAdminToolGetData, 0, usError);
|
||||
}
|
||||
|
||||
ERRLOG4(g_Log, "UID:%10u / CID:%10u / dwSize:%u / DataType:%d "
|
||||
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + <20><><EFBFBD><EFBFBD> ũ<>Ⱑ <20>ִ<EFBFBD> <20><>Ŷ ũ<><C5A9> <20>̻<EFBFBD><CCBB>Դϴ<D4B4>",
|
||||
dwUID, dwCID, dwDataSize, dataType);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AdminToolSetDataAck(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwCID,
|
||||
unsigned char cType, unsigned short eErrorCode)
|
||||
{
|
||||
PktNewAdminToolSetDataAck* lpSetDataAck = reinterpret_cast<PktNewAdminToolSetDataAck*>(
|
||||
SendStream.GetBuffer(sizeof(PktNewAdminToolSetDataAck)));
|
||||
|
||||
if(0 != lpSetDataAck)
|
||||
{
|
||||
lpSetDataAck->m_dwRequestKey = dwRequestKey;
|
||||
lpSetDataAck->m_dwUID = dwUID;
|
||||
lpSetDataAck->m_dwCID = dwCID;
|
||||
lpSetDataAck->m_cType = cType;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktNewAdminToolSetDataAck),
|
||||
CmdAdminToolSetData, 0, eErrorCode);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline void CopyAndAdvanceDst(char*& lpWritePos, const void* lpData, unsigned long dwSize)
|
||||
{
|
||||
memcpy(lpWritePos, lpData, dwSize);
|
||||
lpWritePos += dwSize;
|
||||
}
|
||||
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EEBFB5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
bool TotalDataToAdminTool(CSendStream& SendStream, unsigned long dwRequestKey, IN_ADDR peerAddr,
|
||||
DataStorage::CStoreData& storeData, DataStorage::CCharacterData& characterData)
|
||||
{
|
||||
unsigned long dwUID = storeData.GetUID();
|
||||
unsigned long dwCID = characterData.GetCID();
|
||||
|
||||
const unsigned long MAX_CHAR_DATA_SIZE = DBUpdateData::MAX_DBUPDATE_SIZE +
|
||||
sizeof(unsigned short) * DBUpdateData::MAX_UPDATE_DB;
|
||||
|
||||
const unsigned long MAX_CHAR_EXTRA_DATA_SIZE = sizeof(CHAR_INFOEX) +
|
||||
sizeof(QUEST) + sizeof(HISTORY) + sizeof(CONFIG) + sizeof(STORE_INFO);
|
||||
|
||||
const unsigned long MAX_FRIEND_BAN_DATA_SIZE =
|
||||
std::max(CFriendList::MAX_FRIENDS_NUM * sizeof(FriendInfo),
|
||||
CBanList::MAX_BAN_NUM * sizeof(BanInfo));
|
||||
|
||||
const unsigned long MAX_ADMIN_TOOL_DATA_SIZE = std::max(
|
||||
std::max(MAX_CHAR_DATA_SIZE, MAX_CHAR_EXTRA_DATA_SIZE), MAX_FRIEND_BAN_DATA_SIZE);
|
||||
|
||||
char* szDataBuffer = new char[MAX_ADMIN_TOOL_DATA_SIZE];
|
||||
|
||||
if(0 == szDataBuffer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const int MAX_ADDR_LEN = 32;
|
||||
char szAdminToolAddr[MAX_ADDR_LEN];
|
||||
_snprintf(szAdminToolAddr, MAX_ADDR_LEN - 1, "%s", inet_ntoa(peerAddr));
|
||||
szAdminToolAddr[MAX_ADDR_LEN - 1] = 0;
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// CHAR_BASIC_DATA <20><><EFBFBD><EFBFBD>
|
||||
|
||||
unsigned long dwCharDataWritten = MAX_ADMIN_TOOL_DATA_SIZE -
|
||||
sizeof(unsigned short) * DBUpdateData::MAX_UPDATE_DB;
|
||||
|
||||
char* szCharData = szDataBuffer + sizeof(unsigned short) * DBUpdateData::MAX_UPDATE_DB;
|
||||
unsigned short* usSizeArray = reinterpret_cast<unsigned short*>(szDataBuffer);
|
||||
|
||||
if(characterData.SerializeOut(szCharData, usSizeArray,
|
||||
dwCharDataWritten, DBUpdateData::MAX_UPDATE_DB))
|
||||
{
|
||||
dwCharDataWritten += sizeof(unsigned short) * DBUpdateData::MAX_UPDATE_DB;
|
||||
|
||||
if(SendPacket::AdminToolGetDataAck(SendStream, PktAdminToolGetData::CHAR_BASIC_DATA,
|
||||
dwRequestKey, dwUID, dwCID, szDataBuffer, dwCharDataWritten, 0))
|
||||
{
|
||||
INFLOG3(g_Log, "UID:%10u / CID:%10u / IP:%15s / <20><EFBFBD><EEBFB5><EFBFBD><EFBFBD> CHAR_BASIC_DATA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", dwUID, dwCID, szAdminToolAddr);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// CHAR_EXTRA_DATA <20><><EFBFBD><EFBFBD>
|
||||
|
||||
char* szExtraDataPos = szDataBuffer;
|
||||
|
||||
CopyAndAdvanceDst(szExtraDataPos, &characterData.GetInfoEx(), sizeof(CHAR_INFOEX));
|
||||
CopyAndAdvanceDst(szExtraDataPos, &characterData.GetQuest(), sizeof(QUEST));
|
||||
CopyAndAdvanceDst(szExtraDataPos, &characterData.GetHistory(), sizeof(HISTORY));
|
||||
CopyAndAdvanceDst(szExtraDataPos, &characterData.GetConfig(), sizeof(CONFIG));
|
||||
CopyAndAdvanceDst(szExtraDataPos, &storeData.GetStoreInfo(), sizeof(STORE_INFO));
|
||||
|
||||
if(SendPacket::AdminToolGetDataAck(SendStream,
|
||||
PktAdminToolGetData::CHAR_EXTRA_DATA, dwRequestKey, dwUID, dwCID, szDataBuffer,
|
||||
static_cast<unsigned long>(szExtraDataPos - szDataBuffer), 0))
|
||||
{
|
||||
INFLOG3(g_Log, "UID:%10u / CID:%10u / IP:%15s / <20><EFBFBD><EEBFB5><EFBFBD><EFBFBD> CHAR_EXTRA_DATA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", dwUID, dwCID, szAdminToolAddr);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// CHAR_FRIEND_DATA
|
||||
// CHAR_BAN_DATA
|
||||
|
||||
unsigned long dwFriendBanWritten = MAX_FRIEND_BAN_DATA_SIZE;
|
||||
|
||||
if(characterData.GetFriendList().SerializeOut(szDataBuffer, dwFriendBanWritten))
|
||||
{
|
||||
if(SendPacket::AdminToolGetDataAck(SendStream, PktAdminToolGetData::CHAR_FRIEND_DATA,
|
||||
dwRequestKey, dwUID, dwCID, szDataBuffer, dwFriendBanWritten, 0))
|
||||
{
|
||||
INFLOG3(g_Log, "UID:%10u / CID:%10u / IP:%15s / <20><EFBFBD><EEBFB5><EFBFBD><EFBFBD> CHAR_FRIEND_DATA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", dwUID, dwCID, szAdminToolAddr);
|
||||
}
|
||||
}
|
||||
|
||||
dwFriendBanWritten = MAX_FRIEND_BAN_DATA_SIZE;
|
||||
if(characterData.GetBanList().SerializeOut(szDataBuffer, dwFriendBanWritten))
|
||||
{
|
||||
if(SendPacket::AdminToolGetDataAck(SendStream, PktAdminToolGetData::CHAR_BAN_DATA,
|
||||
dwRequestKey, dwUID, dwCID, szDataBuffer, dwFriendBanWritten, 0))
|
||||
{
|
||||
INFLOG3(g_Log, "UID:%10u / CID:%10u / IP:%15s / <20><EFBFBD><EEBFB5><EFBFBD><EFBFBD> CHAR_BAN_DATA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", dwUID, dwCID, szAdminToolAddr);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// STORE_12_DATA
|
||||
|
||||
if(SendPacket::AdminToolGetDataAck(SendStream, PktAdminToolGetData::STORE_12_DATA,
|
||||
dwRequestKey, dwUID, dwCID, reinterpret_cast<const char*>(&storeData.GetStore1()), sizeof(STORE), 0))
|
||||
{
|
||||
INFLOG3(g_Log, "UID:%10u / CID:%10u / IP:%15s / <20><EFBFBD><EEBFB5><EFBFBD><EFBFBD> STORE_12_DATA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", dwUID, dwCID, szAdminToolAddr);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// STORE_34_DATA
|
||||
|
||||
if(SendPacket::AdminToolGetDataAck(SendStream, PktAdminToolGetData::STORE_34_DATA,
|
||||
dwRequestKey, dwUID, dwCID, reinterpret_cast<const char*>(&storeData.GetStore2()), sizeof(STORE), 0))
|
||||
{
|
||||
INFLOG3(g_Log, "UID:%10u / CID:%10u / IP:%15s / <20><EFBFBD><EEBFB5><EFBFBD><EFBFBD> STORE_34_DATA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", dwUID, dwCID, szAdminToolAddr);
|
||||
}
|
||||
|
||||
delete [] szDataBuffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef _DBAGENT_SERVER_SEND_ADMIN_TOOL_H_
|
||||
#define _DBAGENT_SERVER_SEND_ADMIN_TOOL_H_
|
||||
|
||||
#include <ctime>
|
||||
#include <Network/Packet/PacketStruct/CharAdminPacket.h>
|
||||
|
||||
// forward decl.
|
||||
class CSendStream;
|
||||
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
|
||||
namespace DataStorage
|
||||
{
|
||||
// forward decl.
|
||||
class CStoreData;
|
||||
class CCharacterData;
|
||||
}
|
||||
|
||||
namespace SendPacket
|
||||
{
|
||||
|
||||
bool ItemQtyCheck(unsigned long dwItemTypeID, unsigned long dwItemQty,
|
||||
unsigned long dwCurrentItemQty, time_t tStartTime, time_t tEndTime,
|
||||
unsigned char cType, unsigned short usError = 0);
|
||||
|
||||
bool AdminToolGetDataAck(CSendStream& SendStream, PktAdminToolGetData::GetDataType dataType,
|
||||
unsigned long dwRequestKey, unsigned long dwUID, unsigned long dwCID,
|
||||
const char* lpData, unsigned long dwDataSize, unsigned short usError,
|
||||
unsigned char cOldServerGroupID = 0);
|
||||
|
||||
bool AdminToolSetDataAck(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwCID, unsigned char cType, unsigned short eErrorCode);
|
||||
|
||||
bool TotalDataToAdminTool(CSendStream& SendStream, unsigned long dwRequestKey, IN_ADDR peerAddr,
|
||||
DataStorage::CStoreData& storeData, DataStorage::CCharacterData& characterData);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,331 @@
|
||||
#include "stdafx.h"
|
||||
#include "SendCharManage.h"
|
||||
|
||||
#include <Network/Stream/SendStream.h>
|
||||
#include <Network/Packet/PacketCommand.h>
|
||||
#include <Network/Packet/PacketStruct/AuthServerToDBAgentServer.h>
|
||||
#include <Network/Packet/PacketStruct/UnifiedCharPacket.h>
|
||||
#include <Network/Packet/PacketStruct/CharItemPacket.h>
|
||||
#include <Network/Packet/PacketStruct/CharStatusPacket.h>
|
||||
#include <Network/Dispatch/GameDispatch.h>
|
||||
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
|
||||
#include <DB/DBdefine.h>
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
|
||||
// WORK_LIST 2.1 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool UserLogin(CSendStream& SendStream, unsigned long dwRequestKey, unsigned long dwUID,
|
||||
const CHAR_VIEW* lpCharView, const sGuildData* lpGuildData, const STORE_INFO* pStoreInfo, unsigned long dwCharViewNum,
|
||||
unsigned char cAccountNation, int nPlayTime, unsigned char cAdminLevel, unsigned char cBillingUser,
|
||||
unsigned char cBillingType, unsigned char cLoginType, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktULDAck));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktULDAck* lpPktULDAck = reinterpret_cast<PktULDAck*>(lpBuffer);
|
||||
|
||||
lpPktULDAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktULDAck->m_wCmd = PktDD::SCmdUserLogin;
|
||||
|
||||
lpPktULDAck->m_nPlayTime = nPlayTime;
|
||||
lpPktULDAck->m_usAdminLevel = cAdminLevel;
|
||||
lpPktULDAck->m_cBillingUser = cBillingUser;
|
||||
lpPktULDAck->m_cBillingType = cBillingType;
|
||||
|
||||
lpPktULDAck->m_cLoginType = cLoginType;
|
||||
|
||||
lpPktULDAck->m_dwUserID = dwUID;
|
||||
|
||||
// WORK_LIST 2.1 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>
|
||||
lpPktULDAck->m_cAccountNation = cAccountNation;
|
||||
|
||||
memset(lpPktULDAck->m_CharView, 0, sizeof(CHAR_VIEW) * PktULDAck::MAX_CHAR_VIEW);
|
||||
memset(lpPktULDAck->m_GuildData, 0, sizeof(sGuildData) * PktULDAck::MAX_CHAR_VIEW);
|
||||
memset(&lpPktULDAck->m_sStoreInfo, 0, sizeof(STORE_INFO));
|
||||
|
||||
if(0 != lpCharView && 0 != dwCharViewNum)
|
||||
{
|
||||
memcpy(lpPktULDAck->m_CharView, lpCharView,
|
||||
sizeof(CHAR_VIEW) * std::min(unsigned long(PktULDAck::MAX_CHAR_VIEW), dwCharViewNum));
|
||||
|
||||
memcpy(lpPktULDAck->m_GuildData, lpGuildData, sizeof(sGuildData) * PktULDAck::MAX_CHAR_VIEW);
|
||||
|
||||
memcpy(&lpPktULDAck->m_sStoreInfo, pStoreInfo, sizeof(STORE_INFO));
|
||||
}
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktULDAck), CmdDBGetData, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
bool CharSelect(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned char cZone, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktCSDAck));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktCSDAck* lpPktCSDAck = reinterpret_cast<PktCSDAck*>(lpBuffer);
|
||||
|
||||
lpPktCSDAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktCSDAck->m_wCmd = PktDD::SCmdCharSelect;
|
||||
lpPktCSDAck->m_cZone = cZone;
|
||||
|
||||
CUserPercentageInZone userPercentageInZone(
|
||||
lpPktCSDAck->m_wChannelNum, cZone, PktCSDAck::MAX_CHANNEL_NUM);
|
||||
|
||||
CGameDispatch::GetDispatchTable().Process(userPercentageInZone);
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktCSDAck), CmdDBGetData, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CharCreate(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwCID, unsigned long dwSlot,
|
||||
const CHAR_VIEW& CharView, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktCCDAck));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktCCDAck* lpPktCCDAck = reinterpret_cast<PktCCDAck*>(lpBuffer);
|
||||
|
||||
lpPktCCDAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktCCDAck->m_wCmd = PktDD::SCmdCharCreate;
|
||||
|
||||
lpPktCCDAck->m_dwCharID = dwCID;
|
||||
lpPktCCDAck->m_dwSlot = dwSlot;
|
||||
lpPktCCDAck->m_CharView = CharView;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktCCDAck), CmdDBGetData, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CharDelete(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwSlot,
|
||||
unsigned long dwCID, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktCDD));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktCDD* lpPktCDDAck = reinterpret_cast<PktCDD*>(lpBuffer);
|
||||
|
||||
lpPktCDDAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktCDDAck->m_wCmd = PktDD::SCmdCharDelete;
|
||||
|
||||
lpPktCDDAck->m_dwUserID = dwUID;
|
||||
lpPktCDDAck->m_dwSlotNum = dwSlot;
|
||||
lpPktCDDAck->m_dwCharID = dwCID;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktCDD), CmdDBGetData, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// WORK_LIST 2.1 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>
|
||||
bool SelectAccountNation(CSendStream& SendStream, unsigned long dwRequestKey, unsigned long dwUID,
|
||||
unsigned char cType, unsigned char cAccountNation, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSAND));
|
||||
|
||||
if (0 != lpBuffer)
|
||||
{
|
||||
PktSAND* lpPktSANDAck = reinterpret_cast<PktSAND*>(lpBuffer);
|
||||
|
||||
lpPktSANDAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktSANDAck->m_wCmd = PktDD::SCmdSelectNation;
|
||||
|
||||
lpPktSANDAck->m_dwUserID = dwUID;
|
||||
lpPktSANDAck->m_cType = cType;
|
||||
lpPktSANDAck->m_cAccountNation = cAccountNation;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktSAND), CmdDBGetData, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// WORK_LIST 2.3 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool NationChangeResult(CSendStream& SendStream, unsigned long dwRequestKey, unsigned long dwUID,
|
||||
unsigned long* aryGID, unsigned long* aryFame)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktANCAck));
|
||||
|
||||
if (0 != lpBuffer)
|
||||
{
|
||||
PktANCAck* lpPktANCAck = reinterpret_cast<PktANCAck*>(lpBuffer);
|
||||
|
||||
lpPktANCAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktANCAck->m_wCmd = PktDD::SCmdNationChangeResult;
|
||||
|
||||
lpPktANCAck->m_dwUserID = dwUID;
|
||||
::memcpy(lpPktANCAck->m_dwGID, aryGID, sizeof(unsigned long) * PktANCAck::MAX_CHAR_VIEW);
|
||||
::memcpy(lpPktANCAck->m_dwFame, aryFame, sizeof(unsigned long) * PktANCAck::MAX_CHAR_VIEW);
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktANCAck), CmdDBGetData, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UnifiedCharInfo(CSendStream& SendStream, unsigned long dwUID,
|
||||
unsigned char cTransferedCharCount, const USER_INFO& userInfo,
|
||||
const UnifiedStoreInfo* lpUnifiedStoreInfo, unsigned long dwUnifiedStoreNum,
|
||||
const UnifiedCharData* lpUnifiedCharData, unsigned long dwUnifiedCharNum)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktUnifiedCharInfo));
|
||||
|
||||
if (0 != lpBuffer)
|
||||
{
|
||||
PktUnifiedCharInfo* lpPktUnifiedCharInfo =
|
||||
reinterpret_cast<PktUnifiedCharInfo*>(lpBuffer);
|
||||
|
||||
lpPktUnifiedCharInfo->dwUID = dwUID;
|
||||
|
||||
unsigned long dwMinUnifiedStoreNum =
|
||||
std::min(unsigned long(PktUnifiedCharInfo::MAX_STORE_INFO), dwUnifiedStoreNum);
|
||||
|
||||
unsigned long dwMinUnifiedCharNum =
|
||||
std::min(unsigned long(PktUnifiedCharInfo::MAX_CHAR_DATA), dwUnifiedCharNum);
|
||||
|
||||
lpPktUnifiedCharInfo->cRestrictedPart1ToPart2Level =
|
||||
CServerSetup::GetInstance().GetRestrictedPart1ToPart2Level();
|
||||
|
||||
unsigned char cMaxTransferCount = CServerSetup::GetInstance().GetMaxTransferPart1ToPart2Count();
|
||||
|
||||
if (cTransferedCharCount <= cMaxTransferCount)
|
||||
{
|
||||
lpPktUnifiedCharInfo->cRemainCharTransferCount = cMaxTransferCount - cTransferedCharCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpPktUnifiedCharInfo->cRemainCharTransferCount = 0;
|
||||
}
|
||||
|
||||
lpPktUnifiedCharInfo->userInfo = userInfo;
|
||||
|
||||
memcpy(lpPktUnifiedCharInfo->unifiedStoreInfo, lpUnifiedStoreInfo,
|
||||
sizeof(UnifiedStoreInfo) * dwMinUnifiedStoreNum);
|
||||
|
||||
memcpy(lpPktUnifiedCharInfo->unifiedCharData, lpUnifiedCharData,
|
||||
sizeof(UnifiedCharData) * dwMinUnifiedCharNum);
|
||||
|
||||
lpPktUnifiedCharInfo->cStoreInfoNum = static_cast<unsigned char>(dwMinUnifiedStoreNum);
|
||||
lpPktUnifiedCharInfo->cCharDataNum = static_cast<unsigned char>(dwMinUnifiedCharNum);
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktUnifiedCharInfo), CmdUnifiedCharInfo, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UnifiedCharSelectReq(CSendStream& SendStream, unsigned long dwUID,
|
||||
unsigned long dwRequestKey, unsigned long* lpdwCID, unsigned long dwCIDNum,
|
||||
unsigned char cSelectedStoreServerGroup, unsigned char cSelectedNation)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktUnifiedCharSelectReq));
|
||||
|
||||
if (0 != lpBuffer)
|
||||
{
|
||||
PktUnifiedCharSelectReq* lpPktUnifiedCharSelectReq =
|
||||
reinterpret_cast<PktUnifiedCharSelectReq*>(lpBuffer);
|
||||
|
||||
memset(lpPktUnifiedCharSelectReq->szPassword,
|
||||
0, sizeof(char) * PktUnifiedCharSelectReq::MAX_PASSWORD_LEN);
|
||||
|
||||
lpPktUnifiedCharSelectReq->dwUID= dwUID;
|
||||
lpPktUnifiedCharSelectReq->dwRequestKey = dwRequestKey;
|
||||
|
||||
memcpy(lpPktUnifiedCharSelectReq->dwCID, lpdwCID,
|
||||
sizeof(unsigned long) * min(long(USER_INFO::MAX_CHAR_NUM), long(dwCIDNum)));
|
||||
|
||||
lpPktUnifiedCharSelectReq->cSelectedServerGroupID = cSelectedStoreServerGroup;
|
||||
lpPktUnifiedCharSelectReq->cSelectedNation = cSelectedNation;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktUnifiedCharSelectReq), CmdUnifiedCharSelect, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool UnifiedCharSelectAck(CSendStream& SendStream, unsigned long dwUID,
|
||||
unsigned long dwRequestKey, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktUnifiedCharSelectAck));
|
||||
|
||||
if (0 != lpBuffer)
|
||||
{
|
||||
PktUnifiedCharSelectAck* lpPktUnifiedCharSelectAck =
|
||||
reinterpret_cast<PktUnifiedCharSelectAck*>(lpBuffer);
|
||||
|
||||
lpPktUnifiedCharSelectAck->dwUID = dwUID;
|
||||
lpPktUnifiedCharSelectAck->dwRequestKey = dwRequestKey;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktUnifiedCharSelectAck),
|
||||
CmdUnifiedCharSelect, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CharUseCashItem(CSendStream& SendStream, unsigned long dwSender, unsigned long dwReceiver,
|
||||
Item::ItemPos itemPos, unsigned char cRemainItemNum, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktUI));
|
||||
|
||||
if (NULL != lpBuffer)
|
||||
{
|
||||
PktUI* lpPktUI = reinterpret_cast<PktUI*>(lpBuffer);
|
||||
|
||||
lpPktUI->m_dwSender = dwSender;
|
||||
lpPktUI->m_dwRecver = dwReceiver;
|
||||
lpPktUI->m_itemPos = itemPos;
|
||||
lpPktUI->m_cRemainItemNum = cRemainItemNum;
|
||||
|
||||
return SendStream.WrapCrypt(sizeof(PktUI), CmdCharUseCashItem, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CharExtraEvent(CSendStream& SendStream, unsigned long dwUID, unsigned long dwCID,
|
||||
unsigned long dwEventID, unsigned long dwValue1, unsigned long dwValue2, unsigned short usError)
|
||||
{
|
||||
// edith 2009.09.05 <20>ű<EFBFBD> <20>̺<EFBFBD>Ʈ <20><><EFBFBD>ۺκ<DBBA>
|
||||
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktExtraEvent));
|
||||
|
||||
if (NULL != lpBuffer)
|
||||
{
|
||||
PktExtraEvent* lpPktEE = reinterpret_cast<PktExtraEvent*>(lpBuffer);
|
||||
|
||||
lpPktEE->m_dwUserID = dwUID;
|
||||
lpPktEE->m_dwCharID = dwCID;
|
||||
lpPktEE->m_dwEventID = dwEventID;
|
||||
lpPktEE->m_dwValue1 = dwValue1;
|
||||
lpPktEE->m_dwValue2 = dwValue2;
|
||||
|
||||
return SendStream.WrapCrypt(sizeof(PktExtraEvent), CmdExtraEvent, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#ifndef _DBAGENT_SERVER_SEND_CHAR_MANAGE_H_
|
||||
#define _DBAGENT_SERVER_SEND_CHAR_MANAGE_H_
|
||||
|
||||
#include <DB/DBdefine.h>
|
||||
#include <Item/Item.h>
|
||||
|
||||
// forward decl.
|
||||
class CSendStream;
|
||||
struct USER_INFO;
|
||||
struct CHAR_VIEW;
|
||||
struct sGuildData;
|
||||
struct UnifiedStoreInfo;
|
||||
struct UnifiedCharData;
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace DataStorage
|
||||
{
|
||||
// forward delc.
|
||||
class CSessionData;
|
||||
}
|
||||
|
||||
namespace SendPacket
|
||||
{
|
||||
// WORK_LIST 2.1 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool UserLogin(CSendStream& SendStream, unsigned long dwRequestKey, unsigned long dwUID,
|
||||
const CHAR_VIEW* lpCharView, const sGuildData* lpGuildData, const STORE_INFO* pStoreInfo, unsigned long dwCharViewNum,
|
||||
unsigned char cAccountNation, int nPlayTime, unsigned char cAdminLevel, unsigned char cBillingUser,
|
||||
unsigned char cBillingType, unsigned char cLoginType, unsigned short usError);
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool CharSelect(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned char cZone, unsigned short usError);
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool CharCreate(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwCID, unsigned long dwSlot, const CHAR_VIEW& CharView, unsigned short usError);
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool CharDelete(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwSlot, unsigned long dwCID, unsigned short usError);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool CharCreateItem(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned char cZone, unsigned short usError);
|
||||
|
||||
// WORK_LIST 2.1 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||||
bool SelectAccountNation(CSendStream& SendStream, unsigned long dwRequestKey, unsigned long dwUID,
|
||||
unsigned char cType, unsigned char cAccountNation, unsigned short usError);
|
||||
|
||||
// WORK_LIST 2.3 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool NationChangeResult(CSendStream& SendStream, unsigned long dwRequestKey, unsigned long dwUID,
|
||||
unsigned long* aryGID, unsigned long* aryFame);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD>սÿ<D5BD><C3BF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
|
||||
bool UnifiedCharInfo(CSendStream& SendStream,
|
||||
unsigned long dwUID, unsigned char cTransferedCharCount, const USER_INFO& userInfo,
|
||||
const UnifiedStoreInfo* lpUnifiedStoreInfo, unsigned long dwUnifiedStoreNum,
|
||||
const UnifiedCharData* lpUnifiedCharData, unsigned long dwUnifiedCharNum);
|
||||
|
||||
// Part1 DB<44>߰輭<DFB0><E8BCAD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
bool UnifiedCharSelectReq(CSendStream& SendStream, unsigned long dwUID,
|
||||
unsigned long dwRequestKey, unsigned long* lpdwCID, unsigned long dwCIDNum,
|
||||
unsigned char cSelectedStoreServerGroup, unsigned char cSelectedNation);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD>и<EFBFBD> <20>ش<EFBFBD>.
|
||||
bool UnifiedCharSelectAck(CSendStream& SendStream, unsigned long dwUID,
|
||||
unsigned long dwRequestKey, unsigned short usError);
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool CharUseCashItem(CSendStream& SendStream, unsigned long dwSender, unsigned long dwReceiver,
|
||||
Item::ItemPos itemPos, unsigned char cRemainItemNum, unsigned short usError);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>̺<EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
bool CharExtraEvent(CSendStream& SendStream, unsigned long dwUID, unsigned long dwCID,
|
||||
unsigned long dwEventID, unsigned long dwValue1, unsigned long dwValue2, unsigned short usError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,114 @@
|
||||
#include "stdafx.h"
|
||||
#include "SendGuild.h"
|
||||
|
||||
#include <Network/Packet/WrapPacket.h>
|
||||
#include <Network/Packet/PacketCommand.h>
|
||||
#include <Network/Packet/PacketStruct/GuildPacket.h>
|
||||
|
||||
#include <Network/Stream/SendStream.h>
|
||||
#include <Network/Dispatch/GameDispatch.h>
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
|
||||
|
||||
bool GuildCmd(CSendStream* lpSendStream,
|
||||
unsigned long dwGID, unsigned long dwSenderID, unsigned long dwReferenceID,
|
||||
unsigned short wCmd, const char* szSenderName, const char* szGuildName, unsigned short wError)
|
||||
{
|
||||
PktGuildCmd pktGuildCmd;
|
||||
memset(&pktGuildCmd, 0, sizeof(PktGuildCmd));
|
||||
|
||||
pktGuildCmd.m_dwGID = dwGID;
|
||||
pktGuildCmd.m_dwSenderID = dwSenderID;
|
||||
pktGuildCmd.m_dwReferenceID = dwReferenceID;
|
||||
pktGuildCmd.m_wCmd = wCmd;
|
||||
|
||||
if(szSenderName)
|
||||
strncpy(pktGuildCmd.m_szSenderName, szSenderName, MAX_MEMBER_NAME_LEN);
|
||||
|
||||
if(szGuildName)
|
||||
strncpy(pktGuildCmd.m_szGuildName, szGuildName, MAX_GUILD_NAME_LEN);
|
||||
|
||||
|
||||
if (PktBase::NO_SERVER_ERR == wError)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
if(PacketWrap::WrapHeader(reinterpret_cast<char*>(&pktGuildCmd),
|
||||
sizeof(PktGuildCmd), CmdGuildCmd, 0, wError))
|
||||
{
|
||||
DBAgent::CGameDispatch::GetDispatchTable().Process(CSendPacketAllServer(
|
||||
reinterpret_cast<char*>(&pktGuildCmd), sizeof(PktGuildCmd), CmdGuildCmd));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(0 != lpSendStream)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD><CEB0><EFBFBD>, <20>ش<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
return lpSendStream->WrapCompress(reinterpret_cast<char*>(&pktGuildCmd),
|
||||
sizeof(PktGuildCmd), CmdGuildCmd, 0, wError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GuildMemberFameUpdate(unsigned long dwCID, unsigned long dwOurGID, unsigned char cType, int nAddFame, unsigned char cZone, unsigned long dwEnemyGID)
|
||||
{
|
||||
PktGuildMemberFameUpdate pktGuildMemberFameUpdate;
|
||||
memset(&pktGuildMemberFameUpdate, 0, sizeof(PktGuildMemberFameUpdate));
|
||||
|
||||
pktGuildMemberFameUpdate.m_dwCID = dwCID;
|
||||
pktGuildMemberFameUpdate.m_dwOurGID = dwOurGID;
|
||||
pktGuildMemberFameUpdate.m_dwEnemyGID = dwEnemyGID;
|
||||
pktGuildMemberFameUpdate.m_cType = cType;
|
||||
pktGuildMemberFameUpdate.m_nAddFame = nAddFame;
|
||||
|
||||
if(PacketWrap::WrapHeader(reinterpret_cast<char*>(&pktGuildMemberFameUpdate),
|
||||
sizeof(PktGuildMemberFameUpdate), CmdGuildMemberFameUpdate, 0, 0))
|
||||
{
|
||||
DBAgent::CGameDispatch::GetDispatchTable().Process(CSendPacketToZone(
|
||||
reinterpret_cast<char*>(&pktGuildMemberFameUpdate),
|
||||
sizeof(PktGuildMemberFameUpdate), CmdGuildMemberFameUpdate, cZone));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GuildMemberGoldUpdate(unsigned long dwCID, unsigned long dwGID, unsigned long dwGold, unsigned char cZone)
|
||||
{
|
||||
PktGuildMemberGoldUpdate pktGuildMemberGoldUpdate;
|
||||
memset(&pktGuildMemberGoldUpdate, 0, sizeof(PktGuildMemberGoldUpdate));
|
||||
|
||||
pktGuildMemberGoldUpdate.m_dwCID = dwCID;
|
||||
pktGuildMemberGoldUpdate.m_dwGID = dwGID;
|
||||
pktGuildMemberGoldUpdate.m_dwGold = dwGold;
|
||||
|
||||
if (PacketWrap::WrapHeader(reinterpret_cast<char*>(&pktGuildMemberGoldUpdate),
|
||||
sizeof(PktGuildMemberGoldUpdate), CmdGuildMemberGoldUpdate, 0, 0))
|
||||
{
|
||||
DBAgent::CGameDispatch::GetDispatchTable().Process(CSendPacketToZone(
|
||||
reinterpret_cast<char*>(&pktGuildMemberGoldUpdate),
|
||||
sizeof(PktGuildMemberGoldUpdate), CmdGuildMemberGoldUpdate, cZone));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*bool KeyInfo(unsigned long dwCID)
|
||||
{
|
||||
PktGuildMemberGoldUpdate pktGuildMemberGoldUpdate;
|
||||
memset(&pktGuildMemberGoldUpdate, 0, sizeof(PktGuildMemberGoldUpdate));
|
||||
|
||||
return false;
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef _DBAGENT_SERVER_SEND_GUILD_H_
|
||||
#define _DBAGENT_SERVER_SEND_GUILD_H_
|
||||
|
||||
// forward decl.
|
||||
class CSendStream;
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
bool GuildCmd(CSendStream* lpSendStream,
|
||||
unsigned long dwGID, unsigned long dwSenderID, unsigned long dwReferenceID,
|
||||
unsigned short wCmd, const char* szSenderName, const char* szGuildName, unsigned short wError);
|
||||
|
||||
bool GuildMemberFameUpdate(unsigned long dwCID, unsigned long dwOurGID,
|
||||
unsigned char cType, int nAddFame, unsigned char cZone, unsigned long dwEnemyGID = 0);
|
||||
|
||||
bool GuildMemberGoldUpdate(unsigned long dwCID,
|
||||
unsigned long dwGID, unsigned long dwGold, unsigned char cZone);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,653 @@
|
||||
#include "stdafx.h"
|
||||
#include "SendLoginout.h"
|
||||
|
||||
#include <Network/Stream/SendStream.h>
|
||||
#include <Network/Packet/PacketStruct/CharLoginOutPacket.h>
|
||||
#include <Network/Packet/PacketStruct/CharLoginOutPacketStruct.h>
|
||||
#include <Network/Packet/PacketStruct/CharItemPacket.h>
|
||||
#include <Network/Packet/PacketStruct/CharQuestPacket.h>
|
||||
#include <Network/Packet/PacketStruct/CharConfigPacket.h>
|
||||
#include <Network/Packet/PacketStruct/AuthServerToDBAgentServer.h>
|
||||
|
||||
#include <DataStorage/StoreData.h>
|
||||
#include <DataStorage/CharacterData.h>
|
||||
#include <DataStorage/SessionData.h>
|
||||
|
||||
#include <Log/ServerLog.h>
|
||||
#include <Network/Packet/PacketCommand.h>
|
||||
|
||||
#include <Community/Party/PartyDBInfo.h>
|
||||
#include <Community/Party/PartyDBMgr.h>
|
||||
|
||||
#include <Community/Guild/GuildDB.h>
|
||||
#include <Community/Guild/GuildDBMgr.h>
|
||||
|
||||
#include <DB/DBComponent.h>
|
||||
#include <DB/GameDBComponent.h>
|
||||
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
|
||||
#include <DataStorage/SessionDataMgr.h>
|
||||
|
||||
#include <GameTime/GameTimeConstants.h>
|
||||
#include <GameTime/GameTimeDBMgr.h>
|
||||
|
||||
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
|
||||
// ģ<><C4A3> / <20>ź<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool Friend(CSendStream& SendStream, unsigned char cCmd, unsigned long dwRequestKey, unsigned long dwUID, unsigned long dwCID,
|
||||
unsigned long dwGID, unsigned short wClass, char cLevel, unsigned long dwServerID, const char* lpData, unsigned long dwDataLen);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>Ʈ / <20><><EFBFBD><EFBFBD><EFBFBD>丮 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool Quest(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwCID,
|
||||
const char* lpQuestBuffer, unsigned long dwQuestSize,
|
||||
const char* lpHistoryBuffer, unsigned long dwHistorySize);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool ConfigInfo(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwCID,
|
||||
const char* lpConfigBuffer, unsigned long dwConfigSize);
|
||||
|
||||
// â<><C3A2> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool DepositData(CSendStream& SendStream, unsigned char cCmd,
|
||||
unsigned long dwRequestKey, unsigned long dwCID, const STORE_INFO& storeInfo);
|
||||
|
||||
// â<><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool DepositDBUpdate(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwCID,
|
||||
unsigned char cTabNum, bool bComplete,
|
||||
const STORE_INFO& storeInfo, const STORE& store);
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool StartSession(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwSessionID,
|
||||
unsigned char cFirstLogin, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSSD));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktSSD* lpPktSSDAck = reinterpret_cast<PktSSD*>(lpBuffer);
|
||||
|
||||
lpPktSSDAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktSSDAck->m_wCmd = PktDD::SCmdStartSession;
|
||||
|
||||
lpPktSSDAck->m_dwUserID = dwUID;
|
||||
lpPktSSDAck->m_dwSessionID = dwSessionID;
|
||||
|
||||
lpPktSSDAck->m_cAgentServerType =
|
||||
static_cast<unsigned char>(CServerSetup::GetInstance().GetAgentServerType());
|
||||
|
||||
lpPktSSDAck->m_cFirstLogin =
|
||||
(UnifiedConst::Part2Selectable != lpPktSSDAck->m_cAgentServerType)
|
||||
? cFirstLogin : static_cast<unsigned char>(CServerSetup::GetInstance().GetSelectableUnifiedServerNum());
|
||||
|
||||
ZeroMemory(lpPktSSDAck->m_AccountName, sizeof(char)*PktSSD::MaxName);
|
||||
ZeroMemory(lpPktSSDAck->m_Password, sizeof(char)*PktSSD::MaxPass);
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktSSD), CmdDBGetData, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD>
|
||||
bool CharLogin(CSendStream& SendStream, DataStorage::CSessionData& SessionData,
|
||||
unsigned long dwRequestKey)
|
||||
{
|
||||
// DBAgent<6E><74> ij<><C4B3><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ƿԴ<C6BF>.
|
||||
// DB<44><42><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>о<EFBFBD><D0BE><EFBFBD> DataStorage::CCharacterData <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
|
||||
|
||||
const unsigned long MAX_BUFFER_SIZE = sizeof(PktDBUpdate) + DBUpdateData::MAX_DBUPDATE_SIZE;
|
||||
|
||||
char szBuffer[MAX_BUFFER_SIZE] = {0,};
|
||||
unsigned long dwBufferSize = MAX_BUFFER_SIZE;
|
||||
|
||||
DataStorage::CCharacterData* lpCharacterData = SessionData.GetCharacterData();
|
||||
DataStorage::CStoreData* lpStoreData = SessionData.GetStoreData();
|
||||
|
||||
if(0 == lpCharacterData || 0 == lpStoreData)
|
||||
{
|
||||
ERRLOG4(g_Log, "UID:%10u / CID:%10u / CCharacterData:%p / CStoreData:%p / "
|
||||
"ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.",
|
||||
SessionData.GetUID(), SessionData.GetCID(), lpCharacterData, lpStoreData);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long dwUID = SessionData.GetUID();
|
||||
unsigned long dwCID = lpCharacterData->GetCID();
|
||||
|
||||
PktDBUpdate* lpPktDBUpdate = reinterpret_cast<PktDBUpdate*>(szBuffer);
|
||||
char* lpDataPos = szBuffer + sizeof(PktDBUpdate);
|
||||
|
||||
unsigned long dwDataSize = MAX_BUFFER_SIZE - sizeof(PktDBUpdate);
|
||||
|
||||
memset(lpPktDBUpdate, 0, sizeof(PktDBUpdate));
|
||||
|
||||
if(!lpCharacterData->SerializeOut(lpDataPos, lpPktDBUpdate->m_usUpdate,
|
||||
dwDataSize, DBUpdateData::MAX_UPDATE_DB))
|
||||
{
|
||||
ERRLOG2(g_Log, "UID:%10u / CID:%10u / ij<><C4B3><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SerializeOut<75><74> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.",
|
||||
SessionData.GetUID(), SessionData.GetCID());
|
||||
}
|
||||
else
|
||||
{
|
||||
// <20>÷<EFBFBD><C3B7>̾<EFBFBD> Ÿ<><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD>ش<EFBFBD>.
|
||||
// <20>α<EFBFBD><CEB1><EFBFBD> <20>Ѵ<EFBFBD>.
|
||||
if (GameRYL::CHINA == CServerSetup::GetInstance().GetNationType())
|
||||
{
|
||||
DBComponent::GameDB::UpdatePlayTime(CDBSingleObject::GetInstance(), dwUID, 0);
|
||||
SessionData.GetPlayTimeFromDB(CDBSingleObject::GetInstance());
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>̾<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ÿ<><C5B8> <20><><EFBFBD><EFBFBD>
|
||||
DBComponent::GameDB::UpdatePremiumService(CDBSingleObject::GetInstance(), dwUID, 0);
|
||||
SessionData.GetPremiumServiceFromDB(CDBSingleObject::GetInstance());
|
||||
|
||||
|
||||
unsigned char cAdminLevel = SessionData.GetAdminLevel();
|
||||
DBUpdateData::UpdateType eUpdateType =
|
||||
(0 != cAdminLevel) ? DBUpdateData::ADMIN_LOGIN : DBUpdateData::LOGIN;
|
||||
|
||||
// <20>뺴 <20><><EFBFBD><EFBFBD>.
|
||||
CGuildDB* lpGuild = static_cast<CGuildDB*>(
|
||||
CGuildDBMgr::GetInstance().GetGuild(lpCharacterData->GetGID()));
|
||||
|
||||
unsigned char cTacticsFlag = 0;
|
||||
|
||||
if(lpGuild)
|
||||
{
|
||||
cTacticsFlag = lpGuild->GetTacticsMember(dwCID);
|
||||
}
|
||||
|
||||
lpPktDBUpdate->m_dlItemSerial = 0;
|
||||
lpPktDBUpdate->m_dwSessionID = SessionData.GetSessionID();
|
||||
lpPktDBUpdate->m_dwUserID = dwUID;
|
||||
lpPktDBUpdate->m_dwCharID = dwCID;
|
||||
lpPktDBUpdate->m_dwRequestKey = dwRequestKey;
|
||||
lpPktDBUpdate->m_Address = SessionData.GetRemoteAddress();
|
||||
lpPktDBUpdate->m_cAdminLevel = cAdminLevel;
|
||||
lpPktDBUpdate->m_cAdminFlag = lpCharacterData->GetAdminFlag();
|
||||
lpPktDBUpdate->m_cTacticsFlag = cTacticsFlag;
|
||||
|
||||
strncpy(lpPktDBUpdate->m_szAccountName,
|
||||
SessionData.GetAccountName(), CHAR_INFOST::MAX_ACCOUNT_LEN);
|
||||
|
||||
lpPktDBUpdate->m_szAccountName[CHAR_INFOST::MAX_ACCOUNT_LEN - 1] = 0;
|
||||
|
||||
// WORK_LIST 2.4 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
lpPktDBUpdate->m_cAccountNation = SessionData.GetAccountNation();
|
||||
lpPktDBUpdate->m_cNameChangeCount = lpCharacterData->GetInfoEx().cNameChangeCount;
|
||||
|
||||
// <20>ν<EFBFBD><CEBD>Ͻ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD><EFBFBD>ε<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD> <20>ƴϸ<C6B4> OFF <20><> <20>ٲ<EFBFBD><D9B2>ش<EFBFBD>.
|
||||
if (lpCharacterData->GetInfoEx().GuildWarFlag == Creature::WAR_INSTANCE &&
|
||||
!CGameTimeDBMgr::GetInstance().IsGuildWarTime())
|
||||
{
|
||||
lpCharacterData->SetGuildWarFlag(Creature::WAR_OFF);
|
||||
}
|
||||
|
||||
if (lpCharacterData->GetInfoEx().RealmWarFlag == Creature::WAR_INSTANCE &&
|
||||
!CGameTimeDBMgr::GetInstance().IsRealmWarReadyTime() &&
|
||||
!CGameTimeDBMgr::GetInstance().IsRealmWarTime())
|
||||
{
|
||||
lpCharacterData->SetRealmWarFlag(Creature::WAR_OFF);
|
||||
}
|
||||
|
||||
|
||||
lpPktDBUpdate->m_cGuildWarFlag = lpCharacterData->GetInfoEx().GuildWarFlag;
|
||||
lpPktDBUpdate->m_cRealmWarFlag = lpCharacterData->GetInfoEx().RealmWarFlag;
|
||||
lpPktDBUpdate->m_cRealmPoint = lpCharacterData->GetInfoEx().RealmPoint;
|
||||
|
||||
lpPktDBUpdate->m_TypeCode = static_cast<unsigned short>(eUpdateType);
|
||||
lpPktDBUpdate->m_PlayTime = SessionData.GetPlayTime();
|
||||
lpPktDBUpdate->m_PremiumTime = SessionData.GetPremiumTime();
|
||||
lpPktDBUpdate->m_PremiumType = SessionData.GetPremiumType();
|
||||
|
||||
if(!SendStream.WrapCompress(szBuffer,
|
||||
static_cast<unsigned short>(sizeof(PktDBUpdate) + dwDataSize), CmdDBUpdateData, 0, 0))
|
||||
{
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20>ϴ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ϸ<EFBFBD><CFB7><EFBFBD> <20><><EFBFBD>Ĵ<EFBFBD>,
|
||||
|
||||
unsigned long dwGID = lpCharacterData->GetGID();
|
||||
unsigned short wClass = lpCharacterData->GetClass();
|
||||
char cLevel = lpCharacterData->GetLevel();
|
||||
|
||||
// Friend <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0><EFBFBD>) //
|
||||
unsigned long dwMemberCID[CFriendList::MAX_FRIENDS_NUM] = {0,};
|
||||
|
||||
// ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> CID <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>´<EFBFBD>. //
|
||||
CFriendList friendList = lpCharacterData->GetFriendList();
|
||||
|
||||
friendList.GetCIDList(dwMemberCID);
|
||||
|
||||
for(unsigned char cIndex = 0; cIndex < friendList.GetFriendNum(); cIndex++)
|
||||
{
|
||||
DataStorage::CSessionData* lpTargetSessionData = DataStorage::CSessionDataMgr::GetInstance().GetCharLoadedSession(dwMemberCID[cIndex]);
|
||||
|
||||
CFriendList::Rebind* lpRebind = friendList.GetFriend(dwMemberCID[cIndex]);
|
||||
|
||||
if(lpRebind)
|
||||
{
|
||||
if(lpTargetSessionData)
|
||||
{
|
||||
DataStorage::CCharacterData* lpTargetCharacterData = lpTargetSessionData->GetCharacterData();
|
||||
|
||||
if(lpTargetCharacterData)
|
||||
{
|
||||
if (DataStorage::CSessionData::SE_USER_ENABLED != lpTargetSessionData->GetSessionState() &&
|
||||
DataStorage::CSessionData::SE_CHAR_ENABLED != lpTargetSessionData->GetSessionState())
|
||||
{
|
||||
lpRebind->UpdateServerID(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Frind <20>ʱ<EFBFBD>ȭ //
|
||||
lpRebind->InitializeFriendInfo(lpTargetCharacterData->GetServerID(), lpTargetCharacterData->GetGID(),
|
||||
lpTargetCharacterData->GetClass(), lpTargetCharacterData->GetLevel());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lpRebind->UpdateServerID(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lpRebind->UpdateServerID(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ģ<><C4A3> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
dwBufferSize = MAX_BUFFER_SIZE;
|
||||
if(friendList.SerializeOut(szBuffer, dwBufferSize))
|
||||
{
|
||||
SendPacket::Friend(SendStream, PktFriendDB::CMD::FRIEND_LIST, dwRequestKey, dwUID, dwCID,
|
||||
dwGID, wClass, cLevel, SessionData.GetServerID(), szBuffer, dwBufferSize);
|
||||
}
|
||||
|
||||
// Ban <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0><EFBFBD>) //
|
||||
|
||||
CBanList banList = lpCharacterData->GetBanList();
|
||||
|
||||
// <20>źθ<C5BA><CEB8><EFBFBD>Ʈ<EFBFBD><C6AE> CID <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>´<EFBFBD>. //
|
||||
banList.GetCIDList(dwMemberCID);
|
||||
|
||||
for(unsigned char cIndex = 0; cIndex < banList.GetBanNum(); cIndex++)
|
||||
{
|
||||
DataStorage::CSessionData* lpTargetSessionData = DataStorage::CSessionDataMgr::GetInstance().GetCharLoadedSession(dwMemberCID[cIndex]);
|
||||
|
||||
CBanList::Rebind* lpRebind = banList.GetBan(dwMemberCID[cIndex]);
|
||||
|
||||
if(lpRebind)
|
||||
{
|
||||
if(lpTargetSessionData)
|
||||
{
|
||||
DataStorage::CCharacterData* lpTargetCharacterData = lpTargetSessionData->GetCharacterData();
|
||||
|
||||
if(lpTargetCharacterData)
|
||||
{
|
||||
if (DataStorage::CSessionData::SE_USER_ENABLED != lpTargetSessionData->GetSessionState() &&
|
||||
DataStorage::CSessionData::SE_CHAR_ENABLED != lpTargetSessionData->GetSessionState())
|
||||
{
|
||||
lpRebind->UpdateServerID(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Frind <20>ʱ<EFBFBD>ȭ //
|
||||
lpRebind->InitializeBanInfo(lpTargetCharacterData->GetServerID(), lpTargetCharacterData->GetGID(),
|
||||
lpTargetCharacterData->GetClass(), lpTargetCharacterData->GetLevel());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
lpRebind->UpdateServerID(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lpRebind->UpdateServerID(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <20>ź<EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
dwBufferSize = MAX_BUFFER_SIZE;
|
||||
if(banList.SerializeOut(szBuffer, dwBufferSize))
|
||||
{
|
||||
SendPacket::Friend(SendStream, PktFriendDB::CMD::BAN_LIST, dwRequestKey, dwUID, dwCID,
|
||||
dwGID, wClass, cLevel, SessionData.GetServerID(), szBuffer, dwBufferSize);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
const QUEST& quest = lpCharacterData->GetQuest();
|
||||
const HISTORY& history = lpCharacterData->GetHistory();
|
||||
|
||||
SendPacket::Quest(SendStream, dwRequestKey, dwUID, dwCID,
|
||||
quest.Data, quest.dwSize, history.Data, history.dwSize);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
const CONFIG& config = lpCharacterData->GetConfig();
|
||||
SendPacket::ConfigInfo(SendStream, dwRequestKey, dwUID, dwCID, config.Data, config.dwSize);
|
||||
|
||||
const STORE_INFO& storeInfo = lpStoreData->GetStoreInfo();
|
||||
|
||||
// â<><C3A2> <20>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD> <20><> â<><C3A2> <20>ݾ<EFBFBD> <20><><EFBFBD><EFBFBD>. <20>ݵ<EFBFBD><DDB5><EFBFBD> DepositDBUpdate<74><65><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>.
|
||||
SendPacket::DepositData(SendStream, PktDeposit::CMD::PASSWORD, dwRequestKey, dwCID, storeInfo);
|
||||
SendPacket::DepositData(SendStream, PktDeposit::CMD::GOLD, dwRequestKey, dwCID, storeInfo);
|
||||
|
||||
// â<><C3A2> <20><><EFBFBD><EFBFBD>
|
||||
const STORE& store1 = lpStoreData->GetStore1();
|
||||
const STORE& store2 = lpStoreData->GetStore2();
|
||||
|
||||
if (0 == store2.dwSize)
|
||||
{
|
||||
SendPacket::DepositDBUpdate(SendStream, dwRequestKey, dwUID, dwCID,
|
||||
PktDepositUpdateDB::TabNum::TAB_12, true, storeInfo, store1);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendPacket::DepositDBUpdate(SendStream, dwRequestKey, dwUID, dwCID,
|
||||
PktDepositUpdateDB::TabNum::TAB_12, false, storeInfo, store1);
|
||||
|
||||
SendPacket::DepositDBUpdate(SendStream, dwRequestKey, dwUID, dwCID,
|
||||
PktDepositUpdateDB::TabNum::TAB_34, true, storeInfo, store2);
|
||||
}
|
||||
|
||||
// <20><>Ƽ <20>α<EFBFBD><CEB1><EFBFBD> ó<><C3B3>
|
||||
CPartyDBInfo* lpParty = CPartyDBMgr::GetInstance().OpenParty(
|
||||
CDBSingleObject::GetInstance(), lpCharacterData->GetPID());
|
||||
|
||||
if (0 != lpParty)
|
||||
{
|
||||
CPartyDBMgr::GetInstance().LoginPartyMember(
|
||||
lpParty, dwUID, dwCID, dwGID, wClass, SessionData.GetServerID(), cLevel);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> ó<><C3B3>
|
||||
if (0 != lpGuild)
|
||||
{
|
||||
lpGuild->SendLoginOutMember(dwCID, SessionData.GetServerID());
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>Ŷ.
|
||||
DataStorage::CSessionData::SaveEnemy* lpSaveEnemyInfo = SessionData.GetSaveEnemy();
|
||||
|
||||
unsigned long dwSaveEnemySize = sizeof(PktSaveEnemy) + sizeof(DataStorage::CSessionData::SaveEnemy)*4;
|
||||
|
||||
char* szSaveEnemyBuffer = SendStream.GetBuffer(dwSaveEnemySize);
|
||||
|
||||
PktSaveEnemy* lpPktSaveEnemy = reinterpret_cast<PktSaveEnemy*>(szSaveEnemyBuffer);
|
||||
lpPktSaveEnemy->m_dwCID = SessionData.GetCID();
|
||||
|
||||
DataStorage::CSessionData::SaveEnemy* lpPktSaveEnemyInfo = NULL;
|
||||
|
||||
unsigned long dwTick = ::GetTickCount();
|
||||
|
||||
for(unsigned char cIndex = 0; cIndex < DataStorage::CSessionData::SaveEnemy::MAX_SAVING_ENEMY; cIndex++)
|
||||
{
|
||||
if(!cIndex)
|
||||
{
|
||||
lpPktSaveEnemy->m_dwAttackedCID = lpSaveEnemyInfo[cIndex].m_dwCID;
|
||||
lpPktSaveEnemy->m_dwTick = dwTick - lpSaveEnemyInfo[cIndex].m_dwTick;
|
||||
lpPktSaveEnemyInfo = reinterpret_cast<DataStorage::CSessionData::SaveEnemy*>(szSaveEnemyBuffer+sizeof(PktSaveEnemy));
|
||||
}
|
||||
else
|
||||
{
|
||||
lpPktSaveEnemyInfo[cIndex-1].m_dwCID = lpSaveEnemyInfo[cIndex].m_dwCID;
|
||||
lpPktSaveEnemyInfo[cIndex-1].m_dwTick = 0;
|
||||
|
||||
if(lpSaveEnemyInfo[cIndex].m_dwCID)
|
||||
{
|
||||
lpPktSaveEnemyInfo[cIndex-1].m_dwTick = dwTick - lpSaveEnemyInfo[cIndex].m_dwTick;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!SendStream.WrapHeader((unsigned short)dwSaveEnemySize, CmdSaveEnemy, 0, 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>̽<EFBFBD>ƽ Ű <20><><EFBFBD><EFBFBD>.
|
||||
KeyInfo* pKeyInfo = SessionData.GetKeyInfo();
|
||||
|
||||
if (pKeyInfo && pKeyInfo->m_cUsed)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktKeyInfo));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktKeyInfo* pPktKeyInfo = reinterpret_cast<PktKeyInfo*>(lpBuffer);;
|
||||
pPktKeyInfo->m_dwCID = dwCID;
|
||||
memcpy(pPktKeyInfo->m_dwKeyInfo, pKeyInfo->m_dwKeyInfo, sizeof(unsigned long)*PktKeyInfo::MAX_KEY_INFO);
|
||||
|
||||
SendStream.WrapCrypt(sizeof(PktKeyInfo), CmdKeyInfo, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
SessionData.LogCharData("ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD>");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
bool CharLoginError(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
DBUpdateData::UpdateType eUpdateType,
|
||||
unsigned long dwUID, unsigned long dwCID, unsigned short usError)
|
||||
{
|
||||
if(0 != usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktDBUpdate));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktDBUpdate* lpPktDBUpdate = reinterpret_cast<PktDBUpdate*>(lpBuffer);
|
||||
memset(lpPktDBUpdate, 0, sizeof(PktDBUpdate));
|
||||
|
||||
lpPktDBUpdate->m_dlItemSerial = 0;
|
||||
lpPktDBUpdate->m_dwSessionID = 0;
|
||||
lpPktDBUpdate->m_dwUserID = dwUID;
|
||||
lpPktDBUpdate->m_dwCharID = dwCID;
|
||||
lpPktDBUpdate->m_dwRequestKey = dwRequestKey;
|
||||
|
||||
lpPktDBUpdate->m_Address.S_un.S_addr = 0;
|
||||
|
||||
lpPktDBUpdate->m_cAdminLevel = 0;
|
||||
|
||||
// WORK_LIST 2.4 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
lpPktDBUpdate->m_cAccountNation = 0;
|
||||
lpPktDBUpdate->m_cNameChangeCount = 0;
|
||||
lpPktDBUpdate->m_cGuildWarFlag = 0;
|
||||
lpPktDBUpdate->m_cRealmWarFlag = 0;
|
||||
lpPktDBUpdate->m_cTacticsFlag = 0;
|
||||
|
||||
lpPktDBUpdate->m_TypeCode = static_cast<unsigned short>(eUpdateType);
|
||||
|
||||
memset(lpPktDBUpdate->m_usUpdate, 0,
|
||||
sizeof(unsigned short) * DBUpdateData::MAX_UPDATE_DB);
|
||||
|
||||
return SendStream.WrapCrypt(sizeof(PktDBUpdate), CmdDBUpdateData, 0, usError);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool Friend(CSendStream& SendStream, unsigned char cCmd, unsigned long dwRequestKey, unsigned long dwUID, unsigned long dwCID,
|
||||
unsigned long dwGID, unsigned short wClass, char cLevel, unsigned long dwServerID, const char* lpData, unsigned long dwDataLen)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktFriendDB) + dwDataLen);
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktFriendDB* lpFriendDB = reinterpret_cast<PktFriendDB*>(lpBuffer);
|
||||
|
||||
lpFriendDB->m_cCmd = cCmd;
|
||||
lpFriendDB->m_dwRequestKey = dwRequestKey;
|
||||
lpFriendDB->m_wCmd = 0;
|
||||
|
||||
lpFriendDB->m_dwOwnerUID = dwUID;
|
||||
lpFriendDB->m_dwOwnerCID = dwCID;
|
||||
lpFriendDB->m_dwReferenceCID = 0;
|
||||
lpFriendDB->m_dwData = dwDataLen;
|
||||
|
||||
lpFriendDB->m_dwGID = dwGID;
|
||||
lpFriendDB->m_wClass = wClass;
|
||||
lpFriendDB->m_cLevel = cLevel;
|
||||
lpFriendDB->m_dwServerID = dwServerID;
|
||||
|
||||
memcpy(lpFriendDB + 1, lpData, dwDataLen);
|
||||
|
||||
return SendStream.WrapHeader(
|
||||
static_cast<unsigned short>(sizeof(PktFriendDB) + dwDataLen), CmdFriendDB, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Quest(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwCID,
|
||||
const char* lpQuestBuffer, unsigned long dwQuestSize,
|
||||
const char* lpHistoryBuffer, unsigned long dwHistorySize)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktQuestDB) + dwQuestSize + dwHistorySize);
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktQuestDB* lpPktQuestDB = reinterpret_cast<PktQuestDB*>(lpBuffer);
|
||||
|
||||
lpPktQuestDB->m_dwRequestKey = dwRequestKey;
|
||||
lpPktQuestDB->m_wCmd = 0;
|
||||
|
||||
lpPktQuestDB->m_dwUID = dwUID;
|
||||
lpPktQuestDB->m_dwCID = dwCID;
|
||||
|
||||
lpPktQuestDB->m_wExecuteQuestSize = static_cast<unsigned short>(dwQuestSize);
|
||||
lpPktQuestDB->m_wHistoryQuestSize = static_cast<unsigned short>(dwHistorySize);
|
||||
|
||||
memcpy(lpBuffer + sizeof(PktQuestDB), lpQuestBuffer, dwQuestSize);
|
||||
memcpy(lpBuffer + sizeof(PktQuestDB) + dwQuestSize, lpHistoryBuffer, dwHistorySize);
|
||||
|
||||
return SendStream.WrapHeader(
|
||||
static_cast<unsigned short>(sizeof(PktQuestDB) + dwQuestSize + dwHistorySize),
|
||||
CmdQuestDB, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConfigInfo(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwCID,
|
||||
const char* lpConfigBuffer, unsigned long dwConfigSize)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktConfigInfo) + dwConfigSize);
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktConfigInfo* lpConfigInfo = reinterpret_cast<PktConfigInfo*>(lpBuffer);
|
||||
|
||||
lpConfigInfo->m_dwRequestKey = dwRequestKey;
|
||||
lpConfigInfo->m_wCmd = 0;
|
||||
|
||||
lpConfigInfo->m_dwUserID = dwUID;
|
||||
lpConfigInfo->m_dwCharID = dwCID;
|
||||
lpConfigInfo->m_wSize = static_cast<unsigned short>(dwConfigSize);
|
||||
|
||||
memcpy(lpBuffer + sizeof(PktConfigInfo), lpConfigBuffer, dwConfigSize);
|
||||
|
||||
return SendStream.WrapHeader(
|
||||
static_cast<unsigned short>(sizeof(PktConfigInfo) + dwConfigSize), CmdConfigInfoDB, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DepositData(CSendStream& SendStream, unsigned char cCmd, unsigned long dwRequestKey,
|
||||
unsigned long dwCID, const STORE_INFO& storeInfo)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktDeposit));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktDeposit* lpPktDeposit = reinterpret_cast<PktDeposit*>(lpBuffer);
|
||||
|
||||
lpPktDeposit->m_cCmd = cCmd;
|
||||
lpPktDeposit->m_wCmd = 0;
|
||||
lpPktDeposit->m_dwRequestKey = dwRequestKey;
|
||||
|
||||
if (PktDeposit::CMD::PASSWORD == cCmd)
|
||||
{
|
||||
memcpy(&lpPktDeposit->m_szData[0], &dwCID, sizeof(unsigned long));
|
||||
memcpy(&lpPktDeposit->m_szData[4], storeInfo.Password, Deposit::PASSWORD_LENGTH);
|
||||
}
|
||||
else if (PktDeposit::CMD::GOLD == cCmd)
|
||||
{
|
||||
memcpy(&lpPktDeposit->m_szData[0], &dwCID, sizeof(unsigned long));
|
||||
memcpy(&lpPktDeposit->m_szData[4], &storeInfo.Gold, sizeof(unsigned long));
|
||||
}
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktDeposit), CmdDeposit, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DepositDBUpdate(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwCID,
|
||||
unsigned char cTabNum, bool bComplete,
|
||||
const STORE_INFO& storeInfo, const STORE& store)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktDepositUpdateDB) + store.dwSize);
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktDepositUpdateDB* lpPktDepositUpdateDB =
|
||||
reinterpret_cast<PktDepositUpdateDB*>(lpBuffer);
|
||||
|
||||
lpPktDepositUpdateDB->m_dwRequestKey = dwRequestKey;
|
||||
lpPktDepositUpdateDB->m_wCmd = 0;
|
||||
|
||||
lpPktDepositUpdateDB->m_dwUID = dwUID;
|
||||
lpPktDepositUpdateDB->m_dwCID = dwCID;
|
||||
lpPktDepositUpdateDB->m_dwTabFlag = storeInfo.Flag;
|
||||
lpPktDepositUpdateDB->m_usDataSize = static_cast<unsigned short>(store.dwSize);
|
||||
lpPktDepositUpdateDB->m_cTabNum = cTabNum;
|
||||
lpPktDepositUpdateDB->m_bUpdateComplete = bComplete;
|
||||
|
||||
memcpy(lpBuffer + sizeof(PktDepositUpdateDB), store.Data, store.dwSize);
|
||||
|
||||
return SendStream.WrapHeader(
|
||||
static_cast<unsigned short>(sizeof(PktDepositUpdateDB) + store.dwSize), CmdDepositUpdate, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef _DBAGENT_SERVER_SEND_LOGIN_OUT_H_
|
||||
#define _DBAGENT_SERVER_SEND_LOGIN_OUT_H_
|
||||
|
||||
#include <Network/Packet/PacketStruct/CharLoginOutPacketStruct.h>
|
||||
|
||||
// forward decl.
|
||||
class CSendStream;
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace DataStorage
|
||||
{
|
||||
// forward delc.
|
||||
class CSessionData;
|
||||
}
|
||||
|
||||
namespace SendPacket
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
bool StartSession(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned long dwUID, unsigned long dwSessionID,
|
||||
unsigned char cFirstLogin, unsigned short usError);
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD>
|
||||
bool CharLogin(CSendStream& SendStream,
|
||||
DataStorage::CSessionData& SessionData, unsigned long dwRequestKey);
|
||||
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20>αƿ<D7BE>
|
||||
bool CharLoginError(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
DBUpdateData::UpdateType eUpdateType,
|
||||
unsigned long dwUID, unsigned long dwCID, unsigned short usError);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,111 @@
|
||||
#include "stdafx.h"
|
||||
#include "SendMoveZone.h"
|
||||
|
||||
#include <Network/Stream/SendStream.h>
|
||||
|
||||
#include <Network/Packet/PacketCommand.h>
|
||||
#include <Network/Packet/PacketStruct/ServerInfo.h>
|
||||
#include <Network/Packet/PacketStruct/ServerPacket.h>
|
||||
#include <Network/Dispatch/GameDispatch.h>
|
||||
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
|
||||
bool CharMoveZone(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned char cZone, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSZMvDAck));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktSZMvDAck* lpPktSZMvDAck = reinterpret_cast<PktSZMvDAck*>(lpBuffer);
|
||||
|
||||
lpPktSZMvDAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktSZMvDAck->m_wCmd = PktDD::SCmdCharMoveZone;
|
||||
|
||||
lpPktSZMvDAck->m_cZone = cZone;
|
||||
|
||||
CUserPercentageInZone getUserPercentage(
|
||||
lpPktSZMvDAck->m_wChannelNum, cZone, PktSZMvDAck::MAX_CHANNEL_NUM);
|
||||
|
||||
CGameDispatch::GetDispatchTable().Process(getUserPercentage);
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktSZMvDAck), CmdAgentZone, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ServerZone(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned char cZone, unsigned char cChannel, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSAAck));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
unsigned short usError = 0;
|
||||
|
||||
PktSAAck* lpPktSAAck = reinterpret_cast<PktSAAck*>(lpBuffer);
|
||||
|
||||
lpPktSAAck->m_dwRequestKey = dwRequestKey;
|
||||
lpPktSAAck->m_wCmd = PktDD::SCmdServerZone;
|
||||
|
||||
lpPktSAAck->m_dwServerID = 0;
|
||||
lpPktSAAck->m_GameAddress.S_un.S_addr = 0;
|
||||
|
||||
if(0 == usError)
|
||||
{
|
||||
SERVER_ID serverID;
|
||||
serverID.sID.Type = CServerSetup::GameServer;
|
||||
serverID.sID.Group = CServerSetup::GetInstance().GetServerGroup();
|
||||
serverID.sID.Channel = cChannel;
|
||||
serverID.sID.ID = cZone;
|
||||
|
||||
GET_MULTI_DISPATCH(lpGameDispatch, serverID.dwID,
|
||||
CGameDispatch, CGameDispatch::GetDispatchTable());
|
||||
|
||||
int nUserLimit = static_cast<int>(CServerSetup::GetInstance().GetUserLimit());
|
||||
|
||||
if(0 == lpGameDispatch)
|
||||
{
|
||||
usError = PktSAAck::SERVER_ERROR;
|
||||
}
|
||||
else if(nUserLimit < lpGameDispatch->GetCharNum())
|
||||
{
|
||||
usError = PktSAAck::FAIL_USER_LIMIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpPktSAAck->m_dwServerID = lpGameDispatch->GetServerID();
|
||||
lpPktSAAck->m_GameAddress = lpGameDispatch->GetRemoteAddr().get_addr_in().sin_addr;
|
||||
}
|
||||
}
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktSAAck), CmdAgentZone, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ServerZoneEnd(CSendStream& SendStream, unsigned long dwRequestKey)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktDD));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktDD* lpPktDD = reinterpret_cast<PktDD*>(lpBuffer);
|
||||
|
||||
lpPktDD->m_dwRequestKey = dwRequestKey;
|
||||
lpPktDD->m_wCmd = PktDD::SCmdServerZoneEnd;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktDD), CmdAgentZone, 0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef _DBAGENT_SERVER_SEND_MOVE_ZONE_H_
|
||||
#define _DBAGENT_SERVER_SEND_MOVE_ZONE_H_
|
||||
|
||||
|
||||
// forward decl.
|
||||
class CSendStream;
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
bool CharMoveZone(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned char cZone, unsigned short usError);
|
||||
|
||||
bool ServerZone(CSendStream& SendStream, unsigned long dwRequestKey,
|
||||
unsigned char cZone, unsigned char cChannel, unsigned short usError = 0);
|
||||
|
||||
bool ServerZoneEnd(CSendStream& SendStream, unsigned long dwRequestKey);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,111 @@
|
||||
#include "stdafx.h"
|
||||
#include "SendParty.h"
|
||||
#include <Community/Party/PartyDBInfo.h>
|
||||
#include <Network/Packet/WrapPacket.h>
|
||||
#include <Network/Packet/PacketCommand.h>
|
||||
#include <Network/Packet/PacketStruct/DataPacket.h>
|
||||
#include <Network/Packet/PacketStruct/PartyPacket.h>
|
||||
#include <Network/Dispatch/GameDispatch.h>
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
|
||||
bool DeleteParty(CPartyDBInfo* lpParty)
|
||||
{
|
||||
if(0 != lpParty)
|
||||
{
|
||||
PktDPD pktDPD;
|
||||
memset(&pktDPD, 0, sizeof(PktDPD));
|
||||
|
||||
pktDPD.m_wCmd = PktDD::SCmdDeleteParty;
|
||||
pktDPD.m_dwPartyID = lpParty->GetPID();
|
||||
|
||||
if(PacketWrap::WrapHeader(reinterpret_cast<char*>(&pktDPD),
|
||||
sizeof(PktDPD), CmdAgentParty, 0, 0))
|
||||
{
|
||||
CGameDispatch::GetDispatchTable().Process(CSendPacketAllServer(
|
||||
reinterpret_cast<char*>(&pktDPD), sizeof(PktDPD), CmdAgentParty));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PartyCmd(CSendStream& SendStream, unsigned short cSubCmd, unsigned long dwPID, unsigned long dwSenderID, unsigned long dwGID,
|
||||
unsigned short wClass, unsigned long dwServerID, char cLevel, const char* szSenderName, unsigned short usError)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktPMD));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktPMD* lpPktPMD = reinterpret_cast<PktPMD*>(lpBuffer);
|
||||
|
||||
lpPktPMD->m_wCmd = cSubCmd;
|
||||
lpPktPMD->m_dwPartyID = dwPID;
|
||||
lpPktPMD->m_dwSenderID = dwSenderID;
|
||||
lpPktPMD->m_dwGID = dwGID;
|
||||
lpPktPMD->m_wClass = wClass;
|
||||
lpPktPMD->m_dwServerID = dwServerID;
|
||||
lpPktPMD->m_cLevel = cLevel;
|
||||
|
||||
if(0 != szSenderName)
|
||||
{
|
||||
strncpy(lpPktPMD->m_strSenderName, szSenderName, CHAR_INFOST::MAX_NAME_LEN);
|
||||
lpPktPMD->m_strSenderName[CHAR_INFOST::MAX_NAME_LEN - 1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(lpPktPMD->m_strSenderName, 0, sizeof(char) * CHAR_INFOST::MAX_NAME_LEN);
|
||||
}
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktPMD), CmdAgentParty, 0, usError);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PartyCmd(unsigned short cSubCmd, unsigned long dwPID, unsigned long dwSenderID, unsigned long dwGID,
|
||||
unsigned short wClass, unsigned long dwServerID, char cLevel, const char* szSenderName)
|
||||
{
|
||||
PktPMD pktPMD;
|
||||
memset(&pktPMD, 0, sizeof(PktPMD));
|
||||
|
||||
pktPMD.m_wCmd = cSubCmd;
|
||||
pktPMD.m_dwPartyID = dwPID;
|
||||
pktPMD.m_dwSenderID = dwSenderID;
|
||||
pktPMD.m_dwGID = dwGID;
|
||||
pktPMD.m_wClass = wClass;
|
||||
pktPMD.m_dwServerID = dwServerID;
|
||||
pktPMD.m_cLevel = cLevel;
|
||||
|
||||
if (0 != szSenderName)
|
||||
{
|
||||
strncpy(pktPMD.m_strSenderName, szSenderName, CHAR_INFOST::MAX_NAME_LEN);
|
||||
pktPMD.m_strSenderName[CHAR_INFOST::MAX_NAME_LEN - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(pktPMD.m_strSenderName, 0, sizeof(char) * CHAR_INFOST::MAX_NAME_LEN);
|
||||
}
|
||||
|
||||
if(PacketWrap::WrapHeader(reinterpret_cast<char*>(&pktPMD),
|
||||
sizeof(PktPMD), CmdAgentParty, 0, 0))
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD> //
|
||||
CGameDispatch::GetDispatchTable().Process(CSendPacketAllServer(
|
||||
reinterpret_cast<char*>(&pktPMD), sizeof(PktPMD), CmdAgentParty));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef _DBAGENT_SERVER_SEND_PARTY_H_
|
||||
#define _DBAGENT_SERVER_SEND_PARTY_H_
|
||||
|
||||
// forward decl.
|
||||
class CSendStream;
|
||||
class CPartyDBInfo;
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
bool DeleteParty(CPartyDBInfo* lpParty);
|
||||
|
||||
bool PartyCmd(CSendStream& SendStream, unsigned short cSubCmd, unsigned long dwPID, unsigned long dwSenderID, unsigned long dwGID,
|
||||
unsigned short wClass, unsigned long dwServerID, char cLevel, const char* szSenderName, unsigned short usError);
|
||||
|
||||
bool PartyCmd(unsigned short cSubCmd, unsigned long dwPID, unsigned long dwSenderID, unsigned long dwGID,
|
||||
unsigned short wClass, unsigned long dwServerID, char cLevel, const char* szSenderName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,422 @@
|
||||
#include "stdafx.h"
|
||||
#include "SendServerInfo.h"
|
||||
|
||||
#include <Network/Stream/SendStream.h>
|
||||
#include <Network/Winsock/SocketFactory.h>
|
||||
#include <Network/Packet/PacketCommand.h>
|
||||
#include <Network/Packet/PacketStruct/ServerInfo.h>
|
||||
#include <Network/Packet/PacketStruct/ServerPacket.h>
|
||||
|
||||
#include <Network/Dispatch/LoginDispatch.h>
|
||||
#include <Network/Dispatch/AuthDispatch.h>
|
||||
#include <Network/Dispatch/GameDispatch.h>
|
||||
#include <Network/Dispatch/UIDDispatch.h>
|
||||
|
||||
#include <DataStorage/SessionData.h>
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
|
||||
#include <Log/ServerLog.h>
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace SendPacket
|
||||
{
|
||||
|
||||
class CSendUpdateServerVersionAllGameServer
|
||||
{
|
||||
public:
|
||||
bool operator () (unsigned long dwServer, CPacketDispatch& packetDispatch)
|
||||
{
|
||||
return DBAgent::SendPacket::UpdateServerVersion(
|
||||
static_cast<DBAgent::CGameDispatch&>(packetDispatch).GetSendStream());
|
||||
}
|
||||
};
|
||||
|
||||
bool ServerLogin(CSendStream& SendStream, unsigned long dwServerID)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSL));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
const int MAX_ADDRESS = 64;
|
||||
char szAddress[MAX_ADDRESS];
|
||||
|
||||
CTCPFactory tcpFactory;
|
||||
tcpFactory.GetNetworkInfo(szAddress, MAX_ADDRESS);
|
||||
|
||||
PktSL* lpPktSL = reinterpret_cast<PktSL*>(lpBuffer);
|
||||
|
||||
lpPktSL->m_dwServerID = dwServerID;
|
||||
lpPktSL->m_Address.S_un.S_addr = inet_addr(szAddress);
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktSL), CmdSysServerLogin, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ServerLoginAck(CSendStream& SendStream, unsigned long dwServerID,
|
||||
unsigned __int64 dwItemSerial)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSLAck));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktSLAck* lpPktSLAck = reinterpret_cast<PktSLAck*>(lpBuffer);
|
||||
|
||||
CServerSetup& serverSetup = CServerSetup::GetInstance();
|
||||
|
||||
lpPktSLAck->m_dlItemUID = dwItemSerial;
|
||||
lpPktSLAck->m_dwServerID = dwServerID;
|
||||
|
||||
lpPktSLAck->m_dwClientVer = serverSetup.GetClientVer();
|
||||
lpPktSLAck->m_dwCheckSum = serverSetup.GetCheckSum();
|
||||
|
||||
strncpy(lpPktSLAck->m_PatchAddress,
|
||||
serverSetup.GetPatchAddress(), PktSLAck::PATCH_ADDRESS_LENGTH - 1);
|
||||
|
||||
lpPktSLAck->m_PatchAddress[PktSLAck::PATCH_ADDRESS_LENGTH - 1] = 0;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktSLAck), CmdSysServerLogin, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool UpdateChannel(CSendStream& SendStream, unsigned long dwServerID)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSCInfo));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktSCInfo* lpPktSCInfo = reinterpret_cast<PktSCInfo*>(lpBuffer);
|
||||
|
||||
lpPktSCInfo->m_dwServerID = dwServerID;
|
||||
|
||||
CGetTotalCount getCount(
|
||||
lpPktSCInfo->m_usChannelClientNum[0],
|
||||
lpPktSCInfo->m_usChannelClientNum[1],
|
||||
lpPktSCInfo->m_cChannelNum);
|
||||
|
||||
CGameDispatch::GetDispatchTable().Process(getCount);
|
||||
|
||||
if(0 < lpPktSCInfo->m_cChannelNum)
|
||||
{
|
||||
if(lpPktSCInfo->m_cChannelNum <= lpPktSCInfo->m_usChannelClientNum[0])
|
||||
{
|
||||
lpPktSCInfo->m_usChannelClientNum[0] -= lpPktSCInfo->m_cChannelNum;
|
||||
++lpPktSCInfo->m_usChannelClientNum[0];
|
||||
}
|
||||
|
||||
if(lpPktSCInfo->m_cChannelNum <= lpPktSCInfo->m_usChannelClientNum[1])
|
||||
{
|
||||
lpPktSCInfo->m_usChannelClientNum[1] -= lpPktSCInfo->m_cChannelNum;
|
||||
++lpPktSCInfo->m_usChannelClientNum[1];
|
||||
}
|
||||
|
||||
lpPktSCInfo->m_cChannelNum = 2;
|
||||
}
|
||||
|
||||
return SendStream.WrapCrypt(sizeof(PktSCInfo), CmdSysChannelUpdate, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool UpdateServerVersion(CSendStream& SendStream)
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSVU));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktSVU* lpPktSVU = reinterpret_cast<PktSVU*>(lpBuffer);
|
||||
|
||||
CServerSetup& serverSetup = CServerSetup::GetInstance();
|
||||
|
||||
lpPktSVU->m_dwClientVer = serverSetup.GetClientVer();
|
||||
lpPktSVU->m_dwCheckSum = serverSetup.GetCheckSum();
|
||||
strncpy(lpPktSVU->m_PatchAddress, serverSetup.GetPatchAddress(),
|
||||
PktSVU::PATCH_ADDRESS_LENGTH - 1);
|
||||
|
||||
lpPktSVU->m_PatchAddress[PktSVU::PATCH_ADDRESS_LENGTH - 1] = 0;
|
||||
|
||||
GET_SINGLE_DISPATCH(lpAuthDispatch,
|
||||
CAuthDispatch, CAuthDispatch::GetDispatchTable());
|
||||
|
||||
if(0 != lpAuthDispatch)
|
||||
{
|
||||
lpPktSVU->m_ServerAddr = lpAuthDispatch->GetRemoteAddr().get_addr_in().sin_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpPktSVU->m_ServerAddr.S_un.S_addr = 0;
|
||||
}
|
||||
|
||||
return SendStream.WrapCrypt(sizeof(PktSVU), CmdSysServerVerUpdate, 0, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void UpdateChannelAllServer()
|
||||
{
|
||||
// <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
GET_SINGLE_DISPATCH(lpLoginDispatch, DBAgent::CLoginDispatch,
|
||||
DBAgent::CLoginDispatch::GetDispatchTable());
|
||||
|
||||
if(0 != lpLoginDispatch)
|
||||
{
|
||||
DBAgent::SendPacket::UpdateServerVersion(lpLoginDispatch->GetSendStream());
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
GET_SINGLE_DISPATCH(lpAuthDispatch, DBAgent::CAuthDispatch,
|
||||
DBAgent::CAuthDispatch::GetDispatchTable());
|
||||
|
||||
if(0 != lpAuthDispatch)
|
||||
{
|
||||
DBAgent::SendPacket::UpdateServerVersion(lpAuthDispatch->GetSendStream());
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
DBAgent::CGameDispatch::GetDispatchTable().Process(
|
||||
CSendUpdateServerVersionAllGameServer());
|
||||
}
|
||||
|
||||
|
||||
bool UpdateUIDTable(PktUUT::UpdateType eUpdateType, const char* szAccountName, const char* szPassword,
|
||||
unsigned long dwUID, unsigned long dwCID, unsigned long dwSessionID,
|
||||
unsigned long dwServerID, IN_ADDR peerAddr, unsigned short usError)
|
||||
{
|
||||
const char* szErrorReason = 0;
|
||||
|
||||
GET_SINGLE_DISPATCH(lpUIDDispatch, CUIDDispatch, CUIDDispatch::GetDispatchTable());
|
||||
|
||||
if(0 != lpUIDDispatch)
|
||||
{
|
||||
// edith 2008.01.15 UID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><EFBFBD><DEBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD>.
|
||||
CSendStream& uidSendStream = lpUIDDispatch->GetSendStream();
|
||||
|
||||
char* lpBuffer = uidSendStream.GetBuffer(sizeof(PktUUT));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktUUT* lpPktUUT = reinterpret_cast<PktUUT*>(lpBuffer);
|
||||
|
||||
lpPktUUT->m_cCmd = static_cast<unsigned char>(eUpdateType);
|
||||
|
||||
ZeroMemory(lpPktUUT->m_strAccount, PktUUT::MaxAccountLen);
|
||||
ZeroMemory(lpPktUUT->m_strPassword, PktUUT::MaxPasswordLen);
|
||||
|
||||
if(szAccountName && strlen(szAccountName) > 0)
|
||||
{
|
||||
strcpy(lpPktUUT->m_strAccount, szAccountName);
|
||||
}
|
||||
|
||||
// edith 2008.01.15 <20>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0>۾<EFBFBD>
|
||||
if(szPassword && strlen(szPassword) > 0)
|
||||
{
|
||||
strcpy(lpPktUUT->m_strPassword, szPassword);
|
||||
// strncpy(lpPktUUT->m_strPassword, szPassword, PktUUT::MaxPasswordLen - 1);
|
||||
// lpPktUUT->m_strPassword[PktUUT::MaxPasswordLen - 1] = 0;
|
||||
}
|
||||
|
||||
lpPktUUT->m_IPAddress = peerAddr;
|
||||
|
||||
lpPktUUT->m_dwSessionID = dwSessionID;
|
||||
lpPktUUT->m_dwServerID = dwServerID;
|
||||
lpPktUUT->m_dwUserID = dwUID;
|
||||
lpPktUUT->m_dwCharID = dwCID;
|
||||
|
||||
if(uidSendStream.WrapHeader(sizeof(PktUUT), CmdUpdateUIDTable, 0, usError))
|
||||
{
|
||||
INFLOG3(g_Log, "UID:%10u / CID:%10u / ST:%s / UpdateUIDTable <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwUID, dwCID, g_szPktUUTString[eUpdateType]);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
szErrorReason = "WrapHeader <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
szErrorReason = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҵ<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
szErrorReason = "UID<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
}
|
||||
|
||||
if(0 != szErrorReason)
|
||||
{
|
||||
ERRLOG4(g_Log, "UID:%10u / CID:%10u / ST:%s / UpdateUIDTable <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s",
|
||||
dwUID, dwCID, g_szPktUUTString[eUpdateType], szErrorReason);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UserKill(const DataStorage::CSessionData& SessionData)
|
||||
{
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = SessionData.GetServerID();
|
||||
|
||||
CSendStream* lpSendStream = 0;
|
||||
|
||||
if(serverID.GetType() == CServerSetup::AuthServer)
|
||||
{
|
||||
GET_SINGLE_DISPATCH(lpAuthDispatch, CAuthDispatch,
|
||||
CAuthDispatch::GetDispatchTable());
|
||||
|
||||
if(0 != lpAuthDispatch)
|
||||
{
|
||||
lpSendStream = &lpAuthDispatch->GetSendStream();
|
||||
}
|
||||
}
|
||||
else if(serverID.GetType() == CServerSetup::GameServer)
|
||||
{
|
||||
GET_MULTI_DISPATCH(lpGameDispatch, serverID.dwID,
|
||||
CGameDispatch, CGameDispatch::GetDispatchTable());
|
||||
|
||||
if(0 != lpGameDispatch)
|
||||
{
|
||||
lpSendStream = &lpGameDispatch->GetSendStream();
|
||||
}
|
||||
}
|
||||
|
||||
const char* szErrorReason = 0;
|
||||
|
||||
if(0 == lpSendStream)
|
||||
{
|
||||
szErrorReason = "<EFBFBD>ش<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>";
|
||||
}
|
||||
else
|
||||
{
|
||||
char* lpBuffer = lpSendStream->GetBuffer(sizeof(PktUK));
|
||||
if(0 == lpBuffer)
|
||||
{
|
||||
szErrorReason = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҵ<EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
else
|
||||
{
|
||||
PktUK* lpPktUK = reinterpret_cast<PktUK*>(lpBuffer);
|
||||
|
||||
lpPktUK->m_dwUserID = SessionData.GetUID();
|
||||
lpPktUK->m_dwCharID = SessionData.GetCID();
|
||||
lpPktUK->m_dwServerID = SessionData.GetServerID();
|
||||
|
||||
if(!lpSendStream->WrapHeader(sizeof(PktUK), CmdUserKill, 0, 0))
|
||||
{
|
||||
szErrorReason = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(0 != szErrorReason)
|
||||
{
|
||||
ERRLOG4(g_Log, "UID:%10u / CID:%10u / ServerID:0x%08X / <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̱<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s",
|
||||
SessionData.GetUID(), SessionData.GetCID(), SessionData.GetServerID(), szErrorReason);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
INFLOG3(g_Log, "UID:%10u / CID:%10u / ServerID:0x%08X / <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̱<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
SessionData.GetUID(), SessionData.GetCID(), SessionData.GetServerID());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BillingNotify(const DataStorage::CSessionData& SessionData,
|
||||
unsigned char cRemainMinute, char cBillingType)
|
||||
{
|
||||
GET_MULTI_DISPATCH(lpGameDispatch, SessionData.GetServerID(),
|
||||
CGameDispatch, CGameDispatch::GetDispatchTable());
|
||||
|
||||
if(0 != lpGameDispatch)
|
||||
{
|
||||
CSendStream& SendStream = lpGameDispatch->GetSendStream();
|
||||
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktBTN));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktBTN* lpPktBTN = reinterpret_cast<PktBTN*>(lpBuffer);
|
||||
|
||||
lpPktBTN->m_dwUserID = SessionData.GetUID();
|
||||
lpPktBTN->m_dwCharID = SessionData.GetCID();
|
||||
lpPktBTN->m_dwServerID = SessionData.GetServerID();
|
||||
lpPktBTN->m_cRemainMinute = cRemainMinute;
|
||||
lpPktBTN->m_cBillingType = cBillingType;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktBTN), CmdBillingTimeoutNotify, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BillingCheckNotify(const DataStorage::CSessionData& SessionData,
|
||||
unsigned char cRemainMinute, char cBillingType)
|
||||
{
|
||||
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = SessionData.GetServerID();
|
||||
|
||||
if (CServerSetup::AuthServer == serverID.GetType())
|
||||
{
|
||||
GET_SINGLE_DISPATCH(lpAuthDispatch,
|
||||
CAuthDispatch, CAuthDispatch::GetDispatchTable());
|
||||
|
||||
CSendStream& SendStream = lpAuthDispatch->GetSendStream();
|
||||
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktBTN));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktBTN* lpPktBTN = reinterpret_cast<PktBTN*>(lpBuffer);
|
||||
|
||||
lpPktBTN->m_dwUserID = SessionData.GetUID();
|
||||
lpPktBTN->m_dwCharID = SessionData.GetCID();
|
||||
lpPktBTN->m_dwServerID = SessionData.GetServerID();
|
||||
lpPktBTN->m_cRemainMinute = cRemainMinute;
|
||||
lpPktBTN->m_cBillingType = cBillingType;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktBTN), CmdBillingTimeCheckNotify, 0, 0);
|
||||
}
|
||||
}
|
||||
else if(CServerSetup::GameServer == serverID.GetType())
|
||||
{
|
||||
GET_MULTI_DISPATCH(lpGameDispatch, SessionData.GetServerID(),
|
||||
CGameDispatch, CGameDispatch::GetDispatchTable());
|
||||
|
||||
if(0 != lpGameDispatch)
|
||||
{
|
||||
CSendStream& SendStream = lpGameDispatch->GetSendStream();
|
||||
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktBTN));
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktBTN* lpPktBTN = reinterpret_cast<PktBTN*>(lpBuffer);
|
||||
|
||||
lpPktBTN->m_dwUserID = SessionData.GetUID();
|
||||
lpPktBTN->m_dwCharID = SessionData.GetCID();
|
||||
lpPktBTN->m_dwServerID = SessionData.GetServerID();
|
||||
lpPktBTN->m_cRemainMinute = cRemainMinute;
|
||||
lpPktBTN->m_cBillingType = cBillingType;
|
||||
|
||||
return SendStream.WrapHeader(sizeof(PktBTN), CmdBillingTimeCheckNotify, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef _DBAGENT_SERVER_SEND_SERVER_INFO_H_
|
||||
#define _DBAGENT_SERVER_SEND_SERVER_INFO_H_
|
||||
|
||||
#include <Network/Packet/PacketStruct/ServerPacket.h>
|
||||
|
||||
// forward decl.
|
||||
class CSendStream;
|
||||
class CPacketDispatch;
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
namespace DataStorage
|
||||
{
|
||||
// forward delc.
|
||||
class CSessionData;
|
||||
}
|
||||
|
||||
namespace SendPacket
|
||||
{
|
||||
bool ServerLogin(CSendStream& SendStream, unsigned long dwServerID);
|
||||
bool ServerLoginAck(CSendStream& SendStream, unsigned long dwServerID,
|
||||
unsigned __int64 dwItemSerial);
|
||||
|
||||
bool UpdateChannel(CSendStream& SendStream, unsigned long dwServerID);
|
||||
bool UpdateServerVersion(CSendStream& SendStream);
|
||||
|
||||
void UpdateChannelAllServer();
|
||||
|
||||
bool UpdateUIDTable(PktUUT::UpdateType eUpdateType, const char* szAccountName, const char* szPassword,
|
||||
unsigned long dwUID, unsigned long dwCID, unsigned long dwSessionID,
|
||||
unsigned long dwServerID, IN_ADDR peerAddr, unsigned short usError = 0);
|
||||
|
||||
bool UserKill(const DataStorage::CSessionData& SessionData);
|
||||
|
||||
bool BillingNotify(const DataStorage::CSessionData& SessionData,
|
||||
unsigned char cRemainMinute, char cBillingType);
|
||||
|
||||
// <20>븸<EFBFBD><EBB8B8> <20><><EFBFBD><EFBFBD> üũ Notify
|
||||
bool BillingCheckNotify(const DataStorage::CSessionData& SessionData,
|
||||
unsigned char cRemainMinute, char cBillingType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user