[7276] Rewrited fix for same faction arena matches
Added better Object-oriented calls to BattleGround::Reset()
Added more checks to CreateBattleGround() method
This commit doesn't fix anything
Author: Triply
--HG--
branch : trunk
This commit is contained in:
@@ -181,6 +181,7 @@ void BattleGround::Update(uint32 diff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this should be handled by spell system:
|
||||||
m_LastResurrectTime += diff;
|
m_LastResurrectTime += diff;
|
||||||
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
|
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
|
||||||
{
|
{
|
||||||
@@ -308,7 +309,7 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *
|
|||||||
if(!self && sender == plr)
|
if(!self && sender == plr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
uint32 team = itr->second.Team;
|
||||||
if(!team) team = plr->GetTeam();
|
if(!team) team = plr->GetTeam();
|
||||||
|
|
||||||
if(team == TeamID)
|
if(team == TeamID)
|
||||||
@@ -337,7 +338,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
uint32 team = itr->second.Team;
|
||||||
if(!team) team = plr->GetTeam();
|
if(!team) team = plr->GetTeam();
|
||||||
|
|
||||||
if(team == TeamID)
|
if(team == TeamID)
|
||||||
@@ -360,7 +361,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
uint32 team = itr->second.Team;
|
||||||
if(!team) team = plr->GetTeam();
|
if(!team) team = plr->GetTeam();
|
||||||
|
|
||||||
if(team == TeamID)
|
if(team == TeamID)
|
||||||
@@ -397,7 +398,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
uint32 team = itr->second.Team;
|
||||||
if(!team) team = plr->GetTeam();
|
if(!team) team = plr->GetTeam();
|
||||||
|
|
||||||
if(team == TeamID)
|
if(team == TeamID)
|
||||||
@@ -422,7 +423,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID());
|
uint32 team = itr->second.Team;
|
||||||
if(!team) team = plr->GetTeam();
|
if(!team) team = plr->GetTeam();
|
||||||
|
|
||||||
if(team == TeamID)
|
if(team == TeamID)
|
||||||
@@ -910,9 +911,6 @@ void BattleGround::Reset()
|
|||||||
|
|
||||||
m_Players.clear();
|
m_Players.clear();
|
||||||
m_PlayerScores.clear();
|
m_PlayerScores.clear();
|
||||||
|
|
||||||
// reset BGSubclass
|
|
||||||
ResetBGSubclass();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGround::StartBattleGround()
|
void BattleGround::StartBattleGround()
|
||||||
@@ -993,10 +991,37 @@ void BattleGround::AddPlayer(Player *plr)
|
|||||||
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
|
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup BG group membership
|
||||||
|
PlayerRelogin(plr);
|
||||||
|
AddOrSetPlayerToCorrectBgGroup(plr, guid, team);
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
sLog.outDetail("BATTLEGROUND: Player %s joined the battle.", plr->GetName());
|
sLog.outDetail("BATTLEGROUND: Player %s joined the battle.", plr->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this method adds player to his team's bg group, or sets his correct group if player is already in bg group */
|
||||||
|
void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team)
|
||||||
|
{
|
||||||
|
Group* group = GetBgRaid(team);
|
||||||
|
if(!group) // first player joined
|
||||||
|
{
|
||||||
|
group = new Group;
|
||||||
|
SetBgRaid(team, group);
|
||||||
|
group->Create(plr_guid, plr->GetName());
|
||||||
|
}
|
||||||
|
else // raid already exist
|
||||||
|
{
|
||||||
|
if(group->IsMember(plr_guid))
|
||||||
|
{
|
||||||
|
uint8 subgroup = group->GetMemberGroup(plr_guid);
|
||||||
|
plr->SetGroup(group, subgroup);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
GetBgRaid(team)->AddMember(plr_guid, plr->GetName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This method should be called only once ... it adds pointer to queue */
|
/* This method should be called only once ... it adds pointer to queue */
|
||||||
void BattleGround::AddToBGFreeSlotQueue()
|
void BattleGround::AddToBGFreeSlotQueue()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -258,10 +258,7 @@ class BattleGround
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void Reset(); // resets all common properties for battlegrounds
|
virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass
|
||||||
virtual void ResetBGSubclass() // must be implemented in BG subclass
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Battleground */
|
/* Battleground */
|
||||||
// Get methods:
|
// Get methods:
|
||||||
@@ -425,6 +422,8 @@ class BattleGround
|
|||||||
|
|
||||||
virtual void AddPlayer(Player *plr); // must be implemented in BG subclass
|
virtual void AddPlayer(Player *plr); // must be implemented in BG subclass
|
||||||
|
|
||||||
|
void AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team);
|
||||||
|
|
||||||
virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket);
|
virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket);
|
||||||
// can be extended in in BG subclass
|
// can be extended in in BG subclass
|
||||||
|
|
||||||
|
|||||||
@@ -592,8 +592,11 @@ bool BattleGroundAB::SetupBattleGround()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAB::ResetBGSubclass()
|
void BattleGroundAB::Reset()
|
||||||
{
|
{
|
||||||
|
//call parent's class reset
|
||||||
|
BattleGround::Reset();
|
||||||
|
|
||||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||||
m_lastTick[BG_TEAM_ALLIANCE] = 0;
|
m_lastTick[BG_TEAM_ALLIANCE] = 0;
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ class BattleGroundAB : public BattleGround
|
|||||||
void RemovePlayer(Player *plr,uint64 guid);
|
void RemovePlayer(Player *plr,uint64 guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
virtual bool SetupBattleGround();
|
virtual bool SetupBattleGround();
|
||||||
virtual void ResetBGSubclass();
|
virtual void Reset();
|
||||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 team);
|
virtual WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 team);
|
||||||
|
|
||||||
/* Scorekeeping */
|
/* Scorekeeping */
|
||||||
|
|||||||
@@ -202,9 +202,10 @@ void BattleGroundBE::FillInitialWorldStates(WorldPacket &data)
|
|||||||
data << uint32(0x9f3) << uint32(1); // 9
|
data << uint32(0x9f3) << uint32(1); // 9
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundBE::ResetBGSubclass()
|
void BattleGroundBE::Reset()
|
||||||
{
|
{
|
||||||
|
//call parent's class reset
|
||||||
|
BattleGround::Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundBE::SetupBattleGround()
|
bool BattleGroundBE::SetupBattleGround()
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class BattleGroundBE : public BattleGround
|
|||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
void ResetBGSubclass();
|
virtual void Reset();
|
||||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player *killer);
|
||||||
bool HandlePlayerUnderMap(Player * plr);
|
bool HandlePlayerUnderMap(Player * plr);
|
||||||
|
|||||||
@@ -524,8 +524,11 @@ bool BattleGroundEY::SetupBattleGround()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundEY::ResetBGSubclass()
|
void BattleGroundEY::Reset()
|
||||||
{
|
{
|
||||||
|
//call parent's class reset
|
||||||
|
BattleGround::Reset();
|
||||||
|
|
||||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||||
m_TeamPointsCount[BG_TEAM_ALLIANCE] = 0;
|
m_TeamPointsCount[BG_TEAM_ALLIANCE] = 0;
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ class BattleGroundEY : public BattleGround
|
|||||||
void HandleKillPlayer(Player *player, Player *killer);
|
void HandleKillPlayer(Player *player, Player *killer);
|
||||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 team);
|
virtual WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 team);
|
||||||
virtual bool SetupBattleGround();
|
virtual bool SetupBattleGround();
|
||||||
virtual void ResetBGSubclass();
|
virtual void Reset();
|
||||||
void UpdateTeamScore(uint32 Team);
|
void UpdateTeamScore(uint32 Team);
|
||||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||||
|
|||||||
@@ -55,12 +55,6 @@ INSTANTIATE_SINGLETON_1( BattleGroundMgr );
|
|||||||
BattleGroundQueue::BattleGroundQueue()
|
BattleGroundQueue::BattleGroundQueue()
|
||||||
{
|
{
|
||||||
//queues are empty, we don't have to call clear()
|
//queues are empty, we don't have to call clear()
|
||||||
/* for (int i = 0; i < MAX_BATTLEGROUND_QUEUES; i++)
|
|
||||||
{
|
|
||||||
//m_QueuedPlayers[i].Horde = 0;
|
|
||||||
//m_QueuedPlayers[i].Alliance = 0;
|
|
||||||
//m_QueuedPlayers[i].AverageTime = 0;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleGroundQueue::~BattleGroundQueue()
|
BattleGroundQueue::~BattleGroundQueue()
|
||||||
@@ -87,17 +81,17 @@ void BattleGroundQueue::EligibleGroups::Init(BattleGroundQueue::QueuedGroupsList
|
|||||||
{
|
{
|
||||||
next = itr;
|
next = itr;
|
||||||
++next;
|
++next;
|
||||||
if( (*itr)->BgTypeId == BgTypeId && // bg type must match
|
if( (*itr)->BgTypeId == BgTypeId && // bg type must match
|
||||||
(*itr)->ArenaType == ArenaType && // arena type must match
|
(*itr)->ArenaType == ArenaType && // arena type must match
|
||||||
(*itr)->IsRated == IsRated && // israted must match
|
(*itr)->IsRated == IsRated && // israted must match
|
||||||
(*itr)->IsInvitedToBGInstanceGUID == 0 && // leave out already invited groups
|
(*itr)->IsInvitedToBGInstanceGUID == 0 && // leave out already invited groups
|
||||||
(*itr)->Team == side && // match side
|
(*itr)->Team == side && // match side
|
||||||
(*itr)->Players.size() <= MaxPlayers && // the group must fit in the bg
|
(*itr)->Players.size() <= MaxPlayers && // the group must fit in the bg
|
||||||
( !excludeTeam || (*itr)->ArenaTeamId != excludeTeam ) && // if excludeTeam is specified, leave out those arena team ids
|
( !excludeTeam || (*itr)->ArenaTeamId != excludeTeam ) && // if excludeTeam is specified, leave out those arena team ids
|
||||||
( !IsRated || (*itr)->Players.size() == MaxPlayers ) && // if rated, then pass only if the player count is exact NEEDS TESTING! (but now this should never happen)
|
( !IsRated || (*itr)->Players.size() == MaxPlayers ) && // if rated, then pass only if the player count is exact NEEDS TESTING! (but now this should never happen)
|
||||||
( !DisregardTime || (*itr)->JoinTime <= DisregardTime // pass if disregard time is greater than join time
|
( !DisregardTime || (*itr)->JoinTime <= DisregardTime // pass if disregard time is greater than join time
|
||||||
|| (*itr)->ArenaTeamRating == 0 // pass if no rating info
|
|| (*itr)->ArenaTeamRating == 0 // pass if no rating info
|
||||||
|| ( (*itr)->ArenaTeamRating >= MinRating // pass if matches the rating range
|
|| ( (*itr)->ArenaTeamRating >= MinRating // pass if matches the rating range
|
||||||
&& (*itr)->ArenaTeamRating <= MaxRating ) ) )
|
&& (*itr)->ArenaTeamRating <= MaxRating ) ) )
|
||||||
{
|
{
|
||||||
// the group matches the conditions
|
// the group matches the conditions
|
||||||
@@ -1433,9 +1427,8 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
|
|||||||
bg = new BattleGroundRV(*(BattleGroundRV*)bg_template);
|
bg = new BattleGroundRV(*(BattleGroundRV*)bg_template);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//bg = new BattleGround;
|
//error, but it is handled few lines above
|
||||||
return 0;
|
return 0;
|
||||||
break; // placeholder for non implemented BG
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate a new instance id
|
// generate a new instance id
|
||||||
@@ -1463,11 +1456,10 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// used to create the BG templates
|
// used to create the BG templates
|
||||||
uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, 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)
|
uint32 BattleGroundMgr::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)
|
||||||
{
|
{
|
||||||
// Create the BG
|
// Create the BG
|
||||||
BattleGround *bg = NULL;
|
BattleGround *bg = NULL;
|
||||||
|
|
||||||
switch(bgTypeId)
|
switch(bgTypeId)
|
||||||
{
|
{
|
||||||
case BATTLEGROUND_AV: bg = new BattleGroundAV; break;
|
case BATTLEGROUND_AV: bg = new BattleGroundAV; break;
|
||||||
@@ -1488,19 +1480,13 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 M
|
|||||||
|
|
||||||
bg->Reset();
|
bg->Reset();
|
||||||
|
|
||||||
BattlemasterListEntry const *bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
|
||||||
//in previous method is checked if exists entry in sBattlemasterListStore, so no check needed
|
|
||||||
if (bl)
|
|
||||||
{
|
|
||||||
bg->SetArenaorBGType(bl->type == TYPE_ARENA);
|
|
||||||
}
|
|
||||||
|
|
||||||
bg->SetTypeID(bgTypeId);
|
bg->SetTypeID(bgTypeId);
|
||||||
bg->SetInstanceID(0); // template bg, instance id is 0
|
bg->SetInstanceID(0);
|
||||||
|
bg->SetArenaorBGType(IsArena);
|
||||||
bg->SetMinPlayersPerTeam(MinPlayersPerTeam);
|
bg->SetMinPlayersPerTeam(MinPlayersPerTeam);
|
||||||
bg->SetMaxPlayersPerTeam(MaxPlayersPerTeam);
|
bg->SetMaxPlayersPerTeam(MaxPlayersPerTeam);
|
||||||
bg->SetMinPlayers(MinPlayersPerTeam*2);
|
bg->SetMinPlayers(MinPlayersPerTeam * 2);
|
||||||
bg->SetMaxPlayers(MaxPlayersPerTeam*2);
|
bg->SetMaxPlayers(MaxPlayersPerTeam * 2);
|
||||||
bg->SetName(BattleGroundName);
|
bg->SetName(BattleGroundName);
|
||||||
bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO);
|
bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO);
|
||||||
bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO);
|
bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO);
|
||||||
@@ -1522,6 +1508,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||||||
uint32 MaxPlayersPerTeam, MinPlayersPerTeam, MinLvl, MaxLvl, start1, start2;
|
uint32 MaxPlayersPerTeam, MinPlayersPerTeam, MinLvl, MaxLvl, start1, start2;
|
||||||
BattlemasterListEntry const *bl;
|
BattlemasterListEntry const *bl;
|
||||||
WorldSafeLocsEntry const *start;
|
WorldSafeLocsEntry const *start;
|
||||||
|
bool IsArena;
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
@@ -1552,28 +1539,28 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||||||
bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
|
bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
|
||||||
if(!bl)
|
if(!bl)
|
||||||
{
|
{
|
||||||
sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.",bgTypeID_);
|
sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_);
|
BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_);
|
||||||
|
|
||||||
MaxPlayersPerTeam = bl->maxplayersperteam;
|
IsArena = (bl->type == TYPE_ARENA);
|
||||||
MinPlayersPerTeam = bl->maxplayersperteam/2;
|
MinPlayersPerTeam = fields[1].GetUInt32();
|
||||||
MinLvl = bl->minlvl;
|
MaxPlayersPerTeam = fields[2].GetUInt32();
|
||||||
MaxLvl = bl->maxlvl;
|
MinLvl = fields[3].GetUInt32();
|
||||||
|
MaxLvl = fields[4].GetUInt32();
|
||||||
if(fields[1].GetUInt32())
|
//check values from DB
|
||||||
MinPlayersPerTeam = fields[1].GetUInt32();
|
if( MaxPlayersPerTeam == 0 || MinPlayersPerTeam == 0 || MinPlayersPerTeam > MaxPlayersPerTeam )
|
||||||
|
{
|
||||||
if(fields[2].GetUInt32())
|
MaxPlayersPerTeam = bl->maxplayersperteam;
|
||||||
MaxPlayersPerTeam = fields[2].GetUInt32();
|
MinPlayersPerTeam = bl->maxplayersperteam / 2;
|
||||||
|
}
|
||||||
if(fields[3].GetUInt32())
|
if( MinLvl == 0 || MaxLvl == 0 || MinLvl > MaxLvl )
|
||||||
MinLvl = fields[3].GetUInt32();
|
{
|
||||||
|
MinLvl = bl->minlvl;
|
||||||
if(fields[4].GetUInt32())
|
MaxLvl = bl->maxlvl;
|
||||||
MaxLvl = fields[4].GetUInt32();
|
}
|
||||||
|
|
||||||
start1 = fields[5].GetUInt32();
|
start1 = fields[5].GetUInt32();
|
||||||
|
|
||||||
@@ -1594,7 +1581,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.",bgTypeID,start1);
|
sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", bgTypeID, start1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1617,12 +1604,12 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.",bgTypeID,start2);
|
sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", bgTypeID, start2);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
|
//sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
|
||||||
if(!CreateBattleGround(bgTypeID, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
|
if(!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ class BattleGroundMgr
|
|||||||
BattleGround * GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
|
BattleGround * GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
|
||||||
BattleGround * CreateNewBattleGround(BattleGroundTypeId bgTypeId);
|
BattleGround * CreateNewBattleGround(BattleGroundTypeId bgTypeId);
|
||||||
|
|
||||||
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, 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);
|
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 AddBattleGround(uint32 InstanceID, BattleGround* BG) { m_BattleGrounds[InstanceID] = BG; };
|
||||||
void RemoveBattleGround(uint32 instanceID) { m_BattleGrounds.erase(instanceID); }
|
void RemoveBattleGround(uint32 instanceID) { m_BattleGrounds.erase(instanceID); }
|
||||||
|
|||||||
@@ -195,9 +195,10 @@ void BattleGroundNA::FillInitialWorldStates(WorldPacket &data)
|
|||||||
data << uint32(0xa11) << uint32(1); // 9
|
data << uint32(0xa11) << uint32(1); // 9
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundNA::ResetBGSubclass()
|
void BattleGroundNA::Reset()
|
||||||
{
|
{
|
||||||
|
//call parent's class reset
|
||||||
|
BattleGround::Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundNA::SetupBattleGround()
|
bool BattleGroundNA::SetupBattleGround()
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class BattleGroundNA : public BattleGround
|
|||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
virtual void ResetBGSubclass();
|
virtual void Reset();
|
||||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player *killer);
|
||||||
bool HandlePlayerUnderMap(Player * plr);
|
bool HandlePlayerUnderMap(Player * plr);
|
||||||
|
|||||||
@@ -197,9 +197,10 @@ void BattleGroundRL::FillInitialWorldStates(WorldPacket &data)
|
|||||||
data << uint32(0xbba) << uint32(1); // 9
|
data << uint32(0xbba) << uint32(1); // 9
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundRL::ResetBGSubclass()
|
void BattleGroundRL::Reset()
|
||||||
{
|
{
|
||||||
|
//call parent's reset
|
||||||
|
BattleGround::Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundRL::SetupBattleGround()
|
bool BattleGroundRL::SetupBattleGround()
|
||||||
|
|||||||
@@ -58,12 +58,12 @@ class BattleGroundRL : public BattleGround
|
|||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player *plr);
|
||||||
|
virtual void Reset();
|
||||||
|
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, uint64 guid);
|
void RemovePlayer(Player *plr, uint64 guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
virtual void ResetBGSubclass();
|
|
||||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player *killer);
|
||||||
bool HandlePlayerUnderMap(Player * plr);
|
bool HandlePlayerUnderMap(Player * plr);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -654,8 +654,11 @@ bool BattleGroundWS::SetupBattleGround()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundWS::ResetBGSubclass()
|
void BattleGroundWS::Reset()
|
||||||
{
|
{
|
||||||
|
//call parent's class reset
|
||||||
|
BattleGround::Reset();
|
||||||
|
|
||||||
m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
|
m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
|
||||||
m_FlagKeepers[BG_TEAM_HORDE] = 0;
|
m_FlagKeepers[BG_TEAM_HORDE] = 0;
|
||||||
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
|
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class BattleGroundWS : public BattleGround
|
|||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||||
void HandleKillPlayer(Player *player, Player *killer);
|
void HandleKillPlayer(Player *player, Player *killer);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
virtual void ResetBGSubclass();
|
virtual void Reset();
|
||||||
|
|
||||||
void UpdateFlagState(uint32 team, uint32 value);
|
void UpdateFlagState(uint32 team, uint32 value);
|
||||||
void UpdateTeamScore(uint32 team);
|
void UpdateTeamScore(uint32 team);
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||||||
// cleanup seting if outdated
|
// cleanup seting if outdated
|
||||||
if(!mEntry->IsBattleGroundOrArena())
|
if(!mEntry->IsBattleGroundOrArena())
|
||||||
{
|
{
|
||||||
// Do next only if found in battleground
|
|
||||||
_player->SetBattleGroundId(0); // We're not in BG.
|
_player->SetBattleGroundId(0); // We're not in BG.
|
||||||
// reset destination bg team
|
// reset destination bg team
|
||||||
_player->SetBGTeam(0);
|
_player->SetBGTeam(0);
|
||||||
|
|||||||
+5
-35
@@ -1605,7 +1605,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outDebug("Player %s will teleported to map %u", GetName(), mapid);
|
sLog.outDebug("Player %s is being teleported to map %u", GetName(), mapid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we were on a transport, leave
|
// if we were on a transport, leave
|
||||||
@@ -14600,6 +14600,10 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||||||
SetBattleGroundId(currentBg->GetInstanceID());
|
SetBattleGroundId(currentBg->GetInstanceID());
|
||||||
SetBGTeam(bgteam);
|
SetBGTeam(bgteam);
|
||||||
|
|
||||||
|
//join player to battleground group
|
||||||
|
currentBg->PlayerRelogin(this);
|
||||||
|
currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetGUID(), bgteam);
|
||||||
|
|
||||||
SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID());
|
SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -18685,40 +18689,6 @@ void Player::SendInitialPacketsAfterAddToMap()
|
|||||||
SendMessageToSet(&data,true);
|
SendMessageToSet(&data,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup BG group membership if need
|
|
||||||
if(BattleGround* currentBg = GetBattleGround())
|
|
||||||
{
|
|
||||||
// call for invited (join) or listed (relogin) and avoid other cases (GM teleport)
|
|
||||||
if (IsInvitedForBattleGroundInstance(GetBattleGroundId()) ||
|
|
||||||
currentBg->IsPlayerInBattleGround(GetGUID()))
|
|
||||||
{
|
|
||||||
currentBg->PlayerRelogin(this);
|
|
||||||
if(currentBg->GetMapId() == GetMapId()) // we teleported/login to/in bg
|
|
||||||
{
|
|
||||||
uint32 team = currentBg->GetPlayerTeam(GetGUID());
|
|
||||||
if(!team)
|
|
||||||
team = GetTeam();
|
|
||||||
Group* group = currentBg->GetBgRaid(team);
|
|
||||||
if(!group) // first player joined
|
|
||||||
{
|
|
||||||
group = new Group;
|
|
||||||
currentBg->SetBgRaid(team, group);
|
|
||||||
group->Create(GetGUIDLow(), GetName());
|
|
||||||
}
|
|
||||||
else // raid already exist
|
|
||||||
{
|
|
||||||
if(group->IsMember(GetGUID()))
|
|
||||||
{
|
|
||||||
uint8 subgroup = group->GetMemberGroup(GetGUID());
|
|
||||||
SetGroup(group, subgroup);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
currentBg->GetBgRaid(team)->AddMember(GetGUID(), GetName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SendAurasForTarget(this);
|
SendAurasForTarget(this);
|
||||||
SendEnchantmentDurations(); // must be after add to map
|
SendEnchantmentDurations(); // must be after add to map
|
||||||
SendItemDurations(); // must be after add to map
|
SendItemDurations(); // must be after add to map
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7275"
|
#define REVISION_NR "7276"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|||||||
Reference in New Issue
Block a user