aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Carrasco <manue.l@live.com.ar>2012-03-02 15:23:07 -0300
committerKandera <KanderaDev@gmail.com>2012-08-20 13:36:38 -0400
commit1f6eec4754f3fd8b6c74d19140010f4c057f0ddf (patch)
treefcc0cf25058285ece6c34f2eb23c2361c1c9eb7e
parentefcfdc4c397b12ddd0613cae74568e5df895c341 (diff)
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)
-rw-r--r--Wintergrasp_temp/Spells.sql (renamed from Wintergrasp_temp/Spells.txt)25
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp34
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h2
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp22
4 files changed, 69 insertions, 14 deletions
diff --git a/Wintergrasp_temp/Spells.txt b/Wintergrasp_temp/Spells.sql
index 583e46db04e..91719f47e4b 100644
--- a/Wintergrasp_temp/Spells.txt
+++ b/Wintergrasp_temp/Spells.sql
@@ -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
@@ -26,4 +47,6 @@ Spells cast on vehicle as auras... or something (PET_SPELLS cooldowns):
61178 (Grab Passenger) (Catapult, Siege Engine... NOT tower cannons)
56866 (-Unknown-) (Catapult, Siege Engine.... NOT tower cannons)
14268 (Alliance Flag) (Catapult, Siege Engine... NOT tower cannons)
-14267 (Horde Flag) \ No newline at end of file
+14267 (Horde Flag)
+
+*/
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
index b04b63d0312..3e64894a8ed 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -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()
{
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
index d95b1bdab85..94210dd3fd3 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.h
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -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;
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 93bb15d844b..1d929d00215 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -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;