[7632] more "if"-condition related codestyle in battlegroundfiles Author: balrok,Triply
this time with this regex:
sed -i 's/if *( *\(.*\) *)$/if (\1)/' BattleGround*
--HG--
branch : trunk
This commit is contained in:
+128
-128
@@ -46,7 +46,7 @@ namespace MaNGOS
|
||||
{
|
||||
char const* text = objmgr.GetMangosString(i_textId,loc_idx);
|
||||
|
||||
if(i_args)
|
||||
if (i_args)
|
||||
{
|
||||
// we need copy va_list before use or original va_list will corrupted
|
||||
va_list ap;
|
||||
@@ -121,7 +121,7 @@ template<class Do>
|
||||
void BattleGround::BroadcastWorker(Do& _do)
|
||||
{
|
||||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if(Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
|
||||
_do(plr);
|
||||
}
|
||||
|
||||
@@ -223,8 +223,8 @@ BattleGround::~BattleGround()
|
||||
|
||||
sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID());
|
||||
// unload map
|
||||
if(Map * map = MapManager::Instance().FindMap(GetMapId(), GetInstanceID()))
|
||||
if(map->IsBattleGroundOrArena())
|
||||
if (Map * map = MapManager::Instance().FindMap(GetMapId(), GetInstanceID()))
|
||||
if (map->IsBattleGroundOrArena())
|
||||
((BattleGroundMap*)map)->SetUnload();
|
||||
// remove from bg free slot queue
|
||||
this->RemoveFromBGFreeSlotQueue();
|
||||
@@ -232,17 +232,17 @@ BattleGround::~BattleGround()
|
||||
|
||||
void BattleGround::Update(uint32 diff)
|
||||
{
|
||||
if(!GetPlayersSize() && !GetReviveQueueSize())
|
||||
if (!GetPlayersSize() && !GetReviveQueueSize())
|
||||
//BG is empty
|
||||
return;
|
||||
|
||||
// remove offline players from bg after 5 minutes
|
||||
if( !m_OfflineQueue.empty() )
|
||||
if (!m_OfflineQueue.empty())
|
||||
{
|
||||
BattleGroundPlayerMap::iterator itr = m_Players.find(*(m_OfflineQueue.begin()));
|
||||
if( itr != m_Players.end() )
|
||||
if (itr != m_Players.end())
|
||||
{
|
||||
if( itr->second.OfflineRemoveTime <= sWorld.GetGameTime() )
|
||||
if (itr->second.OfflineRemoveTime <= sWorld.GetGameTime())
|
||||
{
|
||||
RemovePlayerAtLeave(itr->first, true, true);// remove player from BG
|
||||
m_OfflineQueue.pop_front(); // remove from offline queue
|
||||
@@ -259,7 +259,7 @@ void BattleGround::Update(uint32 diff)
|
||||
m_LastResurrectTime += diff;
|
||||
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
|
||||
{
|
||||
if(GetReviveQueueSize())
|
||||
if (GetReviveQueueSize())
|
||||
{
|
||||
for(std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
{
|
||||
@@ -267,7 +267,7 @@ void BattleGround::Update(uint32 diff)
|
||||
for(std::vector<uint64>::iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(*itr2);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
continue;
|
||||
|
||||
if (!sh)
|
||||
@@ -296,7 +296,7 @@ void BattleGround::Update(uint32 diff)
|
||||
for(std::vector<uint64>::iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(*itr);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
continue;
|
||||
plr->ResurrectPlayer(1.0f);
|
||||
plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true);
|
||||
@@ -310,20 +310,20 @@ void BattleGround::Update(uint32 diff)
|
||||
/*********************************************************/
|
||||
|
||||
// if less then minimum players are in on one side, then start premature finish timer
|
||||
if(GetStatus() == STATUS_IN_PROGRESS && !isArena() && sBattleGroundMgr.GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam()))
|
||||
if (GetStatus() == STATUS_IN_PROGRESS && !isArena() && sBattleGroundMgr.GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam()))
|
||||
{
|
||||
if(!m_PrematureCountDown)
|
||||
if (!m_PrematureCountDown)
|
||||
{
|
||||
m_PrematureCountDown = true;
|
||||
m_PrematureCountDownTimer = sBattleGroundMgr.GetPrematureFinishTime();
|
||||
}
|
||||
else if(m_PrematureCountDownTimer < diff)
|
||||
else if (m_PrematureCountDownTimer < diff)
|
||||
{
|
||||
// time's up!
|
||||
uint32 winner = 0;
|
||||
if( GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam() )
|
||||
if (GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam())
|
||||
winner = ALLIANCE;
|
||||
else if( GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam() )
|
||||
else if (GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam())
|
||||
winner = HORDE;
|
||||
|
||||
EndBattleGround(winner);
|
||||
@@ -333,15 +333,15 @@ void BattleGround::Update(uint32 diff)
|
||||
{
|
||||
uint32 newtime = m_PrematureCountDownTimer - diff;
|
||||
// announce every minute
|
||||
if( newtime > (MINUTE * IN_MILISECONDS) )
|
||||
if (newtime > (MINUTE * IN_MILISECONDS))
|
||||
{
|
||||
if( newtime / (MINUTE * IN_MILISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS) )
|
||||
if (newtime / (MINUTE * IN_MILISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS)));
|
||||
}
|
||||
else
|
||||
{
|
||||
//announce every 15 seconds
|
||||
if( newtime / (15 * IN_MILISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILISECONDS) )
|
||||
if (newtime / (15 * IN_MILISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILISECONDS));
|
||||
}
|
||||
m_PrematureCountDownTimer = newtime;
|
||||
@@ -363,7 +363,7 @@ void BattleGround::Update(uint32 diff)
|
||||
m_Events |= BG_STARTING_EVENT_1;
|
||||
|
||||
// setup here, only when at least one player has ported to the map
|
||||
if(!SetupBattleGround())
|
||||
if (!SetupBattleGround())
|
||||
{
|
||||
EndNow();
|
||||
return;
|
||||
@@ -398,12 +398,12 @@ void BattleGround::Update(uint32 diff)
|
||||
SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FOURTH]);
|
||||
|
||||
//remove preparation
|
||||
if( isArena() )
|
||||
if (isArena())
|
||||
{
|
||||
//TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START);
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if(Player *plr = objmgr.GetPlayer(itr->first))
|
||||
if (Player *plr = objmgr.GetPlayer(itr->first))
|
||||
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
||||
|
||||
CheckArenaWinConditions();
|
||||
@@ -414,10 +414,10 @@ void BattleGround::Update(uint32 diff)
|
||||
PlaySoundToAll(SOUND_BG_START);
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if(Player* plr = objmgr.GetPlayer(itr->first))
|
||||
if (Player* plr = objmgr.GetPlayer(itr->first))
|
||||
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
||||
//Announce BG starting
|
||||
if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) )
|
||||
if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
|
||||
{
|
||||
sWorld.SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel());
|
||||
}
|
||||
@@ -429,11 +429,11 @@ void BattleGround::Update(uint32 diff)
|
||||
/*** BATTLEGROUND ENDING SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
if(GetStatus() == STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
{
|
||||
// remove all players from battleground after 2 minutes
|
||||
m_EndTime -= diff;
|
||||
if( m_EndTime <= 0)
|
||||
if (m_EndTime <= 0)
|
||||
{
|
||||
m_EndTime = 0;
|
||||
BattleGroundPlayerMap::iterator itr, next;
|
||||
@@ -466,7 +466,7 @@ void BattleGround::SendPacketToAll(WorldPacket *packet)
|
||||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
if(plr)
|
||||
if (plr)
|
||||
plr->GetSession()->SendPacket(packet);
|
||||
else
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
@@ -479,19 +479,19 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!self && sender == plr)
|
||||
if (!self && sender == plr)
|
||||
continue;
|
||||
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
plr->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
@@ -511,7 +511,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
@@ -520,7 +520,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
{
|
||||
sBattleGroundMgr.BuildPlaySoundPacket(&data, SoundID);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
@@ -534,7 +534,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
@@ -543,7 +543,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
plr->CastSpell(plr, SpellID, true);
|
||||
}
|
||||
}
|
||||
@@ -571,7 +571,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
@@ -580,7 +580,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor);
|
||||
}
|
||||
}
|
||||
@@ -589,14 +589,14 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
||||
{
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
|
||||
|
||||
if(!factionEntry)
|
||||
if (!factionEntry)
|
||||
return;
|
||||
|
||||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
@@ -605,7 +605,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation);
|
||||
}
|
||||
}
|
||||
@@ -635,7 +635,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
WorldPacket data;
|
||||
int32 winmsg_id = 0;
|
||||
|
||||
if(winner == ALLIANCE)
|
||||
if (winner == ALLIANCE)
|
||||
{
|
||||
winmsg_id = isBattleGround() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS;
|
||||
|
||||
@@ -643,7 +643,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
|
||||
SetWinner(WINNER_ALLIANCE);
|
||||
}
|
||||
else if(winner == HORDE)
|
||||
else if (winner == HORDE)
|
||||
{
|
||||
winmsg_id = isBattleGround() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS;
|
||||
|
||||
@@ -661,11 +661,11 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
m_EndTime = TIME_TO_AUTOREMOVE;
|
||||
|
||||
// arena rating calculation
|
||||
if(isArena() && isRated())
|
||||
if (isArena() && isRated())
|
||||
{
|
||||
winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner));
|
||||
loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));
|
||||
if( winner_arena_team && loser_arena_team )
|
||||
if (winner_arena_team && loser_arena_team)
|
||||
{
|
||||
loser_rating = loser_arena_team->GetStats().rating;
|
||||
winner_rating = winner_arena_team->GetStats().rating;
|
||||
@@ -687,12 +687,12 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
uint32 team = itr->second.Team;
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
//if rated arena match - make member lost!
|
||||
if(isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
{
|
||||
if(team == winner)
|
||||
if (team == winner)
|
||||
winner_arena_team->OfflineMemberLost(itr->first, loser_rating);
|
||||
else
|
||||
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
|
||||
@@ -705,7 +705,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
|
||||
if(!plr->isAlive())
|
||||
if (!plr->isAlive())
|
||||
{
|
||||
plr->ResurrectPlayer(1.0f);
|
||||
plr->SpawnCorpseBones();
|
||||
@@ -715,15 +715,15 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
//if(!team) team = plr->GetTeam();
|
||||
|
||||
// per player calculation
|
||||
if(isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
{
|
||||
if(team == winner)
|
||||
if (team == winner)
|
||||
winner_arena_team->MemberWon(plr,loser_rating);
|
||||
else
|
||||
loser_arena_team->MemberLost(plr,winner_rating);
|
||||
}
|
||||
|
||||
if(team == winner)
|
||||
if (team == winner)
|
||||
{
|
||||
RewardMark(plr,ITEM_WINNER_COUNT);
|
||||
RewardQuest(plr);
|
||||
@@ -746,7 +746,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
|
||||
}
|
||||
|
||||
if(isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
{
|
||||
// update arena points only after increasing the player's match count!
|
||||
//obsolete: winner_arena_team->UpdateArenaPointsHelper();
|
||||
@@ -760,7 +760,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
loser_arena_team->NotifyStatsChanged();
|
||||
}
|
||||
|
||||
if(winmsg_id)
|
||||
if (winmsg_id)
|
||||
SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
|
||||
@@ -786,7 +786,7 @@ uint32 BattleGround::GetBattlemasterEntry() const
|
||||
void BattleGround::RewardMark(Player *plr,uint32 count)
|
||||
{
|
||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||
if(plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
return;
|
||||
|
||||
if(!plr || !count)
|
||||
@@ -823,7 +823,7 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
||||
if(Item* item = plr->StoreNewItem( dest, mark, true, 0))
|
||||
plr->SendNewItem(item,count,false,true);
|
||||
|
||||
if(no_space_count > 0)
|
||||
if (no_space_count > 0)
|
||||
SendRewardMarkByMail(plr,mark,no_space_count);
|
||||
}
|
||||
}
|
||||
@@ -831,14 +831,14 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
||||
void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
|
||||
{
|
||||
uint32 bmEntry = GetBattlemasterEntry();
|
||||
if(!bmEntry)
|
||||
if (!bmEntry)
|
||||
return;
|
||||
|
||||
ItemPrototype const* markProto = objmgr.GetItemPrototype(mark);
|
||||
if(!markProto)
|
||||
if (!markProto)
|
||||
return;
|
||||
|
||||
if(Item* markItem = Item::CreateItem(mark,count,plr))
|
||||
if (Item* markItem = Item::CreateItem(mark,count,plr))
|
||||
{
|
||||
// save new item before send
|
||||
markItem->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
|
||||
@@ -850,8 +850,8 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
|
||||
// subject: item name
|
||||
std::string subject = markProto->Name1;
|
||||
int loc_idx = plr->GetSession()->GetSessionDbLocaleIndex();
|
||||
if ( loc_idx >= 0 )
|
||||
if(ItemLocale const *il = objmgr.GetItemLocale(markProto->ItemId))
|
||||
if (loc_idx >= 0 )
|
||||
if (ItemLocale const *il = objmgr.GetItemLocale(markProto->ItemId))
|
||||
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
|
||||
subject = il->Name[loc_idx];
|
||||
|
||||
@@ -868,7 +868,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
|
||||
void BattleGround::RewardQuest(Player *plr)
|
||||
{
|
||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||
if(plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
return;
|
||||
|
||||
uint32 quest;
|
||||
@@ -904,7 +904,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
bool participant = false;
|
||||
// Remove from lists/maps
|
||||
BattleGroundPlayerMap::iterator itr = m_Players.find(guid);
|
||||
if(itr != m_Players.end())
|
||||
if (itr != m_Players.end())
|
||||
{
|
||||
UpdatePlayersCountByTeam(team, true); // -1 player
|
||||
m_Players.erase(itr);
|
||||
@@ -913,7 +913,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
}
|
||||
|
||||
std::map<uint64, BattleGroundScore*>::iterator itr2 = m_PlayerScores.find(guid);
|
||||
if(itr2 != m_PlayerScores.end())
|
||||
if (itr2 != m_PlayerScores.end())
|
||||
{
|
||||
delete itr2->second; // delete player's score
|
||||
m_PlayerScores.erase(itr2);
|
||||
@@ -939,14 +939,14 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
{
|
||||
BattleGroundTypeId bgTypeId = GetTypeID();
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
if(plr)
|
||||
if (plr)
|
||||
{
|
||||
plr->ClearAfkReports();
|
||||
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
// if arena, remove the specific arena auras
|
||||
if(isArena())
|
||||
if (isArena())
|
||||
{
|
||||
plr->RemoveArenaAuras(true); // removes debuffs / dots etc., we don't want the player to die after porting out
|
||||
bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing)
|
||||
@@ -961,16 +961,16 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
(plr)->SetTemporaryUnsummonedPetNumber(0);
|
||||
}
|
||||
|
||||
if(isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
//left a rated match while the encounter was in progress, consider as loser
|
||||
ArenaTeam * winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam * loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if(winner_arena_team && loser_arena_team)
|
||||
if (winner_arena_team && loser_arena_team)
|
||||
loser_arena_team->MemberLost(plr,winner_arena_team->GetRating());
|
||||
}
|
||||
}
|
||||
if(SendPacket)
|
||||
if (SendPacket)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
|
||||
@@ -983,18 +983,18 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
else
|
||||
// removing offline participant
|
||||
{
|
||||
if(isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
//left a rated match while the encounter was in progress, consider as loser
|
||||
ArenaTeam * others_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam * players_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if( others_arena_team && players_arena_team )
|
||||
if (others_arena_team && players_arena_team)
|
||||
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
|
||||
}
|
||||
}
|
||||
|
||||
// remove from raid group if player is member
|
||||
if(Group *group = GetBgRaid(team))
|
||||
if (Group *group = GetBgRaid(team))
|
||||
{
|
||||
if( !group->RemoveMember(guid, 0) ) // group was disbanded
|
||||
{
|
||||
@@ -1004,7 +1004,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
}
|
||||
DecreaseInvitedCount(team);
|
||||
//we should update battleground queue, but only if bg isn't ending
|
||||
if( isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE )
|
||||
if (isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId());
|
||||
// Let others know
|
||||
WorldPacket data;
|
||||
@@ -1012,20 +1012,20 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
SendPacketToTeam(team, &data, plr, false);
|
||||
}
|
||||
|
||||
if( plr )
|
||||
if (plr)
|
||||
{
|
||||
// Do next only if found in battleground
|
||||
plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
|
||||
// reset destination bg team
|
||||
plr->SetBGTeam(0);
|
||||
|
||||
if(Transport)
|
||||
if (Transport)
|
||||
plr->TeleportTo(plr->GetBattleGroundEntryPoint());
|
||||
|
||||
sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName());
|
||||
}
|
||||
|
||||
if(!GetPlayersSize() && !GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
|
||||
if (!GetPlayersSize() && !GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
|
||||
{
|
||||
// if no players left AND no invitees left, set this bg to delete in next update
|
||||
// direct deletion could cause crashes
|
||||
@@ -1092,21 +1092,21 @@ void BattleGround::AddPlayer(Player *plr)
|
||||
SendPacketToTeam(team, &data, plr, false);
|
||||
|
||||
// add arena specific auras
|
||||
if(isArena())
|
||||
if (isArena())
|
||||
{
|
||||
plr->RemoveArenaSpellCooldowns();
|
||||
plr->RemoveArenaAuras();
|
||||
plr->RemoveAllEnchantments(TEMP_ENCHANTMENT_SLOT);
|
||||
if(team == ALLIANCE) // gold
|
||||
{
|
||||
if(plr->GetTeam() == HORDE)
|
||||
if (plr->GetTeam() == HORDE)
|
||||
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG,true);
|
||||
else
|
||||
plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG,true);
|
||||
}
|
||||
else // green
|
||||
{
|
||||
if(plr->GetTeam() == HORDE)
|
||||
if (plr->GetTeam() == HORDE)
|
||||
plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG,true);
|
||||
else
|
||||
plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG,true);
|
||||
@@ -1115,9 +1115,9 @@ void BattleGround::AddPlayer(Player *plr)
|
||||
plr->DestroyConjuredItems(true);
|
||||
|
||||
Pet* pet = plr->GetPet();
|
||||
if(pet)
|
||||
if (pet)
|
||||
{
|
||||
if(pet->getPetType() == SUMMON_PET || pet->getPetType() == HUNTER_PET)
|
||||
if (pet->getPetType() == SUMMON_PET || pet->getPetType() == HUNTER_PET)
|
||||
{
|
||||
(plr)->SetTemporaryUnsummonedPetNumber(pet->GetCharmInfo()->GetPetNumber());
|
||||
(plr)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL));
|
||||
@@ -1161,7 +1161,7 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid,
|
||||
}
|
||||
else // raid already exist
|
||||
{
|
||||
if(group->IsMember(plr_guid))
|
||||
if (group->IsMember(plr_guid))
|
||||
{
|
||||
uint8 subgroup = group->GetMemberGroup(plr_guid);
|
||||
plr->SetBattleGroundRaid(group, subgroup);
|
||||
@@ -1169,8 +1169,8 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid,
|
||||
else
|
||||
{
|
||||
group->AddMember(plr_guid, plr->GetName());
|
||||
if( Group* originalGroup = plr->GetOriginalGroup() )
|
||||
if( originalGroup->IsLeader(plr_guid) )
|
||||
if (Group* originalGroup = plr->GetOriginalGroup())
|
||||
if (originalGroup->IsLeader(plr_guid))
|
||||
group->ChangeLeader(plr_guid);
|
||||
}
|
||||
}
|
||||
@@ -1182,7 +1182,7 @@ void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid)
|
||||
// player is correct pointer
|
||||
for(std::deque<uint64>::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
|
||||
{
|
||||
if( *itr == plr_guid )
|
||||
if (*itr == plr_guid)
|
||||
{
|
||||
m_OfflineQueue.erase(itr);
|
||||
break;
|
||||
@@ -1200,14 +1200,14 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
|
||||
// player is correct pointer, it is checked in WorldSession::LogoutPlayer()
|
||||
m_OfflineQueue.push_back(player->GetGUID());
|
||||
m_Players[player->GetGUID()].OfflineRemoveTime = sWorld.GetGameTime() + MAX_OFFLINE_TIME;
|
||||
if( GetStatus() == STATUS_IN_PROGRESS )
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
if( isBattleGround() )
|
||||
if (isBattleGround())
|
||||
EventPlayerDroppedFlag(player);
|
||||
else
|
||||
{
|
||||
//1 player is logging out, if it is the last, then end arena!
|
||||
if( GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())) )
|
||||
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
|
||||
EndBattleGround(GetOtherTeam(player->GetTeam()));
|
||||
}
|
||||
}
|
||||
@@ -1217,7 +1217,7 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
|
||||
void BattleGround::AddToBGFreeSlotQueue()
|
||||
{
|
||||
// make sure to add only once
|
||||
if(!m_InBGFreeSlotQueue && isBattleGround())
|
||||
if (!m_InBGFreeSlotQueue && isBattleGround())
|
||||
{
|
||||
sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].push_front(this);
|
||||
m_InBGFreeSlotQueue = true;
|
||||
@@ -1277,10 +1277,10 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
|
||||
break;
|
||||
case SCORE_BONUS_HONOR: // Honor bonus
|
||||
// do not add honor in arenas
|
||||
if(isBattleGround())
|
||||
if (isBattleGround())
|
||||
{
|
||||
// reward honor instantly
|
||||
if(Source->RewardHonor(NULL, 1, value))
|
||||
if (Source->RewardHonor(NULL, 1, value))
|
||||
itr->second->BonusHonor += value;
|
||||
}
|
||||
break;
|
||||
@@ -1302,11 +1302,11 @@ void BattleGround::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
|
||||
m_ReviveQueue[npc_guid].push_back(player_guid);
|
||||
|
||||
Player *plr = objmgr.GetPlayer(player_guid);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry( SPELL_WAITING_FOR_RESURRECT );
|
||||
if(spellInfo)
|
||||
if (spellInfo)
|
||||
{
|
||||
Aura *Aur = new Aura(spellInfo, 1, NULL, plr);
|
||||
plr->AddAura(Aur);
|
||||
@@ -1319,12 +1319,12 @@ void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid)
|
||||
{
|
||||
for(std::vector<uint64>::iterator itr2 =(itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
{
|
||||
if(*itr2 == player_guid)
|
||||
if (*itr2 == player_guid)
|
||||
{
|
||||
(itr->second).erase(itr2);
|
||||
|
||||
Player *plr = objmgr.GetPlayer(player_guid);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
|
||||
@@ -1338,7 +1338,7 @@ void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid)
|
||||
bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
|
||||
if(!map)
|
||||
if (!map)
|
||||
return false;
|
||||
|
||||
// must be created this way, adding to godatamap would add it to the base map of the instance
|
||||
@@ -1386,10 +1386,10 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
|
||||
void BattleGround::DoorClose(uint32 type)
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
//if doors are open, close it
|
||||
if( obj->getLootState() == GO_ACTIVATED && !obj->GetGoState() )
|
||||
if (obj->getLootState() == GO_ACTIVATED && !obj->GetGoState())
|
||||
{
|
||||
//change state to allow door to be closed
|
||||
obj->SetLootState(GO_READY);
|
||||
@@ -1405,7 +1405,7 @@ void BattleGround::DoorClose(uint32 type)
|
||||
void BattleGround::DoorOpen(uint32 type)
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
//change state to be sure they will be opened
|
||||
obj->SetLootState(GO_READY);
|
||||
@@ -1436,15 +1436,15 @@ Creature* BattleGround::GetBGCreature(uint32 type)
|
||||
void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
|
||||
if(!map)
|
||||
if (!map)
|
||||
return;
|
||||
if( respawntime == 0 )
|
||||
if (respawntime == 0)
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
//we need to change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
|
||||
if( obj->getLootState() == GO_JUST_DEACTIVATED )
|
||||
if (obj->getLootState() == GO_JUST_DEACTIVATED)
|
||||
obj->SetLootState(GO_READY);
|
||||
obj->SetRespawnTime(0);
|
||||
map->Add(obj);
|
||||
@@ -1453,7 +1453,7 @@ void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
|
||||
else
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
map->Add(obj);
|
||||
obj->SetRespawnTime(respawntime);
|
||||
@@ -1465,7 +1465,7 @@ void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
|
||||
Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
|
||||
if(!map)
|
||||
if (!map)
|
||||
return NULL;
|
||||
|
||||
Creature* pCreature = new Creature;
|
||||
@@ -1478,7 +1478,7 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
|
||||
|
||||
pCreature->Relocate(x, y, z, o);
|
||||
|
||||
if(!pCreature->IsPositionValid())
|
||||
if (!pCreature->IsPositionValid())
|
||||
{
|
||||
sLog.outError("Creature (guidlow %d, entry %d) not added to battleground. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY());
|
||||
delete pCreature;
|
||||
@@ -1498,13 +1498,13 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
|
||||
void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceId());
|
||||
if(!map)
|
||||
if (!map)
|
||||
return false;
|
||||
|
||||
if(respawntime == 0)
|
||||
if (respawntime == 0)
|
||||
{
|
||||
Creature *obj = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
//obj->Respawn(); // bugged
|
||||
obj->SetRespawnTime(0);
|
||||
@@ -1515,7 +1515,7 @@ void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
|
||||
else
|
||||
{
|
||||
Creature *obj = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
obj->setDeathState(DEAD);
|
||||
obj->SetRespawnTime(respawntime);
|
||||
@@ -1526,11 +1526,11 @@ void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
|
||||
*/
|
||||
bool BattleGround::DelCreature(uint32 type)
|
||||
{
|
||||
if(!m_BgCreatures[type])
|
||||
if (!m_BgCreatures[type])
|
||||
return true;
|
||||
|
||||
Creature *cr = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
|
||||
if(!cr)
|
||||
if (!cr)
|
||||
{
|
||||
sLog.outError("Can't find creature guid: %u",GUID_LOPART(m_BgCreatures[type]));
|
||||
return false;
|
||||
@@ -1544,11 +1544,11 @@ bool BattleGround::DelCreature(uint32 type)
|
||||
|
||||
bool BattleGround::DelObject(uint32 type)
|
||||
{
|
||||
if(!m_BgObjects[type])
|
||||
if (!m_BgObjects[type])
|
||||
return true;
|
||||
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(!obj)
|
||||
if (!obj)
|
||||
{
|
||||
sLog.outError("Can't find gobject guid: %u",GUID_LOPART(m_BgObjects[type]));
|
||||
return false;
|
||||
@@ -1563,13 +1563,13 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float
|
||||
{
|
||||
uint32 entry = 0;
|
||||
|
||||
if(team == ALLIANCE)
|
||||
if (team == ALLIANCE)
|
||||
entry = 13116;
|
||||
else
|
||||
entry = 13117;
|
||||
|
||||
Creature* pCreature = AddCreature(entry,type,team,x,y,z,o);
|
||||
if(!pCreature)
|
||||
if (!pCreature)
|
||||
{
|
||||
sLog.outError("Can't create Spirit guide. BattleGround not created!");
|
||||
EndNow();
|
||||
@@ -1644,7 +1644,7 @@ buffs are in their positions when battleground starts
|
||||
void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(go_guid);
|
||||
if(!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
|
||||
if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
|
||||
return;
|
||||
|
||||
//change buff type, when buff is used:
|
||||
@@ -1660,13 +1660,13 @@ void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
|
||||
//randomly select new buff
|
||||
uint8 buff = urand(0, 2);
|
||||
uint32 entry = obj->GetEntry();
|
||||
if( m_BuffChange && entry != Buff_Entries[buff] )
|
||||
if (m_BuffChange && entry != Buff_Entries[buff])
|
||||
{
|
||||
//despawn current buff
|
||||
SpawnBGObject(index, RESPAWN_ONE_DAY);
|
||||
//set index for new one
|
||||
for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex)
|
||||
if( entry == Buff_Entries[currBuffTypeIndex] )
|
||||
if (entry == Buff_Entries[currBuffTypeIndex])
|
||||
{
|
||||
index -= currBuffTypeIndex;
|
||||
index += buff;
|
||||
@@ -1684,7 +1684,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
||||
UpdatePlayerScore(player, SCORE_DEATHS, 1);
|
||||
|
||||
// add +1 kills to group and +1 killing_blows to killer
|
||||
if( killer )
|
||||
if (killer)
|
||||
{
|
||||
UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1);
|
||||
UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1);
|
||||
@@ -1693,16 +1693,16 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr || plr == killer)
|
||||
if (!plr || plr == killer)
|
||||
continue;
|
||||
|
||||
if( plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player) )
|
||||
if (plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player))
|
||||
UpdatePlayerScore(plr, SCORE_HONORABLE_KILLS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// to be able to remove insignia -- ONLY IN BattleGrounds
|
||||
if( !isArena() )
|
||||
if (!isArena())
|
||||
player->SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE );
|
||||
}
|
||||
|
||||
@@ -1711,7 +1711,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
||||
uint32 BattleGround::GetPlayerTeam(uint64 guid)
|
||||
{
|
||||
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
|
||||
if(itr!=m_Players.end())
|
||||
if (itr!=m_Players.end())
|
||||
return itr->second.Team;
|
||||
return 0;
|
||||
}
|
||||
@@ -1724,14 +1724,14 @@ uint32 BattleGround::GetOtherTeam(uint32 teamId)
|
||||
bool BattleGround::IsPlayerInBattleGround(uint64 guid)
|
||||
{
|
||||
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
|
||||
if(itr != m_Players.end())
|
||||
if (itr != m_Players.end())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
|
||||
{
|
||||
if(GetStatus() != STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() != STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
@@ -1751,10 +1751,10 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
|
||||
int count = 0;
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if(itr->second.Team == Team)
|
||||
if (itr->second.Team == Team)
|
||||
{
|
||||
Player * pl = objmgr.GetPlayer(itr->first);
|
||||
if(pl && pl->isAlive())
|
||||
if (pl && pl->isAlive())
|
||||
++count;
|
||||
}
|
||||
}
|
||||
@@ -1784,9 +1784,9 @@ void BattleGround::HandleKillUnit(Creature *creature, Player *killer)
|
||||
|
||||
void BattleGround::CheckArenaWinConditions()
|
||||
{
|
||||
if( !GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE) )
|
||||
if (!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
|
||||
EndBattleGround(HORDE);
|
||||
else if( GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE) )
|
||||
else if (GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
|
||||
EndBattleGround(ALLIANCE);
|
||||
}
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ class BattleGround
|
||||
void IncreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; }
|
||||
uint32 GetInvitedCount(uint32 team) const
|
||||
{
|
||||
if( team == ALLIANCE )
|
||||
if (team == ALLIANCE)
|
||||
return m_InvitedAlliance;
|
||||
else
|
||||
return m_InvitedHorde;
|
||||
@@ -444,7 +444,7 @@ class BattleGround
|
||||
uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
|
||||
void UpdatePlayersCountByTeam(uint32 Team, bool remove)
|
||||
{
|
||||
if(remove)
|
||||
if (remove)
|
||||
--m_PlayersCount[GetTeamIndexByTeamId(Team)];
|
||||
else
|
||||
++m_PlayersCount[GetTeamIndexByTeamId(Team)];
|
||||
|
||||
+59
-59
@@ -60,16 +60,16 @@ void BattleGroundAB::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if( GetStatus() == STATUS_IN_PROGRESS )
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
|
||||
|
||||
for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
{
|
||||
// 3 sec delay to spawn new banner instead previous despawned one
|
||||
if( m_BannerTimers[node].timer )
|
||||
if (m_BannerTimers[node].timer)
|
||||
{
|
||||
if( m_BannerTimers[node].timer > diff )
|
||||
if (m_BannerTimers[node].timer > diff)
|
||||
m_BannerTimers[node].timer -= diff;
|
||||
else
|
||||
{
|
||||
@@ -79,9 +79,9 @@ void BattleGroundAB::Update(uint32 diff)
|
||||
}
|
||||
|
||||
// 1-minute to occupy a node from contested state
|
||||
if( m_NodeTimers[node] )
|
||||
if (m_NodeTimers[node])
|
||||
{
|
||||
if( m_NodeTimers[node] > diff )
|
||||
if (m_NodeTimers[node] > diff)
|
||||
m_NodeTimers[node] -= diff;
|
||||
else
|
||||
{
|
||||
@@ -98,7 +98,7 @@ void BattleGroundAB::Update(uint32 diff)
|
||||
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
|
||||
// Message to chatlog
|
||||
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
{
|
||||
// FIXME: team and node names not localized
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_AB_ALLY,_GetNodeNameId(node));
|
||||
@@ -114,7 +114,7 @@ void BattleGroundAB::Update(uint32 diff)
|
||||
}
|
||||
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
if( m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED )
|
||||
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
|
||||
++team_points[team];
|
||||
}
|
||||
|
||||
@@ -122,28 +122,28 @@ void BattleGroundAB::Update(uint32 diff)
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
{
|
||||
int points = team_points[team];
|
||||
if( !points )
|
||||
if (!points)
|
||||
continue;
|
||||
m_lastTick[team] += diff;
|
||||
if( m_lastTick[team] > BG_AB_TickIntervals[points] )
|
||||
if (m_lastTick[team] > BG_AB_TickIntervals[points])
|
||||
{
|
||||
m_lastTick[team] -= BG_AB_TickIntervals[points];
|
||||
m_TeamScores[team] += BG_AB_TickPoints[points];
|
||||
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
|
||||
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
|
||||
if( m_ReputationScoreTics[team] >= m_ReputationTics )
|
||||
if (m_ReputationScoreTics[team] >= m_ReputationTics)
|
||||
{
|
||||
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
|
||||
m_ReputationScoreTics[team] -= m_ReputationTics;
|
||||
}
|
||||
if( m_HonorScoreTics[team] >= m_HonorTics )
|
||||
if (m_HonorScoreTics[team] >= m_HonorTics)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
|
||||
m_HonorScoreTics[team] -= m_HonorTics;
|
||||
}
|
||||
if( !m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE )
|
||||
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
|
||||
{
|
||||
if( team == BG_TEAM_ALLIANCE )
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
@@ -151,19 +151,19 @@ void BattleGroundAB::Update(uint32 diff)
|
||||
m_IsInformedNearVictory = true;
|
||||
}
|
||||
|
||||
if( m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE )
|
||||
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
|
||||
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
|
||||
if( team == BG_TEAM_ALLIANCE )
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
|
||||
if( team == BG_TEAM_HORDE )
|
||||
if (team == BG_TEAM_HORDE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
|
||||
}
|
||||
}
|
||||
|
||||
// Test win condition
|
||||
if( m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE )
|
||||
if (m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleGround(ALLIANCE);
|
||||
if( m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE )
|
||||
if (m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleGround(HORDE);
|
||||
}
|
||||
}
|
||||
@@ -218,19 +218,19 @@ void BattleGroundAB::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
|
||||
|
||||
void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if( GetStatus() != STATUS_IN_PROGRESS )
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
switch(Trigger)
|
||||
{
|
||||
case 3948: // Arathi Basin Alliance Exit.
|
||||
if( Source->GetTeam() != ALLIANCE )
|
||||
if (Source->GetTeam() != ALLIANCE)
|
||||
Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
|
||||
else
|
||||
Source->LeaveBattleground();
|
||||
break;
|
||||
case 3949: // Arathi Basin Horde Exit.
|
||||
if( Source->GetTeam() != HORDE )
|
||||
if (Source->GetTeam() != HORDE)
|
||||
Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
|
||||
else
|
||||
Source->LeaveBattleground();
|
||||
@@ -255,7 +255,7 @@ void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
|
||||
{
|
||||
// Just put it into the queue
|
||||
if( delay )
|
||||
if (delay)
|
||||
{
|
||||
m_BannerTimers[node].timer = 2000;
|
||||
m_BannerTimers[node].type = type;
|
||||
@@ -268,7 +268,7 @@ void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool
|
||||
SpawnBGObject(obj, RESPAWN_IMMEDIATELY);
|
||||
|
||||
// handle aura with banner
|
||||
if( !type )
|
||||
if (!type)
|
||||
return;
|
||||
obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
|
||||
SpawnBGObject(obj, RESPAWN_IMMEDIATELY);
|
||||
@@ -280,7 +280,7 @@ void BattleGroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex)
|
||||
SpawnBGObject(obj, RESPAWN_ONE_DAY);
|
||||
|
||||
// handle aura with banner
|
||||
if( !type )
|
||||
if (!type)
|
||||
return;
|
||||
obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
|
||||
SpawnBGObject(obj, RESPAWN_ONE_DAY);
|
||||
@@ -317,9 +317,9 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data)
|
||||
// How many bases each team owns
|
||||
uint8 ally = 0, horde = 0;
|
||||
for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
if( m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED )
|
||||
if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||
++ally;
|
||||
else if( m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED )
|
||||
else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||
++horde;
|
||||
|
||||
data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(ally);
|
||||
@@ -340,7 +340,7 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
||||
// Send node owner state update to refresh map icons on client
|
||||
const uint8 plusArray[] = {0, 2, 3, 0, 1};
|
||||
|
||||
if( m_prevNodes[node] )
|
||||
if (m_prevNodes[node])
|
||||
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0);
|
||||
else
|
||||
UpdateWorldState(BG_AB_OP_NODEICONS[node], 0);
|
||||
@@ -350,9 +350,9 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
||||
// How many bases each team owns
|
||||
uint8 ally = 0, horde = 0;
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if( m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED )
|
||||
if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||
++ally;
|
||||
else if( m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED )
|
||||
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||
++horde;
|
||||
|
||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
||||
@@ -361,30 +361,30 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
||||
|
||||
void BattleGroundAB::_NodeOccupied(uint8 node,Team team)
|
||||
{
|
||||
if( !AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team) )
|
||||
if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team))
|
||||
sLog.outError("Failed to spawn spirit guide! point: %u, team: %u,", node, team);
|
||||
// SpawnBGCreature(node,RESPAWN_IMMEDIATELY);
|
||||
|
||||
uint8 capturedNodes = 0;
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if( m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
|
||||
if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
|
||||
++capturedNodes;
|
||||
}
|
||||
if(capturedNodes >= 5)
|
||||
if (capturedNodes >= 5)
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
|
||||
if(capturedNodes >= 4)
|
||||
if (capturedNodes >= 4)
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
|
||||
}
|
||||
|
||||
void BattleGroundAB::_NodeDeOccupied(uint8 node)
|
||||
{
|
||||
if( node >= BG_AB_DYNAMIC_NODES_COUNT)
|
||||
if (node >= BG_AB_DYNAMIC_NODES_COUNT)
|
||||
return;
|
||||
|
||||
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
|
||||
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
|
||||
if( !ghost_list.empty() )
|
||||
if (!ghost_list.empty())
|
||||
{
|
||||
WorldSafeLocsEntry const *ClosestGrave = NULL;
|
||||
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
|
||||
@@ -401,7 +401,7 @@ void BattleGroundAB::_NodeDeOccupied(uint8 node)
|
||||
}
|
||||
}
|
||||
|
||||
if( m_BgCreatures[node] )
|
||||
if (m_BgCreatures[node])
|
||||
DelCreature(node);
|
||||
|
||||
// buff object isn't despawned
|
||||
@@ -410,7 +410,7 @@ void BattleGroundAB::_NodeDeOccupied(uint8 node)
|
||||
/* Invoked if a player used a banner as a gameobject */
|
||||
void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/)
|
||||
{
|
||||
if( GetStatus() != STATUS_IN_PROGRESS )
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint8 node = BG_AB_NODE_STABLES;
|
||||
@@ -421,7 +421,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
||||
obj=HashMapHolder<GameObject>::Find(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]);
|
||||
}
|
||||
|
||||
if( node == BG_AB_DYNAMIC_NODES_COUNT)
|
||||
if (node == BG_AB_DYNAMIC_NODES_COUNT)
|
||||
{
|
||||
// this means our player isn't close to any of banners - maybe cheater ??
|
||||
return;
|
||||
@@ -430,13 +430,13 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
||||
uint8 teamIndex = GetTeamIndexByTeamId(source->GetTeam());
|
||||
|
||||
// Check if player really could use this banner, not cheated
|
||||
if( !(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2) )
|
||||
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
|
||||
return;
|
||||
|
||||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
uint32 sound = 0;
|
||||
// If node is neutral, change to contested
|
||||
if( m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL )
|
||||
if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL)
|
||||
{
|
||||
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
|
||||
m_prevNodes[node] = m_Nodes[node];
|
||||
@@ -449,7 +449,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: team and node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY);
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE);
|
||||
@@ -457,10 +457,10 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
||||
sound = BG_AB_SOUND_NODE_CLAIMED;
|
||||
}
|
||||
// If node is contested
|
||||
else if( (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED) )
|
||||
else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED))
|
||||
{
|
||||
// If last state is NOT occupied, change node to enemy-contested
|
||||
if( m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED )
|
||||
if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED)
|
||||
{
|
||||
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
|
||||
m_prevNodes[node] = m_Nodes[node];
|
||||
@@ -473,7 +473,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
@@ -493,7 +493,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
||||
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
|
||||
|
||||
// FIXME: node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
@@ -515,7 +515,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
@@ -524,10 +524,10 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
||||
}
|
||||
|
||||
// If node is occupied again, send "X has taken the Y" msg.
|
||||
if( m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED )
|
||||
if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
|
||||
{
|
||||
// FIXME: team and node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node));
|
||||
@@ -539,7 +539,7 @@ bool BattleGroundAB::SetupBattleGround()
|
||||
{
|
||||
for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if( !AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i,BG_AB_OBJECTID_NODE_BANNER_0 + i,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i,BG_AB_OBJECTID_NODE_BANNER_0 + i,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i,BG_AB_OBJECTID_BANNER_CONT_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i,BG_AB_OBJECTID_BANNER_CONT_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i,BG_AB_OBJECTID_BANNER_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
@@ -553,7 +553,7 @@ bool BattleGroundAB::SetupBattleGround()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if( !AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_AB_OBJECT_GATE_H,BG_AB_OBJECTID_GATE_H,BG_AB_DoorPositions[1][0],BG_AB_DoorPositions[1][1],BG_AB_DoorPositions[1][2],BG_AB_DoorPositions[1][3],BG_AB_DoorPositions[1][4],BG_AB_DoorPositions[1][5],BG_AB_DoorPositions[1][6],BG_AB_DoorPositions[1][7],RESPAWN_IMMEDIATELY)
|
||||
)
|
||||
{
|
||||
@@ -563,7 +563,7 @@ bool BattleGroundAB::SetupBattleGround()
|
||||
//buffs
|
||||
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if( !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
)
|
||||
@@ -600,16 +600,16 @@ void BattleGroundAB::Reset()
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT; ++i)
|
||||
if(m_BgCreatures[i])
|
||||
if (m_BgCreatures[i])
|
||||
DelCreature(i);
|
||||
}
|
||||
|
||||
void BattleGroundAB::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if( winner == ALLIANCE )
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if( winner == HORDE )
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
@@ -625,12 +625,12 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||
// Is there any occupied node for this team?
|
||||
std::vector<uint8> nodes;
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if( m_Nodes[i] == teamIndex + 3 )
|
||||
if (m_Nodes[i] == teamIndex + 3)
|
||||
nodes.push_back(i);
|
||||
|
||||
WorldSafeLocsEntry const* good_entry = NULL;
|
||||
// If so, select the closest node to place ghost on
|
||||
if( !nodes.empty() )
|
||||
if (!nodes.empty())
|
||||
{
|
||||
float plr_x = player->GetPositionX();
|
||||
float plr_y = player->GetPositionY();
|
||||
@@ -639,10 +639,10 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||
for (uint8 i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[nodes[i]] );
|
||||
if( !entry )
|
||||
if (!entry)
|
||||
continue;
|
||||
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
|
||||
if( mindist > dist )
|
||||
if (mindist > dist)
|
||||
{
|
||||
mindist = dist;
|
||||
good_entry = entry;
|
||||
@@ -651,7 +651,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||
nodes.clear();
|
||||
}
|
||||
// If not, place ghost on starting location
|
||||
if( !good_entry )
|
||||
if (!good_entry)
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[teamIndex+5] );
|
||||
|
||||
return good_entry;
|
||||
|
||||
@@ -543,7 +543,7 @@ void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
|
||||
void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 SpellId = 0;
|
||||
@@ -576,7 +576,7 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
break;
|
||||
}
|
||||
|
||||
if(SpellId)
|
||||
if (SpellId)
|
||||
Source->CastSpell(Source, SpellId, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ void BattleGroundBE::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
/*if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
/*if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
// update something
|
||||
}*/
|
||||
@@ -88,7 +88,7 @@ void BattleGroundBE::AddPlayer(Player *plr)
|
||||
|
||||
void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if(GetStatus() == STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
@@ -99,10 +99,10 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
|
||||
void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if(!killer)
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("Killer player not found");
|
||||
return;
|
||||
@@ -125,7 +125,7 @@ bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
|
||||
void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
@@ -144,7 +144,7 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
break;
|
||||
}
|
||||
|
||||
//if(buff_guid)
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ void BattleGroundBE::Reset()
|
||||
bool BattleGroundBE::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
if( !AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_2, BG_BE_OBJECT_TYPE_DOOR_2, 6189.546f, 241.7099f, 3.101481f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_3, BG_BE_OBJECT_TYPE_DOOR_3, 6299.116f, 296.5494f, 3.308032f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_4, BG_BE_OBJECT_TYPE_DOOR_4, 6177.708f, 227.3481f, 3.604374f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|
||||
|
||||
+59
-59
@@ -59,10 +59,10 @@ void BattleGroundEY::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if( GetStatus() == STATUS_IN_PROGRESS )
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
m_PointAddingTimer -= diff;
|
||||
if(m_PointAddingTimer <= 0)
|
||||
if (m_PointAddingTimer <= 0)
|
||||
{
|
||||
m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME;
|
||||
if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0)
|
||||
@@ -71,11 +71,11 @@ void BattleGroundEY::Update(uint32 diff)
|
||||
AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]);
|
||||
}
|
||||
|
||||
if(m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsTimer -= diff;
|
||||
|
||||
if(m_FlagsTimer < 0)
|
||||
if (m_FlagsTimer < 0)
|
||||
{
|
||||
m_FlagsTimer = 0;
|
||||
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN)
|
||||
@@ -86,7 +86,7 @@ void BattleGroundEY::Update(uint32 diff)
|
||||
}
|
||||
|
||||
m_TowerCapCheckTimer -= diff;
|
||||
if(m_TowerCapCheckTimer <= 0)
|
||||
if (m_TowerCapCheckTimer <= 0)
|
||||
{
|
||||
//check if player joined point
|
||||
/*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times
|
||||
@@ -150,7 +150,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
|
||||
while (j < m_PlayersNearPoint[EY_POINTS_MAX].size())
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Player " I64FMTD " not found!", m_PlayersNearPoint[EY_POINTS_MAX][j]);
|
||||
++j;
|
||||
@@ -184,7 +184,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
|
||||
for(uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REALVER + i]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
uint8 j = 0;
|
||||
while (j < m_PlayersNearPoint[i].size())
|
||||
@@ -268,9 +268,9 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
|
||||
{
|
||||
uint32 score = GetTeamScore(Team);
|
||||
//TODO there should be some sound played when one team is near victory!! - and define variables
|
||||
/*if( !m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE )
|
||||
/*if (!m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE)
|
||||
{
|
||||
if( Team == ALLIANCE )
|
||||
if (Team == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_EY_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_EY_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
@@ -278,13 +278,13 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
|
||||
m_IsInformedNearVictory = true;
|
||||
}*/
|
||||
|
||||
if( score >= BG_EY_MAX_TEAM_SCORE )
|
||||
if (score >= BG_EY_MAX_TEAM_SCORE)
|
||||
{
|
||||
score = BG_EY_MAX_TEAM_SCORE;
|
||||
EndBattleGround(Team);
|
||||
}
|
||||
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(EY_ALLIANCE_RESOURCES, score);
|
||||
else
|
||||
UpdateWorldState(EY_HORDE_RESOURCES, score);
|
||||
@@ -293,9 +293,9 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
|
||||
void BattleGroundEY::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if( winner == ALLIANCE )
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if( winner == HORDE )
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map reward
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
@@ -306,7 +306,7 @@ void BattleGroundEY::EndBattleGround(uint32 winner)
|
||||
|
||||
void BattleGroundEY::UpdatePointsCount(uint32 Team)
|
||||
{
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[BG_TEAM_ALLIANCE]);
|
||||
else
|
||||
UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]);
|
||||
@@ -318,14 +318,14 @@ void BattleGroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
|
||||
if (m_PointState[Point] == EY_POINT_UNDER_CONTROL)
|
||||
{
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateControlIndex, 0);
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 1);
|
||||
else
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 0);
|
||||
else
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 0);
|
||||
@@ -350,15 +350,15 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
|
||||
for (int j = EY_POINTS_MAX; j >= 0; --j)
|
||||
{
|
||||
for(int i = 0; i < m_PlayersNearPoint[j].size(); ++i)
|
||||
if(m_PlayersNearPoint[j][i] == guid)
|
||||
if (m_PlayersNearPoint[j][i] == guid)
|
||||
m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i);
|
||||
}
|
||||
if(IsFlagPickedup())
|
||||
if (IsFlagPickedup())
|
||||
{
|
||||
if(m_FlagKeeper == guid)
|
||||
if (m_FlagKeeper == guid)
|
||||
{
|
||||
if(plr)
|
||||
this->EventPlayerDroppedFlag(plr);
|
||||
if (plr)
|
||||
EventPlayerDroppedFlag(plr);
|
||||
else
|
||||
{
|
||||
SetFlagPicker(0);
|
||||
@@ -370,7 +370,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
|
||||
|
||||
void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if(!Source->isAlive()) //hack code, must be removed later
|
||||
@@ -379,23 +379,23 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
switch(Trigger)
|
||||
{
|
||||
case TR_BLOOD_ELF_POINT:
|
||||
if(m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam())
|
||||
if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_BLOOD_ELF);
|
||||
break;
|
||||
case TR_FEL_REALVER_POINT:
|
||||
if(m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REALVER] == Source->GetTeam())
|
||||
if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REALVER] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_FEL_REALVER);
|
||||
break;
|
||||
case TR_MAGE_TOWER_POINT:
|
||||
if(m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam())
|
||||
if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_MAGE_TOWER);
|
||||
break;
|
||||
case TR_DRAENEI_RUINS_POINT:
|
||||
if(m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam())
|
||||
if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_DRAENEI_RUINS);
|
||||
break;
|
||||
case 4512:
|
||||
@@ -419,7 +419,7 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
bool BattleGroundEY::SetupBattleGround()
|
||||
{
|
||||
// doors
|
||||
if( !AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_EY_OBJECT_DOOR_H, BG_OBJECT_H_DOOR_EY_ENTRY, 1803.21f, 1539.49f, 1261.09f, 3.14159f, 0.173648f, 0, 0.984808f, 0, RESPAWN_IMMEDIATELY)
|
||||
// banners (alliance)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY)
|
||||
@@ -481,12 +481,12 @@ bool BattleGroundEY::SetupBattleGround()
|
||||
for (int i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]);
|
||||
if( !at )
|
||||
if (!at)
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
|
||||
continue;
|
||||
}
|
||||
if ( !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
)
|
||||
@@ -495,14 +495,14 @@ bool BattleGroundEY::SetupBattleGround()
|
||||
|
||||
WorldSafeLocsEntry const *sg = NULL;
|
||||
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE);
|
||||
if( !sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE) )
|
||||
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE);
|
||||
if( !sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE) )
|
||||
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
@@ -552,7 +552,7 @@ void BattleGroundEY::RespawnFlag(bool send_message)
|
||||
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_IMMEDIATELY);
|
||||
|
||||
if(send_message)
|
||||
if (send_message)
|
||||
{
|
||||
SendMessageToAll(LANG_BG_EY_RESETED_FLAG, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound...
|
||||
@@ -566,7 +566,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
|
||||
RespawnFlag(true);
|
||||
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID());
|
||||
if(obj)
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID()));
|
||||
@@ -576,7 +576,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
|
||||
|
||||
void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
BattleGround::HandleKillPlayer(player, killer);
|
||||
@@ -585,11 +585,11 @@ void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
||||
|
||||
void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
// if not running, do not cast things at the dropper player, neither send unnecessary messages
|
||||
// just take off the aura
|
||||
if(IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
@@ -597,10 +597,10 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!IsFlagPickedup())
|
||||
if (!IsFlagPickedup())
|
||||
return;
|
||||
|
||||
if(GetFlagPickerGUID() != Source->GetGUID())
|
||||
if (GetFlagPickerGUID() != Source->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
@@ -613,7 +613,7 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL);
|
||||
@@ -621,10 +621,10 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
||||
|
||||
void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS || this->IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
|
||||
return;
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_ON_PLAYER);
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE);
|
||||
@@ -645,7 +645,7 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
||||
Source->CastSpell(Source, BG_EY_NETHERSTORM_FLAG_SPELL, true);
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName());
|
||||
else
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName());
|
||||
@@ -653,13 +653,13 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
||||
|
||||
void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//Natural point
|
||||
uint32 Team = m_PointOwnedByTeam[Point];
|
||||
|
||||
if(!Team)
|
||||
if (!Team)
|
||||
return;
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
@@ -697,7 +697,7 @@ void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
|
||||
|
||||
void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 Team = Source->GetTeam();
|
||||
@@ -731,12 +731,12 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
||||
else
|
||||
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
|
||||
if(m_BgCreatures[Point])
|
||||
if (m_BgCreatures[Point])
|
||||
DelCreature(Point);
|
||||
|
||||
WorldSafeLocsEntry const *sg = NULL;
|
||||
sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId);
|
||||
if(!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
|
||||
if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
|
||||
sLog.outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u",
|
||||
Point, Team, m_CapturingPointTypes[Point].GraveYardId);
|
||||
|
||||
@@ -748,7 +748,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
||||
|
||||
void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS || this->GetFlagPickerGUID() != Source->GetGUID())
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
@@ -757,7 +757,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
|
||||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
else
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
|
||||
@@ -768,7 +768,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
|
||||
m_FlagCapturedBgObjectType = BgObjectType;
|
||||
|
||||
uint8 team_id = 0;
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
team_id = BG_TEAM_ALLIANCE;
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
@@ -779,7 +779,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
}
|
||||
|
||||
if(m_TeamPointsCount[team_id] > 0)
|
||||
if (m_TeamPointsCount[team_id] > 0)
|
||||
AddPoints(Source->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]);
|
||||
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
|
||||
@@ -871,7 +871,7 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
|
||||
entry = sWorldSafeLocsStore.LookupEntry(g_id);
|
||||
nearestEntry = entry;
|
||||
|
||||
if(!entry)
|
||||
if (!entry)
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Not found the main team graveyard. Graveyard system isn't working!");
|
||||
return NULL;
|
||||
@@ -887,15 +887,15 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
|
||||
|
||||
for(uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
if(m_PointOwnedByTeam[i]==player->GetTeam() && m_PointState[i]==EY_POINT_UNDER_CONTROL)
|
||||
if (m_PointOwnedByTeam[i]==player->GetTeam() && m_PointState[i]==EY_POINT_UNDER_CONTROL)
|
||||
{
|
||||
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
|
||||
if(!entry)
|
||||
if (!entry)
|
||||
sLog.outError("BattleGroundEY: Not found graveyard: %u",m_CapturingPointTypes[i].GraveYardId);
|
||||
else
|
||||
{
|
||||
distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z);
|
||||
if(distance < nearestDistance)
|
||||
if (distance < nearestDistance)
|
||||
{
|
||||
nearestDistance = distance;
|
||||
nearestEntry = entry;
|
||||
|
||||
@@ -43,7 +43,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
|
||||
sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from: " I64FMT, guid);
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battlemaster
|
||||
@@ -54,7 +54,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
|
||||
|
||||
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(unit->GetEntry());
|
||||
|
||||
if(!_player->GetBGAccessByLevel(bgTypeId))
|
||||
if (!_player->GetBGAccessByLevel(bgTypeId))
|
||||
{
|
||||
// temp, must be gossip message...
|
||||
SendNotification(LANG_YOUR_BG_LEVEL_REQ_ERROR);
|
||||
@@ -87,7 +87,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
||||
recv_data >> instanceId; // instance id, 0 if First Available selected
|
||||
recv_data >> joinAsGroup; // join as group
|
||||
|
||||
if(!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u",bgTypeId_,_player->GetGUIDLow());
|
||||
return;
|
||||
@@ -101,11 +101,11 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0);
|
||||
|
||||
// ignore if player is already in BG
|
||||
if(_player->InBattleGround())
|
||||
if (_player->InBattleGround())
|
||||
return;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battlemaster
|
||||
@@ -113,20 +113,20 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
||||
|
||||
// get bg instance or bg template if instance not found
|
||||
BattleGround * bg = NULL;
|
||||
if(instanceId)
|
||||
if (instanceId)
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
|
||||
if(!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
||||
if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
||||
{
|
||||
sLog.outError("Battleground: no available bg / template found");
|
||||
return;
|
||||
}
|
||||
|
||||
// check queueing conditions
|
||||
if(!joinAsGroup)
|
||||
if (!joinAsGroup)
|
||||
{
|
||||
// check Deserter debuff
|
||||
if( !_player->CanJoinToBattleground() )
|
||||
if (!_player->CanJoinToBattleground())
|
||||
{
|
||||
WorldPacket data(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
|
||||
data << uint32(0xFFFFFFFE);
|
||||
@@ -138,14 +138,14 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
||||
//player is already in this queue
|
||||
return;
|
||||
// check if has free queue slots
|
||||
if(!_player->HasFreeBattleGroundQueueId())
|
||||
if (!_player->HasFreeBattleGroundQueueId())
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
grp = _player->GetGroup();
|
||||
// no group found, error
|
||||
if(!grp)
|
||||
if (!grp)
|
||||
return;
|
||||
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
||||
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
|
||||
@@ -160,7 +160,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
||||
// _player->GetGroup() was already checked, grp is already initialized
|
||||
GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, 0, false, isPremade, 0);
|
||||
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
if(joinAsGroup /* && _player->GetGroup()*/)
|
||||
if (joinAsGroup /* && _player->GetGroup()*/)
|
||||
{
|
||||
sLog.outDebug("Battleground: the following players are joining as group:");
|
||||
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
@@ -200,7 +200,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
||||
sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName());
|
||||
}
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
if(!ginfo->IsInvitedToBGInstanceGUID)
|
||||
if (!ginfo->IsInvitedToBGInstanceGUID)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true);
|
||||
}
|
||||
|
||||
@@ -221,11 +221,11 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
|
||||
uint32 count2 = 0; //count of next fields
|
||||
|
||||
Player *ali_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID());
|
||||
if( ali_plr )
|
||||
if (ali_plr)
|
||||
++count2;
|
||||
|
||||
Player *horde_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID());
|
||||
if( horde_plr )
|
||||
if (horde_plr)
|
||||
++count2;
|
||||
|
||||
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
|
||||
@@ -237,13 +237,13 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
|
||||
data << (float)0; // y
|
||||
}*/
|
||||
data << count2; // horde flag holders count - obsolete, now count of next fields
|
||||
if( ali_plr )
|
||||
if (ali_plr)
|
||||
{
|
||||
data << (uint64)ali_plr->GetGUID();
|
||||
data << (float)ali_plr->GetPositionX();
|
||||
data << (float)ali_plr->GetPositionY();
|
||||
}
|
||||
if( horde_plr )
|
||||
if (horde_plr)
|
||||
{
|
||||
data << (uint64)horde_plr->GetGUID();
|
||||
data << (float)horde_plr->GetPositionX();
|
||||
@@ -277,7 +277,7 @@ void WorldSession::HandleBattleGroundPVPlogdataOpcode( WorldPacket & /*recv_data
|
||||
sLog.outDebug( "WORLD: Recvd MSG_PVP_LOG_DATA Message");
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
@@ -297,7 +297,7 @@ void WorldSession::HandleBattleGroundListOpcode( WorldPacket &recv_data )
|
||||
recv_data >> bgTypeId; // id from DBC
|
||||
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
if(!bl)
|
||||
if (!bl)
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype received.");
|
||||
return;
|
||||
@@ -323,25 +323,25 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
|
||||
recv_data >> type >> unk2 >> bgTypeId_ >> unk >> action;
|
||||
|
||||
if( !sBattlemasterListStore.LookupEntry(bgTypeId_) )
|
||||
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype (%u) received.", bgTypeId_);
|
||||
// update battleground slots for the player to fix his UI and sent data.
|
||||
// this is a HACK, I don't know why the client starts sending invalid packets in the first place.
|
||||
// it usually happens with extremely high latency (if debugging / stepping in the code for example)
|
||||
if( _player->InBattleGroundQueue() )
|
||||
if (_player->InBattleGroundQueue())
|
||||
{
|
||||
// update all queues, send invitation info if player is invited, queue info if queued
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
if( !bgQueueTypeId )
|
||||
if (!bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
|
||||
// if the player is not in queue, continue or no group information - this should never happen
|
||||
if( itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo )
|
||||
if (itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo)
|
||||
continue;
|
||||
|
||||
BattleGround * bg = NULL;
|
||||
@@ -350,7 +350,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
uint8 israted = itrPlayerStatus->second.GroupInfo->IsRated;
|
||||
uint8 status = 0;
|
||||
|
||||
if( !itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID )
|
||||
if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
// not invited to bg, get template
|
||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
@@ -364,7 +364,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
}
|
||||
|
||||
// if bg not found, then continue, don't invite if already in the instance
|
||||
if( !bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID()) )
|
||||
if (!bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID()))
|
||||
continue;
|
||||
|
||||
// re - invite player with proper data
|
||||
@@ -381,7 +381,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type);
|
||||
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
|
||||
if( itrPlayerStatus == qpMap.end() )
|
||||
if (itrPlayerStatus == qpMap.end())
|
||||
{
|
||||
sLog.outError("Battleground: itrplayerstatus not found.");
|
||||
return;
|
||||
@@ -389,7 +389,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
|
||||
instanceId = itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID;
|
||||
// if action == 1, then instanceId is required
|
||||
if( !instanceId && action == 1 )
|
||||
if (!instanceId && action == 1)
|
||||
{
|
||||
sLog.outError("Battleground: instance not found.");
|
||||
return;
|
||||
@@ -398,15 +398,15 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
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 )
|
||||
if (!bg && action == 0)
|
||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
{
|
||||
sLog.outError("Battleground: bg_template not found for type id %u.", bgTypeId);
|
||||
return;
|
||||
}
|
||||
|
||||
if( _player->InBattleGroundQueue() )
|
||||
if (_player->InBattleGroundQueue())
|
||||
{
|
||||
//we must use temporary variables, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function!
|
||||
uint32 team = itrPlayerStatus->second.GroupInfo->Team;
|
||||
@@ -416,10 +416,10 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
uint32 opponentsRating = itrPlayerStatus->second.GroupInfo->OpponentsTeamRating;
|
||||
|
||||
//some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it
|
||||
if( action == 1 && arenaType == 0)
|
||||
if (action == 1 && arenaType == 0)
|
||||
{
|
||||
//if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue
|
||||
if( !_player->CanJoinToBattleground() )
|
||||
if (!_player->CanJoinToBattleground())
|
||||
{
|
||||
//send bg command result to show nice message
|
||||
WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
|
||||
@@ -429,7 +429,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
|
||||
}
|
||||
//if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue
|
||||
if( _player->getLevel() > bg->GetMaxLevel() )
|
||||
if (_player->getLevel() > bg->GetMaxLevel())
|
||||
{
|
||||
sLog.outError("Battleground: Player %s (%u) has level higher than maxlevel of battleground! Do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
|
||||
action = 0;
|
||||
@@ -440,16 +440,16 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
switch( action )
|
||||
{
|
||||
case 1: // port to battleground
|
||||
if( !_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId) )
|
||||
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
||||
return; // cheating?
|
||||
// resurrect the player
|
||||
if( !_player->isAlive() )
|
||||
if (!_player->isAlive())
|
||||
{
|
||||
_player->ResurrectPlayer(1.0f);
|
||||
_player->SpawnCorpseBones();
|
||||
}
|
||||
// stop taxi flight at port
|
||||
if(_player->isInFlight())
|
||||
if (_player->isInFlight())
|
||||
{
|
||||
_player->GetMotionMaster()->MovementExpired();
|
||||
_player->m_taxi.ClearTaxiDestinations();
|
||||
@@ -461,7 +461,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), 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() )
|
||||
if (BattleGround *currentBg = _player->GetBattleGround())
|
||||
currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true);
|
||||
|
||||
// set the destination instance id
|
||||
@@ -476,10 +476,10 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
break;
|
||||
case 0: // leave queue
|
||||
// if player leaves rated arena match before match start, it is counted as he played but he lost
|
||||
if( isRated )
|
||||
if (isRated)
|
||||
{
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(team);
|
||||
if( at )
|
||||
if (at)
|
||||
{
|
||||
sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), opponentsRating);
|
||||
at->MemberLost(_player, opponentsRating);
|
||||
@@ -490,7 +490,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), true);
|
||||
// player left queue, we should update it - do not update Arena Queue
|
||||
if( !arenaType )
|
||||
if (!arenaType)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId), arenaType, isRated, rating);
|
||||
SendPacket(&data);
|
||||
sLog.outDebug("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
|
||||
@@ -518,9 +518,9 @@ void WorldSession::HandleBattleGroundLeaveOpcode( WorldPacket & /*recv_data*/ )
|
||||
// return;
|
||||
|
||||
// not allow leave battleground in combat
|
||||
if(_player->isInCombat())
|
||||
if(BattleGround* bg = _player->GetBattleGround())
|
||||
if(bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
if (_player->isInCombat())
|
||||
if (BattleGround* bg = _player->GetBattleGround())
|
||||
if (bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
_player->LeaveBattleground();
|
||||
@@ -537,16 +537,16 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
if( !bgQueueTypeId )
|
||||
if (!bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||
uint8 arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
||||
if( bgTypeId == _player->GetBattleGroundTypeId() )
|
||||
if (bgTypeId == _player->GetBattleGroundTypeId())
|
||||
{
|
||||
bg = _player->GetBattleGround();
|
||||
//i cannot check any variable from player class because player class doesn't know if player is in 2v2 / 3v3 or 5v5 arena
|
||||
//so i must use bg pointer to get that information
|
||||
if( bg && bg->GetArenaType() == arenaType )
|
||||
if (bg && bg->GetArenaType() == arenaType)
|
||||
{
|
||||
// this line is checked, i only don't know if GetStartTime is changing itself after bg end!
|
||||
// send status in BattleGround
|
||||
@@ -559,12 +559,12 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
||||
//get GroupQueueInfo for queue status
|
||||
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
|
||||
if( itrPlayerStatus == qpMap.end() )
|
||||
if (itrPlayerStatus == qpMap.end())
|
||||
continue;
|
||||
if( itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID )
|
||||
if (itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
continue;
|
||||
uint32 remainingTime = getMSTimeDiff(getMSTime(), itrPlayerStatus->second.GroupInfo->RemoveInviteTime);
|
||||
// send status invited to BattleGround
|
||||
@@ -574,7 +574,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
||||
else
|
||||
{
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
continue;
|
||||
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(itrPlayerStatus->second.GroupInfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
// send status in BattleGround Queue
|
||||
@@ -591,14 +591,14 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
|
||||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isSpiritService()) // it's not spirit service
|
||||
@@ -614,14 +614,14 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
|
||||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isSpiritService()) // it's not spirit service
|
||||
@@ -638,7 +638,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
||||
recv_data.hexlike();
|
||||
|
||||
// ignore if we already in BG or BG queue
|
||||
if(_player->InBattleGround())
|
||||
if (_player->InBattleGround())
|
||||
return;
|
||||
|
||||
uint64 guid; // arena Battlemaster guid
|
||||
@@ -650,7 +650,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
||||
recv_data >> guid >> arenaslot >> asGroup >> isRated;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battle master
|
||||
@@ -677,7 +677,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
||||
|
||||
//check existance
|
||||
BattleGround* bg = NULL;
|
||||
if( !(bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA)) )
|
||||
if (!(bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA)))
|
||||
{
|
||||
sLog.outError("Battleground: template bg (all arenas) not found");
|
||||
return;
|
||||
@@ -687,21 +687,21 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
|
||||
// check queueing conditions
|
||||
if(!asGroup)
|
||||
if (!asGroup)
|
||||
{
|
||||
// check if already in queue
|
||||
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||
//player is already in this queue
|
||||
return;
|
||||
// check if has free queue slots
|
||||
if(!_player->HasFreeBattleGroundQueueId())
|
||||
if (!_player->HasFreeBattleGroundQueueId())
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
grp = _player->GetGroup();
|
||||
// no group found, error
|
||||
if(!grp)
|
||||
if (!grp)
|
||||
return;
|
||||
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
|
||||
if (err != BG_JOIN_ERR_OK)
|
||||
@@ -713,12 +713,12 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
||||
|
||||
uint32 ateamId = 0;
|
||||
|
||||
if(isRated)
|
||||
if (isRated)
|
||||
{
|
||||
ateamId = _player->GetArenaTeamId(arenaslot);
|
||||
// check real arenateam existence only here (if it was moved to group->CanJoin .. () then we would ahve to get it twice)
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(ateamId);
|
||||
if(!at)
|
||||
if (!at)
|
||||
{
|
||||
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
|
||||
return;
|
||||
@@ -736,20 +736,20 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
||||
avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot*6) + 5);
|
||||
}
|
||||
|
||||
if( arenatype )
|
||||
if (arenatype)
|
||||
avg_pers_rating /= arenatype;
|
||||
|
||||
// if avg personal rating is more than 150 points below the teams rating, the team will be queued against an opponent matching or similar to the average personal rating
|
||||
if(avg_pers_rating + 150 < arenaRating)
|
||||
if (avg_pers_rating + 150 < arenaRating)
|
||||
arenaRating = avg_pers_rating;
|
||||
}
|
||||
|
||||
GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId);
|
||||
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
if(asGroup)
|
||||
if (asGroup)
|
||||
{
|
||||
sLog.outDebug("Battleground: arena join as group start");
|
||||
if(isRated)
|
||||
if (isRated)
|
||||
sLog.outDebug("Battleground: arena team id %u, leader %s queued with rating %u for type %u",_player->GetArenaTeamId(arenaslot),_player->GetName(),arenaRating,arenatype);
|
||||
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
@@ -771,7 +771,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
||||
sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName());
|
||||
}
|
||||
sLog.outDebug("Battleground: arena join as group end");
|
||||
if(isRated)
|
||||
if (isRated)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true);
|
||||
}
|
||||
else
|
||||
@@ -799,7 +799,7 @@ void WorldSession::HandleBattleGroundReportAFK( WorldPacket & recv_data )
|
||||
recv_data >> playerGuid;
|
||||
Player *reportedPlayer = objmgr.GetPlayer(playerGuid);
|
||||
|
||||
if(!reportedPlayer)
|
||||
if (!reportedPlayer)
|
||||
{
|
||||
sLog.outDebug("WorldSession::HandleBattleGroundReportAFK: player not found");
|
||||
return;
|
||||
|
||||
+137
-137
@@ -102,7 +102,7 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
|
||||
GroupsQueueType::iterator groupToKick = SelectedGroups.begin();
|
||||
for (GroupsQueueType::iterator itr = groupToKick; itr != SelectedGroups.end(); ++itr)
|
||||
{
|
||||
if( abs((int32)((*itr)->Players.size() - size)) <= 1 )
|
||||
if (abs((int32)((*itr)->Players.size() - size)) <= 1)
|
||||
{
|
||||
groupToKick = itr;
|
||||
found = true;
|
||||
@@ -111,7 +111,7 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
|
||||
groupToKick = itr;
|
||||
}
|
||||
//if pool is empty, do nothing
|
||||
if( GetPlayerCount() )
|
||||
if (GetPlayerCount())
|
||||
{
|
||||
//update player count
|
||||
GroupQueueInfo* ginfo = (*groupToKick);
|
||||
@@ -131,14 +131,14 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
|
||||
bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount)
|
||||
{
|
||||
//if group is larger than desired count - don't allow to add it to pool
|
||||
if( !ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size() )
|
||||
if (!ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size())
|
||||
{
|
||||
SelectedGroups.push_back(ginfo);
|
||||
// increase selected players count
|
||||
PlayerCount += ginfo->Players.size();
|
||||
return true;
|
||||
}
|
||||
if( PlayerCount < desiredCount )
|
||||
if (PlayerCount < desiredCount)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -171,9 +171,9 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId
|
||||
|
||||
//compute index (if group is premade or joined a rated match) to queues
|
||||
uint32 index = 0;
|
||||
if(!isRated && !isPremade)
|
||||
if (!isRated && !isPremade)
|
||||
index += BG_TEAMS_COUNT;
|
||||
if(ginfo->Team == HORDE)
|
||||
if (ginfo->Team == HORDE)
|
||||
index++;
|
||||
sLog.outDebug("Adding Group to BattleGroundQueue bgTypeId : %u, queue_id : %u, index : %u", BgTypeId, queue_id, index);
|
||||
|
||||
@@ -199,14 +199,14 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
|
||||
{
|
||||
uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, getMSTime());
|
||||
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
|
||||
if( !ginfo->ArenaType )
|
||||
if (!ginfo->ArenaType)
|
||||
{
|
||||
if( ginfo->Team == HORDE )
|
||||
if (ginfo->Team == HORDE)
|
||||
team_index = BG_TEAM_HORDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ginfo->IsRated )
|
||||
if (ginfo->IsRated)
|
||||
team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
|
||||
}
|
||||
|
||||
@@ -226,18 +226,18 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
|
||||
uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id)
|
||||
{
|
||||
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
|
||||
if( !ginfo->ArenaType )
|
||||
if (!ginfo->ArenaType)
|
||||
{
|
||||
if( ginfo->Team == HORDE )
|
||||
if (ginfo->Team == HORDE)
|
||||
team_index = BG_TEAM_HORDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ginfo->IsRated )
|
||||
if (ginfo->IsRated)
|
||||
team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
|
||||
}
|
||||
//check if there is enought values(we always add values > 0)
|
||||
if(m_WaitTimes[team_index][queue_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1] )
|
||||
if (m_WaitTimes[team_index][queue_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1] )
|
||||
return (m_SumOfWaitTimes[team_index][queue_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME);
|
||||
else
|
||||
//if there aren't enough values return 0 - not available
|
||||
@@ -254,7 +254,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
|
||||
//remove player from map, if he's there
|
||||
itr = m_QueuedPlayers.find(guid);
|
||||
if( itr == m_QueuedPlayers.end() )
|
||||
if (itr == m_QueuedPlayers.end())
|
||||
{
|
||||
sLog.outError("BattleGroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid));
|
||||
return;
|
||||
@@ -275,7 +275,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
{
|
||||
for(group_itr_tmp = m_QueuedGroups[queue_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[queue_id_tmp][j].end(); ++group_itr_tmp)
|
||||
{
|
||||
if( (*group_itr_tmp) == group )
|
||||
if ((*group_itr_tmp) == group)
|
||||
{
|
||||
queue_id = queue_id_tmp;
|
||||
group_itr = group_itr_tmp;
|
||||
@@ -287,7 +287,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
}
|
||||
}
|
||||
//player can't be in queue without group, but just in case
|
||||
if( queue_id == -1 )
|
||||
if (queue_id == -1)
|
||||
{
|
||||
sLog.outError("BattleGroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
|
||||
return;
|
||||
@@ -301,14 +301,14 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
|
||||
// remove player queue info from group queue info
|
||||
std::map<uint64, PlayerQueueInfo*>::iterator pitr = group->Players.find(guid);
|
||||
if( pitr != group->Players.end() )
|
||||
if (pitr != group->Players.end())
|
||||
group->Players.erase(pitr);
|
||||
|
||||
// if invited to bg, and should decrease invited count, then do it
|
||||
if( decreaseInvitedCount && group->IsInvitedToBGInstanceGUID )
|
||||
if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(group->IsInvitedToBGInstanceGUID, group->BgTypeId);
|
||||
if( bg )
|
||||
if (bg)
|
||||
bg->DecreaseInvitedCount(group->Team);
|
||||
}
|
||||
|
||||
@@ -316,18 +316,18 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
m_QueuedPlayers.erase(itr);
|
||||
|
||||
//if we left BG queue(not porting) OR if arena team left queue for rated match
|
||||
if( (decreaseInvitedCount && !group->ArenaType) || (group->ArenaType && group->IsRated && group->Players.empty()) )
|
||||
if ((decreaseInvitedCount && !group->ArenaType) || (group->ArenaType && group->IsRated && group->Players.empty()))
|
||||
AnnounceWorld(group, guid, false);
|
||||
|
||||
//if player leaves queue and he is invited to rated arena match, then he have to loose
|
||||
if( group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount )
|
||||
if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount)
|
||||
{
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(group->ArenaTeamId);
|
||||
if( at )
|
||||
if (at)
|
||||
{
|
||||
sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
|
||||
Player *plr = objmgr.GetPlayer(guid);
|
||||
if( plr )
|
||||
if (plr)
|
||||
at->MemberLost(plr, group->OpponentsTeamRating);
|
||||
else
|
||||
at->OfflineMemberLost(guid, group->OpponentsTeamRating);
|
||||
@@ -336,7 +336,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
}
|
||||
|
||||
// remove group queue info if needed
|
||||
if( group->Players.empty() )
|
||||
if (group->Players.empty())
|
||||
{
|
||||
m_QueuedGroups[queue_id][index].erase(group_itr);
|
||||
delete group;
|
||||
@@ -344,11 +344,11 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
// if group wasn't empty, so it wasn't deleted, and player have left a rated
|
||||
// queue -> everyone from the group should leave too
|
||||
// don't remove recursively if already invited to bg!
|
||||
else if( !group->IsInvitedToBGInstanceGUID && group->IsRated )
|
||||
else if (!group->IsInvitedToBGInstanceGUID && group->IsRated)
|
||||
{
|
||||
// remove next player, this is recursive
|
||||
// first send removal information
|
||||
if(Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first))
|
||||
if (Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first))
|
||||
{
|
||||
BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType);
|
||||
@@ -369,14 +369,14 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe
|
||||
{
|
||||
if(ginfo->ArenaType) //if Arena
|
||||
{
|
||||
if( sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE) && ginfo->IsRated )
|
||||
if (sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE) && ginfo->IsRated)
|
||||
{
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId);
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
char const* bgName = bg->GetName();
|
||||
if(isAddedToQueue)
|
||||
if (isAddedToQueue)
|
||||
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, bgName, ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating);
|
||||
else
|
||||
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, bgName, ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating);
|
||||
@@ -384,11 +384,11 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe
|
||||
}
|
||||
else //if BG
|
||||
{
|
||||
if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) )
|
||||
if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(playerGUID);
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId);
|
||||
if(!bg || !plr)
|
||||
if (!bg || !plr)
|
||||
return;
|
||||
|
||||
BGQueueIdBasedOnLevel queue_id = plr->GetBattleGroundQueueIdFromLevel(bg->GetTypeID());
|
||||
@@ -399,14 +399,14 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe
|
||||
uint32 q_min_level = (queue_id + 1) * 10;
|
||||
GroupsQueueType::const_iterator itr;
|
||||
for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr)
|
||||
if( !(*itr)->IsInvitedToBGInstanceGUID )
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
||||
qAlliance += (*itr)->Players.size();
|
||||
for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].end(); ++itr)
|
||||
if( !(*itr)->IsInvitedToBGInstanceGUID )
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
||||
qHorde += (*itr)->Players.size();
|
||||
|
||||
// Show queue status to player only (when joining queue)
|
||||
if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY) )
|
||||
if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY))
|
||||
{
|
||||
ChatHandler(plr).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF,
|
||||
bgName, q_min_level, q_min_level + 10, qAlliance, MinPlayers, qHorde, MinPlayers);
|
||||
@@ -424,10 +424,10 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe
|
||||
bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side)
|
||||
{
|
||||
// set side if needed
|
||||
if( side )
|
||||
if (side)
|
||||
ginfo->Team = side;
|
||||
|
||||
if( !ginfo->IsInvitedToBGInstanceGUID )
|
||||
if (!ginfo->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
// not yet invited
|
||||
// set invitation
|
||||
@@ -437,7 +437,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
||||
BGQueueIdBasedOnLevel queue_id = bg->GetQueueId();
|
||||
|
||||
// set ArenaTeamId for rated matches
|
||||
if( bg->isArena() && bg->isRated() )
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->SetArenaTeamIdForTeam(ginfo->Team, ginfo->ArenaTeamId);
|
||||
|
||||
ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME;
|
||||
@@ -448,7 +448,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
||||
// get the player
|
||||
Player* plr = objmgr.GetPlayer(itr->first);
|
||||
// if offline, skip him, this should not happen - player is removed from queue when he logs out
|
||||
if( !plr )
|
||||
if (!plr)
|
||||
continue;
|
||||
|
||||
// invite the player
|
||||
@@ -526,18 +526,18 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
|
||||
while( abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0) )
|
||||
{
|
||||
//each cycle execution we need to kick at least 1 group
|
||||
if( diffAli < diffHorde )
|
||||
if (diffAli < diffHorde)
|
||||
{
|
||||
//kick alliance group, add to pool new group if needed
|
||||
if( m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffHorde - diffAli) )
|
||||
if (m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffHorde - diffAli))
|
||||
{
|
||||
for (; aliIndex < aliCount && m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*Ali_itr), (aliFree >= diffHorde) ? aliFree - diffHorde : 0); aliIndex++)
|
||||
++Ali_itr;
|
||||
}
|
||||
//if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break;
|
||||
if( !m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() )
|
||||
if (!m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
|
||||
{
|
||||
if( aliFree <= diffHorde + 1 )
|
||||
if (aliFree <= diffHorde + 1)
|
||||
break;
|
||||
m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffHorde - diffAli);
|
||||
}
|
||||
@@ -545,14 +545,14 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
|
||||
else
|
||||
{
|
||||
//kick horde group, add to pool new group if needed
|
||||
if( m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffAli - diffHorde) )
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffAli - diffHorde))
|
||||
{
|
||||
for (; hordeIndex < hordeCount && m_SelectionPools[BG_TEAM_HORDE].AddGroup((*Horde_itr), (hordeFree >= diffAli) ? hordeFree - diffAli : 0); hordeIndex++)
|
||||
++Horde_itr;
|
||||
}
|
||||
if( !m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() )
|
||||
if (!m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
|
||||
{
|
||||
if( hordeFree <= diffAli + 1 )
|
||||
if (hordeFree <= diffAli + 1)
|
||||
break;
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffAli - diffHorde);
|
||||
}
|
||||
@@ -569,19 +569,19 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
|
||||
bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam)
|
||||
{
|
||||
//check match
|
||||
if(!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && !m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty())
|
||||
if (!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && !m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty())
|
||||
{
|
||||
//start premade match
|
||||
//if groups aren't invited
|
||||
GroupsQueueType::const_iterator ali_group, horde_group;
|
||||
for( ali_group = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group)
|
||||
if( !(*ali_group)->IsInvitedToBGInstanceGUID )
|
||||
if (!(*ali_group)->IsInvitedToBGInstanceGUID)
|
||||
break;
|
||||
for( horde_group = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group)
|
||||
if( !(*horde_group)->IsInvitedToBGInstanceGUID )
|
||||
if (!(*horde_group)->IsInvitedToBGInstanceGUID)
|
||||
break;
|
||||
|
||||
if( ali_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].end())
|
||||
if (ali_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].end())
|
||||
{
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*ali_group), MaxPlayersPerTeam);
|
||||
m_SelectionPools[BG_TEAM_HORDE].AddGroup((*horde_group), MaxPlayersPerTeam);
|
||||
@@ -593,7 +593,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32
|
||||
for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr)
|
||||
{
|
||||
//if itr can join BG and player count is less that maxPlayers, then add group to selectionpool
|
||||
if( !(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers) )
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -608,10 +608,10 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32
|
||||
uint32 time_before = getMSTime() - sWorld.getConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH);
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
{
|
||||
if(!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty())
|
||||
if (!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty())
|
||||
{
|
||||
GroupsQueueType::iterator itr = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE + i].begin();
|
||||
if(!(*itr)->IsInvitedToBGInstanceGUID && ((*itr)->JoinTime < time_before || (*itr)->Players.size() < MinPlayersPerTeam))
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID && ((*itr)->JoinTime < time_before || (*itr)->Players.size() < MinPlayersPerTeam))
|
||||
{
|
||||
//we must insert group to normal queue and erase pointer from premade queue
|
||||
m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].push_front((*itr));
|
||||
@@ -632,17 +632,17 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas
|
||||
itr_team[i] = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin();
|
||||
for(; itr_team[i] != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++(itr_team[i]))
|
||||
{
|
||||
if( !(*(itr_team[i]))->IsInvitedToBGInstanceGUID )
|
||||
if (!(*(itr_team[i]))->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
m_SelectionPools[i].AddGroup(*(itr_team[i]), maxPlayers);
|
||||
if( m_SelectionPools[i].GetPlayerCount() >= minPlayers )
|
||||
if (m_SelectionPools[i].GetPlayerCount() >= minPlayers)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//try to invite same number of players - this cycle may cause longer wait time even if there are enough players in queue, but we want ballanced bg
|
||||
uint32 j = BG_TEAM_ALLIANCE;
|
||||
if( m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() )
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
|
||||
j = BG_TEAM_HORDE;
|
||||
if( sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
|
||||
&& m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers )
|
||||
@@ -651,16 +651,16 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas
|
||||
++(itr_team[j]); //this will not cause a crash, because for cycle above reached break;
|
||||
for(; itr_team[j] != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + j].end(); ++(itr_team[j]))
|
||||
{
|
||||
if( !(*(itr_team[j]))->IsInvitedToBGInstanceGUID )
|
||||
if( !m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % BG_TEAMS_COUNT].GetPlayerCount()) )
|
||||
if (!(*(itr_team[j]))->IsInvitedToBGInstanceGUID)
|
||||
if (!m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % BG_TEAMS_COUNT].GetPlayerCount()))
|
||||
break;
|
||||
}
|
||||
// do not allow to start bg with more than 2 players more on 1 faction
|
||||
if( abs((int32)(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())) > 2 )
|
||||
if (abs((int32)(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())) > 2)
|
||||
return false;
|
||||
}
|
||||
//allow 1v0 if debug bg
|
||||
if( sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()) )
|
||||
if (sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()))
|
||||
return true;
|
||||
//return true if there are enough players in selection pools - enable to work .debug bg command correctly
|
||||
return m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
@@ -669,12 +669,12 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas
|
||||
// this method will check if we can invite players to same faction skirmish match
|
||||
bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_id, uint32 minPlayersPerTeam)
|
||||
{
|
||||
if( m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam )
|
||||
if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam)
|
||||
return false;
|
||||
uint32 teamIndex = BG_TEAM_ALLIANCE;
|
||||
uint32 otherTeam = BG_TEAM_HORDE;
|
||||
uint32 otherTeamId = HORDE;
|
||||
if ( m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam )
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam )
|
||||
{
|
||||
teamIndex = BG_TEAM_HORDE;
|
||||
otherTeam = BG_TEAM_ALLIANCE;
|
||||
@@ -687,9 +687,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_
|
||||
//set itr_team to group that was added to selection pool latest
|
||||
GroupsQueueType::iterator itr_team = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].begin();
|
||||
for(; itr_team != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team)
|
||||
if( ginfo == *itr_team )
|
||||
if (ginfo == *itr_team)
|
||||
break;
|
||||
if( itr_team == m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end() )
|
||||
if (itr_team == m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end())
|
||||
return false;
|
||||
GroupsQueueType::iterator itr_team2 = itr_team;
|
||||
++itr_team2;
|
||||
@@ -697,10 +697,10 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_
|
||||
for(; itr_team2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team2)
|
||||
{
|
||||
//if selection pool is full then break;
|
||||
if( !(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeam].AddGroup(*itr_team2, minPlayersPerTeam) )
|
||||
if (!(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeam].AddGroup(*itr_team2, minPlayersPerTeam))
|
||||
break;
|
||||
}
|
||||
if( m_SelectionPools[otherTeam].GetPlayerCount() != minPlayersPerTeam )
|
||||
if (m_SelectionPools[otherTeam].GetPlayerCount() != minPlayersPerTeam)
|
||||
return false;
|
||||
|
||||
//here we have correct 2 selections and we need to change one teams team and move selection pool teams to other team's queue
|
||||
@@ -715,7 +715,7 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_
|
||||
++itr2;
|
||||
for(; itr2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr2)
|
||||
{
|
||||
if( *itr2 == *itr )
|
||||
if (*itr2 == *itr)
|
||||
{
|
||||
m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].erase(itr2);
|
||||
break;
|
||||
@@ -768,7 +768,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++itr)
|
||||
InviteGroupToBG((*itr), bg, (*itr)->Team);
|
||||
|
||||
if( !bg->HasFreeSlots() )
|
||||
if (!bg->HasFreeSlots())
|
||||
{
|
||||
// remove BG from BGFreeSlotQueue
|
||||
bg->RemoveFromBGFreeSlotQueue();
|
||||
@@ -779,7 +779,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
// finished iterating through the bgs with free slots, maybe we need to create a new bg
|
||||
|
||||
BattleGround * bg_template = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
if( !bg_template )
|
||||
if (!bg_template)
|
||||
{
|
||||
sLog.outError("Battleground: Update: bg template not found for %u", bgTypeId);
|
||||
return;
|
||||
@@ -787,11 +787,11 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
// get the min. players per team, properly for larger arenas as well. (must have full teams for arena matches!)
|
||||
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
|
||||
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
|
||||
if( sBattleGroundMgr.isTesting() )
|
||||
if (sBattleGroundMgr.isTesting())
|
||||
MinPlayersPerTeam = 1;
|
||||
if( bg_template->isArena() )
|
||||
if (bg_template->isArena())
|
||||
{
|
||||
if( sBattleGroundMgr.isArenaTesting() )
|
||||
if (sBattleGroundMgr.isArenaTesting())
|
||||
{
|
||||
MaxPlayersPerTeam = 1;
|
||||
MinPlayersPerTeam = 1;
|
||||
@@ -822,14 +822,14 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[BG_TEAM_HORDE].Init();
|
||||
|
||||
if( bg_template->isBattleGround() )
|
||||
if (bg_template->isBattleGround())
|
||||
{
|
||||
//check if there is premade against premade match
|
||||
if( CheckPremadeMatch(queue_id, MinPlayersPerTeam, MaxPlayersPerTeam) )
|
||||
if (CheckPremadeMatch(queue_id, MinPlayersPerTeam, MaxPlayersPerTeam))
|
||||
{
|
||||
//create new battleground
|
||||
BattleGround * bg2 = NULL;
|
||||
if( !(bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, 0, false)) )
|
||||
if (!(bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, 0, false)))
|
||||
{
|
||||
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
|
||||
return;
|
||||
@@ -847,15 +847,15 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
}
|
||||
|
||||
// now check if there are in queues enough players to start new game of (normal battleground, or non-rated arena)
|
||||
if( !isRated )
|
||||
if (!isRated)
|
||||
{
|
||||
// if there are enough players in pools, start new battleground or non rated arena
|
||||
if( CheckNormalMatch(bg_template, queue_id, MinPlayersPerTeam, MaxPlayersPerTeam)
|
||||
if (CheckNormalMatch(bg_template, queue_id, MinPlayersPerTeam, MaxPlayersPerTeam)
|
||||
|| (bg_template->isArena() && CheckSkirmishForSameFaction(queue_id, MinPlayersPerTeam)) )
|
||||
{
|
||||
// we successfully created a pool
|
||||
BattleGround * bg2 = NULL;
|
||||
if( !(bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, arenaType, false)) )
|
||||
if (!(bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, arenaType, false)))
|
||||
{
|
||||
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
|
||||
return;
|
||||
@@ -869,31 +869,31 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
bg2->StartBattleGround();
|
||||
}
|
||||
}
|
||||
else if( bg_template->isArena() )
|
||||
else if (bg_template->isArena())
|
||||
{
|
||||
// found out the minimum and maximum ratings the newly added team should battle against
|
||||
// arenaRating is the rating of the latest joined team, or 0
|
||||
// 0 is on (automatic update call) and we must set it to team's with longest wait time
|
||||
if ( !arenaRating )
|
||||
if (!arenaRating )
|
||||
{
|
||||
GroupQueueInfo* front1 = NULL;
|
||||
GroupQueueInfo* front2 = NULL;
|
||||
if( !m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty() )
|
||||
if (!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty())
|
||||
{
|
||||
front1 = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].front();
|
||||
arenaRating = front1->ArenaTeamRating;
|
||||
}
|
||||
if( !m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty() )
|
||||
if (!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty())
|
||||
{
|
||||
front2 = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].front();
|
||||
arenaRating = front2->ArenaTeamRating;
|
||||
}
|
||||
if( front1 && front2 )
|
||||
if (front1 && front2)
|
||||
{
|
||||
if( front1->JoinTime < front2->JoinTime )
|
||||
if (front1->JoinTime < front2->JoinTime)
|
||||
arenaRating = front1->ArenaTeamRating;
|
||||
}
|
||||
else if( !front1 && !front2 )
|
||||
else if (!front1 && !front2)
|
||||
return; //queues are empty
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
// if we don't have, we must try to continue search in same queue
|
||||
// tmp variables are correctly set
|
||||
// this code isn't much userfriendly - but it is supposed to continue search for mathing group in HORDE queue
|
||||
if( m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() )
|
||||
if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
|
||||
{
|
||||
itr_team[BG_TEAM_ALLIANCE] = itr_team[BG_TEAM_HORDE];
|
||||
++itr_team[BG_TEAM_ALLIANCE];
|
||||
@@ -949,7 +949,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
}
|
||||
}
|
||||
// this code isn't much userfriendly - but it is supposed to continue search for mathing group in ALLIANCE queue
|
||||
if( m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() )
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
|
||||
{
|
||||
itr_team[BG_TEAM_HORDE] = itr_team[BG_TEAM_ALLIANCE];
|
||||
++itr_team[BG_TEAM_HORDE];
|
||||
@@ -966,10 +966,10 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
}
|
||||
|
||||
//if we have 2 teams, then start new arena and invite players!
|
||||
if( m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() )
|
||||
if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
|
||||
{
|
||||
BattleGround* arena = NULL;
|
||||
if( !(arena = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, arenaType, true)) )
|
||||
if (!(arena = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, arenaType, true)))
|
||||
{
|
||||
sLog.outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!");
|
||||
return;
|
||||
@@ -980,7 +980,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
(*(itr_team[BG_TEAM_HORDE]))->OpponentsTeamRating = (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaTeamRating;
|
||||
sLog.outDebug("setting oposite teamrating for team %u to %u", (*(itr_team[BG_TEAM_HORDE]))->ArenaTeamId, (*(itr_team[BG_TEAM_HORDE]))->OpponentsTeamRating);
|
||||
// now we must move team if we changed its faction to another faction queue, because then we will spam log by errors in Queue::RemovePlayer
|
||||
if( (*(itr_team[BG_TEAM_ALLIANCE]))->Team != ALLIANCE )
|
||||
if ((*(itr_team[BG_TEAM_ALLIANCE]))->Team != ALLIANCE)
|
||||
{
|
||||
// add to alliance queue
|
||||
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(*(itr_team[BG_TEAM_ALLIANCE]));
|
||||
@@ -988,7 +988,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
|
||||
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].erase(itr_team[BG_TEAM_ALLIANCE]);
|
||||
itr_team[BG_TEAM_ALLIANCE] = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].begin();
|
||||
}
|
||||
if( (*(itr_team[BG_TEAM_HORDE]))->Team != HORDE )
|
||||
if ((*(itr_team[BG_TEAM_HORDE]))->Team != HORDE)
|
||||
{
|
||||
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].push_front(*(itr_team[BG_TEAM_HORDE]));
|
||||
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_team[BG_TEAM_HORDE]);
|
||||
@@ -1013,12 +1013,12 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Player* plr = objmgr.GetPlayer( m_PlayerGuid );
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
if( !plr )
|
||||
if (!plr)
|
||||
return true;
|
||||
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
||||
//if battleground ended and its instance deleted - do nothing
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
return true;
|
||||
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
@@ -1080,7 +1080,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
plr->RemoveBattleGroundQueueId(m_BgQueueTypeId);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].RemovePlayer(m_PlayerGuid, true);
|
||||
//update queues if battleground isn't ended
|
||||
if( bg )
|
||||
if (bg)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].Update(m_BgTypeId, bg->GetQueueId());
|
||||
|
||||
WorldPacket data;
|
||||
@@ -1123,7 +1123,7 @@ void BattleGroundMgr::DeleteAllBattleGrounds()
|
||||
{
|
||||
BattleGround * bg = itr->second;
|
||||
m_BattleGrounds[i].erase(itr++);
|
||||
if(!m_ClientBattleGroundIds[i][bg->GetQueueId()].empty())
|
||||
if (!m_ClientBattleGroundIds[i][bg->GetQueueId()].empty())
|
||||
m_ClientBattleGroundIds[i][bg->GetQueueId()].erase(bg->GetClientInstanceID());
|
||||
delete bg;
|
||||
}
|
||||
@@ -1146,7 +1146,7 @@ void BattleGroundMgr::Update(uint32 diff)
|
||||
{
|
||||
itr = m_BattleGrounds[i].begin();
|
||||
// skip updating battleground template
|
||||
if( itr != m_BattleGrounds[i].end() )
|
||||
if (itr != m_BattleGrounds[i].end())
|
||||
++itr;
|
||||
for(; itr != m_BattleGrounds[i].end(); itr = next)
|
||||
{
|
||||
@@ -1155,21 +1155,21 @@ void BattleGroundMgr::Update(uint32 diff)
|
||||
itr->second->Update(diff);
|
||||
// use the SetDeleteThis variable
|
||||
// direct deletion caused crashes
|
||||
if(itr->second->m_SetDeleteThis)
|
||||
if (itr->second->m_SetDeleteThis)
|
||||
{
|
||||
BattleGround * bg = itr->second;
|
||||
m_BattleGrounds[i].erase(itr);
|
||||
if(!m_ClientBattleGroundIds[i][bg->GetQueueId()].empty())
|
||||
if (!m_ClientBattleGroundIds[i][bg->GetQueueId()].empty())
|
||||
m_ClientBattleGroundIds[i][bg->GetQueueId()].erase(bg->GetClientInstanceID());
|
||||
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))
|
||||
if (sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER))
|
||||
{
|
||||
// it's time to force update
|
||||
if(m_NextRatingDiscardUpdate < diff)
|
||||
if (m_NextRatingDiscardUpdate < diff)
|
||||
{
|
||||
// forced update for level 70 rated arenas
|
||||
sLog.outDebug("BattleGroundMgr: UPDATING ARENA QUEUES");
|
||||
@@ -1184,9 +1184,9 @@ void BattleGroundMgr::Update(uint32 diff)
|
||||
else
|
||||
m_NextRatingDiscardUpdate -= diff;
|
||||
}
|
||||
if(sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
if (sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
if(m_AutoDistributionTimeChecker < diff)
|
||||
if (m_AutoDistributionTimeChecker < diff)
|
||||
{
|
||||
if(time(NULL) > m_NextAutoDistributionTime)
|
||||
{
|
||||
@@ -1205,7 +1205,7 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
|
||||
{
|
||||
// we can be in 3 queues in same time...
|
||||
|
||||
if( StatusID == 0 || !bg )
|
||||
if (StatusID == 0 || !bg)
|
||||
{
|
||||
data->Initialize(SMSG_BATTLEFIELD_STATUS, 4*3);
|
||||
*data << uint32(QueueSlot); // queue id (0...2)
|
||||
@@ -1262,7 +1262,7 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
|
||||
break;
|
||||
}
|
||||
|
||||
if(bg->isArena() && (StatusID == STATUS_WAIT_QUEUE))
|
||||
if (bg->isArena() && (StatusID == STATUS_WAIT_QUEUE))
|
||||
*data << uint32(BATTLEGROUND_AA); // all arenas I don't think so.
|
||||
else
|
||||
*data << uint32(bg->GetTypeID()); // BG id from DBC
|
||||
@@ -1315,14 +1315,14 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
|
||||
{
|
||||
uint32 at_id = bg->m_ArenaTeamIds[i];
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
|
||||
if(at)
|
||||
if (at)
|
||||
*data << at->GetName();
|
||||
else
|
||||
*data << (uint8)0;
|
||||
}
|
||||
}
|
||||
|
||||
if(bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
if (bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
{
|
||||
*data << uint8(0); // bg not ended
|
||||
}
|
||||
@@ -1338,7 +1338,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
|
||||
{
|
||||
*data << (uint64)itr->first;
|
||||
*data << (int32)itr->second->KillingBlows;
|
||||
if(type == 0)
|
||||
if (type == 0)
|
||||
{
|
||||
*data << (int32)itr->second->HonorableKills;
|
||||
*data << (int32)itr->second->Deaths;
|
||||
@@ -1348,9 +1348,9 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
uint32 team = bg->GetPlayerTeam(itr->first);
|
||||
if(!team && plr)
|
||||
if (!team && plr)
|
||||
team = plr->GetTeam();
|
||||
if( ( bg->GetWinner()==0 && team == ALLIANCE ) || ( bg->GetWinner()==1 && team==HORDE ) )
|
||||
if (( bg->GetWinner()==0 && team == ALLIANCE ) || ( bg->GetWinner()==1 && team==HORDE ))
|
||||
*data << uint8(1);
|
||||
else
|
||||
*data << uint8(0);
|
||||
@@ -1443,15 +1443,15 @@ BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 inst
|
||||
//cause at HandleBattleGroundJoinOpcode the clients sends the instanceid he gets from
|
||||
//SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
|
||||
BattleGround* bg = GetBattleGroundTemplate(bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
return NULL;
|
||||
|
||||
if(bg->isArena())
|
||||
if (bg->isArena())
|
||||
return GetBattleGround(instanceId, bgTypeId);
|
||||
|
||||
for(BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
|
||||
{
|
||||
if(itr->second->GetClientInstanceID() == instanceId)
|
||||
if (itr->second->GetClientInstanceID() == instanceId)
|
||||
return itr->second;
|
||||
}
|
||||
return NULL;
|
||||
@@ -1461,12 +1461,12 @@ BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundT
|
||||
{
|
||||
//search if needed
|
||||
BattleGroundSet::iterator itr;
|
||||
if( bgTypeId == BATTLEGROUND_TYPE_NONE)
|
||||
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() )
|
||||
if (itr != m_BattleGrounds[i].end())
|
||||
return itr->second;
|
||||
}
|
||||
return NULL;
|
||||
@@ -1483,7 +1483,7 @@ BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTyp
|
||||
|
||||
uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id)
|
||||
{
|
||||
if( IsArenaType(bgTypeId) )
|
||||
if (IsArenaType(bgTypeId))
|
||||
return 0; //arenas don't have client-instanceids
|
||||
|
||||
// we create here an instanceid, which is just for
|
||||
@@ -1508,20 +1508,20 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
|
||||
{
|
||||
// get the template BG
|
||||
BattleGround *bg_template = GetBattleGroundTemplate(bgTypeId);
|
||||
if(!bg_template)
|
||||
if (!bg_template)
|
||||
{
|
||||
sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//for arenas there is random map used
|
||||
if(bg_template->isArena())
|
||||
if (bg_template->isArena())
|
||||
{
|
||||
BattleGroundTypeId arenas[] = {BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL};
|
||||
uint32 arena_num = urand(0,2);
|
||||
bgTypeId = arenas[arena_num];
|
||||
bg_template = GetBattleGroundTemplate(bgTypeId);
|
||||
if(!bg_template)
|
||||
if (!bg_template)
|
||||
{
|
||||
sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId);
|
||||
return NULL;
|
||||
@@ -1647,7 +1647,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
|
||||
|
||||
if(!result)
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar(1);
|
||||
|
||||
@@ -1669,7 +1669,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
|
||||
// can be overwrite by values from DB
|
||||
bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
|
||||
if(!bl)
|
||||
if (!bl)
|
||||
{
|
||||
sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
|
||||
continue;
|
||||
@@ -1683,12 +1683,12 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
MinLvl = fields[3].GetUInt32();
|
||||
MaxLvl = fields[4].GetUInt32();
|
||||
//check values from DB
|
||||
if( MaxPlayersPerTeam == 0 || MinPlayersPerTeam == 0 || MinPlayersPerTeam > MaxPlayersPerTeam )
|
||||
if (MaxPlayersPerTeam == 0 || MinPlayersPerTeam == 0 || MinPlayersPerTeam > MaxPlayersPerTeam)
|
||||
{
|
||||
MaxPlayersPerTeam = bl->maxplayersperteam;
|
||||
MinPlayersPerTeam = bl->maxplayersperteam / 2;
|
||||
}
|
||||
if( MinLvl == 0 || MaxLvl == 0 || MinLvl > MaxLvl )
|
||||
if (MinLvl == 0 || MaxLvl == 0 || MinLvl > MaxLvl)
|
||||
{
|
||||
MinLvl = bl->minlvl;
|
||||
MaxLvl = bl->maxlvl;
|
||||
@@ -1697,14 +1697,14 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
start1 = fields[5].GetUInt32();
|
||||
|
||||
start = sWorldSafeLocsStore.LookupEntry(start1);
|
||||
if(start)
|
||||
if (start)
|
||||
{
|
||||
AStartLoc[0] = start->x;
|
||||
AStartLoc[1] = start->y;
|
||||
AStartLoc[2] = start->z;
|
||||
AStartLoc[3] = fields[6].GetFloat();
|
||||
}
|
||||
else if(bgTypeID == BATTLEGROUND_AA)
|
||||
else if (bgTypeID == BATTLEGROUND_AA)
|
||||
{
|
||||
AStartLoc[0] = 0;
|
||||
AStartLoc[1] = 0;
|
||||
@@ -1720,14 +1720,14 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
start2 = fields[7].GetUInt32();
|
||||
|
||||
start = sWorldSafeLocsStore.LookupEntry(start2);
|
||||
if(start)
|
||||
if (start)
|
||||
{
|
||||
HStartLoc[0] = start->x;
|
||||
HStartLoc[1] = start->y;
|
||||
HStartLoc[2] = start->z;
|
||||
HStartLoc[3] = fields[8].GetFloat();
|
||||
}
|
||||
else if(bgTypeID == BATTLEGROUND_AA)
|
||||
else if (bgTypeID == BATTLEGROUND_AA)
|
||||
{
|
||||
HStartLoc[0] = 0;
|
||||
HStartLoc[1] = 0;
|
||||
@@ -1741,7 +1741,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
}
|
||||
|
||||
//sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
|
||||
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]))
|
||||
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;
|
||||
|
||||
++count;
|
||||
@@ -1755,11 +1755,11 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
|
||||
void BattleGroundMgr::InitAutomaticArenaPointDistribution()
|
||||
{
|
||||
if(sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
if (sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
sLog.outDebug("Initializing Automatic Arena Point Distribution");
|
||||
QueryResult * result = CharacterDatabase.Query("SELECT NextArenaPointDistributionTime FROM saved_variables");
|
||||
if(!result)
|
||||
if (!result)
|
||||
{
|
||||
sLog.outDebug("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now.");
|
||||
m_NextAutoDistributionTime = time(NULL) + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
|
||||
@@ -1787,7 +1787,7 @@ void BattleGroundMgr::DistributeArenaPoints()
|
||||
//at first update all points for all team members
|
||||
for(ObjectMgr::ArenaTeamMap::iterator team_itr = objmgr.GetArenaTeamMapBegin(); team_itr != objmgr.GetArenaTeamMapEnd(); ++team_itr)
|
||||
{
|
||||
if(ArenaTeam * at = team_itr->second)
|
||||
if (ArenaTeam * at = team_itr->second)
|
||||
{
|
||||
at->UpdateArenaPointsHelper(PlayerPoints);
|
||||
}
|
||||
@@ -1811,7 +1811,7 @@ void BattleGroundMgr::DistributeArenaPoints()
|
||||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START);
|
||||
for(ObjectMgr::ArenaTeamMap::iterator titr = objmgr.GetArenaTeamMapBegin(); titr != objmgr.GetArenaTeamMapEnd(); ++titr)
|
||||
{
|
||||
if(ArenaTeam * at = titr->second)
|
||||
if (ArenaTeam * at = titr->second)
|
||||
{
|
||||
at->FinishWeek(); // set played this week etc values to 0 in memory, too
|
||||
at->SaveToDB(); // save changes
|
||||
@@ -1828,7 +1828,7 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
|
||||
{
|
||||
uint32 PlayerLevel = 10;
|
||||
|
||||
if(plr)
|
||||
if (plr)
|
||||
PlayerLevel = plr->getLevel();
|
||||
|
||||
data->Initialize(SMSG_BATTLEFIELD_LIST);
|
||||
@@ -1860,12 +1860,12 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
|
||||
void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
BattleGround *bg = GetBattleGround(instanceId, bgTypeId);
|
||||
if(bg)
|
||||
if (bg)
|
||||
{
|
||||
uint32 mapid = bg->GetMapId();
|
||||
float x, y, z, O;
|
||||
uint32 team = pl->GetBGTeam();
|
||||
if(team==0)
|
||||
if (team==0)
|
||||
team = pl->GetTeam();
|
||||
bg->GetTeamStartLoc(team, x, y, z, O);
|
||||
|
||||
@@ -1882,7 +1882,7 @@ void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *
|
||||
{
|
||||
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
||||
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
|
||||
if(time_ == uint32(-1))
|
||||
if (time_ == uint32(-1))
|
||||
time_ = 0;
|
||||
data << guid << time_;
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
@@ -1973,7 +1973,7 @@ uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
|
||||
void BattleGroundMgr::ToggleTesting()
|
||||
{
|
||||
m_Testing = !m_Testing;
|
||||
if(m_Testing)
|
||||
if (m_Testing)
|
||||
sWorld.SendWorldText(LANG_DEBUG_BG_ON);
|
||||
else
|
||||
sWorld.SendWorldText(LANG_DEBUG_BG_OFF);
|
||||
@@ -1982,7 +1982,7 @@ void BattleGroundMgr::ToggleTesting()
|
||||
void BattleGroundMgr::ToggleArenaTesting()
|
||||
{
|
||||
m_ArenaTesting = !m_ArenaTesting;
|
||||
if(m_ArenaTesting)
|
||||
if (m_ArenaTesting)
|
||||
sWorld.SendWorldText(LANG_DEBUG_ARENA_ON);
|
||||
else
|
||||
sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF);
|
||||
@@ -2026,7 +2026,7 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
if( !result )
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar( 1 );
|
||||
bar.step();
|
||||
|
||||
@@ -233,7 +233,7 @@ class BattleGroundMgr
|
||||
BattleGroundTypeId GetBattleMasterBG(uint32 entry) const
|
||||
{
|
||||
BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
|
||||
if(itr != mBattleMastersMap.end())
|
||||
if (itr != mBattleMastersMap.end())
|
||||
return itr->second;
|
||||
return BATTLEGROUND_WS;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void BattleGroundNA::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
/*if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
/*if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
// update something
|
||||
}*/
|
||||
@@ -85,7 +85,7 @@ void BattleGroundNA::AddPlayer(Player *plr)
|
||||
|
||||
void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if(GetStatus() == STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
@@ -96,10 +96,10 @@ void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
|
||||
void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if(!killer)
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("BattleGroundNA: Killer player not found");
|
||||
return;
|
||||
@@ -121,7 +121,7 @@ bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
|
||||
|
||||
void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
@@ -137,7 +137,7 @@ void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
break;
|
||||
}
|
||||
|
||||
//if(buff_guid)
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ void BattleGroundNA::Reset()
|
||||
bool BattleGroundNA::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
if( !AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854, 2966.833, 12.6462, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854, 2966.833, 12.6462, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_2, BG_NA_OBJECT_TYPE_DOOR_2, 4081.179, 2874.97, 12.39171, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_3, BG_NA_OBJECT_TYPE_DOOR_3, 4023.709, 2981.777, 10.70117, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_4, BG_NA_OBJECT_TYPE_DOOR_4, 4090.064, 2858.438, 10.23631, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY)
|
||||
|
||||
@@ -50,7 +50,7 @@ void BattleGroundRL::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
/*if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
/*if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
// update something
|
||||
}*/
|
||||
@@ -85,7 +85,7 @@ void BattleGroundRL::AddPlayer(Player *plr)
|
||||
|
||||
void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if(GetStatus() == STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
@@ -96,10 +96,10 @@ void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
|
||||
void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if(!killer)
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("Killer player not found");
|
||||
return;
|
||||
@@ -122,7 +122,7 @@ bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
|
||||
void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
@@ -138,7 +138,7 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
break;
|
||||
}
|
||||
|
||||
//if(buff_guid)
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ void BattleGroundRL::Reset()
|
||||
bool BattleGroundRL::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
if( !AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648, 1730.557, 31.60557, 1.684245, 0, 0, 0.7460582, 0.6658807, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971, 1632.719971, 36.730400, -1.448624, 0, 0, 0.6626201, -0.7489557, 120)
|
||||
|
||||
@@ -65,7 +65,7 @@ void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
|
||||
void BattleGroundSA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+64
-64
@@ -67,43 +67,43 @@ void BattleGroundWS::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
if(m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if(m_FlagsTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
RespawnFlag(ALLIANCE, true);
|
||||
}
|
||||
}
|
||||
if(m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if(m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
RespawnFlagAfterDrop(ALLIANCE);
|
||||
}
|
||||
}
|
||||
if(m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if(m_FlagsTimer[BG_TEAM_HORDE] < 0)
|
||||
if (m_FlagsTimer[BG_TEAM_HORDE] < 0)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_HORDE] = 0;
|
||||
RespawnFlag(HORDE, true);
|
||||
}
|
||||
}
|
||||
if(m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if(m_FlagsDropTimer[BG_TEAM_HORDE] < 0)
|
||||
if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_HORDE] = 0;
|
||||
RespawnFlagAfterDrop(HORDE);
|
||||
@@ -150,7 +150,7 @@ void BattleGroundWS::AddPlayer(Player *plr)
|
||||
|
||||
void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
|
||||
{
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
{
|
||||
sLog.outDebug("Respawn Alliance flag");
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
@@ -161,7 +161,7 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
}
|
||||
|
||||
if(captured)
|
||||
if (captured)
|
||||
{
|
||||
//when map_update will be allowed for battlegrounds this code will be useless
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
@@ -173,11 +173,11 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
|
||||
|
||||
void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
RespawnFlag(team,false);
|
||||
if(team == ALLIANCE)
|
||||
if (team == ALLIANCE)
|
||||
{
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
@@ -191,7 +191,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID(team));
|
||||
if(obj)
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
sLog.outError("unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team)));
|
||||
@@ -201,13 +201,13 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
|
||||
|
||||
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 winner = 0;
|
||||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!this->IsHordeFlagPickedup())
|
||||
return;
|
||||
@@ -216,7 +216,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Horde Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if(GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(ALLIANCE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
|
||||
@@ -230,7 +230,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Alliance Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if(GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(HORDE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
|
||||
@@ -241,7 +241,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
@@ -251,13 +251,13 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
// only flag capture should be updated
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
|
||||
if(GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = ALLIANCE;
|
||||
|
||||
if(GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = HORDE;
|
||||
|
||||
if(winner)
|
||||
if (winner)
|
||||
{
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
|
||||
@@ -275,15 +275,15 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
|
||||
void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
// if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages
|
||||
// just take off the aura
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if(!this->IsHordeFlagPickedup())
|
||||
if (!this->IsHordeFlagPickedup())
|
||||
return;
|
||||
if(GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
if (GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
@@ -291,9 +291,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!this->IsAllianceFlagPickedup())
|
||||
if (!this->IsAllianceFlagPickedup())
|
||||
return;
|
||||
if(GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
@@ -304,11 +304,11 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
||||
|
||||
bool set = false;
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if(!this->IsHordeFlagPickedup())
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
if(GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
if (GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
@@ -319,9 +319,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!this->IsAllianceFlagPickedup())
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
if(GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
@@ -336,7 +336,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
||||
Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
UpdateFlagState(Source->GetTeam(), 1);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1));
|
||||
@@ -353,7 +353,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
||||
|
||||
void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
int32 message_id = 0;
|
||||
@@ -392,9 +392,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
||||
}
|
||||
|
||||
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
|
||||
if(this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->id == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
|
||||
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
|
||||
{
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
message_id = LANG_BG_WS_RETURNED_AF;
|
||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
@@ -421,9 +421,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
||||
}
|
||||
|
||||
//Horde flag on ground(not in base) (returned or picked up again)
|
||||
if(this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->id == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
|
||||
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
|
||||
{
|
||||
if(Source->GetTeam() == HORDE)
|
||||
if (Source->GetTeam() == HORDE)
|
||||
{
|
||||
message_id = LANG_BG_WS_RETURNED_HF;
|
||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
@@ -459,9 +459,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
||||
void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
|
||||
{
|
||||
// sometimes flag aura not removed :(
|
||||
if(IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
||||
{
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
|
||||
this->SetAllianceFlagPicker(0);
|
||||
@@ -470,9 +470,9 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
|
||||
else
|
||||
this->EventPlayerDroppedFlag(plr);
|
||||
}
|
||||
if(IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
|
||||
{
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
|
||||
this->SetHordeFlagPicker(0);
|
||||
@@ -485,7 +485,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
|
||||
|
||||
void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
|
||||
{
|
||||
if(team == ALLIANCE)
|
||||
if (team == ALLIANCE)
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
|
||||
else
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
|
||||
@@ -493,7 +493,7 @@ void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
|
||||
|
||||
void BattleGroundWS::UpdateTeamScore(uint32 team)
|
||||
{
|
||||
if(team == ALLIANCE)
|
||||
if (team == ALLIANCE)
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team));
|
||||
else
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
|
||||
@@ -502,7 +502,7 @@ void BattleGroundWS::UpdateTeamScore(uint32 team)
|
||||
void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
@@ -528,13 +528,13 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
||||
break;
|
||||
case 3646: // Alliance Flag spawn
|
||||
if(m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
|
||||
if(GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
|
||||
if (GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source);
|
||||
break;
|
||||
case 3647: // Horde Flag spawn
|
||||
if(m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
|
||||
if(GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
|
||||
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source);
|
||||
break;
|
||||
case 3649: // unk1
|
||||
@@ -548,14 +548,14 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
break;
|
||||
}
|
||||
|
||||
//if(buff_guid)
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
bool BattleGroundWS::SetupBattleGround()
|
||||
{
|
||||
// flags
|
||||
if( !AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000)
|
||||
if (!AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000)
|
||||
|| !AddObject(BG_WS_OBJECT_H_FLAG, BG_OBJECT_H_FLAG_WS_ENTRY, 916.0226f, 1434.405f, 345.413f, 0.01745329f, 0, 0, 0.008726535f, 0.9999619f, BG_WS_FLAG_RESPAWN_TIME/1000)
|
||||
// buffs
|
||||
|| !AddObject(BG_WS_OBJECT_SPEEDBUFF_1, BG_OBJECTID_SPEEDBUFF_ENTRY, 1449.93f, 1470.71f, 342.6346f, -1.64061f, 0, 0, 0.7313537f, -0.6819983f, BUFF_RESPAWN_TIME)
|
||||
@@ -583,14 +583,14 @@ bool BattleGroundWS::SetupBattleGround()
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const *sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
||||
if(!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
|
||||
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
||||
if(!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
|
||||
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
@@ -620,9 +620,9 @@ void BattleGroundWS::Reset()
|
||||
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
|
||||
|
||||
/* Spirit nodes is static at this BG and then not required deleting at BG reset.
|
||||
if(m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
|
||||
if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
|
||||
DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
|
||||
if(m_BgCreatures[WS_SPIRIT_MAIN_HORDE])
|
||||
if (m_BgCreatures[WS_SPIRIT_MAIN_HORDE])
|
||||
DelCreature(WS_SPIRIT_MAIN_HORDE);
|
||||
*/
|
||||
}
|
||||
@@ -630,9 +630,9 @@ void BattleGroundWS::Reset()
|
||||
void BattleGroundWS::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if( winner == ALLIANCE )
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
|
||||
if( winner == HORDE )
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
|
||||
@@ -643,7 +643,7 @@ void BattleGroundWS::EndBattleGround(uint32 winner)
|
||||
|
||||
void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
EventPlayerDroppedFlag(player);
|
||||
@@ -680,16 +680,16 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
|
||||
//if a player dies in preparation phase - then the player can't cheat
|
||||
//and teleport to the graveyard outside the flagroom
|
||||
//and start running around, while the doors are still closed
|
||||
if(player->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
||||
else
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
||||
else
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE);
|
||||
@@ -701,14 +701,14 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data)
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));
|
||||
|
||||
if(m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1);
|
||||
else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0);
|
||||
|
||||
if(m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1);
|
||||
else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1);
|
||||
|
||||
Reference in New Issue
Block a user