⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 handler_cw.cpp

📁 奇迹世界 部分源代码奇迹世界 部分源代码奇迹世界 部分源代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
					break;
				}
				case eZONETYPE_MISSION:
				{
					pZone = pChannel->FindMissionZone(pUser->GetZoneKey());
					if(!pZone)
					{
						// 荤侩磊狼 Zone ID啊 撇啡促. 摹疙利牢 滚弊
						MessageOut( eCRITICAL_LOG, "荤侩磊 %s狼 MissionZone %u啊 粮犁窍瘤 臼澜!! 傍瘤 角菩!!", pUser->GetCharName().c_str(), 
																						pUser->GetZoneKey() );
						return;
					}
					pZone->SendToAll( (BYTE*)&noticeMsg, noticeMsg.GetSize() );

					char szNotice[MAX_NOTICE_LEN + 1];
					ZeroMemory( szNotice, sizeof(szNotice) );
					strncpy( szNotice, noticeMsg.szMsg, pRecvMsg->dwNoticeLength );
					MessageOut(eCRITICAL_LOG,  "---------------------------<< %u盲澄 %u MissionZone傍瘤 >>-------------------------", 
													pUser->GetChannelID(), 
													pUser->GetZoneKey() );
					MessageOut(eCRITICAL_LOG,  "%s(%u)", noticeMsg.szMsg, noticeMsg.wLen );
					MessageOut(eCRITICAL_LOG,  "------------------------------------------------------------------------" );
					break;
				}
				case eZONETYPE_HUNTING:
				{
					pZone = pChannel->FindHuntingZone(pUser->GetZoneKey());
					if(!pZone)
					{
						// 荤侩磊狼 Zone ID啊 撇啡促. 摹疙利牢 滚弊
						MessageOut( eCRITICAL_LOG, "荤侩磊 %s狼 HuntingZone %u啊 粮犁窍瘤 臼澜!! 傍瘤 角菩!!", pUser->GetCharName().c_str(), 
																						pUser->GetZoneKey() );
						return;
					}
					pZone->SendToAll( (BYTE*)&noticeMsg, noticeMsg.GetSize() );

					char szNotice[MAX_NOTICE_LEN + 1];
					ZeroMemory( szNotice, sizeof(szNotice) );
					strncpy( szNotice, noticeMsg.szMsg, pRecvMsg->dwNoticeLength );
					MessageOut(eCRITICAL_LOG,  "---------------------------<< %u盲澄 %u HuntingZone傍瘤 >>-------------------------", 
													pUser->GetChannelID(), 
													pUser->GetZoneKey() );
					MessageOut(eCRITICAL_LOG,  "%s(%u)", noticeMsg.szMsg, noticeMsg.wLen );
					MessageOut(eCRITICAL_LOG,  "------------------------------------------------------------------------" );
					break;
				}
				case eZONETYPE_QUEST:
				{
					pZone = pChannel->FindQuestZone(pUser->GetZoneKey());
					if(!pZone)
					{
						// 荤侩磊狼 Zone ID啊 撇啡促. 摹疙利牢 滚弊
						MessageOut( eCRITICAL_LOG, "荤侩磊 %s狼 QuestZone %u啊 粮犁窍瘤 臼澜!! 傍瘤 角菩!!", pUser->GetCharName().c_str(), 
																						pUser->GetZoneKey() );
						return;
					}
					pZone->SendToAll( (BYTE*)&noticeMsg, noticeMsg.GetSize() );

					char szNotice[MAX_NOTICE_LEN + 1];
					ZeroMemory( szNotice, sizeof(szNotice) );
					strncpy( szNotice, noticeMsg.szMsg, pRecvMsg->dwNoticeLength );
					MessageOut(eCRITICAL_LOG,  "---------------------------<< %u盲澄 %u QuestZone傍瘤 >>-------------------------", 
													pUser->GetChannelID(), 
													pUser->GetZoneKey() );
					MessageOut(eCRITICAL_LOG,  "%s(%u)", noticeMsg.szMsg, noticeMsg.wLen );
					MessageOut(eCRITICAL_LOG,  "------------------------------------------------------------------------" );
					break;
				}
				case eZONETYPE_PVP:
				{
					pZone = pChannel->FindPVPZone(pUser->GetZoneKey());
					if(!pZone)
					{
						// 荤侩磊狼 Zone ID啊 撇啡促. 摹疙利牢 滚弊
						MessageOut( eCRITICAL_LOG, "荤侩磊 %s狼 PVPZone %u啊 粮犁窍瘤 臼澜!! 傍瘤 角菩!!", pUser->GetCharName().c_str(), 
																						pUser->GetZoneKey() );
						return;
					}
					pZone->SendToAll( (BYTE*)&noticeMsg, noticeMsg.GetSize() );

					char szNotice[MAX_NOTICE_LEN + 1];
					ZeroMemory( szNotice, sizeof(szNotice) );
					strncpy( szNotice, noticeMsg.szMsg, pRecvMsg->dwNoticeLength );
					MessageOut(eCRITICAL_LOG,  "---------------------------<< %u盲澄 %u PVPZone傍瘤 >>-------------------------", 
													pUser->GetChannelID(), 
													pUser->GetZoneKey() );
					MessageOut(eCRITICAL_LOG,  "%s(%u)", noticeMsg.szMsg, noticeMsg.wLen );
					MessageOut(eCRITICAL_LOG,  "------------------------------------------------------------------------" );
					break;
				}
				case eZONETYPE_EVENT:
				{
					pZone = pChannel->FindEventZone(pUser->GetZoneKey());
					if(!pZone)
					{
						// 荤侩磊狼 Zone ID啊 撇啡促. 摹疙利牢 滚弊
						MessageOut( eCRITICAL_LOG, "荤侩磊 %s狼 EventZone %u啊 粮犁窍瘤 臼澜!! 傍瘤 角菩!!", pUser->GetCharName().c_str(), 
																						pUser->GetZoneKey() );
						return;
					}
					pZone->SendToAll( (BYTE*)&noticeMsg, noticeMsg.GetSize() );

					char szNotice[MAX_NOTICE_LEN + 1];
					ZeroMemory( szNotice, sizeof(szNotice) );
					strncpy( szNotice, noticeMsg.szMsg, pRecvMsg->dwNoticeLength );
					MessageOut(eCRITICAL_LOG,  "---------------------------<< %u盲澄 %u EventZone傍瘤 >>-------------------------", 
													pUser->GetChannelID(), 
													pUser->GetZoneKey() );
					MessageOut(eCRITICAL_LOG,  "%s(%u)", noticeMsg.szMsg, noticeMsg.wLen );
					MessageOut(eCRITICAL_LOG,  "------------------------------------------------------------------------" );
					break;
				}
				case eZONETYPE_GUILD:
				{
					pZone = pChannel->FindGuildZone(pUser->GetZoneKey());
					if(!pZone)
					{
						// 荤侩磊狼 Zone ID啊 撇啡促. 摹疙利牢 滚弊
						MessageOut( eCRITICAL_LOG, "荤侩磊 %s狼 GuildZone %u啊 粮犁窍瘤 臼澜!! 傍瘤 角菩!!", pUser->GetCharName().c_str(), 
																						pUser->GetZoneKey() );
						return;
					}
					pZone->SendToAll( (BYTE*)&noticeMsg, noticeMsg.GetSize() );

					char szNotice[MAX_NOTICE_LEN + 1];
					ZeroMemory( szNotice, sizeof(szNotice) );
					strncpy( szNotice, noticeMsg.szMsg, pRecvMsg->dwNoticeLength );
					MessageOut(eCRITICAL_LOG,  "---------------------------<< %u盲澄 %u GuildZone傍瘤 >>-------------------------", 
													pUser->GetChannelID(), 
													pUser->GetZoneKey() );
					MessageOut(eCRITICAL_LOG,  "%s(%u)", noticeMsg.szMsg, noticeMsg.wLen );
					MessageOut(eCRITICAL_LOG,  "------------------------------------------------------------------------" );
					break;
				}
				case eZONETYPE_SIEGE:
				{
					pZone = pChannel->FindSiegeZone(pUser->GetZoneKey());
					if(!pZone)
					{
						// 荤侩磊狼 Zone ID啊 撇啡促. 摹疙利牢 滚弊
						MessageOut( eCRITICAL_LOG, "荤侩磊 %s狼 SiegeZone %u啊 粮犁窍瘤 臼澜!! 傍瘤 角菩!!", pUser->GetCharName().c_str(), 
																						pUser->GetZoneKey() );
						return;
					}
					pZone->SendToAll( (BYTE*)&noticeMsg, noticeMsg.GetSize() );

					char szNotice[MAX_NOTICE_LEN + 1];
					ZeroMemory( szNotice, sizeof(szNotice) );
					strncpy( szNotice, noticeMsg.szMsg, pRecvMsg->dwNoticeLength );
					MessageOut(eCRITICAL_LOG,  "---------------------------<< %u盲澄 %u SiegeZone傍瘤 >>-------------------------", 
													pUser->GetChannelID(), 
													pUser->GetZoneKey() );
					MessageOut(eCRITICAL_LOG,  "%s(%u)", noticeMsg.szMsg, noticeMsg.wLen );
					MessageOut(eCRITICAL_LOG,  "------------------------------------------------------------------------" );
					break;
				}
				default:
				{
					assert( !"invalid user status" );
					break;
				}
			}
			break;
		}
		default:
		{
			MessageOut(eCRITICAL_LOG, "GM 傍瘤 辆幅 撇覆!!!(%s:%u)", pUser->GetCharName().c_str(), pRecvMsg->byNoticeType);
			return;
			break;
		}
	}
}

// 胶飘傅 颇教阑 烹茄 GM 疙飞
VOID Handler_CW::OnCW_GM_STRING_CMD_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
	MSG_CW_GM_STRING_CMD_SYN* pRecvMsg = (MSG_CW_GM_STRING_CMD_SYN*)pMsg;

	m_GMCmdManager.ParseCommand( pUser, pRecvMsg->m_szStringCmd );
}

VOID Handler_CW::OnCW_VIEWPORT_CHARSTATE( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
	MSG_CW_VIEWPORT_CHARSTATE	*pRecvMsg = (MSG_CW_VIEWPORT_CHARSTATE*)pMsg;

	// 老窜 秦欧 规瘤侩栏肺 泅犁 User State 犬牢
	if( pUser->GetStatus() != eZONETYPE_VILLAGE )
	{
		MessageOut( eFULL_LOG, "VIEWPORT_CHARSTATE 悼扁拳 Error - Status[Guid:%u][CharGuid:%u][Status:%u][F:%u]", 
																						pUser->GetGUID(), 
																						pUser->GetCharGuid(), 
																						pUser->GetStatus(), 
																						pRecvMsg->dwFieldCode );
		return;
	}
	// 货肺 持绰 巴牢瘤 捞悼牢瘤 犬牢
	if( !pUser->GetFieldCode() )
	{
		// 货肺 持绰 巴
//		if(!ViewPortManager::Instance()->AddUser( pUser, pRecvMsg->dwFieldCode, pRecvMsg->dwSectorIndex ))
		Channel *pChannel = ChannelManager::Instance()->GetChannel( pUser->GetChannelID() );
		if( !pChannel )
		{
			MessageOut(eCRITICAL_LOG, "CHARSTATE AddUser Error - No Channel[Guid:%u][CharGuid:%u][C:%u]", 
																				pUser->GetGUID(), 
																				pUser->GetCharGuid(), 
																				pUser->GetChannelID() );
			return;
		}

		if( !pChannel->AddViewPortUser( pUser, pRecvMsg->dwFieldCode, pRecvMsg->dwSectorIndex ) )
		{
			MessageOut(eCRITICAL_LOG, "CHARSTATE AddUser Error - No Field[Guid:%u][CharGuid:%u][F:%u][S:%u]", 
																				pUser->GetGUID(), 
																				pUser->GetCharGuid(), 
																				pRecvMsg->dwFieldCode, 
																				pRecvMsg->dwSectorIndex );
			return;
		}
		MessageOut(eFULL_LOG, "CHARSTATE AddUser [Guid:%u][CharGuid:%u][F:%u][S:%u]", 
																			pUser->GetGUID(), 
																			pUser->GetCharGuid(), 
																			pRecvMsg->dwFieldCode, 
																			pRecvMsg->dwSectorIndex );
	}
	else
	{
		// 捞悼
//		if(!ViewPortManager::Instance()->MoveUser( pUser, pRecvMsg->dwFieldCode, pRecvMsg->dwSectorIndex ))
		Channel *pChannel = ChannelManager::Instance()->GetChannel( pUser->GetChannelID() );
		if( !pChannel )
		{
			MessageOut(eCRITICAL_LOG, "CHARSTATE AddUser Error - No Channel[Guid:%u][CharGuid:%u][C:%u]", 
																				pUser->GetGUID(), 
																				pUser->GetCharGuid(), 
																				pUser->GetChannelID() );
			return;
		}

		if( !pChannel->MoveViewPortUser( pUser, pRecvMsg->dwFieldCode, pRecvMsg->dwSectorIndex ) )
		{
			MessageOut(eCRITICAL_LOG, "CHARSTATE MoveUser Error - No Field[Guid:%u][CharGuid:%u][F:%u][S:%u]", 
																				pUser->GetGUID(), 
																				pUser->GetCharGuid(), 
																				pRecvMsg->dwFieldCode, 
																				pRecvMsg->dwSectorIndex );
			return;
		}
		MessageOut(eFULL_LOG, "CHARSTATE MoveUser [Guid:%u][CharGuid:%u][F:%u][S:%u]", pUser->GetGUID(), 
																			pUser->GetCharGuid(), 
																			pRecvMsg->dwFieldCode, 
																			pRecvMsg->dwSectorIndex );
	}
}

// Armorkit俊辑 秦欧 矫档 惯斑
VOID Handler_CW::OnCW_ARMORKIT_FINDHACK_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
	MSG_CW_ARMORKIT_FINDHACK_SYN	*pRecvMsg = (MSG_CW_ARMORKIT_FINDHACK_SYN*)pMsg;

	// 郴侩篮 隔扼档 弊成 汗荤
	MSG_MW_ARMORKIT_FINDHACK_SYN	sendMsg;

	memset( sendMsg.szIP, 0, sizeof(sendMsg.szIP) );
	memcpy( sendMsg.szIP, pUser->GetIP(), sizeof(sendMsg.szIP) );
	sendMsg.HackType	= pRecvMsg->HackType;
	sendMsg.Size		= pRecvMsg->Size;
	sendMsg.dwGuid		= pUser->GetGUID();
	memset( sendMsg.Buf, 0, sizeof(sendMsg.Buf) );
	memcpy( sendMsg.Buf, pRecvMsg->Buf, sizeof(sendMsg.Buf) );

	// 弊措肺 副饭捞
	ServerSession *pMasterServer = ServerSessionManager::Instance()->GetMasterServer();
	if( !pMasterServer )
	{
		MessageOut( eCRITICAL_LOG,  "ArmorKit FindHack Error - No Master(User %s)", pUser->GetCharName().c_str() );
		return;
	}
	pMasterServer->Send( (BYTE*)&sendMsg, sizeof(sendMsg) );

	MessageOut(eFULL_LOG,  "ArmorKit Find Hacking tool(User %u/%s)", pUser->GetGUID(), pUser->GetCharName().c_str() );
}

// 模备 格废 夸没
VOID Handler_CW::OnCW_FRIEND_NEWLIST_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{
	if( !pUser->CheckFriendList() )	// 捞固 模备 格废阑 罐篮 利捞 乐促搁 秦欧 矫档 肚绰 肋给等 菩哦
	{
		MessageOut( eCRITICAL_LOG, "Friend_NewList Error - Already Sent List... U Hancker?(%s)", pUser->GetCharName().c_str() );
		return;
	}

    // 模备 格废 夸没
	MSG_DW_FRIEND_GETLIST_SYN	sendMsg;

	sendMsg.m_CharGuid = pUser->GetCharGuid();

	ServerSession *pGameDBProxy = ServerSessionManager::Instance()->GetGameDBProxy();
	if( !pGameDBProxy )
	{
		MessageOut( eCRITICAL_LOG, "Friend_NewList Error - No GameDBProxy");
		return;
	}
	pGameDBProxy->Send( (BYTE*)&sendMsg, sendMsg.GetSize() );

	MessageOut(eFULL_LOG, "Friend_NewList[%s][CharGuid:%u]", pUser->GetCharName().c_str(), pUser->GetCharGuid() );
}

// 模备 夸没
VOID Handler_CW::OnCW_FRIEND_ADD_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{

	MSG_CW_FRIEND_ADD_SYN	*pRecvMsg = (MSG_CW_FRIEND_ADD_SYN*)pMsg;

	// 扁夯利栏肺 捞固 乐绰 模备牢瘤, 酒聪搁 唱 磊脚牢瘤 沥档绰 八荤秦 林绰 诫静!!!
	std::string strName = pUser->GetCharName();

	if( strName == pRecvMsg->ptszCharNameTo )
	{
		// 唱 磊脚捞搁 俊矾
		MSG_CW_FRIEND_ADD_NAK	sendMsg;

		sendMsg.m_byResult = MSG_CW_FRIEND_ADD_NAK::FRIEND_IS_ME;	// 郴啊 模备衬?!

		pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_ADD_NAK) );
		MessageOut( eFULL_LOG, "[%s] Friend ADD Error - 磊脚阑 模备 夸没", pRecvMsg->ptszCharNameTo );
		return;
	}

	// 捞固 乐绰 模备扼档 坷幅
	if( pUser->FindFriend( pRecvMsg->ptszCharNameTo ) )
	{
		MSG_CW_FRIEND_ADD_NAK	sendMsg;

		sendMsg.m_byResult = MSG_CW_FRIEND_ADD_NAK::ALREADY_FRIEND;	// 捞固 模备促!

		pUser->Send( (BYTE*)&sendMsg, sizeof(MSG_CW_FRIEND_ADD_NAK) );
		MessageOut( eFULL_LOG, "[%s] Friend ADD Error - Already Friends", pRecvMsg->ptszCharNameTo );
		return;
	}

	// 老窜 官~肺 DB肺 傈价~
	MSG_DW_FRIEND_ADD_SYN	sendMsg;

	sendMsg.m_CharGuidFrom = pUser->GetCharGuid();
	_tcsncpy( sendMsg.m_ptszCharNameTo, pRecvMsg->ptszCharNameTo, MAX_CHARNAME_LENGTH - 1 );
	sendMsg.m_ptszCharNameTo[MAX_CHARNAME_LENGTH-1] = '\0';

	ServerSession *pGameDBProxy = ServerSessionManager::Instance()->GetGameDBProxy();
	if( !pGameDBProxy )
	{
		MessageOut( eCRITICAL_LOG,  "Friend ADD Error - No GameDBProxy(User %s)", pUser->GetCharName().c_str() );
		return;
	}
	pGameDBProxy->Send( (BYTE*)&sendMsg, sizeof(MSG_DW_FRIEND_ADD_SYN) );

	MessageOut(eFULL_LOG,  "Friend ADD to GameDBProxy(%s->%s)", pUser->GetCharName().c_str(), sendMsg.m_ptszCharNameTo );
}

// 模备 昏力
VOID Handler_CW::OnCW_FRIEND_DEL_SYN( User *pUser, MSG_BASE *pMsg, WORD wSize )
{

	MSG_CW_FRIEND_DEL_SYN		*pRecvMsg = (MSG_CW_FRIEND_DEL_SYN*)pMsg;

	// 模备 嘎酒?
	STRUCT_FRIEND_INFO* pFriendInfo = pUser->FindFriend( pRecvMsg->ptszFriendName );
	if( !pFriendInfo )
	{
		MSG_CW_FRIEND_DEL_NAK	sendMsg;

		sendMsg.m_byResult = MSG_CW_FRIEND_DEL_NAK::NOT_FRIEND_USER;

		pUser->Send( (BYTE*)&sendMsg, sizeof(sendMsg) );
		MessageOut( eCRITICAL_LOG, "Friend Del Error - No Friend[%s][CharGuid:%u]->[%s]", pUser->GetCharName().c_str(), 
																				pUser->GetCharGuid(),
																				pRecvMsg->ptszFriendName );
		return;
	}

	MSG_DW_FRIEND_DEL_SYN	sendMsg;

	sendMsg.m_CharGuidFrom	= pUser->GetCharGuid();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -