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

📄 handler_aw.cpp

📁 奇迹世界 部分源代码奇迹世界 部分源代码奇迹世界 部分源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
		Channel *pChannel = ChannelManager::Instance()->GetChannel( pUser->GetChannelID() );
		if( !pChannel )
		{
			MessageOut( eCRITICAL_LOG, "USER_LEAVE_ZONE Error - [Guid:%u][ZT:%u][ZK:%u] Channel Not Exist!", pRecvMsg->m_dwKey, pRecvMsg->byZoneType, pRecvMsg->dwZoneKey );
			// 呈 酪绢滚啡促! 促矫 嘿绢扼!
//			pUser->Logout();
			return;
		}

		switch( pUser->GetStatus() )
		{
			case eZONETYPE_CHARSELECT:
				{
					MessageOut(eFULL_LOG, "User[Guid:%u] Leave CharSelect[Channel:%u]", pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			case eZONETYPE_VILLAGE:
				{
//					pChannel->DecVillageUserNum();
					MessageOut(eFULL_LOG, "User[%s][Guid:%u] Leave Village[Channel:%u]", pUser->GetCharName().c_str(), pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			case eZONETYPE_LOBBY:
				{
//					pChannel->DecLobbyUserNum();
					MessageOut(eFULL_LOG, "User[%s][Guid:%u] Leave Lobby[Channel %u]", pUser->GetCharName().c_str(), pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			case eZONETYPE_MISSION:
				{
//					pChannel->DecMissionUserNum();
					MessageOut(eFULL_LOG, "User[%s][Guid:%u] Leave MissionZone[Channel %u]", pUser->GetCharName().c_str(), pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			case eZONETYPE_HUNTING:
				{
//					pChannel->DecHuntingUserNum();
					MessageOut(eFULL_LOG, "User[%s][Guid:%u] Leave HuntingZone[Channel %u]", pUser->GetCharName().c_str(), pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			case eZONETYPE_QUEST:
				{
//					pChannel->DecQuestUserNum();
					MessageOut(eFULL_LOG, "User[%s][Guid:%u] Leave QuestZone[Channel %u]", pUser->GetCharName().c_str(), pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			case eZONETYPE_PVP:
				{
//					pChannel->DecQuestUserNum();
					MessageOut(eFULL_LOG, "User[%s][Guid:%u] Leave PVPZone[Channel %u]", pUser->GetCharName().c_str(), pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			case eZONETYPE_EVENT:
				{
//					pChannel->DecEventUserNum();
					MessageOut(eFULL_LOG, "User[%s][Guid:%u] Leave EventZone[Channel %u]", pUser->GetCharName().c_str(), pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			case eZONETYPE_GUILD:
				{
//					pChannel->DecGuildUserNum();
					MessageOut(eFULL_LOG, "User[%s][Guid:%u] Leave GuildZone[Channel %u]", pUser->GetCharName().c_str(), pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			case eZONETYPE_SIEGE:
				{
//					pChannel->DecSiegeUserNum();
					MessageOut(eFULL_LOG, "User[%s][Guid:%u] Leave SiegeZone[Channel %u]", pUser->GetCharName().c_str(), pUser->GetGUID(), pUser->GetChannelID() );
				}
				break;
			default:	// 老窜 某腐磐 急琶/付阑 酒聪搁 傈何 硅撇粮栏肺 秒鞭茄促
#ifdef _DEBUG
				assert( !"UserLeavePrevZone - invalid user status" );
#else
				MessageOut( eCRITICAL_LOG, "USER_LEAVE_ZONE Error - No User Status[Guid:%u][Stat:%u]", pRecvMsg->m_dwKey, pRecvMsg->byZoneType );
				// 呈 酪绢滚啡促! 促矫 嘿绢扼!!!
//				pUser->Logout();
				return;
#endif
		}

		pChannel->UserLeavePrevZone( pUser );
/*
		switch( pRecvMsg->byStatus )
		{
		case eZONETYPE_CHARSELECT:
			pChannel->UserLeavePrevZone( pUser );
			break;
		case eZONETYPE_VILLAGE:
			pChannel->UserEnterVillage( pUser, pRecvMsg->dwZoneKey );
			break;
//		case eZONETYPE_LOBBY:
		default:	// 老窜 某腐磐 急琶/付阑 酒聪搁 傈何 硅撇粮栏肺 秒鞭茄促
			pChannel->UserEnterBattleZone( pUser, pRecvMsg->dwZoneKey );
			break;
//		default:
//			assert( !"invalid user status" );
		}
*/
	}
	else
	{
		pUser = WaitingUserList::Instance()->FindUserWithGuid( pRecvMsg->m_dwKey );
		if( pUser )
		{
			Channel *pChannel = ChannelManager::Instance()->GetChannel( pUser->GetChannelID() );
			if( !pChannel )
			{
				MessageOut( eCRITICAL_LOG, "[Guid:%u] Agent Leave[Channel:%u] Error - No Channel", pUser->GetGUID(), pUser->GetChannelID() );
				return;
			}

			MessageOut( eFULL_LOG, "[Guid:%u] Agent Leave Zone[Channel:%u]", pUser->GetGUID(), pUser->GetChannelID() );
			pChannel->UserLeavePrevZone( pUser );
//			pUser->SetStatus( (eZONETYPE)pRecvMsg->byStatus );
//			pUser->SetZoneKey( pRecvMsg->dwZoneKey );
		}
	}

}

VOID Handler_AW::OnAW_USER_LOGOUT( AgentServerSession *pAgentServer, MSG_BASE *pMsg, WORD wSize )
{
	MSG_AW_USER_LOGOUT *pRecvMsg = (MSG_AW_USER_LOGOUT*)pMsg;

	User *pUser = UserManager::Instance()->FindUser( pRecvMsg->m_dwKey );

	if( !pUser ) return;

	// 蜡廉 立加 谗澜
	MessageOut(eCRITICAL_LOG, "Agent俊辑 蜡廉 立加 辆丰 [%s][Guid:%u]", pUser->GetCharName().c_str(), pUser->GetGUID() );
	pUser->Logout();
}

VOID Handler_AW::OnAW_USER_RESTORE_CMD( AgentServerSession *pAgentServer, MSG_BASE *pMsg, WORD wSize )
{
	MSG_AW_USER_RESTORE_CMD* pRecvMsg = (MSG_AW_USER_RESTORE_CMD*)pMsg;

	User* pUser;
	DWORD dwChannelID = pAgentServer->GetChannelID();
	Channel* pChannel = ChannelManager::Instance()->GetChannel( dwChannelID );

	if( !pChannel )
	{
		MessageOut( eCRITICAL_LOG, "[C:%u] Agent Restore User[Guid:%u] Error - Invalid Channel!!", dwChannelID, pRecvMsg->dwUserGUID );
		return;
	}

	// 秦寸 蜡廉啊 捞固 乐绰 版快 立加阑 谗绰促.
	if( pUser = UserManager::Instance()->FindUser( pRecvMsg->dwUserGUID ) )
	{
		MessageOut(eCRITICAL_LOG, "吝汗 guid 惯积! 乐带 蜡廉 立加 辆丰[%s][Guid:%u][ZT:%u]", pUser->GetCharName().c_str(), 
																							pUser->GetGUID(), 
																							pRecvMsg->byZoneType );
		pUser->Logout();
		return;
	}

	// 咀萍宏 蜡廉 且寸
	pUser = UserFactory::Instance()->Alloc( ACTIVE_USER );

	// 蜡廉 沥焊 悸泼
	pUser->SetGUID( pRecvMsg->dwUserGUID );
	pUser->SetChannelID( dwChannelID );

	// 牢刘等 IP 悸泼
	pUser->SetAuthIP( pRecvMsg->tszClientIP );
	pUser->SetAuthID( pRecvMsg->dwAuthUserID );

	if( pRecvMsg->byZoneType != eZONETYPE_CHARSELECT )
	{
		// 某腐磐 沥焊 技泼
		pUser->SetCharGuid( pRecvMsg->CharGuid );
		pUser->SetCharName( pRecvMsg->tszCharName );
		pUser->SetStatus( (eZONETYPE)pRecvMsg->byZoneType );
		pUser->SetZoneKey( pRecvMsg->dwZoneKey );

		MessageOut( eFULL_LOG, "[C:%u]AgentServer Restore User[Guid:%u][CharGuid:%u][ZT:%u][ZK:%u]", dwChannelID, 
																									pRecvMsg->dwUserGUID, 
																									pRecvMsg->CharGuid, 
																									pRecvMsg->byZoneType, 
																									pRecvMsg->dwZoneKey );
	}
	else
	{
		MessageOut( eFULL_LOG, "[C:%u]AgentServer Restore User[Guid:%u]", dwChannelID, pRecvMsg->dwUserGUID );
	}

	// 措扁 府胶飘俊 眠啊
	WaitingUserList::Instance()->AddUser( pRecvMsg->dwAuthUserID, pUser );

	// AgentServer俊 览翠
	MSG_AW_PREPARE_NEW_USER_ACK ackMsg;
	ackMsg.m_byCategory		= AW_CONNECTION;
	ackMsg.m_byProtocol		= AW_PREPARE_NEW_USER_ACK;
	ackMsg.m_dwKey			= pRecvMsg->dwUserGUID;
	pAgentServer->Send( (BYTE*)&ackMsg, sizeof(ackMsg) );

}

/*
VOID Handler_AW::OnAW_USERCOUNT_SYN( AgentServerSession *pAgentServer, MSG_BASE *pMsg, WORD wSize )
{
	MSG_AW_USERCOUNT_SYN *pRecvMsg = (MSG_AW_USERCOUNT_SYN*)pMsg;

	// 付胶磐客 RTT埃俊 荤侩窍绰 菩哦 备炼眉 鞍捞 荤侩窍扁肺 窍磊.
	MSG_MW_USERCOUNT_SYN msg;

	msg.byChannelID				= (BYTE)pAgentServer->GetChannelID();
	msg.dwVillageUserCount		= pRecvMsg->dwVillageUserCount;
	msg.dwHuntingLobbyZoneCount	= pRecvMsg->dwHuntingLobbyZoneCount;
	msg.dwHuntingLobbyUserCount	= pRecvMsg->dwHuntingLobbyUserCount;
	msg.dwMissionLobbyZoneCount	= pRecvMsg->dwMissionLobbyZoneCount;
	msg.dwMissionLobbyUserCount	= pRecvMsg->dwMissionLobbyUserCount;
	msg.dwPVPLobbyZoneCount		= pRecvMsg->dwPVPLobbyZoneCount;
	msg.dwPVPLobbyUserCount		= pRecvMsg->dwPVPLobbyUserCount;
	msg.dwHuntingZoneCount		= pRecvMsg->dwHuntingZoneCount;
	msg.dwHuntingUserCount		= pRecvMsg->dwHuntingUserCount;
	msg.dwMissionZoneCount		= pRecvMsg->dwMissionZoneCount;
	msg.dwMissionUserCount		= pRecvMsg->dwMissionUserCount;
	msg.dwPVPZoneCount			= pRecvMsg->dwPVPZoneCount;
	msg.dwPVPUserCount			= pRecvMsg->dwPVPUserCount;

	if( !WorldServerInfoParser::Instance()->IsServerInfoFromFile() )
	{
		ServerSession *pMasterServer = ServerSessionManager::Instance()->GetMasterServer();
		if( !pMasterServer )
		{
			MessageOut(eCRITICAL_LOG,  "RTT UserCount Error - No Master: channelID(%d)  village(%d)  battle(H:%u,M:%u,P:%u)", 
			msg.byChannelID, msg.dwVillageUserCount, msg.dwHuntingUserCount, msg.dwMissionUserCount, msg.dwPVPUserCount );
			return;
		}
		pMasterServer->Send( (BYTE*)&msg, sizeof(msg) );

		MessageOut(eFULL_LOG,  "RTT UserCount to Master channelID(%d)  village(%d)  battle(H:%u,M:%u,P:%u)", 
			msg.byChannelID, msg.dwVillageUserCount, msg.dwHuntingUserCount, msg.dwMissionUserCount, msg.dwPVPUserCount );
	}
	else
	{
		MessageOut(eFULL_LOG,  "RTT UserCount Catch - channelID(%d)  village(%d)  battle(H:%u,M:%u,P:%u)", 
			msg.byChannelID, msg.dwVillageUserCount, msg.dwHuntingUserCount, msg.dwMissionUserCount, msg.dwPVPUserCount );
	}
}

VOID Handler_AW::OnAW_USERMONEY_SYN( AgentServerSession *pAgentServer, MSG_BASE *pMsg, WORD wSize )
{
	MSG_AW_USERMONEY_SYN *pRecvMsg = (MSG_AW_USERMONEY_SYN*)pMsg;

	// 付胶磐客 RTT埃俊 荤侩窍绰 菩哦 备炼眉 鞍捞 荤侩窍扁肺 窍磊.
	MSG_MW_USERMONEY_SYN msg;

	msg.dwTotalUserMoney	= pRecvMsg->dwTotalUserMoney;
	msg.dwTotalGetMoney		= pRecvMsg->dwTotalGetMoney;
	msg.dwTotalLoseMoney	= pRecvMsg->dwTotalLoseMoney;

	ServerSession *pMasterServer = ServerSessionManager::Instance()->GetMasterServer();
	if( !pMasterServer )
	{
		MessageOut(eCRITICAL_LOG,  "RTT UserMoney Error - No Master(TotalUser:%u, TotalGet:%u, TotalLose:%u)", 
														msg.dwTotalUserMoney, msg.dwTotalGetMoney, msg.dwTotalLoseMoney );
		return;
	}
	pMasterServer->Send( (BYTE*)&msg, sizeof(msg) );

	MessageOut(eFULL_LOG,  "RTT UserMoney to Master(TotalUser:%u, TotalGet:%u, TotalLose:%u)", 
														msg.dwTotalUserMoney, msg.dwTotalGetMoney, msg.dwTotalLoseMoney );
}
*/

⌨️ 快捷键说明

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