mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +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
|
|
@ -1428,13 +1428,13 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
|
|||
*/
|
||||
// add to world, so it can be later looked up from HashMapHolder
|
||||
go->AddToWorld();
|
||||
m_BgObjects[type] = go->GetGUID();
|
||||
m_BgObjects[type] = go->GetObjectGuid();
|
||||
return true;
|
||||
}
|
||||
|
||||
//some doors aren't despawned so we cannot handle their closing in gameobject::update()
|
||||
//it would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code
|
||||
void BattleGround::DoorClose(uint64 const& guid)
|
||||
void BattleGround::DoorClose(ObjectGuid guid)
|
||||
{
|
||||
GameObject *obj = GetBgMap()->GetGameObject(guid);
|
||||
if (obj)
|
||||
|
|
@ -1448,12 +1448,10 @@ void BattleGround::DoorClose(uint64 const& guid)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outError("BattleGround: Door object not found (cannot close doors)");
|
||||
}
|
||||
sLog.outError("BattleGround: Door %s not found (cannot close doors)", guid.GetString().c_str());
|
||||
}
|
||||
|
||||
void BattleGround::DoorOpen(uint64 const& guid)
|
||||
void BattleGround::DoorOpen(ObjectGuid guid)
|
||||
{
|
||||
GameObject *obj = GetBgMap()->GetGameObject(guid);
|
||||
if (obj)
|
||||
|
|
@ -1463,9 +1461,7 @@ void BattleGround::DoorOpen(uint64 const& guid)
|
|||
obj->UseDoorOrButton(RESPAWN_ONE_DAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outError("BattleGround: Door object not found! - doors will be closed.");
|
||||
}
|
||||
sLog.outError("BattleGround: Door %s not found! - doors will be closed.", guid.GetString().c_str());
|
||||
}
|
||||
|
||||
void BattleGround::OnObjectDBLoad(Creature* creature)
|
||||
|
|
@ -1473,17 +1469,17 @@ void BattleGround::OnObjectDBLoad(Creature* creature)
|
|||
const BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(creature->GetDBTableGUIDLow());
|
||||
if (eventId.event1 == BG_EVENT_NONE)
|
||||
return;
|
||||
m_EventObjects[MAKE_PAIR32(eventId.event1, eventId.event2)].creatures.push_back(creature->GetGUID());
|
||||
m_EventObjects[MAKE_PAIR32(eventId.event1, eventId.event2)].creatures.push_back(creature->GetObjectGuid());
|
||||
if (!IsActiveEvent(eventId.event1, eventId.event2))
|
||||
SpawnBGCreature(creature->GetGUID(), RESPAWN_ONE_DAY);
|
||||
SpawnBGCreature(creature->GetObjectGuid(), RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
uint64 BattleGround::GetSingleCreatureGuid(uint8 event1, uint8 event2)
|
||||
ObjectGuid BattleGround::GetSingleCreatureGuid(uint8 event1, uint8 event2)
|
||||
{
|
||||
BGCreatures::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin();
|
||||
if (itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end())
|
||||
return *itr;
|
||||
return 0;
|
||||
return ObjectGuid();
|
||||
}
|
||||
|
||||
void BattleGround::OnObjectDBLoad(GameObject* obj)
|
||||
|
|
@ -1491,16 +1487,16 @@ void BattleGround::OnObjectDBLoad(GameObject* obj)
|
|||
const BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(obj->GetDBTableGUIDLow());
|
||||
if (eventId.event1 == BG_EVENT_NONE)
|
||||
return;
|
||||
m_EventObjects[MAKE_PAIR32(eventId.event1, eventId.event2)].gameobjects.push_back(obj->GetGUID());
|
||||
m_EventObjects[MAKE_PAIR32(eventId.event1, eventId.event2)].gameobjects.push_back(obj->GetObjectGuid());
|
||||
if (!IsActiveEvent(eventId.event1, eventId.event2))
|
||||
{
|
||||
SpawnBGObject(obj->GetGUID(), RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(obj->GetObjectGuid(), RESPAWN_ONE_DAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's possible, that doors aren't spawned anymore (wsg)
|
||||
if (GetStatus() >= STATUS_IN_PROGRESS && IsDoor(eventId.event1, eventId.event2))
|
||||
DoorOpen(obj->GetGUID());
|
||||
DoorOpen(obj->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1560,7 +1556,7 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
|
|||
SpawnBGObject(*itr2, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
void BattleGround::SpawnBGObject(uint64 const& guid, uint32 respawntime)
|
||||
void BattleGround::SpawnBGObject(ObjectGuid guid, uint32 respawntime)
|
||||
{
|
||||
Map* map = GetBgMap();
|
||||
|
||||
|
|
@ -1583,7 +1579,7 @@ void BattleGround::SpawnBGObject(uint64 const& guid, uint32 respawntime)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGround::SpawnBGCreature(uint64 const& guid, uint32 respawntime)
|
||||
void BattleGround::SpawnBGCreature(ObjectGuid guid, uint32 respawntime)
|
||||
{
|
||||
Map* map = GetBgMap();
|
||||
|
||||
|
|
@ -1606,19 +1602,19 @@ void BattleGround::SpawnBGCreature(uint64 const& guid, uint32 respawntime)
|
|||
|
||||
bool BattleGround::DelObject(uint32 type)
|
||||
{
|
||||
if (!m_BgObjects[type])
|
||||
if (m_BgObjects[type].IsEmpty())
|
||||
return true;
|
||||
|
||||
GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
|
||||
if (!obj)
|
||||
{
|
||||
sLog.outError("Can't find gobject guid: %u",GUID_LOPART(m_BgObjects[type]));
|
||||
sLog.outError("Can't find gobject: %s", m_BgObjects[type].GetString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
obj->SetRespawnTime(0); // not save respawn time
|
||||
obj->Delete();
|
||||
m_BgObjects[type] = 0;
|
||||
m_BgObjects[type].Clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1629,7 +1625,7 @@ void BattleGround::SendMessageToAll(int32 entry, ChatMsg type, Player const* sou
|
|||
BroadcastWorker(bg_do);
|
||||
}
|
||||
|
||||
void BattleGround::SendYellToAll(int32 entry, uint32 language, uint64 const& guid)
|
||||
void BattleGround::SendYellToAll(int32 entry, uint32 language, ObjectGuid guid)
|
||||
{
|
||||
Creature* source = GetBgMap()->GetCreature(guid);
|
||||
if(!source)
|
||||
|
|
@ -1658,7 +1654,7 @@ void BattleGround::SendMessage2ToAll(int32 entry, ChatMsg type, Player const* so
|
|||
BroadcastWorker(bg_do);
|
||||
}
|
||||
|
||||
void BattleGround::SendYell2ToAll(int32 entry, uint32 language, uint64 const& guid, int32 arg1, int32 arg2)
|
||||
void BattleGround::SendYell2ToAll(int32 entry, uint32 language, ObjectGuid guid, int32 arg1, int32 arg2)
|
||||
{
|
||||
Creature* source = GetBgMap()->GetCreature(guid);
|
||||
if(!source)
|
||||
|
|
@ -1680,7 +1676,7 @@ important notice:
|
|||
buffs aren't spawned/despawned when players captures anything
|
||||
buffs are in their positions when battleground starts
|
||||
*/
|
||||
void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
|
||||
void BattleGround::HandleTriggerBuff(ObjectGuid go_guid)
|
||||
{
|
||||
GameObject *obj = GetBgMap()->GetGameObject(go_guid);
|
||||
if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
|
||||
|
|
@ -1701,7 +1697,8 @@ void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
|
|||
index--;
|
||||
if (index < 0)
|
||||
{
|
||||
sLog.outError("BattleGround (Type: %u) has buff gameobject (Guid: %u Entry: %u Type:%u) but it hasn't that object in its internal data",GetTypeID(),GUID_LOPART(go_guid),obj->GetEntry(),obj->GetGoType());
|
||||
sLog.outError("BattleGround (Type: %u) has buff trigger %s GOType: %u but it hasn't that object in its internal data",
|
||||
GetTypeID(), go_guid.GetString().c_str(), obj->GetGoType());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -433,12 +433,12 @@ class BattleGround
|
|||
void BlockMovement(Player *plr);
|
||||
|
||||
void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL);
|
||||
void SendYellToAll(int32 entry, uint32 language, uint64 const& guid);
|
||||
void SendYellToAll(int32 entry, uint32 language, ObjectGuid guid);
|
||||
void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ... );
|
||||
|
||||
// specialized version with 2 string id args
|
||||
void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0);
|
||||
void SendYell2ToAll(int32 entry, uint32 language, uint64 const& guid, int32 arg1, int32 arg2);
|
||||
void SendYell2ToAll(int32 entry, uint32 language, ObjectGuid guid, int32 arg1, int32 arg2);
|
||||
|
||||
/* Raid Group */
|
||||
Group *GetBgRaid(Team team) const { return m_BgRaids[GetTeamIndexByTeamId(team)]; }
|
||||
|
|
@ -501,25 +501,25 @@ class BattleGround
|
|||
return false;
|
||||
return m_ActiveEvents[event1] == event2;
|
||||
}
|
||||
uint64 GetSingleCreatureGuid(uint8 event1, uint8 event2);
|
||||
ObjectGuid GetSingleCreatureGuid(uint8 event1, uint8 event2);
|
||||
|
||||
void OpenDoorEvent(uint8 event1, uint8 event2 = 0);
|
||||
bool IsDoor(uint8 event1, uint8 event2);
|
||||
|
||||
void HandleTriggerBuff(uint64 const& go_guid);
|
||||
void HandleTriggerBuff(ObjectGuid go_guid);
|
||||
|
||||
// TODO: make this protected:
|
||||
typedef std::vector<uint64> BGObjects;
|
||||
typedef std::vector<uint64> BGCreatures;
|
||||
typedef std::vector<ObjectGuid> BGObjects;
|
||||
typedef std::vector<ObjectGuid> BGCreatures;
|
||||
// TODO drop m_BGObjects
|
||||
BGObjects m_BgObjects;
|
||||
void SpawnBGObject(uint64 const& guid, uint32 respawntime);
|
||||
void SpawnBGObject(ObjectGuid guid, uint32 respawntime);
|
||||
bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0);
|
||||
void SpawnBGCreature(uint64 const& guid, uint32 respawntime);
|
||||
void SpawnBGCreature(ObjectGuid guid, uint32 respawntime);
|
||||
bool DelObject(uint32 type);
|
||||
|
||||
void DoorOpen(uint64 const& guid);
|
||||
void DoorClose(uint64 const& guid);
|
||||
void DoorOpen(ObjectGuid guid);
|
||||
void DoorClose(ObjectGuid guid);
|
||||
|
||||
virtual bool HandlePlayerUnderMap(Player * /*plr*/) { return false; }
|
||||
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ void BattleGroundEY::Reset()
|
|||
m_HonorScoreTics[BG_TEAM_HORDE] = 0;
|
||||
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
m_FlagKeeper.Clear();
|
||||
m_DroppedFlagGUID = 0;
|
||||
m_DroppedFlagGuid.Clear();
|
||||
m_PointAddingTimer = 0;
|
||||
m_TowerCapCheckTimer = 0;
|
||||
bool isBGWeekend = BattleGroundMgr::IsBGWeekend(GetTypeID());
|
||||
|
|
@ -459,13 +459,13 @@ void BattleGroundEY::RespawnFlagAfterDrop()
|
|||
{
|
||||
RespawnFlag(true);
|
||||
|
||||
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID());
|
||||
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid());
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID()));
|
||||
sLog.outError("BattleGroundEY: Unknown dropped flag: %s", GetDroppedFlagGuid().GetString().c_str());
|
||||
|
||||
SetDroppedFlagGUID(0);
|
||||
ClearDroppedFlagGuid();
|
||||
}
|
||||
|
||||
void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
||||
|
|
|
|||
|
|
@ -273,8 +273,9 @@ class BattleGroundEY : public BattleGround
|
|||
void EndBattleGround(Team winner);
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
|
||||
void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;}
|
||||
uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;}
|
||||
void SetDroppedFlagGuid(ObjectGuid guid) { m_DroppedFlagGuid = guid;}
|
||||
void ClearDroppedFlagGuid() { m_DroppedFlagGuid.Clear();}
|
||||
ObjectGuid const& GetDroppedFlagGuid() const { return m_DroppedFlagGuid;}
|
||||
|
||||
/* Battleground Events */
|
||||
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
||||
|
|
@ -308,7 +309,7 @@ class BattleGroundEY : public BattleGround
|
|||
uint32 m_Points_Trigger[BG_EY_NODES_MAX];
|
||||
|
||||
ObjectGuid m_FlagKeeper; // keepers guid
|
||||
uint64 m_DroppedFlagGUID;
|
||||
ObjectGuid m_DroppedFlagGuid;
|
||||
uint8 m_FlagState; // for checking flag state
|
||||
int32 m_FlagsTimer;
|
||||
int32 m_TowerCapCheckTimer;
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||
//we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function
|
||||
GroupQueueInfo ginfo;
|
||||
if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
|
||||
if (!bgQueue.GetPlayerGroupInfoData(_player->GetObjectGuid(), &ginfo))
|
||||
{
|
||||
sLog.outError("BattlegroundHandler: itrplayerstatus not found.");
|
||||
return;
|
||||
|
|
@ -426,7 +426,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType());
|
||||
_player->GetSession()->SendPacket(&data);
|
||||
// remove battleground queue status from BGmgr
|
||||
bgQueue.RemovePlayer(_player->GetGUID(), false);
|
||||
bgQueue.RemovePlayer(_player->GetObjectGuid(), false);
|
||||
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
|
||||
// also this is required to prevent stuck at old battleground after SetBattleGroundId set to new
|
||||
if (BattleGround *currentBg = _player->GetBattleGround())
|
||||
|
|
@ -449,14 +449,14 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
ArenaTeam * at = sObjectMgr.GetArenaTeamById(ginfo.ArenaTeamId);
|
||||
if (at)
|
||||
{
|
||||
DEBUG_LOG("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating);
|
||||
DEBUG_LOG("UPDATING memberLost's personal arena rating for %s by opponents rating: %u, because he has left queue!", _player->GetGuidStr().c_str(), ginfo.OpponentsTeamRating);
|
||||
at->MemberLost(_player, ginfo.OpponentsTeamRating);
|
||||
at->SaveToDB();
|
||||
}
|
||||
}
|
||||
_player->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
|
||||
bgQueue.RemovePlayer(_player->GetGUID(), true);
|
||||
bgQueue.RemovePlayer(_player->GetObjectGuid(), true);
|
||||
// player left queue, we should update it - do not update Arena Queue
|
||||
if (!ginfo.ArenaType)
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||
|
|
@ -523,7 +523,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
//get GroupQueueInfo for queue status
|
||||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||
GroupQueueInfo ginfo;
|
||||
if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
|
||||
if (!bgQueue.GetPlayerGroupInfoData(_player->GetObjectGuid(), &ginfo))
|
||||
continue;
|
||||
if (ginfo.IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -45,9 +45,11 @@ struct PlayerQueueInfo // stores informatio
|
|||
GroupQueueInfo * GroupInfo; // pointer to the associated groupqueueinfo
|
||||
};
|
||||
|
||||
typedef std::map<ObjectGuid, PlayerQueueInfo*> GroupQueueInfoPlayers;
|
||||
|
||||
struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!)
|
||||
{
|
||||
std::map<uint64, PlayerQueueInfo*> Players; // player queue info map
|
||||
GroupQueueInfoPlayers Players; // player queue info map
|
||||
Team GroupTeam; // Player team (ALLIANCE/HORDE)
|
||||
BattleGroundTypeId BgTypeId; // battleground type id
|
||||
bool IsRated; // rated
|
||||
|
|
@ -83,9 +85,9 @@ class BattleGroundQueue
|
|||
bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||
bool CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
||||
GroupQueueInfo * AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
|
||||
void RemovePlayer(const uint64& guid, bool decreaseInvitedCount);
|
||||
bool IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
|
||||
bool GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo);
|
||||
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount);
|
||||
bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
|
||||
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
|
||||
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id);
|
||||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id);
|
||||
|
||||
|
|
@ -94,7 +96,7 @@ class BattleGroundQueue
|
|||
ACE_Recursive_Thread_Mutex m_Lock;
|
||||
|
||||
|
||||
typedef std::map<uint64, PlayerQueueInfo> QueuedPlayersMap;
|
||||
typedef std::map<ObjectGuid, PlayerQueueInfo> QueuedPlayersMap;
|
||||
QueuedPlayersMap m_QueuedPlayers;
|
||||
|
||||
//we need constant add to begin and constant remove / add from the end, therefore deque suits our problem well
|
||||
|
|
@ -141,7 +143,7 @@ class BattleGroundQueue
|
|||
class BGQueueInviteEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
|
||||
BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
||||
{
|
||||
};
|
||||
|
|
@ -150,7 +152,7 @@ class BGQueueInviteEvent : public BasicEvent
|
|||
virtual bool Execute(uint64 e_time, uint32 p_time);
|
||||
virtual void Abort(uint64 e_time);
|
||||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
ObjectGuid m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
BattleGroundTypeId m_BgTypeId;
|
||||
uint8 m_ArenaType;
|
||||
|
|
|
|||
|
|
@ -176,13 +176,13 @@ void BattleGroundWS::RespawnFlagAfterDrop(Team team)
|
|||
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
|
||||
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team));
|
||||
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid(team));
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
sLog.outError("unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team)));
|
||||
sLog.outError("Unknown dropped flag bg: %s", GetDroppedFlagGuid(team).GetString().c_str());
|
||||
|
||||
SetDroppedFlagGUID(0,team);
|
||||
ClearDroppedFlagGuid(team);
|
||||
}
|
||||
|
||||
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
|
|
@ -543,7 +543,7 @@ void BattleGroundWS::Reset()
|
|||
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
{
|
||||
m_DroppedFlagGUID[i] = 0;
|
||||
m_DroppedFlagGuid[i].Clear();
|
||||
m_FlagKeepers[i].Clear();
|
||||
m_FlagState[i] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
m_TeamScores[i] = 0;
|
||||
|
|
|
|||
|
|
@ -138,8 +138,9 @@ class BattleGroundWS : public BattleGround
|
|||
void UpdateFlagState(Team team, uint32 value);
|
||||
void UpdateTeamScore(Team team);
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
void SetDroppedFlagGUID(uint64 guid, Team team) { m_DroppedFlagGUID[GetTeamIndexByTeamId(team)] = guid;}
|
||||
uint64 GetDroppedFlagGUID(Team team) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(team)];}
|
||||
void SetDroppedFlagGuid(ObjectGuid guid, Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)] = guid;}
|
||||
void ClearDroppedFlagGuid(Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)].Clear();}
|
||||
ObjectGuid const& GetDroppedFlagGuid(Team team) const { return m_DroppedFlagGuid[GetTeamIndexByTeamId(team)];}
|
||||
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
|
||||
|
||||
/* Scorekeeping */
|
||||
|
|
@ -150,7 +151,7 @@ class BattleGroundWS : public BattleGround
|
|||
private:
|
||||
ObjectGuid m_FlagKeepers[BG_TEAMS_COUNT];
|
||||
|
||||
uint64 m_DroppedFlagGUID[BG_TEAMS_COUNT];
|
||||
ObjectGuid m_DroppedFlagGuid[BG_TEAMS_COUNT];
|
||||
uint8 m_FlagState[BG_TEAMS_COUNT];
|
||||
int32 m_FlagsTimer[BG_TEAMS_COUNT];
|
||||
int32 m_FlagsDropTimer[BG_TEAMS_COUNT];
|
||||
|
|
|
|||
|
|
@ -5629,7 +5629,7 @@ void Spell::EffectSummonObjectWild(SpellEffectIndex eff_idx)
|
|||
{
|
||||
Team team = pl->GetTeam() == ALLIANCE ? HORDE : ALLIANCE;
|
||||
|
||||
((BattleGroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(), team);
|
||||
((BattleGroundWS*)bg)->SetDroppedFlagGuid(pGameObj->GetObjectGuid(), team);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -5637,7 +5637,7 @@ void Spell::EffectSummonObjectWild(SpellEffectIndex eff_idx)
|
|||
{
|
||||
if(bg && bg->GetTypeID()==BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
((BattleGroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID());
|
||||
((BattleGroundEY*)bg)->SetDroppedFlagGuid(pGameObj->GetObjectGuid());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
if(BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i))
|
||||
{
|
||||
_player->RemoveBattleGroundQueueId(bgQueueTypeId);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[ bgQueueTypeId ].RemovePlayer(_player->GetGUID(), true);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[ bgQueueTypeId ].RemovePlayer(_player->GetObjectGuid(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10800"
|
||||
#define REVISION_NR "10801"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue