TrinityCore
Loading...
Searching...
No Matches
ScriptMgr.h
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#ifndef SC_SCRIPTMGR_H
19#define SC_SCRIPTMGR_H
20
21#include "Common.h"
22#include "ObjectGuid.h"
23#include "Tuples.h"
24#include <boost/preprocessor/punctuation/remove_parens.hpp>
25#include <memory>
26#include <vector>
27
28class AccountMgr;
29class AreaTrigger;
30class AreaTriggerAI;
32class Aura;
33class AuraScript;
34class Battlefield;
35class Battleground;
36class BattlegroundMap;
38class Channel;
39class Conversation;
40class ConversationAI;
41class Creature;
42class CreatureAI;
43class DynamicObject;
44class GameObject;
45class GameObjectAI;
46class Guild;
47class Group;
48class InstanceMap;
49class InstanceScript;
50class Item;
51class Map;
52class ModuleReference;
53class OutdoorPvP;
54class Player;
55class Quest;
56class ScriptMgr;
57class Spell;
58class SpellInfo;
59class SpellScript;
61class Transport;
62class Unit;
63class Vehicle;
64class Weather;
65class WorldPacket;
66class WorldSocket;
67class WorldObject;
68class WorldSession;
69
70struct AchievementEntry;
71struct AreaTriggerEntry;
72struct AuctionPosting;
74struct Condition;
75struct CreatureTemplate;
76struct CreatureData;
77struct ItemTemplate;
78struct MapEntry;
79struct PlayerChoice;
81struct Position;
82struct QuestObjective;
83struct SceneTemplate;
85
86namespace Trinity::ChatCommands { struct ChatCommandBuilder; }
87
89enum Difficulty : int16;
91enum Emote : uint32;
92enum QuestStatus : uint8;
93enum RemoveMethod : uint8;
95enum ShutdownMask : uint32;
96enum SpellEffIndex : uint8;
97enum WeatherState : uint32;
98enum XPColorChar : uint8;
99
100#define VISIBLE_RANGE 166.0f //MAX visible range (size of grid)
101
102/*
103 @todo Add more script type classes.
104
105 MailScript
106 SessionScript
107 CollisionScript
108 ArenaTeamScript
109
110*/
111
112/*
113 Standard procedure when adding new script type classes:
114
115 First of all, define the actual class, and have it inherit from ScriptObject, like so:
116
117 class MyScriptType : public ScriptObject
118 {
119 uint32 _someId;
120
121 private:
122
123 void RegisterSelf();
124
125 protected:
126
127 MyScriptType(char const* name, uint32 someId)
128 : ScriptObject(name), _someId(someId)
129 {
130 ScriptRegistry<MyScriptType>::AddScript(this);
131 }
132
133 public:
134
135 // If a virtual function in your script type class is not necessarily
136 // required to be overridden, just declare it virtual with an empty
137 // body. If, on the other hand, it's logical only to override it (i.e.
138 // if it's the only method in the class), make it pure virtual, by adding
139 // = 0 to it.
140 virtual void OnSomeEvent(uint32 someArg1, std::string& someArg2) { }
141
142 // This is a pure virtual function:
143 virtual void OnAnotherEvent(uint32 someArg) = 0;
144 }
145
146 Next, you need to add a specialization for ScriptRegistry. Put this in the bottom of
147 ScriptMgr.cpp:
148
149 template class ScriptRegistry<MyScriptType>;
150
151 Now, add a cleanup routine in ScriptMgr::~ScriptMgr:
152
153 SCR_CLEAR(MyScriptType);
154
155 Now your script type is good to go with the script system. What you need to do now
156 is add functions to ScriptMgr that can be called from the core to actually trigger
157 certain events. For example, in ScriptMgr.h:
158
159 void OnSomeEvent(uint32 someArg1, std::string& someArg2);
160 void OnAnotherEvent(uint32 someArg);
161
162 In ScriptMgr.cpp:
163
164 void ScriptMgr::OnSomeEvent(uint32 someArg1, std::string& someArg2)
165 {
166 FOREACH_SCRIPT(MyScriptType)->OnSomeEvent(someArg1, someArg2);
167 }
168
169 void ScriptMgr::OnAnotherEvent(uint32 someArg)
170 {
171 FOREACH_SCRIPT(MyScriptType)->OnAnotherEvent(someArg1, someArg2);
172 }
173
174 Now you simply call these two functions from anywhere in the core to trigger the
175 event on all registered scripts of that type.
176*/
177
179{
180 friend class ScriptMgr;
181
182 public:
183
184 ScriptObject(ScriptObject const& right) = delete;
185 ScriptObject(ScriptObject&& right) = delete;
186 ScriptObject& operator=(ScriptObject const& right) = delete;
188
189 std::string const& GetName() const;
190
191 protected:
192
193 explicit ScriptObject(char const* name) noexcept;
194 virtual ~ScriptObject();
195
196 private:
197
198 std::string const _name;
199};
200
202{
203 protected:
204
205 explicit SpellScriptLoader(char const* name) noexcept;
206
207 public:
208
209 // Should return a fully valid SpellScript pointer.
210 virtual SpellScript* GetSpellScript() const;
211
212 // Should return a fully valid AuraScript pointer.
213 virtual AuraScript* GetAuraScript() const;
214};
215
217{
218 protected:
219
220 explicit ServerScript(char const* name) noexcept;
221
222 public:
223
225
226 // Called when reactive socket I/O is started (WorldTcpSessionMgr).
227 virtual void OnNetworkStart();
228
229 // Called when reactive I/O is stopped.
230 virtual void OnNetworkStop();
231
232 // Called when a remote socket establishes a connection to the server. Do not store the socket object.
233 virtual void OnSocketOpen(std::shared_ptr<WorldSocket> socket);
234
235 // Called when a socket is closed. Do not store the socket object, and do not rely on the connection
236 // being open; it is not.
237 virtual void OnSocketClose(std::shared_ptr<WorldSocket> socket);
238
239 // Called when a packet is sent to a client. The packet object is a copy of the original packet, so reading
240 // and modifying it is safe.
241 virtual void OnPacketSend(WorldSession* session, WorldPacket& packet);
242
243 // Called when a (valid) packet is received by a client. The packet object is a copy of the original packet, so
244 // reading and modifying it is safe. Make sure to check WorldSession pointer before usage, it might be null in case of auth packets
245 virtual void OnPacketReceive(WorldSession* session, WorldPacket& packet);
246};
247
249{
250 protected:
251
252 explicit WorldScript(char const* name) noexcept;
253
254 public:
255
257
258 // Called when the open/closed state of the world changes.
259 virtual void OnOpenStateChange(bool open);
260
261 // Called after the world configuration is (re)loaded.
262 virtual void OnConfigLoad(bool reload);
263
264 // Called before the message of the day is changed.
265 virtual void OnMotdChange(std::string& newMotd);
266
267 // Called when a world shutdown is initiated.
268 virtual void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask);
269
270 // Called when a world shutdown is cancelled.
271 virtual void OnShutdownCancel();
272
273 // Called on every world tick (don't execute too heavy code here).
274 virtual void OnUpdate(uint32 diff);
275
276 // Called when the world is started.
277 virtual void OnStartup();
278
279 // Called when the world is actually shut down.
280 virtual void OnShutdown();
281};
282
284{
285 protected:
286
287 explicit FormulaScript(char const* name) noexcept;
288
289 public:
290
292
293 // Called after calculating honor.
294 virtual void OnHonorCalculation(float& honor, uint8 level, float multiplier);
295
296 // Called after gray level calculation.
297 virtual void OnGrayLevelCalculation(uint8& grayLevel, uint8 playerLevel);
298
299 // Called after calculating experience color.
300 virtual void OnColorCodeCalculation(XPColorChar& color, uint8 playerLevel, uint8 mobLevel);
301
302 // Called after calculating zero difference.
303 virtual void OnZeroDifferenceCalculation(uint8& diff, uint8 playerLevel);
304
305 // Called after calculating base experience gain.
306 virtual void OnBaseGainCalculation(uint32& gain, uint8 playerLevel, uint8 mobLevel);
307
308 // Called after calculating experience gain.
309 virtual void OnGainCalculation(uint32& gain, Player* player, Unit* unit);
310
311 // Called when calculating the experience rate for group experience.
312 virtual void OnGroupRateCalculation(float& rate, uint32 count, bool isRaid);
313};
314
315template<class TMap>
317{
319
320 protected:
321
322 explicit MapScript(MapEntry const* mapEntry) noexcept;
323
324 public:
325
326 MapScript(MapScript const& right) = delete;
327 MapScript(MapScript&& right) = delete;
328 MapScript& operator=(MapScript const& right) = delete;
329 MapScript& operator=(MapScript&& right) = delete;
330
331 // Gets the MapEntry structure associated with this script. Can return NULL.
332 MapEntry const* GetEntry() const;
333
334 // Called when the map is created.
335 virtual void OnCreate(TMap* map);
336
337 // Called just before the map is destroyed.
338 virtual void OnDestroy(TMap* map);
339
340 // Called when a player enters the map.
341 virtual void OnPlayerEnter(TMap* map, Player* player);
342
343 // Called when a player leaves the map.
344 virtual void OnPlayerLeave(TMap* map, Player* player);
345
346 virtual void OnUpdate(TMap* map, uint32 diff);
347};
348
350{
351 protected:
352
353 explicit WorldMapScript(char const* name, uint32 mapId) noexcept;
354
355 public:
356
358};
359
360class TC_GAME_API InstanceMapScript : public ScriptObject, public MapScript<InstanceMap>
361{
362 protected:
363
364 explicit InstanceMapScript(char const* name, uint32 mapId) noexcept;
365
366 public:
367
369
370 // Gets an InstanceScript object for this instance.
371 virtual InstanceScript* GetInstanceScript(InstanceMap* map) const;
372};
373
374class TC_GAME_API BattlegroundMapScript : public ScriptObject, public MapScript<BattlegroundMap>
375{
376 protected:
377
378 explicit BattlegroundMapScript(char const* name, uint32 mapId) noexcept;
379
380 public:
381
383
384 // Gets an BattlegroundScript object for this battleground.
385 virtual BattlegroundScript* GetBattlegroundScript(BattlegroundMap* map) const;
386};
387
389{
390 protected:
391
392 explicit ItemScript(char const* name) noexcept;
393
394 public:
395
397
398 // Called when a player accepts a quest from the item.
399 virtual bool OnQuestAccept(Player* player, Item* item, Quest const* quest);
400
401 // Called when a player uses the item.
402 virtual bool OnUse(Player* player, Item* item, SpellCastTargets const& targets, ObjectGuid castId);
403
404 // Called when the item expires (is destroyed).
405 virtual bool OnExpire(Player* player, ItemTemplate const* proto);
406
407 // Called when the item is destroyed.
408 virtual bool OnRemove(Player* player, Item* item);
409
410 // Called before casting a combat spell from this item (chance on hit spells of item template, can be used to prevent cast if returning false)
411 virtual bool OnCastItemCombatSpell(Player* player, Unit* victim, SpellInfo const* spellInfo, Item* item);
412};
413
415{
416 protected:
417
418 explicit UnitScript(char const* name) noexcept;
419
420 public:
421
423
424 // Called when a unit deals healing to another unit
425 virtual void OnHeal(Unit* healer, Unit* reciever, uint32& gain);
426
427 // Called when a unit deals damage to another unit
428 virtual void OnDamage(Unit* attacker, Unit* victim, uint32& damage);
429
430 // Called when DoT's Tick Damage is being Dealt
431 virtual void ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage);
432
433 // Called when Melee Damage is being Dealt
434 virtual void ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage);
435
436 // Called when Spell Damage is being Dealt
437 virtual void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage, SpellInfo const* spellInfo);
438};
439
441{
442 protected:
443
444 explicit CreatureScript(char const* name) noexcept;
445
446 public:
447
449
450 // Called when a CreatureAI object is needed for the creature.
451 virtual CreatureAI* GetAI(Creature* creature) const = 0;
452};
453
455{
456 protected:
457
458 explicit GameObjectScript(char const* name) noexcept;
459
460 public:
461
463
464 // Called when a GameObjectAI object is needed for the gameobject.
465 virtual GameObjectAI* GetAI(GameObject* go) const = 0;
466};
467
469{
470 protected:
471
472 explicit AreaTriggerScript(char const* name) noexcept;
473
474 public:
475
477
478 // Called when the area trigger is activated by a player.
479 virtual bool OnTrigger(Player* player, AreaTriggerEntry const* trigger);
480
481 // Called when the area trigger is left by a player.
482 virtual bool OnExit(Player* player, AreaTriggerEntry const* trigger);
483};
484
486{
488
489 public:
490
492
493 bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) final;
494
495 protected:
496 // returns true if the trigger was successfully handled, false if we should try again next time
497 virtual bool TryHandleOnce(Player* player, AreaTriggerEntry const* trigger) = 0;
498 void ResetAreaTriggerDone(InstanceScript* instance, uint32 triggerId);
499 void ResetAreaTriggerDone(Player const* player, AreaTriggerEntry const* trigger);
500};
501
503{
504 protected:
505
506 explicit BattlefieldScript(char const* name) noexcept;
507
508 public:
509
511
512 virtual Battlefield* GetBattlefield(Map* map) const = 0;
513};
514
516{
517 protected:
518
519 explicit OutdoorPvPScript(char const* name) noexcept;
520
521 public:
522
524
525 // Should return a fully valid OutdoorPvP object for the type ID.
526 virtual OutdoorPvP* GetOutdoorPvP(Map* map) const = 0;
527};
528
530{
531 protected:
532
533 explicit CommandScript(char const* name) noexcept;
534
535 public:
536
538
539 // Should return a pointer to a valid command table (ChatCommand array) to be used by ChatHandler.
540 virtual std::span<Trinity::ChatCommands::ChatCommandBuilder const> GetCommands() const = 0;
541};
542
544{
545 protected:
546
547 explicit WeatherScript(char const* name) noexcept;
548
549 public:
550
552
553 // Called when the weather changes in the zone this script is associated with.
554 virtual void OnChange(Weather* weather, WeatherState state, float grade);
555
556 virtual void OnUpdate(Weather* weather, uint32 diff);
557};
558
560{
561 protected:
562
563 explicit AuctionHouseScript(char const* name) noexcept;
564
565 public:
566
568
569 // Called when an auction is added to an auction house.
570 virtual void OnAuctionAdd(AuctionHouseObject* ah, AuctionPosting* auction);
571
572 // Called when an auction is removed from an auction house.
573 virtual void OnAuctionRemove(AuctionHouseObject* ah, AuctionPosting* auction);
574
575 // Called when an auction was succesfully completed.
576 virtual void OnAuctionSuccessful(AuctionHouseObject* ah, AuctionPosting* auction);
577
578 // Called when an auction expires.
579 virtual void OnAuctionExpire(AuctionHouseObject* ah, AuctionPosting* auction);
580};
581
583{
584 protected:
585
586 explicit ConditionScript(char const* name) noexcept;
587
588 public:
589
591
592 // Called when a single condition is checked for a player.
593 virtual bool OnConditionCheck(Condition const* condition, ConditionSourceInfo& sourceInfo);
594};
595
597{
598 protected:
599
600 explicit VehicleScript(char const* name) noexcept;
601
602 public:
603
605
606 // Called after a vehicle is installed.
607 virtual void OnInstall(Vehicle* veh);
608
609 // Called after a vehicle is uninstalled.
610 virtual void OnUninstall(Vehicle* veh);
611
612 // Called when a vehicle resets.
613 virtual void OnReset(Vehicle* veh);
614
615 // Called after an accessory is installed in a vehicle.
616 virtual void OnInstallAccessory(Vehicle* veh, Creature* accessory);
617
618 // Called after a passenger is added to a vehicle.
619 virtual void OnAddPassenger(Vehicle* veh, Unit* passenger, int8 seatId);
620
621 // Called after a passenger is removed from a vehicle.
622 virtual void OnRemovePassenger(Vehicle* veh, Unit* passenger);
623};
624
626{
627 protected:
628
629 explicit DynamicObjectScript(char const* name) noexcept;
630
631 public:
632
634
635 virtual void OnUpdate(DynamicObject* obj, uint32 diff);
636};
637
639{
640 protected:
641
642 explicit TransportScript(char const* name) noexcept;
643
644 public:
645
647
648 // Called when a player boards the transport.
649 virtual void OnAddPassenger(Transport* transport, Player* player);
650
651 // Called when a creature boards the transport.
652 virtual void OnAddCreaturePassenger(Transport* transport, Creature* creature);
653
654 // Called when a player exits the transport.
655 virtual void OnRemovePassenger(Transport* transport, Player* player);
656
657 // Called when a transport moves.
658 virtual void OnRelocate(Transport* transport, uint32 mapId, float x, float y, float z);
659
660 virtual void OnUpdate(Transport* transport, uint32 diff);
661};
662
664{
665 protected:
666
667 explicit AchievementScript(char const* name) noexcept;
668
669 public:
670
672
673 // Called when an achievement is completed.
674 virtual void OnCompleted(Player* player, AchievementEntry const* achievement);
675};
676
678{
679 protected:
680
681 explicit AchievementCriteriaScript(char const* name) noexcept;
682
683 public:
684
686
687 // Called when an additional criteria is checked.
688 virtual bool OnCheck(Player* source, Unit* target) = 0;
689};
690
692{
693 protected:
694
695 explicit PlayerScript(char const* name) noexcept;
696
697 public:
698
700
701 // Called when a player kills another player
702 virtual void OnPVPKill(Player* killer, Player* killed);
703
704 // Called when a player kills a creature
705 virtual void OnCreatureKill(Player* killer, Creature* killed);
706
707 // Called when a player is killed by a creature
708 virtual void OnPlayerKilledByCreature(Creature* killer, Player* killed);
709
710 // Called when a player's level changes (after the level is applied)
711 virtual void OnLevelChanged(Player* player, uint8 oldLevel);
712
713 // Called when a player's free talent points change (right before the change is applied)
714 virtual void OnFreeTalentPointsChanged(Player* player, uint32 points);
715
716 // Called when a player's talent points are reset (right before the reset is done)
717 virtual void OnTalentsReset(Player* player, bool noCost);
718
719 // Called when a player's money is modified (before the modification is done)
720 virtual void OnMoneyChanged(Player* player, int64& amount);
721
722 // Called when a player's money is at limit (amount = money tried to add)
723 virtual void OnMoneyLimit(Player* player, int64 amount);
724
725 // Called when a player gains XP (before anything is given)
726 virtual void OnGiveXP(Player* player, uint32& amount, Unit* victim);
727
728 // Called when a player's reputation changes (before it is actually changed)
729 virtual void OnReputationChange(Player* player, uint32 factionId, int32& standing, bool incremental);
730
731 // Called when a duel is requested
732 virtual void OnDuelRequest(Player* target, Player* challenger);
733
734 // Called when a duel starts (after 3s countdown)
735 virtual void OnDuelStart(Player* player1, Player* player2);
736
737 // Called when a duel ends
738 virtual void OnDuelEnd(Player* winner, Player* loser, DuelCompleteType type);
739
740 // The following methods are called when a player sends a chat message.
741 virtual void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg);
742
743 virtual void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Player* receiver);
744
745 virtual void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group);
746
747 virtual void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild);
748
749 virtual void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel);
750
751 // Both of the below are called on emote opcodes.
752 virtual void OnClearEmote(Player* player);
753
754 virtual void OnTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid);
755
756 // Called in Spell::Cast.
757 virtual void OnSpellCast(Player* player, Spell* spell, bool skipCheck);
758
759 // Called when a player logs in.
760 virtual void OnLogin(Player* player, bool firstLogin);
761
762 // Called when a player logs out.
763 virtual void OnLogout(Player* player);
764
765 // Called when a player is created.
766 virtual void OnCreate(Player* player);
767
768 // Called when a player is deleted.
769 virtual void OnDelete(ObjectGuid guid, uint32 accountId);
770
771 // Called when a player delete failed
772 virtual void OnFailedDelete(ObjectGuid guid, uint32 accountId);
773
774 // Called when a player is about to be saved.
775 virtual void OnSave(Player* player);
776
777 // Called when a player is bound to an instance
778 virtual void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent, uint8 extendState);
779
780 // Called when a player switches to a new zone
781 virtual void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea);
782
783 // Called when a player changes to a new map (after moving to new map)
784 virtual void OnMapChanged(Player* player);
785
786 // Called after a player's quest status has been changed
787 virtual void OnQuestStatusChange(Player* player, uint32 questId);
788
789 // Called when a player presses release when he died
790 virtual void OnPlayerRepop(Player* player);
791
792 // Called when a player completes a movie
793 virtual void OnMovieComplete(Player* player, uint32 movieId);
794};
795
797{
798 protected:
799
800 explicit AccountScript(char const* name) noexcept;
801
802 public:
803
805
806 // Called when an account logged in succesfully
807 virtual void OnAccountLogin(uint32 accountId);
808
809 // Called when an account login failed
810 virtual void OnFailedAccountLogin(uint32 accountId);
811
812 // Called when Email is successfully changed for Account
813 virtual void OnEmailChange(uint32 accountId);
814
815 // Called when Email failed to change for Account
816 virtual void OnFailedEmailChange(uint32 accountId);
817
818 // Called when Password is successfully changed for Account
819 virtual void OnPasswordChange(uint32 accountId);
820
821 // Called when Password failed to change for Account
822 virtual void OnFailedPasswordChange(uint32 accountId);
823};
824
826{
827 protected:
828
829 explicit GuildScript(char const* name) noexcept;
830
831 public:
832
834
835 // Called when a member is added to the guild.
836 virtual void OnAddMember(Guild* guild, Player* player, uint8 plRank);
837
838 // Called when a member is removed from the guild.
839 virtual void OnRemoveMember(Guild* guild, ObjectGuid guid, bool isDisbanding, bool isKicked);
840
841 // Called when the guild MOTD (message of the day) changes.
842 virtual void OnMOTDChanged(Guild* guild, std::string const& newMotd);
843
844 // Called when the guild info is altered.
845 virtual void OnInfoChanged(Guild* guild, std::string const& newInfo);
846
847 // Called when a guild is created.
848 virtual void OnCreate(Guild* guild, Player* leader, std::string const& name);
849
850 // Called when a guild is disbanded.
851 virtual void OnDisband(Guild* guild);
852
853 // Called when a guild member withdraws money from a guild bank.
854 virtual void OnMemberWitdrawMoney(Guild* guild, Player* player, uint64& amount, bool isRepair);
855
856 // Called when a guild member deposits money in a guild bank.
857 virtual void OnMemberDepositMoney(Guild* guild, Player* player, uint64& amount);
858
859 // Called when a guild member moves an item in a guild bank.
860 virtual void OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
861 bool isDestBank, uint8 destContainer, uint8 destSlotId);
862
863 virtual void OnEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank);
864
865 virtual void OnBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId);
866};
867
869{
870 protected:
871
872 explicit GroupScript(char const* name) noexcept;
873
874 public:
875
877
878 // Called when a member is added to a group.
879 virtual void OnAddMember(Group* group, ObjectGuid guid);
880
881 // Called when a member is invited to join a group.
882 virtual void OnInviteMember(Group* group, ObjectGuid guid);
883
884 // Called when a member is removed from a group.
885 virtual void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason);
886
887 // Called when the leader of a group is changed.
888 virtual void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid);
889
890 // Called when a group is disbanded.
891 virtual void OnDisband(Group* group);
892};
893
895{
896 protected:
897
898 explicit AreaTriggerEntityScript(char const* name) noexcept;
899
900 public:
901
903
904 // Called when a AreaTriggerAI object is needed for the areatrigger.
905 virtual AreaTriggerAI* GetAI(AreaTrigger* at) const;
906};
907
909{
910 protected:
911
912 explicit ConversationScript(char const* name) noexcept;
913
914 public:
915
917
918 // Called when a ConversationAI object is needed for the conversation.
919 virtual ConversationAI* GetAI(Conversation* conversation) const;
920};
921
923{
924 protected:
925
926 explicit SceneScript(char const* name) noexcept;
927
928 public:
929
931
932 // Called when a player start a scene
933 virtual void OnSceneStart(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate);
934
935 // Called when a player receive trigger from scene
936 virtual void OnSceneTriggerEvent(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate, std::string const& triggerName);
937
938 // Called when a scene is canceled
939 virtual void OnSceneCancel(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate);
940
941 // Called when a scene is completed
942 virtual void OnSceneComplete(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate);
943};
944
946{
947 protected:
948
949 explicit QuestScript(char const* name) noexcept;
950
951 public:
952
954
955 // Called when a quest status change
956 virtual void OnQuestStatusChange(Player* player, Quest const* quest, QuestStatus oldStatus, QuestStatus newStatus);
957
958 // Called for auto accept quests when player closes quest UI after seeing initial quest details
959 virtual void OnAcknowledgeAutoAccept(Player* player, Quest const* quest);
960
961 // Called when a quest objective data change
962 virtual void OnQuestObjectiveChange(Player* player, Quest const* quest, QuestObjective const& objective, int32 oldAmount, int32 newAmount);
963};
964
966{
967 protected:
968
969 explicit WorldStateScript(char const* name) noexcept;
970
971 public:
972
974
975 // Called when worldstate changes value, map is optional
976 virtual void OnValueChange(int32 worldStateId, int32 oldValue, int32 newValue, Map const* map);
977};
978
980{
981 protected:
982
983 explicit EventScript(char const* name) noexcept;
984
985 public:
986
988
989 // Called when a game event is triggered
990 virtual void OnTrigger(WorldObject* object, WorldObject* invoker, uint32 eventId);
991};
992
994{
995 protected:
996
997 explicit PlayerChoiceScript(char const* name) noexcept;
998
999 public:
1000
1002
1010 virtual void OnResponse(WorldObject* object, Player* player, PlayerChoice const* choice, PlayerChoiceResponse const* response, uint16 clientIdentifier);
1011};
1012
1013// Manages registration, loading, and execution of scripts.
1015{
1016 friend class ScriptObject;
1017
1018 private:
1019 ScriptMgr();
1021
1022 ScriptMgr(ScriptMgr const& right) = delete;
1023 ScriptMgr(ScriptMgr&& right) = delete;
1024 ScriptMgr& operator=(ScriptMgr const& right) = delete;
1025 ScriptMgr& operator=(ScriptMgr&& right) = delete;
1026
1027 void FillSpellSummary();
1028 void LoadDatabase();
1029
1030 void IncreaseScriptCount() { ++_scriptCount; }
1031 void DecreaseScriptCount() { --_scriptCount; }
1032
1033 public: /* Initialization */
1034 static ScriptMgr* instance();
1035
1036 void Initialize();
1037
1038 uint32 GetScriptCount() const { return _scriptCount; }
1039
1040 typedef void(*ScriptLoaderCallbackType)();
1041
1044 void SetScriptLoader(ScriptLoaderCallbackType script_loader_callback)
1045 {
1046 _script_loader_callback = script_loader_callback;
1047 }
1048
1049 public: /* Updating script ids */
1051 void NotifyScriptIDUpdate();
1053 void SyncScripts();
1054
1055 public: /* Script contexts */
1059 void SetScriptContext(std::string const& context);
1061 std::string const& GetCurrentScriptContext() const { return _currentContext; }
1064 void ReleaseScriptContext(std::string const& context);
1068 void SwapScriptContext(bool initialize = false);
1069
1071 static std::string const& GetNameOfStaticContext();
1072
1076 std::shared_ptr<ModuleReference> AcquireModuleReferenceOfScriptName(
1077 std::string const& scriptname) const;
1078
1079 public: /* Unloading */
1080
1081 void Unload();
1082
1083 public: /* SpellScriptLoader */
1084
1085 void CreateSpellScripts(uint32 spellId, std::vector<SpellScript*>& scriptVector, Spell* invoker) const;
1086 void CreateAuraScripts(uint32 spellId, std::vector<AuraScript*>& scriptVector, Aura* invoker) const;
1087 SpellScriptLoader* GetSpellScriptLoader(uint32 scriptId);
1088
1089 public: /* ServerScript */
1090
1091 void OnNetworkStart();
1092 void OnNetworkStop();
1093 void OnSocketOpen(std::shared_ptr<WorldSocket> const& socket);
1094 void OnSocketClose(std::shared_ptr<WorldSocket> const& socket);
1095 void OnPacketReceive(WorldSession* session, WorldPacket const& packet);
1096 void OnPacketSend(WorldSession* session, WorldPacket const& packet);
1097
1098 public: /* WorldScript */
1099
1100 void OnOpenStateChange(bool open);
1101 void OnConfigLoad(bool reload);
1102 void OnMotdChange(std::string& newMotd);
1103 void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask);
1104 void OnShutdownCancel();
1105 void OnWorldUpdate(uint32 diff);
1106 void OnStartup();
1107 void OnShutdown();
1108
1109 public: /* FormulaScript */
1110
1111 void OnHonorCalculation(float& honor, uint8 level, float multiplier);
1112 void OnGrayLevelCalculation(uint8& grayLevel, uint8 playerLevel);
1113 void OnColorCodeCalculation(XPColorChar& color, uint8 playerLevel, uint8 mobLevel);
1114 void OnZeroDifferenceCalculation(uint8& diff, uint8 playerLevel);
1115 void OnBaseGainCalculation(uint32& gain, uint8 playerLevel, uint8 mobLevel);
1116 void OnGainCalculation(uint32& gain, Player* player, Unit* unit);
1117 void OnGroupRateCalculation(float& rate, uint32 count, bool isRaid);
1118
1119 public: /* MapScript */
1120
1121 void OnCreateMap(Map* map);
1122 void OnDestroyMap(Map* map);
1123 void OnPlayerEnterMap(Map* map, Player* player);
1124 void OnPlayerLeaveMap(Map* map, Player* player);
1125 void OnMapUpdate(Map* map, uint32 diff);
1126
1127 public: /* InstanceMapScript */
1128
1129 InstanceScript* CreateInstanceData(InstanceMap* map);
1130
1131 public: /* ItemScript */
1132
1133 bool OnQuestAccept(Player* player, Item* item, Quest const* quest);
1134 bool OnItemUse(Player* player, Item* item, SpellCastTargets const& targets, ObjectGuid castId);
1135 bool OnItemExpire(Player* player, ItemTemplate const* proto);
1136 bool OnItemRemove(Player* player, Item* item);
1137 bool OnCastItemCombatSpell(Player* player, Unit* victim, SpellInfo const* spellInfo, Item* item);
1138
1139 public: /* CreatureScript */
1140
1141 bool CanCreateCreatureAI(uint32 scriptId) const;
1142 CreatureAI* GetCreatureAI(Creature* creature);
1143
1144 public: /* GameObjectScript */
1145
1146 bool CanCreateGameObjectAI(uint32 scriptId) const;
1147 GameObjectAI* GetGameObjectAI(GameObject* go);
1148
1149 public: /* AreaTriggerScript */
1150
1151 bool OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger, bool entered);
1152
1153 public: /* BattlefieldScript */
1154
1155 Battlefield* CreateBattlefield(uint32 scriptId, Map* map);
1156
1157 public: /* BattlegroundScript */
1158
1159 BattlegroundScript* CreateBattlegroundData(BattlegroundMap* map);
1160
1161 public: /* OutdoorPvPScript */
1162
1163 OutdoorPvP* CreateOutdoorPvP(uint32 scriptId, Map* map);
1164
1165 public: /* CommandScript */
1166
1167 std::vector<Trinity::ChatCommands::ChatCommandBuilder> GetChatCommands();
1168
1169 public: /* WeatherScript */
1170
1171 void OnWeatherChange(Weather* weather, WeatherState state, float grade);
1172 void OnWeatherUpdate(Weather* weather, uint32 diff);
1173
1174 public: /* AuctionHouseScript */
1175
1176 void OnAuctionAdd(AuctionHouseObject* ah, AuctionPosting* auction);
1177 void OnAuctionRemove(AuctionHouseObject* ah, AuctionPosting* auction);
1178 void OnAuctionSuccessful(AuctionHouseObject* ah, AuctionPosting* auction);
1179 void OnAuctionExpire(AuctionHouseObject* ah, AuctionPosting* auction);
1180
1181 public: /* ConditionScript */
1182
1183 bool OnConditionCheck(Condition const* condition, ConditionSourceInfo& sourceInfo);
1184
1185 public: /* VehicleScript */
1186
1187 void OnInstall(Vehicle* veh);
1188 void OnUninstall(Vehicle* veh);
1189 void OnReset(Vehicle* veh);
1190 void OnInstallAccessory(Vehicle* veh, Creature* accessory);
1191 void OnAddPassenger(Vehicle* veh, Unit* passenger, int8 seatId);
1192 void OnRemovePassenger(Vehicle* veh, Unit* passenger);
1193
1194 public: /* DynamicObjectScript */
1195
1196 void OnDynamicObjectUpdate(DynamicObject* dynobj, uint32 diff);
1197
1198 public: /* TransportScript */
1199
1200 void OnAddPassenger(Transport* transport, Player* player);
1201 void OnAddCreaturePassenger(Transport* transport, Creature* creature);
1202 void OnRemovePassenger(Transport* transport, Player* player);
1203 void OnTransportUpdate(Transport* transport, uint32 diff);
1204 void OnRelocate(Transport* transport, uint32 mapId, float x, float y, float z);
1205
1206 public: /* AchievementScript */
1207
1208 void OnAchievementCompleted(Player* player, AchievementEntry const* achievement);
1209
1210 public: /* AchievementCriteriaScript */
1211
1212 bool OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target);
1213
1214 public: /* PlayerScript */
1215
1216 void OnPVPKill(Player* killer, Player* killed);
1217 void OnCreatureKill(Player* killer, Creature* killed);
1218 void OnPlayerKilledByCreature(Creature* killer, Player* killed);
1219 void OnPlayerLevelChanged(Player* player, uint8 oldLevel);
1220 void OnPlayerFreeTalentPointsChanged(Player* player, uint32 newPoints);
1221 void OnPlayerTalentsReset(Player* player, bool noCost);
1222 void OnPlayerMoneyChanged(Player* player, int64& amount);
1223 void OnPlayerMoneyLimit(Player* player, int64 amount);
1224 void OnGivePlayerXP(Player* player, uint32& amount, Unit* victim);
1225 void OnPlayerReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental);
1226 void OnPlayerDuelRequest(Player* target, Player* challenger);
1227 void OnPlayerDuelStart(Player* player1, Player* player2);
1228 void OnPlayerDuelEnd(Player* winner, Player* loser, DuelCompleteType type);
1229 void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg);
1230 void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Player* receiver);
1231 void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group);
1232 void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild);
1233 void OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel);
1234 void OnPlayerClearEmote(Player* player);
1235 void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid);
1236 void OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck);
1237 void OnPlayerLogin(Player* player, bool firstLogin);
1238 void OnPlayerLogout(Player* player);
1239 void OnPlayerCreate(Player* player);
1240 void OnPlayerDelete(ObjectGuid guid, uint32 accountId);
1241 void OnPlayerFailedDelete(ObjectGuid guid, uint32 accountId);
1242 void OnPlayerSave(Player* player);
1243 void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent, uint8 extendState);
1244 void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea);
1245 void OnQuestStatusChange(Player* player, uint32 questId);
1246 void OnPlayerRepop(Player* player);
1247 void OnMovieComplete(Player* player, uint32 movieId);
1248 void OnPlayerChoiceResponse(WorldObject* object, Player* player, PlayerChoice const* choice, PlayerChoiceResponse const* response, uint16 clientIdentifier);
1249
1250 public: /* AccountScript */
1251
1252 void OnAccountLogin(uint32 accountId);
1253 void OnFailedAccountLogin(uint32 accountId);
1254 void OnEmailChange(uint32 accountId);
1255 void OnFailedEmailChange(uint32 accountId);
1256 void OnPasswordChange(uint32 accountId);
1257 void OnFailedPasswordChange(uint32 accountId);
1258
1259 public: /* GuildScript */
1260
1261 void OnGuildAddMember(Guild* guild, Player* player, uint8 plRank);
1262 void OnGuildRemoveMember(Guild* guild, ObjectGuid guid, bool isDisbanding, bool isKicked);
1263 void OnGuildMOTDChanged(Guild* guild, const std::string& newMotd);
1264 void OnGuildInfoChanged(Guild* guild, const std::string& newInfo);
1265 void OnGuildCreate(Guild* guild, Player* leader, const std::string& name);
1266 void OnGuildDisband(Guild* guild);
1267 void OnGuildMemberWitdrawMoney(Guild* guild, Player* player, uint64 &amount, bool isRepair);
1268 void OnGuildMemberDepositMoney(Guild* guild, Player* player, uint64 &amount);
1269 void OnGuildItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
1270 bool isDestBank, uint8 destContainer, uint8 destSlotId);
1271 void OnGuildEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank);
1272 void OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId);
1273
1274 public: /* GroupScript */
1275
1276 void OnGroupAddMember(Group* group, ObjectGuid guid);
1277 void OnGroupInviteMember(Group* group, ObjectGuid guid);
1278 void OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason);
1279 void OnGroupChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid);
1280 void OnGroupDisband(Group* group);
1281
1282 public: /* UnitScript */
1283
1284 void OnHeal(Unit* healer, Unit* reciever, uint32& gain);
1285 void OnDamage(Unit* attacker, Unit* victim, uint32& damage);
1286 void ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage);
1287 void ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage);
1288 void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage, SpellInfo const* spellInfo);
1289
1290 public: /* AreaTriggerEntityScript */
1291
1292 bool CanCreateAreaTriggerAI(uint32 scriptId) const;
1293 AreaTriggerAI* GetAreaTriggerAI(AreaTrigger* areaTrigger);
1294
1295 public: /* ConversationScript */
1296
1297 bool CanCreateConversationAI(uint32 scriptId) const;
1298 ConversationAI* GetConversationAI(Conversation* conversation);
1299
1300 public: /* SceneScript */
1301
1302 void OnSceneStart(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate);
1303 void OnSceneTrigger(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate, std::string const& triggerName);
1304 void OnSceneCancel(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate);
1305 void OnSceneComplete(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate);
1306
1307 public: /* QuestScript */
1308
1309 void OnQuestStatusChange(Player* player, Quest const* quest, QuestStatus oldStatus, QuestStatus newStatus);
1310 void OnQuestAcknowledgeAutoAccept(Player* player, Quest const* quest);
1311 void OnQuestObjectiveChange(Player* player, Quest const* quest, QuestObjective const& objective, int32 oldAmount, int32 newAmount);
1312
1313 public: /* WorldStateScript */
1314
1315 void OnWorldStateValueChange(WorldStateTemplate const* worldStateTemplate, int32 oldValue, int32 newValue, Map const* map);
1316
1317 public: /* EventScript */
1318
1319 void OnEventTrigger(WorldObject* object, WorldObject* invoker, uint32 eventId);
1320
1321 private:
1324
1325 ScriptLoaderCallbackType _script_loader_callback;
1326
1327 std::string _currentContext;
1328};
1329
1331{
1332 template<typename T>
1333 concept IsSpellScript = std::is_base_of_v<SpellScript, T>;
1334
1335 template<typename T>
1336 concept IsAuraScript = std::is_base_of_v<AuraScript, T>;
1337
1338 template<typename T>
1340
1341 template<typename T, typename Other>
1344 || std::same_as<T, void>;
1345
1346 template<typename T>
1347 concept ArgsTuple = Trinity::is_tuple_v<T>;
1348}
1349
1350template <Trinity::SpellScripts::IsSpellOrAuraScript Script1, Trinity::SpellScripts::ComplementScriptFor<Script1> Script2, Trinity::SpellScripts::ArgsTuple ArgsType>
1352{
1353public:
1354 GenericSpellAndAuraScriptLoader(char const* name, ArgsType&& args) noexcept : SpellScriptLoader(name), _args(std::move(args)) { }
1355
1356private:
1357 SpellScript* GetSpellScript() const override
1358 {
1360 return Trinity::new_from_tuple<Script1>(_args);
1362 return Trinity::new_from_tuple<Script2>(_args);
1363 else
1364 return nullptr;
1365 }
1366
1367 AuraScript* GetAuraScript() const override
1368 {
1370 return Trinity::new_from_tuple<Script1>(_args);
1372 return Trinity::new_from_tuple<Script2>(_args);
1373 else
1374 return nullptr;
1375 }
1376
1377 ArgsType _args;
1378};
1379
1380#define RegisterSpellAndAuraScriptPairWithArgs(script_1, script_2, script_name, ...) new GenericSpellAndAuraScriptLoader<BOOST_PP_REMOVE_PARENS(script_1), BOOST_PP_REMOVE_PARENS(script_2), decltype(std::make_tuple(__VA_ARGS__))>(script_name, std::make_tuple(__VA_ARGS__))
1381#define RegisterSpellAndAuraScriptPair(script_1, script_2) RegisterSpellAndAuraScriptPairWithArgs(script_1, script_2, #script_1)
1382#define RegisterSpellScriptWithArgs(spell_script, script_name, ...) RegisterSpellAndAuraScriptPairWithArgs(spell_script, void, script_name, __VA_ARGS__)
1383#define RegisterSpellScript(spell_script) RegisterSpellAndAuraScriptPairWithArgs(spell_script, void, #spell_script)
1384
1385template <class AI>
1387{
1388 public:
1389 GenericCreatureScript(char const* name) noexcept : CreatureScript(name) { }
1390 CreatureAI* GetAI(Creature* me) const override { return new AI(me); }
1391};
1392#define RegisterCreatureAI(ai_name) new GenericCreatureScript<ai_name>(#ai_name)
1393
1394template <class AI, AI* (*AIFactory)(Creature*)>
1396{
1397 public:
1398 FactoryCreatureScript(char const* name) noexcept : CreatureScript(name) { }
1399 CreatureAI* GetAI(Creature* me) const override { return AIFactory(me); }
1400};
1401#define RegisterCreatureAIWithFactory(ai_name, factory_fn) new FactoryCreatureScript<ai_name, &factory_fn>(#ai_name)
1402
1403template <class AI>
1405{
1406 public:
1407 GenericGameObjectScript(char const* name) noexcept : GameObjectScript(name) { }
1408 GameObjectAI* GetAI(GameObject* go) const override { return new AI(go); }
1409};
1410#define RegisterGameObjectAI(ai_name) new GenericGameObjectScript<ai_name>(#ai_name)
1411
1412template <class AI, AI* (*AIFactory)(GameObject*)>
1414{
1415 public:
1416 FactoryGameObjectScript(char const* name) noexcept : GameObjectScript(name) { }
1417 GameObjectAI* GetAI(GameObject* me) const override { return AIFactory(me); }
1418};
1419#define RegisterGameObjectAIWithFactory(ai_name, factory_fn) new FactoryGameObjectScript<ai_name, &factory_fn>(#ai_name)
1420
1421template <class AI>
1423{
1424 public:
1425 GenericAreaTriggerEntityScript(char const* name) noexcept : AreaTriggerEntityScript(name) { }
1426 AreaTriggerAI* GetAI(AreaTrigger* at) const override { return new AI(at); }
1427};
1428#define RegisterAreaTriggerAI(ai_name) new GenericAreaTriggerEntityScript<ai_name>(#ai_name)
1429
1430template <class AI>
1432{
1433public:
1434 GenericConversationScript(char const* name) noexcept : ConversationScript(name) {}
1435 ConversationAI* GetAI(Conversation* conversation) const override { return new AI(conversation); }
1436};
1437#define RegisterConversationAI(ai_name) new GenericConversationScript<ai_name>(#ai_name)
1438
1439template<class Script>
1441{
1442public:
1443 GenericBattlegroundMapScript(char const* name, uint32 mapId) noexcept : BattlegroundMapScript(name, mapId) { }
1444
1445 BattlegroundScript* GetBattlegroundScript(BattlegroundMap* map) const override { return new Script(map); }
1446};
1447#define RegisterBattlegroundMapScript(script_name, mapId) new GenericBattlegroundMapScript<script_name>(#script_name, mapId)
1448
1449#define sScriptMgr ScriptMgr::instance()
1450
1451#endif
T GetEntry(std::unordered_map< uint32, T > const &map, CriteriaTreeEntry const *tree)
Difficulty
Definition DBCEnums.h:932
#define TC_GAME_API
Definition Define.h:129
uint8_t uint8
Definition Define.h:156
int64_t int64
Definition Define.h:149
int16_t int16
Definition Define.h:151
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
QuestStatus
Definition QuestDef.h:146
SpellEffIndex
XPColorChar
DuelCompleteType
BattlegroundTypeId
RemoveMethod
virtual bool OnCheck(Player *source, Unit *target)=0
AreaTriggerScript(char const *name) noexcept
virtual Battlefield * GetBattlefield(Map *map) const =0
virtual std::span< Trinity::ChatCommands::ChatCommandBuilder const > GetCommands() const =0
virtual CreatureAI * GetAI(Creature *creature) const =0
CreatureAI * GetAI(Creature *me) const override
Definition ScriptMgr.h:1399
FactoryCreatureScript(char const *name) noexcept
Definition ScriptMgr.h:1398
GameObjectAI * GetAI(GameObject *me) const override
Definition ScriptMgr.h:1417
FactoryGameObjectScript(char const *name) noexcept
Definition ScriptMgr.h:1416
virtual GameObjectAI * GetAI(GameObject *go) const =0
GenericAreaTriggerEntityScript(char const *name) noexcept
Definition ScriptMgr.h:1425
AreaTriggerAI * GetAI(AreaTrigger *at) const override
Definition ScriptMgr.h:1426
BattlegroundScript * GetBattlegroundScript(BattlegroundMap *map) const override
Definition ScriptMgr.h:1445
GenericBattlegroundMapScript(char const *name, uint32 mapId) noexcept
Definition ScriptMgr.h:1443
ConversationAI * GetAI(Conversation *conversation) const override
Definition ScriptMgr.h:1435
GenericConversationScript(char const *name) noexcept
Definition ScriptMgr.h:1434
GenericCreatureScript(char const *name) noexcept
Definition ScriptMgr.h:1389
CreatureAI * GetAI(Creature *me) const override
Definition ScriptMgr.h:1390
GameObjectAI * GetAI(GameObject *go) const override
Definition ScriptMgr.h:1408
GenericGameObjectScript(char const *name) noexcept
Definition ScriptMgr.h:1407
AuraScript * GetAuraScript() const override
Definition ScriptMgr.h:1367
GenericSpellAndAuraScriptLoader(char const *name, ArgsType &&args) noexcept
Definition ScriptMgr.h:1354
SpellScript * GetSpellScript() const override
Definition ScriptMgr.h:1357
Definition Group.h:205
Definition Guild.h:329
Definition Item.h:179
MapEntry const * _mapEntry
Definition ScriptMgr.h:318
MapScript(MapScript &&right)=delete
MapScript(MapScript const &right)=delete
MapScript & operator=(MapScript const &right)=delete
MapScript & operator=(MapScript &&right)=delete
Definition Map.h:225
uint64 LowType
Definition ObjectGuid.h:321
virtual bool TryHandleOnce(Player *player, AreaTriggerEntry const *trigger)=0
virtual OutdoorPvP * GetOutdoorPvP(Map *map) const =0
void IncreaseScriptCount()
Definition ScriptMgr.h:1030
void SetScriptLoader(ScriptLoaderCallbackType script_loader_callback)
Definition ScriptMgr.h:1044
void DecreaseScriptCount()
Definition ScriptMgr.h:1031
bool _scriptIdUpdated
Definition ScriptMgr.h:1323
ScriptMgr(ScriptMgr &&right)=delete
uint32 GetScriptCount() const
Definition ScriptMgr.h:1038
ScriptMgr(ScriptMgr const &right)=delete
ScriptMgr & operator=(ScriptMgr &&right)=delete
std::string const & GetCurrentScriptContext() const
Returns the current script context.
Definition ScriptMgr.h:1061
ScriptMgr & operator=(ScriptMgr const &right)=delete
std::string _currentContext
Definition ScriptMgr.h:1327
ScriptLoaderCallbackType _script_loader_callback
Definition ScriptMgr.h:1325
uint32 _scriptCount
Definition ScriptMgr.h:1322
ScriptObject(ScriptObject &&right)=delete
ScriptObject & operator=(ScriptObject &&right)=delete
std::string const _name
Definition ScriptMgr.h:198
ScriptObject(ScriptObject const &right)=delete
ScriptObject & operator=(ScriptObject const &right)=delete
Definition Spell.h:277
Definition Unit.h:635
Weather for one zone.
Definition Weather.h:66
Player session in the World.
WeatherState
Definition Weather.h:46
ShutdownExitCode
Definition World.h:74
ShutdownMask
Definition World.h:67