📄 handler_cw.cpp
字号:
sendMsg.m_CharGuidTo = pFriendInfo->dwFriendGuid;
// DB肺 夸没~
ServerSession *pGameDBProxy = ServerSessionManager::Instance()->GetGameDBProxy();
if( !pGameDBProxy )
{
MSG_CW_FRIEND_DEL_NAK sendMsg;
sendMsg.m_byResult = MSG_CW_FRIEND_DEL_NAK::ERR_DEFAULT;
pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_DEL_NAK) );
MessageOut( eCRITICAL_LOG, "Friend Del Error - No GameDBProxy(User %s)", pUser->GetCharName().c_str() );
return;
}
pGameDBProxy->Send( (BYTE*)&sendMsg, sizeof(MSG_DW_FRIEND_DEL_SYN) );
MessageOut(eFULL_LOG, "Friend NO to GameDBProxy(%s->%s)", pUser->GetCharName().c_str(), pFriendInfo->sPacketInfo.ptszFriendName );
}
// 瞒窜 夸没
VOID Handler_CW::OnCW_FRIEND_BLOCK_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
// 弊成 瞒窜窍搁 场~
MSG_CW_FRIEND_BLOCK_SYN* pRecvMsg = (MSG_CW_FRIEND_BLOCK_SYN*)pMsg;
// 趣矫 呈 磊脚阑 瞒窜窍绰 巴篮 酒聪摆瘤?
if( !_tcsncmp( pRecvMsg->ptszBlockName, pUser->GetCharName().c_str(), strlen(pUser->GetCharName().c_str()) ) )
{
//弊矾搁 角菩芭电!!
MSG_CW_FRIEND_BLOCK_NAK sendMsg;
sendMsg.m_byResult = MSG_CW_FRIEND_BLOCK_NAK::BLOCKED_ME; // 呈 磊脚阑 瞒窜沁促绊!!!
pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_BLOCK_NAK) );
MessageOut( eCRITICAL_LOG, "[%s] Block Error - Block Myself", pUser->GetCharName().c_str() );
return;
}
MSG_DW_FRIEND_BLOCK_SYN sendMsg;
sendMsg.m_CharGuidFrom = pUser->GetCharGuid();
_tcsncpy( sendMsg.m_ptszCharNameTo, pRecvMsg->ptszBlockName, MAX_CHARNAME_LENGTH - 1 );
sendMsg.m_ptszCharNameTo[MAX_CHARNAME_LENGTH-1] = '\0';
// DB肺 夸没~
ServerSession *pGameDBProxy = ServerSessionManager::Instance()->GetGameDBProxy();
if( !pGameDBProxy )
{
MSG_CW_FRIEND_BLOCK_NAK sendMsg;
sendMsg.m_byResult = MSG_CW_FRIEND_BLOCK_NAK::ERR_DEFAULT;
pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_BLOCK_NAK) );
MessageOut( eCRITICAL_LOG, "Friend Block Error - No GameDBProxy(User %s)", pUser->GetCharName().c_str() );
return;
}
pGameDBProxy->Send( (BYTE*)&sendMsg, sizeof(MSG_DW_FRIEND_BLOCK_SYN) );
MessageOut(eFULL_LOG, "Friend Block to GameDBProxy(%s->%s)", pUser->GetCharName().c_str(), sendMsg.m_ptszCharNameTo );
}
// 瞒窜 昏力 夸没
VOID Handler_CW::OnCW_FRIEND_BLOCK_FREE_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
MSG_CW_FRIEND_BLOCK_FREE_SYN* pRecvMsg = (MSG_CW_FRIEND_BLOCK_FREE_SYN*)pMsg;
// 瞒窜 吝捞变 窍衬?
STRUCT_BLOCK_INFO* pBlockInfo = pUser->FindBlock( pRecvMsg->ptszBlockName );
// 瞒窜 沥焊啊 绝栏搁
if( !pBlockInfo)
{
// 俊矾促
MSG_CW_FRIEND_BLOCK_FREE_NAK sendMsg;
sendMsg.m_byResult = MSG_CW_FRIEND_BLOCK_FREE_NAK::NOT_BLOCKED;
pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_BLOCK_FREE_NAK) );
return;
}
// 沥犬茄 瞒窜 沥焊啊 乐栏搁 瞒窜 秦力 夸没阑 DB俊 焊辰促
MSG_DW_FRIEND_BLOCK_FREE_SYN sendMsg;
sendMsg.m_CharGuidFrom = pUser->GetCharGuid();
_tcsncpy( sendMsg.m_ptszCharNameTo, pRecvMsg->ptszBlockName, MAX_CHARNAME_LENGTH - 1 );
sendMsg.m_ptszCharNameTo[MAX_CHARNAME_LENGTH-1] = '\0';
// DB肺 夸没~
ServerSession *pGameDBProxy = ServerSessionManager::Instance()->GetGameDBProxy();
if( !pGameDBProxy )
{
MSG_CW_FRIEND_BLOCK_FREE_NAK sendMsg;
sendMsg.m_byResult = MSG_CW_FRIEND_BLOCK_NAK::ERR_DEFAULT;
pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_BLOCK_FREE_NAK) );
MessageOut( eCRITICAL_LOG, "Friend Block Free Error - No GameDBProxy(User %s)", pUser->GetCharName().c_str() );
return;
}
pGameDBProxy->Send( (BYTE*)&sendMsg, sizeof(MSG_DW_FRIEND_BLOCK_FREE_SYN) );
MessageOut(eFULL_LOG, "Friend Block Free to GameDBProxy(%s->%s)", pUser->GetCharName().c_str(), sendMsg.m_ptszCharNameTo );
}
// 模备 盲泼
VOID Handler_CW::OnCW_FRIEND_CHAT_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
MSG_CW_FRIEND_CHAT_SYN* pRecvMsg = (MSG_CW_FRIEND_CHAT_SYN*)pMsg;
// 柯扼牢牢瘤 犬牢
User *pFriend = UserManager::Instance()->FindUser( pRecvMsg->ptszFriendNameTo );
if( !pFriend )
{
// 柯扼牢 酒捞促!!
MSG_CW_FRIEND_CHAT_NAK sendMsg;
_tcsncpy( sendMsg.ptszFriendNameTo, pRecvMsg->ptszFriendNameTo, MAX_CHARNAME_LENGTH - 1 );
sendMsg.ptszFriendNameTo[MAX_CHARNAME_LENGTH-1] = '\0';
sendMsg.m_byResult = MSG_CW_FRIEND_CHAT_NAK::OFFLINE_FRIEND;
pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_CHAT_NAK) );
MessageOut( eCRITICAL_LOG, "Friend Chat Error[%s][CharGuid:%u] - Friend Offline[%s]", pUser->GetCharName().c_str(),
pUser->GetCharGuid(),
pRecvMsg->ptszFriendNameTo );
return;
}
// 柯扼牢捞搁 模备衬?
STRUCT_FRIEND_INFO* pFriendInfo = pUser->FindFriend( pRecvMsg->ptszFriendNameTo );
if( !pFriendInfo )
{
if( !pFriend->FindFriend( pUser->GetCharGuid() ) )
{
// 惑措俊霸档 模备 酒捞促!!
MSG_CW_FRIEND_CHAT_NAK sendMsg;
_tcsncpy( sendMsg.ptszFriendNameTo, pRecvMsg->ptszFriendNameTo, MAX_CHARNAME_LENGTH - 1 );
sendMsg.ptszFriendNameTo[MAX_CHARNAME_LENGTH-1] = '\0';
sendMsg.m_byResult = MSG_CW_FRIEND_CHAT_NAK::NOT_FRIEND;
pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_CHAT_NAK) );
MessageOut( eCRITICAL_LOG, "Friend Chat Error[%s][CharGuid:%u] - Not Friend[%s]", pUser->GetCharName().c_str(), pUser->GetCharGuid(),
pRecvMsg->ptszFriendNameTo );
return;
}
}
// 辑肺 模备扼绊 秦档 娟啊 芭何沁芭唱 瞒窜沁绰瘤 舅酒具 茄促
if( pFriend->GetFriendChatBlock() || pFriend->FindBlock( pUser->GetCharGuid() ) )
{
MSG_CW_FRIEND_CHAT_NAK sendMsg;
_tcsncpy( sendMsg.ptszFriendNameTo, pRecvMsg->ptszFriendNameTo, MAX_CHARNAME_LENGTH - 1 );
sendMsg.ptszFriendNameTo[MAX_CHARNAME_LENGTH-1] = '\0';
sendMsg.m_byResult = MSG_CW_FRIEND_CHAT_NAK::BLOCK_CHAT;
pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_CHAT_NAK) );
MessageOut( eCRITICAL_LOG, "Friend Chat Error[%s][CharGuid:%u] - Chat Block[%s]", pUser->GetCharName().c_str(), pUser->GetCharGuid(),
pRecvMsg->ptszFriendNameTo );
return;
}
// 磊 捞力 焊郴磊
MSG_CW_FRIEND_CHAT_BRD sendMsg;
if( pRecvMsg->byMsgLength >= MSG_CW_FRIEND_CHAT_SYN::_MAX_CHATMSG_SIZE )
{
MessageOut(eCRITICAL_LOG, "%s CW_FRIEND_CHAT_SYN 辨捞檬苞(%u)", pUser->GetCharName().c_str(), pRecvMsg->byMsgLength);
return;
}
memset( sendMsg.ptszChatMsg, 0, sizeof(TCHAR) * MSG_CW_FRIEND_CHAT_BRD::_MAX_CHATMSG_SIZE );
_tcsncpy( sendMsg.ptszChatMsg, pRecvMsg->ptszChatMsg, pRecvMsg->byMsgLength );
// sendMsg.ptszChatMsg[pRecvMsg->byMsgLength] = '\0';
sendMsg.byMsgLength = pRecvMsg->byMsgLength;
_tcsncpy( sendMsg.ptszFriendNameFrom, pUser->GetCharName().c_str(), MAX_CHARNAME_LENGTH - 1 );
sendMsg.ptszFriendNameFrom[MAX_CHARNAME_LENGTH-1] = '\0';
// 模备 盲泼篮 惑措规俊霸父 焊郴霖促. 焊辰 仇篮 弊成 瘤啊 舅绊 乐栏聪 舅酒辑 免仿秦拎!
// pUser->Send( (BYTE*)&sendMsg, sendMsg.GetSize() );
pFriend->Send( (BYTE*)&sendMsg, sendMsg.GetSize() );
TCHAR ptszCharName[MAX_CHARNAME_LENGTH]={0,}, ptszTargetName[MAX_CHARNAME_LENGTH]={0,};
_tcsncpy( ptszCharName, pUser->GetCharName().c_str(), MAX_CHARNAME_LENGTH - 1 );
ptszCharName[MAX_CHARNAME_LENGTH-1] = '\0';
_tcsncpy( ptszTargetName, pFriend->GetCharName().c_str(), MAX_CHARNAME_LENGTH - 1 );
ptszTargetName[MAX_CHARNAME_LENGTH-1] = '\0';
GAMELOG->WriteFriendChat( NULL, ptszCharName, ptszTargetName, WorldServer::Instance()->GetServerKey(), sendMsg.ptszChatMsg );
MessageOut( eFULL_LOG, "Friend Chat[%s -> %s]: %s", pUser->GetCharName().c_str(),
pRecvMsg->ptszFriendNameTo,
pRecvMsg->ptszChatMsg );
}
// 1:1 措拳 芭何 眉农
VOID Handler_CW::OnCW_FRIEND_CHATBLOCK_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
// 秦寸 蜡历狼 1:1措拳甫 芭何茄促
MSG_CW_FRIEND_CHATBLOCK_SYN* pRecvMsg = (MSG_CW_FRIEND_CHATBLOCK_SYN*)pMsg;
pUser->SetFriendChatBlock( pRecvMsg->m_bBlock );
MSG_CW_FRIEND_CHATBLOCK_ACK sendMsg;
sendMsg.m_bNowBlock = pRecvMsg->m_bBlock;
pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_CHATBLOCK_ACK) );
MessageOut( eFULL_LOG, "[%s] Friend Chat Block(%u)", pUser->GetCharName().c_str(), sendMsg.m_bNowBlock );
}
// 辨靛 糕滚 沥焊 夸没
VOID Handler_CW::OnCW_GUILD_MEMBER_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
MSG_CW_GUILD_MEMBER_SYN* pRecvMsg = (MSG_CW_GUILD_MEMBER_SYN*)pMsg;
MSG_CW_GUILD_MEMBER_NAK nakMsg;
// 辨靛 糕滚 沥焊绰 夸没且 锭付促 霖促 - 老窜 橇府 坷锹海鸥 锭父 利侩
/*
if( pUser->CheckGuildList() ) // 捞固 辨靛 糕滚 罐疽栏搁 览翠 绝促
{
return;
}
pUser->SetGuildList(); // 捞力 歹 捞惑 辨靛 糕滚 罐栏搁 救等促
*/
if( pUser->GetGuildGuid() == 0 ) // 荤侩磊 沥焊俊 啊涝等 辨靛啊 绝栏搁
{
nakMsg.m_byErrorCode = MSG_CW_GUILD_MEMBER_NAK::ERR_WAIT_INFO;
pUser->Send( (BYTE*)&nakMsg, sizeof(MSG_CW_GUILD_MEMBER_NAK) );
MessageOut( eFULL_LOG, "[%s][CharGuid:%u] No Info Guild Member", pUser->GetCharName().c_str(), pUser->GetCharGuid() );
// 辨靛 糕滚 汗备 夸没
MSG_WZ_GUILD_SELECT_SYN ToGuildMsg;
ToGuildMsg.m_dwKey = pUser->GetGUID();
ToGuildMsg.m_GuildGuid = pRecvMsg->m_GuildGuid; // 捞 沥焊父 脚汾且 荐 乐促
ToGuildMsg.m_CharGuid = pUser->GetCharGuid();
ServerSession *pGuildServer = ServerSessionManager::Instance()->GetGuildServer();
if( !pGuildServer )
{
MessageOut( eCRITICAL_LOG, "GUILD_MEMBER_SYN 辨靛辑滚 绝绢 汗备 夸没 阂啊!" );
return;
}
pGuildServer->Send( (BYTE*)&ToGuildMsg, sizeof(MSG_WZ_GUILD_SELECT_SYN) );
MessageOut( eFULL_LOG, "GUILD_MEMBER_SYN 辨靛沥焊[%u] 绝绢辑 夸没[%s]", pRecvMsg->m_GuildGuid, pUser->GetCharName().c_str() );
}
// 老窜 罐篮 沥焊啊 乐促搁 100% 捞 沥焊甫 脚汾茄促. 蝶扼辑 RecvMsg客 厚背且 鞘夸 绝促
/*
else if( pUser->GetGuildGuid() != pRecvMsg->m_GuildGuid ) // 辨靛绰 乐绰单 罐篮 皋矫瘤客 促福搁?
{
// 捞 版快绰 官肺 nak...努扼啊 力措肺 等 沥焊甫 林瘤 臼疽栏骨肺
nakMsg.m_byErrorCode = MSG_CW_GUILD_MEMBER_NAK::ERR_NOT_GUILD;
pUser->Send( (BYTE*)&nakMsg, sizeof(MSG_CW_GUILD_MEMBER_NAK) );
MessageOut( eCRITICAL_LOG, "[%s][CharGuid:%u] Guild Member Error - GuildGuid false[%u/%u]", pUser->GetCharName().c_str(),
pUser->GetCharGuid(),
pUser->GetGuildGuid(),
pRecvMsg->m_GuildGuid );
return;
}
*/
else
{
MSG_CW_GUILD_MEMBER_BRD sendMsg;
WorldGuild* pGuild = g_WorldGuildManager.FindGuild( pUser->GetGuildGuid() );
if( !pGuild )
{
nakMsg.m_byErrorCode = MSG_CW_GUILD_MEMBER_NAK::ERR_NOT_GUILD;
pUser->Send( (BYTE*)&nakMsg, sizeof(MSG_CW_GUILD_MEMBER_NAK) );
MessageOut( eFULL_LOG, "[%s][CharGuid:%u] No Info Guild Member", pUser->GetCharName().c_str(), pUser->GetCharGuid() );
// 捞 版快绰 沥惑捞绢具 窍绰单 肋给等 版快捞骨肺 汗备 鞘夸绝促.
return;
}
// 秦寸 辨靛狼 沥焊 罐酒辑 傈价
pGuild->GetMemberPacketInfo( sendMsg.m_Count, sendMsg.m_Member );
pUser->Send( (BYTE*)&sendMsg, sendMsg.GetSize() );
MessageOut( eFULL_LOG, "[%s][CharGuid:%u] Guild Member Info Send", pUser->GetCharName().c_str(), pUser->GetCharGuid() );
return;
}
}
VOID Handler_CW::OnCW_GUILD_CHAT_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
MSG_CW_GUILD_CHAT_SYN* pRecvMsg = (MSG_CW_GUILD_CHAT_SYN*)pMsg;
MSG_CW_GUILD_CHAT_NAK resMsg;
if( pUser->GetGuildGuid() == 0 ) // 辨靛 家加捞 酒聪扼绊 唱柯促搁?
{
// 辨靛 沥焊甫 夸没秦具 茄促
resMsg.byResult = MSG_CW_GUILD_CHAT_NAK::ERR_WAIT_INFO; // 泪矫 饶俊 促矫 矫档窍绞矫坷
pUser->Send( (BYTE*)&resMsg, sizeof(MSG_CW_GUILD_CHAT_NAK) );
MessageOut( eCRITICAL_LOG, "[%s] Guild Chat Error - No Guild %u", pUser->GetCharName().c_str(), pUser->GetGuildGuid() );
// 辨靛 糕滚 汗备 夸没
MSG_WZ_GUILD_SELECT_SYN ToGuildMsg;
ToGuildMsg.m_dwKey = pUser->GetGUID();
ToGuildMsg.m_GuildGuid = pRecvMsg->m_GuildGuid;
ToGuildMsg.m_CharGuid = pUser->GetCharGuid();
ServerSession *pGuildServer = ServerSessionManager::Instance()->GetGuildServer();
if( !pGuildServer )
{
MessageOut( eCRITICAL_LOG, "GUILD_MEMBER_SYN 辨靛辑滚 绝绢 汗备 夸没 阂啊!" );
return;
}
pGuildServer->Send( (BYTE*)&ToGuildMsg, sizeof(MSG_WZ_GUILD_SELECT_SYN) );
MessageOut( eFULL_LOG, "GUILD_CHAT_SYN 辨靛沥焊[%u] 绝绢辑 夸没[%s]", pRecvMsg->m_GuildGuid, pUser->GetCharName().c_str() );
}
// 老窜 罐篮 沥焊啊 乐促搁 100% 捞 沥焊甫 脚汾茄促. 蝶扼辑 RecvMsg客 厚背且 鞘夸 绝促
/*
else if( pUser->GetGuildGuid() != pRecvMsg->m_GuildGuid )
{
// 捞扒 弊成 坷幅促
resMsg.byResult = MSG_CW_GUILD_CHAT_NAK::ERR_NOT_GUILD;
pUser->Send( (BYTE*)&resMsg, sizeof(MSG_CW_GUILD_CHAT_NAK) );
MessageOut( eCRITICAL_LOG, "[%s] Guild Chat Error - No Guild %u", pUser->GetCharName().c_str(), pUser->GetGuildGuid() );
}
*/
else
{
// 家加 辨靛 茫绰促
WorldGuild *pGuild = g_WorldGuildManager.FindGuild( pUser->GetGuildGuid() );
if( !pGuild )
{
MSG_CW_GUILD_CHAT_NAK resMsg;
resMsg.byResult = MSG_CW_GUILD_CHAT_NAK::ERR_NOT_GUILD;
pUser->Send( (BYTE*)&resMsg, sizeof(MSG_CW_GUILD_CHAT_NAK) );
MessageOut( eCRITICAL_LOG, "[%s] Guild Chat Error - No Guild %u", pUser->GetCharName().c_str(), pUser->GetGuildGuid() );
return;
}
if( pRecvMsg->m_byMsgLen >= MSG_CW_GUILD_CHAT_SYN::_MAX_CHATMSG_SIZE )
{
MessageOut(eCRITICAL_LOG, "%s CW_GUILD_CHAT_SYN 辨捞檬苞(%u)", pUser->GetCharName().c_str(), pRecvMsg->m_byMsgLen);
return;
}
// 辨靛盔 傈眉俊霸 皋矫瘤 傈价 - 捞芭 UserManager俊辑 贸府秦具 登瘤 臼阑扼唱 酵匙?
MSG_CW_GUILD_CHAT_BRD sendMsg;
memset( sendMsg.ptszCharName, 0, sizeof(TCHAR) * MAX_CHARNAME_LENGTH );
_tcsncpy( sendMsg.ptszCharName, pUser->GetCharName().c_str(), MAX_CHARNAME_LENGTH - 1 );
memset( sendMsg.ptszChatMsg, 0, sizeof(TCHAR) * MSG_CW_GUILD_CHAT_BRD::_MAX_CHATMSG_SIZE );
_tcsncpy( sendMsg.ptszChatMsg, pRecvMsg->m_ptszCharMsg, pRecvMsg->m_byMsgLen );
sendMsg.byMsgLen = pRecvMsg->m_byMsgLen;
// sendMsg.byMsgLen = pRecvMsg->m_byMsgLen;
pGuild->SendAll( (BYTE*)&sendMsg, sendMsg.GetSize() );
MessageOut( eFULL_LOG, "[%s] Send Guild Chat[%u]", pUser->GetCharName().c_str(), pRecvMsg->m_GuildGuid );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -