mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 07:22:02 -04:00
@@ -46,8 +46,8 @@ namespace Trinity
|
||||
class AchievementChatBuilder
|
||||
{
|
||||
public:
|
||||
AchievementChatBuilder(Player const& pl, ChatMsg msgtype, int32 textId, uint32 ach_id)
|
||||
: i_player(pl), i_msgtype(msgtype), i_textId(textId), i_achievementId(ach_id) {}
|
||||
AchievementChatBuilder(Player const& player, ChatMsg msgtype, int32 textId, uint32 ach_id)
|
||||
: i_player(player), i_msgtype(msgtype), i_textId(textId), i_achievementId(ach_id) {}
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
{
|
||||
char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx);
|
||||
|
||||
@@ -244,7 +244,7 @@ class WorldPacket;
|
||||
class AchievementMgr
|
||||
{
|
||||
public:
|
||||
AchievementMgr(Player* pl);
|
||||
AchievementMgr(Player* player);
|
||||
~AchievementMgr();
|
||||
|
||||
void Reset();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
@@ -1823,8 +1823,8 @@ uint32 Battleground::GetAlivePlayersCountByTeam(uint32 Team) const
|
||||
{
|
||||
if (itr->second.Team == Team)
|
||||
{
|
||||
Player* pl = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (pl && pl->isAlive() && !pl->HasByteFlag(UNIT_FIELD_BYTES_2, 3, FORM_SPIRITOFREDEMPTION))
|
||||
Player* player = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (player && player->isAlive() && !player->HasByteFlag(UNIT_FIELD_BYTES_2, 3, FORM_SPIRITOFREDEMPTION))
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ class Battleground
|
||||
{
|
||||
}
|
||||
|
||||
virtual void DestroyGate(Player* /*pl*/, GameObject* /*go*/) {}
|
||||
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) {}
|
||||
|
||||
/* achievement req. */
|
||||
virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; }
|
||||
@@ -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();
|
||||
@@ -868,35 +868,35 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundMgr::SendToBattleground(Player* pl, uint32 instanceId, BattlegroundTypeId bgTypeId)
|
||||
void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
Battleground* bg = GetBattleground(instanceId, bgTypeId);
|
||||
if (bg)
|
||||
{
|
||||
uint32 mapid = bg->GetMapId();
|
||||
float x, y, z, O;
|
||||
uint32 team = pl->GetBGTeam();
|
||||
uint32 team = player->GetBGTeam();
|
||||
if (team == 0)
|
||||
team = pl->GetTeam();
|
||||
team = player->GetTeam();
|
||||
bg->GetTeamStartLoc(team, x, y, z, O);
|
||||
|
||||
sLog->outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", pl->GetName(), mapid, x, y, z, O);
|
||||
pl->TeleportTo(mapid, x, y, z, O);
|
||||
sLog->outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", player->GetName(), mapid, x, y, z, O);
|
||||
player->TeleportTo(mapid, x, y, z, O);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError("player %u is trying to port to non-existent bg instance %u", pl->GetGUIDLow(), instanceId);
|
||||
sLog->outError("player %u is trying to port to non-existent bg instance %u", player->GetGUIDLow(), instanceId);
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* pl, Battleground* bg, uint64 guid)
|
||||
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid)
|
||||
{
|
||||
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
||||
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
|
||||
if (time_ == uint32(-1))
|
||||
time_ = 0;
|
||||
data << guid << time_;
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
|
||||
|
||||
@@ -65,15 +65,15 @@ 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);
|
||||
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame = 1);
|
||||
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* pl, Battleground* bg, uint64 guid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
|
||||
|
||||
/* Battlegrounds */
|
||||
Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId);
|
||||
@@ -91,7 +91,7 @@ class BattlegroundMgr
|
||||
void CreateInitialBattlegrounds();
|
||||
void DeleteAllBattlegrounds();
|
||||
|
||||
void SendToBattleground(Player* pl, uint32 InstanceID, BattlegroundTypeId bgTypeId);
|
||||
void SendToBattleground(Player* player, uint32 InstanceID, BattlegroundTypeId bgTypeId);
|
||||
|
||||
/* Battleground queues */
|
||||
//these queues are instantiated when creating BattlegroundMrg
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -169,22 +169,22 @@ void Channel::Join(uint64 p, const char *pass)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* plr = ObjectAccessor::FindPlayer(p);
|
||||
Player* player = ObjectAccessor::FindPlayer(p);
|
||||
|
||||
if (plr)
|
||||
if (player)
|
||||
{
|
||||
if (HasFlag(CHANNEL_FLAG_LFG) &&
|
||||
sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(plr->GetSession()->GetSecurity()) && plr->GetGroup())
|
||||
sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->GetGroup())
|
||||
{
|
||||
MakeNotInLfg(&data);
|
||||
SendToOne(&data, p);
|
||||
return;
|
||||
}
|
||||
|
||||
plr->JoinedChannel(this);
|
||||
player->JoinedChannel(this);
|
||||
}
|
||||
|
||||
if (m_announce && (!plr || !AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
{
|
||||
MakeJoined(&data, p);
|
||||
SendToAll(&data);
|
||||
@@ -231,22 +231,22 @@ void Channel::Leave(uint64 p, bool send)
|
||||
}
|
||||
else
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(p);
|
||||
Player* player = ObjectAccessor::FindPlayer(p);
|
||||
|
||||
if (send)
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeYouLeft(&data);
|
||||
SendToOne(&data, p);
|
||||
if (plr)
|
||||
plr->LeftChannel(this);
|
||||
if (player)
|
||||
player->LeftChannel(this);
|
||||
data.clear();
|
||||
}
|
||||
|
||||
bool changeowner = players[p].IsOwner();
|
||||
|
||||
players.erase(p);
|
||||
if (m_announce && (!plr || !AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeLeft(&data, p);
|
||||
@@ -379,11 +379,11 @@ void Channel::UnBan(uint64 good, const char *badname)
|
||||
void Channel::Password(uint64 p, const char *pass)
|
||||
{
|
||||
uint32 sec = 0;
|
||||
Player* plr = ObjectAccessor::FindPlayer(p);
|
||||
if (plr)
|
||||
sec = plr->GetSession()->GetSecurity();
|
||||
Player* player = ObjectAccessor::FindPlayer(p);
|
||||
if (player)
|
||||
sec = player->GetSession()->GetSecurity();
|
||||
|
||||
ChatHandler chat(plr);
|
||||
ChatHandler chat(player);
|
||||
|
||||
if (!IsOn(p))
|
||||
{
|
||||
@@ -411,11 +411,11 @@ void Channel::Password(uint64 p, const char *pass)
|
||||
|
||||
void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(p);
|
||||
if (!plr)
|
||||
Player* player = ObjectAccessor::FindPlayer(p);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
uint32 sec = plr->GetSession()->GetSecurity();
|
||||
uint32 sec = player->GetSession()->GetSecurity();
|
||||
|
||||
if (!IsOn(p))
|
||||
{
|
||||
@@ -453,8 +453,8 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
|
||||
|
||||
// allow make moderator from another team only if both is GMs
|
||||
// at this moment this only way to show channel post for GM from another team
|
||||
if ((!AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) &&
|
||||
plr->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
if ((!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) &&
|
||||
player->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakePlayerNotFound(&data, p2n);
|
||||
@@ -479,11 +479,11 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
|
||||
|
||||
void Channel::SetOwner(uint64 p, const char *newname)
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(p);
|
||||
if (!plr)
|
||||
Player* player = ObjectAccessor::FindPlayer(p);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
uint32 sec = plr->GetSession()->GetSecurity();
|
||||
uint32 sec = player->GetSession()->GetSecurity();
|
||||
|
||||
if (!IsOn(p))
|
||||
{
|
||||
@@ -510,7 +510,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
|
||||
return;
|
||||
}
|
||||
|
||||
if (newp->GetTeam() != plr->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakePlayerNotFound(&data, newname);
|
||||
@@ -563,12 +563,12 @@ void Channel::List(Player* player)
|
||||
uint32 count = 0;
|
||||
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(i->first);
|
||||
Player* player = ObjectAccessor::FindPlayer(i->first);
|
||||
|
||||
// PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
||||
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
||||
if (plr && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || plr->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
|
||||
plr->IsVisibleGloballyFor(player))
|
||||
if (player && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || player->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
|
||||
player->IsVisibleGloballyFor(player))
|
||||
{
|
||||
data << uint64(i->first);
|
||||
data << uint8(i->second.flags); // flags seems to be changed...
|
||||
@@ -585,9 +585,9 @@ void Channel::List(Player* player)
|
||||
void Channel::Announce(uint64 p)
|
||||
{
|
||||
uint32 sec = 0;
|
||||
Player* plr = ObjectAccessor::FindPlayer(p);
|
||||
if (plr)
|
||||
sec = plr->GetSession()->GetSecurity();
|
||||
Player* player = ObjectAccessor::FindPlayer(p);
|
||||
if (player)
|
||||
sec = player->GetSession()->GetSecurity();
|
||||
|
||||
if (!IsOn(p))
|
||||
{
|
||||
@@ -623,7 +623,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
lang = LANG_UNIVERSAL;
|
||||
|
||||
Player* plr = ObjectAccessor::FindPlayer(p);
|
||||
Player* player = ObjectAccessor::FindPlayer(p);
|
||||
|
||||
if (!IsOn(p))
|
||||
{
|
||||
@@ -650,7 +650,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
|
||||
data << p;
|
||||
data << messageLength;
|
||||
data << what;
|
||||
data << uint8(plr ? plr->GetChatTag() : 0);
|
||||
data << uint8(player ? player->GetChatTag() : 0);
|
||||
|
||||
SendToAll(&data, !players[p].IsModerator() ? p : false);
|
||||
}
|
||||
@@ -683,11 +683,11 @@ void Channel::Invite(uint64 p, const char *newname)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* plr = ObjectAccessor::FindPlayer(p);
|
||||
if (!plr)
|
||||
Player* player = ObjectAccessor::FindPlayer(p);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (newp->GetTeam() != plr->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeInviteWrongFaction(&data);
|
||||
@@ -749,11 +749,11 @@ void Channel::SendToAll(WorldPacket* data, uint64 p)
|
||||
{
|
||||
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(i->first);
|
||||
if (plr)
|
||||
Player* player = ObjectAccessor::FindPlayer(i->first);
|
||||
if (player)
|
||||
{
|
||||
if (!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
|
||||
plr->GetSession()->SendPacket(data);
|
||||
if (!p || !player->GetSocial()->HasIgnore(GUID_LOPART(p)))
|
||||
player->GetSession()->SendPacket(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -764,18 +764,18 @@ void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
|
||||
{
|
||||
if (i->first != who)
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(i->first);
|
||||
if (plr)
|
||||
plr->GetSession()->SendPacket(data);
|
||||
Player* player = ObjectAccessor::FindPlayer(i->first);
|
||||
if (player)
|
||||
player->GetSession()->SendPacket(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::SendToOne(WorldPacket* data, uint64 who)
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(who);
|
||||
if (plr)
|
||||
plr->GetSession()->SendPacket(data);
|
||||
Player* player = ObjectAccessor::FindPlayer(who);
|
||||
if (player)
|
||||
player->GetSession()->SendPacket(data);
|
||||
}
|
||||
|
||||
void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)
|
||||
|
||||
@@ -1551,9 +1551,9 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline)
|
||||
bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline)
|
||||
{
|
||||
plr = NULL;
|
||||
player = NULL;
|
||||
guid = 0;
|
||||
|
||||
if (cname)
|
||||
@@ -1568,28 +1568,28 @@ bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, G
|
||||
return false;
|
||||
}
|
||||
|
||||
plr = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
player = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
if (offline)
|
||||
guid = sObjectMgr->GetPlayerGUIDByName(name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (plr)
|
||||
if (player)
|
||||
{
|
||||
group = plr->GetGroup();
|
||||
group = player->GetGroup();
|
||||
if (!guid || !offline)
|
||||
guid = plr->GetGUID();
|
||||
guid = player->GetGUID();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getSelectedPlayer())
|
||||
plr = getSelectedPlayer();
|
||||
player = getSelectedPlayer();
|
||||
else
|
||||
plr = m_session->GetPlayer();
|
||||
player = m_session->GetPlayer();
|
||||
|
||||
if (!guid || !offline)
|
||||
guid = plr->GetGUID();
|
||||
group = plr->GetGroup();
|
||||
guid = player->GetGUID();
|
||||
group = player->GetGroup();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -109,7 +109,7 @@ class ChatHandler
|
||||
uint32 extractSpellIdFromLink(char* text);
|
||||
uint64 extractGuidFromLink(char* text);
|
||||
GameTele const* extractGameTeleFromLink(char* text);
|
||||
bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline = false);
|
||||
bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline = false);
|
||||
std::string extractPlayerNameFromLink(char* text);
|
||||
// select by arg (name/link) or in-game selection online/offline player
|
||||
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL);
|
||||
|
||||
@@ -713,18 +713,18 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
|
||||
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* pl = itr->getSource();
|
||||
Player* player = itr->getSource();
|
||||
|
||||
if (!pl || pl == m_session->GetPlayer() || !pl->GetSession())
|
||||
if (!player || player == m_session->GetPlayer() || !player->GetSession())
|
||||
continue;
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(pl, 0))
|
||||
if (HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
std::string plNameLink = GetNameLink(pl);
|
||||
std::string plNameLink = GetNameLink(player);
|
||||
|
||||
if (pl->IsBeingTeleported() == true)
|
||||
if (player->IsBeingTeleported() == true)
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
@@ -733,7 +733,7 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
|
||||
|
||||
if (to_instance)
|
||||
{
|
||||
Map* plMap = pl->GetMap();
|
||||
Map* plMap = player->GetMap();
|
||||
|
||||
if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
|
||||
{
|
||||
@@ -745,23 +745,23 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
|
||||
if (needReportToTarget(pl))
|
||||
ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
|
||||
if (needReportToTarget(player))
|
||||
ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
|
||||
|
||||
// stop flight if need
|
||||
if (pl->isInFlight())
|
||||
if (player->isInFlight())
|
||||
{
|
||||
pl->GetMotionMaster()->MovementExpired();
|
||||
pl->CleanupAfterTaxiFlight();
|
||||
player->GetMotionMaster()->MovementExpired();
|
||||
player->CleanupAfterTaxiFlight();
|
||||
}
|
||||
// save only in non-flight case
|
||||
else
|
||||
pl->SaveRecallPosition();
|
||||
player->SaveRecallPosition();
|
||||
|
||||
// before GM
|
||||
float x, y, z;
|
||||
m_session->GetPlayer()->GetClosePoint(x, y, z, pl->GetObjectSize());
|
||||
pl->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, pl->GetOrientation());
|
||||
m_session->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
|
||||
player->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -912,8 +912,8 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* plr = m_session->GetPlayer();
|
||||
Pet* pet = plr->GetPet();
|
||||
Player* player = m_session->GetPlayer();
|
||||
Pet* pet = player->GetPet();
|
||||
|
||||
if (!pet)
|
||||
{
|
||||
@@ -955,8 +955,8 @@ bool ChatHandler::HandlePetUnlearnCommand(const char *args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* plr = m_session->GetPlayer();
|
||||
Pet* pet = plr->GetPet();
|
||||
Player* player = m_session->GetPlayer();
|
||||
Pet* pet = player->GetPet();
|
||||
|
||||
if (!pet)
|
||||
{
|
||||
|
||||
@@ -256,10 +256,10 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
|
||||
if (count == 0)
|
||||
count = 1;
|
||||
|
||||
Player* pl = m_session->GetPlayer();
|
||||
Player* player = m_session->GetPlayer();
|
||||
Player* plTarget = getSelectedPlayer();
|
||||
if (!plTarget)
|
||||
plTarget = pl;
|
||||
plTarget = player;
|
||||
|
||||
sLog->outDetail(GetTrinityString(LANG_ADDITEM), itemId, count);
|
||||
|
||||
@@ -298,15 +298,15 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
|
||||
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (pl == plTarget)
|
||||
if (player == plTarget)
|
||||
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
|
||||
if (Item* item1 = pl->GetItemByPos(itr->pos))
|
||||
if (Item* item1 = player->GetItemByPos(itr->pos))
|
||||
item1->SetBinding(false);
|
||||
|
||||
if (count > 0 && item)
|
||||
{
|
||||
pl->SendNewItem(item, count, false, true);
|
||||
if (pl != plTarget)
|
||||
player->SendNewItem(item, count, false, true);
|
||||
if (player != plTarget)
|
||||
plTarget->SendNewItem(item, count, true, false);
|
||||
}
|
||||
|
||||
@@ -637,9 +637,9 @@ bool ChatHandler::HandleListObjectCommand(const char *args)
|
||||
|
||||
if (m_session)
|
||||
{
|
||||
Player* pl = m_session->GetPlayer();
|
||||
Player* player = m_session->GetPlayer();
|
||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), go_id, uint32(count));
|
||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), go_id, uint32(count));
|
||||
}
|
||||
else
|
||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u",
|
||||
@@ -709,9 +709,9 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
|
||||
|
||||
if (m_session)
|
||||
{
|
||||
Player* pl = m_session->GetPlayer();
|
||||
Player* player = m_session->GetPlayer();
|
||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id, uint32(count));
|
||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), cr_id, uint32(count));
|
||||
}
|
||||
else
|
||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
|
||||
@@ -3458,11 +3458,11 @@ bool ChatHandler::HandleBanListIPCommand(const char *args)
|
||||
|
||||
bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
|
||||
{
|
||||
Player* pl = m_session->GetPlayer();
|
||||
Player* player = m_session->GetPlayer();
|
||||
|
||||
// accept only explicitly selected target (not implicitly self targeting case)
|
||||
Unit* target = getSelectedUnit();
|
||||
if (pl->GetSelection() && target)
|
||||
if (player->GetSelection() && target)
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
|
||||
{
|
||||
@@ -3476,15 +3476,15 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
CellCoord p(Trinity::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY()));
|
||||
CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::RespawnDo u_do;
|
||||
Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(pl, u_do);
|
||||
Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
|
||||
|
||||
TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
|
||||
cell.Visit(p, obj_worker, *pl->GetMap(), *pl, pl->GetGridActivationRange());
|
||||
cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -4031,9 +4031,9 @@ bool ChatHandler::HandleComeToMeCommand(const char *args)
|
||||
|
||||
caster->SetUnitMovementFlags(newFlags);
|
||||
|
||||
Player* pl = m_session->GetPlayer();
|
||||
Player* player = m_session->GetPlayer();
|
||||
|
||||
caster->GetMotionMaster()->MovePoint(0, pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ());
|
||||
caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4177,9 +4177,9 @@ bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/)
|
||||
|
||||
bool ChatHandler::HandleInstanceSaveDataCommand(const char * /*args*/)
|
||||
{
|
||||
Player* pl = m_session->GetPlayer();
|
||||
Player* player = m_session->GetPlayer();
|
||||
|
||||
Map* map = pl->GetMap();
|
||||
Map* map = player->GetMap();
|
||||
if (!map->IsDungeon())
|
||||
{
|
||||
PSendSysMessage("Map is not a dungeon.");
|
||||
@@ -4649,12 +4649,12 @@ bool ChatHandler::HandleListFreezeCommand(const char * /*args*/)
|
||||
|
||||
bool ChatHandler::HandleGroupLeaderCommand(const char *args)
|
||||
{
|
||||
Player* plr = NULL;
|
||||
Player* player = NULL;
|
||||
Group* group = NULL;
|
||||
uint64 guid = 0;
|
||||
char* cname = strtok((char*)args, " ");
|
||||
|
||||
if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid))
|
||||
if (GetPlayerGroupAndGUIDByName(cname, player, group, guid))
|
||||
if (group && group->GetLeaderGUID() != guid)
|
||||
{
|
||||
group->ChangeLeader(guid);
|
||||
@@ -4666,12 +4666,12 @@ bool ChatHandler::HandleGroupLeaderCommand(const char *args)
|
||||
|
||||
bool ChatHandler::HandleGroupDisbandCommand(const char *args)
|
||||
{
|
||||
Player* plr = NULL;
|
||||
Player* player = NULL;
|
||||
Group* group = NULL;
|
||||
uint64 guid = 0;
|
||||
char* cname = strtok((char*)args, " ");
|
||||
|
||||
if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid))
|
||||
if (GetPlayerGroupAndGUIDByName(cname, player, group, guid))
|
||||
if (group)
|
||||
group->Disband();
|
||||
|
||||
@@ -4680,12 +4680,12 @@ bool ChatHandler::HandleGroupDisbandCommand(const char *args)
|
||||
|
||||
bool ChatHandler::HandleGroupRemoveCommand(const char *args)
|
||||
{
|
||||
Player* plr = NULL;
|
||||
Player* player = NULL;
|
||||
Group* group = NULL;
|
||||
uint64 guid = 0;
|
||||
char* cname = strtok((char*)args, " ");
|
||||
|
||||
if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid, true))
|
||||
if (GetPlayerGroupAndGUIDByName(cname, player, group, guid, true))
|
||||
if (group)
|
||||
group->RemoveMember(guid);
|
||||
|
||||
|
||||
@@ -159,12 +159,12 @@ void LFGMgr::Update(uint32 diff)
|
||||
{
|
||||
uint64 guid = itRoles->first;
|
||||
ClearState(guid);
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
plr->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
|
||||
player->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
|
||||
|
||||
if (itRoles->first == roleCheck->leader)
|
||||
plr->GetSession()->SendLfgJoinResult(LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE));
|
||||
player->GetSession()->SendLfgJoinResult(LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE));
|
||||
}
|
||||
}
|
||||
delete roleCheck;
|
||||
@@ -226,18 +226,18 @@ void LFGMgr::Update(uint32 diff)
|
||||
{
|
||||
guid = itPlayers->first;
|
||||
SetState(guid, LFG_STATE_PROPOSAL);
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(itPlayers->first))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itPlayers->first))
|
||||
{
|
||||
Group* grp = plr->GetGroup();
|
||||
Group* grp = player->GetGroup();
|
||||
if (grp)
|
||||
{
|
||||
uint64 gguid = grp->GetGUID();
|
||||
SetState(gguid, LFG_STATE_PROPOSAL);
|
||||
plr->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
|
||||
player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
|
||||
}
|
||||
else
|
||||
plr->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
|
||||
plr->GetSession()->SendLfgUpdateProposal(m_lfgProposalId, pProposal);
|
||||
player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
|
||||
player->GetSession()->SendLfgUpdateProposal(m_lfgProposalId, pProposal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,8 +291,8 @@ void LFGMgr::Update(uint32 diff)
|
||||
}
|
||||
|
||||
for (LfgRolesMap::const_iterator itPlayer = queue->roles.begin(); itPlayer != queue->roles.end(); ++itPlayer)
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(itPlayer->first))
|
||||
plr->GetSession()->SendLfgQueueStatus(dungeonId, waitTime, m_WaitTimeAvg, m_WaitTimeTank, m_WaitTimeHealer, m_WaitTimeDps, queuedTime, queue->tanks, queue->healers, queue->dps);
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itPlayer->first))
|
||||
player->GetSession()->SendLfgQueueStatus(dungeonId, waitTime, m_WaitTimeAvg, m_WaitTimeTank, m_WaitTimeHealer, m_WaitTimeDps, queuedTime, queue->tanks, queue->healers, queue->dps);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -358,13 +358,13 @@ bool LFGMgr::RemoveFromQueue(uint64 guid)
|
||||
/**
|
||||
Generate the dungeon lock map for a given player
|
||||
|
||||
@param[in] plr Player we need to initialize the lock status map
|
||||
@param[in] player Player we need to initialize the lock status map
|
||||
*/
|
||||
void LFGMgr::InitializeLockedDungeons(Player* plr)
|
||||
void LFGMgr::InitializeLockedDungeons(Player* player)
|
||||
{
|
||||
uint64 guid = plr->GetGUID();
|
||||
uint8 level = plr->getLevel();
|
||||
uint8 expansion = plr->GetSession()->Expansion();
|
||||
uint64 guid = player->GetGUID();
|
||||
uint8 level = player->getLevel();
|
||||
uint8 expansion = player->GetSession()->Expansion();
|
||||
LfgDungeonSet dungeons = GetDungeonsByRandom(0);
|
||||
LfgLockMap lock;
|
||||
|
||||
@@ -379,9 +379,9 @@ void LFGMgr::InitializeLockedDungeons(Player* plr)
|
||||
LfgLockStatusType locktype = LFG_LOCKSTATUS_OK;
|
||||
if (dungeon->expansion > expansion)
|
||||
locktype = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
|
||||
else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, plr))
|
||||
else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player))
|
||||
locktype = LFG_LOCKSTATUS_RAID_LOCKED;
|
||||
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && plr->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
|
||||
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
|
||||
locktype = LFG_LOCKSTATUS_RAID_LOCKED;
|
||||
else if (dungeon->minlevel > level)
|
||||
locktype = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
|
||||
@@ -389,19 +389,19 @@ void LFGMgr::InitializeLockedDungeons(Player* plr)
|
||||
locktype = LFG_LOCKSTATUS_TOO_HIGH_LEVEL;
|
||||
else if (locktype == LFG_LOCKSTATUS_OK && ar)
|
||||
{
|
||||
if (ar->achievement && !plr->GetAchievementMgr().HasAchieved(sAchievementStore.LookupEntry(ar->achievement)))
|
||||
if (ar->achievement && !player->GetAchievementMgr().HasAchieved(sAchievementStore.LookupEntry(ar->achievement)))
|
||||
locktype = LFG_LOCKSTATUS_RAID_LOCKED; // FIXME: Check the correct lock value
|
||||
else if (plr->GetTeam() == ALLIANCE && ar->quest_A && !plr->GetQuestRewardStatus(ar->quest_A))
|
||||
else if (player->GetTeam() == ALLIANCE && ar->quest_A && !player->GetQuestRewardStatus(ar->quest_A))
|
||||
locktype = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
|
||||
else if (plr->GetTeam() == HORDE && ar->quest_H && !plr->GetQuestRewardStatus(ar->quest_H))
|
||||
else if (player->GetTeam() == HORDE && ar->quest_H && !player->GetQuestRewardStatus(ar->quest_H))
|
||||
locktype = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
|
||||
else
|
||||
if (ar->item)
|
||||
{
|
||||
if (!plr->HasItemCount(ar->item, 1) && (!ar->item2 || !plr->HasItemCount(ar->item2, 1)))
|
||||
if (!player->HasItemCount(ar->item, 1) && (!ar->item2 || !player->HasItemCount(ar->item2, 1)))
|
||||
locktype = LFG_LOCKSTATUS_MISSING_ITEM;
|
||||
}
|
||||
else if (ar->item2 && !plr->HasItemCount(ar->item2, 1))
|
||||
else if (ar->item2 && !player->HasItemCount(ar->item2, 1))
|
||||
locktype = LFG_LOCKSTATUS_MISSING_ITEM;
|
||||
}
|
||||
/* TODO VoA closed if WG is not under team control (LFG_LOCKSTATUS_RAID_LOCKED)
|
||||
@@ -423,18 +423,18 @@ void LFGMgr::InitializeLockedDungeons(Player* plr)
|
||||
of the group tying to join the group. Join conditions are checked before adding
|
||||
to the new queue.
|
||||
|
||||
@param[in] plr Player trying to join (or leader of group trying to join)
|
||||
@param[in] player Player trying to join (or leader of group trying to join)
|
||||
@param[in] roles Player selected roles
|
||||
@param[in] dungeons Dungeons the player/group is applying for
|
||||
@param[in] comment Player selected comment
|
||||
*/
|
||||
void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeons, const std::string& comment)
|
||||
void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDungeons, const std::string& comment)
|
||||
{
|
||||
if (!plr || !plr->GetSession() || selectedDungeons.empty())
|
||||
if (!player || !player->GetSession() || selectedDungeons.empty())
|
||||
return;
|
||||
|
||||
Group* grp = plr->GetGroup();
|
||||
uint64 guid = plr->GetGUID();
|
||||
Group* grp = player->GetGroup();
|
||||
uint64 guid = player->GetGUID();
|
||||
uint64 gguid = grp ? grp->GetGUID() : guid;
|
||||
LfgJoinResultData joinData;
|
||||
PlayerSet players;
|
||||
@@ -457,7 +457,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
|
||||
if (playerDungeons == dungeons) // Joining the same dungeons -- Send OK
|
||||
{
|
||||
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, comment);
|
||||
plr->GetSession()->SendLfgJoinResult(joinData); // Default value of joinData.result = LFG_JOIN_OK
|
||||
player->GetSession()->SendLfgJoinResult(joinData); // Default value of joinData.result = LFG_JOIN_OK
|
||||
if (grp)
|
||||
{
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
@@ -471,11 +471,11 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
|
||||
}
|
||||
|
||||
// Check player or group member restrictions
|
||||
if (plr->InBattleground() || plr->InArena() || plr->InBattlegroundQueue())
|
||||
if (player->InBattleground() || player->InArena() || player->InBattlegroundQueue())
|
||||
joinData.result = LFG_JOIN_USING_BG_SYSTEM;
|
||||
else if (plr->HasAura(LFG_SPELL_DUNGEON_DESERTER))
|
||||
else if (player->HasAura(LFG_SPELL_DUNGEON_DESERTER))
|
||||
joinData.result = LFG_JOIN_DESERTER;
|
||||
else if (plr->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
|
||||
else if (player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
|
||||
joinData.result = LFG_JOIN_RANDOM_COOLDOWN;
|
||||
else if (dungeons.empty())
|
||||
joinData.result = LFG_JOIN_NOT_MEET_REQS;
|
||||
@@ -505,7 +505,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
|
||||
}
|
||||
}
|
||||
else
|
||||
players.insert(plr);
|
||||
players.insert(player);
|
||||
|
||||
// Check if all dungeons are valid
|
||||
bool isRaid = false;
|
||||
@@ -559,7 +559,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Join: [" UI64FMTD "] joining with %u members. result: %u", guid, grp ? grp->GetMembersCount() : 1, joinData.result);
|
||||
if (!dungeons.empty()) // Only should show lockmap when have no dungeons available
|
||||
joinData.lockmap.clear();
|
||||
plr->GetSession()->SendLfgJoinResult(joinData);
|
||||
player->GetSession()->SendLfgJoinResult(joinData);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -612,7 +612,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
|
||||
// Queue player
|
||||
LfgQueueInfo* pqInfo = new LfgQueueInfo();
|
||||
pqInfo->joinTime = time_t(time(NULL));
|
||||
pqInfo->roles[plr->GetGUID()] = roles;
|
||||
pqInfo->roles[player->GetGUID()] = roles;
|
||||
pqInfo->dungeons = dungeons;
|
||||
if (roles & ROLE_TANK)
|
||||
--pqInfo->tanks;
|
||||
@@ -623,8 +623,8 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
|
||||
m_QueueInfoMap[guid] = pqInfo;
|
||||
|
||||
// Send update to player
|
||||
plr->GetSession()->SendLfgJoinResult(joinData);
|
||||
plr->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment));
|
||||
player->GetSession()->SendLfgJoinResult(joinData);
|
||||
player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment));
|
||||
SetState(gguid, LFG_STATE_QUEUED);
|
||||
SetRoles(guid, roles);
|
||||
if (!isContinue)
|
||||
@@ -636,7 +636,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
|
||||
}
|
||||
SetSelectedDungeons(guid, dungeons);
|
||||
}
|
||||
AddToQueue(guid, uint8(plr->GetTeam()));
|
||||
AddToQueue(guid, uint8(player->GetTeam()));
|
||||
}
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Join: [" UI64FMTD "] joined with %u members. dungeons: %u", guid, grp ? grp->GetMembersCount() : 1, uint8(dungeons.size()));
|
||||
}
|
||||
@@ -645,15 +645,15 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
|
||||
Leaves Dungeon System. Player/Group is removed from queue, rolechecks, proposals
|
||||
or votekicks. Player or group needs to be not NULL and using Dungeon System
|
||||
|
||||
@param[in] plr Player trying to leave (can be NULL)
|
||||
@param[in] player Player trying to leave (can be NULL)
|
||||
@param[in] grp Group trying to leave (default NULL)
|
||||
*/
|
||||
void LFGMgr::Leave(Player* plr, Group* grp /* = NULL*/)
|
||||
void LFGMgr::Leave(Player* player, Group* grp /* = NULL*/)
|
||||
{
|
||||
if (!plr && !grp)
|
||||
if (!player && !grp)
|
||||
return;
|
||||
|
||||
uint64 guid = grp ? grp->GetGUID() : plr->GetGUID();
|
||||
uint64 guid = grp ? grp->GetGUID() : player->GetGUID();
|
||||
LfgState state = GetState(guid);
|
||||
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Leave: [" UI64FMTD "]", guid);
|
||||
@@ -676,7 +676,7 @@ void LFGMgr::Leave(Player* plr, Group* grp /* = NULL*/)
|
||||
}
|
||||
else
|
||||
{
|
||||
plr->GetSession()->SendLfgUpdatePlayer(updateData);
|
||||
player->GetSession()->SendLfgUpdatePlayer(updateData);
|
||||
ClearState(guid);
|
||||
}
|
||||
}
|
||||
@@ -689,7 +689,7 @@ void LFGMgr::Leave(Player* plr, Group* grp /* = NULL*/)
|
||||
{
|
||||
// Remove from Proposals
|
||||
LfgProposalMap::iterator it = m_Proposals.begin();
|
||||
uint64 guid = plr ? plr->GetGUID() : grp->GetLeaderGUID();
|
||||
uint64 guid = player ? player->GetGUID() : grp->GetLeaderGUID();
|
||||
while (it != m_Proposals.end())
|
||||
{
|
||||
LfgProposalPlayerMap::iterator itPlayer = it->second->players.find(guid);
|
||||
@@ -866,22 +866,22 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal)
|
||||
PlayerSet players;
|
||||
for (LfgRolesMap::const_iterator it = rolesMap.begin(); it != rolesMap.end(); ++it)
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(it->first);
|
||||
if (!plr)
|
||||
Player* player = ObjectAccessor::FindPlayer(it->first);
|
||||
if (!player)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Warning! [" UI64FMTD "] offline! Marking as not compatibles!", strGuids.c_str(), it->first);
|
||||
else
|
||||
{
|
||||
for (PlayerSet::const_iterator itPlayer = players.begin(); itPlayer != players.end() && plr; ++itPlayer)
|
||||
for (PlayerSet::const_iterator itPlayer = players.begin(); itPlayer != players.end() && player; ++itPlayer)
|
||||
{
|
||||
// Do not form a group with ignoring candidates
|
||||
if (plr->GetSocial()->HasIgnore((*itPlayer)->GetGUIDLow()) || (*itPlayer)->GetSocial()->HasIgnore(plr->GetGUIDLow()))
|
||||
if (player->GetSocial()->HasIgnore((*itPlayer)->GetGUIDLow()) || (*itPlayer)->GetSocial()->HasIgnore(player->GetGUIDLow()))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Players [" UI64FMTD "] and [" UI64FMTD "] ignoring", strGuids.c_str(), (*itPlayer)->GetGUID(), plr->GetGUID());
|
||||
plr = NULL;
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Players [" UI64FMTD "] and [" UI64FMTD "] ignoring", strGuids.c_str(), (*itPlayer)->GetGUID(), player->GetGUID());
|
||||
player = NULL;
|
||||
}
|
||||
}
|
||||
if (plr)
|
||||
players.insert(plr);
|
||||
if (player)
|
||||
players.insert(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1276,18 +1276,18 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
|
||||
bool allAnswered = true;
|
||||
for (LfgProposalPlayerMap::const_iterator itPlayers = pProposal->players.begin(); itPlayers != pProposal->players.end(); ++itPlayers)
|
||||
{
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(itPlayers->first))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itPlayers->first))
|
||||
{
|
||||
if (itPlayers->first == pProposal->leader)
|
||||
players.push_front(plr);
|
||||
players.push_front(player);
|
||||
else
|
||||
players.push_back(plr);
|
||||
players.push_back(player);
|
||||
|
||||
// Only teleport new players
|
||||
Group* grp = plr->GetGroup();
|
||||
Group* grp = player->GetGroup();
|
||||
uint64 gguid = grp ? grp->GetGUID() : 0;
|
||||
if (!gguid || !grp->isLFGGroup() || GetState(gguid) == LFG_STATE_FINISHED_DUNGEON)
|
||||
playersToTeleport.push_back(plr);
|
||||
playersToTeleport.push_back(player);
|
||||
}
|
||||
|
||||
if (itPlayers->second->accept != LFG_ANSWER_AGREE) // No answer (-1) or not accepted (0)
|
||||
@@ -1329,31 +1329,31 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
|
||||
Group* grp = pProposal->groupLowGuid ? sGroupMgr->GetGroupByGUID(pProposal->groupLowGuid) : NULL;
|
||||
for (LfgPlayerList::const_iterator it = players.begin(); it != players.end(); ++it)
|
||||
{
|
||||
Player* plr = (*it);
|
||||
uint64 pguid = plr->GetGUID();
|
||||
Group* group = plr->GetGroup();
|
||||
Player* player = (*it);
|
||||
uint64 pguid = player->GetGUID();
|
||||
Group* group = player->GetGroup();
|
||||
if (sendUpdate)
|
||||
plr->GetSession()->SendLfgUpdateProposal(proposalId, pProposal);
|
||||
player->GetSession()->SendLfgUpdateProposal(proposalId, pProposal);
|
||||
if (group)
|
||||
{
|
||||
plr->GetSession()->SendLfgUpdateParty(updateData);
|
||||
player->GetSession()->SendLfgUpdateParty(updateData);
|
||||
if (group != grp)
|
||||
plr->RemoveFromGroup();
|
||||
player->RemoveFromGroup();
|
||||
}
|
||||
else
|
||||
plr->GetSession()->SendLfgUpdatePlayer(updateData);
|
||||
player->GetSession()->SendLfgUpdatePlayer(updateData);
|
||||
|
||||
if (!grp)
|
||||
{
|
||||
grp = new Group();
|
||||
grp->Create(plr);
|
||||
grp->Create(player);
|
||||
grp->ConvertToLFG();
|
||||
uint64 gguid = grp->GetGUID();
|
||||
SetState(gguid, LFG_STATE_PROPOSAL);
|
||||
sGroupMgr->AddGroup(grp);
|
||||
}
|
||||
else if (group != grp)
|
||||
grp->AddMember(plr);
|
||||
grp->AddMember(player);
|
||||
|
||||
// Update timers
|
||||
uint8 role = GetRoles(pguid);
|
||||
@@ -1363,25 +1363,25 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
|
||||
case ROLE_DAMAGE:
|
||||
{
|
||||
uint32 old_number = m_NumWaitTimeDps++;
|
||||
m_WaitTimeDps = int32((m_WaitTimeDps * old_number + waitTimesMap[plr->GetGUID()]) / m_NumWaitTimeDps);
|
||||
m_WaitTimeDps = int32((m_WaitTimeDps * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeDps);
|
||||
break;
|
||||
}
|
||||
case ROLE_HEALER:
|
||||
{
|
||||
uint32 old_number = m_NumWaitTimeHealer++;
|
||||
m_WaitTimeHealer = int32((m_WaitTimeHealer * old_number + waitTimesMap[plr->GetGUID()]) / m_NumWaitTimeHealer);
|
||||
m_WaitTimeHealer = int32((m_WaitTimeHealer * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeHealer);
|
||||
break;
|
||||
}
|
||||
case ROLE_TANK:
|
||||
{
|
||||
uint32 old_number = m_NumWaitTimeTank++;
|
||||
m_WaitTimeTank = int32((m_WaitTimeTank * old_number + waitTimesMap[plr->GetGUID()]) / m_NumWaitTimeTank);
|
||||
m_WaitTimeTank = int32((m_WaitTimeTank * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeTank);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
uint32 old_number = m_NumWaitTimeAvg++;
|
||||
m_WaitTimeAvg = int32((m_WaitTimeAvg * old_number + waitTimesMap[plr->GetGUID()]) / m_NumWaitTimeAvg);
|
||||
m_WaitTimeAvg = int32((m_WaitTimeAvg * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeAvg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1454,15 +1454,15 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
|
||||
// Notify players
|
||||
for (LfgProposalPlayerMap::const_iterator it = pProposal->players.begin(); it != pProposal->players.end(); ++it)
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(it->first);
|
||||
if (!plr)
|
||||
Player* player = ObjectAccessor::FindPlayer(it->first);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
team = uint8(plr->GetTeam());
|
||||
plr->GetSession()->SendLfgUpdateProposal(itProposal->first, pProposal);
|
||||
team = uint8(player->GetTeam());
|
||||
player->GetSession()->SendLfgUpdateProposal(itProposal->first, pProposal);
|
||||
|
||||
Group* grp = plr->GetGroup();
|
||||
uint64 guid = plr->GetGUID();
|
||||
Group* grp = player->GetGroup();
|
||||
uint64 guid = player->GetGUID();
|
||||
uint64 gguid = it->second->groupLowGuid ? MAKE_NEW_GUID(it->second->groupLowGuid, 0, HIGHGUID_GROUP) : guid;
|
||||
|
||||
if (toRemove.find(gguid) != toRemove.end()) // Didn't accept or in same group that someone that didn't accept
|
||||
@@ -1482,10 +1482,10 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
|
||||
if (grp)
|
||||
{
|
||||
RestoreState(gguid);
|
||||
plr->GetSession()->SendLfgUpdateParty(updateData);
|
||||
player->GetSession()->SendLfgUpdateParty(updateData);
|
||||
}
|
||||
else
|
||||
plr->GetSession()->SendLfgUpdatePlayer(updateData);
|
||||
player->GetSession()->SendLfgUpdatePlayer(updateData);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1494,10 +1494,10 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
|
||||
if (grp)
|
||||
{
|
||||
SetState(gguid, LFG_STATE_QUEUED);
|
||||
plr->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
|
||||
player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
|
||||
}
|
||||
else
|
||||
plr->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
|
||||
player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1572,17 +1572,17 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas
|
||||
/**
|
||||
Update Boot info with player answer
|
||||
|
||||
@param[in] plr Player who has answered
|
||||
@param[in] player Player who has answered
|
||||
@param[in] accept player answer
|
||||
*/
|
||||
void LFGMgr::UpdateBoot(Player* plr, bool accept)
|
||||
void LFGMgr::UpdateBoot(Player* player, bool accept)
|
||||
{
|
||||
Group* grp = plr ? plr->GetGroup() : NULL;
|
||||
Group* grp = player ? player->GetGroup() : NULL;
|
||||
if (!grp)
|
||||
return;
|
||||
|
||||
uint32 bootId = grp->GetLowGUID();
|
||||
uint64 guid = plr->GetGUID();
|
||||
uint64 guid = player->GetGUID();
|
||||
|
||||
LfgPlayerBootMap::iterator itBoot = m_Boots.find(bootId);
|
||||
if (itBoot == m_Boots.end())
|
||||
@@ -1647,29 +1647,29 @@ void LFGMgr::UpdateBoot(Player* plr, bool accept)
|
||||
/**
|
||||
Teleports the player in or out the dungeon
|
||||
|
||||
@param[in] plr Player to teleport
|
||||
@param[in] player Player to teleport
|
||||
@param[in] out Teleport out (true) or in (false)
|
||||
@param[in] fromOpcode Function called from opcode handlers? (Default false)
|
||||
*/
|
||||
void LFGMgr::TeleportPlayer(Player* plr, bool out, bool fromOpcode /*= false*/)
|
||||
void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*/)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::TeleportPlayer: [" UI64FMTD "] is being teleported %s", plr->GetGUID(), out ? "out" : "in");
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::TeleportPlayer: [" UI64FMTD "] is being teleported %s", player->GetGUID(), out ? "out" : "in");
|
||||
if (out)
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
|
||||
plr->TeleportToBGEntryPoint();
|
||||
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
|
||||
player->TeleportToBGEntryPoint();
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO Add support for LFG_TELEPORTERROR_FATIGUE
|
||||
LfgTeleportError error = LFG_TELEPORTERROR_OK;
|
||||
Group* grp = plr->GetGroup();
|
||||
Group* grp = player->GetGroup();
|
||||
|
||||
if (!grp || !grp->isLFGGroup()) // should never happen, but just in case...
|
||||
error = LFG_TELEPORTERROR_INVALID_LOCATION;
|
||||
else if (!plr->isAlive())
|
||||
else if (!player->isAlive())
|
||||
error = LFG_TELEPORTERROR_PLAYER_DEAD;
|
||||
else if (plr->IsFalling() || plr->HasUnitState(UNIT_STAT_JUMPING))
|
||||
else if (player->IsFalling() || player->HasUnitState(UNIT_STAT_JUMPING))
|
||||
error = LFG_TELEPORTERROR_FALLING;
|
||||
else
|
||||
{
|
||||
@@ -1678,7 +1678,7 @@ void LFGMgr::TeleportPlayer(Player* plr, bool out, bool fromOpcode /*= false*/)
|
||||
|
||||
if (!dungeon)
|
||||
error = LFG_TELEPORTERROR_INVALID_LOCATION;
|
||||
else if (plr->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance
|
||||
else if (player->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance
|
||||
{
|
||||
uint32 mapid = 0;
|
||||
float x = 0;
|
||||
@@ -1692,7 +1692,7 @@ void LFGMgr::TeleportPlayer(Player* plr, bool out, bool fromOpcode /*= false*/)
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && !mapid; itr = itr->next())
|
||||
{
|
||||
Player* plrg = itr->getSource();
|
||||
if (plrg && plrg != plr && plrg->GetMapId() == uint32(dungeon->map))
|
||||
if (plrg && plrg != player && plrg->GetMapId() == uint32(dungeon->map))
|
||||
{
|
||||
mapid = plrg->GetMapId();
|
||||
x = plrg->GetPositionX();
|
||||
@@ -1708,7 +1708,7 @@ void LFGMgr::TeleportPlayer(Player* plr, bool out, bool fromOpcode /*= false*/)
|
||||
AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(dungeon->map);
|
||||
if (!at)
|
||||
{
|
||||
sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "]: No areatrigger found for map: %u difficulty: %u", plr->GetGUID(), dungeon->map, dungeon->difficulty);
|
||||
sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "]: No areatrigger found for map: %u difficulty: %u", player->GetGUID(), dungeon->map, dungeon->difficulty);
|
||||
error = LFG_TELEPORTERROR_INVALID_LOCATION;
|
||||
}
|
||||
else
|
||||
@@ -1723,36 +1723,36 @@ void LFGMgr::TeleportPlayer(Player* plr, bool out, bool fromOpcode /*= false*/)
|
||||
|
||||
if (error == LFG_TELEPORTERROR_OK)
|
||||
{
|
||||
if (!plr->GetMap()->IsDungeon() && !plr->GetMap()->IsRaid())
|
||||
plr->SetBattlegroundEntryPoint();
|
||||
if (!player->GetMap()->IsDungeon() && !player->GetMap()->IsRaid())
|
||||
player->SetBattlegroundEntryPoint();
|
||||
|
||||
if (plr->isInFlight())
|
||||
if (player->isInFlight())
|
||||
{
|
||||
plr->GetMotionMaster()->MovementExpired();
|
||||
plr->CleanupAfterTaxiFlight();
|
||||
player->GetMotionMaster()->MovementExpired();
|
||||
player->CleanupAfterTaxiFlight();
|
||||
}
|
||||
|
||||
if (plr->TeleportTo(mapid, x, y, z, orientation))
|
||||
if (player->TeleportTo(mapid, x, y, z, orientation))
|
||||
// FIXME - HACK - this should be done by teleport, when teleporting far
|
||||
plr->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
player->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
else
|
||||
{
|
||||
error = LFG_TELEPORTERROR_INVALID_LOCATION;
|
||||
sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", plr->GetGUID(), mapid);
|
||||
sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", player->GetGUID(), mapid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (error != LFG_TELEPORTERROR_OK)
|
||||
plr->GetSession()->SendLfgTeleportError(uint8(error));
|
||||
player->GetSession()->SendLfgTeleportError(uint8(error));
|
||||
}
|
||||
|
||||
/**
|
||||
Give completion reward to player
|
||||
|
||||
@param[in] dungeonId Id of the dungeon finished
|
||||
@param[in] plr Player to reward
|
||||
@param[in] player Player to reward
|
||||
*/
|
||||
void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player)
|
||||
{
|
||||
|
||||
@@ -268,8 +268,8 @@ class LFGMgr
|
||||
LfgReward const* GetRandomDungeonReward(uint32 dungeon, uint8 level);
|
||||
|
||||
// Queue
|
||||
void Join(Player* plr, uint8 roles, const LfgDungeonSet& dungeons, const std::string& comment);
|
||||
void Leave(Player* plr, Group* grp = NULL);
|
||||
void Join(Player* player, uint8 roles, const LfgDungeonSet& dungeons, const std::string& comment);
|
||||
void Leave(Player* player, Group* grp = NULL);
|
||||
|
||||
// Role Check
|
||||
void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = ROLE_NONE);
|
||||
@@ -278,14 +278,14 @@ class LFGMgr
|
||||
void UpdateProposal(uint32 proposalId, uint64 guid, bool accept);
|
||||
|
||||
// Teleportation
|
||||
void TeleportPlayer(Player* plr, bool out, bool fromOpcode = false);
|
||||
void TeleportPlayer(Player* player, bool out, bool fromOpcode = false);
|
||||
|
||||
// Vote kick
|
||||
void InitBoot(Group* grp, uint64 kguid, uint64 vguid, std::string reason);
|
||||
void UpdateBoot(Player* plr, bool accept);
|
||||
void UpdateBoot(Player* player, bool accept);
|
||||
void OfferContinue(Group* grp);
|
||||
|
||||
void InitializeLockedDungeons(Player* plr);
|
||||
void InitializeLockedDungeons(Player* player);
|
||||
|
||||
void SetComment(uint64 guid, const std::string& comment);
|
||||
const LfgLockMap& GetLockedDungeons(uint64 guid);
|
||||
|
||||
@@ -51,8 +51,8 @@ void LFGScripts::OnAddMember(Group* group, uint64 guid)
|
||||
sLFGMgr->Leave(NULL, group);
|
||||
|
||||
if (sLFGMgr->GetState(guid) == LFG_STATE_QUEUED)
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(guid))
|
||||
sLFGMgr->Leave(plr);
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
sLFGMgr->Leave(player);
|
||||
}
|
||||
|
||||
void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason)
|
||||
@@ -82,7 +82,7 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method,
|
||||
}
|
||||
|
||||
sLFGMgr->ClearState(guid);
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
/*
|
||||
if (method == GROUP_REMOVEMETHOD_LEAVE)
|
||||
@@ -92,9 +92,9 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method,
|
||||
*/
|
||||
|
||||
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER);
|
||||
plr->GetSession()->SendLfgUpdateParty(updateData);
|
||||
if (plr->GetMap()->IsDungeon()) // Teleport player out the dungeon
|
||||
sLFGMgr->TeleportPlayer(plr, true);
|
||||
player->GetSession()->SendLfgUpdateParty(updateData);
|
||||
if (player->GetMap()->IsDungeon()) // Teleport player out the dungeon
|
||||
sLFGMgr->TeleportPlayer(player, true);
|
||||
}
|
||||
|
||||
if (sLFGMgr->GetState(gguid) != LFG_STATE_FINISHED_DUNGEON)// Need more players to finish the dungeon
|
||||
@@ -116,17 +116,17 @@ void LFGScripts::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLe
|
||||
return;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
|
||||
Player* plr = ObjectAccessor::FindPlayer(newLeaderGuid);
|
||||
Player* player = ObjectAccessor::FindPlayer(newLeaderGuid);
|
||||
|
||||
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER);
|
||||
if (plr)
|
||||
plr->GetSession()->SendLfgUpdateParty(updateData);
|
||||
if (player)
|
||||
player->GetSession()->SendLfgUpdateParty(updateData);
|
||||
|
||||
plr = ObjectAccessor::FindPlayer(oldLeaderGuid);
|
||||
if (plr)
|
||||
player = ObjectAccessor::FindPlayer(oldLeaderGuid);
|
||||
if (player)
|
||||
{
|
||||
updateData.updateType = LFG_UPDATETYPE_GROUP_DISBAND;
|
||||
plr->GetSession()->SendLfgUpdateParty(updateData);
|
||||
player->GetSession()->SendLfgUpdateParty(updateData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1433,14 +1433,14 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
|
||||
return IsWithinLOSInMap(who);
|
||||
}
|
||||
|
||||
float Creature::GetAttackDistance(Unit const* pl) const
|
||||
float Creature::GetAttackDistance(Unit const* player) const
|
||||
{
|
||||
float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
|
||||
if (aggroRate == 0)
|
||||
return 0.0f;
|
||||
|
||||
uint32 playerlevel = pl->getLevelForTarget(this);
|
||||
uint32 creaturelevel = getLevelForTarget(pl);
|
||||
uint32 playerlevel = player->getLevelForTarget(this);
|
||||
uint32 creaturelevel = getLevelForTarget(player);
|
||||
|
||||
int32 leveldif = int32(playerlevel) - int32(creaturelevel);
|
||||
|
||||
@@ -1461,7 +1461,7 @@ float Creature::GetAttackDistance(Unit const* pl) const
|
||||
RetDistance += GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE);
|
||||
|
||||
// detected range auras
|
||||
RetDistance += pl->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
|
||||
RetDistance += player->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
|
||||
}
|
||||
|
||||
// "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
|
||||
|
||||
@@ -607,7 +607,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
|
||||
CreatureSpellCooldowns m_CreatureCategoryCooldowns;
|
||||
|
||||
bool canStartAttack(Unit const* u, bool force) const;
|
||||
float GetAttackDistance(Unit const* pl) const;
|
||||
float GetAttackDistance(Unit const* player) const;
|
||||
|
||||
void SendAIReaction(AiReaction reactionType);
|
||||
|
||||
|
||||
@@ -780,13 +780,13 @@ void Object::ClearUpdateMask(bool remove)
|
||||
}
|
||||
}
|
||||
|
||||
void Object::BuildFieldsUpdate(Player* pl, UpdateDataMapType& data_map) const
|
||||
void Object::BuildFieldsUpdate(Player* player, UpdateDataMapType& data_map) const
|
||||
{
|
||||
UpdateDataMapType::iterator iter = data_map.find(pl);
|
||||
UpdateDataMapType::iterator iter = data_map.find(player);
|
||||
|
||||
if (iter == data_map.end())
|
||||
{
|
||||
std::pair<UpdateDataMapType::iterator, bool> p = data_map.insert(UpdateDataMapType::value_type(pl, UpdateData()));
|
||||
std::pair<UpdateDataMapType::iterator, bool> p = data_map.insert(UpdateDataMapType::value_type(player, UpdateData()));
|
||||
ASSERT(p.second);
|
||||
iter = p.first;
|
||||
}
|
||||
@@ -2723,19 +2723,19 @@ void WorldObject::DestroyForNearbyPlayers()
|
||||
VisitNearbyWorldObject(GetVisibilityRange(), searcher);
|
||||
for (std::list<Player*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
|
||||
{
|
||||
Player* plr = (*iter);
|
||||
Player* player = (*iter);
|
||||
|
||||
if (plr == this)
|
||||
if (player == this)
|
||||
continue;
|
||||
|
||||
if (!plr->HaveAtClient(this))
|
||||
if (!player->HaveAtClient(this))
|
||||
continue;
|
||||
|
||||
if (isType(TYPEMASK_UNIT) && ((Unit*)this)->GetCharmerGUID() == plr->GetGUID()) // TODO: this is for puppet
|
||||
if (isType(TYPEMASK_UNIT) && ((Unit*)this)->GetCharmerGUID() == player->GetGUID()) // TODO: this is for puppet
|
||||
continue;
|
||||
|
||||
DestroyForPlayer(plr);
|
||||
plr->m_clientGUIDs.erase(GetGUID());
|
||||
DestroyForPlayer(player);
|
||||
player->m_clientGUIDs.erase(GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2803,13 +2803,13 @@ struct WorldObjectChangeAccumulator
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPacket(Player* plr)
|
||||
void BuildPacket(Player* player)
|
||||
{
|
||||
// Only send update once to a player
|
||||
if (plr_list.find(plr->GetGUID()) == plr_list.end() && plr->HaveAtClient(&i_object))
|
||||
if (plr_list.find(player->GetGUID()) == plr_list.end() && player->HaveAtClient(&i_object))
|
||||
{
|
||||
i_object.BuildFieldsUpdate(plr, i_updateDatas);
|
||||
plr_list.insert(plr->GetGUID());
|
||||
i_object.BuildFieldsUpdate(player, i_updateDatas);
|
||||
plr_list.insert(player->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2338,7 +2338,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
bool IsNeverVisible() const;
|
||||
|
||||
bool IsVisibleGloballyFor(Player* pl) const;
|
||||
bool IsVisibleGloballyFor(Player* player) const;
|
||||
|
||||
void SendInitialVisiblePackets(Unit* target);
|
||||
void UpdateObjectVisibility(bool forced = true);
|
||||
|
||||
@@ -114,9 +114,9 @@ void PlayerSocial::SetFriendNote(uint32 friend_guid, std::string note)
|
||||
m_playerSocialMap[friend_guid].Note = note;
|
||||
}
|
||||
|
||||
void PlayerSocial::SendSocialList(Player* plr)
|
||||
void PlayerSocial::SendSocialList(Player* player)
|
||||
{
|
||||
if (!plr)
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
uint32 size = m_playerSocialMap.size();
|
||||
@@ -127,7 +127,7 @@ void PlayerSocial::SendSocialList(Player* plr)
|
||||
|
||||
for (PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
|
||||
{
|
||||
sSocialMgr->GetFriendInfo(plr, itr->first, itr->second);
|
||||
sSocialMgr->GetFriendInfo(player, itr->first, itr->second);
|
||||
|
||||
data << uint64(itr->first); // player guid
|
||||
data << uint32(itr->second.Flags); // player flag (0x1-friend?, 0x2-ignored?, 0x4-muted?)
|
||||
@@ -144,7 +144,7 @@ void PlayerSocial::SendSocialList(Player* plr)
|
||||
}
|
||||
}
|
||||
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CONTACT_LIST");
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ class PlayerSocial
|
||||
void RemoveFromSocialList(uint32 friend_guid, bool ignore);
|
||||
void SetFriendNote(uint32 friend_guid, std::string note);
|
||||
// Packet send's
|
||||
void SendSocialList(Player* plr);
|
||||
void SendSocialList(Player* player);
|
||||
// Misc
|
||||
bool HasFriend(uint32 friend_guid);
|
||||
bool HasIgnore(uint32 ignore_guid);
|
||||
|
||||
@@ -489,13 +489,13 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
|
||||
|
||||
for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();)
|
||||
{
|
||||
Player* plr = *itr;
|
||||
Player* player = *itr;
|
||||
++itr;
|
||||
|
||||
if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
||||
plr->ResurrectPlayer(1.0f);
|
||||
if (player->isDead() && !player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
||||
player->ResurrectPlayer(1.0f);
|
||||
|
||||
plr->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
|
||||
player->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
|
||||
}
|
||||
|
||||
//we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference...
|
||||
@@ -584,13 +584,13 @@ void Transport::Update(uint32 p_diff)
|
||||
|
||||
void Transport::UpdateForMap(Map const* targetMap)
|
||||
{
|
||||
Map::PlayerList const& pl = targetMap->GetPlayers();
|
||||
if (pl.isEmpty())
|
||||
Map::PlayerList const& player = targetMap->GetPlayers();
|
||||
if (player.isEmpty())
|
||||
return;
|
||||
|
||||
if (GetMapId() == targetMap->GetId())
|
||||
{
|
||||
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
|
||||
for (Map::PlayerList::const_iterator itr = player.begin(); itr != player.end(); ++itr)
|
||||
{
|
||||
if (this != itr->getSource()->GetTransport())
|
||||
{
|
||||
@@ -609,7 +609,7 @@ void Transport::UpdateForMap(Map const* targetMap)
|
||||
WorldPacket out_packet;
|
||||
transData.BuildPacket(&out_packet);
|
||||
|
||||
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
|
||||
for (Map::PlayerList::const_iterator itr = player.begin(); itr != player.end(); ++itr)
|
||||
if (this != itr->getSource()->GetTransport())
|
||||
itr->getSource()->SendDirectMessage(&out_packet);
|
||||
}
|
||||
|
||||
@@ -5765,11 +5765,11 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Glyph of Ice Block
|
||||
case 56372:
|
||||
{
|
||||
Player* plr = ToPlayer();
|
||||
if (!plr)
|
||||
Player* player = ToPlayer();
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
SpellCooldowns const cooldowns = plr->GetSpellCooldowns();
|
||||
SpellCooldowns const cooldowns = player->GetSpellCooldowns();
|
||||
// remove cooldowns on all ranks of Frost Nova
|
||||
for (SpellCooldowns::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
|
||||
{
|
||||
@@ -5777,7 +5777,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Frost Nova
|
||||
if (cdSpell && cdSpell->SpellFamilyName == SPELLFAMILY_MAGE
|
||||
&& cdSpell->SpellFamilyFlags[0] & 0x00000040)
|
||||
plr->RemoveSpellCooldown(cdSpell->Id, true);
|
||||
player->RemoveSpellCooldown(cdSpell->Id, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -7059,26 +7059,26 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
// Windfury Weapon (Passive) 1-5 Ranks
|
||||
case 33757:
|
||||
{
|
||||
Player* plr = ToPlayer();
|
||||
if (!plr || !castItem || !castItem->IsEquipped() || !victim || !victim->isAlive())
|
||||
Player* player = ToPlayer();
|
||||
if (!player || !castItem || !castItem->IsEquipped() || !victim || !victim->isAlive())
|
||||
return false;
|
||||
|
||||
// custom cooldown processing case
|
||||
if (cooldown && plr->HasSpellCooldown(dummySpell->Id))
|
||||
if (cooldown && player->HasSpellCooldown(dummySpell->Id))
|
||||
return false;
|
||||
|
||||
if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID())
|
||||
return false;
|
||||
|
||||
WeaponAttackType attType = WeaponAttackType(plr->GetAttackBySlot(castItem->GetSlot()));
|
||||
WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
|
||||
if ((attType != BASE_ATTACK && attType != OFF_ATTACK) || !isAttackReady(attType))
|
||||
return false;
|
||||
|
||||
// Now compute real proc chance...
|
||||
uint32 chance = 20;
|
||||
plr->ApplySpellMod(dummySpell->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
|
||||
player->ApplySpellMod(dummySpell->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
|
||||
|
||||
Item* addWeapon = plr->GetWeaponForAttack(attType == BASE_ATTACK ? OFF_ATTACK : BASE_ATTACK, true);
|
||||
Item* addWeapon = player->GetWeaponForAttack(attType == BASE_ATTACK ? OFF_ATTACK : BASE_ATTACK, true);
|
||||
uint32 enchant_id_add = addWeapon ? addWeapon->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)) : 0;
|
||||
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id_add);
|
||||
if (pEnchant && pEnchant->spellid[0] == dummySpell->Id)
|
||||
@@ -7123,7 +7123,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
|
||||
// apply cooldown before cast to prevent processing itself
|
||||
if (cooldown)
|
||||
plr->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
|
||||
player->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
|
||||
|
||||
// Attack Twice
|
||||
for (uint32 i = 0; i < 2; ++i)
|
||||
@@ -8074,9 +8074,9 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
|
||||
{
|
||||
*handled = true;
|
||||
// Convert recently used Blood Rune to Death Rune
|
||||
if (Player* plr = ToPlayer())
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
if (plr->getClass() != CLASS_DEATH_KNIGHT)
|
||||
if (player->getClass() != CLASS_DEATH_KNIGHT)
|
||||
return false;
|
||||
|
||||
RuneType rune = ToPlayer()->GetLastUsedRune();
|
||||
@@ -8100,22 +8100,22 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
|
||||
{
|
||||
if (dummySpell->SpellIconID == 2622)
|
||||
{
|
||||
if (plr->GetCurrentRune(i) == RUNE_DEATH ||
|
||||
plr->GetBaseRune(i) == RUNE_BLOOD)
|
||||
if (player->GetCurrentRune(i) == RUNE_DEATH ||
|
||||
player->GetBaseRune(i) == RUNE_BLOOD)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plr->GetCurrentRune(i) == RUNE_DEATH ||
|
||||
plr->GetBaseRune(i) != RUNE_BLOOD)
|
||||
if (player->GetCurrentRune(i) == RUNE_DEATH ||
|
||||
player->GetBaseRune(i) != RUNE_BLOOD)
|
||||
continue;
|
||||
}
|
||||
if (plr->GetRuneCooldown(i) != plr->GetRuneBaseCooldown(i))
|
||||
if (player->GetRuneCooldown(i) != player->GetRuneBaseCooldown(i))
|
||||
continue;
|
||||
|
||||
--runesLeft;
|
||||
// Mark aura as used
|
||||
plr->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
|
||||
player->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -8791,11 +8791,11 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
// Blade Barrier
|
||||
if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && auraSpellInfo->SpellIconID == 85)
|
||||
{
|
||||
Player* plr = ToPlayer();
|
||||
if (!plr || plr->getClass() != CLASS_DEATH_KNIGHT)
|
||||
Player* player = ToPlayer();
|
||||
if (!player || player->getClass() != CLASS_DEATH_KNIGHT)
|
||||
return false;
|
||||
|
||||
if (!plr->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD))
|
||||
if (!player->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10144,20 +10144,20 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
|
||||
|
||||
// only called in Player::SetSeer
|
||||
// so move it to Player?
|
||||
void Unit::AddPlayerToVision(Player* plr)
|
||||
void Unit::AddPlayerToVision(Player* player)
|
||||
{
|
||||
if (m_sharedVision.empty())
|
||||
{
|
||||
setActive(true);
|
||||
SetWorldObject(true);
|
||||
}
|
||||
m_sharedVision.push_back(plr);
|
||||
m_sharedVision.push_back(player);
|
||||
}
|
||||
|
||||
// only called in Player::SetSeer
|
||||
void Unit::RemovePlayerFromVision(Player* plr)
|
||||
void Unit::RemovePlayerFromVision(Player* player)
|
||||
{
|
||||
m_sharedVision.remove(plr);
|
||||
m_sharedVision.remove(player);
|
||||
if (m_sharedVision.empty())
|
||||
{
|
||||
setActive(false);
|
||||
@@ -11894,7 +11894,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
|
||||
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT);
|
||||
|
||||
if (Player* plr = ToPlayer())
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
// mount as a vehicle
|
||||
if (VehicleId)
|
||||
@@ -11910,7 +11910,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
|
||||
SendMessageToSet(&data, true);
|
||||
|
||||
data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
// mounts can also have accessories
|
||||
GetVehicleKit()->InstallAllAccessories(false);
|
||||
@@ -11918,7 +11918,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
|
||||
}
|
||||
|
||||
// unsummon pet
|
||||
Pet* pet = plr->GetPet();
|
||||
Pet* pet = player->GetPet();
|
||||
if (pet)
|
||||
{
|
||||
Battleground* bg = ToPlayer()->GetBattleground();
|
||||
@@ -11926,7 +11926,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
|
||||
if (bg && bg->isArena())
|
||||
pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
else
|
||||
plr->UnsummonPetTemporaryIfAny();
|
||||
player->UnsummonPetTemporaryIfAny();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11962,15 +11962,15 @@ void Unit::Unmount()
|
||||
// only resummon old pet if the player is already added to a map
|
||||
// this prevents adding a pet to a not created map which would otherwise cause a crash
|
||||
// (it could probably happen when logging in after a previous crash)
|
||||
if (Player* plr = ToPlayer())
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
if (Pet* pPet = plr->GetPet())
|
||||
if (Pet* pPet = player->GetPet())
|
||||
{
|
||||
if (pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STAT_STUNNED))
|
||||
pPet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
}
|
||||
else
|
||||
plr->ResummonPetTemporaryUnSummonedIfAny();
|
||||
player->ResummonPetTemporaryUnSummonedIfAny();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13556,10 +13556,10 @@ void Unit::SetHealth(uint32 val)
|
||||
SetUInt32Value(UNIT_FIELD_HEALTH, val);
|
||||
|
||||
// group update
|
||||
if (Player* plr = ToPlayer())
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
if (plr->GetGroup())
|
||||
plr->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
|
||||
if (player->GetGroup())
|
||||
player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
|
||||
}
|
||||
else if (Pet* pet = ToCreature()->ToPet())
|
||||
{
|
||||
@@ -14772,9 +14772,9 @@ void Unit::ClearComboPointHolders()
|
||||
{
|
||||
uint32 lowguid = *m_ComboPointHolders.begin();
|
||||
|
||||
Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
|
||||
if (plr && plr->GetComboTarget() == GetGUID()) // recheck for safe
|
||||
plr->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
|
||||
Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
|
||||
if (player && player->GetComboTarget() == GetGUID()) // recheck for safe
|
||||
player->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
|
||||
else
|
||||
m_ComboPointHolders.erase(lowguid); // or remove manually
|
||||
}
|
||||
@@ -15341,9 +15341,9 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
return;
|
||||
|
||||
// Inform pets (if any) when player kills target)
|
||||
if (Player* plr = ToPlayer())
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
Pet* pet = plr->GetPet();
|
||||
Pet* pet = player->GetPet();
|
||||
if (pet && pet->isAlive() && pet->isControlled())
|
||||
pet->AI()->KilledUnit(victim);
|
||||
}
|
||||
@@ -15915,10 +15915,10 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
||||
}
|
||||
else
|
||||
{
|
||||
Player* plr = ToPlayer();
|
||||
if (plr->isAFK())
|
||||
plr->ToggleAFK();
|
||||
plr->SetClientControl(this, 0);
|
||||
Player* player = ToPlayer();
|
||||
if (player->isAFK())
|
||||
player->ToggleAFK();
|
||||
player->SetClientControl(this, 0);
|
||||
}
|
||||
|
||||
// charm is set by aura, and aura effect remove handler was called during apply handler execution
|
||||
@@ -16981,25 +16981,25 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
|
||||
if (aurApp && aurApp->GetRemoveMode())
|
||||
return;
|
||||
|
||||
if (Player* plr = ToPlayer())
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && plr->isInCombat())
|
||||
if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->isInCombat())
|
||||
return;
|
||||
|
||||
InterruptNonMeleeSpells(false);
|
||||
plr->StopCastingCharm();
|
||||
plr->StopCastingBindSight();
|
||||
player->StopCastingCharm();
|
||||
player->StopCastingBindSight();
|
||||
Unmount();
|
||||
RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
// drop flag at invisible in bg
|
||||
if (Battleground* bg = plr->GetBattleground())
|
||||
bg->EventPlayerDroppedFlag(plr);
|
||||
if (Battleground* bg = player->GetBattleground())
|
||||
bg->EventPlayerDroppedFlag(player);
|
||||
|
||||
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
plr->UnsummonPetTemporaryIfAny();
|
||||
player->UnsummonPetTemporaryIfAny();
|
||||
}
|
||||
|
||||
ASSERT(!m_vehicle);
|
||||
@@ -17073,8 +17073,8 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
||||
SendMonsterMoveExitVehicle(&pos);
|
||||
Relocate(&pos);
|
||||
|
||||
if (Player* plr = ToPlayer())
|
||||
plr->ResummonPetTemporaryUnSummonedIfAny();
|
||||
if (Player* player = ToPlayer())
|
||||
player->ResummonPetTemporaryUnSummonedIfAny();
|
||||
|
||||
WorldPacket data2;
|
||||
BuildHeartBeatMsg(&data2);
|
||||
|
||||
@@ -1730,8 +1730,8 @@ class Unit : public WorldObject
|
||||
//Player* GetMoverSource() const;
|
||||
Player* m_movedPlayer;
|
||||
SharedVisionList const& GetSharedVisionList() { return m_sharedVision; }
|
||||
void AddPlayerToVision(Player* plr);
|
||||
void RemovePlayerFromVision(Player* plr);
|
||||
void AddPlayerToVision(Player* player);
|
||||
void RemovePlayerFromVision(Player* player);
|
||||
bool HasSharedVision() const { return !m_sharedVision.empty(); }
|
||||
void RemoveBindSightAuras();
|
||||
void RemoveCharmAuras();
|
||||
|
||||
@@ -1590,15 +1590,15 @@ void GameEventMgr::SaveWorldEventStateToDB(uint16 event_id)
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
void GameEventMgr::SendWorldStateUpdate(Player* plr, uint16 event_id)
|
||||
void GameEventMgr::SendWorldStateUpdate(Player* player, uint16 event_id)
|
||||
{
|
||||
GameEventConditionMap::const_iterator itr;
|
||||
for (itr = mGameEvent[event_id].conditions.begin(); itr !=mGameEvent[event_id].conditions.end(); ++itr)
|
||||
{
|
||||
if (itr->second.done_world_state)
|
||||
plr->SendUpdateWorldState(itr->second.done_world_state, (uint32)(itr->second.done));
|
||||
player->SendUpdateWorldState(itr->second.done_world_state, (uint32)(itr->second.done));
|
||||
if (itr->second.max_world_state)
|
||||
plr->SendUpdateWorldState(itr->second.max_world_state, (uint32)(itr->second.reqNum));
|
||||
player->SendUpdateWorldState(itr->second.max_world_state, (uint32)(itr->second.reqNum));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,11 +115,11 @@ class GameEventMgr
|
||||
bool StartEvent(uint16 event_id, bool overwrite = false);
|
||||
void StopEvent(uint16 event_id, bool overwrite = false);
|
||||
void HandleQuestComplete(uint32 quest_id); // called on world event type quest completions
|
||||
void HandleWorldEventGossip(Player* plr, Creature* c);
|
||||
void HandleWorldEventGossip(Player* player, Creature* c);
|
||||
uint32 GetNPCFlag(Creature* cr);
|
||||
uint32 GetNpcTextId(uint32 guid);
|
||||
private:
|
||||
void SendWorldStateUpdate(Player* plr, uint16 event_id);
|
||||
void SendWorldStateUpdate(Player* player, uint16 event_id);
|
||||
void AddActiveEvent(uint16 event_id) { m_ActiveEvents.insert(event_id); }
|
||||
void RemoveActiveEvent(uint16 event_id) { m_ActiveEvents.erase(event_id); }
|
||||
void ApplyNewEvent(uint16 event_id);
|
||||
|
||||
@@ -5369,11 +5369,11 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
||||
m->checked = fields[7].GetUInt32();
|
||||
m->mailTemplateId = fields[8].GetInt16();
|
||||
|
||||
Player* pl = NULL;
|
||||
Player* player = NULL;
|
||||
if (serverUp)
|
||||
pl = ObjectAccessor::FindPlayer((uint64)m->receiver);
|
||||
player = ObjectAccessor::FindPlayer((uint64)m->receiver);
|
||||
|
||||
if (pl && pl->m_mailsLoaded)
|
||||
if (player && player->m_mailsLoaded)
|
||||
{ // this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail
|
||||
// his in mailbox and he has already listed his mails)
|
||||
delete m;
|
||||
@@ -8490,13 +8490,13 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, bool savetodb)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const
|
||||
bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* player, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const
|
||||
{
|
||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
|
||||
if (!cInfo)
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||
if (player)
|
||||
ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||
else
|
||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
|
||||
return false;
|
||||
@@ -8506,8 +8506,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
||||
{
|
||||
if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||
if (player)
|
||||
ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||
else
|
||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
|
||||
|
||||
@@ -8519,8 +8519,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
||||
|
||||
if (!sObjectMgr->GetItemTemplate(item_id))
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
|
||||
if (player)
|
||||
ChatHandler(player).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
|
||||
else
|
||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id);
|
||||
return false;
|
||||
@@ -8528,8 +8528,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
||||
|
||||
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
||||
if (player)
|
||||
ChatHandler(player).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
||||
else
|
||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry);
|
||||
return false;
|
||||
@@ -8537,16 +8537,16 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
||||
|
||||
if (maxcount > 0 && incrtime == 0)
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
|
||||
if (player)
|
||||
ChatHandler(player).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
|
||||
else
|
||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
|
||||
return false;
|
||||
}
|
||||
else if (maxcount == 0 && incrtime > 0)
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
|
||||
if (player)
|
||||
ChatHandler(player).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
|
||||
else
|
||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry);
|
||||
return false;
|
||||
@@ -8558,8 +8558,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
||||
|
||||
if (vItems->FindItemCostPair(item_id, ExtendedCost))
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
|
||||
if (player)
|
||||
ChatHandler(player).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
|
||||
else
|
||||
sLog->outErrorDb("Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry);
|
||||
return false;
|
||||
@@ -8567,8 +8567,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
||||
|
||||
if (vItems->GetItemCount() >= MAX_VENDOR_ITEMS)
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
|
||||
if (player)
|
||||
ChatHandler(player).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
|
||||
else
|
||||
sLog->outErrorDb("Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry);
|
||||
return false;
|
||||
|
||||
@@ -1140,7 +1140,7 @@ class ObjectMgr
|
||||
}
|
||||
void AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event
|
||||
bool RemoveVendorItem(uint32 entry, uint32 item, bool savetodb = true); // for event
|
||||
bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const;
|
||||
bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* player = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const;
|
||||
|
||||
void LoadScriptNames();
|
||||
ScriptNameMap &GetScriptNames() { return m_scriptNames; }
|
||||
|
||||
@@ -55,9 +55,9 @@ void VisibleNotifier::SendToSelf()
|
||||
|
||||
if (IS_PLAYER_GUID(*it))
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(*it);
|
||||
if (plr && plr->IsInWorld() && !plr->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
plr->UpdateVisibilityOf(&i_player);
|
||||
Player* player = ObjectAccessor::FindPlayer(*it);
|
||||
if (player && player->IsInWorld() && !player->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
player->UpdateVisibilityOf(&i_player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,16 +122,16 @@ void PlayerRelocationNotifier::Visit(PlayerMapType &m)
|
||||
{
|
||||
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Player* plr = iter->getSource();
|
||||
Player* player = iter->getSource();
|
||||
|
||||
vis_guids.erase(plr->GetGUID());
|
||||
vis_guids.erase(player->GetGUID());
|
||||
|
||||
i_player.UpdateVisibilityOf(plr, i_data, i_visibleNow);
|
||||
i_player.UpdateVisibilityOf(player, i_data, i_visibleNow);
|
||||
|
||||
if (plr->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
if (player->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
continue;
|
||||
|
||||
plr->UpdateVisibilityOf(&i_player);
|
||||
player->UpdateVisibilityOf(&i_player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,12 +156,12 @@ void CreatureRelocationNotifier::Visit(PlayerMapType &m)
|
||||
{
|
||||
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Player* pl = iter->getSource();
|
||||
Player* player = iter->getSource();
|
||||
|
||||
if (!pl->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
pl->UpdateVisibilityOf(&i_creature);
|
||||
if (!player->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
player->UpdateVisibilityOf(&i_creature);
|
||||
|
||||
CreatureUnitRelocationWorker(&i_creature, pl);
|
||||
CreatureUnitRelocationWorker(&i_creature, player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,11 +307,11 @@ void MessageDistDeliverer::Visit(DynamicObjectMapType &m)
|
||||
|
||||
/*
|
||||
void
|
||||
MessageDistDeliverer::VisitObject(Player* plr)
|
||||
MessageDistDeliverer::VisitObject(Player* player)
|
||||
{
|
||||
if (!i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam()))
|
||||
if (!i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && player->GetTeam() == ((Player&)i_source).GetTeam()))
|
||||
{
|
||||
SendPacket(plr);
|
||||
SendPacket(player);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Trinity
|
||||
|
||||
struct PlayerRelocationNotifier : public VisibleNotifier
|
||||
{
|
||||
PlayerRelocationNotifier(Player &pl) : VisibleNotifier(pl) {}
|
||||
PlayerRelocationNotifier(Player &player) : VisibleNotifier(player) {}
|
||||
|
||||
template<class T> void Visit(GridRefManager<T> &m) { VisibleNotifier::Visit(m); }
|
||||
void Visit(CreatureMapType &);
|
||||
@@ -137,16 +137,16 @@ namespace Trinity
|
||||
void Visit(DynamicObjectMapType &m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
|
||||
void SendPacket(Player* plr)
|
||||
void SendPacket(Player* player)
|
||||
{
|
||||
// never send packet to self
|
||||
if (plr == i_source || (team && plr->GetTeam() != team) || skipped_receiver == plr)
|
||||
if (player == i_source || (team && player->GetTeam() != team) || skipped_receiver == player)
|
||||
return;
|
||||
|
||||
if (!plr->HaveAtClient(i_source))
|
||||
if (!player->HaveAtClient(i_source))
|
||||
return;
|
||||
|
||||
if (WorldSession* session = plr->GetSession())
|
||||
if (WorldSession* session = player->GetSession())
|
||||
session->SendPacket(i_message);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1274,12 +1274,12 @@ void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int
|
||||
{
|
||||
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* plr = itr->getSource();
|
||||
if (!plr || (ignore != 0 && plr->GetGUID() == ignore) || (ignorePlayersInBGRaid && plr->GetGroup() != this))
|
||||
Player* player = itr->getSource();
|
||||
if (!player || (ignore != 0 && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
|
||||
continue;
|
||||
|
||||
if (plr->GetSession() && (group == -1 || itr->getSubGroup() == group))
|
||||
plr->GetSession()->SendPacket(packet);
|
||||
if (player->GetSession() && (group == -1 || itr->getSubGroup() == group))
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1287,10 +1287,10 @@ void Group::BroadcastReadyCheck(WorldPacket* packet)
|
||||
{
|
||||
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* plr = itr->getSource();
|
||||
if (plr && plr->GetSession())
|
||||
if (IsLeader(plr->GetGUID()) || IsAssistant(plr->GetGUID()))
|
||||
plr->GetSession()->SendPacket(packet);
|
||||
Player* player = itr->getSource();
|
||||
if (player && player->GetSession())
|
||||
if (IsLeader(player->GetGUID()) || IsAssistant(player->GetGUID()))
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1298,8 +1298,8 @@ void Group::OfflineReadyCheck()
|
||||
{
|
||||
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(citr->guid);
|
||||
if (!plr || !plr->GetSession())
|
||||
Player* player = ObjectAccessor::FindPlayer(citr->guid);
|
||||
if (!player || !player->GetSession())
|
||||
{
|
||||
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
|
||||
data << uint64(citr->guid);
|
||||
@@ -1425,10 +1425,10 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
|
||||
Player* pNewLooter = NULL;
|
||||
for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr)
|
||||
{
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
||||
if (pl->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
|
||||
if (player->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
{
|
||||
pNewLooter = pl;
|
||||
pNewLooter = player;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1438,10 +1438,10 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
|
||||
// search from start
|
||||
for (member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr)
|
||||
{
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
||||
if (pl->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
|
||||
if (player->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
{
|
||||
pNewLooter = pl;
|
||||
pNewLooter = player;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,8 +436,8 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
|
||||
roundRobinPlayer = lootOwner->GetGUID();
|
||||
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
if (Player* pl = itr->getSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter
|
||||
FillNotNormalLootFor(pl, pl->IsAtGroupRewardDistance(lootOwner));
|
||||
if (Player* player = itr->getSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter
|
||||
FillNotNormalLootFor(player, player->IsAtGroupRewardDistance(lootOwner));
|
||||
|
||||
for (uint8 i = 0; i < items.size(); ++i)
|
||||
{
|
||||
@@ -453,28 +453,28 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
|
||||
return true;
|
||||
}
|
||||
|
||||
void Loot::FillNotNormalLootFor(Player* pl, bool presentAtLooting)
|
||||
void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting)
|
||||
{
|
||||
uint32 plguid = pl->GetGUIDLow();
|
||||
uint32 plguid = player->GetGUIDLow();
|
||||
|
||||
QuestItemMap::const_iterator qmapitr = PlayerQuestItems.find(plguid);
|
||||
if (qmapitr == PlayerQuestItems.end())
|
||||
FillQuestLoot(pl);
|
||||
FillQuestLoot(player);
|
||||
|
||||
qmapitr = PlayerFFAItems.find(plguid);
|
||||
if (qmapitr == PlayerFFAItems.end())
|
||||
FillFFALoot(pl);
|
||||
FillFFALoot(player);
|
||||
|
||||
qmapitr = PlayerNonQuestNonFFAConditionalItems.find(plguid);
|
||||
if (qmapitr == PlayerNonQuestNonFFAConditionalItems.end())
|
||||
FillNonQuestNonFFAConditionalLoot(pl, presentAtLooting);
|
||||
FillNonQuestNonFFAConditionalLoot(player, presentAtLooting);
|
||||
|
||||
// if not auto-processed player will have to come and pick it up manually
|
||||
if (!presentAtLooting)
|
||||
return;
|
||||
|
||||
// Process currency items
|
||||
uint32 max_slot = GetMaxSlotInLootFor(pl);
|
||||
uint32 max_slot = GetMaxSlotInLootFor(player);
|
||||
LootItem const* item = NULL;
|
||||
uint32 itemsSize = uint32(items.size());
|
||||
for (uint32 i = 0; i < max_slot; ++i)
|
||||
@@ -484,10 +484,10 @@ void Loot::FillNotNormalLootFor(Player* pl, bool presentAtLooting)
|
||||
else
|
||||
item = &quest_items[i-itemsSize];
|
||||
|
||||
if (!item->is_looted && item->freeforall && item->AllowedForPlayer(pl))
|
||||
if (!item->is_looted && item->freeforall && item->AllowedForPlayer(player))
|
||||
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
|
||||
if (proto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
||||
pl->StoreLootItem(i, this);
|
||||
player->StoreLootItem(i, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,8 +592,8 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
|
||||
{
|
||||
i_next = i;
|
||||
++i_next;
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(*i))
|
||||
pl->SendNotifyLootItemRemoved(lootIndex);
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*i))
|
||||
player->SendNotifyLootItemRemoved(lootIndex);
|
||||
else
|
||||
PlayersLooting.erase(i);
|
||||
}
|
||||
@@ -607,8 +607,8 @@ void Loot::NotifyMoneyRemoved()
|
||||
{
|
||||
i_next = i;
|
||||
++i_next;
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(*i))
|
||||
pl->SendNotifyLootMoneyRemoved();
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*i))
|
||||
player->SendNotifyLootMoneyRemoved();
|
||||
else
|
||||
PlayersLooting.erase(i);
|
||||
}
|
||||
@@ -626,9 +626,9 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
|
||||
{
|
||||
i_next = i;
|
||||
++i_next;
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(*i))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*i))
|
||||
{
|
||||
QuestItemMap::const_iterator pq = PlayerQuestItems.find(pl->GetGUIDLow());
|
||||
QuestItemMap::const_iterator pq = PlayerQuestItems.find(player->GetGUIDLow());
|
||||
if (pq != PlayerQuestItems.end() && pq->second)
|
||||
{
|
||||
// find where/if the player has the given item in it's vector
|
||||
@@ -640,7 +640,7 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
|
||||
break;
|
||||
|
||||
if (j < pql.size())
|
||||
pl->SendNotifyLootItemRemoved(items.size()+j);
|
||||
player->SendNotifyLootItemRemoved(items.size()+j);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -309,11 +309,11 @@ void Map::DeleteFromWorld(T* obj)
|
||||
}
|
||||
|
||||
template<>
|
||||
void Map::DeleteFromWorld(Player* pl)
|
||||
void Map::DeleteFromWorld(Player* player)
|
||||
{
|
||||
sObjectAccessor->RemoveObject(pl);
|
||||
sObjectAccessor->RemoveUpdateObject(pl); //TODO: I do not know why we need this, it should be removed in ~Object anyway
|
||||
delete pl;
|
||||
sObjectAccessor->RemoveObject(player);
|
||||
sObjectAccessor->RemoveUpdateObject(player); //TODO: I do not know why we need this, it should be removed in ~Object anyway
|
||||
delete player;
|
||||
}
|
||||
|
||||
//Create NGrid so the object can be added to it
|
||||
@@ -506,11 +506,11 @@ void Map::Update(const uint32 t_diff)
|
||||
/// update worldsessions for existing players
|
||||
for (m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter)
|
||||
{
|
||||
Player* plr = m_mapRefIter->getSource();
|
||||
if (plr && plr->IsInWorld())
|
||||
Player* player = m_mapRefIter->getSource();
|
||||
if (player && player->IsInWorld())
|
||||
{
|
||||
//plr->Update(t_diff);
|
||||
WorldSession* pSession = plr->GetSession();
|
||||
//player->Update(t_diff);
|
||||
WorldSession* pSession = player->GetSession();
|
||||
MapSessionFilter updater(pSession);
|
||||
pSession->Update(t_diff, updater);
|
||||
}
|
||||
@@ -528,15 +528,15 @@ void Map::Update(const uint32 t_diff)
|
||||
// to make sure calls to Map::Remove don't invalidate it
|
||||
for (m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter)
|
||||
{
|
||||
Player* plr = m_mapRefIter->getSource();
|
||||
Player* player = m_mapRefIter->getSource();
|
||||
|
||||
if (!plr || !plr->IsInWorld())
|
||||
if (!player || !player->IsInWorld())
|
||||
continue;
|
||||
|
||||
// update players at tick
|
||||
plr->Update(t_diff);
|
||||
player->Update(t_diff);
|
||||
|
||||
VisitNearbyCellsOf(plr, grid_object_update, world_object_update);
|
||||
VisitNearbyCellsOf(player, grid_object_update, world_object_update);
|
||||
}
|
||||
|
||||
// non-player active objects, increasing iterator in the loop in case of object removal
|
||||
@@ -1011,12 +1011,12 @@ void Map::RemoveAllPlayers()
|
||||
{
|
||||
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||
{
|
||||
Player* plr = itr->getSource();
|
||||
if (!plr->IsBeingTeleportedFar())
|
||||
Player* player = itr->getSource();
|
||||
if (!player->IsBeingTeleportedFar())
|
||||
{
|
||||
// this is happening for bg
|
||||
sLog->outError("Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", plr->GetName(), GetId());
|
||||
plr->TeleportTo(plr->m_homebindMapId, plr->m_homebindX, plr->m_homebindY, plr->m_homebindZ, plr->GetOrientation());
|
||||
sLog->outError("Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName(), GetId());
|
||||
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2109,9 +2109,9 @@ bool Map::ActiveObjectsNearGrid(NGridType const& ngrid) const
|
||||
|
||||
for (MapRefManager::const_iterator iter = m_mapRefManager.begin(); iter != m_mapRefManager.end(); ++iter)
|
||||
{
|
||||
Player* plr = iter->getSource();
|
||||
Player* player = iter->getSource();
|
||||
|
||||
CellCoord p = Trinity::ComputeCellCoord(plr->GetPositionX(), plr->GetPositionY());
|
||||
CellCoord p = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
|
||||
if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
|
||||
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
|
||||
return true;
|
||||
@@ -2502,20 +2502,20 @@ void InstanceMap::PermBindAllPlayers(Player* player)
|
||||
// group members outside the instance group don't get bound
|
||||
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||
{
|
||||
Player* plr = itr->getSource();
|
||||
Player* player = itr->getSource();
|
||||
// players inside an instance cannot be bound to other instances
|
||||
// some players may already be permanently bound, in this case nothing happens
|
||||
InstancePlayerBind* bind = plr->GetBoundInstance(save->GetMapId(), save->GetDifficulty());
|
||||
InstancePlayerBind* bind = player->GetBoundInstance(save->GetMapId(), save->GetDifficulty());
|
||||
if (!bind || !bind->perm)
|
||||
{
|
||||
plr->BindToInstance(save, true);
|
||||
player->BindToInstance(save, true);
|
||||
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
|
||||
data << uint32(0);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
// if the leader is not in the instance the group will not get a perm bind
|
||||
if (group && group->GetLeaderGUID() == plr->GetGUID())
|
||||
if (group && group->GetLeaderGUID() == player->GetGUID())
|
||||
group->BindToInstance(save, true);
|
||||
}
|
||||
}
|
||||
@@ -2649,9 +2649,9 @@ void BattlegroundMap::RemoveAllPlayers()
|
||||
{
|
||||
if (HavePlayers())
|
||||
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||
if (Player* plr = itr->getSource())
|
||||
if (!plr->IsBeingTeleportedFar())
|
||||
plr->TeleportTo(plr->GetBattlegroundEntryPoint());
|
||||
if (Player* player = itr->getSource())
|
||||
if (!player->IsBeingTeleportedFar())
|
||||
player->TeleportTo(player->GetBattlegroundEntryPoint());
|
||||
}
|
||||
|
||||
Creature*
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Trinity
|
||||
return baseGain;
|
||||
}
|
||||
|
||||
inline uint32 Gain(Player* pl, Unit* u)
|
||||
inline uint32 Gain(Player* player, Unit* u)
|
||||
{
|
||||
uint32 gain;
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Trinity
|
||||
gain = 0;
|
||||
else
|
||||
{
|
||||
gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
|
||||
gain = BaseGain(player->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
|
||||
|
||||
if (gain != 0 && u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite())
|
||||
{
|
||||
@@ -181,7 +181,7 @@ namespace Trinity
|
||||
gain = uint32(gain * sWorld->getRate(RATE_XP_KILL));
|
||||
}
|
||||
|
||||
sScriptMgr->OnGainCalculation(gain, pl, u);
|
||||
sScriptMgr->OnGainCalculation(gain, player, u);
|
||||
return gain;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,22 +36,22 @@ m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp)
|
||||
{
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::HandlePlayerEnter(Player* plr)
|
||||
bool OPvPCapturePoint::HandlePlayerEnter(Player* player)
|
||||
{
|
||||
if (m_capturePoint)
|
||||
{
|
||||
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
|
||||
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
|
||||
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
|
||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
|
||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
|
||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
|
||||
}
|
||||
return m_activePlayers[plr->GetTeamId()].insert(plr).second;
|
||||
return m_activePlayers[player->GetTeamId()].insert(player).second;
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::HandlePlayerLeave(Player* plr)
|
||||
void OPvPCapturePoint::HandlePlayerLeave(Player* player)
|
||||
{
|
||||
if (m_capturePoint)
|
||||
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
|
||||
m_activePlayers[plr->GetTeamId()].erase(plr);
|
||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
|
||||
m_activePlayers[player->GetTeamId()].erase(player);
|
||||
}
|
||||
|
||||
void OPvPCapturePoint::SendChangePhase()
|
||||
@@ -239,24 +239,24 @@ OutdoorPvP::~OutdoorPvP()
|
||||
DeleteSpawns();
|
||||
}
|
||||
|
||||
void OutdoorPvP::HandlePlayerEnterZone(Player* plr, uint32 /*zone*/)
|
||||
void OutdoorPvP::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
||||
{
|
||||
m_players[plr->GetTeamId()].insert(plr);
|
||||
m_players[player->GetTeamId()].insert(player);
|
||||
}
|
||||
|
||||
void OutdoorPvP::HandlePlayerLeaveZone(Player* plr, uint32 /*zone*/)
|
||||
void OutdoorPvP::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
|
||||
{
|
||||
// inform the objectives of the leaving
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
itr->second->HandlePlayerLeave(plr);
|
||||
itr->second->HandlePlayerLeave(player);
|
||||
// remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones)
|
||||
if (!plr->GetSession()->PlayerLogout())
|
||||
SendRemoveWorldStates(plr);
|
||||
m_players[plr->GetTeamId()].erase(plr);
|
||||
sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", plr->GetName());
|
||||
if (!player->GetSession()->PlayerLogout())
|
||||
SendRemoveWorldStates(player);
|
||||
m_players[player->GetTeamId()].erase(player);
|
||||
sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", player->GetName());
|
||||
}
|
||||
|
||||
void OutdoorPvP::HandlePlayerResurrects(Player* /*plr*/, uint32 /*zone*/)
|
||||
void OutdoorPvP::HandlePlayerResurrects(Player* /*player*/, uint32 /*zone*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -463,88 +463,88 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed)
|
||||
}
|
||||
}
|
||||
|
||||
bool OutdoorPvP::IsInsideObjective(Player* plr) const
|
||||
bool OutdoorPvP::IsInsideObjective(Player* player) const
|
||||
{
|
||||
for (OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->IsInsideObjective(plr))
|
||||
if (itr->second->IsInsideObjective(player))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::IsInsideObjective(Player* plr) const
|
||||
bool OPvPCapturePoint::IsInsideObjective(Player* player) const
|
||||
{
|
||||
return m_activePlayers[plr->GetTeamId()].find(plr) != m_activePlayers[plr->GetTeamId()].end();
|
||||
return m_activePlayers[player->GetTeamId()].find(player) != m_activePlayers[player->GetTeamId()].end();
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go)
|
||||
bool OutdoorPvP::HandleCustomSpell(Player* player, uint32 spellId, GameObject* go)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->HandleCustomSpell(plr, spellId, go))
|
||||
if (itr->second->HandleCustomSpell(player, spellId, go))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::HandleCustomSpell(Player* plr, uint32 /*spellId*/, GameObject* /*go*/)
|
||||
bool OPvPCapturePoint::HandleCustomSpell(Player* player, uint32 /*spellId*/, GameObject* /*go*/)
|
||||
{
|
||||
if (!plr->IsOutdoorPvPActive())
|
||||
if (!player->IsOutdoorPvPActive())
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleOpenGo(Player* plr, uint64 guid)
|
||||
bool OutdoorPvP::HandleOpenGo(Player* player, uint64 guid)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->HandleOpenGo(plr, guid) >= 0)
|
||||
if (itr->second->HandleOpenGo(player, guid) >= 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleGossipOption(Player* plr, uint64 guid, uint32 id)
|
||||
bool OutdoorPvP::HandleGossipOption(Player* player, uint64 guid, uint32 id)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->HandleGossipOption(plr, guid, id))
|
||||
if (itr->second->HandleGossipOption(player, guid, id))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OutdoorPvP::CanTalkTo(Player* plr, Creature* c, GossipMenuItems const& gso)
|
||||
bool OutdoorPvP::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->CanTalkTo(plr, c, gso))
|
||||
if (itr->second->CanTalkTo(player, c, gso))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleDropFlag(Player* plr, uint32 id)
|
||||
bool OutdoorPvP::HandleDropFlag(Player* player, uint32 id)
|
||||
{
|
||||
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
if (itr->second->HandleDropFlag(plr, id))
|
||||
if (itr->second->HandleDropFlag(player, id))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::HandleGossipOption(Player* /*plr*/, uint64 /*guid*/, uint32 /*id*/)
|
||||
bool OPvPCapturePoint::HandleGossipOption(Player* /*player*/, uint64 /*guid*/, uint32 /*id*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::CanTalkTo(Player* /*plr*/, Creature* /*c*/, GossipMenuItems const& /*gso*/)
|
||||
bool OPvPCapturePoint::CanTalkTo(Player* /*player*/, Creature* /*c*/, GossipMenuItems const& /*gso*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OPvPCapturePoint::HandleDropFlag(Player* /*plr*/, uint32 /*id*/)
|
||||
bool OPvPCapturePoint::HandleDropFlag(Player* /*player*/, uint32 /*id*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 OPvPCapturePoint::HandleOpenGo(Player* /*plr*/, uint64 guid)
|
||||
int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, uint64 guid)
|
||||
{
|
||||
std::map<uint64, uint32>::iterator itr = m_ObjectTypes.find(guid);
|
||||
if (itr != m_ObjectTypes.end())
|
||||
@@ -554,7 +554,7 @@ int32 OPvPCapturePoint::HandleOpenGo(Player* /*plr*/, uint64 guid)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HandleAreaTrigger(Player* /*plr*/, uint32 /*trigger*/)
|
||||
bool OutdoorPvP::HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -572,9 +572,9 @@ void OutdoorPvP::RegisterZone(uint32 zoneId)
|
||||
sOutdoorPvPMgr->AddZone(zoneId, this);
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HasPlayer(Player* plr) const
|
||||
bool OutdoorPvP::HasPlayer(Player* player) const
|
||||
{
|
||||
return m_players[plr->GetTeamId()].find(plr) != m_players[plr->GetTeamId()].end();
|
||||
return m_players[player->GetTeamId()].find(player) != m_players[player->GetTeamId()].end();
|
||||
}
|
||||
|
||||
void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId)
|
||||
|
||||
@@ -104,15 +104,15 @@ class OPvPCapturePoint
|
||||
void SendObjectiveComplete(uint32 id, uint64 guid);
|
||||
|
||||
// used when player is activated/inactivated in the area
|
||||
virtual bool HandlePlayerEnter(Player* plr);
|
||||
virtual void HandlePlayerLeave(Player* plr);
|
||||
virtual bool HandlePlayerEnter(Player* player);
|
||||
virtual void HandlePlayerLeave(Player* player);
|
||||
|
||||
// checks if player is in range of a capture credit marker
|
||||
bool IsInsideObjective(Player* plr) const;
|
||||
bool IsInsideObjective(Player* player) const;
|
||||
|
||||
virtual bool HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go);
|
||||
virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
|
||||
|
||||
virtual int32 HandleOpenGo(Player* plr, uint64 guid);
|
||||
virtual int32 HandleOpenGo(Player* player, uint64 guid);
|
||||
|
||||
// returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
|
||||
virtual bool Update(uint32 diff);
|
||||
@@ -123,11 +123,11 @@ class OPvPCapturePoint
|
||||
|
||||
virtual void SendChangePhase();
|
||||
|
||||
virtual bool HandleGossipOption(Player* plr, uint64 guid, uint32 gossipid);
|
||||
virtual bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
|
||||
|
||||
virtual bool CanTalkTo(Player* plr, Creature* c, GossipMenuItems const& gso);
|
||||
virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso);
|
||||
|
||||
virtual bool HandleDropFlag(Player* plr, uint32 spellId);
|
||||
virtual bool HandleDropFlag(Player* player, uint32 spellId);
|
||||
|
||||
virtual void DeleteSpawns();
|
||||
|
||||
@@ -208,13 +208,13 @@ class OutdoorPvP : public ZoneScript
|
||||
virtual void FillInitialWorldStates(WorldPacket & /*data*/) {}
|
||||
|
||||
// called when a player triggers an areatrigger
|
||||
virtual bool HandleAreaTrigger(Player* plr, uint32 trigger);
|
||||
virtual bool HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
|
||||
// called on custom spell
|
||||
virtual bool HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go);
|
||||
virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
|
||||
|
||||
// called on go use
|
||||
virtual bool HandleOpenGo(Player* plr, uint64 guid);
|
||||
virtual bool HandleOpenGo(Player* player, uint64 guid);
|
||||
|
||||
// setup stuff
|
||||
virtual bool SetupOutdoorPvP() {return true;}
|
||||
@@ -234,18 +234,18 @@ class OutdoorPvP : public ZoneScript
|
||||
virtual void HandleKillImpl(Player* /*killer*/, Unit* /*killed*/) {}
|
||||
|
||||
// checks if player is in range of a capture credit marker
|
||||
bool IsInsideObjective(Player* plr) const;
|
||||
bool IsInsideObjective(Player* player) const;
|
||||
|
||||
// awards rewards for player kill
|
||||
virtual void AwardKillBonus(Player* /*plr*/) {}
|
||||
virtual void AwardKillBonus(Player* /*player*/) {}
|
||||
|
||||
uint32 GetTypeId() {return m_TypeId;}
|
||||
|
||||
virtual bool HandleDropFlag(Player* plr, uint32 spellId);
|
||||
virtual bool HandleDropFlag(Player* player, uint32 spellId);
|
||||
|
||||
virtual bool HandleGossipOption(Player* plr, uint64 guid, uint32 gossipid);
|
||||
virtual bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
|
||||
|
||||
virtual bool CanTalkTo(Player* plr, Creature* c, GossipMenuItems const& gso);
|
||||
virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso);
|
||||
|
||||
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
||||
|
||||
@@ -261,14 +261,14 @@ class OutdoorPvP : public ZoneScript
|
||||
bool m_sendUpdate;
|
||||
|
||||
// world state stuff
|
||||
virtual void SendRemoveWorldStates(Player* /*plr*/) {}
|
||||
virtual void SendRemoveWorldStates(Player* /*player*/) {}
|
||||
|
||||
void BroadcastPacket(WorldPacket & data) const;
|
||||
|
||||
virtual void HandlePlayerEnterZone(Player* plr, uint32 zone);
|
||||
virtual void HandlePlayerLeaveZone(Player* plr, uint32 zone);
|
||||
virtual void HandlePlayerEnterZone(Player* player, uint32 zone);
|
||||
virtual void HandlePlayerLeaveZone(Player* player, uint32 zone);
|
||||
|
||||
virtual void HandlePlayerResurrects(Player* plr, uint32 zone);
|
||||
virtual void HandlePlayerResurrects(Player* player, uint32 zone);
|
||||
|
||||
void AddCapturePoint(OPvPCapturePoint* cp)
|
||||
{
|
||||
@@ -285,7 +285,7 @@ class OutdoorPvP : public ZoneScript
|
||||
|
||||
void RegisterZone(uint32 zoneid);
|
||||
|
||||
bool HasPlayer(Player* plr) const;
|
||||
bool HasPlayer(Player* player) const;
|
||||
|
||||
void TeamCastSpell(TeamId team, int32 spellId);
|
||||
};
|
||||
|
||||
@@ -115,31 +115,31 @@ void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle)
|
||||
m_OutdoorPvPMap[zoneid] = handle;
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandlePlayerEnterZone(Player* plr, uint32 zoneid)
|
||||
void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
|
||||
if (itr == m_OutdoorPvPMap.end())
|
||||
return;
|
||||
|
||||
if (itr->second->HasPlayer(plr))
|
||||
if (itr->second->HasPlayer(player))
|
||||
return;
|
||||
|
||||
itr->second->HandlePlayerEnterZone(plr, zoneid);
|
||||
sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u entered outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId());
|
||||
itr->second->HandlePlayerEnterZone(player, zoneid);
|
||||
sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* plr, uint32 zoneid)
|
||||
void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
|
||||
if (itr == m_OutdoorPvPMap.end())
|
||||
return;
|
||||
|
||||
// teleport: remove once in removefromworld, once in updatezone
|
||||
if (!itr->second->HasPlayer(plr))
|
||||
if (!itr->second->HasPlayer(player))
|
||||
return;
|
||||
|
||||
itr->second->HandlePlayerLeaveZone(plr, zoneid);
|
||||
sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u left outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId());
|
||||
itr->second->HandlePlayerLeaveZone(player, zoneid);
|
||||
sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
|
||||
}
|
||||
|
||||
OutdoorPvP* OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid)
|
||||
@@ -164,11 +164,11 @@ void OutdoorPvPMgr::Update(uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
bool OutdoorPvPMgr::HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go)
|
||||
bool OutdoorPvPMgr::HandleCustomSpell(Player* player, uint32 spellId, GameObject* go)
|
||||
{
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->HandleCustomSpell(plr, spellId, go))
|
||||
if ((*itr)->HandleCustomSpell(player, spellId, go))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -183,21 +183,21 @@ ZoneScript* OutdoorPvPMgr::GetZoneScript(uint32 zoneId)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool OutdoorPvPMgr::HandleOpenGo(Player* plr, uint64 guid)
|
||||
bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid)
|
||||
{
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->HandleOpenGo(plr, guid))
|
||||
if ((*itr)->HandleOpenGo(player, guid))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandleGossipOption(Player* plr, uint64 guid, uint32 gossipid)
|
||||
void OutdoorPvPMgr::HandleGossipOption(Player* player, uint64 guid, uint32 gossipid)
|
||||
{
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->HandleGossipOption(plr, guid, gossipid))
|
||||
if ((*itr)->HandleGossipOption(player, guid, gossipid))
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -212,21 +212,21 @@ bool OutdoorPvPMgr::CanTalkTo(Player* player, Creature* creature, GossipMenuItem
|
||||
return false;
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandleDropFlag(Player* plr, uint32 spellId)
|
||||
void OutdoorPvPMgr::HandleDropFlag(Player* player, uint32 spellId)
|
||||
{
|
||||
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->HandleDropFlag(plr, spellId))
|
||||
if ((*itr)->HandleDropFlag(player, spellId))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandlePlayerResurrects(Player* plr, uint32 zoneid)
|
||||
void OutdoorPvPMgr::HandlePlayerResurrects(Player* player, uint32 zoneid)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
|
||||
if (itr == m_OutdoorPvPMap.end())
|
||||
return;
|
||||
|
||||
if (itr->second->HasPlayer(plr))
|
||||
itr->second->HandlePlayerResurrects(plr, zoneid);
|
||||
if (itr->second->HasPlayer(player))
|
||||
itr->second->HandlePlayerResurrects(player, zoneid);
|
||||
}
|
||||
|
||||
@@ -49,22 +49,22 @@ class OutdoorPvPMgr
|
||||
void InitOutdoorPvP();
|
||||
|
||||
// called when a player enters an outdoor pvp area
|
||||
void HandlePlayerEnterZone(Player* plr, uint32 areaflag);
|
||||
void HandlePlayerEnterZone(Player* player, uint32 areaflag);
|
||||
|
||||
// called when player leaves an outdoor pvp area
|
||||
void HandlePlayerLeaveZone(Player* plr, uint32 areaflag);
|
||||
void HandlePlayerLeaveZone(Player* player, uint32 areaflag);
|
||||
|
||||
// called when player resurrects
|
||||
void HandlePlayerResurrects(Player* plr, uint32 areaflag);
|
||||
void HandlePlayerResurrects(Player* player, uint32 areaflag);
|
||||
|
||||
// return assigned outdoor pvp
|
||||
OutdoorPvP* GetOutdoorPvPToZoneId(uint32 zoneid);
|
||||
|
||||
// handle custom (non-exist in dbc) spell if registered
|
||||
bool HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go);
|
||||
bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
|
||||
|
||||
// handle custom go if registered
|
||||
bool HandleOpenGo(Player* plr, uint64 guid);
|
||||
bool HandleOpenGo(Player* player, uint64 guid);
|
||||
|
||||
ZoneScript* GetZoneScript(uint32 zoneId);
|
||||
|
||||
@@ -76,7 +76,7 @@ class OutdoorPvPMgr
|
||||
|
||||
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso);
|
||||
|
||||
void HandleDropFlag(Player* plr, uint32 spellId);
|
||||
void HandleDropFlag(Player* player, uint32 spellId);
|
||||
|
||||
private:
|
||||
typedef std::vector<OutdoorPvP*> OutdoorPvPSet;
|
||||
|
||||
@@ -125,7 +125,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
recv_data >> buyout;
|
||||
recv_data >> etime;
|
||||
|
||||
Player* pl = GetPlayer();
|
||||
Player* player = GetPlayer();
|
||||
|
||||
if (!item || !bid || !etime)
|
||||
return; //check for cheaters
|
||||
@@ -162,11 +162,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
Item* it = pl->GetItemByGuid(item);
|
||||
Item* it = player->GetItemByGuid(item);
|
||||
//do not allow to sell already auctioned items
|
||||
if (sAuctionMgr->GetAItem(GUID_LOPART(item)))
|
||||
{
|
||||
sLog->outError("AuctionError, player %s is sending item id: %u, but item is already in another auction", pl->GetName(), GUID_LOPART(item));
|
||||
sLog->outError("AuctionError, player %s is sending item id: %u, but item is already in another auction", player->GetName(), GUID_LOPART(item));
|
||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
|
||||
//we have to take deposit :
|
||||
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, it, count);
|
||||
if (!pl->HasEnoughMoney(deposit))
|
||||
if (!player->HasEnoughMoney(deposit))
|
||||
{
|
||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
|
||||
return;
|
||||
@@ -211,7 +211,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), count);
|
||||
}
|
||||
|
||||
pl->ModifyMoney(-int32(deposit));
|
||||
player->ModifyMoney(-int32(deposit));
|
||||
|
||||
uint32 auction_time = uint32(etime * sWorld->getRate(RATE_AUCTION_TIME));
|
||||
|
||||
@@ -223,7 +223,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
AH->auctioneer = GUID_LOPART(auctioneer);
|
||||
AH->item_guidlow = GUID_LOPART(item);
|
||||
AH->item_template = it->GetEntry();
|
||||
AH->owner = pl->GetGUIDLow();
|
||||
AH->owner = player->GetGUIDLow();
|
||||
AH->startbid = bid;
|
||||
AH->bidder = 0;
|
||||
AH->bid = 0;
|
||||
@@ -236,13 +236,13 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
sAuctionMgr->AddAItem(it);
|
||||
auctionHouse->AddAuction(AH);
|
||||
|
||||
pl->MoveItemFromInventory(it->GetBagSlot(), it->GetSlot(), true);
|
||||
player->MoveItemFromInventory(it->GetBagSlot(), it->GetSlot(), true);
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
it->DeleteFromInventoryDB(trans);
|
||||
it->SaveToDB(trans); // recursive and not have transaction guard into self, not in inventiory and can be save standalone
|
||||
AH->SaveToDB(trans);
|
||||
pl->SaveInventoryAndGoldToDB(trans);
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
|
||||
@@ -276,9 +276,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||
Player* pl = GetPlayer();
|
||||
Player* player = GetPlayer();
|
||||
|
||||
if (!auction || auction->owner == pl->GetGUIDLow())
|
||||
if (!auction || auction->owner == player->GetGUIDLow())
|
||||
{
|
||||
//you cannot bid your own auction:
|
||||
SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
|
||||
@@ -287,7 +287,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||
|
||||
// impossible have online own another character (use this for speedup check in case online owner)
|
||||
Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
|
||||
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId())
|
||||
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == player->GetSession()->GetAccountId())
|
||||
{
|
||||
//you cannot bid your another character auction:
|
||||
SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
|
||||
@@ -306,7 +306,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pl->HasEnoughMoney(price))
|
||||
if (!player->HasEnoughMoney(price))
|
||||
{
|
||||
//you don't have enought money!, client tests!
|
||||
//SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
|
||||
@@ -319,19 +319,19 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||
{
|
||||
if (auction->bidder > 0)
|
||||
{
|
||||
if (auction->bidder == pl->GetGUIDLow())
|
||||
pl->ModifyMoney(-int32(price - auction->bid));
|
||||
if (auction->bidder == player->GetGUIDLow())
|
||||
player->ModifyMoney(-int32(price - auction->bid));
|
||||
else
|
||||
{
|
||||
// mail to last bidder and return money
|
||||
sAuctionMgr->SendAuctionOutbiddedMail(auction, price, GetPlayer(), trans);
|
||||
pl->ModifyMoney(-int32(price));
|
||||
player->ModifyMoney(-int32(price));
|
||||
}
|
||||
}
|
||||
else
|
||||
pl->ModifyMoney(-int32(price));
|
||||
player->ModifyMoney(-int32(price));
|
||||
|
||||
auction->bidder = pl->GetGUIDLow();
|
||||
auction->bidder = player->GetGUIDLow();
|
||||
auction->bid = price;
|
||||
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
|
||||
|
||||
@@ -342,15 +342,15 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||
else
|
||||
{
|
||||
//buyout:
|
||||
if (pl->GetGUIDLow() == auction->bidder)
|
||||
pl->ModifyMoney(-int32(auction->buyout - auction->bid));
|
||||
if (player->GetGUIDLow() == auction->bidder)
|
||||
player->ModifyMoney(-int32(auction->buyout - auction->bid));
|
||||
else
|
||||
{
|
||||
pl->ModifyMoney(-int32(auction->buyout));
|
||||
player->ModifyMoney(-int32(auction->buyout));
|
||||
if (auction->bidder) //buyout for bidded auction ..
|
||||
sAuctionMgr->SendAuctionOutbiddedMail(auction, auction->buyout, GetPlayer(), trans);
|
||||
}
|
||||
auction->bidder = pl->GetGUIDLow();
|
||||
auction->bidder = player->GetGUIDLow();
|
||||
auction->bid = auction->buyout;
|
||||
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
|
||||
|
||||
@@ -367,7 +367,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||
sAuctionMgr->RemoveAItem(auction->item_guidlow);
|
||||
auctionHouse->RemoveAuction(auction, item_template);
|
||||
}
|
||||
pl->SaveInventoryAndGoldToDB(trans);
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
@@ -394,10 +394,10 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||
Player* pl = GetPlayer();
|
||||
Player* player = GetPlayer();
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
if (auction && auction->owner == pl->GetGUIDLow())
|
||||
if (auction && auction->owner == player->GetGUIDLow())
|
||||
{
|
||||
Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
|
||||
if (pItem)
|
||||
@@ -405,11 +405,11 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
|
||||
{
|
||||
uint32 auctionCut = auction->GetAuctionCut();
|
||||
if (!pl->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
||||
if (!player->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
||||
return;
|
||||
//some auctionBidderNotification would be needed, but don't know that parts..
|
||||
sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans);
|
||||
pl->ModifyMoney(-int32(auctionCut));
|
||||
player->ModifyMoney(-int32(auctionCut));
|
||||
}
|
||||
// Return the item by mail
|
||||
std::ostringstream msgAuctionCanceledOwner;
|
||||
@@ -418,7 +418,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||
// item will deleted or added to received mail list
|
||||
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, pl, auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -431,7 +431,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||
{
|
||||
SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
|
||||
//this code isn't possible ... maybe there should be assert
|
||||
sLog->outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", pl->GetGUIDLow(), auctionId);
|
||||
sLog->outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||
|
||||
// Now remove the auction
|
||||
|
||||
pl->SaveInventoryAndGoldToDB(trans);
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
auction->DeleteFromDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
@@ -479,7 +479,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
|
||||
Player* pl = GetPlayer();
|
||||
Player* player = GetPlayer();
|
||||
data << (uint32) 0; //add 0 as count
|
||||
uint32 count = 0;
|
||||
uint32 totalcount = 0;
|
||||
@@ -496,7 +496,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
auctionHouse->BuildListBidderItems(data, pl, count, totalcount);
|
||||
auctionHouse->BuildListBidderItems(data, player, count, totalcount);
|
||||
data.put<uint32>(0, count); // add count to placeholder
|
||||
data << totalcount;
|
||||
data << (uint32)300; //unk 2.3.0
|
||||
|
||||
@@ -495,8 +495,8 @@ namespace Trinity
|
||||
class EmoteChatBuilder
|
||||
{
|
||||
public:
|
||||
EmoteChatBuilder(Player const& pl, uint32 text_emote, uint32 emote_num, Unit const* target)
|
||||
: i_player(pl), i_text_emote(text_emote), i_emote_num(emote_num), i_target(target) {}
|
||||
EmoteChatBuilder(Player const& player, uint32 text_emote, uint32 emote_num, Unit const* target)
|
||||
: i_player(player), i_text_emote(text_emote), i_emote_num(emote_num), i_target(target) {}
|
||||
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
uint64 guid;
|
||||
Player* pl;
|
||||
Player* player;
|
||||
Player* plTarget;
|
||||
|
||||
recvPacket >> guid;
|
||||
@@ -35,21 +35,21 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||
if (!GetPlayer()->duel) // ignore accept from duel-sender
|
||||
return;
|
||||
|
||||
pl = GetPlayer();
|
||||
plTarget = pl->duel->opponent;
|
||||
player = GetPlayer();
|
||||
plTarget = player->duel->opponent;
|
||||
|
||||
if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
|
||||
if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0)
|
||||
return;
|
||||
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED");
|
||||
sLog->outStaticDebug("Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName());
|
||||
sLog->outStaticDebug("Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName());
|
||||
sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName());
|
||||
|
||||
time_t now = time(NULL);
|
||||
pl->duel->startTimer = now;
|
||||
player->duel->startTimer = now;
|
||||
plTarget->duel->startTimer = now;
|
||||
|
||||
pl->SendDuelCountdown(3000);
|
||||
player->SendDuelCountdown(3000);
|
||||
plTarget->SendDuelCountdown(3000);
|
||||
}
|
||||
|
||||
|
||||
@@ -306,9 +306,9 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Player* plr = grp->GetInvited(guid))
|
||||
if (Player* player = grp->GetInvited(guid))
|
||||
{
|
||||
plr->UninviteFromGroup();
|
||||
player->UninviteFromGroup();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -350,9 +350,9 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Player* plr = grp->GetInvited(membername))
|
||||
if (Player* player = grp->GetInvited(membername))
|
||||
{
|
||||
plr->UninviteFromGroup();
|
||||
player->UninviteFromGroup();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -419,8 +419,8 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
Player* plr = ObjectAccessor::FindPlayer(guid);
|
||||
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
data << uint8(player ? player->getLevel() : 0); // Level
|
||||
|
||||
for (LfgRolesMap::const_iterator it = pRoleCheck->roles.begin(); it != pRoleCheck->roles.end(); ++it)
|
||||
{
|
||||
@@ -432,8 +432,8 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
plr = ObjectAccessor::FindPlayer(guid);
|
||||
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||
player = ObjectAccessor::FindPlayer(guid);
|
||||
data << uint8(player ? player->getLevel() : 0); // Level
|
||||
}
|
||||
}
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -75,9 +75,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
if (receiver.empty())
|
||||
return;
|
||||
|
||||
Player* pl = _player;
|
||||
Player* player = _player;
|
||||
|
||||
if (pl->getLevel() < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
|
||||
if (player->getLevel() < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_MAIL_SENDER_REQ), sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ));
|
||||
return;
|
||||
@@ -90,16 +90,16 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
if (!rc)
|
||||
{
|
||||
sLog->outDetail("Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
|
||||
pl->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
|
||||
player->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
sLog->outDetail("Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", pl->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
sLog->outDetail("Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
|
||||
if (pl->GetGUID() == rc)
|
||||
if (player->GetGUID() == rc)
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANNOT_SEND_TO_SELF);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANNOT_SEND_TO_SELF);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,9 +107,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
|
||||
uint32 reqmoney = cost + money;
|
||||
|
||||
if (!pl->HasEnoughMoney(reqmoney))
|
||||
if (!player->HasEnoughMoney(reqmoney))
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -142,14 +142,14 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
//do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
|
||||
if (mails_count > 100)
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED);
|
||||
return;
|
||||
}
|
||||
// test the receiver's Faction... or all items are account bound
|
||||
bool accountBound = items_count ? true : false;
|
||||
for (uint8 i = 0; i < items_count; ++i)
|
||||
{
|
||||
Item* item = pl->GetItemByGuid(itemGUIDs[i]);
|
||||
Item* item = player->GetItemByGuid(itemGUIDs[i]);
|
||||
if (item)
|
||||
{
|
||||
ItemTemplate const* itemProto = item->GetTemplate();
|
||||
@@ -161,9 +161,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeam() != rc_team && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -183,56 +183,56 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
{
|
||||
if (!itemGUIDs[i])
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
Item* item = pl->GetItemByGuid(itemGUIDs[i]);
|
||||
Item* item = player->GetItemByGuid(itemGUIDs[i]);
|
||||
|
||||
// prevent sending bag with items (cheat: can be placed in bag after adding equipped empty bag to mail)
|
||||
if (!item)
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item->CanBeTraded(true))
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->IsBoundAccountWide() && item->IsSoulBound() && pl->GetSession()->GetAccountId() != rc_account)
|
||||
if (item->IsBoundAccountWide() && item->IsSoulBound() && player->GetSession()->GetAccountId() != rc_account)
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_ARTEFACTS_ONLY_FOR_OWN_CHARACTERS);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_ARTEFACTS_ONLY_FOR_OWN_CHARACTERS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION))
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (COD && item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANT_SEND_WRAPPED_COD);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANT_SEND_WRAPPED_COD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->IsNotEmptyBag())
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS);
|
||||
return;
|
||||
}
|
||||
|
||||
items[i] = item;
|
||||
}
|
||||
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_OK);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_OK);
|
||||
|
||||
pl->ModifyMoney(-int32(reqmoney));
|
||||
pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost);
|
||||
player->ModifyMoney(-int32(reqmoney));
|
||||
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost);
|
||||
|
||||
bool needItemDelay = false;
|
||||
|
||||
@@ -254,7 +254,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
}
|
||||
|
||||
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
|
||||
pl->MoveItemFromInventory(items[i]->GetBagSlot(), item->GetSlot(), true);
|
||||
player->MoveItemFromInventory(items[i]->GetBagSlot(), item->GetSlot(), true);
|
||||
|
||||
item->DeleteFromInventoryDB(trans); // deletes item from character's inventory
|
||||
item->SetOwnerGUID(rc);
|
||||
@@ -264,7 +264,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
}
|
||||
|
||||
// if item send to character at another account, then apply item delivery delay
|
||||
needItemDelay = pl->GetSession()->GetAccountId() != rc_account;
|
||||
needItemDelay = player->GetSession()->GetAccountId() != rc_account;
|
||||
}
|
||||
|
||||
if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
@@ -281,9 +281,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
draft
|
||||
.AddMoney(money)
|
||||
.AddCOD(COD)
|
||||
.SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(pl), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
.SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
|
||||
pl->SaveInventoryAndGoldToDB(trans);
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
@@ -298,14 +298,14 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data)
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||
return;
|
||||
|
||||
Player* pl = _player;
|
||||
Mail* m = pl->GetMail(mailId);
|
||||
Player* player = _player;
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (m)
|
||||
{
|
||||
if (pl->unReadMails)
|
||||
--pl->unReadMails;
|
||||
if (player->unReadMails)
|
||||
--player->unReadMails;
|
||||
m->checked = m->checked | MAIL_CHECK_MASK_READ;
|
||||
pl->m_mailsUpdated = true;
|
||||
player->m_mailsUpdated = true;
|
||||
m->state = MAIL_STATE_CHANGED;
|
||||
}
|
||||
}
|
||||
@@ -323,20 +323,20 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data)
|
||||
return;
|
||||
|
||||
Mail* m = _player->GetMail(mailId);
|
||||
Player* pl = _player;
|
||||
pl->m_mailsUpdated = true;
|
||||
Player* player = _player;
|
||||
player->m_mailsUpdated = true;
|
||||
if (m)
|
||||
{
|
||||
// delete shouldn't show up for COD mails
|
||||
if (m->COD)
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_DELETED, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(mailId, MAIL_DELETED, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
m->state = MAIL_STATE_DELETED;
|
||||
}
|
||||
pl->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
|
||||
player->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
||||
@@ -350,11 +350,11 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||
return;
|
||||
|
||||
Player* pl = _player;
|
||||
Mail* m = pl->GetMail(mailId);
|
||||
Player* player = _player;
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
//we can return mail now
|
||||
@@ -362,7 +362,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
trans->PAppend("DELETE FROM mail WHERE id = '%u'", mailId); // needed?
|
||||
trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", mailId);
|
||||
pl->RemoveMail(mailId);
|
||||
player->RemoveMail(mailId);
|
||||
|
||||
// only return mail if the player exists (and delete if not existing)
|
||||
if (m->messageType == MAIL_NORMAL && m->sender)
|
||||
@@ -375,7 +375,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
||||
{
|
||||
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
||||
{
|
||||
Item* item = pl->GetMItem(itr2->item_guid);
|
||||
Item* item = player->GetMItem(itr2->item_guid);
|
||||
if (item)
|
||||
draft.AddItem(item);
|
||||
else
|
||||
@@ -383,7 +383,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
||||
//WTF?
|
||||
}
|
||||
|
||||
pl->RemoveMItem(itr2->item_guid);
|
||||
player->RemoveMItem(itr2->item_guid);
|
||||
}
|
||||
}
|
||||
draft.AddMoney(m->money).SendReturnToSender(GetAccountId(), m->receiver, m->sender, trans);
|
||||
@@ -392,7 +392,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
delete m; //we can deallocate old mail
|
||||
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK);
|
||||
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK);
|
||||
}
|
||||
|
||||
//called when player takes item attached in mail
|
||||
@@ -408,23 +408,23 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||
return;
|
||||
|
||||
Player* pl = _player;
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = pl->GetMail(mailId);
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent cheating with skip client money check
|
||||
if (!pl->HasEnoughMoney(m->COD))
|
||||
if (!player->HasEnoughMoney(m->COD))
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
}
|
||||
|
||||
Item* it = pl->GetMItem(itemId);
|
||||
Item* it = player->GetMItem(itemId);
|
||||
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, it, false);
|
||||
@@ -471,24 +471,24 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
|
||||
.SendMailTo(trans, MailReceiver(receive, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
|
||||
}
|
||||
|
||||
pl->ModifyMoney(-int32(m->COD));
|
||||
player->ModifyMoney(-int32(m->COD));
|
||||
}
|
||||
m->COD = 0;
|
||||
m->state = MAIL_STATE_CHANGED;
|
||||
pl->m_mailsUpdated = true;
|
||||
pl->RemoveMItem(it->GetGUIDLow());
|
||||
player->m_mailsUpdated = true;
|
||||
player->RemoveMItem(it->GetGUIDLow());
|
||||
|
||||
uint32 count = it->GetCount(); // save counts before store and possible merge with deleting
|
||||
pl->MoveItemToInventory(dest, it, true);
|
||||
player->MoveItemToInventory(dest, it, true);
|
||||
|
||||
pl->SaveInventoryAndGoldToDB(trans);
|
||||
pl->_SaveMail(trans);
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
player->_SaveMail(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_OK, 0, itemId, count);
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_OK, 0, itemId, count);
|
||||
}
|
||||
else
|
||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data)
|
||||
@@ -501,26 +501,26 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data)
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||
return;
|
||||
|
||||
Player* pl = _player;
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = pl->GetMail(mailId);
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
pl->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
|
||||
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
|
||||
|
||||
pl->ModifyMoney(m->money);
|
||||
player->ModifyMoney(m->money);
|
||||
m->money = 0;
|
||||
m->state = MAIL_STATE_CHANGED;
|
||||
pl->m_mailsUpdated = true;
|
||||
player->m_mailsUpdated = true;
|
||||
|
||||
// save money and mail to prevent cheating
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
pl->SaveGoldToDB(trans);
|
||||
pl->_SaveMail(trans);
|
||||
player->SaveGoldToDB(trans);
|
||||
player->_SaveMail(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
@@ -533,11 +533,11 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||
return;
|
||||
|
||||
Player* pl = _player;
|
||||
Player* player = _player;
|
||||
|
||||
//load players mails, and mailed items
|
||||
if (!pl->m_mailsLoaded)
|
||||
pl ->_LoadMail();
|
||||
if (!player->m_mailsLoaded)
|
||||
player ->_LoadMail();
|
||||
|
||||
// client can't work with packets > max int16 value
|
||||
const uint32 maxPacketSize = 32767;
|
||||
@@ -550,7 +550,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
|
||||
data << uint8(0); // mail's count
|
||||
time_t cur_time = time(NULL);
|
||||
|
||||
for (PlayerMails::iterator itr = pl->GetMailBegin(); itr != pl->GetMailEnd(); ++itr)
|
||||
for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr)
|
||||
{
|
||||
// packet send mail count as uint8, prevent overflow
|
||||
if (mailsCount >= 254)
|
||||
@@ -605,7 +605,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
|
||||
|
||||
for (uint8 i = 0; i < item_count; ++i)
|
||||
{
|
||||
Item* item = pl->GetMItem((*itr)->items[i].item_guid);
|
||||
Item* item = player->GetMItem((*itr)->items[i].item_guid);
|
||||
// item index (0-6?)
|
||||
data << uint8(i);
|
||||
// item guid low?
|
||||
@@ -658,17 +658,17 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||
return;
|
||||
|
||||
Player* pl = _player;
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = pl->GetMail(mailId);
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
Item* bodyItem = new Item; // This is not bag and then can be used new Item.
|
||||
if (!bodyItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, pl))
|
||||
if (!bodyItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, player))
|
||||
{
|
||||
delete bodyItem;
|
||||
return;
|
||||
@@ -680,7 +680,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
|
||||
MailTemplateEntry const* mailTemplateEntry = sMailTemplateStore.LookupEntry(m->mailTemplateId);
|
||||
if (!mailTemplateEntry)
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -700,14 +700,14 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
|
||||
{
|
||||
m->checked = m->checked | MAIL_CHECK_MASK_COPIED;
|
||||
m->state = MAIL_STATE_CHANGED;
|
||||
pl->m_mailsUpdated = true;
|
||||
player->m_mailsUpdated = true;
|
||||
|
||||
pl->StoreItem(dest, bodyItem, true);
|
||||
pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_OK);
|
||||
player->StoreItem(dest, bodyItem, true);
|
||||
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
|
||||
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
|
||||
delete bodyItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1190,18 +1190,18 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
|
||||
|
||||
_player->SetSelection(guid);
|
||||
|
||||
Player* plr = ObjectAccessor::FindPlayer(guid);
|
||||
if (!plr) // wrong player
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (!player) // wrong player
|
||||
return;
|
||||
|
||||
uint32 talent_points = 0x47;
|
||||
uint32 guid_size = plr->GetPackGUID().wpos();
|
||||
uint32 guid_size = player->GetPackGUID().wpos();
|
||||
WorldPacket data(SMSG_INSPECT_TALENT, guid_size+4+talent_points);
|
||||
data.append(plr->GetPackGUID());
|
||||
data.append(player->GetPackGUID());
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_TALENTS_INSPECTING) || _player->isGameMaster())
|
||||
{
|
||||
plr->BuildPlayerTalentsInfoData(&data);
|
||||
player->BuildPlayerTalentsInfoData(&data);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1210,7 +1210,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
|
||||
data << uint8(0); // talentGroupIndex
|
||||
}
|
||||
|
||||
plr->BuildEnchantmentsInfoData(&data);
|
||||
player->BuildEnchantmentsInfoData(&data);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -1291,15 +1291,15 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* plr = sObjectAccessor->FindPlayerByName(charname.c_str());
|
||||
Player* player = sObjectAccessor->FindPlayerByName(charname.c_str());
|
||||
|
||||
if (!plr)
|
||||
if (!player)
|
||||
{
|
||||
SendNotification(LANG_PLAYER_NOT_EXIST_OR_OFFLINE, charname.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 accid = plr->GetSession()->GetAccountId();
|
||||
uint32 accid = player->GetSession()->GetAccountId();
|
||||
|
||||
QueryResult result = LoginDatabase.PQuery("SELECT username, email, last_ip FROM account WHERE id=%u", accid);
|
||||
if (!result)
|
||||
|
||||
@@ -373,7 +373,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
|
||||
if (plMover->isAlive())
|
||||
{
|
||||
plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
|
||||
// pl can be alive if GM/etc
|
||||
// player can be alive if GM/etc
|
||||
// change the death state to CORPSE to prevent the death timer from
|
||||
// starting in the next player update
|
||||
if (!plMover->isAlive())
|
||||
|
||||
@@ -379,8 +379,8 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
|
||||
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
if (PageTextLocale const* pl = sObjectMgr->GetPageTextLocale(pageID))
|
||||
ObjectMgr::GetLocaleString(pl->Text, loc_idx, Text);
|
||||
if (PageTextLocale const* player = sObjectMgr->GetPageTextLocale(pageID))
|
||||
ObjectMgr::GetLocaleString(player->Text, loc_idx, Text);
|
||||
|
||||
data << Text;
|
||||
data << uint32(pageText->NextPage);
|
||||
|
||||
@@ -129,16 +129,16 @@ void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
|
||||
uint64 guid;
|
||||
data >> guid;
|
||||
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
if (!pl->GetVehicleKit())
|
||||
if (!player->GetVehicleKit())
|
||||
return;
|
||||
if (!pl->IsInRaidWith(_player))
|
||||
if (!player->IsInRaidWith(_player))
|
||||
return;
|
||||
if (!pl->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
|
||||
if (!player->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
|
||||
return;
|
||||
|
||||
_player->EnterVehicle(pl);
|
||||
_player->EnterVehicle(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,23 +157,23 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
|
||||
|
||||
if (IS_PLAYER_GUID(guid))
|
||||
{
|
||||
Player* plr = ObjectAccessor::FindPlayer(guid);
|
||||
if (!plr)
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (!player)
|
||||
{
|
||||
sLog->outError("Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plr->IsOnVehicle(vehicle->GetBase()))
|
||||
if (!player->IsOnVehicle(vehicle->GetBase()))
|
||||
{
|
||||
sLog->outError("Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
return;
|
||||
}
|
||||
|
||||
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(plr);
|
||||
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(player);
|
||||
ASSERT(seat);
|
||||
if (seat->IsEjectable())
|
||||
plr->ExitVehicle();
|
||||
player->ExitVehicle();
|
||||
else
|
||||
sLog->outError("Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
}
|
||||
|
||||
@@ -55,12 +55,12 @@ bool MapSessionFilter::Process(WorldPacket* packet)
|
||||
if (opHandle.packetProcessing == PROCESS_THREADUNSAFE)
|
||||
return false;
|
||||
|
||||
Player* plr = m_pSession->GetPlayer();
|
||||
if (!plr)
|
||||
Player* player = m_pSession->GetPlayer();
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
//in Map::Update() we do not process packets where player is not in world!
|
||||
return plr->IsInWorld();
|
||||
return player->IsInWorld();
|
||||
}
|
||||
|
||||
//we should process ALL packets when player is not in world/logged in
|
||||
@@ -77,12 +77,12 @@ bool WorldSessionFilter::Process(WorldPacket* packet)
|
||||
return true;
|
||||
|
||||
//no player attached? -> our client! ^^
|
||||
Player* plr = m_pSession->GetPlayer();
|
||||
if (!plr)
|
||||
Player* player = m_pSession->GetPlayer();
|
||||
if (!player)
|
||||
return true;
|
||||
|
||||
//lets process all packets for non-in-the-world player
|
||||
return (plr->IsInWorld() == false);
|
||||
return (player->IsInWorld() == false);
|
||||
}
|
||||
|
||||
/// WorldSession constructor
|
||||
@@ -964,9 +964,9 @@ void WorldSession::SendAddonsInfo()
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SetPlayer(Player* plr)
|
||||
void WorldSession::SetPlayer(Player* player)
|
||||
{
|
||||
_player = plr;
|
||||
_player = player;
|
||||
|
||||
// set m_GUID that can be used while player loggined and later until m_playerRecentlyLogout not reset
|
||||
if (_player)
|
||||
|
||||
@@ -247,7 +247,7 @@ class WorldSession
|
||||
char const* GetPlayerName() const;
|
||||
void SetSecurity(AccountTypes security) { _security = security; }
|
||||
std::string const& GetRemoteAddress() { return m_Address; }
|
||||
void SetPlayer(Player* plr);
|
||||
void SetPlayer(Player* player);
|
||||
uint8 Expansion() const { return m_expansion; }
|
||||
|
||||
/// Session in auth.queue currently
|
||||
|
||||
@@ -1569,9 +1569,9 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
|
||||
target->RemoveAurasDueToSpell(spellId2);
|
||||
|
||||
// Improved Barkskin - apply/remove armor bonus due to shapeshift
|
||||
if (Player* pl=target->ToPlayer())
|
||||
if (Player* player=target->ToPlayer())
|
||||
{
|
||||
if (pl->HasSpell(63410) || pl->HasSpell(63411))
|
||||
if (player->HasSpell(63410) || player->HasSpell(63411))
|
||||
{
|
||||
target->RemoveAurasDueToSpell(66530);
|
||||
target->CastSpell(target, 66530, true);
|
||||
@@ -2847,7 +2847,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
|
||||
if (target->GetTypeId() == TYPEID_UNIT)
|
||||
target->SetFlying(apply);
|
||||
|
||||
if (Player* plr = target->m_movedPlayer)
|
||||
if (Player* player = target->m_movedPlayer)
|
||||
{
|
||||
// allow flying
|
||||
WorldPacket data;
|
||||
@@ -2857,7 +2857,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
|
||||
data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
|
||||
data.append(target->GetPackGUID());
|
||||
data << uint32(0); // unk
|
||||
plr->SendDirectMessage(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3246,16 +3246,16 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !target->HasAuraType(SPELL_AURA_FLY))))
|
||||
{
|
||||
if (Player* plr = target->m_movedPlayer)
|
||||
if (Player* player = target->m_movedPlayer)
|
||||
{
|
||||
WorldPacket data;
|
||||
if (apply)
|
||||
data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
|
||||
else
|
||||
data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
|
||||
data.append(plr->GetPackGUID());
|
||||
data.append(player->GetPackGUID());
|
||||
data << uint32(0); // unknown
|
||||
plr->SendDirectMessage(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5394,9 +5394,9 @@ void AuraEffect::HandleAuraConvertRune(AuraApplication const* aurApp, uint8 mode
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* plr = (Player*)target;
|
||||
Player* player = (Player*)target;
|
||||
|
||||
if (plr->getClass() != CLASS_DEATH_KNIGHT)
|
||||
if (player->getClass() != CLASS_DEATH_KNIGHT)
|
||||
return;
|
||||
|
||||
uint32 runes = m_amount;
|
||||
@@ -5405,17 +5405,17 @@ void AuraEffect::HandleAuraConvertRune(AuraApplication const* aurApp, uint8 mode
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
|
||||
{
|
||||
if (GetMiscValue() != plr->GetCurrentRune(i))
|
||||
if (GetMiscValue() != player->GetCurrentRune(i))
|
||||
continue;
|
||||
if (!plr->GetRuneCooldown(i))
|
||||
if (!player->GetRuneCooldown(i))
|
||||
{
|
||||
plr->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
|
||||
player->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
|
||||
--runes;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
plr->RemoveRunesByAuraEffect(this);
|
||||
player->RemoveRunesByAuraEffect(this);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
|
||||
@@ -4330,9 +4330,9 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
Player* plr = (Player*)m_caster;
|
||||
Player* player = (Player*)m_caster;
|
||||
|
||||
if (plr->getClass() != CLASS_DEATH_KNIGHT)
|
||||
if (player->getClass() != CLASS_DEATH_KNIGHT)
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
SpellRuneCostEntry const* src = sSpellRuneCostStore.LookupEntry(runeCostID);
|
||||
@@ -4356,8 +4356,8 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
|
||||
|
||||
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
RuneType rune = plr->GetCurrentRune(i);
|
||||
if ((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
|
||||
RuneType rune = player->GetCurrentRune(i);
|
||||
if ((player->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
|
||||
runeCost[rune]--;
|
||||
}
|
||||
|
||||
|
||||
@@ -4398,8 +4398,8 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
|
||||
|
||||
if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pl = m_caster->ToPlayer();
|
||||
Battleground* bg = pl->GetBattleground();
|
||||
Player* player = m_caster->ToPlayer();
|
||||
Battleground* bg = player->GetBattleground();
|
||||
|
||||
switch (pGameObj->GetMapId())
|
||||
{
|
||||
@@ -4409,7 +4409,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
|
||||
{
|
||||
uint32 team = ALLIANCE;
|
||||
|
||||
if (pl->GetTeam() == team)
|
||||
if (player->GetTeam() == team)
|
||||
team = HORDE;
|
||||
|
||||
((BattlegroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(), team);
|
||||
@@ -5344,11 +5344,11 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
case 64142: // Upper Deck - Create Foam Sword
|
||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
Player* plr = unitTarget->ToPlayer();
|
||||
Player* player = unitTarget->ToPlayer();
|
||||
static uint32 const itemId[] = {45061, 45176, 45177, 45178, 45179, 0};
|
||||
// player can only have one of these items
|
||||
for (uint32 const* itr = &itemId[0]; *itr; ++itr)
|
||||
if (plr->HasItemCount(*itr, 1, true))
|
||||
if (player->HasItemCount(*itr, 1, true))
|
||||
return;
|
||||
DoCreateItem(effIndex, itemId[urand(0, 4)]);
|
||||
return;
|
||||
@@ -6155,15 +6155,15 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
|
||||
mana = CalculatePctN(m_caster->GetMaxPower(POWER_MANA), damage);
|
||||
}
|
||||
|
||||
Player* plr = m_caster->ToPlayer();
|
||||
plr->ResurrectPlayer(0.0f);
|
||||
Player* player = m_caster->ToPlayer();
|
||||
player->ResurrectPlayer(0.0f);
|
||||
|
||||
plr->SetHealth(health);
|
||||
plr->SetPower(POWER_MANA, mana);
|
||||
plr->SetPower(POWER_RAGE, 0);
|
||||
plr->SetPower(POWER_ENERGY, plr->GetMaxPower(POWER_ENERGY));
|
||||
player->SetHealth(health);
|
||||
player->SetPower(POWER_MANA, mana);
|
||||
player->SetPower(POWER_RAGE, 0);
|
||||
player->SetPower(POWER_ENERGY, player->GetMaxPower(POWER_ENERGY));
|
||||
|
||||
plr->SpawnCorpseBones();
|
||||
player->SpawnCorpseBones();
|
||||
}
|
||||
|
||||
void Spell::EffectSkinning(SpellEffIndex /*effIndex*/)
|
||||
@@ -6937,9 +6937,9 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* plr = m_caster->ToPlayer();
|
||||
Player* player = m_caster->ToPlayer();
|
||||
|
||||
if (plr->getClass() != CLASS_DEATH_KNIGHT)
|
||||
if (player->getClass() != CLASS_DEATH_KNIGHT)
|
||||
return;
|
||||
|
||||
// needed later
|
||||
@@ -6949,9 +6949,9 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
|
||||
if (count == 0) count = 1;
|
||||
for (uint32 j = 0; j < MAX_RUNES && count > 0; ++j)
|
||||
{
|
||||
if (plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->Effects[effIndex].MiscValue))
|
||||
if (player->GetRuneCooldown(j) && player->GetCurrentRune(j) == RuneType(m_spellInfo->Effects[effIndex].MiscValue))
|
||||
{
|
||||
plr->SetRuneCooldown(j, 0);
|
||||
player->SetRuneCooldown(j, 0);
|
||||
--count;
|
||||
}
|
||||
}
|
||||
@@ -6964,8 +6964,8 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
|
||||
|
||||
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
if (plr->GetRuneCooldown(i) && (plr->GetCurrentRune(i) == RUNE_FROST || plr->GetCurrentRune(i) == RUNE_DEATH))
|
||||
plr->SetRuneCooldown(i, 0);
|
||||
if (player->GetRuneCooldown(i) && (player->GetCurrentRune(i) == RUNE_FROST || player->GetCurrentRune(i) == RUNE_DEATH))
|
||||
player->SetRuneCooldown(i, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ SpellMgr::~SpellMgr()
|
||||
}
|
||||
|
||||
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
|
||||
bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
||||
bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg)
|
||||
{
|
||||
// not exist
|
||||
if (!spellInfo)
|
||||
@@ -378,8 +378,8 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
||||
{
|
||||
if (msg)
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
|
||||
if (player)
|
||||
ChatHandler(player).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
|
||||
else
|
||||
sLog->outErrorDb("Craft spell %u not have create item entry.", spellInfo->Id);
|
||||
}
|
||||
@@ -392,8 +392,8 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
||||
{
|
||||
if (msg)
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
|
||||
if (player)
|
||||
ChatHandler(player).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
|
||||
else
|
||||
sLog->outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
|
||||
}
|
||||
@@ -406,12 +406,12 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
||||
case SPELL_EFFECT_LEARN_SPELL:
|
||||
{
|
||||
SpellInfo const* spellInfo2 = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell);
|
||||
if (!IsSpellValid(spellInfo2, pl, msg))
|
||||
if (!IsSpellValid(spellInfo2, player, msg))
|
||||
{
|
||||
if (msg)
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
|
||||
if (player)
|
||||
ChatHandler(player).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
|
||||
else
|
||||
sLog->outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
|
||||
}
|
||||
@@ -430,8 +430,8 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
||||
{
|
||||
if (msg)
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
|
||||
if (player)
|
||||
ChatHandler(player).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
|
||||
else
|
||||
sLog->outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
|
||||
}
|
||||
|
||||
@@ -617,7 +617,7 @@ class SpellMgr
|
||||
// Accessors (const or static functions)
|
||||
public:
|
||||
// Spell correctess for client using
|
||||
static bool IsSpellValid(SpellInfo const* spellInfo, Player* pl = NULL, bool msg = true);
|
||||
static bool IsSpellValid(SpellInfo const* spellInfo, Player* player = NULL, bool msg = true);
|
||||
|
||||
// Spell difficulty
|
||||
uint32 GetSpellDifficultyId(uint32 spellId) const;
|
||||
|
||||
@@ -381,12 +381,12 @@ void CreatureTextMgr::SendChatPacket(WorldPacket* data, WorldObject* source, Cha
|
||||
const SessionMap smap = sWorld->GetAllSessions();
|
||||
for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
|
||||
{
|
||||
if (Player* plr = (*iter).second->GetPlayer())
|
||||
if (Player* player = (*iter).second->GetPlayer())
|
||||
{
|
||||
if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid
|
||||
data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(plr->GetGUID()));
|
||||
if (plr->GetSession() && (!team || Team(plr->GetTeam()) == team) && (!gmOnly || plr->isGameMaster()))
|
||||
plr->GetSession()->SendPacket(data);
|
||||
data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(player->GetGUID()));
|
||||
if (player->GetSession() && (!team || Team(player->GetTeam()) == team) && (!gmOnly || player->isGameMaster()))
|
||||
player->GetSession()->SendPacket(data);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -228,38 +228,38 @@ public:
|
||||
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* pl = itr->getSource();
|
||||
Player* player = itr->getSource();
|
||||
|
||||
if (!pl || !pl->GetSession())
|
||||
if (!player || !player->GetSession())
|
||||
continue;
|
||||
|
||||
// check online security
|
||||
if (handler->HasLowerSecurity(pl, 0))
|
||||
if (handler->HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
std::string plNameLink = handler->GetNameLink(pl);
|
||||
std::string plNameLink = handler->GetNameLink(player);
|
||||
|
||||
if (pl->IsBeingTeleported())
|
||||
if (player->IsBeingTeleported())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name.c_str());
|
||||
if (handler->needReportToTarget(pl))
|
||||
(ChatHandler(pl)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
|
||||
if (handler->needReportToTarget(player))
|
||||
(ChatHandler(player)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
|
||||
|
||||
// stop flight if need
|
||||
if (pl->isInFlight())
|
||||
if (player->isInFlight())
|
||||
{
|
||||
pl->GetMotionMaster()->MovementExpired();
|
||||
pl->CleanupAfterTaxiFlight();
|
||||
player->GetMotionMaster()->MovementExpired();
|
||||
player->CleanupAfterTaxiFlight();
|
||||
}
|
||||
// save only in non-flight case
|
||||
else
|
||||
pl->SaveRecallPosition();
|
||||
player->SaveRecallPosition();
|
||||
|
||||
pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
||||
player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -641,7 +641,7 @@ public:
|
||||
|
||||
void EnterCombat(Unit* /*who*/) {}
|
||||
|
||||
void BeginEvent(Player* pl)
|
||||
void BeginEvent(Player* player)
|
||||
{
|
||||
if (!instance)
|
||||
return;
|
||||
@@ -662,7 +662,7 @@ public:
|
||||
me->CombatStart(Shade);
|
||||
Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
|
||||
Shade->SetTarget(me->GetGUID());
|
||||
if (pl) Shade->AddThreat(pl, 1.0f);
|
||||
if (player) Shade->AddThreat(player, 1.0f);
|
||||
DoZoneInCombat(Shade);
|
||||
EventBegun = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user