📄 handler_fromagentserver.cpp
字号:
#include "stdafx.h"
#include ".\Handler_FromAgentServer.h"
#include <PacketStruct_AD.h>
#include "ServerSession.h"
#include "DBUser.h"
#include "DBUserManager.h"
#include "DBProxyServer.h"
Handler_FromAgentServer_IMPL( AD_CHARINFO_CHARLISTREQ_SYN )
{
MSG_AD_CHARINFO_CHARLISTREQ_SYN * pRecvMsg = (MSG_AD_CHARINFO_CHARLISTREQ_SYN *)pMsg;
//------------------------------------------------------------------------------------------------
// 孽府 朝覆
//------------------------------------------------------------------------------------------------
DWORD UserKey = pRecvMsg->m_dwKey;
DWORD UserGUID = pRecvMsg->m_dwUserGUID;
TCHAR szQueryBuff[32];
_sntprintf( szQueryBuff, sizeof(szQueryBuff), "S_SelectUser %u", UserGUID );
//CharacterListQuery * pQuery = QUERYALLOC(CharacterListQuery);
SelectUserQuery * pQuery = SelectUserQuery::ALLOC();
if( !pQuery ) return;
pQuery->SetIndex( MAKEDWORD( (WORD)AD_CHARINFO, (WORD)AD_CHARINFO_CHARLISTREQ_DBR ) );
pQuery->SetVoidObject( pServerSession );
pQuery->SetQuery( szQueryBuff );
pQuery->SetUserKey( UserKey ); //< 绢蠢 蜡历牢瘤 魄喊窍扁 困秦 鞘夸
pServerSession->DBQuery( pQuery );
}
Handler_FromAgentServer_IMPL( AD_CHARINFO_CHARLISTREQ_DBR )
{
MSG_DBPROXY_RESULT * pResult = (MSG_DBPROXY_RESULT *)pMsg;
//CharacterListQuery * pQResult = (CharacterListQuery *)pResult->m_pData;
SelectUserQuery * pQResult = (SelectUserQuery *)pResult->m_pData;
DWORD dwUserKey = pQResult->GetUserKey();
BYTE ResultNum = (BYTE)pQResult->GetResultRowNum();
// Agent肺 焊尘 菩哦
MSG_AD_CHARINFO_CHARLISTREQ_ACK msg;
msg.m_dwKey = dwUserKey;
msg.m_byCount = ResultNum;
// 扁夯 菩哦阑 持绰促.
pServerSession->m_pMsg[0] = (BYTE*)&msg;
pServerSession->m_wSize[0] = (WORD)msg.GetSize();
for( BYTE i = 0 ; i < ResultNum ; ++i )
{
ASSERT( sizeof(SERVER_CHARACTER_PART) < RESULTMSG::MAX_BUFFER_SIZE );
SERVER_CHARACTER_PART * pSCharacterPart = (SERVER_CHARACTER_PART *)&(pServerSession->m_ResultMsg[i].m_byMsg[0]);
pSCharacterPart->m_CharGuid = pQResult->pResult[i].m_CharGuid;
pSCharacterPart->m_bySlot = pQResult->pResult[i].m_bySlot;
memcpy(pSCharacterPart->m_tszCharName, pQResult->pResult[i].m_tszCharName, MAX_CHARNAME_LENGTH*sizeof(TCHAR) );
pSCharacterPart->m_byHeight = pQResult->pResult[i].m_byHeight;
pSCharacterPart->m_byFace = pQResult->pResult[i].m_byFace;
pSCharacterPart->m_byHair = pQResult->pResult[i].m_byHair;
pSCharacterPart->m_byClass = pQResult->pResult[i].m_byClass;
pSCharacterPart->m_LV = pQResult->pResult[i].m_LV;
pSCharacterPart->m_dwRegion = pQResult->pResult[i].m_dwRegion;
pSCharacterPart->m_wX = pQResult->pResult[i].m_wX;
pSCharacterPart->m_wY = pQResult->pResult[i].m_wY;
pSCharacterPart->m_wZ = pQResult->pResult[i].m_wZ;
pSCharacterPart->m_GuildGuid = pQResult->pResult[i].m_GuildGuid;
pSCharacterPart->m_GuildPosition = pQResult->pResult[i].m_GuildPosition;
memcpy(pSCharacterPart->m_tszGuildNicName, pQResult->pResult[i].m_tszGuildNicName, MAX_CHARNAME_LENGTH*sizeof(TCHAR) );
// 啊函 浇吩 盲框 ----------------------------------------------------------------------------
ITEMSLOTEX * pSlot = pSCharacterPart->m_EquipItemInfo.m_Slot;
BYTE & total = pSCharacterPart->m_EquipItemInfo.m_Count;
total = 0;
ITEMSTREAMEX * pEquipStream = (ITEMSTREAMEX *)pQResult->pResult[i].m_pEquipItem;
for(POSTYPE pos=0;pos<MAX_EQUIPMENT_SLOT_NUM;++pos)
{
if( pEquipStream[pos].ItemPart.dwSerial != 0 )
{
pSlot[total].m_ItemPos = pos;
memcpy( &pSlot[total].m_Stream, &pEquipStream[pos], sizeof(ITEMSTREAMEX) );
++total;
}
}
pServerSession->m_ResultMsg[i].m_wSize = pSCharacterPart->GetSize();
// 荤捞令 拌魂
pServerSession->m_pMsg[1+i] = pServerSession->m_ResultMsg[i].m_byMsg;
pServerSession->m_wSize[1+i] = pServerSession->m_ResultMsg[i].m_wSize;
}
//QUERYFREE( CharacterListQuery, pQResult );
SelectUserQuery::FREE( pQResult ); pQResult = NULL;
// 某浆 贸府 内靛 ------------------------------
//SUNLOG(eFULL_LOG, "[U:%d:俺荐:%d]:某腐磐府胶飘焊晨己傍\n", dwUserKey, ResultNum );
// Agent肺 傈崔
pServerSession->SendEx( ResultNum + 1, &pServerSession->m_pMsg[0], &pServerSession->m_wSize[0] );
}
Handler_FromAgentServer_IMPL( AD_CHARINFO_CREATE_SYN )
{
MSG_AD_CHARINFO_CREATE_SYN * pRcvMsg = (MSG_AD_CHARINFO_CREATE_SYN *)pMsg;
// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府
// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府
// 叼厚俊 历厘茄 惑怕牢啊????
DWORD UserKey = pRcvMsg->m_dwKey;
if( g_DBUserManager.FindUserFromCacheList(UserKey) )
g_DBUserManager.DestroyUserFromCacheList(UserKey);
// 单捞磐 公搬己 八刘!! (馆靛矫 鞘夸!!)
TCHAR szTempUserID[ID_MAX_LEN+1];
memcpy(szTempUserID, pRcvMsg->m_pszUserID, ID_MAX_LEN*sizeof(TCHAR));
szTempUserID[ID_MAX_LEN]='\0';
TCHAR tszTempCharName[MAX_CHARNAME_LENGTH+1];
memcpy( tszTempCharName, pRcvMsg->m_pszCharName, MAX_CHARNAME_LENGTH*sizeof(TCHAR) );
tszTempCharName[MAX_CHARNAME_LENGTH]='\0';
//------------------------------------------------------------------------------------------------
// 某腐 积己 孽府 朝覆
//------------------------------------------------------------------------------------------------
TCHAR szQueryBuff[128];
_sntprintf( szQueryBuff, sizeof(szQueryBuff), "{?=call S_CreateChar(%u, '%s', '%s', %u, %u, %u, %u)}",
pRcvMsg->m_dwUserGUID, szTempUserID, tszTempCharName, pRcvMsg->m_byClass,
pRcvMsg->m_byHeight, pRcvMsg->m_byFace, pRcvMsg->m_byHair );
CreateCharQuery * pQuery = CreateCharQuery::ALLOC();
pQuery->SetIndex( MAKEDWORD( (WORD)AD_CHARINFO, (WORD)AD_CHARINFO_CREATE_DBR ) );
pQuery->SetVoidObject( pServerSession );
pQuery->SetQuery( szQueryBuff );
pQuery->SetUserKey( pRcvMsg->m_dwKey );
pServerSession->DBQuery( pQuery );
}
Handler_FromAgentServer_IMPL( AD_CHARINFO_CREATE_DBR )
{
MSG_DBPROXY_RESULT * pResult = (MSG_DBPROXY_RESULT *)pMsg;
CreateCharQuery * pQResult = (CreateCharQuery *)pResult->m_pData;
DWORD dwUserKey = pQResult->GetUserKey();
BYTE ResultNum = (BYTE)pQResult->GetResultRowNum();
if( pQResult->GetResult() != 0 )
{
// 1篮 悼老 某腐磐 疙
// 2绰 浇吩 FULL
switch( pQResult->GetResult() )
{
case 1:
{
SUNLOG(eFULL_LOG, "[Handler_FromAgentServer_IMPL( AD_CHARINFO_CREATE_DBR )] [U:%u][R:%u]某腐磐积己 悼老 某腐磐疙 坷幅(%s)", dwUserKey, pQResult->GetResult(), pQResult->GetQuery() );
} break;
case 2:
{
SUNLOG(eFULL_LOG, "[Handler_FromAgentServer_IMPL( AD_CHARINFO_CREATE_DBR )] [U:%u][R:%u]某腐磐积己 浇吩 FULL 坷幅(%s)", dwUserKey, pQResult->GetResult(), pQResult->GetQuery() );
} break;
default:
{
SUNLOG(eFULL_LOG, "[Handler_FromAgentServer_IMPL( AD_CHARINFO_CREATE_DBR )] [U:%u][R:%u]某腐磐积己 摹疙利牢 飘罚黎记 坷幅(%s)", dwUserKey, pQResult->GetResult(), pQResult->GetQuery() );
}break;
}
MSG_AD_CHARINFO_CREATE_NAK nmsg;
nmsg.m_dwKey = dwUserKey;
nmsg.m_dwErrorCode = pQResult->GetResult(); //! 烙矫 贸府
pServerSession->Send( (BYTE *)&nmsg, sizeof(nmsg) );
CreateCharQuery::FREE( pQResult ); pQResult = NULL;
return;
}
ASSERT( ResultNum == 1 );
DEBUG_CODE( if( ResultNum != 1 ) return; );
MSG_AD_CHARINFO_CREATE_ACK msg;
msg.m_dwKey = dwUserKey;
SERVER_CHARACTER_PART * pSCharacterPart = &msg.m_CharInfo;
pSCharacterPart->m_CharGuid = pQResult->pResult[0].m_CharGuid;
pSCharacterPart->m_bySlot = pQResult->pResult[0].m_bySlot;
pSCharacterPart->m_byHeight = pQResult->pResult[0].m_byHeight;
pSCharacterPart->m_byFace = pQResult->pResult[0].m_byFace;
pSCharacterPart->m_byHair = pQResult->pResult[0].m_byHair;
pSCharacterPart->m_byClass = pQResult->pResult[0].m_byClass;
pSCharacterPart->m_LV = pQResult->pResult[0].m_LV;
pSCharacterPart->m_dwRegion = pQResult->pResult[0].m_iRegion;
pSCharacterPart->m_wX = pQResult->pResult[0].m_sX;
pSCharacterPart->m_wY = pQResult->pResult[0].m_sY;
pSCharacterPart->m_wZ = pQResult->pResult[0].m_sZ;
memcpy(pSCharacterPart->m_tszCharName, pQResult->pResult[0].m_tszCharName, MAX_CHARNAME_LENGTH*sizeof(TCHAR) );
// 积己矫 辨靛 沥焊 zero
pSCharacterPart->m_GuildGuid = 0;
pSCharacterPart->m_GuildPosition = 0;
pSCharacterPart->m_tszGuildNicName[0] = '\0';
// 啊函 浇吩 盲框 ----------------------------------------------------------------------------
ITEMSLOTEX * pSlot = pSCharacterPart->m_EquipItemInfo.m_Slot;
BYTE & total = pSCharacterPart->m_EquipItemInfo.m_Count;
total = 0;
ITEMSTREAMEX * pEquipStream = (ITEMSTREAMEX *)pQResult->pResult[0].m_pEquipItem;
for(POSTYPE pos=0;pos<MAX_EQUIPMENT_SLOT_NUM;++pos)
{
if( pEquipStream[pos].ItemPart.dwSerial != 0 )
{
pSlot[total].m_ItemPos = pos;
memcpy( &pSlot[total].m_Stream, &pEquipStream[pos], sizeof(ITEMSTREAMEX) );
++total;
}
}
//-----------------------------------------------------------------------------------------
CreateCharQuery::FREE( pQResult ); pQResult = NULL;
pServerSession->Send( (BYTE *)&msg, msg.GetSize() );
// SUNLOG(eFULL_LOG, "[U:%d]:某腐磐积己己傍\n", dwUserKey );
}
Handler_FromAgentServer_IMPL( AD_CHARINFO_DESTROY_SYN )
{
MSG_AD_CHARINFO_DESTROY_SYN * pRcvMsg = (MSG_AD_CHARINFO_DESTROY_SYN *)pMsg;
DWORD UserKey = pRcvMsg->m_dwKey;
// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府
// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府// 烙矫 贸府
// 叼厚俊 历厘茄 惑怕牢啊????
if( g_DBUserManager.FindUserFromCacheList(UserKey) )
g_DBUserManager.DestroyUserFromCacheList(UserKey);
//------------------------------------------------------------------------------------------------
// 某腐 昏力 孽府 朝覆
//------------------------------------------------------------------------------------------------
TCHAR szQueryBuff[50];
_sntprintf( szQueryBuff, sizeof(szQueryBuff), "{?=call S_DestroyCharDel(%u, %u)}", pRcvMsg->m_dwUserGUID, pRcvMsg->m_dwCharGUID );
//_sntprintf( szQueryBuff, sizeof(szQueryBuff), "{?=call S_DestroyCharDel(%u, %u)}", pRcvMsg->m_dwUserGUID, pRcvMsg->m_dwCharGUID );
//DestroyCharQuery * pQuery = QUERYALLOC(DestroyCharQuery);
DestroyCharQuery * pQuery = DestroyCharQuery::ALLOC();
pQuery->SetIndex( MAKEDWORD( (WORD)AD_CHARINFO, (WORD)AD_CHARINFO_DESTROY_DBR ) );
pQuery->SetVoidObject( pServerSession );
pQuery->SetSlotIndex( pRcvMsg->m_bySelectedCharSlotIndex );
pQuery->SetQuery( szQueryBuff );
pQuery->SetUserKey( UserKey );
pServerSession->DBQuery( pQuery );
}
Handler_FromAgentServer_IMPL( AD_CHARINFO_DESTROY_DBR )
{
MSG_DBPROXY_RESULT * pResult = (MSG_DBPROXY_RESULT *)pMsg;
DestroyCharQuery * pQResult = (DestroyCharQuery *)pResult->m_pData;
DWORD dwUserKey = pQResult->GetUserKey();
BYTE ResultNum = (BYTE)pQResult->GetResultRowNum();
BYTE bySlotIdx = pQResult->GetSlotIndex();
if( pQResult->GetResult() != 0 )
{
SUNLOG(eFULL_LOG, "[Handler_FromAgentServer_IMPL( AD_CHARINFO_DESTROY_DBR )] [ID:%u][R:%u]某腐磐DESTROY角菩(%s)", dwUserKey, pQResult->GetResult(), pQResult->GetQuery() );
MSG_AD_CHARINFO_DESTROY_NAK nmsg;
nmsg.m_dwKey = dwUserKey;
nmsg.m_dwErrorCode = pQResult->GetResult(); //! 烙矫 贸府
pServerSession->Send( (BYTE *)&nmsg, sizeof(nmsg) );
DestroyCharQuery::FREE( pQResult ); pQResult = NULL;
return;
}
DestroyCharQuery::FREE( pQResult );
pQResult = NULL;
// 某浆 贸府 内靛 ------------------------------
MSG_AD_CHARINFO_DESTROY_ACK msg;
msg.m_dwKey = dwUserKey;
msg.m_bySelectedCharSlotIndex = bySlotIdx;
//msg.m_dwCharGUID //!!!!!
//SUNLOG(eFULL_LOG, "[U:%d:浇吩牢郸胶:%d]:某腐磐昏力己傍", dwUserKey, bySlotIdx );
pServerSession->Send( (BYTE *)&msg, sizeof(msg) );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -