📄 handler_fromgameserver.cpp
字号:
SUNLOG(eFULL_LOG, "[Handler_FromGameServer_IMPL(DG_CHARINFO_ALL_REQ_SYN)] 某腐磐甫 积己且 荐 绝促." );
return;
}
}
if( pUser && !pUser->IsValidSlot(pRecvMsg->m_bySelectedCharSlotIndex) )
{
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// 咯扁辑 某腐磐啊 急琶等促!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// 急琶登绰 某腐磐 沥焊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if(bCache)
g_DBUserManager.MoveUserFromCacheList( UserKey );
pUser->SetSelectedCharSlotIndex( pRecvMsg->m_bySelectedCharSlotIndex );
pUser->SetDBSaveState( eDB_SAVE_NONE );
pUser->SetDBLoadState( eDB_LOAD_BEFORE );
ExecuteCharacterQuery( pServerSession, MAKEDWORD( (WORD)DG_CHARINFO, (WORD)DG_CHARINFO_ALL_REQ_DBR ), pRecvMsg->m_dwCharGUID, UserKey, pRecvMsg->m_byType );
}
else
{
ASSERT(bCache);
// 某矫 府胶飘俊 粮犁茄促.
// 老馆 府胶飘肺 颗变促.
g_DBUserManager.MoveUserFromCacheList( UserKey );
// 犁荤侩
pUser->ReInit();
pUser->SetSelectedCharSlotIndex( pRecvMsg->m_bySelectedCharSlotIndex );
pUser->SetDBSaveState( eDB_SAVE_NONE );
pUser->SendAllDataToGameServer( pServerSession );
pUser->SetDBLoadState( eDB_LOAD_AFTER );
MSG_DG_CHARINFO_ALL_REQ_ACK msg_end;
msg_end.m_dwKey = UserKey;
msg_end.m_byType = pRecvMsg->m_byType;
pServerSession->Send( (BYTE *)&msg_end, sizeof(msg_end) );
}
pUser->SetServerSessionIndex( pServerSession->GetSessionIndex() );
}
Handler_FromGameServer_IMPL( DG_CHARINFO_ALL_REQ_DBR )
{
MSG_DBPROXY_RESULT * pResult = (MSG_DBPROXY_RESULT *)pMsg;
SelectCharQuery * pQResult = (SelectCharQuery *)pResult->m_pData;
DWORD dwUserKey = pQResult->GetUserKey();
BYTE byType = pQResult->GetType();
DBUser * pUser = g_DBUserManager.FindUser( dwUserKey );
if( !pUser )
{
// 捞固 谗绢脸栏骨肺 傈崔且 鞘夸 绝促.
SelectCharQuery::FREE( pQResult ); pQResult = NULL;
return;
}
if( pQResult->GetResultRowNum() != 1 )
{
SUNLOG(eFULL_LOG, "[Handler_FromGameServer_IMPL( DG_CHARINFO_ALL_REQ_DBR )] 某腐磐 沥焊 叼厚俊辑 佬绢 坷瘤 给沁嚼聪促. UserID(%u)(%s)", dwUserKey, pQResult->GetQuery() );
MSG_DG_CHARINFO_ALL_REQ_NAK nmsg;
nmsg.m_dwKey = dwUserKey;
nmsg.m_dwErrorCode = 3; //! 烙矫 内靛
nmsg.m_byType = byType;
pServerSession->Send( (BYTE *)&nmsg, sizeof(nmsg) );
SelectCharQuery::FREE( pQResult ); pQResult = NULL;
return ;
}
pUser->CopyQUERY_CHARACTERTo( pUser->GetSelectedCharSlotIndex(), &pQResult->pCharacter[0] );
SelectCharQuery::FREE( pQResult ); pQResult = NULL;
// 某浆 贸府 内靛 -------------------------------------------------------------------------
pUser->SetDBLoadState( eDB_LOAD_AFTER );
pUser->SetOccupiedSlot( pUser->GetSelectedCharSlotIndex(), TRUE );
pUser->SendAllDataToGameServer( pServerSession );
MSG_DG_CHARINFO_ALL_REQ_ACK msg_end;
msg_end.m_dwKey = dwUserKey;
msg_end.m_byType = byType;
pServerSession->Send( (BYTE *)&msg_end, sizeof(msg_end) );
//SUNLOG(eFULL_LOG, "[U:%d]:MSG_DG_CHARINFO_ALL_REQ_ACK", dwUserKey );
}
Handler_FromGameServer_IMPL(DG_ITEM_SERIAL_SYN)
{
MSG_DG_ITEM_SERIAL_SYN * pRecvMsg = (MSG_DG_ITEM_SERIAL_SYN *)pMsg;
MSG_DG_ITEM_SERIAL_ACK msg;
msg.m_dwKey = pRecvMsg->m_dwKey;
msg.m_SlotIdx = pRecvMsg->m_SlotIdx;
msg.m_ItemPos = pRecvMsg->m_ItemPos;
msg.m_DBSerial = g_DBProxyServer.AllocDBSerial();
if( msg.m_DBSerial != 0 )
{
//SUNLOG(eFULL_LOG, "[g_DBProxyServer.]: 酒捞袍 矫府倔 g_DBProxyServer.(%d)OK", msg.m_DBSerial );
pServerSession->Send( (BYTE *)&msg, sizeof(msg) );
}
else
{
SUNLOG(eFULL_LOG, "[Handler_FromGameServer_IMPL(DG_ITEM_SERIAL_SYN)] [版绊]:酒捞袍 矫府倔捞 何练钦聪促." );
}
}
Handler_FromGameServer_IMPL(DG_WAREHOUSE_START_SYN)
{
MSG_DG_WAREHOUSE_START_SYN * pRecvMsg = (MSG_DG_WAREHOUSE_START_SYN *)pMsg;
DWORD UserKey = pRecvMsg->m_dwKey;
DBUser * pUser = g_DBUserManager.FindUser( UserKey );
if( !pUser )
{
SUNLOG(eFULL_LOG, "[Handler_FromGameServer_IMPL(DG_WAREHOUSE_START_SYN)] [坷幅]:[ID:%u]:ID俊 嘎绰 DBUser啊 绝嚼聪促.", UserKey );
return;
}
TCHAR szQueryBuff[32];
_sntprintf( szQueryBuff, sizeof(szQueryBuff), "S_SelectWarehouse %u", UserKey );
SelectWarehouseQuery * pQuery = QUERYALLOC(SelectWarehouseQuery);
// 檬扁拳
for( int i = 0 ; i < SelectWarehouseQuery::WAREHOUSE_ROW_NUM ; ++i )
{
memset( pQuery->pWarehouse[i].m_byaWarehouseItem, 0, MAX_WAREHOUSESTREAM_SIZE );
}
pQuery->SetIndex( MAKEDWORD( (WORD)DG_WAREHOUSE, (WORD)DG_WAREHOUSE_START_DBR ) );
pQuery->SetVoidObject( pServerSession );
pQuery->SetQuery( szQueryBuff );
pQuery->SetUserKey( UserKey );
pServerSession->DBQuery( pQuery );
//SUNLOG(eFULL_LOG, "[ID:%d]:%s", UserKey, szQueryBuff );
}
Handler_FromGameServer_IMPL(DG_WAREHOUSE_START_DBR)
{
MSG_DBPROXY_RESULT * pResult = (MSG_DBPROXY_RESULT *)pMsg;
SelectWarehouseQuery * pQResult = (SelectWarehouseQuery *)pResult->m_pData;
if( pQResult->GetResultRowNum() != 1 )
{
SUNLOG(eFULL_LOG, "[Handler_FromGameServer_IMPL(DG_WAREHOUSE_START_DBR)] [坷幅]:UserGuid[%u]肺 叼厚俊辑 佬绢 坷瘤 给沁嚼聪促.(%s)", pQResult->GetUserKey(), pQResult->GetQuery() );
// send nack msg
MSG_DG_WAREHOUSE_START_NAK errorMsg;
errorMsg.m_dwKey = pQResult->GetUserKey();
pServerSession->Send( (BYTE *)&errorMsg, sizeof(errorMsg) );
QUERYFREE( SelectWarehouseQuery, pQResult );
return ;
}
// 某浆 贸府 内靛 -------------------------------------------------------------------------
DBUser * pUser = g_DBUserManager.FindUser( pQResult->GetUserKey() );
if( !pUser )
{
// 蜡历啊 绝促.
// send nack msg
MSG_DG_WAREHOUSE_START_NAK errorMsg;
errorMsg.m_dwKey = pQResult->GetUserKey();
pServerSession->Send( (BYTE *)&errorMsg, sizeof(errorMsg) );
return;
}
pUser->SetWarehouseMoney( pQResult->pWarehouse[0].m_Money );
pUser->SerializeWarehouseStream( pQResult->pWarehouse[0].m_byaWarehouseItem, MAX_WAREHOUSESTREAM_SIZE, SERIALIZE_STORE );
QUERYFREE( SelectWarehouseQuery, pQResult );
pQResult = NULL;
// 某浆 贸府 内靛 -------------------------------------------------------------------------
//SUNLOG(eFULL_LOG, "[ID:%d]:MSG_DG_WAREHOUSE_START_ACK", pUser->GetUserKey() );
// 俺牢芒绊沥焊?
MSG_DG_WAREHOUSE_START_ACK msg;
msg.m_dwKey = pUser->GetUserKey();
msg.m_WarehouseMoney = pUser->GetWarehouseMoney();
msg.m_ItemInfo.m_Count = 0;
ITEMSLOTEX * pSlot = msg.m_ItemInfo.m_Slot;
POSTYPE total = 0;
for(POSTYPE i=0;i<MAX_WAREHOUSE_SLOT_NUM;++i)
{
if( !pUser->IsEmptyWarehouseItem(i))
{
pSlot[total].m_ItemPos = i;
pUser->GetWarehouseItem(pSlot[total].m_ItemPos, &pSlot[total].m_Stream);
++total;
++msg.m_ItemInfo.m_Count;
}
}
pServerSession->Send( (BYTE *)&msg, msg.GetSize() );
}
Handler_FromGameServer_IMPL(DG_WAREHOUSE_END_SYN)
{
MSG_DG_WAREHOUSE_END_SYN * pRecvMsg = (MSG_DG_WAREHOUSE_END_SYN *)pMsg;
DWORD UserKey = pRecvMsg->m_dwKey;
DBUser * pUser = g_DBUserManager.FindUser( UserKey );
if( !pUser )
{
SUNLOG(eFULL_LOG, "[Handler_FromGameServer_IMPL(DG_WAREHOUSE_END_SYN)] [坷幅]:[ID:%u]:ID俊 嘎绰 DBUser啊 绝嚼聪促.", UserKey );
return;
}
g_DBProxyServer.ExecutUpdateWarehouseQuery( pUser );
//SUNLOG(eFULL_LOG, "[ID:%d]:MSG_DG_WAREHOUSE_END_ACK", pUser->GetUserKey() );
MSG_DG_WAREHOUSE_END_ACK msg;
msg.m_dwKey = UserKey;
pServerSession->Send( (BYTE *)&msg, sizeof(msg) );
}
// 霸烙 救俊辑 柳青吝牢 ID府胶飘捞扼绊 啊沥茄促.
// 溜, DBP俊 User啊 绝绰 惑炔
Handler_FromGameServer_DECL(DG_CONNECTION_RECOVER_SYN)
{
MSG_DG_CONNECTION_RECOVER_SYN * pRecvMsg = (MSG_DG_CONNECTION_RECOVER_SYN *)pMsg;
/*
for( BYTE i = 0 ; i < pRecvMsg->m_byCount ; ++i )
{
DWORD UserKey = pRecvMsg->m_RECOVER_INFO[i].m_dwKey;
BYTE SelectedCharSlotIndex = pRecvMsg->m_RECOVER_INFO[i].m_bySelectedCharSlotIndex;
DBUser * pUser = g_DBUserManager.FindUserFromCacheList(UserKey);
ASSERT( NULL == pUser );
if( pUser ) return;
pUser = g_DBUserManager.FindUser(UserKey);
ASSERT( NULL == pUser );
if( pUser ) return;
pUser = g_DBUserManager.CreateUser_AddList(UserKey);
ASSERT(pUser);
if( !pUser ) return;
pUser->SetSelectedCharSlotIndex( SelectedCharSlotIndex );
pUser->SetDBSaveState( eDB_SAVE_NONE );
pUser->SetDBLoadState( eDB_LOAD_BEFORE );
}
*/
}
Handler_FromGameServer_IMPL( DG_EVENT_SELECT_SYN )
{
MSG_DG_EVENT_SELECT_SYN * pRecvMsg = (MSG_DG_EVENT_SELECT_SYN *)pMsg;
DWORD UserKey = pRecvMsg->m_dwKey;
DBUser * pUser = g_DBUserManager.FindUser( UserKey );
if( !pUser )
{
SUNLOG(eFULL_LOG, "[Handler_FromGameServer_IMPL(DG_EVENT_SELECT_SYN)] [坷幅]:[ID:%u]:ID俊 嘎绰 DBUser啊 绝嚼聪促.", UserKey );
return;
}
TCHAR szQueryBuff[32];
_sntprintf( szQueryBuff, sizeof(szQueryBuff), "{?=call S_Event_Select(%d)}", pRecvMsg->m_UserGuid );
SelectEventQuery * pQuery = SelectEventQuery::ALLOC();
pQuery->SetUserKey( pRecvMsg->m_dwKey );
pQuery->SetQuery(szQueryBuff);
pQuery->SetIndex( MAKEDWORD( (WORD)DG_EVENT, (WORD)DG_EVENT_SELECT_DBR ) );
pQuery->SetVoidObject( pServerSession );
pServerSession->DBQuery( pQuery );
}
Handler_FromGameServer_IMPL( DG_EVENT_SELECT_DBR )
{
MSG_DBPROXY_RESULT * pResult = (MSG_DBPROXY_RESULT *)pMsg;
SelectEventQuery * pQResult = (SelectEventQuery *)pResult->m_pData;
if( !pQResult->ResultSuccess() )
{
MSG_DG_EVENT_SELECT_NAK nmsg;
nmsg.m_dwKey = pQResult->GetUserKey();
nmsg.m_byErrorCode = 1;
pServerSession->SendPacket( &nmsg, sizeof(nmsg) );
SelectEventQuery::FREE(pQResult); pQResult = NULL;
return;
}
MSG_DG_EVENT_SELECT_ACK msg;
msg.m_dwKey = pQResult->GetUserKey();
msg.m_TotalInfo.m_Count = (BYTE)pQResult->GetResultRowNum();
ASSERT( msg.m_TotalInfo.m_Count <= EVENT_ITEM_TOTAL_INFO_EX::MAX_SLOT_NUM );
for( BYTE i = 0 ; ( i < pQResult->GetResultRowNum() && i < EVENT_ITEM_TOTAL_INFO_EX::MAX_SLOT_NUM ) ; ++i )
{
msg.m_TotalInfo.m_Slot[i].m_ItemCode = pQResult->pResult[i].m_ItemCode;
msg.m_TotalInfo.m_Slot[i].m_ItemCount = pQResult->pResult[i].m_ItemCount;
msg.m_TotalInfo.m_Slot[i].m_ItemSeq = pQResult->pResult[i].m_ItemSeq;
}
pServerSession->SendPacket( &msg, msg.GetSize() );
SelectEventQuery::FREE(pQResult); pQResult = NULL;
}
Handler_FromGameServer_IMPL( DG_EVENT_UPDATE_SYN )
{
MSG_DG_EVENT_UPDATE_SYN * pRecvMsg = (MSG_DG_EVENT_UPDATE_SYN *)pMsg;
DWORD UserKey = pRecvMsg->m_dwKey;
DBUser * pUser = g_DBUserManager.FindUser( UserKey );
if( !pUser )
{
SUNLOG(eFULL_LOG, "[Handler_FromGameServer_IMPL(DG_EVENT_UPDATE_SYN)] [坷幅]:[ID:%u]:ID俊 嘎绰 DBUser啊 绝嚼聪促.", UserKey );
return;
}
TCHAR szQueryBuff[64];
_sntprintf( szQueryBuff, sizeof(szQueryBuff), "{?=call S_Event_Update(%d,%d)}", pRecvMsg->m_UserGuid, pRecvMsg->m_ItemSeq );
UdpateEventQuery * pQuery = UdpateEventQuery::ALLOC();
pQuery->SetUserKey( pRecvMsg->m_dwKey );
pQuery->SetItemPos( pRecvMsg->m_ItemPos );
pQuery->SetQuery(szQueryBuff);
pQuery->SetIndex( MAKEDWORD( (WORD)DG_EVENT, (WORD)DG_EVENT_UPDATE_DBR ) );
pQuery->SetVoidObject( pServerSession );
pServerSession->DBQuery( pQuery );
}
Handler_FromGameServer_IMPL( DG_EVENT_UPDATE_DBR )
{
MSG_DBPROXY_RESULT * pResult = (MSG_DBPROXY_RESULT *)pMsg;
UdpateEventQuery * pQResult = (UdpateEventQuery *)pResult->m_pData;
if( !pQResult->ResultSuccess() )
{
MSG_DG_EVENT_UPDATE_NAK nmsg;
nmsg.m_dwKey = pQResult->GetUserKey();
nmsg.m_byErrorCode = 1;
pServerSession->SendPacket( &nmsg, sizeof(nmsg) );
UdpateEventQuery::FREE(pQResult); pQResult = NULL;
return;
}
MSG_DG_EVENT_UPDATE_ACK msg;
msg.m_dwKey = pQResult->GetUserKey();
msg.m_ItemPos = pQResult->GetItemPos();
pServerSession->SendPacket( &msg, sizeof(msg) );
UdpateEventQuery::FREE(pQResult); pQResult = NULL;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -