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

📄 channel.cpp

📁 奇迹世界 部分源代码奇迹世界 部分源代码奇迹世界 部分源代码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
	pZone->AddUser( pUser->GetGUID(), pUser );
	MessageOut( eFULL_LOG, "UserEnterBattleZone(%s:%u)", pUser->GetCharName().c_str(), pUser->GetGUID() );
}
*/

VOID Channel::UserEnterLobby( User *pUser, DWORD dwNewZoneKey )
{
	if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
	{
		MessageOut( eCRITICAL_LOG, "User Leave 绝捞 LobbyEnter Error[%s][Guid:%u][CharGuid:%u][ZT:%u][ZK:%u]", pUser->GetCharName().c_str(), 
																							pUser->GetGUID(), 
																							pUser->GetCharGuid(), 
																							pUser->GetStatus(), 
																							dwNewZoneKey );
		UserLeavePrevZone( pUser );	// 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
	}

	pUser->SetStatus( eZONETYPE_LOBBY );

	// 秦寸 虐肺 硅撇粮阑 茫酒焊绊 绝栏搁 硅撇粮 眠啊 饶 蜡廉 眠啊
	Zone *pZone = FindLobby( dwNewZoneKey );
	if( !pZone )
	{
		pZone = AddLobby( dwNewZoneKey );
	}

	if( pZone->AddUser( pUser->GetGUID(), pUser ) )
	{
		IncLobbyUserNum();
	}
	MessageOut( eMIDDLE_LOG, "UserEnterLobby[Guid:%u][CharGuid:%u][ZK:%u]", pUser->GetGUID(), pUser->GetCharGuid(), dwNewZoneKey );
}

VOID Channel::UserEnterMissionZone( User *pUser, DWORD dwNewZoneKey )
{
	if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
	{
		MessageOut( eCRITICAL_LOG, "User Leave 绝捞 MissionEnter Error[%s][Guid:%u][CharGuid:%u]", pUser->GetCharName().c_str(), 
																							pUser->GetGUID(), 
																							pUser->GetCharGuid() );
		UserLeavePrevZone( pUser );	// 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
	}

	pUser->SetStatus( eZONETYPE_MISSION );

	// 秦寸 虐肺 硅撇粮阑 茫酒焊绊 绝栏搁 硅撇粮 眠啊 饶 蜡廉 眠啊
	Zone *pZone = FindMissionZone( dwNewZoneKey );
	if( !pZone )
	{
		pZone = AddMissionZone( dwNewZoneKey );
	}

	if( pZone->AddUser( pUser->GetGUID(), pUser ) )
	{
		IncMissionUserNum();
	}
	MessageOut( eMIDDLE_LOG, "UserEnterMissionZone[Guid:%u][CharGuid:%u][ZK:%u]", pUser->GetGUID(), pUser->GetCharGuid(), dwNewZoneKey );
}

VOID Channel::UserEnterHuntingZone( User *pUser, DWORD dwNewZoneKey )
{
	if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
	{
		MessageOut( eCRITICAL_LOG, "User Leave 绝捞 HuntingEnter Error[%s][Guid:%u][CharGuid:%u]", pUser->GetCharName().c_str(), 
																							pUser->GetGUID(), 
																							pUser->GetCharGuid() );
		UserLeavePrevZone( pUser );	// 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
	}

	pUser->SetStatus( eZONETYPE_HUNTING );

	// 秦寸 虐肺 硅撇粮阑 茫酒焊绊 绝栏搁 硅撇粮 眠啊 饶 蜡廉 眠啊
	Zone *pZone = FindHuntingZone( dwNewZoneKey );
	if( !pZone )
	{
		pZone = AddHuntingZone( dwNewZoneKey );
	}

	if( pZone->AddUser( pUser->GetGUID(), pUser ) )
	{
		IncHuntingUserNum();
	}
	MessageOut( eMIDDLE_LOG, "UserEnterHuntingZone[Guid:%u][CharGuid:%u][ZK:%u]", pUser->GetGUID(), pUser->GetCharGuid(), dwNewZoneKey );
}

VOID Channel::UserEnterQuestZone( User *pUser, DWORD dwNewZoneKey )
{
	if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
	{
		MessageOut( eCRITICAL_LOG, "User Leave 绝捞 QuestEnter Error[%s][Guid:%u][CharGuid:%u]", pUser->GetCharName().c_str(), 
																							pUser->GetGUID(), 
																							pUser->GetCharGuid() );
		UserLeavePrevZone( pUser );	// 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
	}

	pUser->SetStatus( eZONETYPE_QUEST );

	// 秦寸 虐肺 硅撇粮阑 茫酒焊绊 绝栏搁 硅撇粮 眠啊 饶 蜡廉 眠啊
	Zone *pZone = FindQuestZone( dwNewZoneKey );
	if( !pZone )
	{
		pZone = AddQuestZone( dwNewZoneKey );
	}

	if( pZone->AddUser( pUser->GetGUID(), pUser ) )
	{
		IncQuestUserNum();
	}
	MessageOut( eMIDDLE_LOG, "UserEnterQuestZone[Guid:%u][CharGuid:%u]", pUser->GetGUID(), pUser->GetCharGuid() );
}

VOID Channel::UserEnterPVPZone( User *pUser, DWORD dwNewZoneKey )
{
	if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
	{
		MessageOut( eCRITICAL_LOG, "User Leave 绝捞 PVP Enter Error[%s][Guid:%u][CharGuid:%u]", pUser->GetCharName().c_str(), 
																							pUser->GetGUID(), 
																							pUser->GetCharGuid() );
		UserLeavePrevZone( pUser );	// 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
	}

	pUser->SetStatus( eZONETYPE_PVP );

	// 秦寸 虐肺 硅撇粮阑 茫酒焊绊 绝栏搁 硅撇粮 眠啊 饶 蜡廉 眠啊
	Zone *pZone = FindPVPZone( dwNewZoneKey );
	if( !pZone )
	{
		pZone = AddPVPZone( dwNewZoneKey );
	}

	if( pZone->AddUser( pUser->GetGUID(), pUser ) )
	{
		IncPVPUserNum();
	}
	MessageOut( eMIDDLE_LOG, "UserEnterPVPZone[Guid:%u][CharGuid:%u]", pUser->GetGUID(), pUser->GetCharGuid() );
}

VOID Channel::UserEnterEventZone( User *pUser, DWORD dwNewZoneKey )
{
	if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
	{
		MessageOut( eCRITICAL_LOG, "User Leave 绝捞 Enter Error[%s][Guid:%u][CharGuid:%u]", pUser->GetCharName().c_str(), 
																							pUser->GetGUID(), 
																							pUser->GetCharGuid() );
		UserLeavePrevZone( pUser );	// 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
	}

	pUser->SetStatus( eZONETYPE_EVENT );

	// 秦寸 虐肺 硅撇粮阑 茫酒焊绊 绝栏搁 硅撇粮 眠啊 饶 蜡廉 眠啊
	Zone *pZone = FindEventZone( dwNewZoneKey );
	if( !pZone )
	{
		pZone = AddEventZone( dwNewZoneKey );
	}

	if( pZone->AddUser( pUser->GetGUID(), pUser ) )
	{
		IncEventUserNum();
	}
	MessageOut( eMIDDLE_LOG, "UserEnterEventZone[Guid:%u][CharGuid:%u]", pUser->GetGUID(), pUser->GetCharGuid() );
}

VOID Channel::UserEnterGuildZone( User *pUser, DWORD dwNewZoneKey )
{
	if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
	{
		MessageOut( eCRITICAL_LOG, "User Leave 绝捞 Enter Error[%s][Guid:%u][CharGuid:%u]", pUser->GetCharName().c_str(), 
																							pUser->GetGUID(), 
																							pUser->GetCharGuid() );
		UserLeavePrevZone( pUser );	// 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
	}

	pUser->SetStatus( eZONETYPE_GUILD );

	// 秦寸 虐肺 硅撇粮阑 茫酒焊绊 绝栏搁 硅撇粮 眠啊 饶 蜡廉 眠啊
	Zone *pZone = FindGuildZone( dwNewZoneKey );
	if( !pZone )
	{
		pZone = AddGuildZone( dwNewZoneKey );
	}

	if( pZone->AddUser( pUser->GetGUID(), pUser ) )
	{
		IncGuildUserNum();
	}
	MessageOut( eMIDDLE_LOG, "UserEnterGuildZone[Guid:%u][CharGuid:%u]", pUser->GetGUID(), pUser->GetCharGuid() );
}

