Core/Battlefield: some minor cleanups
This commit is contained in:
@@ -37,7 +37,7 @@ Battlefield::Battlefield()
|
|||||||
{
|
{
|
||||||
m_Timer = 0;
|
m_Timer = 0;
|
||||||
m_enable = true;
|
m_enable = true;
|
||||||
m_WarTime = false;
|
m_BattlefieldActive = false;
|
||||||
m_DefenderTeam = TEAM_NEUTRAL;
|
m_DefenderTeam = TEAM_NEUTRAL;
|
||||||
|
|
||||||
m_TypeId = 0;
|
m_TypeId = 0;
|
||||||
@@ -313,7 +313,7 @@ void Battlefield::KickPlayerFromBf(uint64 guid)
|
|||||||
|
|
||||||
void Battlefield::StartBattle()
|
void Battlefield::StartBattle()
|
||||||
{
|
{
|
||||||
if (m_WarTime)
|
if (m_BattlefieldActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
||||||
@@ -323,7 +323,7 @@ void Battlefield::StartBattle()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Timer = m_BattleTime;
|
m_Timer = m_BattleTime;
|
||||||
m_WarTime = true;
|
m_BattlefieldActive = true;
|
||||||
|
|
||||||
InvitePlayerInZoneToWar();
|
InvitePlayerInZoneToWar();
|
||||||
InvitePlayerInQueueToWar();
|
InvitePlayerInQueueToWar();
|
||||||
@@ -335,7 +335,7 @@ void Battlefield::StartBattle()
|
|||||||
|
|
||||||
void Battlefield::EndBattle(bool endbytimer)
|
void Battlefield::EndBattle(bool endbytimer)
|
||||||
{
|
{
|
||||||
m_WarTime = false;
|
m_BattlefieldActive = false;
|
||||||
|
|
||||||
m_StartGrouping = false;
|
m_StartGrouping = false;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "ZoneScript.h"
|
#include "ZoneScript.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "GameObject.h"
|
#include "GameObject.h"
|
||||||
|
#include "Battleground.h"
|
||||||
|
|
||||||
enum BattlefieldTypes
|
enum BattlefieldTypes
|
||||||
{
|
{
|
||||||
@@ -215,7 +216,7 @@ class Battlefield:public ZoneScript
|
|||||||
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
||||||
|
|
||||||
/// Return true if battle is start, false if battle is not started
|
/// Return true if battle is start, false if battle is not started
|
||||||
bool IsWarTime() { return m_WarTime; }
|
bool IsWarTime() { return m_BattlefieldActive; }
|
||||||
|
|
||||||
/// Enable or Disable battlefield
|
/// Enable or Disable battlefield
|
||||||
void SetEnable(bool enable) { m_enable = enable; }
|
void SetEnable(bool enable) { m_enable = enable; }
|
||||||
@@ -304,7 +305,7 @@ class Battlefield:public ZoneScript
|
|||||||
virtual void SendInitWorldStatesToAll() {};
|
virtual void SendInitWorldStatesToAll() {};
|
||||||
|
|
||||||
/// Return if we can use mount in battlefield
|
/// Return if we can use mount in battlefield
|
||||||
bool CanFlyIn() { return !m_WarTime; } // Used for check if we can use flying mount or not
|
bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not
|
||||||
bool IncrementQuest(Player * player, uint32 quest, bool complete = false);
|
bool IncrementQuest(Player * player, uint32 quest, bool complete = false);
|
||||||
void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid);
|
void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid);
|
||||||
|
|
||||||
@@ -330,7 +331,7 @@ protected:
|
|||||||
uint64 StalkerGuid;
|
uint64 StalkerGuid;
|
||||||
uint32 m_Timer; // Global timer for event
|
uint32 m_Timer; // Global timer for event
|
||||||
bool m_enable;
|
bool m_enable;
|
||||||
bool m_WarTime;
|
bool m_BattlefieldActive;
|
||||||
TeamId m_DefenderTeam;
|
TeamId m_DefenderTeam;
|
||||||
|
|
||||||
// the map of the objectives belonging to this outdoorpvp
|
// the map of the objectives belonging to this outdoorpvp
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
// TODO: Use spell victory/defeat in wg instead of RewardMarkOfHonor() && RewardHonor
|
// TODO: Use spell victory/defeat in wg instead of RewardMarkOfHonor() && RewardHonor
|
||||||
// TODO: Add proper implement of achievement
|
// TODO: Add proper implement of achievement
|
||||||
|
|
||||||
|
#include "ObjectMgr.h"
|
||||||
#include "BattlefieldWG.h"
|
#include "BattlefieldWG.h"
|
||||||
#include "SpellAuras.h"
|
#include "SpellAuras.h"
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ bool BattlefieldWG::SetupBattlefield()
|
|||||||
m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE;
|
m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE;
|
||||||
|
|
||||||
m_TimeForAcceptInvite = 20;
|
m_TimeForAcceptInvite = 20;
|
||||||
m_StartGroupingTimer = 15 * MINUTE;
|
m_StartGroupingTimer = 15 * MINUTE;
|
||||||
m_StartGrouping = false;
|
m_StartGrouping = false;
|
||||||
|
|
||||||
m_tenacityStack = 0;
|
m_tenacityStack = 0;
|
||||||
@@ -72,13 +73,13 @@ bool BattlefieldWG::SetupBattlefield()
|
|||||||
sWorld->setWorldState(ClockWorldState[0], m_NoWarBattleTime);
|
sWorld->setWorldState(ClockWorldState[0], m_NoWarBattleTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_WarTime = sWorld->getWorldState(3801);
|
m_BattlefieldActive = sWorld->getWorldState(3801);
|
||||||
m_DefenderTeam = TeamId(sWorld->getWorldState(3802));
|
m_DefenderTeam = TeamId(sWorld->getWorldState(3802));
|
||||||
|
|
||||||
m_Timer = sWorld->getWorldState(ClockWorldState[0]);
|
m_Timer = sWorld->getWorldState(ClockWorldState[0]);
|
||||||
if (m_WarTime)
|
if (m_BattlefieldActive)
|
||||||
{
|
{
|
||||||
m_WarTime = false;
|
m_BattlefieldActive = false;
|
||||||
m_Timer = m_RestartAfterCrash;
|
m_Timer = m_RestartAfterCrash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,9 +87,9 @@ bool BattlefieldWG::SetupBattlefield()
|
|||||||
{
|
{
|
||||||
BfGraveYardWG *gy = new BfGraveYardWG(this);
|
BfGraveYardWG *gy = new BfGraveYardWG(this);
|
||||||
if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) // When between games, the graveyard is controlled by the defending team
|
if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) // When between games, the graveyard is controlled by the defending team
|
||||||
gy->Init(31841, 31842, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, m_DefenderTeam, WGGraveYard[i].gyid);
|
gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, m_DefenderTeam, WGGraveYard[i].gyid);
|
||||||
else
|
else
|
||||||
gy->Init(31841, 31842, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
|
gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
|
||||||
gy->SetTextId(WGGraveYard[i].textid);
|
gy->SetTextId(WGGraveYard[i].textid);
|
||||||
m_GraveYardList[i] = gy;
|
m_GraveYardList[i] = gy;
|
||||||
}
|
}
|
||||||
@@ -210,7 +211,7 @@ bool BattlefieldWG::Update(uint32 diff)
|
|||||||
bool m_return = Battlefield::Update(diff);
|
bool m_return = Battlefield::Update(diff);
|
||||||
if (m_saveTimer <= diff)
|
if (m_saveTimer <= diff)
|
||||||
{
|
{
|
||||||
sWorld->setWorldState(3801, m_WarTime);
|
sWorld->setWorldState(3801, m_BattlefieldActive);
|
||||||
sWorld->setWorldState(3802, m_DefenderTeam);
|
sWorld->setWorldState(3802, m_DefenderTeam);
|
||||||
sWorld->setWorldState(ClockWorldState[0], m_Timer);
|
sWorld->setWorldState(ClockWorldState[0], m_Timer);
|
||||||
m_saveTimer = 60 * IN_MILLISECONDS;
|
m_saveTimer = 60 * IN_MILLISECONDS;
|
||||||
@@ -219,23 +220,23 @@ bool BattlefieldWG::Update(uint32 diff)
|
|||||||
m_saveTimer -= diff;
|
m_saveTimer -= diff;
|
||||||
|
|
||||||
for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersIsSpellImu.begin(); itr != m_PlayersIsSpellImu.end(); ++itr)
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
{
|
{
|
||||||
if (plr->HasAura(SPELL_SPIRITUAL_IMMUNITY))
|
if (player->HasAura(SPELL_SPIRITUAL_IMMUNITY))
|
||||||
{
|
{
|
||||||
const WorldSafeLocsEntry *graveyard = GetClosestGraveYard(plr);
|
const WorldSafeLocsEntry *graveyard = GetClosestGraveYard(player);
|
||||||
if (graveyard)
|
if (graveyard)
|
||||||
{
|
{
|
||||||
if (plr->GetDistance2d(graveyard->x, graveyard->y) > 10.0f)
|
if (player->GetDistance2d(graveyard->x, graveyard->y) > 10.0f)
|
||||||
{
|
{
|
||||||
plr->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
||||||
m_PlayersIsSpellImu.erase(plr->GetGUID());
|
m_PlayersIsSpellImu.erase(player->GetGUID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_WarTime)
|
if (m_BattlefieldActive)
|
||||||
{
|
{
|
||||||
for (uint8 team = 0; team < 2; ++team)
|
for (uint8 team = 0; team < 2; ++team)
|
||||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||||
@@ -251,13 +252,13 @@ bool BattlefieldWG::Update(uint32 diff)
|
|||||||
|
|
||||||
for (uint8 team = 0; team < 2; ++team)
|
for (uint8 team = 0; team < 2; ++team)
|
||||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr)
|
for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr)
|
||||||
{
|
{
|
||||||
if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(plr) < 22500.0f) // 150*150
|
if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150
|
||||||
{
|
{
|
||||||
plr->AddAura((*cp_itr).second->GetTeamId() == TEAM_HORDE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT, plr);
|
player->AddAura((*cp_itr).second->GetTeamId() == TEAM_HORDE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT, player);
|
||||||
plr->RemoveAurasDueToSpell((*cp_itr).second->GetTeamId() == TEAM_ALLIANCE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
|
player->RemoveAurasDueToSpell((*cp_itr).second->GetTeamId() == TEAM_ALLIANCE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,12 +271,12 @@ void BattlefieldWG::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_gui
|
|||||||
Battlefield::AddPlayerToResurrectQueue(npc_guid, player_guid);
|
Battlefield::AddPlayerToResurrectQueue(npc_guid, player_guid);
|
||||||
if (IsWarTime())
|
if (IsWarTime())
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectMgr->GetPlayer(player_guid))
|
if (Player* player = sObjectMgr->GetPlayer(player_guid))
|
||||||
{
|
{
|
||||||
if (!plr->HasAura(SPELL_SPIRITUAL_IMMUNITY))
|
if (!player->HasAura(SPELL_SPIRITUAL_IMMUNITY))
|
||||||
{
|
{
|
||||||
plr->CastSpell(plr, SPELL_SPIRITUAL_IMMUNITY, true);
|
player->CastSpell(player, SPELL_SPIRITUAL_IMMUNITY, true);
|
||||||
m_PlayersIsSpellImu.insert(plr->GetGUID());
|
m_PlayersIsSpellImu.insert(player->GetGUID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -335,13 +336,13 @@ void BattlefieldWG::OnBattleStart()
|
|||||||
for (GuidSet::const_iterator p_itr = m_players[team].begin(); p_itr != m_players[team].end(); ++p_itr)
|
for (GuidSet::const_iterator p_itr = m_players[team].begin(); p_itr != m_players[team].end(); ++p_itr)
|
||||||
{
|
{
|
||||||
// Kick player in orb room, TODO: offline player ?
|
// Kick player in orb room, TODO: offline player ?
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*p_itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*p_itr)))
|
||||||
{
|
{
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
plr->GetPosition(x, y, z);
|
player->GetPosition(x, y, z);
|
||||||
if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
|
if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
|
||||||
plr->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
|
player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
|
||||||
SendInitWorldStatesTo(plr);
|
SendInitWorldStatesTo(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Initialize vehicle counter
|
// Initialize vehicle counter
|
||||||
@@ -451,59 +452,59 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer)
|
|||||||
for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr)
|
for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr)
|
||||||
(*itr)->Save();
|
(*itr)->Save();
|
||||||
|
|
||||||
uint32 WinerHonor = 0;
|
uint32 WinHonor = 0;
|
||||||
uint32 LooserHonor = 0;
|
uint32 LossHonor = 0;
|
||||||
|
|
||||||
if (!endbytimer)
|
if (!endbytimer)
|
||||||
{
|
{
|
||||||
WinerHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF];
|
WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF];
|
||||||
LooserHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT];
|
LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WinerHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT];
|
WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT];
|
||||||
LooserHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF];
|
LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
{
|
{
|
||||||
plr->AddAura(58045, plr);
|
player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player);
|
||||||
if (plr->HasAura(SPELL_LIEUTENANT))
|
if (player->HasAura(SPELL_LIEUTENANT))
|
||||||
{
|
{
|
||||||
plr->RewardHonor(NULL, 1, WinerHonor);
|
player->RewardHonor(NULL, 1, WinHonor);
|
||||||
RewardMarkOfHonor(plr, 3);
|
RewardMarkOfHonor(player, 3);
|
||||||
}
|
}
|
||||||
else if (plr->HasAura(SPELL_CORPORAL))
|
else if (player->HasAura(SPELL_CORPORAL))
|
||||||
{
|
{
|
||||||
plr->RewardHonor(NULL, 1, WinerHonor);
|
player->RewardHonor(NULL, 1, WinHonor);
|
||||||
RewardMarkOfHonor(plr, 2);
|
RewardMarkOfHonor(player, 2);
|
||||||
}
|
}
|
||||||
if (plr->GetTeamId() == TEAM_HORDE)
|
if (player->GetTeamId() == TEAM_HORDE)
|
||||||
IncrementQuest(plr, 13183, true);
|
IncrementQuest(player, 13183, true);
|
||||||
else
|
else
|
||||||
IncrementQuest(plr, 13181, true);
|
IncrementQuest(player, 13181, true);
|
||||||
// Send Wintergrasp victory achievement
|
// Send Wintergrasp victory achievement
|
||||||
DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, plr);
|
DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player);
|
||||||
// Award achievement for succeeding in Wintergrasp in 10 minutes or less
|
// Award achievement for succeeding in Wintergrasp in 10 minutes or less
|
||||||
if (!endbytimer && GetTimer() <= 10000)
|
if (!endbytimer && GetTimer() <= 10000)
|
||||||
DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, plr);
|
DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
{
|
{
|
||||||
if (plr->HasAura(SPELL_LIEUTENANT))
|
if (player->HasAura(SPELL_LIEUTENANT))
|
||||||
{
|
{
|
||||||
plr->RewardHonor(NULL, 1, LooserHonor);
|
player->RewardHonor(NULL, 1, LossHonor);
|
||||||
RewardMarkOfHonor(plr, 1);
|
RewardMarkOfHonor(player, 1);
|
||||||
}
|
}
|
||||||
else if (plr->HasAura(SPELL_CORPORAL))
|
else if (player->HasAura(SPELL_CORPORAL))
|
||||||
{
|
{
|
||||||
plr->RewardHonor(NULL, 1, LooserHonor);
|
player->RewardHonor(NULL, 1, LossHonor);
|
||||||
RewardMarkOfHonor(plr, 1);
|
RewardMarkOfHonor(player, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -512,14 +513,14 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer)
|
|||||||
{
|
{
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
{
|
{
|
||||||
plr->RemoveAura(SPELL_TOWER_CONTROL);
|
player->RemoveAura(SPELL_TOWER_CONTROL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
player->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
player->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TENACITY);
|
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_PlayersInWar[team].clear();
|
m_PlayersInWar[team].clear();
|
||||||
@@ -540,10 +541,10 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer)
|
|||||||
{
|
{
|
||||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
{
|
{
|
||||||
plr->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, plr->GetGUID());
|
player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID());
|
||||||
plr->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, plr);
|
player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -582,7 +583,7 @@ void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlefieldWG::RewardMarkOfHonor(Player *plr, uint32 count)
|
void BattlefieldWG::RewardMarkOfHonor(Player* player, uint32 count)
|
||||||
{
|
{
|
||||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
@@ -590,7 +591,7 @@ void BattlefieldWG::RewardMarkOfHonor(Player *plr, uint32 count)
|
|||||||
|
|
||||||
ItemPosCountVec dest;
|
ItemPosCountVec dest;
|
||||||
uint32 no_space_count = 0;
|
uint32 no_space_count = 0;
|
||||||
uint8 msg = plr->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, WG_MARK_OF_HONOR, count, &no_space_count);
|
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, WG_MARK_OF_HONOR, count, &no_space_count);
|
||||||
|
|
||||||
if (msg == EQUIP_ERR_ITEM_NOT_FOUND)
|
if (msg == EQUIP_ERR_ITEM_NOT_FOUND)
|
||||||
{
|
{
|
||||||
@@ -601,8 +602,8 @@ void BattlefieldWG::RewardMarkOfHonor(Player *plr, uint32 count)
|
|||||||
count -= no_space_count;
|
count -= no_space_count;
|
||||||
|
|
||||||
if (count != 0 && !dest.empty()) // can add some
|
if (count != 0 && !dest.empty()) // can add some
|
||||||
if (Item * item = plr->StoreNewItem(dest, WG_MARK_OF_HONOR, true, 0))
|
if (Item * item = player->StoreNewItem(dest, WG_MARK_OF_HONOR, true, 0))
|
||||||
plr->SendNewItem(item, count, true, false);
|
player->SendNewItem(item, count, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlefieldWG::OnStartGrouping()
|
void BattlefieldWG::OnStartGrouping()
|
||||||
@@ -681,7 +682,7 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Called when player kill a unit in wg zone
|
// Called when player kill a unit in wg zone
|
||||||
void BattlefieldWG::HandleKill(Player *killer, Unit *victim)
|
void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
||||||
{
|
{
|
||||||
if (killer == victim)
|
if (killer == victim)
|
||||||
return;
|
return;
|
||||||
@@ -693,9 +694,9 @@ void BattlefieldWG::HandleKill(Player *killer, Unit *victim)
|
|||||||
IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]);
|
IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]);
|
||||||
for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr)
|
for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr)
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectAccessor->FindPlayer(*p_itr))
|
if (Player* player = sObjectAccessor->FindPlayer(*p_itr))
|
||||||
if (plr->GetDistance2d(killer) < 40)
|
if (player->GetDistance2d(killer) < 40)
|
||||||
PromotePlayer(plr);
|
PromotePlayer(player);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -711,9 +712,9 @@ void BattlefieldWG::HandleKill(Player *killer, Unit *victim)
|
|||||||
again = true;
|
again = true;
|
||||||
for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr)
|
for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr)
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectAccessor->FindPlayer(*p_itr))
|
if (Player* player = sObjectAccessor->FindPlayer(*p_itr))
|
||||||
if (plr->GetDistance2d(killer) < 40)
|
if (player->GetDistance2d(killer) < 40)
|
||||||
IncrementQuest(plr, IncrementQuest(killer, WGQuest[killer->GetTeamId()][0]));
|
IncrementQuest(player, IncrementQuest(killer, WGQuest[killer->GetTeamId()][0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -733,9 +734,9 @@ void BattlefieldWG::HandleKill(Player *killer, Unit *victim)
|
|||||||
IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]);
|
IncrementQuest(killer, WGQuest[killer->GetTeamId()][5]);
|
||||||
for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr)
|
for (GuidSet::const_iterator p_itr = m_PlayersInWar[killer->GetTeamId()].begin(); p_itr != m_PlayersInWar[killer->GetTeamId()].end(); ++p_itr)
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectAccessor->FindPlayer(*p_itr))
|
if (Player* player = sObjectAccessor->FindPlayer(*p_itr))
|
||||||
if (plr->GetDistance2d(killer) < 40)
|
if (player->GetDistance2d(killer) < 40)
|
||||||
PromotePlayer(plr);
|
PromotePlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -745,9 +746,9 @@ void BattlefieldWG::HandleKill(Player *killer, Unit *victim)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update rank for player
|
// Update rank for player
|
||||||
void BattlefieldWG::PromotePlayer(Player *killer)
|
void BattlefieldWG::PromotePlayer(Player* killer)
|
||||||
{
|
{
|
||||||
if (!m_WarTime)
|
if (!m_BattlefieldActive)
|
||||||
return;
|
return;
|
||||||
// Updating rank of player
|
// Updating rank of player
|
||||||
if (Aura* aur = killer->GetAura(SPELL_RECRUIT))
|
if (Aura* aur = killer->GetAura(SPELL_RECRUIT))
|
||||||
@@ -774,114 +775,111 @@ void BattlefieldWG::PromotePlayer(Player *killer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlefieldWG::OnPlayerJoinWar(Player *plr)
|
void BattlefieldWG::OnPlayerJoinWar(Player* player)
|
||||||
{
|
{
|
||||||
plr->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
player->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
player->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TENACITY);
|
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||||
plr->RemoveAurasDueToSpell(58045);
|
player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP);
|
||||||
|
|
||||||
plr->CastSpell(plr, SPELL_RECRUIT, true);
|
player->CastSpell(player, SPELL_RECRUIT, true);
|
||||||
|
|
||||||
if (plr->GetZoneId() != m_ZoneId)
|
if (player->GetZoneId() != m_ZoneId)
|
||||||
{
|
{
|
||||||
if (plr->GetTeamId() == GetDefenderTeam())
|
if (player->GetTeamId() == GetDefenderTeam())
|
||||||
{
|
{
|
||||||
plr->TeleportTo(571, 5345, 2842, 410, 3.14f);
|
player->TeleportTo(571, 5345, 2842, 410, 3.14f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (plr->GetTeamId() == TEAM_HORDE)
|
if (player->GetTeamId() == TEAM_HORDE)
|
||||||
plr->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f);
|
player->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f);
|
||||||
else
|
else
|
||||||
plr->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f);
|
player->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateTenacity();
|
UpdateTenacity();
|
||||||
|
|
||||||
if (plr->GetTeamId() == GetAttackerTeam())
|
if (player->GetTeamId() == GetAttackerTeam())
|
||||||
{
|
{
|
||||||
if (3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0)
|
if (3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0)
|
||||||
plr->SetAuraStack(SPELL_TOWER_CONTROL, plr, 3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]);
|
player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0)
|
if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0)
|
||||||
plr->SetAuraStack(SPELL_TOWER_CONTROL, plr, m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]);
|
player->SetAuraStack(SPELL_TOWER_CONTROL, player, m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]);
|
||||||
}
|
}
|
||||||
SendInitWorldStatesTo(plr);
|
SendInitWorldStatesTo(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlefieldWG::OnPlayerLeaveWar(Player *plr)
|
void BattlefieldWG::OnPlayerLeaveWar(Player* player)
|
||||||
{
|
{
|
||||||
// Remove all aura from WG // TODO: false we can go out of this zone on retail and keep Rank buff, remove on end of WG
|
// Remove all aura from WG // TODO: false we can go out of this zone on retail and keep Rank buff, remove on end of WG
|
||||||
if (!plr->GetSession()->PlayerLogout())
|
if (!player->GetSession()->PlayerLogout())
|
||||||
{
|
{
|
||||||
if (plr->GetVehicle()) // Remove vehicle of player if he go out.
|
if (player->GetVehicle()) // Remove vehicle of player if he go out.
|
||||||
plr->GetVehicle()->Dismiss();
|
player->GetVehicle()->Dismiss();
|
||||||
plr->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
player->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
player->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TENACITY);
|
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||||
plr->RemoveAurasDueToSpell(58730);
|
player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
|
||||||
plr->RemoveAurasDueToSpell(58045);
|
player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||||
}
|
}
|
||||||
plr->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
|
player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
|
player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
|
player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
|
player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlefieldWG::OnPlayerLeaveZone(Player *plr)
|
void BattlefieldWG::OnPlayerLeaveZone(Player* player)
|
||||||
{
|
{
|
||||||
plr->RemoveAurasDueToSpell(58045);
|
player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP);
|
||||||
if (!m_WarTime)
|
if (!m_BattlefieldActive)
|
||||||
{
|
{
|
||||||
plr->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
player->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
player->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TENACITY);
|
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||||
plr->RemoveAurasDueToSpell(58730);
|
player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||||
}
|
}
|
||||||
plr->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
|
player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
|
player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
|
player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
|
player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlefieldWG::OnPlayerEnterZone(Player *plr)
|
void BattlefieldWG::OnPlayerEnterZone(Player* player)
|
||||||
{
|
{
|
||||||
plr->RemoveAurasDueToSpell(58045);
|
player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP);
|
||||||
if (!m_WarTime)
|
if (!m_BattlefieldActive)
|
||||||
{
|
{
|
||||||
plr->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
player->RemoveAurasDueToSpell(SPELL_RECRUIT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
player->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TENACITY);
|
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||||
plr->RemoveAurasDueToSpell(58730);
|
player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||||
if (plr->GetTeamId() == GetDefenderTeam())
|
if (player->GetTeamId() == GetDefenderTeam())
|
||||||
plr->AddAura(58045, plr);
|
player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
plr->AddAura(m_DefenderTeam == TEAM_HORDE ?
|
player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
|
||||||
SPELL_HORDE_CONTROL_PHASE_SHIFT:
|
|
||||||
SPELL_ALLIANCE_CONTROL_PHASE_SHIFT,
|
|
||||||
plr);
|
|
||||||
// Send worldstate to player
|
// Send worldstate to player
|
||||||
SendInitWorldStatesTo(plr);
|
SendInitWorldStatesTo(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method sending worldsate to player
|
// Method sending worldsate to player
|
||||||
@@ -929,8 +927,8 @@ void BattlefieldWG::SendInitWorldStatesToAll()
|
|||||||
WorldPacket data = BuildInitWorldStates();
|
WorldPacket data = BuildInitWorldStates();
|
||||||
for (uint8 team = 0; team < 2; team++)
|
for (uint8 team = 0; team < 2; team++)
|
||||||
for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
plr->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlefieldWG::BrokenWallOrTower(TeamId team)
|
void BattlefieldWG::BrokenWallOrTower(TeamId team)
|
||||||
@@ -939,12 +937,12 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team)
|
|||||||
{
|
{
|
||||||
for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr)
|
for (GuidSet::const_iterator p_itr = m_PlayersInWar[GetAttackerTeam()].begin(); p_itr != m_PlayersInWar[GetAttackerTeam()].end(); ++p_itr)
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*p_itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*p_itr)))
|
||||||
{
|
{
|
||||||
if (plr->GetTeamId() == TEAM_ALLIANCE)
|
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||||
IncrementQuest(plr, 13222);
|
IncrementQuest(player, 13222);
|
||||||
else
|
else
|
||||||
IncrementQuest(plr, 13223);
|
IncrementQuest(player, 13223);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -961,19 +959,19 @@ void BattlefieldWG::AddBrokenTower(TeamId team)
|
|||||||
|
|
||||||
// Remove buff stack
|
// Remove buff stack
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
plr->RemoveAuraFromStack(SPELL_TOWER_CONTROL);
|
player->RemoveAuraFromStack(SPELL_TOWER_CONTROL);
|
||||||
|
|
||||||
// Add buff stack
|
// Add buff stack
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
{
|
{
|
||||||
plr->CastSpell(plr, SPELL_TOWER_CONTROL, true);
|
player->CastSpell(player, SPELL_TOWER_CONTROL, true);
|
||||||
if (plr->GetTeamId() == TEAM_HORDE)
|
if (player->GetTeamId() == TEAM_HORDE)
|
||||||
IncrementQuest(plr, 13539, true);
|
IncrementQuest(player, 13539, true);
|
||||||
else
|
else
|
||||||
IncrementQuest(plr, 13538, true);
|
IncrementQuest(player, 13538, true);
|
||||||
DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, plr);
|
DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player);
|
||||||
}
|
}
|
||||||
// If the threw south tower is destroy
|
// If the threw south tower is destroy
|
||||||
if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] == 3)
|
if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] == 3)
|
||||||
@@ -1006,7 +1004,7 @@ void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId)
|
|||||||
if (obj->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC)
|
if (obj->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC)
|
||||||
{
|
{
|
||||||
// Check that the door is break
|
// Check that the door is break
|
||||||
if (m_bCanClickOnOrb)
|
if (m_CanClickOnOrb)
|
||||||
EndBattle(false);
|
EndBattle(false);
|
||||||
else // if door is not break, respawn relic.
|
else // if door is not break, respawn relic.
|
||||||
m_relic->SetRespawnTime(RESPAWN_IMMEDIATELY);
|
m_relic->SetRespawnTime(RESPAWN_IMMEDIATELY);
|
||||||
@@ -1078,9 +1076,9 @@ void BattlefieldWG::UpdateTenacity()
|
|||||||
if (team != TEAM_NEUTRAL)
|
if (team != TEAM_NEUTRAL)
|
||||||
{
|
{
|
||||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
if (plr->getLevel() >= m_MinLevel))
|
if (player->getLevel() >= m_MinLevel)
|
||||||
plr->RemoveAurasDueToSpell(SPELL_TENACITY);
|
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||||
|
|
||||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||||
@@ -1098,28 +1096,28 @@ void BattlefieldWG::UpdateTenacity()
|
|||||||
if (newStack > 20)
|
if (newStack > 20)
|
||||||
newStack = 20;
|
newStack = 20;
|
||||||
|
|
||||||
uint32 buff_honnor = SPELL_GREATEST_HONOR;
|
uint32 buff_honor = SPELL_GREATEST_HONOR;
|
||||||
buff_honnor = (newStack < 15) ? (uint32) SPELL_GREATER_HONOR : buff_honnor;
|
buff_honor = (newStack < 15) ? (uint32) SPELL_GREATER_HONOR : buff_honor;
|
||||||
buff_honnor = (newStack < 10) ? (uint32) SPELL_GREAT_HONOR : buff_honnor;
|
buff_honor = (newStack < 10) ? (uint32) SPELL_GREAT_HONOR : buff_honor;
|
||||||
buff_honnor = (newStack < 5) ? 0 : buff_honnor;
|
buff_honor = (newStack < 5) ? 0 : buff_honor;
|
||||||
|
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
plr->SetAuraStack(SPELL_TENACITY, plr, newStack);
|
player->SetAuraStack(SPELL_TENACITY, player, newStack);
|
||||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||||
if (Creature* creature = unit->ToCreature())
|
if (Creature* creature = unit->ToCreature())
|
||||||
creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
|
creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
|
||||||
|
|
||||||
if (buff_honnor != 0)
|
if (buff_honor != 0)
|
||||||
{
|
{
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
if (Player* player = sObjectMgr->GetPlayer((*itr)))
|
||||||
plr->AddAura(buff_honnor, plr);
|
player->AddAura(buff_honor, player);
|
||||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||||
if (Creature* creature = unit->ToCreature())
|
if (Creature* creature = unit->ToCreature())
|
||||||
creature->AddAura(buff_honnor, creature);
|
creature->AddAura(buff_honor, creature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1129,13 +1127,13 @@ void BfCapturePointWG::ChangeTeam(TeamId /*oldTeam */ )
|
|||||||
m_WorkShop->ChangeControl(m_team, false);
|
m_WorkShop->ChangeControl(m_team, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
BfCapturePointWG::BfCapturePointWG(BattlefieldWG *bf, TeamId control):BfCapturePoint(bf)
|
BfCapturePointWG::BfCapturePointWG(BattlefieldWG* bf, TeamId control) : BfCapturePoint(bf)
|
||||||
{
|
{
|
||||||
m_Bf = bf;
|
m_Bf = bf;
|
||||||
m_team = control;
|
m_team = control;
|
||||||
}
|
}
|
||||||
|
|
||||||
BfGraveYardWG::BfGraveYardWG(BattlefieldWG *bf):BfGraveYard(bf)
|
BfGraveYardWG::BfGraveYardWG(BattlefieldWG* bf) : BfGraveYard(bf)
|
||||||
{
|
{
|
||||||
m_Bf = bf;
|
m_Bf = bf;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,11 @@
|
|||||||
#ifndef BATTLEFIELD_WG_
|
#ifndef BATTLEFIELD_WG_
|
||||||
#define BATTLEFIELD_WG_
|
#define BATTLEFIELD_WG_
|
||||||
|
|
||||||
#include "Battlefield.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "Group.h"
|
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
#include "Group.h"
|
||||||
|
#include "Battlefield.h"
|
||||||
|
|
||||||
const uint32 VehNumWorldState[2] = { 3680, 3490 };
|
const uint32 VehNumWorldState[2] = { 3680, 3490 };
|
||||||
const uint32 MaxVehNumWorldState[2] = { 3681, 3491 };
|
const uint32 MaxVehNumWorldState[2] = { 3681, 3491 };
|
||||||
@@ -46,50 +47,52 @@ typedef std::set<Group *> GroupSet;
|
|||||||
enum eWGItem
|
enum eWGItem
|
||||||
{
|
{
|
||||||
// *INDENT-OFF*
|
// *INDENT-OFF*
|
||||||
WG_MARK_OF_HONOR = 43589,
|
WG_MARK_OF_HONOR = 43589,
|
||||||
// *INDENT-ON*
|
// *INDENT-ON*
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eWGSpell
|
enum eWGSpell
|
||||||
{
|
{
|
||||||
// *INDENT-OFF*
|
// *INDENT-OFF*
|
||||||
// Wartime auras
|
// AWartime auras
|
||||||
SPELL_RECRUIT = 37795,
|
SPELL_RECRUIT = 37795,
|
||||||
SPELL_CORPORAL = 33280,
|
SPELL_CORPORAL = 33280,
|
||||||
SPELL_LIEUTENANT = 55629,
|
SPELL_LIEUTENANT = 55629,
|
||||||
SPELL_TENACITY = 58549,
|
SPELL_TENACITY = 58549,
|
||||||
SPELL_TENACITY_VEHICLE = 59911,
|
SPELL_TENACITY_VEHICLE = 59911,
|
||||||
SPELL_TOWER_CONTROL = 62064,
|
SPELL_TOWER_CONTROL = 62064,
|
||||||
SPELL_SPIRITUAL_IMMUNITY = 58729,
|
SPELL_SPIRITUAL_IMMUNITY = 58729,
|
||||||
SPELL_GREAT_HONOR = 58555,
|
SPELL_GREAT_HONOR = 58555,
|
||||||
SPELL_GREATER_HONOR = 58556,
|
SPELL_GREATER_HONOR = 58556,
|
||||||
SPELL_GREATEST_HONOR = 58557,
|
SPELL_GREATEST_HONOR = 58557,
|
||||||
SPELL_ALLIANCE_FLAG = 14268,
|
SPELL_ALLIANCE_FLAG = 14268,
|
||||||
SPELL_HORDE_FLAG = 14267,
|
SPELL_HORDE_FLAG = 14267,
|
||||||
|
|
||||||
// Reward spells
|
// Reward spells
|
||||||
SPELL_VICTORY_REWARD = 56902,
|
SPELL_VICTORY_REWARD = 56902,
|
||||||
SPELL_DEFEAT_REWARD = 58494,
|
SPELL_DEFEAT_REWARD = 58494,
|
||||||
SPELL_DAMAGED_TOWER = 59135,
|
SPELL_DAMAGED_TOWER = 59135,
|
||||||
SPELL_DESTROYED_TOWER = 59136,
|
SPELL_DESTROYED_TOWER = 59136,
|
||||||
SPELL_DAMAGED_BUILDING = 59201,
|
SPELL_DAMAGED_BUILDING = 59201,
|
||||||
SPELL_INTACT_BUILDING = 59203,
|
SPELL_INTACT_BUILDING = 59203,
|
||||||
|
|
||||||
SPELL_TELEPORT_BRIDGE = 59096,
|
SPELL_TELEPORT_BRIDGE = 59096,
|
||||||
SPELL_TELEPORT_FORTRESS = 60035,
|
SPELL_TELEPORT_FORTRESS = 60035,
|
||||||
|
|
||||||
SPELL_TELEPORT_DALARAN = 53360,
|
SPELL_TELEPORT_DALARAN = 53360,
|
||||||
SPELL_VICTORY_AURA = 60044,
|
SPELL_VICTORY_AURA = 60044,
|
||||||
|
|
||||||
// Other spells
|
// Other spells
|
||||||
SPELL_WINTERGRASP_WATER = 36444,
|
SPELL_WINTERGRASP_WATER = 36444,
|
||||||
|
SPELL_ESSENCE_OF_WINTERGRASP = 58045,
|
||||||
|
SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730,
|
||||||
|
|
||||||
// Phasing spells
|
// Phasing spells
|
||||||
SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617,// ADDS PHASE 32
|
SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618,// ADDS PHASE 16
|
||||||
SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618,// ADDS PHASE 16
|
SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617,// ADDS PHASE 32
|
||||||
|
|
||||||
SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773,// ADDS PHASE 64
|
SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773,// ADDS PHASE 64
|
||||||
SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774,// ADDS PHASE 128
|
SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774,// ADDS PHASE 128
|
||||||
|
|
||||||
// *INDENT-ON*
|
// *INDENT-ON*
|
||||||
};
|
};
|
||||||
@@ -195,6 +198,9 @@ enum eWGNpc
|
|||||||
BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108,
|
BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108,
|
||||||
BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054,
|
BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054,
|
||||||
BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109,
|
BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109,
|
||||||
|
|
||||||
|
NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp
|
||||||
|
NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
|
||||||
// *INDENT-ON*
|
// *INDENT-ON*
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -374,13 +380,13 @@ class BattlefieldWG : public Battlefield
|
|||||||
/// Say if player can click or not on orb (last door broken)
|
/// Say if player can click or not on orb (last door broken)
|
||||||
bool CanClickOnOrb()
|
bool CanClickOnOrb()
|
||||||
{
|
{
|
||||||
return m_bCanClickOnOrb;
|
return m_CanClickOnOrb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Define if player can click or not on orb (if last door broken)
|
/// Define if player can click or not on orb (if last door broken)
|
||||||
void AllowToClickOnOrb(bool allow)
|
void AllowToClickOnOrb(bool allow)
|
||||||
{
|
{
|
||||||
m_bCanClickOnOrb = allow;
|
m_CanClickOnOrb = allow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RewardMarkOfHonor(Player *plr, uint32 count);
|
void RewardMarkOfHonor(Player *plr, uint32 count);
|
||||||
@@ -399,8 +405,8 @@ class BattlefieldWG : public Battlefield
|
|||||||
void ProcessEvent(GameObject *obj, uint32 eventId);
|
void ProcessEvent(GameObject *obj, uint32 eventId);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_bCanClickOnOrb;
|
bool m_CanClickOnOrb;
|
||||||
GameObject *m_relic;
|
GameObject* m_relic;
|
||||||
GameObjectBuilding BuildingsInZone;
|
GameObjectBuilding BuildingsInZone;
|
||||||
GuidSet KeepCreature[2];
|
GuidSet KeepCreature[2];
|
||||||
GuidSet OutsideCreature[2];
|
GuidSet OutsideCreature[2];
|
||||||
@@ -1746,15 +1752,15 @@ struct BfWGGameObjectBuilding
|
|||||||
// Structure for the 6 workshop
|
// Structure for the 6 workshop
|
||||||
struct BfWGWorkShopData
|
struct BfWGWorkShopData
|
||||||
{
|
{
|
||||||
BattlefieldWG *m_WG; // Object du joug
|
BattlefieldWG* m_WG; // Object du joug
|
||||||
GameObject *m_Build;
|
GameObject* m_Build;
|
||||||
uint32 m_Type;
|
uint32 m_Type;
|
||||||
uint32 m_State; // For worldstate
|
uint32 m_State; // For worldstate
|
||||||
uint32 m_WorldState;
|
uint32 m_WorldState;
|
||||||
uint32 m_TeamControl; // Team witch control the workshop
|
uint32 m_TeamControl; // Team witch control the workshop
|
||||||
GuidSet m_CreatureOnPoint[2]; // Contain all Creature associate to this point
|
GuidSet m_CreatureOnPoint[2]; // Contain all Creature associate to this point
|
||||||
GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point
|
GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point
|
||||||
uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message
|
uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message
|
||||||
|
|
||||||
BfWGWorkShopData(BattlefieldWG * WG)
|
BfWGWorkShopData(BattlefieldWG * WG)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user