TrinityCore
Loading...
Searching...
No Matches
battleground_silvershard_mines.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "Battleground.h"
19#include "BattlegroundScore.h"
20#include "BattlegroundScript.h"
21#include "Containers.h"
22#include "GameObject.h"
23#include "GameTime.h"
24#include "Map.h"
25#include "MotionMaster.h"
26#include "ObjectAccessor.h"
27#include "Player.h"
28#include "ScriptedCreature.h"
29#include "ScriptMgr.h"
30#include "SpellAuras.h"
31#include "SpellScript.h"
32#include "TaskScheduler.h"
33#include "TemporarySummon.h"
34
36{
37 namespace Actions
38 {
39 static constexpr uint32 MineCartCaptured = 1;
40 static constexpr uint32 TrackChanged = 2;
41 static constexpr uint32 MineCartControlChanged = 3;
42 static constexpr uint32 MineCartCapturedPlayer = 4;
43 }
44
45 namespace BroadcastTexts
46 {
47 static constexpr uint32 AllianceControlsMineCart = 60441;
48 static constexpr uint32 HordeControlsMineCart = 60442;
49
50 static constexpr uint32 EasternCrossroadsChangedTracks = 60030;
51 static constexpr uint32 NorthernCrossroadsChangedTracks = 60032;
52 }
53
54 namespace Creatures
55 {
56 static constexpr uint32 MineCart = 60140;
57
58 static constexpr uint32 MineCartCosmetic1 = 60379;
59 static constexpr uint32 MineCartCosmetic2 = 60378;
60 static constexpr uint32 MineCartCosmetic3 = 60380;
61
62 static constexpr std::array<std::pair<uint32, double>, 3> CosmeticCarts =
63 {{
64 { MineCartCosmetic1, 1.0 },
65 { MineCartCosmetic2, 0.05 },
66 { MineCartCosmetic3, 0.05 }
67 }};
68 }
69
70 namespace CreatureTexts::MineCart
71 {
72 static constexpr uint32 Spawned = 1;
73 static constexpr uint32 CapturedByAlliance = 2;
74 static constexpr uint32 CapturedByHorde = 3;
75 }
76
77 namespace Events
78 {
79 static constexpr uint32 ProgressEventHordeEast = 32909;
80 static constexpr uint32 ProgressEventAllianceEast = 32910;
81 static constexpr uint32 ProgressEventNeutralEast = 32912;
82
83 static constexpr uint32 ProgressEventHordeNorth = 31167;
84 static constexpr uint32 ProgressEventAllianceNorth = 31166;
85
86 static constexpr uint32 ProgressEventHordeSouth = 32937;
87 static constexpr uint32 ProgressEventAllianceSouth = 32938;
88 static constexpr uint32 ProgressEventNeutralSouth = 32951;
89 }
90
91 namespace GameObjects
92 {
93 static constexpr uint32 Gate1 = 212939;
94 static constexpr uint32 Gate2 = 212940;
95 static constexpr uint32 Gate3 = 212941;
96 static constexpr uint32 Gate4 = 212942;
97
98 }
99
100 namespace Maps
101 {
102 static constexpr uint32 BattlegroundMap = 727;
103 }
104
105 namespace PathIds
106 {
107 static constexpr uint32 South = Creatures::MineCart * 100 + 0;
108 static constexpr uint32 SouthEnd = Creatures::MineCart * 100 + 1;
109
110 static constexpr uint32 North = Creatures::MineCart * 100 + 2;
111 static constexpr uint32 NorthEast = Creatures::MineCart * 100 + 3;
112 static constexpr uint32 NorthEastEnd = Creatures::MineCart * 100 + 4;
113 static constexpr uint32 NorthWest = Creatures::MineCart * 100 + 5;
114 static constexpr uint32 NorthWestEnd = Creatures::MineCart * 100 + 6;
115
116 static constexpr uint32 East = Creatures::MineCart * 100 + 7;
117 static constexpr uint32 EastSouth = Creatures::MineCart * 100 + 8;
118 static constexpr uint32 EastSouthEnd = Creatures::MineCart * 100 + 9;
119 static constexpr uint32 EastNorth = Creatures::MineCart * 100 + 10;
120 static constexpr uint32 EastNorthEnd = Creatures::MineCart * 100 + 11;
121
125 }
126
127 namespace PvpStats
128 {
129 static constexpr uint32 CartsCaptured = 428;
130 }
131
132 namespace Score
133 {
134 static constexpr uint32 Max = 1500;
135 static constexpr uint32 Capture = 150;
136 }
137
138 namespace SpawnPositions
139 {
140 static constexpr Position MineCartSouth = { 739.29517f, 203.76389f, 319.54398f, 2.261440753936767578f };
141 static constexpr Position MineCartEast = { 744.5174f, 183.19792f, 319.54395f, 4.338116168975830078f };
142 static constexpr Position MineCartNorth = { 759.32465f, 198.3316f, 319.53058f, 0.421508282423019409f };
143
144 static constexpr std::array<std::pair<uint32, Position>, 3> CosmeticCartsSpawnPositions =
145 { {
146 { PathIds::CosmeticCart1, { 735.7135f, 293.2292f, 398.70938f } },
147 { PathIds::CosmeticCart2, { 580.17706f, 305.46524f, 395.6946f } },
148 { PathIds::CosmeticCart3, { 1117.7551f, 285.7205f, 389.8406f } }
149 }};
150 }
151
152 namespace Spells
153 {
154 static constexpr uint32 ControlVisualNeutral = 118001;
155 static constexpr uint32 ControlVisualHorde = 116085;
156 static constexpr uint32 ControlVisualAlliance = 116086;
157
158 static constexpr uint32 CartControlCapturePointUnitEast = 125620;
159 static constexpr uint32 CartControlCapturePointUnitNorth = 125695;
160 static constexpr uint32 CartControlCapturePointUnitSouth = 125696;
161
162 static constexpr uint32 DefendingCartAura = 128646; // triggers 128648
163
164 static constexpr uint32 CartCap = 115904;
165
166 static constexpr uint32 Capturing = 124492;
167
168 static constexpr uint32 TrackSwitchVisualOpened = 120228;
169 static constexpr uint32 TrackSwitchVisualClosed = 120229;
170
171 // Achievements
172
173 // Mine Cart Courier
174 // Capture a mine cart using each of the 5 sets of tracks in a single match
175 static constexpr uint32 MineCartCourierEastSouth = 128702;
176 static constexpr uint32 MineCartCourierEastNorth = 128703;
177 static constexpr uint32 MineCartCourierNorthWest = 128706;
178 static constexpr uint32 MineCartCourierNorthEast = 128705;
179 static constexpr uint32 MineCartCourierSouth = 128704;
180
181 // End of the Line
182 // Seize control of a mine that is controlled by the opposing team within 20yards of the depot, and then capture it
183 static constexpr uint32 EndOfTheLineAchievementCheck = 128720;
184
185 // The Long Riders
186 // Escort a mine from its spawn to a depot and capture it without losing control
187 static constexpr uint32 LongRiderAchievementEastAlliance = 128672;
188 static constexpr uint32 LongRiderAchievementEastHorde = 128668;
189 static constexpr uint32 LongRiderAchievementNorthAlliance = 128673;
190 static constexpr uint32 LongRiderAchievementNorthHorde = 128669;
191 static constexpr uint32 LongRiderAchievementSouthAlliance = 128674;
192 static constexpr uint32 LongRiderAchievementSouthHorde = 128670;
193
194 // Five for Five
195 // Capture five mine carts in a single Silvershard Mines battle without dying
196 static constexpr uint32 ThreeForThreeComplete = 128650;
197 }
198
199 namespace StringIds
200 {
201 static constexpr std::string_view MineDepot = "bg_silvershard_mine_depot";
202 static constexpr std::string_view TrackSwitchEast = "bg_silvershard_mines_track_switch_east";
203 static constexpr std::string_view TrackSwitchNorth = "bg_silvershard_mines_track_switch_north";
204 }
205
206 namespace WorldStates
207 {
208 static constexpr int32 EasternCrossroadsTrackSwitchState = 6467; // 1 (closed) or 2 (open)
209 static constexpr int32 NorthernCrossroadsTrackSwitchState = 6468; // 1 (closed) or 2 (open)
210
211 static constexpr int32 AllianceTeamScore = 6437;
212 static constexpr int32 HordeTeamScore = 6438;
213
214 static constexpr int32 HordeControlsSouthCart = 6882;
215 static constexpr int32 AllianceControlsSouthCart = 6881;
216
217 static constexpr int32 HordeControlsNorthCart = 6879;
218 static constexpr int32 AllianceControlsNorthCart = 6880;
219
220 static constexpr int32 HordeControlsEastCart = 6440;
221 static constexpr int32 AllianceControlsEastCart = 6439;
222
225
226 // My Diamonds and Your Rust
227 // Win a Silvershard Mines battle without letting the enemy team capture a mine cart
228 // WSE: 12385, "(WorldState(6954) + WorldState(6955)) == 1")
229 // values might be swapped, they are not send to client
230 static constexpr int32 AllianceCapturedMineCart = 6954;
231 static constexpr int32 HordeCapturedMineCart = 6955;
232 }
233
235 {
236 Closed = 1,
237 Open
238 };
239}
240
242{
244
245 void OnInit() override
246 {
247 // setup spawning of cosmetic carts
248 _scheduler.Schedule(5s, [&](TaskContext& context)
249 {
250 for (auto const& [pathId, spawnPosition] : SilvershardMines::SpawnPositions::CosmeticCartsSpawnPositions)
251 {
252 auto const& [entry, weight] = *Trinity::Containers::SelectRandomWeightedContainerElement(SilvershardMines::Creatures::CosmeticCarts, [](std::pair<uint32, double> const& pair)
253 {
254 return pair.second;
255 });
256
257 if (Creature* creature = battlegroundMap->SummonCreature(entry, spawnPosition))
258 creature->GetMotionMaster()->MovePath(pathId, false);
259 }
260
261 context.Repeat();
262 });
263 }
264
265 void OnUpdate(uint32 diff) override
266 {
268 _scheduler.Update(diff);
269 }
270
277
278 void OnStart() override
279 {
281 for (ObjectGuid door : _doors)
282 {
283 if (GameObject* gameObject = battlegroundMap->GetGameObject(door))
284 {
285 gameObject->UseDoorOrButton();
286 gameObject->DespawnOrUnsummon(3s);
287 }
288 }
289
291 _scheduler.Schedule(2s, [&](TaskContext& context)
292 {
293 uint32 const underAllianceControl = std::ranges::count_if(SilvershardMines::WorldStates::AllianceControlWorldStates, [&](int32 worldState)
294 {
295 return battlegroundMap->GetWorldStateValue(worldState) == 1;
296 });
297
298 uint32 const underHordeControl = std::ranges::count_if(SilvershardMines::WorldStates::HordeControlWorldStates, [&](int32 worldState)
299 {
300 return battlegroundMap->GetWorldStateValue(worldState) == 1;
301 });
302
303 uint32 const hordeScoreToAdd = std::min<uint32>(SilvershardMines::Score::Max - battleground->GetTeamScore(TEAM_HORDE), underHordeControl);
304 uint32 const allianceScoreToAdd = std::min<uint32>(SilvershardMines::Score::Max - battleground->GetTeamScore(TEAM_ALLIANCE), underAllianceControl);
305
306 battleground->AddPoint(HORDE, hordeScoreToAdd);
307 battleground->AddPoint(ALLIANCE, allianceScoreToAdd);
308
310 if (!CheckWinner())
311 context.Repeat();
312 });
313 }
314
339
340 void DoAction(uint32 actionId, WorldObject* source, WorldObject* target) override
341 {
342 BattlegroundScript::DoAction(actionId, source, target);
343
344 switch (actionId)
345 {
348 break;
351 break;
354 break;
355 default:
356 break;
357 }
358 }
359
360 void OnGameObjectCreate(GameObject* gameobject) override
361 {
363
364 switch (gameobject->GetEntry())
365 {
370 _doors.push_back(gameobject->GetGUID());
371 break;
372 default:
373 break;
374 }
375 }
376
384
385 void HandleProgressEvent(GameObject const* controlZone, Team team, ChatMsg msgType = CHAT_MSG_ADDON, uint32 broadcastTextId = 0, uint32 visualSpellId = 0) const
386 {
387 if (!controlZone)
388 return;
389
390 Creature* mineCart = Object::ToCreature(controlZone->GetOwner());
391 if (!mineCart)
392 return;
393
397 mineCart->CastSpell(mineCart, visualSpellId, true);
398 UpdateCartWorldStates(controlZone);
399
400 if (team == TEAM_OTHER)
401 return;
402
403 battleground->SendBroadcastText(broadcastTextId, msgType, controlZone);
405
406 for (ObjectGuid const& guid : *controlZone->GetInsidePlayers())
407 if (Player* player = ObjectAccessor::FindPlayer(guid))
408 if (player->GetBGTeam() == team)
410 }
411
413 {
415 {
416 creature->GetMotionMaster()->MovePath(SilvershardMines::PathIds::South, false);
417 creature->CastSpell(creature, SilvershardMines::Spells::CartControlCapturePointUnitSouth, true);
418 }
419 }
420
422 {
424 {
425 creature->GetMotionMaster()->MovePath(SilvershardMines::PathIds::East, false);
426 creature->CastSpell(creature, SilvershardMines::Spells::CartControlCapturePointUnitEast, true);
427 }
428 }
429
431 {
433 {
434 creature->GetMotionMaster()->MovePath(SilvershardMines::PathIds::North, false);
435 creature->CastSpell(creature, SilvershardMines::Spells::CartControlCapturePointUnitNorth, true);
436 }
437 }
438
463
469
470 void OnMineCartCaptured(Creature const* mineCart)
471 {
472 if (!mineCart)
473 return;
474
475 GameObject* controlZone = nullptr;
477 {
481
482 _scheduler.Schedule(5s, [&](TaskContext const&)
483 {
485 });
486 }
488 {
492
493 _scheduler.Schedule(5s, [&](TaskContext const&)
494 {
496 });
497 }
499 {
503
504 _scheduler.Schedule(5s, [&](TaskContext const&)
505 {
507 });
508 }
509
510 if (!controlZone || controlZone->GetControllingTeam() == TEAM_NEUTRAL)
511 return;
512
514 if (controlZone->GetControllingTeam() == TEAM_HORDE)
515 {
518 {
519 battleground->AddPoint(HORDE, scoreToAdd);
521 CheckWinner();
522 }
523 }
524 else if (controlZone->GetControllingTeam() == TEAM_ALLIANCE)
525 {
528 {
529 battleground->AddPoint(ALLIANCE, scoreToAdd);
531 CheckWinner();
532 }
533 }
534 }
535
537 {
538 if (!player)
539 return;
540
541 if (_capturedMineCartsByPlayer.contains(player->GetGUID()))
543 else
544 _capturedMineCartsByPlayer[player->GetGUID()] = 1;
545
547 if (!score)
548 return;
549
550 if (score->GetDeaths() && _capturedMineCartsByPlayer[player->GetGUID()] >= 5)
552 }
553
554 void OnTrackSwitched(Player const* invoker, Creature* trackSwitch) const
555 {
556 if (!invoker || !trackSwitch)
557 return;
558
559 int32 worldStateId = 0;
560 int32 broadcastTextId = 0;
562 {
565 }
567 {
570 }
571
572 if (!worldStateId)
573 return;
574
575 uint32 const currentState = trackSwitch->GetMap()->GetWorldStateValue(worldStateId);
577 {
580 trackSwitch->CastSpell(trackSwitch, SilvershardMines::Spells::TrackSwitchVisualOpened, true);
581 }
583 {
586 trackSwitch->CastSpell(trackSwitch, SilvershardMines::Spells::TrackSwitchVisualClosed, true);
587 }
588
589 if (broadcastTextId)
591 }
592
593 bool CheckWinner() const
594 {
596 return true;
597
598 uint32 const hordeScore = battleground->GetTeamScore(TEAM_HORDE);
599 uint32 const allianceScore = battleground->GetTeamScore(TEAM_ALLIANCE);
600 if (hordeScore >= SilvershardMines::Score::Max || allianceScore >= SilvershardMines::Score::Max)
601 {
603
604 if (hordeScore >= SilvershardMines::Score::Max && allianceScore >= SilvershardMines::Score::Max)
605 {
607 return true;
608 }
609
610 if (hordeScore >= SilvershardMines::Score::Max)
611 {
613 return true;
614 }
615
616 if (allianceScore >= SilvershardMines::Score::Max)
617 {
619 return true;
620 }
621 }
622
623 return false;
624 }
625private:
628 std::unordered_map<ObjectGuid, uint16> _capturedMineCartsByPlayer;
629};
630
631// 60140 - Mine Cart
633{
634public:
636
637 void UpdateAI(uint32 diff) override
638 {
639 _scheduler.Update(diff);
640 }
641
642 void JustAppeared() override
643 {
646
647 // give a bit of grace time for The Long Rider achievement (guessed behaviour)
648 _scheduler.Schedule(2s, [&](TaskContext& context)
649 {
651
652 // initialize the long riders eligible players
653 DoForPlayersInControlZone([&](GameObject const* controlZone, Player const* player)
654 {
655 if (controlZone->GetControllingTeam() == GetTeamIdForTeam(player->GetBGTeam()))
656 _theLongRidersPlayers.insert(player->GetGUID());
657 });
658
659 // each second, check if eligible players are still inside
660 context.Schedule(1s, [&](TaskContext& context2)
661 {
662 if (GameObject const* controlZone = GetControlZone())
663 {
664 GuidUnorderedSet currentPlayers = *controlZone->GetInsidePlayers();
665 GuidSet theLongRidersPlayers;
666 std::ranges::set_intersection(_theLongRidersPlayers, currentPlayers, std::inserter(theLongRidersPlayers, theLongRidersPlayers.begin()));
667 _theLongRidersPlayers = std::move(theLongRidersPlayers);
668 }
669
670 context2.Repeat();
671 });
672 });
673 }
674
675 void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
676 {
677 switch (pathId)
678 {
681 break;
687 break;
690 break;
693 break;
699 break;
702 break;
705 break;
711 HandleCapture(pathId);
712 break;
713 default:
714 break;
715 }
716 }
717
718 template <std::invocable<GameObject const*, Player*> Action>
719 void DoForPlayersInControlZone(Action const& fn) const
720 {
721 if (GameObject const* controlZone = GetControlZone())
722 for (ObjectGuid const& playerGuid : *controlZone->GetInsidePlayers())
723 if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
724 fn(controlZone, player);
725 }
726
727 void HandleCapture(uint32 pathId) const
728 {
729 if (uint32 const mineCartCourierSpell = GetMineCartCourierSpell(pathId))
730 {
731 DoForPlayersInControlZone([&](GameObject const* controlZone, Player* player)
732 {
733 if (GetTeamIdForTeam(player->GetBGTeam()) == controlZone->GetControllingTeam())
734 {
735 player->CastSpell(player, mineCartCourierSpell, true);
736 if (controlZone->GetControllingTeam() == _endOfTheLineTeam)
737 player->CastSpell(player, SilvershardMines::Spells::EndOfTheLineAchievementCheck, true);
738 }
739 });
740 }
741
743 {
744 DoForPlayersInControlZone([&](GameObject const* controlZone, Player* player)
745 {
746 if (GetTeamIdForTeam(player->GetBGTeam()) == controlZone->GetControllingTeam() && controlZone->GetControllingTeam() == _endOfTheLineTeam)
748 });
749 }
750
751 if (uint32 const longRiderSpell = GetTheLongRiderAchievementSpell(pathId))
752 {
753 time_t controlAuraApplyTime = GameTime::GetGameTime();
754
756 controlAuraApplyTime = aura->GetApplyTime();
758 controlAuraApplyTime = aura->GetApplyTime();
759
760 if (controlAuraApplyTime <= _theLongRidersSpawnTime)
761 for (ObjectGuid const& playerGuid : _theLongRidersPlayers)
762 if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
763 player->CastSpell(player, longRiderSpell, true);
764 }
765
766 DoForPlayersInControlZone([&](GameObject const* controlZone, Player* player)
767 {
768 if (GetTeamIdForTeam(player->GetBGTeam()) != controlZone->GetControllingTeam())
769 return;
770
771 if (ZoneScript* zs = me->GetZoneScript())
773 });
774
776 }
777
796
820
821 void DoAction(int32 actionId) override
822 {
824 return;
825
826 if (me->FindNearestGameObjectWithOptions(20.0f, { .StringId = SilvershardMines::StringIds::MineDepot }))
827 if (GameObject const* controlZone = GetControlZone())
828 _endOfTheLineTeam = controlZone->GetControllingTeam();
829 }
830
844
845private:
850};
851
852// 115904 - Cart Cap
854{
855 void HandleScript(SpellEffIndex /*effIndex*/) const
856 {
857 Creature* hitCreature = GetHitCreature();
858 if (!hitCreature)
859 return;
860
861 if (ZoneScript* zoneScript = hitCreature->GetZoneScript())
862 zoneScript->DoAction(SilvershardMines::Actions::MineCartCaptured, hitCreature, hitCreature);
863
864 if (GameObject* depot = hitCreature->FindNearestGameObjectWithOptions(15.0f, { .StringId = SilvershardMines::StringIds::MineDepot }))
865 depot->ActivateObject(GameObjectActions::Open, 0, hitCreature);
866
867 hitCreature->DespawnOrUnsummon();
868 }
869
874};
875
876// 124491 - capturing
878{
879 bool Validate(SpellInfo const* /*spellInfo*/) override
880 {
882 }
883
884 void HandleScript(SpellEffIndex /*effIndex*/) const
885 {
886 if (Player* player = GetHitPlayer())
887 player->CastSpell(player, SilvershardMines::Spells::Capturing);
888 }
889
894};
895
896// 97372 - Capturing
898{
903
904 void HandleScript(SpellEffIndex /*effIndex*/) const
905 {
906 Creature* hitCreature = GetHitCreature();
907 if (!hitCreature)
908 return;
909
910 if (ZoneScript* zoneScript = hitCreature->GetZoneScript())
911 zoneScript->DoAction(SilvershardMines::Actions::TrackChanged, GetCaster(), hitCreature);
912 }
913
918};
919
920// 60379, 60378, 60380 - Mine Cart
922{
923public:
925
926 void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
927 {
928 switch (pathId)
929 {
933 me->DespawnOrUnsummon(500ms);
934 break;
935 default:
936 break;
937 }
938 }
939};
940
@ STATUS_WAIT_LEAVE
@ STATUS_IN_PROGRESS
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition ObjectGuid.h:435
std::set< ObjectGuid > GuidSet
Definition ObjectGuid.h:432
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:434
Spells
Definition PlayerAI.cpp:32
#define RegisterBattlegroundMapScript(script_name, mapId)
Definition ScriptMgr.h:1447
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
constexpr TeamId GetTeamIdForTeam(Team team)
@ TEAM_NEUTRAL
@ TEAM_ALLIANCE
@ TEAM_HORDE
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TEAM_OTHER
@ ALLIANCE
@ HORDE
ChatMsg
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
@ CHAT_MSG_ADDON
@ CHAT_MSG_BG_SYSTEM_HORDE
@ CHAT_MSG_BG_SYSTEM_NEUTRAL
#define SpellEffectFn(F, I, N)
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition Util.h:565
Creatures
void AddSC_battleground_silvershard_mines()
Action
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
Battleground * battleground
BattlegroundMap * battlegroundMap
virtual void OnPrepareStage2()
virtual void OnUpdate(uint32 diff)
void UpdateWorldState(int32 worldStateId, int32 value, bool hidden=false) const
uint32 GetTeamScore(TeamId teamId) const
void UpdateWorldState(int32 worldStateId, int32 value, bool hidden=false)
virtual void EndBattleground(Team winner)
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
BattlegroundScore const * GetBattlegroundScore(Player *player) const
BattlegroundStatus GetStatus() const
void AddPoint(Team team, uint32 points=1)
void UpdatePvpStat(Player *player, uint32 pvpStatId, uint32 value)
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool HasStringId(std::string_view id) const
CreatureAI * AI() const
Definition Creature.h:228
GuidUnorderedSet const * GetInsidePlayers() const
TeamId GetControllingTeam() const
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, Milliseconds duration=0ms, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty, SmoothPhasingInfo const *smoothPhasingInfo=nullptr)
Definition Object.cpp:1186
void SetWorldStateValue(int32 worldStateId, int32 value, bool hidden)
Definition Map.cpp:435
int32 GetWorldStateValue(int32 worldStateId) const
Definition Map.cpp:427
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3552
void MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Player * ToPlayer()
Definition Object.h:126
GameObject * ToGameObject()
Definition Object.h:131
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
Team GetBGTeam() const
Definition Player.cpp:24358
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Creature * GetHitCreature() const
Player * GetHitPlayer() const
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
TaskContext & Schedule(TaskScheduler::duration_t time, TaskScheduler::task_handler_t task)
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
virtual void DoAction(int32 param)
Definition UnitAI.h:73
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
GameObject * GetGameObject(uint32 spellId) const
Definition Unit.cpp:5341
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4700
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
Map * GetMap() const
Definition Object.h:411
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
Unit * GetOwner() const
Definition Object.cpp:1598
ZoneScript * GetZoneScript() const
Definition Object.h:417
GameObject * FindNearestGameObjectWithOptions(float range, FindGameObjectOptions const &options) const
Definition Object.cpp:1548
virtual void DoAction(uint32 actionId, WorldObject *source=nullptr, WorldObject *target=nullptr)
Definition ZoneScript.h:104
virtual void OnCreatureCreate(Creature *)
Definition ZoneScript.h:76
virtual void ProcessEvent(WorldObject *obj, uint32 eventId, WorldObject *invoker)
Definition ZoneScript.h:103
virtual void OnGameObjectCreate(GameObject *)
Definition ZoneScript.h:79
void WaypointPathEnded(uint32, uint32 pathId) override
uint32 GetTheLongRiderAchievementSpell(uint32 pathId) const
time_t GetGameTime()
Definition GameTime.cpp:52
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
static constexpr std::array< std::pair< uint32, double >, 3 > CosmeticCarts
static constexpr uint32 ProgressEventAllianceNorth
static constexpr uint32 ProgressEventAllianceEast
static constexpr uint32 ProgressEventNeutralEast
static constexpr uint32 ProgressEventHordeNorth
static constexpr uint32 ProgressEventHordeSouth
static constexpr uint32 ProgressEventNeutralSouth
static constexpr uint32 ProgressEventAllianceSouth
static constexpr uint32 ProgressEventHordeEast
static constexpr std::array< std::pair< uint32, Position >, 3 > CosmeticCartsSpawnPositions
static constexpr uint32 TrackSwitchVisualClosed
static constexpr uint32 MineCartCourierNorthWest
static constexpr uint32 CartControlCapturePointUnitSouth
static constexpr uint32 LongRiderAchievementSouthAlliance
static constexpr uint32 CartControlCapturePointUnitEast
static constexpr uint32 LongRiderAchievementEastAlliance
static constexpr uint32 EndOfTheLineAchievementCheck
static constexpr uint32 LongRiderAchievementEastHorde
static constexpr uint32 LongRiderAchievementSouthHorde
static constexpr uint32 MineCartCourierEastSouth
static constexpr uint32 MineCartCourierEastNorth
static constexpr uint32 LongRiderAchievementNorthHorde
static constexpr uint32 MineCartCourierNorthEast
static constexpr uint32 LongRiderAchievementNorthAlliance
static constexpr uint32 TrackSwitchVisualOpened
static constexpr uint32 CartControlCapturePointUnitNorth
static constexpr std::string_view MineDepot
static constexpr std::string_view TrackSwitchEast
static constexpr std::string_view TrackSwitchNorth
static constexpr std::array< int32, 3 > HordeControlWorldStates
static constexpr std::array< int32, 3 > AllianceControlWorldStates
auto SelectRandomWeightedContainerElement(C const &container, std::span< double > const &weights) -> decltype(std::ranges::begin(container))
Definition Containers.h:127
uint32 GetDeaths() const
std::unordered_map< ObjectGuid, uint16 > _capturedMineCartsByPlayer
void HandleProgressEvent(GameObject const *controlZone, Team team, ChatMsg msgType=CHAT_MSG_ADDON, uint32 broadcastTextId=0, uint32 visualSpellId=0) const
void OnCreatureCreate(Creature *creature) override
void OnGameObjectCreate(GameObject *gameobject) override
void OnMineCartCaptured(Creature const *mineCart)
void ProcessEvent(WorldObject *obj, uint32 eventId, WorldObject *invoker) override
void UpdateCartWorldStates(GameObject const *controlZone) const
void OnTrackSwitched(Player const *invoker, Creature *trackSwitch) const
void DoAction(uint32 actionId, WorldObject *source, WorldObject *target) override