VOID Channel::UserEnterSiegeZone( User *pUser, DWORD dwNewZoneKey )
{
	if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
	{
		MessageOut( eCRITICAL_LOG, "User Leave 绝捞 Enter Error[%s][Guid:%u][CharGuid:%u]", pUser->GetCharName().c_str(), 
																							pUser->GetGUID(), 
																							pUser->GetCharGuid() );
		UserLeavePrevZone( pUser );	// 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
	}

	pUser->SetStatus( eZONETYPE_SIEGE );

	// 秦寸 虐肺 硅撇粮阑 茫酒焊绊 绝栏搁 硅撇粮 眠啊 饶 蜡廉 眠啊
	Zone *pZone = FindSiegeZone( dwNewZoneKey );
	if( !pZone )
	{
		pZone = AddSiegeZone( dwNewZoneKey );
	}

	if( pZone->AddUser( pUser->GetGUID(), pUser ) )
	{
		IncSiegeUserNum();
	}
	MessageOut( eMIDDLE_LOG, "UserEnterSiegeZone[Guid:%u][CharGuid:%u]", pUser->GetGUID(), pUser->GetCharGuid() );
}

VOID Channel::UserEnterFriendChat( User *pUser, DWORD dwNewZoneKey )
{
	// 秦寸 虐肺 模备 盲泼规 茫酒焊绊 绝栏搁 眠啊 饶 蜡廉 眠啊
	Zone *pZone = FindFriendChat( dwNewZoneKey );
	if( !pZone )
	{
		KEYTYPE zoneKey = AllocKey();	// 盲泼规 虐甫 捞锭 眠啊
		pZone = AddFriendChat( zoneKey );
	}

	pZone->AddUser( pUser->GetGUID(), pUser );
	MessageOut( eMIDDLE_LOG, "UserEnterFriendChat[Guid:%u][CharGuid:%u]", pUser->GetGUID(), pUser->GetCharGuid() );
}

VOID Channel::SendToAll( BYTE *pMsg, WORD wSize )
{
	USER_MAP_ITER	it;
	User			*pUser;
	for( it = m_mapUsers.begin(); it !=m_mapUsers.end(); ++it )
	{
		pUser = it->second;
		pUser->Send( pMsg, wSize );
	}
}

BOOL Channel::SendToOneVillage( DWORD dwFieldCode, BYTE* pMsg, WORD wSize )
{
	return m_pViewPortManager->SendToAll( dwFieldCode, pMsg, wSize );
}

VOID Channel::SendToVillages( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapVillageZones.begin(); it != m_mapVillageZones.end(); ++it )
	{
		pZone = it->second;
		if( pZone )
			pZone->SendToAll( pMsg, wSize );
	}
}
/*
VOID Channel::SendToBattleZones( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapBattleZones.begin(); it != m_mapBattleZones.end(); ++it )
	{
		pZone = it->second;
		pZone->SendToAll( pMsg, wSize );
	}
}
*/
VOID Channel::SendToLobby( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapLobby.begin(); it != m_mapLobby.end(); ++it )
	{
		pZone = it->second;
		if( pZone )
			pZone->SendToAll( pMsg, wSize );
	}
	MessageOut(eFULL_LOG, "SendToLobby");
}

VOID Channel::SendToMissionZones( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapMissionZones.begin(); it != m_mapMissionZones.end(); ++it )
	{
		pZone = it->second;
		if( pZone )
			pZone->SendToAll( pMsg, wSize );
	}
	MessageOut(eFULL_LOG, "SendToMissionZones");
}

VOID Channel::SendToHuntingZones( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapHuntingZones.begin(); it != m_mapHuntingZones.end(); ++it )
	{
		pZone = it->second;
		if( pZone )
			pZone->SendToAll( pMsg, wSize );
	}
	MessageOut(eFULL_LOG, "SendToHuntingZones");
}

VOID Channel::SendToQuestZones( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapQuestZones.begin(); it != m_mapQuestZones.end(); ++it )
	{
		pZone = it->second;
		if( pZone )
			pZone->SendToAll( pMsg, wSize );
	}
	MessageOut(eFULL_LOG, "SendToQuestZones");
}

VOID Channel::SendToPVPZones( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapPVPZones.begin(); it != m_mapPVPZones.end(); ++it )
	{
		pZone = it->second;
		if( pZone )
			pZone->SendToAll( pMsg, wSize );
	}
	MessageOut(eFULL_LOG, "SendToPVPZones");
}

VOID Channel::SendToEventZones( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapEventZones.begin(); it != m_mapEventZones.end(); ++it )
	{
		pZone = it->second;
		if( pZone )
			pZone->SendToAll( pMsg, wSize );
	}
	MessageOut(eFULL_LOG, "SendToEventZones");
}

VOID Channel::SendToGuildZones( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapGuildZones.begin(); it != m_mapGuildZones.end(); ++it )
	{
		pZone = it->second;
		if( pZone )
			pZone->SendToAll( pMsg, wSize );
	}
	MessageOut(eFULL_LOG, "SendToGuildZones");
}

VOID Channel::SendToSiegeZones( BYTE *pMsg, WORD wSize )
{
	ZONE_MAP_ITER	it;
	Zone			*pZone;
	for( it = m_mapSiegeZones.begin(); it != m_mapSiegeZones.end(); ++it )
	{
		pZone = it->second;
		if( pZone )
			pZone->SendToAll( pMsg, wSize );
	}
	MessageOut(eFULL_LOG, "SendToSiegeZones");
}

BOOL Channel::SendToViewPort( User *pUser, BYTE *pMsg, WORD wSize )
{
	return m_pViewPortManager->SendViewPort( pUser, pMsg, wSize );
}

VOID Channel::DisplayInfo()
{
	DWORD dwNumberOfVillageUsers	= 0;
//	DWORD dwNumberOfBattleZoneUsers	= 0;
	DWORD dwNumberOfLobbyUsers	= 0;
	DWORD dwNumberOfMissionZoneUsers	= 0;
	DWORD dwNumberOfHuntingZoneUsers	= 0;
	DWORD dwNumberOfQuestZoneUsers	= 0;
	DWORD dwNumberOfPVPZoneUsers	= 0;
	DWORD dwNumberOfEventZoneUsers	= 0;
	DWORD dwNumberOfGuildZoneUsers	= 0;
	DWORD dwNumberOfSiegeZoneUsers	= 0;

	ZONE_MAP_ITER	it;
	Zone			*pZone;

	for( it = m_mapVillageZones.begin(); it != m_mapVillageZones.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfVillageUsers += pZone->GetNumberOfUsers();
	}
/*
	for( it = m_mapBattleZones.begin(); it != m_mapBattleZones.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfBattleZoneUsers += pZone->GetNumberOfUsers();
	}
*/
	for( it = m_mapLobby.begin(); it != m_mapLobby.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfLobbyUsers += pZone->GetNumberOfUsers();
	}

	for( it = m_mapMissionZones.begin(); it != m_mapMissionZones.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfMissionZoneUsers += pZone->GetNumberOfUsers();
	}

	for( it = m_mapHuntingZones.begin(); it != m_mapHuntingZones.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfHuntingZoneUsers += pZone->GetNumberOfUsers();
	}

	for( it = m_mapQuestZones.begin(); it != m_mapQuestZones.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfQuestZoneUsers += pZone->GetNumberOfUsers();
	}

	for( it = m_mapPVPZones.begin(); it != m_mapPVPZones.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfPVPZoneUsers += pZone->GetNumberOfUsers();
	}

	for( it = m_mapEventZones.begin(); it != m_mapEventZones.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfEventZoneUsers += pZone->GetNumberOfUsers();
	}

	for( it = m_mapGuildZones.begin(); it != m_mapGuildZones.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfGuildZoneUsers += pZone->GetNumberOfUsers();
	}

	for( it = m_mapSiegeZones.begin(); it != m_mapSiegeZones.end(); ++it )
	{
		pZone = it->second;
		dwNumberOfSiegeZoneUsers += pZone->GetNumberOfUsers();
	}

	MessageOut(eCRITICAL_LOG,   "⒐ Channel No.%d: ", GetChannelID() );
	MessageOut(eCRITICAL_LOG,   "Total(%d) CharScene(%d) Village(%d) Battle(%d)",
			m_mapUsers.size(), m_pCharSceneZone->GetNumberOfUsers(), dwNumberOfVillageUsers, dwNumberOfMissionZoneUsers +
			dwNumberOfMissionZoneUsers + dwNumberOfHuntingZoneUsers + dwNumberOfQuestZoneUsers + dwNumberOfPVPZoneUsers + 
			dwNumberOfEventZoneUsers + dwNumberOfGuildZoneUsers + dwNumberOfSiegeZoneUsers );
}

⌨️ 快捷键说明

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