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