-
-
Save mysterious-static/ffd41b55f0893d03ec8d3f38eedb8dfb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1247667c4f7a9dba28829eb2c88a81c7836773ef Mon Sep 17 00:00:00 2001 | |
From: tje3d <[email protected]> | |
Date: Thu, 28 Sep 2017 21:33:19 +0330 | |
Subject: [PATCH] wg_tena_teleporter_aura | |
--- | |
.../game/Battlefield/Zones/BattlefieldWG.cpp | 39 +++++++++++++++------- | |
src/server/game/Battlefield/Zones/BattlefieldWG.h | 4 ++- | |
src/server/scripts/Northrend/zone_wintergrasp.cpp | 2 +- | |
3 files changed, 31 insertions(+), 14 deletions(-) | |
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp | |
index 5ce33a0cdd..d9a43a0b71 100644 | |
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp | |
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp | |
@@ -437,6 +437,10 @@ void BattlefieldWintergrasp::OnBattleStart() | |
} | |
} | |
+ for (ObjectGuid teleGuid : _teleporterList) | |
+ if (GameObject* go = GetGameObject(teleGuid)) | |
+ go->SetFaction(WintergraspFaction[GetDefenderTeam()]); | |
+ | |
// rebuild | |
for (WintergraspBuilding* building : _buildingSet) | |
building->Rebuild(); | |
@@ -907,6 +911,9 @@ void BattlefieldWintergrasp::OnGameObjectCreate(GameObject* gameObject) | |
capturePoint->SetCapturePointData(gameObject); | |
} | |
break; | |
+ case GO_WINTERGRASP_VEHICLE_TELEPORTER: | |
+ _teleporterList.insert(gameObject->GetGUID()); | |
+ break; | |
default: | |
break; | |
} | |
@@ -914,6 +921,9 @@ void BattlefieldWintergrasp::OnGameObjectCreate(GameObject* gameObject) | |
void BattlefieldWintergrasp::OnGameObjectRemove(GameObject* gameObject) | |
{ | |
+ if (gameObject->GetEntry() == GO_WINTERGRASP_VEHICLE_TELEPORTER) | |
+ _teleporterList.erase(gameObject->GetGUID()); | |
+ | |
for (WintergraspBuilding* building : _buildingSet) | |
building->CleanRelatedObject(gameObject->GetGUID()); | |
} | |
@@ -1238,25 +1248,34 @@ void BattlefieldWintergrasp::UpdateTenacity() | |
{ | |
uint32 const alliancePlayers = _playersInWar[TEAM_ALLIANCE].size(); | |
uint32 const hordePlayers = _playersInWar[TEAM_HORDE].size(); | |
- int32 newStack = 0; | |
+ uint32 newStack = 0; | |
+ TeamId oldTeam = _tenacityTeam; | |
if (alliancePlayers && hordePlayers) | |
{ | |
if (alliancePlayers < hordePlayers) | |
- newStack = int32((float(hordePlayers) / float(alliancePlayers) - 1.f) * 4.f); // positive, should cast on alliance | |
+ { | |
+ _tenacityTeam = TEAM_ALLIANCE; | |
+ newStack = uint32((float(hordePlayers) / float(alliancePlayers) - 1.f) * 4.f); | |
+ } | |
else if (alliancePlayers > hordePlayers) | |
- newStack = int32((1.f - float(alliancePlayers) / float(hordePlayers)) * 4.f); // negative, should cast on horde | |
+ { | |
+ _tenacityTeam = TEAM_HORDE; | |
+ newStack = uint32((float(alliancePlayers) / float(hordePlayers) - 1.f) * 4.f); | |
+ } | |
+ else | |
+ _tenacityTeam = TEAM_NEUTRAL; | |
} | |
- if (newStack == int32(_tenacityStack)) | |
+ if (newStack == _tenacityStack) | |
return; | |
_tenacityStack = newStack; | |
// Remove old buff | |
- if (_tenacityTeam != TEAM_NEUTRAL) | |
+ if (oldTeam != TEAM_NEUTRAL) | |
{ | |
- for (auto itr = _players[_tenacityTeam].begin(); itr != _players[_tenacityTeam].end(); ++itr) | |
+ for (auto itr = _players[oldTeam].begin(); itr != _players[oldTeam].end(); ++itr) | |
{ | |
if (Player* player = ObjectAccessor::FindPlayer(*itr)) | |
{ | |
@@ -1267,7 +1286,7 @@ void BattlefieldWintergrasp::UpdateTenacity() | |
} | |
} | |
- for (auto itr = _vehicleSet[_tenacityTeam].begin(); itr != _vehicleSet[_tenacityTeam].end(); ++itr) | |
+ for (auto itr = _vehicleSet[oldTeam].begin(); itr != _vehicleSet[oldTeam].end(); ++itr) | |
{ | |
if (Creature* creature = GetCreature(*itr)) | |
{ | |
@@ -1280,10 +1299,8 @@ void BattlefieldWintergrasp::UpdateTenacity() | |
} | |
// Apply new buff | |
- if (newStack) | |
+ if (_tenacityStack) | |
{ | |
- _tenacityTeam = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE; | |
- | |
for (auto itr = _playersInWar[_tenacityTeam].begin(); itr != _playersInWar[_tenacityTeam].end(); ++itr) | |
if (Player* player = ObjectAccessor::FindPlayer(*itr)) | |
ApplyBuff(player, true); | |
@@ -1292,8 +1309,6 @@ void BattlefieldWintergrasp::UpdateTenacity() | |
if (Creature* creature = GetCreature(*itr)) | |
ApplyBuff(creature, false); | |
} | |
- else | |
- _tenacityTeam = TEAM_NEUTRAL; | |
} | |
void BattlefieldWintergrasp::ApplyBuff(Unit* target, bool type) const | |
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h | |
index c0ab73ba22..fbad22b183 100644 | |
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.h | |
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h | |
@@ -332,7 +332,8 @@ enum WintergraspGameObject | |
GO_WINTERGRASP_FORTRESS_GATE = 190375, | |
GO_WINTERGRASP_VAULT_GATE = 191810, | |
- GO_WINTERGRASP_KEEP_COLLISION_WALL = 194323 | |
+ GO_WINTERGRASP_KEEP_COLLISION_WALL = 194323, | |
+ GO_WINTERGRASP_VEHICLE_TELEPORTER = 192951 | |
}; | |
enum WintergraspQuests | |
@@ -465,6 +466,7 @@ class TC_GAME_API BattlefieldWintergrasp : public Battlefield | |
BuildingSet _buildingSet; | |
GuidUnorderedSet _vehicleSet[PVP_TEAMS_COUNT]; | |
GuidUnorderedSet _keepCannonList; | |
+ GuidUnorderedSet _teleporterList; | |
ObjectGuid _titansRelicGUID; | |
ObjectGuid _stalkerGUID; | |
TeamId _tenacityTeam; | |
diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp | |
index dec4817efd..7ed44a83c1 100644 | |
--- a/src/server/scripts/Northrend/zone_wintergrasp.cpp | |
+++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp | |
@@ -497,7 +497,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript | |
if (!vehicle->HasAura(SPELL_VEHICLE_TELEPORT)) | |
{ | |
if (Player* owner = vehicle->GetCharmerOrOwnerPlayerOrPlayerItself()) | |
- if ((me->GetFaction() == WintergraspFaction[TEAM_HORDE] && owner->GetFaction() == HORDE) || (me->GetFaction() == WintergraspFaction[TEAM_ALLIANCE] && owner->GetFaction() == ALLIANCE)) | |
+ if (me->GetFaction() == WintergraspFaction[owner->GetTeamId()]) | |
if (Creature* teleportTrigger = owner->SummonTrigger(me->GetPositionX() - 60.f, me->GetPositionY(), me->GetPositionZ() + 1.f, vehicle->GetOrientation(), 1000)) | |
return teleportTrigger; | |
} | |
-- | |
2.11.0 (Apple Git-81) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment