Core: Codestyle clean-up

"plr"->player

Note: codestyle methods needs maintained, Player* player.
This commit is contained in:
Bootz
2011-11-07 11:06:39 -06:00
parent c51f6e7fa0
commit f75ec5ba2b
67 changed files with 852 additions and 852 deletions
+16 -16
View File
@@ -433,8 +433,8 @@ void ArenaTeam::NotifyStatsChanged()
// This is called after a rated match ended
// Updates arena team stats for every member of the team (not only the ones who participated!)
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
if (Player* plr = ObjectAccessor::FindPlayer(itr->Guid))
SendStats(plr->GetSession());
if (Player* player = ObjectAccessor::FindPlayer(itr->Guid))
SendStats(player->GetSession());
}
void ArenaTeam::Inspect(WorldSession* session, uint64 guid)
@@ -455,17 +455,17 @@ void ArenaTeam::Inspect(WorldSession* session, uint64 guid)
session->SendPacket(&data);
}
void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
void ArenaTeamMember::ModifyPersonalRating(Player* player, int32 mod, uint32 slot)
{
if (int32(PersonalRating) + mod < 0)
PersonalRating = 0;
else
PersonalRating += mod;
if (plr)
if (player)
{
plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, PersonalRating);
plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_PERSONAL_RATING, PersonalRating, slot);
player->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, PersonalRating);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_PERSONAL_RATING, PersonalRating, slot);
}
}
@@ -716,16 +716,16 @@ int32 ArenaTeam::LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int3
return mod;
}
void ArenaTeam::MemberLost(Player* plr, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
// Called for each participant of a match after losing
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
if (itr->Guid == plr->GetGUID())
if (itr->Guid == player->GetGUID())
{
// Update personal rating
int32 mod = GetRatingMod(itr->PersonalRating, againstMatchmakerRating, false);
itr->ModifyPersonalRating(plr, mod, GetSlot());
itr->ModifyPersonalRating(player, mod, GetSlot());
// Update matchmaker rating
itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot());
@@ -735,8 +735,8 @@ void ArenaTeam::MemberLost(Player* plr, uint32 againstMatchmakerRating, int32 Ma
itr->SeasonGames +=1;
// update the unit fields
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
return;
}
}
@@ -764,16 +764,16 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, i
}
}
void ArenaTeam::MemberWon(Player* plr, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
// called for each participant after winning a match
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
if (itr->Guid == plr->GetGUID())
if (itr->Guid == player->GetGUID())
{
// update personal rating
int32 mod = GetRatingMod(itr->PersonalRating, againstMatchmakerRating, true);
itr->ModifyPersonalRating(plr, mod, GetSlot());
itr->ModifyPersonalRating(player, mod, GetSlot());
// update matchmaker rating
itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot());
@@ -784,8 +784,8 @@ void ArenaTeam::MemberWon(Player* plr, uint32 againstMatchmakerRating, int32 Mat
itr->SeasonWins += 1;
itr->WeekWins += 1;
// update unit fields
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
return;
}
}
+3 -3
View File
@@ -97,7 +97,7 @@ struct ArenaTeamMember
uint16 PersonalRating;
uint16 MatchMakerRating;
void ModifyPersonalRating(Player* plr, int32 mod, uint32 slot);
void ModifyPersonalRating(Player* player, int32 mod, uint32 slot);
void ModifyMatchmakerRating(int32 mod, uint32 slot);
};
@@ -172,9 +172,9 @@ class ArenaTeam
int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
float GetChanceAgainst(uint32 ownRating, uint32 opponentRating);
int32 WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change);
void MemberWon(Player* plr, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange);
void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange);
int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change);
void MemberLost(Player* plr, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
+135 -135
View File
@@ -124,8 +124,8 @@ template<class Do>
void Battleground::BroadcastWorker(Do& _do)
{
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
_do(plr);
if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
_do(player);
}
Battleground::Battleground()
@@ -333,13 +333,13 @@ inline void Battleground::_ProcessRessurect(uint32 diff)
Creature* sh = NULL;
for (std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
{
Player* plr = ObjectAccessor::FindPlayer(*itr2);
if (!plr)
Player* player = ObjectAccessor::FindPlayer(*itr2);
if (!player)
continue;
if (!sh && plr->IsInWorld())
if (!sh && player->IsInWorld())
{
sh = plr->GetMap()->GetCreature(itr->first);
sh = player->GetMap()->GetCreature(itr->first);
// only for visual effect
if (sh)
// Spirit Heal, effect 117
@@ -347,7 +347,7 @@ inline void Battleground::_ProcessRessurect(uint32 diff)
}
// Resurrection visual
plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true);
player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
m_ResurrectQueue.push_back(*itr2);
}
(itr->second).clear();
@@ -364,12 +364,12 @@ inline void Battleground::_ProcessRessurect(uint32 diff)
{
for (std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
{
Player* plr = ObjectAccessor::FindPlayer(*itr);
if (!plr)
Player* player = ObjectAccessor::FindPlayer(*itr);
if (!player)
continue;
plr->ResurrectPlayer(1.0f);
plr->CastSpell(plr, 6962, true);
plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true);
player->ResurrectPlayer(1.0f);
player->CastSpell(player, 6962, true);
player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
sObjectAccessor->ConvertCorpseForPlayer(*itr);
}
m_ResurrectQueue.clear();
@@ -429,8 +429,8 @@ inline void Battleground::_ProcessJoin(uint32 diff)
{
m_ResetStatTimer = 0;
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
plr->ResetAllPowers();
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
player->ResetAllPowers();
}
if (!(m_Events & BG_STARTING_EVENT_1))
@@ -484,19 +484,19 @@ inline void Battleground::_ProcessJoin(uint32 diff)
{
// TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START);
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
{
// BG Status packet
WorldPacket status;
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType());
plr->GetSession()->SendPacket(&status);
player->GetSession()->SendPacket(&status);
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
plr->ResetAllPowers();
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
player->ResetAllPowers();
// remove auras with duration lower than 30s
Unit::AuraApplicationMap & auraMap = plr->GetAppliedAuras();
Unit::AuraApplicationMap & auraMap = player->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();)
{
AuraApplication * aurApp = iter->second;
@@ -506,7 +506,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
&& aurApp->IsPositive()
&& (!(aura->GetSpellInfo()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
plr->RemoveAura(iter);
player->RemoveAura(iter);
else
++iter;
}
@@ -519,10 +519,10 @@ inline void Battleground::_ProcessJoin(uint32 diff)
PlaySoundToAll(SOUND_BG_START);
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
{
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
plr->ResetAllPowers();
player->RemoveAurasDueToSpell(SPELL_PREPARATION);
player->ResetAllPowers();
}
// Announce BG starting
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
@@ -788,28 +788,28 @@ void Battleground::EndBattleground(uint32 winner)
continue;
}
Player* plr = _GetPlayer(itr, "EndBattleground");
if (!plr)
Player* player = _GetPlayer(itr, "EndBattleground");
if (!player)
continue;
// should remove spirit of redemption
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (!plr->isAlive())
if (!player->isAlive())
{
plr->ResurrectPlayer(1.0f);
plr->SpawnCorpseBones();
player->ResurrectPlayer(1.0f);
player->SpawnCorpseBones();
}
else
{
//needed cause else in av some creatures will kill the players at the end
plr->CombatStop();
plr->getHostileRefManager().deleteReferences();
player->CombatStop();
player->getHostileRefManager().deleteReferences();
}
//this line is obsolete - team is set ALWAYS
//if (!team) team = plr->GetTeam();
//if (!team) team = player->GetTeam();
// per player calculation
if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
@@ -817,57 +817,57 @@ void Battleground::EndBattleground(uint32 winner)
if (team == winner)
{
// update achievement BEFORE personal rating update
ArenaTeamMember* member = winner_arena_team->GetMember(plr->GetGUID());
ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID());
if (member)
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->PersonalRating);
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->PersonalRating);
winner_arena_team->MemberWon(plr, loser_matchmaker_rating, winner_matchmaker_change);
winner_arena_team->MemberWon(player, loser_matchmaker_rating, winner_matchmaker_change);
}
else
{
loser_arena_team->MemberLost(plr, winner_matchmaker_rating, loser_matchmaker_change);
loser_arena_team->MemberLost(player, winner_matchmaker_rating, loser_matchmaker_change);
// Arena lost => reset the win_rated_arena having the "no_lose" condition
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE);
}
}
uint32 winner_kills = plr->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
uint32 loser_kills = plr->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
uint32 winner_arena = plr->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
uint32 winner_kills = player->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
uint32 loser_kills = player->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
uint32 winner_arena = player->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
// Reward winner team
if (team == winner)
{
if (IsRandom() || BattlegroundMgr::IsBGWeekend(GetTypeID()))
{
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills));
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills));
if (CanAwardArenaPoints())
plr->ModifyArenaPoints(winner_arena);
if (!plr->GetRandomWinner())
plr->SetRandomWinner(true);
player->ModifyArenaPoints(winner_arena);
if (!player->GetRandomWinner())
player->SetRandomWinner(true);
}
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
}
else
{
if (IsRandom() || BattlegroundMgr::IsBGWeekend(GetTypeID()))
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loser_kills));
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loser_kills));
}
plr->ResetAllPowers();
plr->CombatStopWithPets(true);
player->ResetAllPowers();
player->CombatStopWithPets(true);
BlockMovement(plr);
BlockMovement(player);
sBattlegroundMgr->BuildPvpLogDataPacket(&data, this);
plr->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, plr->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType());
plr->GetSession()->SendPacket(&data);
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType());
player->GetSession()->SendPacket(&data);
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
}
if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
@@ -908,9 +908,9 @@ uint32 Battleground::GetBattlemasterEntry() const
}
}
void Battleground::BlockMovement(Player* plr)
void Battleground::BlockMovement(Player* player)
{
plr->SetClientControl(plr, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave()
player->SetClientControl(player, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave()
}
void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket)
@@ -936,32 +936,32 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
RemovePlayerFromResurrectQueue(guid);
Player* plr = ObjectAccessor::FindPlayer(guid);
Player* player = ObjectAccessor::FindPlayer(guid);
// should remove spirit of redemption
if (plr)
if (player)
{
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (!plr->isAlive()) // resurrect on exit
if (!player->isAlive()) // resurrect on exit
{
plr->ResurrectPlayer(1.0f);
plr->SpawnCorpseBones();
player->ResurrectPlayer(1.0f);
player->SpawnCorpseBones();
}
}
RemovePlayer(plr, guid, team); // BG subclass specific code
RemovePlayer(player, guid, team); // BG subclass specific code
if (participant) // if the player was a match participant, remove auras, calc rating, update queue
{
BattlegroundTypeId bgTypeId = GetTypeID();
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
if (plr)
if (player)
{
plr->ClearAfkReports();
player->ClearAfkReports();
if (!team) team = plr->GetTeam();
if (!team) team = player->GetTeam();
// if arena, remove the specific arena auras
if (isArena())
@@ -969,8 +969,8 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing)
// unsummon current and summon old pet if there was one and there isn't a current pet
plr->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT);
plr->ResummonPetTemporaryUnSummonedIfAny();
player->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT);
player->ResummonPetTemporaryUnSummonedIfAny();
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
{
@@ -978,18 +978,18 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
ArenaTeam* winner_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
ArenaTeam* loser_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team));
if (winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
loser_arena_team->MemberLost(plr, GetArenaMatchmakerRating(GetOtherTeam(team)));
loser_arena_team->MemberLost(player, GetArenaMatchmakerRating(GetOtherTeam(team)));
}
}
if (SendPacket)
{
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, plr->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
plr->GetSession()->SendPacket(&data);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
player->GetSession()->SendPacket(&data);
}
// this call is important, because player, when joins to battleground, this method is not called, so it must be called when leaving bg
plr->RemoveBattlegroundQueueId(bgQueueTypeId);
player->RemoveBattlegroundQueueId(bgQueueTypeId);
}
else
// removing offline participant
@@ -1023,20 +1023,20 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
// Let others know
WorldPacket data;
sBattlegroundMgr->BuildPlayerLeftBattlegroundPacket(&data, guid);
SendPacketToTeam(team, &data, plr, false);
SendPacketToTeam(team, &data, player, false);
}
if (plr)
if (player)
{
// Do next only if found in battleground
plr->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
// reset destination bg team
plr->SetBGTeam(0);
player->SetBGTeam(0);
if (Transport)
plr->TeleportToBGEntryPoint();
player->TeleportToBGEntryPoint();
sLog->outDetail("BATTLEGROUND: Removed player %s from Battleground.", plr->GetName());
sLog->outDetail("BATTLEGROUND: Removed player %s from Battleground.", player->GetName());
}
//battleground object will be deleted next Battleground::Update() call
@@ -1087,16 +1087,16 @@ void Battleground::StartBattleground()
sLog->outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
}
void Battleground::AddPlayer(Player* plr)
void Battleground::AddPlayer(Player* player)
{
// remove afk from player
if (plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK))
plr->ToggleAFK();
if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK))
player->ToggleAFK();
// score struct must be created in inherited class
uint64 guid = plr->GetGUID();
uint32 team = plr->GetBGTeam();
uint64 guid = player->GetGUID();
uint32 team = player->GetBGTeam();
BattlegroundPlayer bp;
bp.OfflineRemoveTime = 0;
@@ -1108,74 +1108,74 @@ void Battleground::AddPlayer(Player* plr)
UpdatePlayersCountByTeam(team, false); // +1 player
WorldPacket data;
sBattlegroundMgr->BuildPlayerJoinedBattlegroundPacket(&data, plr);
SendPacketToTeam(team, &data, plr, false);
sBattlegroundMgr->BuildPlayerJoinedBattlegroundPacket(&data, player);
SendPacketToTeam(team, &data, player, false);
// BG Status packet
WorldPacket status;
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType(), isArena() ? 0 : 1);
plr->GetSession()->SendPacket(&status);
player->GetSession()->SendPacket(&status);
plr->RemoveAurasByType(SPELL_AURA_MOUNTED);
player->RemoveAurasByType(SPELL_AURA_MOUNTED);
// add arena specific auras
if (isArena())
{
plr->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT);
player->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT);
if (team == ALLIANCE) // gold
{
if (plr->GetTeam() == HORDE)
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG, true);
if (player->GetTeam() == HORDE)
player->CastSpell(player, SPELL_HORDE_GOLD_FLAG, true);
else
plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG, true);
player->CastSpell(player, SPELL_ALLIANCE_GOLD_FLAG, true);
}
else // green
{
if (plr->GetTeam() == HORDE)
plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG, true);
if (player->GetTeam() == HORDE)
player->CastSpell(player, SPELL_HORDE_GREEN_FLAG, true);
else
plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG, true);
player->CastSpell(player, SPELL_ALLIANCE_GREEN_FLAG, true);
}
plr->DestroyConjuredItems(true);
plr->UnsummonPetTemporaryIfAny();
player->DestroyConjuredItems(true);
player->UnsummonPetTemporaryIfAny();
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
{
plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true);
plr->ResetAllPowers();
player->CastSpell(player, SPELL_ARENA_PREPARATION, true);
player->ResetAllPowers();
}
WorldPacket teammate;
teammate.Initialize(SMSG_ARENA_OPPONENT_UPDATE, 8);
teammate << uint64(plr->GetGUID());
SendPacketToTeam(team, &teammate, plr, false);
teammate << uint64(player->GetGUID());
SendPacketToTeam(team, &teammate, player, false);
}
else
{
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
player->CastSpell(player, SPELL_PREPARATION, true); // reduces all mana cost of spells.
}
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
// setup BG group membership
PlayerAddedToBGCheckIfBGIsRunning(plr);
AddOrSetPlayerToCorrectBgGroup(plr, team);
PlayerAddedToBGCheckIfBGIsRunning(player);
AddOrSetPlayerToCorrectBgGroup(player, team);
// Log
sLog->outDetail("BATTLEGROUND: Player %s joined the battle.", plr->GetName());
sLog->outDetail("BATTLEGROUND: Player %s joined the battle.", player->GetName());
}
// this method adds player to his team's bg group, or sets his correct group if player is already in bg group
@@ -1385,11 +1385,11 @@ void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
{
m_ReviveQueue[npc_guid].push_back(player_guid);
Player* plr = ObjectAccessor::FindPlayer(player_guid);
if (!plr)
Player* player = ObjectAccessor::FindPlayer(player_guid);
if (!player)
return;
plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true);
player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
}
void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid)
@@ -1401,8 +1401,8 @@ void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid)
if (*itr2 == player_guid)
{
(itr->second).erase(itr2);
if (Player* plr = ObjectAccessor::FindPlayer(player_guid))
plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
if (Player* player = ObjectAccessor::FindPlayer(player_guid))
player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
return;
}
}
@@ -1680,9 +1680,9 @@ void Battleground::SendWarningToAll(int32 entry, ...)
data << msg.c_str();
data << (uint8)0;
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
if (plr->GetSession())
plr->GetSession()->SendPacket(&data);
if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
if (player->GetSession())
player->GetSession()->SendPacket(&data);
}
void Battleground::SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 arg1, int32 arg2)
@@ -1759,12 +1759,12 @@ void Battleground::HandleKillPlayer(Player* player, Player* killer)
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
Player* plr = ObjectAccessor::FindPlayer(itr->first);
if (!plr || plr == killer)
Player* player = ObjectAccessor::FindPlayer(itr->first);
if (!player || player == killer)
continue;
if (plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player))
UpdatePlayerScore(plr, SCORE_HONORABLE_KILLS, 1);
if (player->GetTeam() == killer->GetTeam() && player->IsAtGroupRewardDistance(player))
UpdatePlayerScore(player, SCORE_HONORABLE_KILLS, 1);
}
}
@@ -1799,7 +1799,7 @@ bool Battleground::IsPlayerInBattleground(uint64 guid) const
return false;
}
void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* player)
{
if (GetStatus() != STATUS_WAIT_LEAVE)
return;
@@ -1807,13 +1807,13 @@ void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
WorldPacket data;
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
BlockMovement(plr);
BlockMovement(player);
sBattlegroundMgr->BuildPvpLogDataPacket(&data, this);
plr->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, plr->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType());
plr->GetSession()->SendPacket(&data);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType());
player->GetSession()->SendPacket(&data);
}
uint32 Battleground::GetAlivePlayersCountByTeam(uint32 Team) const
+5 -5
View File
@@ -463,7 +463,7 @@ class Battleground
void UpdateWorldState(uint32 Field, uint32 Value);
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* Source);
void EndBattleground(uint32 winner);
void BlockMovement(Player* plr);
void BlockMovement(Player* player);
void SendWarningToAll(int32 entry, ...);
void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL);
@@ -515,7 +515,7 @@ class Battleground
virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) {}
void EventPlayerLoggedIn(Player* player);
void EventPlayerLoggedOut(Player* player);
virtual void EventPlayerDamagedGO(Player* /*plr*/, GameObject* /*go*/, uint32 /*eventType*/) {}
virtual void EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/, uint32 /*eventType*/) {}
virtual void EventPlayerUsedGO(Player* /*player*/, GameObject* /*go*/){}
// this function can be used by spell to interact with the BG map
@@ -526,7 +526,7 @@ class Battleground
// Death related
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
virtual void AddPlayer(Player* plr); // must be implemented in BG subclass
virtual void AddPlayer(Player* player); // must be implemented in BG subclass
void AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team);
@@ -554,7 +554,7 @@ class Battleground
//to be removed
const char* GetTrinityString(int32 entry);
virtual bool HandlePlayerUnderMap(Player* /*plr*/) { return false; }
virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; }
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
uint32 GetPlayerTeam(uint64 guid) const;
@@ -575,7 +575,7 @@ class Battleground
protected:
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
void EndNow();
void PlayerAddedToBGCheckIfBGIsRunning(Player* plr);
void PlayerAddedToBGCheckIfBGIsRunning(Player* player);
Player* _GetPlayer(uint64 guid, bool offlineRemove, const char* context) const;
Player* _GetPlayer(BattlegroundPlayerMap::iterator itr, const char* context);
@@ -291,10 +291,10 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
}
else
{
Player* plr = ObjectAccessor::FindPlayer(itr2->first);
Player* player = ObjectAccessor::FindPlayer(itr2->first);
uint32 team = bg->GetPlayerTeam(itr2->first);
if (!team && plr)
team = plr->GetBGTeam();
if (!team && player)
team = player->GetBGTeam();
*data << uint8(team == ALLIANCE ? 1 : 0); // green or yellow
}
*data << uint32(itr2->second->DamageDone); // damage done
@@ -422,10 +422,10 @@ void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint6
*data << uint64(guid);
}
void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* plr)
void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player)
{
data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8);
*data << uint64(plr->GetGUID());
*data << uint64(player->GetGUID());
}
Battleground* BattlegroundMgr::GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId)
@@ -804,17 +804,17 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Automatic Arena Point Distribution initialized.");
}
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* plr, BattlegroundTypeId bgTypeId, uint8 fromWhere)
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
{
if (!plr)
if (!player)
return;
uint32 winner_kills = plr->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
uint32 winner_arena = plr->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
uint32 loser_kills = plr->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
uint32 winner_kills = player->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
uint32 winner_arena = player->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
uint32 loser_kills = player->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
winner_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), float(winner_kills));
loser_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), float(loser_kills));
winner_kills = Trinity::Honor::hk_honor_at_level(player->getLevel(), float(winner_kills));
loser_kills = Trinity::Honor::hk_honor_at_level(player->getLevel(), float(loser_kills));
data->Initialize(SMSG_BATTLEFIELD_LIST);
*data << uint64(guid); // battlemaster guid
@@ -824,7 +824,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
*data << uint8(0); // unk
// Rewards
*data << uint8(plr->GetRandomWinner()); // 3.3.3 hasWin
*data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin
*data << uint32(winner_kills); // 3.3.3 winHonor
*data << uint32(winner_arena); // 3.3.3 winArena
*data << uint32(loser_kills); // 3.3.3 lossHonor
@@ -835,7 +835,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
if (isRandom)
{
// Rewards (random)
*data << uint8(plr->GetRandomWinner()); // 3.3.3 hasWin_Random
*data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin_Random
*data << uint32(winner_kills); // 3.3.3 winHonor_Random
*data << uint32(winner_arena); // 3.3.3 winArena_Random
*data << uint32(loser_kills); // 3.3.3 lossHonor_Random
@@ -853,7 +853,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
if (Battleground* bgTemplate = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId))
{
// expected bracket entry
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), plr->getLevel()))
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), player->getLevel()))
{
uint32 count = 0;
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
@@ -65,9 +65,9 @@ class BattlegroundMgr
void Update(uint32 diff);
/* Packet Building */
void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* plr);
void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player);
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid);
void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* plr, BattlegroundTypeId bgTypeId, uint8 fromWhere);
void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
@@ -285,7 +285,7 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg
//remove player from queue and from group info, if group info is empty then remove it too
void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
{
//Player* plr = ObjectAccessor::FindPlayer(guid);
//Player* player = ObjectAccessor::FindPlayer(guid);
int32 bracket_id = -1; // signed for proper for-loop finish
QueuedPlayersMap::iterator itr;
@@ -362,8 +362,8 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId))
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
if (Player* plr = ObjectAccessor::FindPlayer(guid))
at->MemberLost(plr, group->OpponentsMatchmakerRating);
if (Player* player = ObjectAccessor::FindPlayer(guid))
at->MemberLost(player, group->OpponentsMatchmakerRating);
else
at->OfflineMemberLost(guid, group->OpponentsMatchmakerRating);
at->SaveToDB();
@@ -442,36 +442,36 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg,
for (std::map<uint64, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
{
// get the player
Player* plr = ObjectAccessor::FindPlayer(itr->first);
Player* player = ObjectAccessor::FindPlayer(itr->first);
// if offline, skip him, this should not happen - player is removed from queue when he logs out
if (!plr)
if (!player)
continue;
// invite the player
PlayerInvitedToBGUpdateAverageWaitTime(ginfo, bracket_id);
//sBattlegroundMgr->InvitePlayer(plr, bg, ginfo->Team);
//sBattlegroundMgr->InvitePlayer(player, bg, ginfo->Team);
// set invited player counters
bg->IncreaseInvitedCount(ginfo->Team);
plr->SetInviteForBattlegroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);
player->SetInviteForBattlegroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);
// create remind invite events
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
m_events.AddEvent(inviteEvent, m_events.CalculateTime(INVITATION_REMIND_TIME));
// create automatic remove events
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime);
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime);
m_events.AddEvent(removeEvent, m_events.CalculateTime(INVITE_ACCEPT_WAIT_TIME));
WorldPacket data;
uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited plr %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", plr->GetName(), plr->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", player->GetName(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
// send status packet
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
plr->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
}
return true;
}
@@ -1020,9 +1020,9 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Player* plr = ObjectAccessor::FindPlayer(m_PlayerGuid);
Player* player = ObjectAccessor::FindPlayer(m_PlayerGuid);
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
if (!plr)
if (!player)
return true;
Battleground* bg = sBattlegroundMgr->GetBattleground(m_BgInstanceGUID, m_BgTypeId);
@@ -1031,7 +1031,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
return true;
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue or in battleground
{
// check if player is invited to this bg
@@ -1041,7 +1041,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
WorldPacket data;
//we must send remaining time in queue
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType);
plr->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
}
}
return true; //event will be deleted
@@ -1063,8 +1063,8 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
*/
bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Player* plr = ObjectAccessor::FindPlayer(m_PlayerGuid);
if (!plr)
Player* player = ObjectAccessor::FindPlayer(m_PlayerGuid);
if (!player)
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
return true;
@@ -1072,16 +1072,16 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
//battleground can be deleted already when we are removing queue info
//bg pointer can be NULL! so use it carefully!
uint32 queueSlot = plr->GetBattlegroundQueueIndex(m_BgQueueTypeId);
uint32 queueSlot = player->GetBattlegroundQueueIndex(m_BgQueueTypeId);
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground
{
// check if player is in queue for this BG and if we are removing his invite event
BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[m_BgQueueTypeId];
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", plr->GetGUIDLow(), m_BgInstanceGUID);
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", player->GetGUIDLow(), m_BgInstanceGUID);
plr->RemoveBattlegroundQueueId(m_BgQueueTypeId);
player->RemoveBattlegroundQueueId(m_BgQueueTypeId);
bgQueue.RemovePlayer(m_PlayerGuid, true);
//update queues if battleground isn't ended
if (bg && bg->isBattleground() && bg->GetStatus() != STATUS_WAIT_LEAVE)
@@ -1089,7 +1089,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
plr->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
}
}
@@ -47,16 +47,16 @@ void BattlegroundAA::StartingEventOpenDoors()
{
}
void BattlegroundAA::AddPlayer(Player* plr)
void BattlegroundAA::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundAAScore* sc = new BattlegroundAAScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
}
void BattlegroundAA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundAA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
}
@@ -35,11 +35,11 @@ class BattlegroundAA : public Battleground
~BattlegroundAA();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);
@@ -204,16 +204,16 @@ void BattlegroundAB::StartingEventOpenDoors()
DoorOpen(BG_AB_OBJECT_GATE_H);
}
void BattlegroundAB::AddPlayer(Player* plr)
void BattlegroundAB::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in the constructor
BattlegroundABScore* sc = new BattlegroundABScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
}
void BattlegroundAB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundAB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
}
@@ -409,15 +409,15 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node)
WorldSafeLocsEntry const* ClosestGrave = NULL;
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
Player* plr = ObjectAccessor::FindPlayer(*itr);
if (!plr)
Player* player = ObjectAccessor::FindPlayer(*itr);
if (!player)
continue;
if (!ClosestGrave) // cache
ClosestGrave = GetClosestGraveYard(plr);
ClosestGrave = GetClosestGraveYard(player);
if (ClosestGrave)
plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
}
}
@@ -245,10 +245,10 @@ class BattlegroundAB : public Battleground
BattlegroundAB();
~BattlegroundAB();
void AddPlayer(Player* plr);
void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
virtual bool SetupBattleground();
virtual void Reset();
@@ -422,14 +422,14 @@ void BattlegroundAV::StartingEventOpenDoors()
DoorOpen(BG_AV_OBJECT_DOOR_A);
}
void BattlegroundAV::AddPlayer(Player* plr)
void BattlegroundAV::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundAVScore* sc = new BattlegroundAVScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
if (m_MaxLevel == 0)
m_MaxLevel=(plr->getLevel()%10 == 0)? plr->getLevel() : (plr->getLevel()-(plr->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
m_MaxLevel=(player->getLevel()%10 == 0)? player->getLevel() : (player->getLevel()-(player->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
}
@@ -473,17 +473,17 @@ void BattlegroundAV::EndBattleground(uint32 winner)
Battleground::EndBattleground(winner);
}
void BattlegroundAV::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/)
{
if (!plr)
if (!player)
{
sLog->outError("bg_AV no player at remove");
return;
}
//TODO search more buffs
plr->RemoveAurasDueToSpell(AV_BUFF_ARMOR);
plr->RemoveAurasDueToSpell(AV_BUFF_A_CAPTAIN);
plr->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN);
player->RemoveAurasDueToSpell(AV_BUFF_ARMOR);
player->RemoveAurasDueToSpell(AV_BUFF_A_CAPTAIN);
player->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN);
}
void BattlegroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger)
@@ -1029,17 +1029,17 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
if (!ghost_list.empty())
{
Player* plr;
Player* player;
WorldSafeLocsEntry const* ClosestGrave = NULL;
for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
plr = ObjectAccessor::FindPlayer(*ghost_list.begin());
if (!plr)
player = ObjectAccessor::FindPlayer(*ghost_list.begin());
if (!player)
continue;
if (!ClosestGrave)
ClosestGrave = GetClosestGraveYard(plr);
ClosestGrave = GetClosestGraveYard(player);
else
plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
}
m_ReviveQueue[m_BgCreatures[node]].clear();
}
@@ -1539,11 +1539,11 @@ class BattlegroundAV : public Battleground
~BattlegroundAV();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
virtual void ResetBGSubclass();
@@ -62,18 +62,18 @@ void BattlegroundBE::StartingEventOpenDoors()
SpawnBGObject(i, 60);
}
void BattlegroundBE::AddPlayer(Player* plr)
void BattlegroundBE::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundBEScore* sc = new BattlegroundBEScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState();
}
void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundBE::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -55,17 +55,17 @@ class BattlegroundBE : public Battleground
~BattlegroundBE();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* plr);
bool HandlePlayerUnderMap(Player* player);
/* Scorekeeping */
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
@@ -88,18 +88,18 @@ void BattlegroundDS::StartingEventOpenDoors()
SpawnBGObject(i, getWaterFallTimer());
}
void BattlegroundDS::AddPlayer(Player* plr)
void BattlegroundDS::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundDSScore* sc = new BattlegroundDSScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState();
}
void BattlegroundDS::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundDS::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -64,17 +64,17 @@ class BattlegroundDS : public Battleground
~BattlegroundDS();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* plr);
bool HandlePlayerUnderMap(Player* player);
private:
uint32 m_waterTimer;
bool m_waterfallActive;
@@ -146,20 +146,20 @@ void BattlegroundEY::CheckSomeoneJoinedPoint()
uint8 j = 0;
while (j < m_PlayersNearPoint[EY_POINTS_MAX].size())
{
Player* plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
if (!plr)
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
if (!player)
{
sLog->outError("BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
++j;
continue;
}
if (plr->CanCaptureTowerPoint() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
if (player->CanCaptureTowerPoint() && player->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
{
//player joined point!
//show progress bar
UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, plr);
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[i], plr);
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, plr);
UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, player);
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[i], player);
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, player);
//add player to point
m_PlayersNearPoint[i].push_back(m_PlayersNearPoint[EY_POINTS_MAX][j]);
//remove player from "free space"
@@ -186,8 +186,8 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
uint8 j = 0;
while (j < m_PlayersNearPoint[i].size())
{
Player* plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]);
if (!plr)
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]);
if (!player)
{
sLog->outError("BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
@@ -196,17 +196,17 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
++j;
continue;
}
if (!plr->CanCaptureTowerPoint() || !plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
if (!player->CanCaptureTowerPoint() || !player->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
//move player out of point (add him to players that are out of points
{
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr);
this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, player);
}
else
{
//player is neat flag, so update count:
m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(plr->GetTeam())]++;
m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(player->GetTeam())]++;
++j;
}
}
@@ -241,20 +241,20 @@ void BattlegroundEY::UpdatePointStatuses()
for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i)
{
Player* plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[point][i]);
if (plr)
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[point][i]);
if (player)
{
this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr);
this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], player);
//if point owner changed we must evoke event!
if (pointOwnerTeamId != m_PointOwnedByTeam[point])
{
//point was uncontrolled and player is from team which captured point
if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && plr->GetTeam() == pointOwnerTeamId)
this->EventTeamCapturedPoint(plr, point);
if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && player->GetTeam() == pointOwnerTeamId)
this->EventTeamCapturedPoint(player, point);
//point was under control and player isn't from team which controlled it
if (m_PointState[point] == EY_POINT_UNDER_CONTROL && plr->GetTeam() != m_PointOwnedByTeam[point])
this->EventTeamLostPoint(plr, point);
if (m_PointState[point] == EY_POINT_UNDER_CONTROL && player->GetTeam() != m_PointOwnedByTeam[point])
this->EventTeamLostPoint(player, point);
}
}
}
@@ -330,18 +330,18 @@ void BattlegroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
}
}
void BattlegroundEY::AddPlayer(Player* plr)
void BattlegroundEY::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map
BattlegroundEYScore* sc = new BattlegroundEYScore;
m_PlayersNearPoint[EY_POINTS_MAX].push_back(plr->GetGUID());
m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID());
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
}
void BattlegroundEY::RemovePlayer(Player* plr, uint64 guid, uint32 /*team*/)
void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
for (int j = EY_POINTS_MAX; j >= 0; --j)
@@ -354,8 +354,8 @@ void BattlegroundEY::RemovePlayer(Player* plr, uint64 guid, uint32 /*team*/)
{
if (m_FlagKeeper == guid)
{
if (plr)
EventPlayerDroppedFlag(plr);
if (player)
EventPlayerDroppedFlag(player);
else
{
SetFlagPicker(0);
@@ -336,7 +336,7 @@ class BattlegroundEY : public Battleground
~BattlegroundEY();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
@@ -348,7 +348,7 @@ class BattlegroundEY : public Battleground
void RespawnFlag(bool send_message);
void RespawnFlagAfterDrop();
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleBuffUse(uint64 buff_guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleKillPlayer(Player* player, Player* killer);
@@ -90,22 +90,22 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var)
if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT)
return;
Player* plr = ObjectAccessor::FindPlayer(var);
Player* player = ObjectAccessor::FindPlayer(var);
if (!plr || !gunshipAlliance || !gunshipHorde)
if (!player || !gunshipAlliance || !gunshipHorde)
return;
plr->CastSpell(plr, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell.
plr->CastSpell(plr, SPELL_SLOW_FALL, true);
player->CastSpell(player, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell.
player->CastSpell(player, SPELL_SLOW_FALL, true);
plr->SetTransport(plr->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
player->SetTransport(player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
plr->m_movementInfo.t_pos.m_positionX = TransportMovementInfo.GetPositionX();
plr->m_movementInfo.t_pos.m_positionY = TransportMovementInfo.GetPositionY();
plr->m_movementInfo.t_pos.m_positionZ = TransportMovementInfo.GetPositionZ();
plr->m_movementInfo.t_guid = (plr->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
player->m_movementInfo.t_pos.m_positionX = TransportMovementInfo.GetPositionX();
player->m_movementInfo.t_pos.m_positionY = TransportMovementInfo.GetPositionY();
player->m_movementInfo.t_pos.m_positionZ = TransportMovementInfo.GetPositionZ();
player->m_movementInfo.t_guid = (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
plr->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(), TeleportToTransportPosition.GetPositionY(), TeleportToTransportPosition.GetPositionZ(), TeleportToTransportPosition.GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(), TeleportToTransportPosition.GetPositionY(), TeleportToTransportPosition.GetPositionZ(), TeleportToTransportPosition.GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
}
void BattlegroundIC::PostUpdateImpl(uint32 diff)
@@ -292,29 +292,29 @@ bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const
return count == NODE_TYPE_WORKSHOP;
}
void BattlegroundIC::AddPlayer(Player* plr)
void BattlegroundIC::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundICScore* sc = new BattlegroundICScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (plr->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
plr->CastSpell(plr, SPELL_QUARRY, true);
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
player->CastSpell(player, SPELL_QUARRY, true);
if (nodePoint[NODE_TYPE_REFINERY].nodeState == (plr->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
plr->CastSpell(plr, SPELL_OIL_REFINERY, true);
if (nodePoint[NODE_TYPE_REFINERY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
player->CastSpell(player, SPELL_OIL_REFINERY, true);
SendTransportInit(plr);
SendTransportInit(player);
}
void BattlegroundIC::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundIC::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/)
{
if (plr)
if (player)
{
plr->RemoveAura(SPELL_QUARRY);
plr->RemoveAura(SPELL_OIL_REFINERY);
player->RemoveAura(SPELL_QUARRY);
player->RemoveAura(SPELL_OIL_REFINERY);
}
}
@@ -482,15 +482,15 @@ void BattlegroundIC::RealocatePlayers(ICNodePointType nodeType)
WorldSafeLocsEntry const* ClosestGrave = NULL;
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
Player* plr = ObjectAccessor::FindPlayer(*itr);
if (!plr)
Player* player = ObjectAccessor::FindPlayer(*itr);
if (!player)
continue;
if (!ClosestGrave) // cache
ClosestGrave = GetClosestGraveYard(plr);
ClosestGrave = GetClosestGraveYard(player);
if (ClosestGrave)
plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
}
}
}
@@ -855,7 +855,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP));
}
void BattlegroundIC::EventPlayerDamagedGO(Player* /*plr*/, GameObject* /*go*/, uint32 /*eventType*/)
void BattlegroundIC::EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/, uint32 /*eventType*/)
{
}
@@ -863,12 +863,12 @@ class BattlegroundIC : public Battleground
~BattlegroundIC();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
virtual void PostUpdateImpl(uint32 diff);
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
void SpawnLeader(uint32 teamid);
@@ -877,7 +877,7 @@ class BattlegroundIC : public Battleground
void EndBattleground(uint32 winner);
void EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/);
void EventPlayerDamagedGO(Player* /*plr*/, GameObject* go, uint32 eventType);
void EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType);
void DestroyGate(Player* player, GameObject* go);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
@@ -59,18 +59,18 @@ void BattlegroundNA::StartingEventOpenDoors()
SpawnBGObject(i, 60);
}
void BattlegroundNA::AddPlayer(Player* plr)
void BattlegroundNA::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundNAScore* sc = new BattlegroundNAScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState();
}
void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundNA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -56,16 +56,16 @@ class BattlegroundNA : public Battleground
~BattlegroundNA();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* plr);
bool HandlePlayerUnderMap(Player* player);
};
#endif
@@ -43,16 +43,16 @@ void BattlegroundRB::StartingEventOpenDoors()
{
}
void BattlegroundRB::AddPlayer(Player* plr)
void BattlegroundRB::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundRBScore* sc = new BattlegroundRBScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
}
void BattlegroundRB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundRB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
}
@@ -34,11 +34,11 @@ class BattlegroundRB : public Battleground
BattlegroundRB();
~BattlegroundRB();
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
/* Scorekeeping */
@@ -59,18 +59,18 @@ void BattlegroundRL::StartingEventOpenDoors()
SpawnBGObject(i, 60);
}
void BattlegroundRL::AddPlayer(Player* plr)
void BattlegroundRL::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundRLScore* sc = new BattlegroundRLScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState();
}
void BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundRL::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -52,16 +52,16 @@ class BattlegroundRL : public Battleground
~BattlegroundRL();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* plr);
bool HandlePlayerUnderMap(Player* player);
};
#endif
@@ -102,19 +102,19 @@ void BattlegroundRV::StartingEventOpenDoors()
setTimer(BG_RV_FIRST_TIMER);
}
void BattlegroundRV::AddPlayer(Player* plr)
void BattlegroundRV::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundRVScore* sc = new BattlegroundRVScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
}
void BattlegroundRV::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundRV::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -105,17 +105,17 @@ class BattlegroundRV : public Battleground
~BattlegroundRV();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* plr);
bool HandlePlayerUnderMap(Player* player);
private:
uint32 Timer;
@@ -62,8 +62,8 @@ bool BattlegroundSA::SetupBattleground()
bool BattlegroundSA::ResetObjs()
{
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
SendTransportsRemove(plr);
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
SendTransportsRemove(player);
uint32 atF = BG_SA_Factions[Attackers];
uint32 defF = BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE];
@@ -245,8 +245,8 @@ bool BattlegroundSA::ResetObjs()
for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
SendTransportInit(plr);
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
SendTransportInit(player);
TeleportPlayers();
return true;
@@ -431,39 +431,39 @@ void BattlegroundSA::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << ally_attacks;
}
void BattlegroundSA::AddPlayer(Player* plr)
void BattlegroundSA::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundSAScore* sc = new BattlegroundSAScore;
if (!ShipsStarted)
{
if (plr->GetTeamId() == Attackers)
if (player->GetTeamId() == Attackers)
{
plr->CastSpell(plr, 12438, true);//Without this player falls before boat loads...
player->CastSpell(player, 12438, true);//Without this player falls before boat loads...
if (urand(0, 1))
plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
player->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
else
plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
player->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
}
else
plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
}
else
{
if (plr->GetTeamId() == Attackers)
plr->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
if (player->GetTeamId() == Attackers)
player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
else
plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
}
SendTransportInit(plr);
m_PlayerScores[plr->GetGUID()] = sc;
SendTransportInit(player);
m_PlayerScores[player->GetGUID()] = sc;
}
void BattlegroundSA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
void BattlegroundSA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
}
@@ -492,37 +492,37 @@ void BattlegroundSA::TeleportPlayers()
{
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
{
// should remove spirit of redemption
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (!plr->isAlive())
if (!player->isAlive())
{
plr->ResurrectPlayer(1.0f);
plr->SpawnCorpseBones();
player->ResurrectPlayer(1.0f);
player->SpawnCorpseBones();
}
plr->ResetAllPowers();
plr->CombatStopWithPets(true);
player->ResetAllPowers();
player->CombatStopWithPets(true);
if (plr->GetTeamId() == Attackers)
if (player->GetTeamId() == Attackers)
{
plr->CastSpell(plr, 12438, true); //Without this player falls before boat loads...
player->CastSpell(player, 12438, true); //Without this player falls before boat loads...
if (urand(0, 1))
plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
player->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
else
plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
player->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
}
else
plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
}
}
}
void BattlegroundSA::EventPlayerDamagedGO(Player* /*plr*/, GameObject* go, uint32 eventType)
void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType)
{
if (!go || !go->GetGOInfo())
return;
@@ -798,9 +798,9 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
//Achievement Storm the Beach (1310)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
if (plr->GetTeamId() == Attackers)
plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
if (player->GetTeamId() == Attackers)
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
}
Attackers = (Attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
@@ -822,9 +822,9 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
//Achievement Storm the Beach (1310)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
if (plr->GetTeamId() == Attackers && RoundScores[1].winner == Attackers)
plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
if (player->GetTeamId() == Attackers && RoundScores[1].winner == Attackers)
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
}
if (RoundScores[0].time == RoundScores[1].time)
@@ -423,7 +423,7 @@ class BattlegroundSA : public Battleground
/* inherited from BattlegroundClass */
/// Called when a player join battle
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
/// Called when battle start
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
@@ -433,7 +433,7 @@ class BattlegroundSA : public Battleground
/// Called for generate packet contain worldstate data
virtual void FillInitialWorldStates(WorldPacket& data);
/// Called when a player deal damage to building (door)
virtual void EventPlayerDamagedGO(Player* plr, GameObject* go, uint32 eventType);
virtual void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType);
/// Called when a player kill a unit in bg
virtual void HandleKillUnit(Creature* unit, Player* killer);
/// Return the nearest graveyard where player can respawn
@@ -477,7 +477,7 @@ class BattlegroundSA : public Battleground
void EndBattleground(uint32 winner);
/// CAlled when a player leave battleground
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
/* Scorekeeping */
@@ -140,23 +140,23 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
m_FlagSpellForceTimer += diff;
if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
{
if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
plr->CastSpell(plr, WS_SPELL_FOCUSED_ASSAULT, true);
if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
plr->CastSpell(plr, WS_SPELL_FOCUSED_ASSAULT, true);
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
m_FlagDebuffState = 1;
}
else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
{
if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr, WS_SPELL_BRUTAL_ASSAULT, true);
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
}
if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr, WS_SPELL_BRUTAL_ASSAULT, true);
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
}
m_FlagDebuffState = 2;
}
@@ -202,13 +202,13 @@ void BattlegroundWS::StartingEventOpenDoors()
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE);
}
void BattlegroundWS::AddPlayer(Player* plr)
void BattlegroundWS::AddPlayer(Player* player)
{
Battleground::AddPlayer(plr);
Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundWGScore* sc = new BattlegroundWGScore;
m_PlayerScores[plr->GetGUID()] = sc;
m_PlayerScores[player->GetGUID()] = sc;
}
void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
@@ -556,30 +556,30 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
void BattlegroundWS::RemovePlayer(Player* plr, uint64 guid, uint32 /*team*/)
void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
{
if (!plr)
if (!player)
{
sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetAllianceFlagPicker(0);
this->RespawnFlag(ALLIANCE, false);
}
else
this->EventPlayerDroppedFlag(plr);
this->EventPlayerDroppedFlag(player);
}
if (IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
{
if (!plr)
if (!player)
{
sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetHordeFlagPicker(0);
this->RespawnFlag(HORDE, false);
}
else
this->EventPlayerDroppedFlag(plr);
this->EventPlayerDroppedFlag(player);
}
}
@@ -163,7 +163,7 @@ class BattlegroundWS : public Battleground
~BattlegroundWS();
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player* plr);
virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
@@ -187,7 +187,7 @@ class BattlegroundWS : public Battleground
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
virtual void EventPlayerCapturedFlag(Player* Source);
void RemovePlayer(Player* plr, uint64 guid, uint32 team);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleKillPlayer(Player* player, Player* killer);
bool SetupBattleground();