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