102 lines
3.1 KiB
C++
102 lines
3.1 KiB
C++
#include <stdafx.h>
|
|
|
|
//_NA_007065_20140217_BATTLEGROUND_REFACTORYING
|
|
#include "World/ChaosZoneSystem/ChaosZoneBattleTeam.h"
|
|
#include "PacketStruct_AG_ChaosZoneSystem.h"
|
|
|
|
void ChaosZoneBattleTeam::SendPacketToAll( MSG_BASE_FORWARD* msg, WORD msg_size )
|
|
{
|
|
PLAYER_HASH::const_iterator const_itr = player_hash_map_.begin();
|
|
for (; const_itr != player_hash_map_.end(); ++const_itr)
|
|
{
|
|
Player* const player = const_itr->second;
|
|
if (player == NULL || player->IsDeleted())
|
|
continue;
|
|
player->SendPacket(msg, msg_size);
|
|
}
|
|
}
|
|
|
|
void ChaosZoneBattleTeam::RemoveMember( const DWORD char_guid )
|
|
{
|
|
Player* const member = FindMember(char_guid);
|
|
if (member == NULL || member->IsDeleted())
|
|
{
|
|
return;
|
|
}
|
|
|
|
player_hash_map_.erase(char_guid);
|
|
}
|
|
|
|
Player* ChaosZoneBattleTeam::FindMember( const DWORD char_guid )
|
|
{
|
|
PLAYER_HASH_ITR itr = player_hash_map_.find(char_guid);
|
|
return (itr != player_hash_map_.end() ? itr->second : NULL);
|
|
}
|
|
|
|
#ifdef _NA_008679_20160202_REWORK_BATTLEGROUND
|
|
void ChaosZoneBattleTeam::SetReadyPlayer( Player* const player )
|
|
{
|
|
const DWORD user_key = player->GetUserKey();
|
|
BYTE name_index = player->GetBattleGroundPlayerInfo().GetNameIndex();
|
|
ready_user_keys_.insert(std::make_pair(user_key, name_index));
|
|
}
|
|
#else
|
|
void ChaosZoneBattleTeam::SetReadyPlayer( Player* const player )
|
|
{
|
|
const DWORD user_key = player->GetUserKey();
|
|
ready_user_keys_.insert(user_key);
|
|
}
|
|
#endif //_NA_008679_20160202_REWORK_BATTLEGROUND
|
|
|
|
#ifdef _NA_008679_20160202_REWORK_BATTLEGROUND
|
|
void ChaosZoneBattleTeam::SetReadyPlayer( const BYTE player_count, DWORD* user_key_list )
|
|
{
|
|
ready_user_keys_.clear();
|
|
ready_player_count_ = player_count;
|
|
for (int i = 0; i < (int)ready_player_count_; ++i) {
|
|
ready_user_keys_.insert(std::make_pair(user_key_list[i], 0));
|
|
}
|
|
}
|
|
|
|
VOID ChaosZoneBattleTeam::SetReadyPlayer( MSG_AG_BATTLE_GROUND_ENTER_TEAM_CMD* cmd_msg )
|
|
{
|
|
ready_user_keys_.clear();
|
|
ready_player_count_ = cmd_msg->user_count;
|
|
for (int i = 0; i < (int)ready_player_count_; ++i) {
|
|
ready_user_keys_.insert(std::make_pair(cmd_msg->user_key_list[i],
|
|
cmd_msg->user_team_index_array[i]));
|
|
}
|
|
}
|
|
#else
|
|
void ChaosZoneBattleTeam::SetReadyPlayer( const BYTE player_count, DWORD* user_key_list )
|
|
{
|
|
ready_user_keys_.clear();
|
|
ready_player_count_ = player_count;
|
|
for (int i = 0; i < (int)ready_player_count_; ++i) {
|
|
ready_user_keys_.insert(user_key_list[i]);
|
|
}
|
|
}
|
|
#endif //_NA_008679_20160202_REWORK_BATTLEGROUND
|
|
|
|
bool ChaosZoneBattleTeam::IsReadyPlayer( const DWORD user_key )
|
|
{
|
|
#ifdef _NA_008679_20160202_REWORK_BATTLEGROUND
|
|
STLX_MAP<DWORD, BYTE>::const_iterator const_itr = ready_user_keys_.find(user_key);
|
|
#else
|
|
STLX_SET<DWORD>::const_iterator const_itr = ready_user_keys_.find(user_key);
|
|
#endif //_NA_008679_20160202_REWORK_BATTLEGROUND
|
|
if (const_itr != ready_user_keys_.end())
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool ChaosZoneBattleTeam::IsAllPlayerEntered()
|
|
{
|
|
if (ready_user_keys_.size() == 0)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
} |