BF/Wintergrasp: Implemented better support for Wintergrasp phasing. It has been done by checking player's distance to the Caputre Point on every tick. Now it is performed using spell_area.
P.D: Reverted my last commit, it was wrong (my apologies)
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
SET @SPELL_HORDE := 56618;
|
||||
SET @SPELL_ALLIANCE := 56617;
|
||||
|
||||
SET @AREA_SUNKEN_RING := 4538;
|
||||
SET @AREA_BROKEN_TEMPLE := 4539;
|
||||
SET @AREA_W_WORKSHOP := 4611;
|
||||
SET @AREA_E_WORKSHOP := 4612;
|
||||
|
||||
DELETE FROM `spell_area` WHERE `spell` IN (@SPELL_HORDE, @SPELL_ALLIANCE);
|
||||
INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES
|
||||
(@SPELL_HORDE, @AREA_SUNKEN_RING, 1),
|
||||
(@SPELL_ALLIANCE, @AREA_SUNKEN_RING, 1),
|
||||
(@SPELL_HORDE, @AREA_BROKEN_TEMPLE, 1),
|
||||
(@SPELL_ALLIANCE, @AREA_BROKEN_TEMPLE, 1),
|
||||
(@SPELL_HORDE, @AREA_W_WORKSHOP, 1),
|
||||
(@SPELL_ALLIANCE, @AREA_W_WORKSHOP, 1),
|
||||
(@SPELL_HORDE, @AREA_E_WORKSHOP, 1),
|
||||
(@SPELL_ALLIANCE, @AREA_E_WORKSHOP, 1);
|
||||
|
||||
/*
|
||||
|
||||
Spell 56617 "Alliance Controls Factory Phase Shift" Adds Phase 32
|
||||
Spell 56618 "Horde Controls Factory Phase Shift" Adds Phase 16
|
||||
|
||||
@@ -27,3 +48,5 @@ Spells cast on vehicle as auras... or something (PET_SPELLS cooldowns):
|
||||
56866 (-Unknown-) (Catapult, Siege Engine.... NOT tower cannons)
|
||||
14268 (Alliance Flag) (Catapult, Siege Engine... NOT tower cannons)
|
||||
14267 (Horde Flag)
|
||||
|
||||
*/
|
||||
@@ -238,19 +238,6 @@ bool BattlefieldWG::Update(uint32 diff)
|
||||
|
||||
}
|
||||
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
for (BfCapturePointMap::iterator cp_itr = m_capturePoints.begin(); cp_itr != m_capturePoints.end(); ++cp_itr)
|
||||
{
|
||||
if ((*cp_itr).second->GetCapturePointGo()->GetExactDist2dSq(player) < 22500.0f) // 150*150
|
||||
{
|
||||
player->AddAura((*cp_itr).second->GetTeamId() == TEAM_HORDE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT, player);
|
||||
player->RemoveAurasDueToSpell((*cp_itr).second->GetTeamId() == TEAM_ALLIANCE ? SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT : SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return m_return;
|
||||
}
|
||||
|
||||
@@ -862,6 +849,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player)
|
||||
player->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
||||
player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
||||
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||
player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
||||
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||
player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
|
||||
player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP);
|
||||
@@ -882,6 +870,7 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player)
|
||||
player->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
||||
player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
||||
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||
player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
||||
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||
player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
|
||||
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||
@@ -901,6 +890,7 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player)
|
||||
player->RemoveAurasDueToSpell(SPELL_CORPORAL);
|
||||
player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
|
||||
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||
player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
|
||||
player->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||
player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
|
||||
player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
|
||||
@@ -913,6 +903,24 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player)
|
||||
SendInitWorldStatesTo(player);
|
||||
}
|
||||
|
||||
uint32 BattlefieldWG::GetData(uint32 data)
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
// Used to determine when the phasing spells must be casted
|
||||
// See: SpellArea::IsFitToRequirements
|
||||
case AREA_THE_SUNKEN_RING:
|
||||
case AREA_THE_BROKEN_TEMPLATE:
|
||||
case AREA_WESTPARK_WORKSHOP:
|
||||
case AREA_EASTPARK_WORKSHOP:
|
||||
// Graveyards and Workshops are controlled by the same team.
|
||||
if (m_GraveYardList[GetSpiritGraveyardId(data)])
|
||||
return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Method sending worldsate to player
|
||||
WorldPacket BattlefieldWG::BuildInitWorldStates()
|
||||
{
|
||||
|
||||
@@ -428,6 +428,8 @@ class BattlefieldWG : public Battlefield
|
||||
|
||||
// returns the graveyardId in the specified area.
|
||||
uint8 GetSpiritGraveyardId(uint32 areaId);
|
||||
|
||||
uint32 GetData(uint32 data);
|
||||
protected:
|
||||
bool m_CanClickOnOrb;
|
||||
GameObject* m_relic;
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "CreatureAI.h"
|
||||
#include "MapManager.h"
|
||||
#include "BattlegroundIC.h"
|
||||
#include "BattlefieldWG.h"
|
||||
#include "BattlefieldMgr.h"
|
||||
|
||||
bool IsPrimaryProfessionSkill(uint32 skill)
|
||||
{
|
||||
@@ -1145,6 +1147,26 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
|
||||
|
||||
return false;
|
||||
}
|
||||
case 56618: // Horde Controls Factory Phase Shift
|
||||
case 56617: // Alliance Controls Factory Phase Shift
|
||||
{
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId());
|
||||
|
||||
if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
|
||||
return false;
|
||||
|
||||
// team that controls the workshop in the specified area
|
||||
uint32 team = bf->GetData(newArea);
|
||||
|
||||
if (team == TEAM_HORDE)
|
||||
return spellId == 56618;
|
||||
else if (team == TEAM_ALLIANCE)
|
||||
return spellId == 56617;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user