mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[7632] more "if"-condition related codestyle in battlegroundfiles
this time with this regex: sed -i 's/if *( *\(.*\) *)$/if (\1)/' BattleGround*
This commit is contained in:
parent
73d12d7ccf
commit
6b2fd22a9c
14 changed files with 346 additions and 346 deletions
|
|
@ -44,7 +44,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;
|
||||
|
|
@ -119,7 +119,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);
|
||||
}
|
||||
|
||||
|
|
@ -219,8 +219,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();
|
||||
|
|
@ -228,7 +228,7 @@ BattleGround::~BattleGround()
|
|||
|
||||
void BattleGround::Update(uint32 diff)
|
||||
{
|
||||
if(!GetPlayersSize() && !GetReviveQueueSize())
|
||||
if (!GetPlayersSize() && !GetReviveQueueSize())
|
||||
//BG is empty
|
||||
return;
|
||||
|
||||
|
|
@ -255,7 +255,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)
|
||||
{
|
||||
|
|
@ -263,7 +263,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)
|
||||
|
|
@ -292,7 +292,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);
|
||||
|
|
@ -306,14 +306,14 @@ 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;
|
||||
|
|
@ -359,7 +359,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;
|
||||
|
|
@ -399,7 +399,7 @@ void BattleGround::Update(uint32 diff)
|
|||
//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();
|
||||
|
|
@ -410,7 +410,7 @@ 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))
|
||||
|
|
@ -425,11 +425,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;
|
||||
|
|
@ -462,7 +462,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);
|
||||
|
|
@ -475,19 +475,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);
|
||||
}
|
||||
}
|
||||
|
|
@ -507,7 +507,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;
|
||||
|
|
@ -516,7 +516,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);
|
||||
|
|
@ -530,7 +530,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;
|
||||
|
|
@ -539,7 +539,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);
|
||||
}
|
||||
}
|
||||
|
|
@ -550,7 +550,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;
|
||||
|
|
@ -559,7 +559,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);
|
||||
}
|
||||
}
|
||||
|
|
@ -568,14 +568,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;
|
||||
|
|
@ -584,7 +584,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);
|
||||
}
|
||||
}
|
||||
|
|
@ -614,7 +614,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;
|
||||
|
||||
|
|
@ -622,7 +622,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;
|
||||
|
||||
|
|
@ -640,7 +640,7 @@ 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)));
|
||||
|
|
@ -666,12 +666,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);
|
||||
|
|
@ -681,10 +681,10 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
}
|
||||
|
||||
// should remove spirit of redemption
|
||||
if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
|
||||
if(!plr->isAlive())
|
||||
if (!plr->isAlive())
|
||||
{
|
||||
plr->ResurrectPlayer(1.0f);
|
||||
plr->SpawnCorpseBones();
|
||||
|
|
@ -694,15 +694,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);
|
||||
|
|
@ -725,7 +725,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();
|
||||
|
|
@ -739,7 +739,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
loser_arena_team->NotifyStatsChanged();
|
||||
}
|
||||
|
||||
if(winmsg_id)
|
||||
if (winmsg_id)
|
||||
SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
|
||||
|
|
@ -765,7 +765,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;
|
||||
|
||||
BattleGroundMarks mark;
|
||||
|
|
@ -774,21 +774,21 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
|||
{
|
||||
case BATTLEGROUND_AV:
|
||||
IsSpell = true;
|
||||
if(count == ITEM_WINNER_COUNT)
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
mark = SPELL_AV_MARK_WINNER;
|
||||
else
|
||||
mark = SPELL_AV_MARK_LOSER;
|
||||
break;
|
||||
case BATTLEGROUND_WS:
|
||||
IsSpell = true;
|
||||
if(count == ITEM_WINNER_COUNT)
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
mark = SPELL_WS_MARK_WINNER;
|
||||
else
|
||||
mark = SPELL_WS_MARK_LOSER;
|
||||
break;
|
||||
case BATTLEGROUND_AB:
|
||||
IsSpell = true;
|
||||
if(count == ITEM_WINNER_COUNT)
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
mark = SPELL_AB_MARK_WINNER;
|
||||
else
|
||||
mark = SPELL_AB_MARK_LOSER;
|
||||
|
|
@ -801,9 +801,9 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
|||
return;
|
||||
}
|
||||
|
||||
if(IsSpell)
|
||||
if (IsSpell)
|
||||
plr->CastSpell(plr, mark, true);
|
||||
else if ( objmgr.GetItemPrototype( mark ) )
|
||||
else if (objmgr.GetItemPrototype( mark ) )
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
uint32 no_space_count = 0;
|
||||
|
|
@ -812,10 +812,10 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
|||
count -= no_space_count;
|
||||
|
||||
if( count != 0 && !dest.empty()) // can add some
|
||||
if(Item* item = plr->StoreNewItem( dest, mark, true, 0))
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -823,14 +823,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
|
||||
|
|
@ -842,8 +842,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];
|
||||
|
||||
|
|
@ -860,7 +860,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;
|
||||
|
|
@ -896,7 +896,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);
|
||||
|
|
@ -905,7 +905,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);
|
||||
|
|
@ -916,7 +916,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
Player *plr = objmgr.GetPlayer(guid);
|
||||
|
||||
// should remove spirit of redemption
|
||||
if(plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
|
||||
if(plr && !plr->isAlive()) // resurrect on exit
|
||||
|
|
@ -931,38 +931,38 @@ 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)
|
||||
|
||||
// summon old pet if there was one and there isn't a current pet
|
||||
if(!plr->GetPet() && plr->GetTemporaryUnsummonedPetNumber())
|
||||
if (!plr->GetPet() && plr->GetTemporaryUnsummonedPetNumber())
|
||||
{
|
||||
Pet* NewPet = new Pet;
|
||||
if(!NewPet->LoadPetFromDB(plr, 0, (plr)->GetTemporaryUnsummonedPetNumber(), true))
|
||||
if (!NewPet->LoadPetFromDB(plr, 0, (plr)->GetTemporaryUnsummonedPetNumber(), true))
|
||||
delete NewPet;
|
||||
|
||||
(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);
|
||||
|
|
@ -975,7 +975,7 @@ 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)));
|
||||
|
|
@ -986,7 +986,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
|
|
@ -1011,13 +1011,13 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
// 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
|
||||
|
|
@ -1084,21 +1084,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);
|
||||
|
|
@ -1107,9 +1107,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));
|
||||
|
|
@ -1153,7 +1153,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);
|
||||
|
|
@ -1209,7 +1209,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;
|
||||
|
|
@ -1269,10 +1269,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;
|
||||
|
|
@ -1294,12 +1294,12 @@ 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;
|
||||
|
||||
plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true);
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry( SPELL_WAITING_FOR_RESURRECT );
|
||||
if(spellInfo)
|
||||
if (spellInfo)
|
||||
{
|
||||
Aura *Aur = CreateAura(spellInfo, 0, NULL, plr);
|
||||
plr->AddAura(Aur);
|
||||
|
|
@ -1312,12 +1312,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);
|
||||
|
|
@ -1331,7 +1331,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
|
||||
|
|
@ -1379,7 +1379,7 @@ 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())
|
||||
|
|
@ -1398,7 +1398,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);
|
||||
|
|
@ -1413,12 +1413,12 @@ void BattleGround::DoorOpen(uint32 type)
|
|||
void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
|
||||
if(!map)
|
||||
if (!map)
|
||||
return;
|
||||
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)
|
||||
|
|
@ -1430,7 +1430,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);
|
||||
|
|
@ -1442,7 +1442,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;
|
||||
|
|
@ -1455,7 +1455,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());
|
||||
return NULL;
|
||||
|
|
@ -1474,13 +1474,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);
|
||||
|
|
@ -1491,7 +1491,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);
|
||||
|
|
@ -1502,11 +1502,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;
|
||||
|
|
@ -1519,11 +1519,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;
|
||||
|
|
@ -1538,13 +1538,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();
|
||||
|
|
@ -1610,7 +1610,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:
|
||||
|
|
@ -1659,7 +1659,7 @@ 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))
|
||||
|
|
@ -1677,7 +1677,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;
|
||||
}
|
||||
|
|
@ -1690,14 +1690,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;
|
||||
|
|
@ -1717,10 +1717,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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue