aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/master/2017_09_05_01_world_2016_10_08_00_world_335.sql39
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp164
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h3
-rw-r--r--src/server/scripts/Northrend/zone_wintergrasp.cpp51
4 files changed, 104 insertions, 153 deletions
diff --git a/sql/updates/world/master/2017_09_05_01_world_2016_10_08_00_world_335.sql b/sql/updates/world/master/2017_09_05_01_world_2016_10_08_00_world_335.sql
new file mode 100644
index 00000000000..40dcbe4bcf7
--- /dev/null
+++ b/sql/updates/world/master/2017_09_05_01_world_2016_10_08_00_world_335.sql
@@ -0,0 +1,39 @@
+--
+UPDATE `creature_template` SET `ScriptName`="npc_wg_guard" WHERE `entry` IN (30739, 30740);
+
+SET @GUID := 94920;
+DELETE FROM `creature` WHERE `guid` BETWEEN @GUID AND @GUID+17;
+INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `PhaseId`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `VerifiedBuild`) VALUES
+(@GUID , 30739, 571, 0, 0, 1, 175, 0, 1, 5150.27, 2786.02, 409.547, 3.22886, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+1 , 30739, 571, 0, 0, 1, 175, 0, 1, 5150.66, 2777.95, 409.405, 2.94961, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+2 , 30739, 571, 0, 0, 1, 175, 0, 1, 5193.63, 2734.17, 409.273, 4.69494, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+3 , 30739, 571, 0, 0, 1, 175, 0, 1, 5200.5, 2733.89, 409.273, 4.67748, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+4 , 30739, 571, 0, 0, 1, 175, 0, 1, 5264.65, 2670.19, 409.182, 3.07178, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+5 , 30739, 571, 0, 0, 1, 175, 0, 1, 5265.31, 2663.15, 409.182, 3.12414, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+6 , 30739, 571, 0, 0, 1, 175, 0, 1, 5307.02, 2613.9, 409.172, 4.69494, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+7 , 30739, 571, 0, 0, 1, 175, 0, 1, 5311.13, 3061.04, 408.81, 1.50098, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+8 , 30739, 571, 0, 0, 1, 175, 0, 1, 5315.87, 2614.22, 408.973, 4.67748, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+9 , 30739, 571, 0, 0, 1, 175, 0, 1, 5318.09, 3060.63, 408.883, 1.62316, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+10, 30739, 571, 0, 0, 1, 175, 0, 1, 5149.4, 2897.04, 409.304, 3.03687, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+11, 30739, 571, 0, 0, 1, 175, 0, 1, 5149.52, 2904.19, 409.276, 3.07178, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+12, 30739, 571, 0, 0, 1, 175, 0, 1, 5192.79, 2948.45, 409.275, 1.50098, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+13, 30739, 571, 0, 0, 1, 175, 0, 1, 5201.65, 2948.78, 409.275, 1.62316, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+14, 30739, 571, 0, 0, 1, 175, 0, 1, 5265.28, 3010.1, 408.896, 2.82743, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+15, 30739, 571, 0, 0, 1, 175, 0, 1, 5265.48, 3017.4, 408.583, 3.07178, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+16, 30739, 571, 0, 0, 1, 175, 0, 1, 5154.23, 2833.82, 409.262, 3.12414, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0),
+(@GUID+17, 30739, 571, 0, 0, 1, 175, 0, 1, 5154.12, 2847.89, 409.248, 3.07178, 180, 0, 0, 11001, 0, 0, 0, 0, 0, 0);
+
+UPDATE `creature` SET `curhealth`=11001, `spawntimesecs`=180 WHERE `id` IN (30739, 30740);
+DELETE FROM `creature_addon` WHERE `guid` IN (SELECT `guid` FROM `creature` WHERE `id` IN (30739, 30740));
+
+UPDATE `creature` SET `position_x`=5307.75, `position_y`=3008.87, `position_z`=409.193, `orientation`=4.78168 WHERE `guid`=131266;
+UPDATE `creature` SET `PhaseId`=175, `modelid`=0, `spawndist`=0, `MovementType`=0 WHERE `guid` IN (131261, 131266, 131258, 131262, 131259, 131260, 131269, 131264, 131839, 131267, 131263);
+
+DELETE FROM `creature` WHERE `guid`=12548;
+INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `PhaseId`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `VerifiedBuild`) VALUES
+(12548, 15351, 571, 0, 0, 1, 176, 15389, 0, 5467.59, 2841.06, 418.758, 1.39626, 180, 0, 0, 126000, 0, 0, 0, 0, 0, 0);
+
+DELETE FROM `creature_addon` WHERE `guid` IN (131839, 12548);
+INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES
+(131839, 0, 0, 0, 257, 0, ""),
+(12548, 0, 0, 0, 257, 0, "");
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
index abd92bb19d3..95a534124a9 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -66,9 +66,6 @@ QuaternionData const WintergraspRelicRot = { 0.f, 0.f, -0.7933531f, 0.6087617
uint8 const WG_MAX_OBJ = 32;
uint8 const WG_MAX_TURRET = 15;
-uint8 const WG_MAX_KEEP_NPC = 39;
-uint8 const WG_MAX_OUTSIDE_NPC = 14;
-uint8 const WG_OUTSIDE_ALLIANCE_NPC = 7;
uint8 const WG_MAX_TELEPORTER = 12;
uint8 const WG_MAX_WORKSHOP = 6;
uint8 const WG_MAX_TOWER = 7;
@@ -182,76 +179,6 @@ struct WintergraspObjectPositionData
uint32 AllianceEntry;
};
-// Here there is all npc keeper spawn point
-WintergraspObjectPositionData const WGKeepNPC[WG_MAX_KEEP_NPC] =
-{
- // X Y Z O horde alliance
- // North East
- { { 5326.203125f, 2660.026367f, 409.100891f, 2.543383f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
- { { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f }, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Blazefeather
- { { 5335.310059f, 2764.110107f, 409.274994f, 4.834560f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5349.810059f, 2763.629883f, 409.333008f, 4.660030f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- // North
- { { 5373.470215f, 2789.060059f, 409.322998f, 2.600540f }, BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR, BATTLEFIELD_WG_NPC_KNIGHT_DAMERON }, // Stone Guard Mukar
- { { 5296.560059f, 2789.870117f, 409.274994f, 0.733038f }, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA }, // Voodoo Master Fu'jin
- { { 5372.670000f, 2786.740000f, 409.442000f, 2.809980f }, BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI, BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER }, // Wintergrasp Quartermaster
- { { 5368.709961f, 2856.360107f, 409.322998f, 2.949610f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5367.910156f, 2826.520020f, 409.322998f, 3.333580f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5389.270020f, 2847.370117f, 418.759003f, 3.106690f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5388.560059f, 2834.770020f, 418.759003f, 3.071780f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5359.129883f, 2837.989990f, 409.364014f, 4.698930f }, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, // Commander Dardosh
- { { 5366.129883f, 2833.399902f, 409.322998f, 3.141590f }, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, // Tactical Officer Kilrath
- // X Y Z O horde alliance
- // North West
- { { 5350.680176f, 2917.010010f, 409.274994f, 1.466080f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5335.120117f, 2916.800049f, 409.444000f, 1.500980f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5295.560059f, 2926.669922f, 409.274994f, 0.872665f }, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE }, // Stronghoof
- { { 5371.399902f, 3026.510010f, 409.205994f, 3.250030f }, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA }, // Primalist Mulfort
- { { 5392.123535f, 3031.110352f, 409.187683f, 3.677212f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
- // South
- { { 5270.060059f, 2847.550049f, 409.274994f, 3.071780f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5270.160156f, 2833.479980f, 409.274994f, 3.124140f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5179.109863f, 2837.129883f, 409.274994f, 3.211410f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5179.669922f, 2846.600098f, 409.274994f, 3.089230f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5234.970215f, 2883.399902f, 409.274994f, 4.293510f }, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, // Lieutenant Murp
- // X Y Z O horde alliance
- // Portal guards (from around the fortress)
- { { 5319.209473f, 3055.947754f, 409.176636f, 1.020201f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5311.612305f, 3061.207275f, 408.734161f, 0.965223f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5264.713379f, 3017.283447f, 408.479706f, 3.482424f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5269.096191f, 3008.315918f, 408.826294f, 3.843706f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5201.414551f, 2945.096924f, 409.190735f, 0.945592f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5193.386230f, 2949.617188f, 409.190735f, 1.145859f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5148.116211f, 2904.761963f, 409.193756f, 3.368532f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5153.355957f, 2895.501465f, 409.199310f, 3.549174f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5154.353027f, 2787.349365f, 409.250183f, 2.555644f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5150.066406f, 2777.876953f, 409.343903f, 2.708797f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5193.706543f, 2732.882812f, 409.189514f, 4.845073f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5202.126953f, 2737.570557f, 409.189514f, 5.375215f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5269.181152f, 2671.174072f, 409.098999f, 2.457459f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5264.960938f, 2662.332520f, 409.098999f, 2.598828f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5307.111816f, 2616.006836f, 409.095734f, 5.355575f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
- { { 5316.770996f, 2619.430176f, 409.027740f, 5.363431f }, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard
-};
-
-WintergraspObjectPositionData const WGOutsideNPC[WG_MAX_OUTSIDE_NPC] =
-{
- { { 5032.04f, 3681.79f, 362.980f, 4.210f }, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 },
- { { 5020.71f, 3626.19f, 360.150f, 4.640f }, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 },
- { { 4994.85f, 3660.51f, 359.150f, 2.260f }, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, 0 },
- { { 5015.46f, 3677.11f, 362.970f, 6.009f }, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, 0 },
- { { 5031.12f, 3663.77f, 363.500f, 3.110f }, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, 0 },
- { { 5042.74f, 3675.82f, 363.060f, 3.358f }, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, 0 },
- { { 5014.45f, 3640.87f, 361.390f, 3.280f }, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, 0 },
- { { 5100.07f, 2168.89f, 365.779f, 1.972f }, 0, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH },
- { { 5081.70f, 2173.73f, 365.878f, 0.855f }, 0, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA },
- { { 5078.28f, 2183.70f, 365.029f, 1.466f }, 0, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH },
- { { 5088.49f, 2188.18f, 365.647f, 5.253f }, 0, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS },
- { { 5095.67f, 2193.28f, 365.924f, 4.939f }, 0, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE },
- { { 5088.61f, 2167.66f, 365.689f, 0.680f }, 0, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA },
- { { 5080.40f, 2199.00f, 359.489f, 2.967f }, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO },
-};
-
struct WintergraspGameObjectData
{
Position Pos;
@@ -564,38 +491,6 @@ bool BattlefieldWG::SetupBattlefield()
Workshops[i] = workshop;
}
- // Spawn NPCs in the defender's keep, both Horde and Alliance
- for (uint8 i = 0; i < WG_MAX_KEEP_NPC; ++i)
- {
- // Horde npc
- if (Creature* creature = SpawnCreature(WGKeepNPC[i].HordeEntry, WGKeepNPC[i].Pos))
- KeepCreature[TEAM_HORDE].push_back(creature->GetGUID());
-
- // Alliance npc
- if (Creature* creature = SpawnCreature(WGKeepNPC[i].AllianceEntry, WGKeepNPC[i].Pos))
- KeepCreature[TEAM_ALLIANCE].push_back(creature->GetGUID());
- }
-
- // Hide NPCs from the Attacker's team in the keep
- for (auto itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
- if (Creature* creature = GetCreature(*itr))
- HideNpc(creature);
-
- // Spawn Horde NPCs outside the keep
- for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; ++i)
- if (Creature* creature = SpawnCreature(WGOutsideNPC[i].HordeEntry, WGOutsideNPC[i].Pos))
- OutsideCreature[TEAM_HORDE].push_back(creature->GetGUID());
-
- // Spawn Alliance NPCs outside the keep
- for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; ++i)
- if (Creature* creature = SpawnCreature(WGOutsideNPC[i].AllianceEntry, WGOutsideNPC[i].Pos))
- OutsideCreature[TEAM_ALLIANCE].push_back(creature->GetGUID());
-
- // Hide units outside the keep that are defenders
- for (auto itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
- if (Creature* creature = GetCreature(*itr))
- HideNpc(creature);
-
// Spawn turrets and hide them per default
for (uint8 i = 0; i < WG_MAX_TURRET; i++)
{
@@ -773,27 +668,6 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
}
}
- if (!endByTimer) // One player triggered the relic
- {
- // Change all npc in keep
- for (auto itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
- if (Creature* creature = GetCreature(*itr))
- HideNpc(creature);
-
- for (auto itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
- if (Creature* creature = GetCreature(*itr))
- ShowNpc(creature, true);
-
- // Change all npc out of keep
- for (auto itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
- if (Creature* creature = GetCreature(*itr))
- HideNpc(creature);
-
- for (auto itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
- if (Creature* creature = GetCreature(*itr))
- ShowNpc(creature, true);
- }
-
// Update all graveyard, control is to defender when no wartime
for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++)
if (BfGraveyard* graveyard = GetGraveyardById(i))
@@ -1078,33 +952,11 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
if (killer == victim)
return;
- bool again = false;
- TeamId killerTeam = killer->GetTeamId();
-
if (victim->GetTypeId() == TYPEID_PLAYER)
- {
- for (auto itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
- if (Player* player = ObjectAccessor::FindPlayer(*itr))
- if (player->GetDistance2d(killer) < 40)
- PromotePlayer(player);
- return;
- }
+ HandlePromotion(killer, victim);
+
+ return;
- for (auto itr = KeepCreature[GetOtherTeam(killerTeam)].begin();
- itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr)
- {
- if (Creature* creature = GetCreature(*itr))
- {
- if (victim->GetEntry() == creature->GetEntry() && !again)
- {
- again = true;
- for (auto iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter)
- if (Player* player = ObjectAccessor::FindPlayer(*iter))
- if (player->GetDistance2d(killer) < 40.0f)
- PromotePlayer(player);
- }
- }
- }
/// @todoRecent PvP activity worldstate
}
@@ -1136,6 +988,16 @@ void BattlefieldWG::OnUnitDeath(Unit* unit)
UpdateVehicleCountWG();
}
+void BattlefieldWG::HandlePromotion(Player* playerKiller, Unit* unitKilled)
+{
+ uint32 teamId = playerKiller->GetTeamId();
+
+ for (auto iter = m_PlayersInWar[teamId].begin(); iter != m_PlayersInWar[teamId].end(); ++iter)
+ if (Player* player = ObjectAccessor::FindPlayer(*iter))
+ if (player->GetDistance2d(unitKilled) < 40.0f)
+ PromotePlayer(player);
+}
+
// Update rank for player
void BattlefieldWG::PromotePlayer(Player* killer)
{
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
index 5528be655e9..c855a392ad7 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.h
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -389,6 +389,7 @@ class TC_GAME_API BattlefieldWG : public Battlefield
void HandleKill(Player* killer, Unit* victim) override;
void OnUnitDeath(Unit* unit) override;
+ void HandlePromotion(Player* killer, Unit* killed);
void PromotePlayer(Player* killer);
void UpdateTenacity();
@@ -411,8 +412,6 @@ class TC_GAME_API BattlefieldWG : public Battlefield
GuidUnorderedSet m_vehicles[BG_TEAMS_COUNT];
GuidVector CanonList;
- GuidVector KeepCreature[BG_TEAMS_COUNT];
- GuidVector OutsideCreature[BG_TEAMS_COUNT];
uint32 m_tenacityStack;
uint32 m_saveTimer;
diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp
index d31344add7b..fae7663f00f 100644
--- a/src/server/scripts/Northrend/zone_wintergrasp.cpp
+++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp
@@ -487,6 +487,56 @@ class npc_wg_quest_giver : public CreatureScript
SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
+
+ struct npc_wg_quest_giverAI : public ScriptedAI
+ {
+ npc_wg_quest_giverAI(Creature* creature) : ScriptedAI(creature) { }
+
+ void JustDied(Unit* killer) override
+ {
+ if (killer->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ BattlefieldWG* wintergrasp = (BattlefieldWG*)sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return;
+
+ wintergrasp->HandlePromotion(killer->ToPlayer(), me);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_wg_quest_giverAI(creature);
+ }
+};
+
+class npc_wg_guard : public CreatureScript
+{
+public:
+ npc_wg_guard() : CreatureScript("npc_wg_guard") { }
+
+ struct npc_wg_guardAI : public ScriptedAI
+ {
+ npc_wg_guardAI(Creature* creature) : ScriptedAI(creature) { }
+
+ void JustDied(Unit* killer) override
+ {
+ if (killer->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ BattlefieldWG* wintergrasp = (BattlefieldWG*)sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return;
+
+ wintergrasp->HandlePromotion(killer->ToPlayer(), me);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_wg_guardAI(creature);
+ }
};
class spell_wintergrasp_force_building : public SpellScriptLoader
@@ -679,6 +729,7 @@ void AddSC_wintergrasp()
new npc_wg_demolisher_engineer();
new go_wg_vehicle_teleporter();
new npc_wg_quest_giver();
+ new npc_wg_guard();
new spell_wintergrasp_force_building();
new spell_wintergrasp_grab_passenger();
new achievement_wg_didnt_stand_a_chance();