[7353] Fixed problem with joining rated arena matches. Thanks to balrok for help. Author: Triply
--HG-- branch : trunk
This commit is contained in:
@@ -119,7 +119,7 @@ BattleGround::~BattleGround()
|
||||
// remove from battlegrounds
|
||||
}
|
||||
|
||||
sBattleGroundMgr.RemoveBattleGround(GetInstanceID());
|
||||
sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID());
|
||||
// unload map
|
||||
if(Map * map = MapManager::Instance().FindMap(GetMapId(), GetInstanceID()))
|
||||
if(map->IsBattleGroundOrArena())
|
||||
@@ -856,7 +856,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
}
|
||||
|
||||
// Do next only if found in battleground
|
||||
plr->SetBattleGroundId(0); // We're not in BG.
|
||||
plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
|
||||
// reset destination bg team
|
||||
plr->SetBGTeam(0);
|
||||
|
||||
@@ -1031,7 +1031,7 @@ void BattleGround::RemoveFromBGFreeSlotQueue()
|
||||
// set to be able to re-add if needed
|
||||
m_InBGFreeSlotQueue = false;
|
||||
// uncomment this code when battlegrounds will work like instances
|
||||
for (std::deque<BattleGround*>::iterator itr = sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].begin(); itr != sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].end(); ++itr)
|
||||
for (BGFreeSlotQueueType::iterator itr = sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].begin(); itr != sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].end(); ++itr)
|
||||
{
|
||||
if ((*itr)->GetInstanceID() == m_InstanceID)
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
||||
// get bg instance or bg template if instance not found
|
||||
BattleGround * bg = 0;
|
||||
if(instanceId)
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId);
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId, bgTypeId);
|
||||
|
||||
if(!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
||||
{
|
||||
@@ -347,7 +347,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
else
|
||||
{
|
||||
// get the bg we're invited to
|
||||
BattleGround * bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID);
|
||||
BattleGround * bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
status = STATUS_WAIT_JOIN;
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId);
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId, bgTypeId);
|
||||
|
||||
// bg template might and must be used in case of leaving queue, when instance is not created yet
|
||||
if(!bg && action == 0)
|
||||
@@ -458,11 +458,11 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true);
|
||||
|
||||
// set the destination instance id
|
||||
_player->SetBattleGroundId(bg->GetInstanceID());
|
||||
_player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId);
|
||||
// set the destination team
|
||||
_player->SetBGTeam(team);
|
||||
// bg->HandleBeforeTeleportToBattleGround(_player);
|
||||
sBattleGroundMgr.SendToBattleGround(_player, instanceId);
|
||||
sBattleGroundMgr.SendToBattleGround(_player, instanceId, bgTypeId);
|
||||
// add only in HandleMoveWorldPortAck()
|
||||
// bg->AddPlayer(_player,team);
|
||||
sLog.outDebug("Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.",_player->GetName(),_player->GetGUIDLow(),bg->GetInstanceID(),bg->GetTypeID(),bgQueueTypeId);
|
||||
|
||||
@@ -246,7 +246,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
// if invited to bg, and should decrease invited count, then do it
|
||||
if( decreaseInvitedCount && group->IsInvitedToBGInstanceGUID )
|
||||
{
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(group->IsInvitedToBGInstanceGUID);
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(group->IsInvitedToBGInstanceGUID, group->BgTypeId);
|
||||
if( bg )
|
||||
bg->DecreaseInvitedCount(group->Team);
|
||||
}
|
||||
@@ -370,7 +370,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
||||
continue;
|
||||
|
||||
// invite the player
|
||||
sBattleGroundMgr.InvitePlayer(plr, bg->GetInstanceID(), ginfo->Team);
|
||||
sBattleGroundMgr.InvitePlayer(plr, bg->GetInstanceID(), bg->GetTypeID(), ginfo->Team);
|
||||
|
||||
WorldPacket data;
|
||||
|
||||
@@ -918,7 +918,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
|
||||
// Player can be in another BG queue and must be removed in normal way in any case
|
||||
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID);
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
||||
if (!bg)
|
||||
return true;
|
||||
|
||||
@@ -952,7 +952,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
return true;
|
||||
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID);
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
||||
if (!bg)
|
||||
return true;
|
||||
|
||||
@@ -1004,7 +1004,8 @@ void BGQueueRemoveEvent::Abort(uint64 /*e_time*/)
|
||||
|
||||
BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
|
||||
{
|
||||
m_BattleGrounds.clear();
|
||||
for(uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
m_BattleGrounds[i].clear();
|
||||
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
|
||||
m_Testing=false;
|
||||
}
|
||||
@@ -1016,12 +1017,15 @@ BattleGroundMgr::~BattleGroundMgr()
|
||||
|
||||
void BattleGroundMgr::DeleteAlllBattleGrounds()
|
||||
{
|
||||
for(BattleGroundSet::iterator itr = m_BattleGrounds.begin(); itr != m_BattleGrounds.end();)
|
||||
for(uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
{
|
||||
for(BattleGroundSet::iterator itr = m_BattleGrounds[i].begin(); itr != m_BattleGrounds[i].end();)
|
||||
{
|
||||
BattleGround * bg = itr->second;
|
||||
m_BattleGrounds.erase(itr++);
|
||||
m_BattleGrounds[i].erase(itr++);
|
||||
delete bg;
|
||||
}
|
||||
}
|
||||
|
||||
// destroy template battlegrounds that listed only in queues (other already terminated)
|
||||
for(uint32 bgTypeId = 0; bgTypeId < MAX_BATTLEGROUND_TYPE_ID; ++bgTypeId)
|
||||
@@ -1036,7 +1040,9 @@ void BattleGroundMgr::DeleteAlllBattleGrounds()
|
||||
void BattleGroundMgr::Update(uint32 diff)
|
||||
{
|
||||
BattleGroundSet::iterator itr, next;
|
||||
for(itr = m_BattleGrounds.begin(); itr != m_BattleGrounds.end(); itr = next)
|
||||
for(uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
{
|
||||
for(itr = m_BattleGrounds[i].begin(); itr != m_BattleGrounds[i].end(); itr = next)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
@@ -1046,10 +1052,11 @@ void BattleGroundMgr::Update(uint32 diff)
|
||||
if(itr->second->m_SetDeleteThis)
|
||||
{
|
||||
BattleGround * bg = itr->second;
|
||||
m_BattleGrounds.erase(itr);
|
||||
m_BattleGrounds[i].erase(itr);
|
||||
delete bg;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if rating difference counts, maybe force-update queues
|
||||
if(sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER))
|
||||
{
|
||||
@@ -1324,10 +1331,10 @@ void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Pla
|
||||
*data << uint64(plr->GetGUID());
|
||||
}
|
||||
|
||||
void BattleGroundMgr::InvitePlayer(Player* plr, uint32 bgInstanceGUID, uint32 team)
|
||||
void BattleGroundMgr::InvitePlayer(Player* plr, uint32 bgInstanceGUID, BattleGroundTypeId bgTypeId, uint32 team)
|
||||
{
|
||||
// set invited player counters:
|
||||
BattleGround* bg = GetBattleGround(bgInstanceGUID);
|
||||
BattleGround* bg = GetBattleGround(bgInstanceGUID, bgTypeId);
|
||||
if(!bg)
|
||||
return;
|
||||
bg->IncreaseInvitedCount(team);
|
||||
@@ -1355,15 +1362,34 @@ void BattleGroundMgr::InvitePlayer(Player* plr, uint32 bgInstanceGUID, uint32 te
|
||||
|
||||
// create invite events:
|
||||
//add events to player's counters ---- this is not good way - there should be something like global event processor, where we should add those events
|
||||
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), bgInstanceGUID);
|
||||
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), bgInstanceGUID, bgTypeId);
|
||||
plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME));
|
||||
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), bgInstanceGUID, team);
|
||||
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), bgInstanceGUID, bgTypeId, team);
|
||||
plr->m_Events.AddEvent(removeEvent, plr->m_Events.CalculateTime(INVITE_ACCEPT_WAIT_TIME));
|
||||
}
|
||||
|
||||
BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
//search if needed
|
||||
BattleGroundSet::iterator itr;
|
||||
if( bgTypeId == BATTLEGROUND_TYPE_NONE)
|
||||
{
|
||||
for(uint32 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
{
|
||||
itr = m_BattleGrounds[i].find(InstanceID);
|
||||
if( itr != m_BattleGrounds[i].end() )
|
||||
return itr->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
itr = m_BattleGrounds[bgTypeId].find(InstanceID);
|
||||
return ( (itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL );
|
||||
}
|
||||
|
||||
BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
return BGFreeSlotQueue[bgTypeId].empty() ? NULL : BGFreeSlotQueue[bgTypeId].back();
|
||||
//map is sorted and we can be sure that lowest instance id has only BG template
|
||||
return m_BattleGrounds[bgTypeId].empty() ? NULL : m_BattleGrounds[bgTypeId].begin()->second;
|
||||
}
|
||||
|
||||
// create a new battleground that will really be used to play
|
||||
@@ -1460,7 +1486,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
|
||||
bg->AddToBGFreeSlotQueue();
|
||||
|
||||
// add bg to update list
|
||||
AddBattleGround(bg->GetInstanceID(), bg);
|
||||
AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg);
|
||||
|
||||
return bg;
|
||||
}
|
||||
@@ -1487,9 +1513,6 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA
|
||||
}
|
||||
|
||||
bg->SetMapId(MapID);
|
||||
|
||||
bg->Reset();
|
||||
|
||||
bg->SetTypeID(bgTypeId);
|
||||
bg->SetInstanceID(0);
|
||||
bg->SetArenaorBGType(IsArena);
|
||||
@@ -1502,8 +1525,8 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA
|
||||
bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO);
|
||||
bg->SetLevelRange(LevelMin, LevelMax);
|
||||
|
||||
//add BattleGround instance to FreeSlotQueue (.back() will return the template!)
|
||||
bg->AddToBGFreeSlotQueue();
|
||||
//reset() and add to free slot queue are called only when needed!
|
||||
//bg->AddToBGFreeSlotQueue();
|
||||
|
||||
// do NOT add to update list, since this is a template battleground!
|
||||
|
||||
@@ -1725,9 +1748,9 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
|
||||
uint32 count = 0;
|
||||
*data << uint32(0x00); // number of bg instances
|
||||
|
||||
for(std::map<uint32, BattleGround*>::iterator itr = m_BattleGrounds.begin(); itr != m_BattleGrounds.end(); ++itr)
|
||||
for(BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
|
||||
{
|
||||
if(itr->second->GetTypeID() == bgTypeId && (PlayerLevel >= itr->second->GetMinLevel()) && (PlayerLevel <= itr->second->GetMaxLevel()))
|
||||
if( PlayerLevel >= itr->second->GetMinLevel() && PlayerLevel <= itr->second->GetMaxLevel() )
|
||||
{
|
||||
*data << uint32(itr->second->GetInstanceID());
|
||||
++count;
|
||||
@@ -1737,9 +1760,9 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId)
|
||||
void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
BattleGround *bg = GetBattleGround(instanceId);
|
||||
BattleGround *bg = GetBattleGround(instanceId, bgTypeId);
|
||||
if(bg)
|
||||
{
|
||||
uint32 mapid = bg->GetMapId();
|
||||
|
||||
+14
-18
@@ -24,8 +24,6 @@
|
||||
#include "Common.h"
|
||||
#include "BattleGround.h"
|
||||
|
||||
//TODO it is not possible to have this structure, because we should have BattlegroundSet for each queue
|
||||
//so i propose to change this type to array 1..MAX_BATTLEGROUND_TYPES of sets or maps..
|
||||
typedef std::map<uint32, BattleGround*> BattleGroundSet;
|
||||
|
||||
typedef std::deque<BattleGround*> BGFreeSlotQueueType;
|
||||
@@ -131,7 +129,10 @@ class BattleGroundQueue
|
||||
class BGQueueInviteEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID) : m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID) {};
|
||||
BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId)
|
||||
{
|
||||
};
|
||||
virtual ~BGQueueInviteEvent() {};
|
||||
|
||||
virtual bool Execute(uint64 e_time, uint32 p_time);
|
||||
@@ -139,6 +140,7 @@ class BGQueueInviteEvent : public BasicEvent
|
||||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
BattleGroundTypeId m_BgTypeId;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -147,8 +149,8 @@ class BGQueueInviteEvent : public BasicEvent
|
||||
class BGQueueRemoveEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, uint32 playersTeam) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_PlayersTeam(playersTeam)
|
||||
BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, uint32 playersTeam) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_BgTypeId(BgTypeId), m_PlayersTeam(playersTeam)
|
||||
{
|
||||
};
|
||||
virtual ~BGQueueRemoveEvent() {};
|
||||
@@ -159,6 +161,7 @@ class BGQueueRemoveEvent : public BasicEvent
|
||||
uint64 m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
uint32 m_PlayersTeam;
|
||||
BattleGroundTypeId m_BgTypeId;
|
||||
};
|
||||
|
||||
class BattleGroundMgr
|
||||
@@ -182,30 +185,23 @@ class BattleGroundMgr
|
||||
|
||||
/* Player invitation */
|
||||
// called from Queue update, or from Addplayer to queue
|
||||
void InvitePlayer(Player* plr, uint32 bgInstanceGUID, uint32 team);
|
||||
void InvitePlayer(Player* plr, uint32 bgInstanceGUID, BattleGroundTypeId bgTypeId, uint32 team);
|
||||
|
||||
/* Battlegrounds */
|
||||
BattleGroundSet::iterator GetBattleGroundsBegin() { return m_BattleGrounds.begin(); };
|
||||
BattleGroundSet::iterator GetBattleGroundsEnd() { return m_BattleGrounds.end(); };
|
||||
|
||||
BattleGround* GetBattleGround(uint32 InstanceID)
|
||||
{
|
||||
BattleGroundSet::iterator i = m_BattleGrounds.find(InstanceID);
|
||||
return ( (i != m_BattleGrounds.end()) ? i->second : NULL );
|
||||
};
|
||||
BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
|
||||
|
||||
BattleGround * GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
|
||||
BattleGround * CreateNewBattleGround(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id, uint8 arenaType, bool isRated);
|
||||
|
||||
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
|
||||
|
||||
void AddBattleGround(uint32 InstanceID, BattleGround* BG) { m_BattleGrounds[InstanceID] = BG; };
|
||||
void RemoveBattleGround(uint32 instanceID) { m_BattleGrounds.erase(instanceID); }
|
||||
void AddBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId, BattleGround* BG) { m_BattleGrounds[bgTypeId][InstanceID] = BG; };
|
||||
void RemoveBattleGround(uint32 instanceID, BattleGroundTypeId bgTypeId) { m_BattleGrounds[bgTypeId].erase(instanceID); }
|
||||
|
||||
void CreateInitialBattleGrounds();
|
||||
void DeleteAlllBattleGrounds();
|
||||
|
||||
void SendToBattleGround(Player *pl, uint32 InstanceID);
|
||||
void SendToBattleGround(Player *pl, uint32 InstanceID, BattleGroundTypeId bgTypeId);
|
||||
|
||||
/* Battleground queues */
|
||||
//these queues are instantiated when creating BattlegroundMrg
|
||||
@@ -244,7 +240,7 @@ class BattleGroundMgr
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
|
||||
/* Battlegrounds */
|
||||
BattleGroundSet m_BattleGrounds;
|
||||
BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID];
|
||||
uint32 m_NextRatingDiscardUpdate;
|
||||
uint64 m_NextAutoDistributionTime;
|
||||
uint32 m_AutoDistributionTimeChecker;
|
||||
|
||||
+2
-2
@@ -783,7 +783,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||
}
|
||||
// all's well, set bg id
|
||||
// when porting out from the bg, it will be reset to 0
|
||||
chr->SetBattleGroundId(m_session->GetPlayer()->GetBattleGroundId());
|
||||
chr->SetBattleGroundId(m_session->GetPlayer()->GetBattleGroundId(), m_session->GetPlayer()->GetBattleGroundTypeId());
|
||||
// remember current position as entry point for return at bg end teleportation
|
||||
chr->SetBattleGroundEntryPoint(chr->GetMapId(),chr->GetPositionX(),chr->GetPositionY(),chr->GetPositionZ(),chr->GetOrientation());
|
||||
}
|
||||
@@ -901,7 +901,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||
}
|
||||
// all's well, set bg id
|
||||
// when porting out from the bg, it will be reset to 0
|
||||
_player->SetBattleGroundId(chr->GetBattleGroundId());
|
||||
_player->SetBattleGroundId(chr->GetBattleGroundId(), chr->GetBattleGroundTypeId());
|
||||
// remember current position as entry point for return at bg end teleportation
|
||||
_player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation());
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
// cleanup seting if outdated
|
||||
if(!mEntry->IsBattleGroundOrArena())
|
||||
{
|
||||
_player->SetBattleGroundId(0); // We're not in BG.
|
||||
_player->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
|
||||
// reset destination bg team
|
||||
_player->SetBGTeam(0);
|
||||
}
|
||||
|
||||
+5
-4
@@ -370,6 +370,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
|
||||
m_DetectInvTimer = 1000;
|
||||
|
||||
m_bgBattleGroundID = 0;
|
||||
m_bgTypeID = BATTLEGROUND_TYPE_NONE;
|
||||
for (int j=0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; j++)
|
||||
{
|
||||
m_bgBattleGroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
|
||||
@@ -4347,7 +4348,7 @@ void Player::RepopAtGraveyard()
|
||||
WorldSafeLocsEntry const *ClosestGrave = NULL;
|
||||
|
||||
// Special handle for battleground maps
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(GetBattleGroundId());
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgTypeID);
|
||||
|
||||
if(bg && (bg->GetTypeID() == BATTLEGROUND_AB || bg->GetTypeID() == BATTLEGROUND_EY || bg->GetTypeID() == BATTLEGROUND_AV))
|
||||
ClosestGrave = bg->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetTeam());
|
||||
@@ -14609,14 +14610,14 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||
if(!mapEntry || mapEntry->Instanceable() || !MapManager::IsValidMapCoord(m_bgEntryPoint))
|
||||
SetBattleGroundEntryPoint(m_homebindMapId,m_homebindX,m_homebindY,m_homebindZ,0.0f);
|
||||
|
||||
BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(bgid);
|
||||
BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(bgid, BATTLEGROUND_TYPE_NONE);
|
||||
|
||||
if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID()))
|
||||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
|
||||
uint32 queueSlot = AddBattleGroundQueueId(bgQueueTypeId);
|
||||
|
||||
SetBattleGroundId(currentBg->GetInstanceID());
|
||||
SetBattleGroundId(currentBg->GetInstanceID(), currentBg->GetTypeID());
|
||||
SetBGTeam(bgteam);
|
||||
|
||||
//join player to battleground group
|
||||
@@ -19050,7 +19051,7 @@ BattleGround* Player::GetBattleGround() const
|
||||
if(GetBattleGroundId()==0)
|
||||
return NULL;
|
||||
|
||||
return sBattleGroundMgr.GetBattleGround(GetBattleGroundId());
|
||||
return sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgTypeID);
|
||||
}
|
||||
|
||||
bool Player::InArena() const
|
||||
|
||||
+7
-1
@@ -1867,6 +1867,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
bool InBattleGround() const { return m_bgBattleGroundID != 0; }
|
||||
bool InArena() const;
|
||||
uint32 GetBattleGroundId() const { return m_bgBattleGroundID; }
|
||||
BattleGroundTypeId GetBattleGroundTypeId() const { return m_bgTypeID; }
|
||||
BattleGround* GetBattleGround() const;
|
||||
|
||||
|
||||
@@ -1900,7 +1901,11 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
return GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
|
||||
void SetBattleGroundId(uint32 val) { m_bgBattleGroundID = val; }
|
||||
void SetBattleGroundId(uint32 val, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
m_bgBattleGroundID = val;
|
||||
m_bgTypeID = bgTypeId;
|
||||
}
|
||||
uint32 AddBattleGroundQueueId(BattleGroundQueueTypeId val)
|
||||
{
|
||||
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
@@ -2169,6 +2174,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
|
||||
/* this variable is set to bg->m_InstanceID, when player is teleported to BG - (it is battleground's GUID)*/
|
||||
uint32 m_bgBattleGroundID;
|
||||
BattleGroundTypeId m_bgTypeID;
|
||||
/*
|
||||
this is an array of BG queues (BgTypeIDs) in which is player
|
||||
*/
|
||||
|
||||
@@ -2296,6 +2296,7 @@ enum BanReturn
|
||||
// indexes of BattlemasterList.dbc
|
||||
enum BattleGroundTypeId
|
||||
{
|
||||
BATTLEGROUND_TYPE_NONE = 0,
|
||||
BATTLEGROUND_AV = 1,
|
||||
BATTLEGROUND_WS = 2,
|
||||
BATTLEGROUND_AB = 3,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7352"
|
||||
#define REVISION_NR "7353"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
||||
Reference in New Issue
Block a user