mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 07:37:02 +00:00
[10801] More ObjectGuid uses in battleground code.
This commit is contained in:
parent
6d13cd6553
commit
3de8212e03
12 changed files with 82 additions and 80 deletions
|
|
@ -194,19 +194,19 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
|
|||
Player *member = itr->getSource();
|
||||
if(!member)
|
||||
continue; // this should never happen
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()];
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetObjectGuid()];
|
||||
pl_info.LastOnlineTime = lastOnlineTime;
|
||||
pl_info.GroupInfo = ginfo;
|
||||
// add the pinfo to ginfo's list
|
||||
ginfo->Players[member->GetGUID()] = &pl_info;
|
||||
ginfo->Players[member->GetObjectGuid()] = &pl_info;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetGUID()];
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetObjectGuid()];
|
||||
pl_info.LastOnlineTime = lastOnlineTime;
|
||||
pl_info.GroupInfo = ginfo;
|
||||
ginfo->Players[leader->GetGUID()] = &pl_info;
|
||||
ginfo->Players[leader->GetObjectGuid()] = &pl_info;
|
||||
}
|
||||
|
||||
//add GroupInfo to m_QueuedGroups
|
||||
|
|
@ -301,7 +301,7 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
|
|||
}
|
||||
|
||||
//remove player from queue and from group info, if group info is empty then remove it too
|
||||
void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount)
|
||||
void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
||||
{
|
||||
//Player *plr = sObjectMgr.GetPlayer(guid);
|
||||
//ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
|
||||
|
|
@ -313,7 +313,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
|||
itr = m_QueuedPlayers.find(guid);
|
||||
if (itr == m_QueuedPlayers.end())
|
||||
{
|
||||
sLog.outError("BattleGroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid));
|
||||
sLog.outError("BattleGroundQueue: couldn't find for remove: %s", guid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -346,10 +346,10 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
|||
//player can't be in queue without group, but just in case
|
||||
if (bracket_id == -1)
|
||||
{
|
||||
sLog.outError("BattleGroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
|
||||
sLog.outError("BattleGroundQueue: ERROR Cannot find groupinfo for %s", guid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG("BattleGroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id);
|
||||
DEBUG_LOG("BattleGroundQueue: Removing %s, from bracket_id %u", guid.GetString().c_str(), (uint32)bracket_id);
|
||||
|
||||
// ALL variables are correctly set
|
||||
// We can ignore leveling up in queue - it should not cause crash
|
||||
|
|
@ -357,7 +357,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
|||
// if only one player there, remove group
|
||||
|
||||
// remove player queue info from group queue info
|
||||
std::map<uint64, PlayerQueueInfo*>::iterator pitr = group->Players.find(guid);
|
||||
GroupQueueInfoPlayers::iterator pitr = group->Players.find(guid);
|
||||
if (pitr != group->Players.end())
|
||||
group->Players.erase(pitr);
|
||||
|
||||
|
|
@ -382,7 +382,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
|||
ArenaTeam * at = sObjectMgr.GetArenaTeamById(group->ArenaTeamId);
|
||||
if (at)
|
||||
{
|
||||
DEBUG_LOG("UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
|
||||
DEBUG_LOG("UPDATING memberLost's personal arena rating for %s by opponents rating: %u", guid.GetString().c_str(), group->OpponentsTeamRating);
|
||||
Player *plr = sObjectMgr.GetPlayer(guid);
|
||||
if (plr)
|
||||
at->MemberLost(plr, group->OpponentsTeamRating);
|
||||
|
|
@ -422,7 +422,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
|||
}
|
||||
|
||||
//returns true when player pl_guid is in queue and is invited to bgInstanceGuid
|
||||
bool BattleGroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
|
||||
bool BattleGroundQueue::IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
|
||||
{
|
||||
//ACE_Guard<ACE_Recursive_Thread_Mutex> g(m_Lock);
|
||||
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid);
|
||||
|
|
@ -431,7 +431,7 @@ bool BattleGroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgIn
|
|||
&& qItr->second.GroupInfo->RemoveInviteTime == removeTime );
|
||||
}
|
||||
|
||||
bool BattleGroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo)
|
||||
bool BattleGroundQueue::GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo)
|
||||
{
|
||||
//ACE_Guard<ACE_Recursive_Thread_Mutex> g(m_Lock);
|
||||
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid);
|
||||
|
|
@ -463,7 +463,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
|||
ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME;
|
||||
|
||||
// loop through the players
|
||||
for(std::map<uint64,PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
for(GroupQueueInfoPlayers::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
{
|
||||
// get the player
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
|
@ -481,7 +481,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
|||
plr->SetInviteForBattleGroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);
|
||||
|
||||
// create remind invite events
|
||||
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
|
||||
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetObjectGuid(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
|
||||
plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME));
|
||||
// create automatic remove events
|
||||
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime);
|
||||
|
|
@ -491,7 +491,8 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
|||
|
||||
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
|
||||
DEBUG_LOG("Battleground: invited plr %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.",plr->GetName(),plr->GetGUIDLow(),bg->GetInstanceID(),queueSlot,bg->GetTypeID());
|
||||
DEBUG_LOG("Battleground: invited %s to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.",
|
||||
plr->GetGuidStr().c_str(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
|
||||
|
||||
// send status packet
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue