19 #ifndef SC_SCRIPTMGR_H
20 #define SC_SCRIPTMGR_H
70 #define VISIBLE_RANGE 166.0f //MAX visible range (size of grid)
155 const std::string&
GetName()
const {
return _name; }
303 : _mapEntry(
sMapStore.LookupEntry(mapId))
306 TC_LOG_ERROR(
"scripts",
"Invalid MapScript for %u; no such map ID.", mapId);
387 UnitScript(
const char* name,
bool addToScripts =
true);
520 virtual OutdoorPvP* GetOutdoorPvP()
const = 0;
532 virtual std::vector<ChatCommand> GetCommands()
const = 0;
644 virtual bool OnCheck(
Player* source,
Unit* target) = 0;
837 #define sScriptMgr ScriptMgr::instance()
859 void FillSpellSummary();
866 typedef void(*ScriptLoaderCallbackType)();
872 _script_loader_callback = script_loader_callback;
881 void CreateSpellScripts(
uint32 spellId, std::list<SpellScript*>& scriptVector);
882 void CreateAuraScripts(
uint32 spellId, std::list<AuraScript*>& scriptVector);
883 void CreateSpellScriptLoaders(
uint32 spellId, std::vector<std::pair<
SpellScriptLoader*, std::multimap<uint32, uint32>::iterator> >& scriptVector);
887 void OnNetworkStart();
888 void OnNetworkStop();
889 void OnSocketOpen(std::shared_ptr<WorldSocket> socket);
890 void OnSocketClose(std::shared_ptr<WorldSocket> socket);
896 void OnOpenStateChange(
bool open);
897 void OnConfigLoad(
bool reload);
898 void OnMotdChange(std::string& newMotd);
900 void OnShutdownCancel();
901 void OnWorldUpdate(
uint32 diff);
907 void OnHonorCalculation(
float& honor,
uint8 level,
float multiplier);
908 void OnGrayLevelCalculation(
uint8& grayLevel,
uint8 playerLevel);
910 void OnZeroDifferenceCalculation(
uint8& diff,
uint8 playerLevel);
911 void OnBaseGainCalculation(
uint32& gain,
uint8 playerLevel,
uint8 mobLevel);
913 void OnGroupRateCalculation(
float& rate,
uint32 count,
bool isRaid);
917 void OnCreateMap(
Map* map);
918 void OnDestroyMap(
Map* map);
921 void OnPlayerEnterMap(
Map* map,
Player* player);
922 void OnPlayerLeaveMap(
Map* map,
Player* player);
935 bool OnItemRemove(
Player* player,
Item* item);
980 std::vector<ChatCommand> GetChatCommands();
1001 void OnUninstall(
Vehicle* veh);
1005 void OnRemovePassenger(
Vehicle* veh,
Unit* passenger);
1028 void OnPlayerLevelChanged(
Player* player,
uint8 oldLevel);
1029 void OnPlayerFreeTalentPointsChanged(
Player* player,
uint32 newPoints);
1030 void OnPlayerTalentsReset(
Player* player,
bool noCost);
1031 void OnPlayerMoneyChanged(
Player* player,
int64& amount);
1032 void OnPlayerMoneyLimit(
Player* player,
int64 amount);
1034 void OnPlayerReputationChange(
Player* player,
uint32 factionID,
int32& standing,
bool incremental);
1035 void OnPlayerDuelRequest(
Player* target,
Player* challenger);
1036 void OnPlayerDuelStart(
Player* player1,
Player* player2);
1043 void OnPlayerClearEmote(
Player* player);
1045 void OnPlayerSpellCast(
Player* player,
Spell* spell,
bool skipCheck);
1046 void OnPlayerLogin(
Player* player,
bool firstLogin);
1047 void OnPlayerLogout(
Player* player);
1048 void OnPlayerCreate(
Player* player);
1051 void OnPlayerSave(
Player* player);
1058 void OnAccountLogin(
uint32 accountId);
1059 void OnFailedAccountLogin(
uint32 accountId);
1060 void OnEmailChange(
uint32 accountId);
1061 void OnFailedEmailChange(
uint32 accountId);
1062 void OnPasswordChange(
uint32 accountId);
1063 void OnFailedPasswordChange(
uint32 accountId);
1068 void OnGuildRemoveMember(
Guild* guild,
ObjectGuid guid,
bool isDisbanding,
bool isKicked);
1069 void OnGuildMOTDChanged(
Guild* guild,
const std::string& newMotd);
1070 void OnGuildInfoChanged(
Guild* guild,
const std::string& newInfo);
1071 void OnGuildCreate(
Guild* guild,
Player* leader,
const std::string& name);
1072 void OnGuildDisband(
Guild* guild);
1073 void OnGuildMemberWitdrawMoney(
Guild* guild,
Player* player,
uint64 &amount,
bool isRepair);
1076 bool isDestBank,
uint8 destContainer,
uint8 destSlotId);
1086 void OnGroupDisband(
Group* group);
1092 void ModifyPeriodicDamageAurasTick(
Unit* target,
Unit* attacker,
uint32& damage);
1093 void ModifyMeleeDamage(
Unit* target,
Unit* attacker,
uint32& damage);
1094 void ModifySpellDamageTaken(
Unit* target,
Unit* attacker,
int32& damage);
virtual void OnOpenStateChange(bool)
Definition: ScriptMgr.h:242
virtual void OnSpellCast(Player *, Spell *, bool)
Definition: ScriptMgr.h:711
virtual GameObjectAI * GetAI(GameObject *) const
Definition: ScriptMgr.h:484
virtual void OnChat(Player *, uint32, uint32, std::string &, Channel *)
Definition: ScriptMgr.h:703
virtual void OnGiveXP(Player *, uint32 &, Unit *)
Definition: ScriptMgr.h:680
Definition: ScriptMgr.h:359
Difficulty
Definition: DBCEnums.h:402
Definition: ScriptMgr.h:406
virtual void OnChat(Player *, uint32, uint32, std::string &, Group *)
Definition: ScriptMgr.h:699
virtual void ModifyMeleeDamage(Unit *, Unit *, uint32 &)
Definition: ScriptMgr.h:400
Definition: ScriptMgr.h:340
Definition: ScriptMgr.h:233
Definition: ScriptMgr.h:173
virtual void OnLogout(Player *)
Definition: ScriptMgr.h:717
BattlegroundTypeId
Definition: SharedDefines.h:4558
virtual void OnShutdownCancel()
Definition: ScriptMgr.h:254
int8_t int8
Definition: Define.h:148
virtual void OnBindToInstance(Player *, Difficulty, uint32, bool, uint8)
Definition: ScriptMgr.h:732
virtual ~ScriptObject()
Definition: ScriptMgr.h:164
Definition: QuestDef.h:279
virtual void OnDuelRequest(Player *, Player *)
Definition: ScriptMgr.h:686
virtual void OnUninstall(Vehicle *)
Definition: ScriptMgr.h:592
ScriptLoaderCallbackType _script_loader_callback
Definition: ScriptMgr.h:1110
virtual void OnChat(Player *, uint32, uint32, std::string &, Player *)
Definition: ScriptMgr.h:697
Definition: ConditionMgr.h:194
virtual void OnPacketReceive(WorldSession *, WorldPacket &)
Definition: ScriptMgr.h:230
virtual bool OnConditionCheck(Condition const *, ConditionSourceInfo &)
Definition: ScriptMgr.h:577
virtual InstanceScript * GetInstanceScript(InstanceMap *) const
Definition: ScriptMgr.h:349
Definition: AccountMgr.h:53
int64_t int64
Definition: Define.h:145
virtual bool OnGossipSelect(Player *, Creature *, uint32, uint32)
Definition: ScriptMgr.h:421
virtual AuraScript * GetAuraScript() const
Definition: ScriptMgr.h:200
Definition: ScriptMgr.h:547
virtual bool OnGossipSelectCode(Player *, GameObject *, uint32, uint32, const char *)
Definition: ScriptMgr.h:460
virtual void OnTextEmote(Player *, uint32, uint32, ObjectGuid)
Definition: ScriptMgr.h:708
DuelCompleteType
Definition: SharedDefines.h:4724
Definition: ScriptMgr.h:846
Definition: ScriptMgr.h:296
Definition: ScriptMgr.h:771
virtual void OnChangeLeader(Group *, ObjectGuid, ObjectGuid)
Definition: ScriptMgr.h:830
virtual void OnConfigLoad(bool)
Definition: ScriptMgr.h:245
Definition: ScriptMgr.h:635
MapEntry const * GetEntry()
Definition: ScriptMgr.h:312
virtual bool OnGossipSelect(Player *, GameObject *, uint32, uint32)
Definition: ScriptMgr.h:457
virtual void OnMOTDChanged(Guild *, const std::string &)
Definition: ScriptMgr.h:786
virtual void OnInstallAccessory(Vehicle *, Creature *)
Definition: ScriptMgr.h:598
XPColorChar
Definition: SharedDefines.h:4676
virtual void OnMapChanged(Player *)
Definition: ScriptMgr.h:738
Definition: ScriptMgr.h:568
virtual void OnFailedPasswordChange(uint32)
Definition: ScriptMgr.h:768
uint64 IncreaseScheduledScriptsCount()
Definition: ScriptMgr.h:1098
void IncrementScriptCount()
Definition: ScriptMgr.h:863
UpdatableScript()
Definition: ScriptMgr.h:177
virtual void OnDuelStart(Player *, Player *)
Definition: ScriptMgr.h:689
uint64 DecreaseScheduledScriptCount()
Definition: ScriptMgr.h:1099
virtual void OnSocketOpen(std::shared_ptr< WorldSocket >)
Definition: ScriptMgr.h:218
Definition: ScriptMgr.h:511
virtual void OnDestroy(TMap *)
Definition: ScriptMgr.h:318
virtual void OnAuctionSuccessful(AuctionHouseObject *, AuctionEntry *)
Definition: ScriptMgr.h:562
bool IsScriptScheduled() const
Definition: ScriptMgr.h:1101
virtual void OnUpdate(TObject *, uint32)
Definition: ScriptMgr.h:185
QuestStatus
Definition: QuestDef.h:108
Definition: SpellScript.h:152
Definition: QuestDef.h:136
virtual void OnSocketClose(std::shared_ptr< WorldSocket >)
Definition: ScriptMgr.h:222
virtual void OnGameObjectStateChanged(GameObject *, uint32)
Definition: ScriptMgr.h:481
Definition: DBCStructure.h:830
Definition: AuctionHouseMgr.h:67
virtual void OnCreate(TMap *)
Definition: ScriptMgr.h:315
virtual bool OnUse(Player *, Item *, SpellCastTargets const &)
Definition: ScriptMgr.h:374
arena_t NULL
Definition: jemalloc_internal.h:624
virtual bool OnExpire(Player *, ItemTemplate const *)
Definition: ScriptMgr.h:377
virtual bool OnDummyEffect(Unit *, uint32, SpellEffIndex, Creature *)
Definition: ScriptMgr.h:415
Definition: Transport.h:28
virtual void OnUnloadGridMap(TMap *, GridMap *, uint32, uint32)
Definition: ScriptMgr.h:324
Definition: OutdoorPvPMgr.h:31
Definition: Creature.h:467
virtual void OnChange(Weather *, WeatherState, float)
Definition: ScriptMgr.h:544
std::list< std::string > UnusedScriptNamesContainer
Definition: ScriptMgr.h:841
virtual void OnChat(Player *, uint32, uint32, std::string &, Guild *)
Definition: ScriptMgr.h:701
Definition: ScriptMgr.h:203
virtual bool OnRemove(Player *, Item *)
Definition: ScriptMgr.h:380
virtual void OnAuctionAdd(AuctionHouseObject *, AuctionEntry *)
Definition: ScriptMgr.h:556
virtual void OnUpdateZone(Player *, uint32, uint32)
Definition: ScriptMgr.h:735
uint64 LowType
Definition: ObjectGuid.h:199
virtual void OnShutdown()
Definition: ScriptMgr.h:263
LIBPROTOBUF_EXPORT void OnShutdown(void(*func)())
Definition: Channel.h:126
Definition: GameObjectAI.h:29
virtual void OnFailedAccountLogin(uint32)
Definition: ScriptMgr.h:756
virtual void OnQuestStatusChange(Player *, uint32, QuestStatus)
Definition: ScriptMgr.h:741
virtual void OnBankEvent(Guild *, uint8, uint8, ObjectGuid::LowType, uint64, uint16, uint8)
Definition: ScriptMgr.h:809
virtual void OnSave(Player *)
Definition: ScriptMgr.h:729
RemoveMethod
Definition: SharedDefines.h:4685
virtual void OnAddMember(Group *, ObjectGuid)
Definition: ScriptMgr.h:821
virtual void OnAddMember(Guild *, Player *, uint8 &)
Definition: ScriptMgr.h:780
virtual void OnChat(Player *, uint32, uint32, std::string &)
Definition: ScriptMgr.h:695
const std::string _name
Definition: ScriptMgr.h:170
virtual void OnDelete(ObjectGuid, uint32)
Definition: ScriptMgr.h:723
virtual void OnDestroyed(GameObject *, Player *)
Definition: ScriptMgr.h:472
virtual void OnInstall(Vehicle *)
Definition: ScriptMgr.h:589
virtual void OnPacketSend(WorldSession *, WorldPacket &)
Definition: ScriptMgr.h:226
Definition: DynamicObject.h:35
virtual SpellScript * GetSpellScript() const
Definition: ScriptMgr.h:197
virtual void OnLogin(Player *, bool)
Definition: ScriptMgr.h:714
virtual void OnCreate(Player *)
Definition: ScriptMgr.h:720
Definition: ScriptMgr.h:523
virtual void OnPlayerKilledByCreature(Creature *, Player *)
Definition: ScriptMgr.h:662
virtual void ModifyPeriodicDamageAurasTick(Unit *, Unit *, uint32 &)
Definition: ScriptMgr.h:397
virtual void OnClearEmote(Player *)
Definition: ScriptMgr.h:706
virtual void OnInfoChanged(Guild *, const std::string &)
Definition: ScriptMgr.h:789
virtual void OnFailedDelete(ObjectGuid, uint32)
Definition: ScriptMgr.h:726
virtual void ModifySpellDamageTaken(Unit *, Unit *, int32 &)
Definition: ScriptMgr.h:403
virtual void OnAddPassenger(Transport *, Player *)
Definition: ScriptMgr.h:623
virtual void OnDamage(Unit *, Unit *, uint32 &)
Definition: ScriptMgr.h:394
virtual bool OnQuestAccept(Player *, Item *, Quest const *)
Definition: ScriptMgr.h:371
MapEntry const * _mapEntry
Definition: ScriptMgr.h:298
G3D::int16 z
Definition: Vector3int16.h:46
uint32 _scriptCount
Definition: ScriptMgr.h:1105
virtual CreatureAI * GetAI(Creature *) const
Definition: ScriptMgr.h:439
ShutdownMask
Definition: World.h:65
const char * ScriptsVersion() const
Definition: ScriptMgr.h:861
virtual void OnAuctionRemove(AuctionHouseObject *, AuctionEntry *)
Definition: ScriptMgr.h:559
SpellEffIndex
Definition: SharedDefines.h:26
Definition: WorldSocket.h:70
virtual void OnNetworkStop()
Definition: ScriptMgr.h:215
virtual void OnDisband(Group *)
Definition: ScriptMgr.h:833
int32_t int32
Definition: Define.h:146
Definition: CreatureAI.h:68
uint32_t uint32
Definition: Define.h:150
static void Initialize(PCASC_SALSA20 pState, LPBYTE pbKey, DWORD cbKeyLength, LPBYTE pbVector)
Definition: CascDecrypt.cpp:81
virtual void OnLootStateChanged(GameObject *, uint32, Unit *)
Definition: ScriptMgr.h:478
uint64_t uint64
Definition: Define.h:149
Definition: ScriptMgr.h:744
G3D::int16 y
Definition: Vector2int16.h:38
Definition: ConditionMgr.h:181
uint16_t uint16
Definition: Define.h:151
Definition: GameObject.h:880
Definition: ScriptMgr.h:333
virtual void OnRemovePassenger(Transport *, Player *)
Definition: ScriptMgr.h:629
virtual void OnReset(Vehicle *)
Definition: ScriptMgr.h:595
virtual void OnLoadGridMap(TMap *, GridMap *, uint32, uint32)
Definition: ScriptMgr.h:321
std::atomic< uint64 > _scheduledScripts
Definition: ScriptMgr.h:1108
Definition: ScriptMgr.h:499
Definition: ScriptMgr.h:149
virtual void OnEvent(Guild *, uint8, ObjectGuid::LowType, ObjectGuid::LowType, uint8)
Definition: ScriptMgr.h:807
virtual bool OnGossipSelectCode(Player *, Creature *, uint32, uint32, const char *)
Definition: ScriptMgr.h:424
virtual void OnCreatureKill(Player *, Creature *)
Definition: ScriptMgr.h:659
virtual void OnItemMove(Guild *, Player *, Item *, bool, uint8, uint8, bool, uint8, uint8)
Definition: ScriptMgr.h:804
Definition: ScriptMgr.h:487
virtual void OnLevelChanged(Player *, uint8)
Definition: ScriptMgr.h:665
virtual void OnRemoveMember(Group *, ObjectGuid, RemoveMethod, ObjectGuid, const char *)
Definition: ScriptMgr.h:827
Definition: inftrees.h:24
Definition: ScriptMgr.h:580
virtual uint32 GetDialogStatus(Player *, Creature *)
Definition: ScriptMgr.h:436
MapScript(uint32 mapId)
Definition: ScriptMgr.h:302
virtual void OnPasswordChange(uint32)
Definition: ScriptMgr.h:765
Definition: ScriptMgr.h:812
virtual bool OnTrigger(Player *, AreaTriggerEntry const *, bool)
Definition: ScriptMgr.h:496
Definition: ScriptMgr.h:535
Definition: ScriptMgr.h:607
virtual void OnTalentsReset(Player *, bool)
Definition: ScriptMgr.h:671
virtual void OnHeal(Unit *, Unit *, uint32 &)
Definition: ScriptMgr.h:391
friend class ScriptMgr
Definition: ScriptMgr.h:151
virtual ~UpdatableScript()
Definition: ScriptMgr.h:181
virtual void OnPVPKill(Player *, Player *)
Definition: ScriptMgr.h:656
virtual bool OnGossipHello(Player *, GameObject *)
Definition: ScriptMgr.h:454
virtual uint32 GetDialogStatus(Player *, GameObject *)
Definition: ScriptMgr.h:469
Definition: OutdoorPvP.h:188
Definition: ItemTemplate.h:647
virtual void OnEmailChange(uint32)
Definition: ScriptMgr.h:759
Definition: ScriptMgr.h:442
Definition: ScriptMgr.h:614
DBCStorage< MapEntry > sMapStore(Mapfmt)
Definition: ScriptMgr.h:647
virtual void OnPlayerLeave(TMap *, Player *)
Definition: ScriptMgr.h:330
virtual void OnRemoveMember(Guild *, ObjectGuid, bool, bool)
Definition: ScriptMgr.h:783
uint32 GetScriptCount() const
Definition: ScriptMgr.h:864
virtual bool OnQuestAccept(Player *, Creature *, Quest const *)
Definition: ScriptMgr.h:427
#define TC_GAME_API
Definition: Define.h:134
virtual void OnDisband(Guild *)
Definition: ScriptMgr.h:795
virtual bool OnQuestAccept(Player *, GameObject *, Quest const *)
Definition: ScriptMgr.h:463
virtual void OnNetworkStart()
Definition: ScriptMgr.h:212
Definition: ScriptMgr.h:383
virtual void OnRelocate(Transport *, uint32, uint32, float, float, float)
Definition: ScriptMgr.h:632
virtual void OnAuctionExpire(AuctionHouseObject *, AuctionEntry *)
Definition: ScriptMgr.h:565
virtual void OnReputationChange(Player *, uint32, int32 &, bool)
Definition: ScriptMgr.h:683
Definition: InstanceScript.h:141
virtual void OnInviteMember(Group *, ObjectGuid)
Definition: ScriptMgr.h:824
TC_GAME_API UnusedScriptNamesContainer UnusedScriptNames
Definition: ScriptMgr.cpp:40
uint8_t uint8
Definition: Define.h:152
const std::string & GetName() const
Definition: ScriptMgr.h:155
uint64 DecreaseScheduledScriptCount(uint64 count)
Definition: ScriptMgr.h:1100
virtual void OnFreeTalentPointsChanged(Player *, uint32)
Definition: ScriptMgr.h:668
Definition: AuctionHouseMgr.h:100
virtual void OnMoneyLimit(Player *, int64)
Definition: ScriptMgr.h:677
virtual bool OnDummyEffect(Unit *, uint32, SpellEffIndex, GameObject *)
Definition: ScriptMgr.h:451
Definition: ScriptMgr.h:188
Definition: Battleground.h:235
Definition: DBCStructure.h:74
virtual void OnShutdownInitiate(ShutdownExitCode, ShutdownMask)
Definition: ScriptMgr.h:251
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
ScriptObject(const char *name)
Definition: ScriptMgr.h:159
Player session in the World.
Definition: WorldSession.h:882
virtual void OnMemberDepositMoney(Guild *, Player *, uint64 &)
Definition: ScriptMgr.h:801
Definition: ObjectGuid.h:189
G3D::int16 x
Definition: Vector2int16.h:37
Weather for one zone.
Definition: Weather.h:65
virtual void OnDamaged(GameObject *, Player *)
Definition: ScriptMgr.h:475
Definition: SpellScript.h:475
Definition: ScriptMgr.h:352
virtual void OnMotdChange(std::string &)
Definition: ScriptMgr.h:248
virtual bool OnQuestSelect(Player *, Creature *, Quest const *)
Definition: ScriptMgr.h:430
virtual bool OnGossipHello(Player *, Creature *)
Definition: ScriptMgr.h:418
virtual void OnRemovePassenger(Vehicle *, Unit *)
Definition: ScriptMgr.h:604
virtual void OnMemberWitdrawMoney(Guild *, Player *, uint64 &, bool)
Definition: ScriptMgr.h:798
Definition: WorldPacket.h:26
void SetScriptLoader(ScriptLoaderCallbackType script_loader_callback)
Definition: ScriptMgr.h:870
virtual void OnAccountLogin(uint32)
Definition: ScriptMgr.h:753
WeatherState
Definition: Weather.h:46
virtual void OnStartup()
Definition: ScriptMgr.h:260
virtual void OnAddCreaturePassenger(Transport *, Creature *)
Definition: ScriptMgr.h:626
virtual bool OnQuestReward(Player *, GameObject *, Quest const *, uint32)
Definition: ScriptMgr.h:466
virtual bool OnQuestReward(Player *, Creature *, Quest const *, uint32)
Definition: ScriptMgr.h:433
virtual void OnPlayerEnter(TMap *, Player *)
Definition: ScriptMgr.h:327
virtual void OnDuelEnd(Player *, Player *, DuelCompleteType)
Definition: ScriptMgr.h:692
virtual void OnCreate(Guild *, Player *, const std::string &)
Definition: ScriptMgr.h:792
virtual void OnAddPassenger(Vehicle *, Unit *, int8)
Definition: ScriptMgr.h:601
ShutdownExitCode
Definition: World.h:71
virtual void OnFailedEmailChange(uint32)
Definition: ScriptMgr.h:762
virtual bool OnDummyEffect(Unit *, uint32, SpellEffIndex, Item *)
Definition: ScriptMgr.h:368
virtual void OnMoneyChanged(Player *, int64 &)
Definition: ScriptMgr.h:674
virtual void OnUpdate(uint32)
Definition: ScriptMgr.h:257