diff --git a/src/server/game/Scripting/ScriptDefines/AccountScript.cpp b/src/server/game/Scripting/ScriptDefines/AccountScript.cpp
new file mode 100644
index 000000000..99ac4c799
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AccountScript.cpp
@@ -0,0 +1,83 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnAccountLogin(uint32 accountId)
+{
+ ExecuteScript([&](AccountScript* script)
+ {
+ script->OnAccountLogin(accountId);
+ });
+}
+
+//void ScriptMgr::OnAccountLogout(uint32 accountId)
+//{
+// ExecuteScript([&](AccountScript* script)
+// {
+// script->OnAccountLogout(accountId);
+// });
+//}
+
+void ScriptMgr::OnLastIpUpdate(uint32 accountId, std::string ip)
+{
+ ExecuteScript([&](AccountScript* script)
+ {
+ script->OnLastIpUpdate(accountId, ip);
+ });
+}
+
+void ScriptMgr::OnFailedAccountLogin(uint32 accountId)
+{
+ ExecuteScript([&](AccountScript* script)
+ {
+ script->OnFailedAccountLogin(accountId);
+ });
+}
+
+void ScriptMgr::OnEmailChange(uint32 accountId)
+{
+ ExecuteScript([&](AccountScript* script)
+ {
+ script->OnEmailChange(accountId);
+ });
+}
+
+void ScriptMgr::OnFailedEmailChange(uint32 accountId)
+{
+ ExecuteScript([&](AccountScript* script)
+ {
+ script->OnFailedEmailChange(accountId);
+ });
+}
+
+void ScriptMgr::OnPasswordChange(uint32 accountId)
+{
+ ExecuteScript([&](AccountScript* script)
+ {
+ script->OnPasswordChange(accountId);
+ });
+}
+
+void ScriptMgr::OnFailedPasswordChange(uint32 accountId)
+{
+ ExecuteScript([&](AccountScript* script)
+ {
+ script->OnFailedPasswordChange(accountId);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.cpp b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.cpp
new file mode 100644
index 000000000..871dc8865
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.cpp
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+bool ScriptMgr::OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target, uint32 criteria_id)
+{
+ ASSERT(source);
+ // target can be nullptr.
+
+ auto tempScript = ScriptRegistry::GetScriptById(scriptId);
+ return tempScript ? tempScript->OnCheck(source, target, criteria_id) : false;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/AchievementScript.cpp b/src/server/game/Scripting/ScriptDefines/AchievementScript.cpp
new file mode 100644
index 000000000..e99ade7e4
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AchievementScript.cpp
@@ -0,0 +1,80 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::SetRealmCompleted(AchievementEntry const* achievement)
+{
+ ExecuteScript([&](AchievementScript* script)
+ {
+ script->SetRealmCompleted(achievement);
+ });
+}
+
+bool ScriptMgr::IsCompletedCriteria(AchievementMgr* mgr, AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement, CriteriaProgress const* progress)
+{
+ auto ret = IsValidBoolScript([&](AchievementScript* script)
+ {
+ return !script->IsCompletedCriteria(mgr, achievementCriteria, achievement, progress);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ScriptMgr::IsRealmCompleted(AchievementGlobalMgr const* globalmgr, AchievementEntry const* achievement, SystemTimePoint completionTime)
+{
+ auto ret = IsValidBoolScript([&](AchievementScript* script)
+ {
+ return !script->IsRealmCompleted(globalmgr, achievement, completionTime);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void ScriptMgr::OnBeforeCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntryList const* achievementCriteriaList)
+{
+ ExecuteScript([&](AchievementScript* script)
+ {
+ script->OnBeforeCheckCriteria(mgr, achievementCriteriaList);
+ });
+}
+
+bool ScriptMgr::CanCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntry const* achievementCriteria)
+{
+ auto ret = IsValidBoolScript([&](AchievementScript* script)
+ {
+ return !script->CanCheckCriteria(mgr, achievementCriteria);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/AllCreatureScript.cpp b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.cpp
new file mode 100644
index 000000000..8fa40dd2b
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.cpp
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnCreatureAddWorld(Creature* creature)
+{
+ ASSERT(creature);
+
+ ExecuteScript([&](AllCreatureScript* script)
+ {
+ script->OnCreatureAddWorld(creature);
+ });
+}
+
+void ScriptMgr::OnCreatureRemoveWorld(Creature* creature)
+{
+ ASSERT(creature);
+
+ ExecuteScript([&](AllCreatureScript* script)
+ {
+ script->OnCreatureRemoveWorld(creature);
+ });
+}
+
+void ScriptMgr::Creature_SelectLevel(const CreatureTemplate* cinfo, Creature* creature)
+{
+ ExecuteScript([&](AllCreatureScript* script)
+ {
+ script->Creature_SelectLevel(cinfo, creature);
+ });
+}
+
+//bool ScriptMgr::CanCreatureSendListInventory(Player* player, Creature* creature, uint32 vendorEntry)
+//{
+// auto ret = IsValidBoolScript([&](AllCreatureScript* script)
+// {
+// return !script->CanCreatureSendListInventory(player, creature, vendorEntry);
+// });
+//
+// if (ret && *ret)
+// return false;
+//
+// return true;
+//}
diff --git a/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.cpp
new file mode 100644
index 000000000..39d4d62b2
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.cpp
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnGameObjectAddWorld(GameObject* go)
+{
+ ASSERT(go);
+
+ ExecuteScript([&](AllGameObjectScript* script)
+ {
+ script->OnGameObjectAddWorld(go);
+ });
+}
+
+void ScriptMgr::OnGameObjectRemoveWorld(GameObject* go)
+{
+ ASSERT(go);
+
+ ExecuteScript([&](AllGameObjectScript* script)
+ {
+ script->OnGameObjectRemoveWorld(go);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/AllMapScript.cpp b/src/server/game/Scripting/ScriptDefines/AllMapScript.cpp
new file mode 100644
index 000000000..5dc11d58b
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllMapScript.cpp
@@ -0,0 +1,353 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+namespace
+{
+ template
+ inline void ForeachMaps([[maybe_unused]] Map* map, [[maybe_unused]] std::function executeHook)
+ {
+ static_assert(Acore::dependant_false_v, "Unsupported type used for ForeachMaps");
+ }
+
+ template<>
+ inline void ForeachMaps(Map* map, std::function executeHook)
+ {
+ auto mapEntry = map->GetEntry();
+
+ if (!mapEntry)
+ {
+ return;
+ }
+
+ if (!mapEntry->IsWorldMap())
+ {
+ return;
+ }
+
+ if (ScriptRegistry::ScriptPointerList.empty())
+ {
+ return;
+ }
+
+ for (auto const& [scriptID, script] : ScriptRegistry::ScriptPointerList)
+ {
+ MapEntry const* mapEntry = script->GetEntry();
+ if (!mapEntry)
+ {
+ continue;
+ }
+
+ if (mapEntry->MapID != map->GetId())
+ {
+ continue;
+ }
+
+ executeHook(script);
+ return;
+ }
+ }
+
+ template<>
+ inline void ForeachMaps(Map* map, std::function executeHook)
+ {
+ auto mapEntry = map->GetEntry();
+
+ if (!mapEntry)
+ {
+ return;
+ }
+
+ if (!mapEntry->IsDungeon())
+ {
+ return;
+ }
+
+ if (ScriptRegistry::ScriptPointerList.empty())
+ {
+ return;
+ }
+
+ for (auto const& [scriptID, script] : ScriptRegistry::ScriptPointerList)
+ {
+ MapEntry const* mapEntry = script->GetEntry();
+ if (!mapEntry)
+ {
+ continue;
+ }
+
+ if (mapEntry->MapID != map->GetId())
+ {
+ continue;
+ }
+
+ executeHook(script);
+ return;
+ }
+ }
+
+ template<>
+ inline void ForeachMaps(Map* map, std::function executeHook)
+ {
+ auto mapEntry = map->GetEntry();
+
+ if (!mapEntry)
+ {
+ return;
+ }
+
+ if (!mapEntry->IsBattleground())
+ {
+ return;
+ }
+
+ if (ScriptRegistry::ScriptPointerList.empty())
+ {
+ return;
+ }
+
+ for (auto const& [scriptID, script] : ScriptRegistry::ScriptPointerList)
+ {
+ MapEntry const* mapEntry = script->GetEntry();
+ if (!mapEntry)
+ {
+ continue;
+ }
+
+ if (mapEntry->MapID != map->GetId())
+ {
+ continue;
+ }
+
+ executeHook(script);
+ return;
+ }
+ }
+}
+
+void ScriptMgr::OnCreateMap(Map* map)
+{
+ ASSERT(map);
+
+ ExecuteScript([&](AllMapScript* script)
+ {
+ script->OnCreateMap(map);
+ });
+
+ ForeachMaps(map,
+ [&](WorldMapScript* script)
+ {
+ script->OnCreate(map);
+ });
+
+ ForeachMaps(map,
+ [&](InstanceMapScript* script)
+ {
+ script->OnCreate((InstanceMap*)map);
+ });
+
+ ForeachMaps(map,
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnCreate((BattlegroundMap*)map);
+ });
+}
+
+void ScriptMgr::OnDestroyMap(Map* map)
+{
+ ASSERT(map);
+
+ ExecuteScript([&](AllMapScript* script)
+ {
+ script->OnDestroyMap(map);
+ });
+
+ ForeachMaps(map,
+ [&](WorldMapScript* script)
+ {
+ script->OnDestroy(map);
+ });
+
+ ForeachMaps(map,
+ [&](InstanceMapScript* script)
+ {
+ script->OnDestroy((InstanceMap*)map);
+ });
+
+ ForeachMaps(map,
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnDestroy((BattlegroundMap*)map);
+ });
+}
+
+void ScriptMgr::OnLoadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
+{
+ ASSERT(map);
+ ASSERT(gmap);
+
+ ForeachMaps(map,
+ [&](WorldMapScript* script)
+ {
+ script->OnLoadGridMap(map, gmap, gx, gy);
+ });
+
+ ForeachMaps(map,
+ [&](InstanceMapScript* script)
+ {
+ script->OnLoadGridMap((InstanceMap*)map, gmap, gx, gy);
+ });
+
+ ForeachMaps(map,
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnLoadGridMap((BattlegroundMap*)map, gmap, gx, gy);
+ });
+}
+
+void ScriptMgr::OnUnloadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
+{
+ ASSERT(map);
+ ASSERT(gmap);
+
+ ForeachMaps(map,
+ [&](WorldMapScript* script)
+ {
+ script->OnUnloadGridMap(map, gmap, gx, gy);
+ });
+
+ ForeachMaps(map,
+ [&](InstanceMapScript* script)
+ {
+ script->OnUnloadGridMap((InstanceMap*)map, gmap, gx, gy);
+ });
+
+ ForeachMaps(map,
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnUnloadGridMap((BattlegroundMap*)map, gmap, gx, gy);
+ });
+}
+
+void ScriptMgr::OnPlayerEnterMap(Map* map, Player* player)
+{
+ ASSERT(map);
+ ASSERT(player);
+
+ ExecuteScript([&](AllMapScript* script)
+ {
+ script->OnPlayerEnterAll(map, player);
+ });
+
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnMapChanged(player);
+ });
+
+ ForeachMaps(map,
+ [&](WorldMapScript* script)
+ {
+ script->OnPlayerEnter(map, player);
+ });
+
+ ForeachMaps(map,
+ [&](InstanceMapScript* script)
+ {
+ script->OnPlayerEnter((InstanceMap*)map, player);
+ });
+
+ ForeachMaps(map,
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnPlayerEnter((BattlegroundMap*)map, player);
+ });
+}
+
+void ScriptMgr::OnPlayerLeaveMap(Map* map, Player* player)
+{
+ ASSERT(map);
+ ASSERT(player);
+
+ ExecuteScript([&](AllMapScript* script)
+ {
+ script->OnPlayerLeaveAll(map, player);
+ });
+
+ ForeachMaps(map,
+ [&](WorldMapScript* script)
+ {
+ script->OnPlayerLeave(map, player);
+ });
+
+ ForeachMaps(map,
+ [&](InstanceMapScript* script)
+ {
+ script->OnPlayerLeave((InstanceMap*)map, player);
+ });
+
+ ForeachMaps(map,
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnPlayerLeave((BattlegroundMap*)map, player);
+ });
+}
+
+void ScriptMgr::OnMapUpdate(Map* map, uint32 diff)
+{
+ ASSERT(map);
+
+ ExecuteScript([&](AllMapScript* script)
+ {
+ script->OnMapUpdate(map, diff);
+ });
+
+ ForeachMaps(map,
+ [&](WorldMapScript* script)
+ {
+ script->OnUpdate(map, diff);
+ });
+
+ ForeachMaps(map,
+ [&](InstanceMapScript* script)
+ {
+ script->OnUpdate((InstanceMap*)map, diff);
+ });
+
+ ForeachMaps(map,
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnUpdate((BattlegroundMap*)map, diff);
+ });
+}
+
+void ScriptMgr::OnBeforeCreateInstanceScript(InstanceMap* instanceMap, InstanceScript* instanceData, bool load, std::string data, uint32 completedEncounterMask)
+{
+ ExecuteScript([&](AllMapScript* script)
+ {
+ script->OnBeforeCreateInstanceScript(instanceMap, instanceData, load, data, completedEncounterMask);
+ });
+}
+
+void ScriptMgr::OnDestroyInstance(MapInstanced* mapInstanced, Map* map)
+{
+ ExecuteScript([&](AllMapScript* script)
+ {
+ script->OnDestroyInstance(mapInstanced, map);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.cpp b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.cpp
new file mode 100644
index 000000000..fa3a04deb
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.cpp
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+bool ScriptMgr::OnAreaTrigger(Player* player, AreaTrigger const* trigger)
+{
+ ASSERT(player);
+ ASSERT(trigger);
+
+ auto ret = IsValidBoolScript([&](ElunaScript* script)
+ {
+ return script->CanAreaTrigger(player, trigger);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(sObjectMgr->GetAreaTriggerScriptId(trigger->entry));
+ return tempScript ? tempScript->OnTrigger(player, trigger) : false;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/ArenaScript.cpp b/src/server/game/Scripting/ScriptDefines/ArenaScript.cpp
new file mode 100644
index 000000000..0bfc33184
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/ArenaScript.cpp
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+bool ScriptMgr::CanAddMember(ArenaTeam* team, ObjectGuid PlayerGuid)
+{
+ auto ret = IsValidBoolScript([&](ArenaScript* script)
+ {
+ return !script->CanAddMember(team, PlayerGuid);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void ScriptMgr::OnGetPoints(ArenaTeam* team, uint32 memberRating, float& points)
+{
+ ExecuteScript([&](ArenaScript* script)
+ {
+ script->OnGetPoints(team, memberRating, points);
+ });
+}
+
+bool ScriptMgr::CanSaveToDB(ArenaTeam* team)
+{
+ auto ret = IsValidBoolScript([&](ArenaScript* script)
+ {
+ return !script->CanSaveToDB(team);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.cpp b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.cpp
new file mode 100644
index 000000000..25555347a
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.cpp
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnGetSlotByType(const uint32 type, uint8& slot)
+{
+ ExecuteScript([&](ArenaTeamScript* script)
+ {
+ script->OnGetSlotByType(type, slot);
+ });
+}
+
+void ScriptMgr::OnGetArenaPoints(ArenaTeam* at, float& points)
+{
+ ExecuteScript([&](ArenaTeamScript* script)
+ {
+ script->OnGetArenaPoints(at, points);
+ });
+}
+
+void ScriptMgr::OnArenaTypeIDToQueueID(const BattlegroundTypeId bgTypeId, const uint8 arenaType, uint32& queueTypeID)
+{
+ ExecuteScript([&](ArenaTeamScript* script)
+ {
+ script->OnTypeIDToQueueID(bgTypeId, arenaType, queueTypeID);
+ });
+}
+
+void ScriptMgr::OnArenaQueueIdToArenaType(const BattlegroundQueueTypeId bgQueueTypeId, uint8& ArenaType)
+{
+ ExecuteScript([&](ArenaTeamScript* script)
+ {
+ script->OnQueueIdToArenaType(bgQueueTypeId, ArenaType);
+ });
+}
+
+void ScriptMgr::OnSetArenaMaxPlayersPerTeam(const uint8 arenaType, uint32& maxPlayerPerTeam)
+{
+ ExecuteScript([&](ArenaTeamScript* script)
+ {
+ script->OnSetArenaMaxPlayersPerTeam(arenaType, maxPlayerPerTeam);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.cpp b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.cpp
new file mode 100644
index 000000000..e0255d26d
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.cpp
@@ -0,0 +1,119 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnAuctionAdd(AuctionHouseObject* ah, AuctionEntry* entry)
+{
+ ASSERT(ah);
+ ASSERT(entry);
+
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnAuctionAdd(ah, entry);
+ });
+}
+
+void ScriptMgr::OnAuctionRemove(AuctionHouseObject* ah, AuctionEntry* entry)
+{
+ ASSERT(ah);
+ ASSERT(entry);
+
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnAuctionRemove(ah, entry);
+ });
+}
+
+void ScriptMgr::OnAuctionSuccessful(AuctionHouseObject* ah, AuctionEntry* entry)
+{
+ ASSERT(ah);
+ ASSERT(entry);
+
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnAuctionSuccessful(ah, entry);
+ });
+}
+
+void ScriptMgr::OnAuctionExpire(AuctionHouseObject* ah, AuctionEntry* entry)
+{
+ ASSERT(ah);
+ ASSERT(entry);
+
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnAuctionExpire(ah, entry);
+ });
+}
+
+void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionWonMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* bidder, uint32& bidder_accId, bool& sendNotification, bool& updateAchievementCriteria, bool& sendMail)
+{
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnBeforeAuctionHouseMgrSendAuctionWonMail(auctionHouseMgr, auction, bidder, bidder_accId, sendNotification, updateAchievementCriteria, sendMail);
+ });
+}
+
+void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionSalePendingMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, bool& sendMail)
+{
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnBeforeAuctionHouseMgrSendAuctionSalePendingMail(auctionHouseMgr, auction, owner, owner_accId, sendMail);
+ });
+}
+
+void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionSuccessfulMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, uint32& profit, bool& sendNotification, bool& updateAchievementCriteria, bool& sendMail)
+{
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnBeforeAuctionHouseMgrSendAuctionSuccessfulMail(auctionHouseMgr, auction, owner, owner_accId, profit, sendNotification, updateAchievementCriteria, sendMail);
+ });
+}
+
+void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionExpiredMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, bool& sendNotification, bool& sendMail)
+{
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnBeforeAuctionHouseMgrSendAuctionExpiredMail(auctionHouseMgr, auction, owner, owner_accId, sendNotification, sendMail);
+ });
+}
+
+void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionOutbiddedMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* oldBidder, uint32& oldBidder_accId, Player* newBidder, uint32& newPrice, bool& sendNotification, bool& sendMail)
+{
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnBeforeAuctionHouseMgrSendAuctionOutbiddedMail(auctionHouseMgr, auction, oldBidder, oldBidder_accId, newBidder, newPrice, sendNotification, sendMail);
+ });
+}
+
+void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionCancelledToBidderMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* bidder, uint32& bidder_accId, bool& sendMail)
+{
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnBeforeAuctionHouseMgrSendAuctionCancelledToBidderMail(auctionHouseMgr, auction, bidder, bidder_accId, sendMail);
+ });
+}
+
+void ScriptMgr::OnBeforeAuctionHouseMgrUpdate()
+{
+ ExecuteScript([&](AuctionHouseScript* script)
+ {
+ script->OnBeforeAuctionHouseMgrUpdate();
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/BGScript.cpp b/src/server/game/Scripting/ScriptDefines/BGScript.cpp
new file mode 100644
index 000000000..602cb342a
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/BGScript.cpp
@@ -0,0 +1,191 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnBattlegroundStart(Battleground* bg)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnBattlegroundStart(bg);
+ });
+}
+
+void ScriptMgr::OnBattlegroundEndReward(Battleground* bg, Player* player, TeamId winnerTeamId)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnBattlegroundEndReward(bg, player, winnerTeamId);
+ });
+}
+
+void ScriptMgr::OnBattlegroundUpdate(Battleground* bg, uint32 diff)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnBattlegroundUpdate(bg, diff);
+ });
+}
+
+void ScriptMgr::OnBattlegroundAddPlayer(Battleground* bg, Player* player)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnBattlegroundAddPlayer(bg, player);
+ });
+}
+
+void ScriptMgr::OnBattlegroundBeforeAddPlayer(Battleground* bg, Player* player)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnBattlegroundBeforeAddPlayer(bg, player);
+ });
+}
+
+void ScriptMgr::OnBattlegroundRemovePlayerAtLeave(Battleground* bg, Player* player)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnBattlegroundRemovePlayerAtLeave(bg, player);
+ });
+}
+
+void ScriptMgr::OnAddGroup(BattlegroundQueue* queue, GroupQueueInfo* ginfo, uint32& index, Player* leader, Group* grp, PvPDifficultyEntry const* bracketEntry, bool isPremade)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnAddGroup(queue, ginfo, index, leader, grp, bracketEntry, isPremade);
+ });
+}
+
+bool ScriptMgr::CanFillPlayersToBG(BattlegroundQueue* queue, Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id)
+{
+ auto ret = IsValidBoolScript([&](BGScript* script)
+ {
+ return !script->CanFillPlayersToBG(queue, bg, aliFree, hordeFree, bracket_id);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ScriptMgr::CanFillPlayersToBGWithSpecific(BattlegroundQueue* queue, Battleground* bg, const int32 aliFree, const int32 hordeFree,
+ BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId)
+{
+ auto ret = IsValidBoolScript([&](BGScript* script)
+ {
+ return !script->CanFillPlayersToBGWithSpecific(queue, bg, aliFree, hordeFree, thisBracketId, specificQueue, specificBracketId);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void ScriptMgr::OnCheckNormalMatch(BattlegroundQueue* queue, uint32& Coef, Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32& minPlayers, uint32& maxPlayers)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnCheckNormalMatch(queue, Coef, bgTemplate, bracket_id, minPlayers, maxPlayers);
+ });
+}
+
+void ScriptMgr::OnQueueUpdate(BattlegroundQueue* queue, BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnQueueUpdate(queue, bracket_id, isRated, arenaRatedTeamId);
+ });
+}
+
+bool ScriptMgr::CanSendMessageBGQueue(BattlegroundQueue* queue, Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry)
+{
+ auto ret = IsValidBoolScript([&](BGScript* script)
+ {
+ return !script->CanSendMessageBGQueue(queue, leader, bg, bracketEntry);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ScriptMgr::OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* queue, Player* leader, GroupQueueInfo* ginfo, PvPDifficultyEntry const* bracketEntry, bool isRated)
+{
+ auto ret = IsValidBoolScript([&](BGScript* script)
+ {
+ return !script->OnBeforeSendJoinMessageArenaQueue(queue, leader, ginfo, bracketEntry, isRated);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ScriptMgr::OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* queue, GroupQueueInfo* ginfo)
+{
+ auto ret = IsValidBoolScript([&](BGScript* script)
+ {
+ return !script->OnBeforeSendExitMessageArenaQueue(queue, ginfo);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void ScriptMgr::OnBattlegroundEnd(Battleground* bg, TeamId winnerTeam)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnBattlegroundEnd(bg, winnerTeam);
+ });
+}
+
+void ScriptMgr::OnBattlegroundDestroy(Battleground* bg)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnBattlegroundDestroy(bg);
+ });
+}
+
+void ScriptMgr::OnBattlegroundCreate(Battleground* bg)
+{
+ ExecuteScript([&](BGScript* script)
+ {
+ script->OnBattlegroundCreate(bg);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/BattlegroundScript.cpp b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.cpp
new file mode 100644
index 000000000..90aee0057
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/)
+{
+ // TODO: Implement script-side battlegrounds.
+ ABORT();
+ return nullptr;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/CommandSC.cpp b/src/server/game/Scripting/ScriptDefines/CommandSC.cpp
new file mode 100644
index 000000000..a92ff2297
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/CommandSC.cpp
@@ -0,0 +1,42 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnHandleDevCommand(Player* player, std::string& argstr)
+{
+ ExecuteScript([&](CommandSC* script)
+ {
+ script->OnHandleDevCommand(player, argstr);
+ });
+}
+
+bool ScriptMgr::CanExecuteCommand(ChatHandler& handler, std::string_view cmdStr)
+{
+ auto ret = IsValidBoolScript([&](CommandSC* script)
+ {
+ return !script->CanExecuteCommand(handler, cmdStr);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/CommandScript.cpp b/src/server/game/Scripting/ScriptDefines/CommandScript.cpp
new file mode 100644
index 000000000..1aff3e3bb
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/CommandScript.cpp
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+#include "Chat.h"
+
+Acore::ChatCommands::ChatCommandTable ScriptMgr::GetChatCommands()
+{
+ Acore::ChatCommands::ChatCommandTable table;
+
+ for (auto const& [scriptID, script] : ScriptRegistry::ScriptPointerList)
+ {
+ Acore::ChatCommands::ChatCommandTable cmds = script->GetCommands();
+ std::move(cmds.begin(), cmds.end(), std::back_inserter(table));
+ }
+
+ return table;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/ConditionScript.cpp b/src/server/game/Scripting/ScriptDefines/ConditionScript.cpp
new file mode 100644
index 000000000..68d239028
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/ConditionScript.cpp
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+bool ScriptMgr::OnConditionCheck(Condition* condition, ConditionSourceInfo& sourceInfo)
+{
+ ASSERT(condition);
+
+ auto tempScript = ScriptRegistry::GetScriptById(condition->ScriptId);
+ return tempScript ? tempScript->OnConditionCheck(condition, sourceInfo) : true;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/CreatureScript.cpp b/src/server/game/Scripting/ScriptDefines/CreatureScript.cpp
new file mode 100644
index 000000000..e4e54c7dc
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/CreatureScript.cpp
@@ -0,0 +1,186 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+#include "ScriptedGossip.h"
+
+bool ScriptMgr::OnGossipHello(Player* player, Creature* creature)
+{
+ ASSERT(player);
+ ASSERT(creature);
+
+ auto ret = IsValidBoolScript([&](AllCreatureScript* script)
+ {
+ return script->CanCreatureGossipHello(player, creature);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->OnGossipHello(player, creature) : false;
+}
+
+bool ScriptMgr::OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
+{
+ ASSERT(player);
+ ASSERT(creature);
+
+ auto ret = IsValidBoolScript([&](AllCreatureScript* script)
+ {
+ return script->CanCreatureGossipSelect(player, creature, sender, action);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId());
+ return tempScript ? tempScript->OnGossipSelect(player, creature, sender, action) : false;
+}
+
+bool ScriptMgr::OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code)
+{
+ ASSERT(player);
+ ASSERT(creature);
+ ASSERT(code);
+
+ auto ret = IsValidBoolScript([&](AllCreatureScript* script)
+ {
+ return script->CanCreatureGossipSelectCode(player, creature, sender, action, code);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId());
+ return tempScript ? tempScript->OnGossipSelectCode(player, creature, sender, action, code) : false;
+}
+
+bool ScriptMgr::OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
+{
+ ASSERT(player);
+ ASSERT(creature);
+ ASSERT(quest);
+
+ auto ret = IsValidBoolScript([&](AllCreatureScript* script)
+ {
+ return script->CanCreatureQuestAccept(player, creature, quest);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->OnQuestAccept(player, creature, quest) : false;
+}
+
+bool ScriptMgr::OnQuestSelect(Player* player, Creature* creature, Quest const* quest)
+{
+ ASSERT(player);
+ ASSERT(creature);
+ ASSERT(quest);
+
+ auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->OnQuestSelect(player, creature, quest) : false;
+}
+
+bool ScriptMgr::OnQuestComplete(Player* player, Creature* creature, Quest const* quest)
+{
+ ASSERT(player);
+ ASSERT(creature);
+ ASSERT(quest);
+
+ auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->OnQuestComplete(player, creature, quest) : false;
+}
+
+bool ScriptMgr::OnQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt)
+{
+ ASSERT(player);
+ ASSERT(creature);
+ ASSERT(quest);
+
+ auto ret = IsValidBoolScript([&](AllCreatureScript* script)
+ {
+ return script->CanCreatureQuestReward(player, creature, quest, opt);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->OnQuestReward(player, creature, quest, opt) : false;
+}
+
+uint32 ScriptMgr::GetDialogStatus(Player* player, Creature* creature)
+{
+ ASSERT(player);
+ ASSERT(creature);
+
+ auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->GetDialogStatus(player, creature) : DIALOG_STATUS_SCRIPTED_NO_STATUS;
+}
+
+CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature)
+{
+ ASSERT(creature);
+
+ auto retAI = GetReturnAIScript([creature](AllCreatureScript* script)
+ {
+ return script->GetCreatureAI(creature);
+ });
+
+ if (retAI)
+ {
+ return retAI;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId());
+ return tempScript ? tempScript->GetAI(creature) : nullptr;
+}
+
+void ScriptMgr::OnCreatureUpdate(Creature* creature, uint32 diff)
+{
+ ASSERT(creature);
+
+ ExecuteScript([&](AllCreatureScript* script)
+ {
+ script->OnAllCreatureUpdate(creature, diff);
+ });
+
+ if (auto tempScript = ScriptRegistry::GetScriptById(creature->GetScriptId()))
+ {
+ tempScript->OnUpdate(creature, diff);
+ }
+}
diff --git a/src/server/game/Scripting/ScriptDefines/DatabaseScript.cpp b/src/server/game/Scripting/ScriptDefines/DatabaseScript.cpp
new file mode 100644
index 000000000..b4debdf2f
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/DatabaseScript.cpp
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnAfterDatabasesLoaded(uint32 updateFlags)
+{
+ ExecuteScript([&](DatabaseScript* script)
+ {
+ script->OnAfterDatabasesLoaded(updateFlags);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.cpp
new file mode 100644
index 000000000..80f126930
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.cpp
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnDynamicObjectUpdate(DynamicObject* dynobj, uint32 diff)
+{
+ ASSERT(dynobj);
+
+ for (auto const& [scriptID, script] : ScriptRegistry::ScriptPointerList)
+ {
+ script->OnUpdate(dynobj, diff);
+ }
+}
diff --git a/src/server/game/Scripting/ScriptDefines/FormulaScript.cpp b/src/server/game/Scripting/ScriptDefines/FormulaScript.cpp
new file mode 100644
index 000000000..c4d029b0a
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/FormulaScript.cpp
@@ -0,0 +1,94 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnHonorCalculation(float& honor, uint8 level, float multiplier)
+{
+ ExecuteScript([&](FormulaScript* script)
+ {
+ script->OnHonorCalculation(honor, level, multiplier);
+ });
+}
+
+void ScriptMgr::OnGrayLevelCalculation(uint8& grayLevel, uint8 playerLevel)
+{
+ ExecuteScript([&](FormulaScript* script)
+ {
+ script->OnGrayLevelCalculation(grayLevel, playerLevel);
+ });
+}
+
+void ScriptMgr::OnColorCodeCalculation(XPColorChar& color, uint8 playerLevel, uint8 mobLevel)
+{
+ ExecuteScript([&](FormulaScript* script)
+ {
+ script->OnColorCodeCalculation(color, playerLevel, mobLevel);
+ });
+}
+
+void ScriptMgr::OnZeroDifferenceCalculation(uint8& diff, uint8 playerLevel)
+{
+ ExecuteScript([&](FormulaScript* script)
+ {
+ script->OnZeroDifferenceCalculation(diff, playerLevel);
+ });
+}
+
+void ScriptMgr::OnBaseGainCalculation(uint32& gain, uint8 playerLevel, uint8 mobLevel, ContentLevels content)
+{
+ ExecuteScript([&](FormulaScript* script)
+ {
+ script->OnBaseGainCalculation(gain, playerLevel, mobLevel, content);
+ });
+}
+
+void ScriptMgr::OnGainCalculation(uint32& gain, Player* player, Unit* unit)
+{
+ ASSERT(player);
+ ASSERT(unit);
+
+ ExecuteScript([&](FormulaScript* script)
+ {
+ script->OnGainCalculation(gain, player, unit);
+ });
+}
+
+void ScriptMgr::OnGroupRateCalculation(float& rate, uint32 count, bool isRaid)
+{
+ ExecuteScript([&](FormulaScript* script)
+ {
+ script->OnGroupRateCalculation(rate, count, isRaid);
+ });
+}
+
+void ScriptMgr::OnAfterArenaRatingCalculation(Battleground* const bg, int32& winnerMatchmakerChange, int32& loserMatchmakerChange, int32& winnerChange, int32& loserChange)
+{
+ ExecuteScript([&](FormulaScript* script)
+ {
+ script->OnAfterArenaRatingCalculation(bg, winnerMatchmakerChange, loserMatchmakerChange, winnerChange, loserChange);
+ });
+}
+
+void ScriptMgr::OnBeforeUpdatingPersonalRating(int32& mod, uint32 type)
+{
+ ExecuteScript([&](FormulaScript* script)
+ {
+ script->OnBeforeUpdatingPersonalRating(mod, type);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/GameEventScript.cpp b/src/server/game/Scripting/ScriptDefines/GameEventScript.cpp
new file mode 100644
index 000000000..d489083ce
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/GameEventScript.cpp
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnGameEventStart(uint16 EventID)
+{
+ ExecuteScript([&](GameEventScript* script)
+ {
+ script->OnStart(EventID);
+ });
+}
+
+void ScriptMgr::OnGameEventStop(uint16 EventID)
+{
+ ExecuteScript([&](GameEventScript* script)
+ {
+ script->OnStop(EventID);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/GameObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/GameObjectScript.cpp
new file mode 100644
index 000000000..abf62eb58
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/GameObjectScript.cpp
@@ -0,0 +1,224 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+#include "ScriptedGossip.h"
+
+bool ScriptMgr::OnGossipHello(Player* player, GameObject* go)
+{
+ ASSERT(player);
+ ASSERT(go);
+
+ auto ret = IsValidBoolScript([&](AllGameObjectScript* script)
+ {
+ return script->CanGameObjectGossipHello(player, go);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->OnGossipHello(player, go) : false;
+}
+
+bool ScriptMgr::OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action)
+{
+ ASSERT(player);
+ ASSERT(go);
+
+ auto ret = IsValidBoolScript([&](AllGameObjectScript* script)
+ {
+ return script->CanGameObjectGossipSelect(player, go, sender, action);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId());
+ return tempScript ? tempScript->OnGossipSelect(player, go, sender, action) : false;
+}
+
+bool ScriptMgr::OnGossipSelectCode(Player* player, GameObject* go, uint32 sender, uint32 action, const char* code)
+{
+ ASSERT(player);
+ ASSERT(go);
+ ASSERT(code);
+
+ auto ret = IsValidBoolScript([&](AllGameObjectScript* script)
+ {
+ return script->CanGameObjectGossipSelectCode(player, go, sender, action, code);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId());
+ return tempScript ? tempScript->OnGossipSelectCode(player, go, sender, action, code) : false;
+}
+
+bool ScriptMgr::OnQuestAccept(Player* player, GameObject* go, Quest const* quest)
+{
+ ASSERT(player);
+ ASSERT(go);
+ ASSERT(quest);
+
+ auto ret = IsValidBoolScript([&](AllGameObjectScript* script)
+ {
+ return script->CanGameObjectQuestAccept(player, go, quest);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->OnQuestAccept(player, go, quest) : false;
+}
+
+bool ScriptMgr::OnQuestReward(Player* player, GameObject* go, Quest const* quest, uint32 opt)
+{
+ ASSERT(player);
+ ASSERT(go);
+ ASSERT(quest);
+
+ auto ret = IsValidBoolScript([&](AllGameObjectScript* script)
+ {
+ return script->CanGameObjectQuestReward(player, go, quest, opt);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->OnQuestReward(player, go, quest, opt) : false;
+}
+
+uint32 ScriptMgr::GetDialogStatus(Player* player, GameObject* go)
+{
+ ASSERT(player);
+ ASSERT(go);
+
+ auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->GetDialogStatus(player, go) : DIALOG_STATUS_SCRIPTED_NO_STATUS;
+}
+
+void ScriptMgr::OnGameObjectDestroyed(GameObject* go, Player* player)
+{
+ ASSERT(go);
+
+ ExecuteScript([&](AllGameObjectScript* script)
+ {
+ script->OnGameObjectDestroyed(go, player);
+ });
+
+ if (auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId()))
+ {
+ tempScript->OnDestroyed(go, player);
+ }
+}
+
+void ScriptMgr::OnGameObjectDamaged(GameObject* go, Player* player)
+{
+ ASSERT(go);
+
+ ExecuteScript([&](AllGameObjectScript* script)
+ {
+ script->OnGameObjectDamaged(go, player);
+ });
+
+ if (auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId()))
+ {
+ tempScript->OnDamaged(go, player);
+ }
+}
+
+void ScriptMgr::OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit)
+{
+ ASSERT(go);
+
+ ExecuteScript([&](AllGameObjectScript* script)
+ {
+ script->OnGameObjectLootStateChanged(go, state, unit);
+ });
+
+ if (auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId()))
+ {
+ tempScript->OnLootStateChanged(go, state, unit);
+ }
+}
+
+void ScriptMgr::OnGameObjectStateChanged(GameObject* go, uint32 state)
+{
+ ASSERT(go);
+
+ ExecuteScript([&](AllGameObjectScript* script)
+ {
+ script->OnGameObjectStateChanged(go, state);
+ });
+
+ if (auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId()))
+ {
+ tempScript->OnGameObjectStateChanged(go, state);
+ }
+}
+
+void ScriptMgr::OnGameObjectUpdate(GameObject* go, uint32 diff)
+{
+ ASSERT(go);
+
+ ExecuteScript([&](AllGameObjectScript* script)
+ {
+ script->OnGameObjectUpdate(go, diff);
+ });
+
+ if (auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId()))
+ {
+ tempScript->OnUpdate(go, diff);
+ }
+}
+
+GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go)
+{
+ ASSERT(go);
+
+ auto retAI = GetReturnAIScript([go](AllGameObjectScript* script)
+ {
+ return script->GetGameObjectAI(go);
+ });
+
+ if (retAI)
+ {
+ return retAI;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId());
+ return tempScript ? tempScript->GetAI(go) : nullptr;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/GlobalScript.cpp b/src/server/game/Scripting/ScriptDefines/GlobalScript.cpp
new file mode 100644
index 000000000..642f5b3fe
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/GlobalScript.cpp
@@ -0,0 +1,124 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnGlobalItemDelFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
+{
+ ASSERT(trans);
+ ASSERT(itemGuid);
+
+ ExecuteScript([&](GlobalScript* script)
+ {
+ script->OnItemDelFromDB(trans, itemGuid);
+ });
+}
+
+void ScriptMgr::OnGlobalMirrorImageDisplayItem(const Item* item, uint32& display)
+{
+ ExecuteScript([&](GlobalScript* script)
+ {
+ script->OnMirrorImageDisplayItem(item, display);
+ });
+}
+
+void ScriptMgr::OnBeforeUpdateArenaPoints(ArenaTeam* at, std::map& ap)
+{
+ ExecuteScript([&](GlobalScript* script)
+ {
+ script->OnBeforeUpdateArenaPoints(at, ap);
+ });
+}
+
+void ScriptMgr::OnAfterRefCount(Player const* player, Loot& loot, bool canRate, uint16 lootMode, LootStoreItem* LootStoreItem, uint32& maxcount, LootStore const& store)
+{
+ ExecuteScript([&](GlobalScript* script)
+ {
+ script->OnAfterRefCount(player, LootStoreItem, loot, canRate, lootMode, maxcount, store);
+ });
+}
+
+void ScriptMgr::OnBeforeDropAddItem(Player const* player, Loot& loot, bool canRate, uint16 lootMode, LootStoreItem* LootStoreItem, LootStore const& store)
+{
+ ExecuteScript([&](GlobalScript* script)
+ {
+ script->OnBeforeDropAddItem(player, loot, canRate, lootMode, LootStoreItem, store);
+ });
+}
+
+bool ScriptMgr::OnItemRoll(Player const* player, LootStoreItem const* lootStoreItem, float& chance, Loot& loot, LootStore const& store)
+{
+ auto ret = IsValidBoolScript([&](GlobalScript* script)
+ {
+ return !script->OnItemRoll(player, lootStoreItem, chance, loot, store);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ScriptMgr::OnBeforeLootEqualChanced(Player const* player, LootStoreItemList EqualChanced, Loot& loot, LootStore const& store)
+{
+ auto ret = IsValidBoolScript([&](GlobalScript* script)
+ {
+ return !script->OnBeforeLootEqualChanced(player, EqualChanced, loot, store);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void ScriptMgr::OnInitializeLockedDungeons(Player* player, uint8& level, uint32& lockData, lfg::LFGDungeonData const* dungeon)
+{
+ ExecuteScript([&](GlobalScript* script)
+ {
+ script->OnInitializeLockedDungeons(player, level, lockData, dungeon);
+ });
+}
+
+void ScriptMgr::OnAfterInitializeLockedDungeons(Player* player)
+{
+ ExecuteScript([&](GlobalScript* script)
+ {
+ script->OnAfterInitializeLockedDungeons(player);
+ });
+}
+
+void ScriptMgr::OnAfterUpdateEncounterState(Map* map, EncounterCreditType type, uint32 creditEntry, Unit* source, Difficulty difficulty_fixed, DungeonEncounterList const* encounters, uint32 dungeonCompleted, bool updated)
+{
+ ExecuteScript([&](GlobalScript* script)
+ {
+ script->OnAfterUpdateEncounterState(map, type, creditEntry, source, difficulty_fixed, encounters, dungeonCompleted, updated);
+ });
+}
+
+void ScriptMgr::OnBeforeWorldObjectSetPhaseMask(WorldObject const* worldObject, uint32& oldPhaseMask, uint32& newPhaseMask, bool& useCombinedPhases, bool& update)
+{
+ ExecuteScript([&](GlobalScript* script)
+ {
+ script->OnBeforeWorldObjectSetPhaseMask(worldObject, oldPhaseMask, newPhaseMask, useCombinedPhases, update);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/GroupScript.cpp b/src/server/game/Scripting/ScriptDefines/GroupScript.cpp
new file mode 100644
index 000000000..306949402
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/GroupScript.cpp
@@ -0,0 +1,92 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnGroupAddMember(Group* group, ObjectGuid guid)
+{
+ ASSERT(group);
+
+ ExecuteScript([&](GroupScript* script)
+ {
+ script->OnAddMember(group, guid);
+ });
+}
+
+void ScriptMgr::OnGroupInviteMember(Group* group, ObjectGuid guid)
+{
+ ASSERT(group);
+
+ ExecuteScript([&](GroupScript* script)
+ {
+ script->OnInviteMember(group, guid);
+ });
+}
+
+void ScriptMgr::OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, const char* reason)
+{
+ ASSERT(group);
+
+ ExecuteScript([&](GroupScript* script)
+ {
+ script->OnRemoveMember(group, guid, method, kicker, reason);
+ });
+}
+
+void ScriptMgr::OnGroupChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
+{
+ ASSERT(group);
+
+ ExecuteScript([&](GroupScript* script)
+ {
+ script->OnChangeLeader(group, newLeaderGuid, oldLeaderGuid);
+ });
+}
+
+void ScriptMgr::OnGroupDisband(Group* group)
+{
+ ASSERT(group);
+
+ ExecuteScript([&](GroupScript* script)
+ {
+ script->OnDisband(group);
+ });
+}
+
+bool ScriptMgr::CanGroupJoinBattlegroundQueue(Group const* group, Player* member, Battleground const* bgTemplate, uint32 MinPlayerCount, bool isRated, uint32 arenaSlot)
+{
+ auto ret = IsValidBoolScript([&](GroupScript* script)
+ {
+ return !script->CanGroupJoinBattlegroundQueue(group, member, bgTemplate, MinPlayerCount, isRated, arenaSlot);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void ScriptMgr::OnCreate(Group* group, Player* leader)
+{
+ ExecuteScript([&](GroupScript* script)
+ {
+ script->OnCreate(group, leader);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/GuildScript.cpp b/src/server/game/Scripting/ScriptDefines/GuildScript.cpp
new file mode 100644
index 000000000..6ca69523e
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/GuildScript.cpp
@@ -0,0 +1,123 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnGuildAddMember(Guild* guild, Player* player, uint8& plRank)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnAddMember(guild, player, plRank);
+ });
+}
+
+void ScriptMgr::OnGuildRemoveMember(Guild* guild, Player* player, bool isDisbanding, bool isKicked)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnRemoveMember(guild, player, isDisbanding, isKicked);
+ });
+}
+
+void ScriptMgr::OnGuildMOTDChanged(Guild* guild, const std::string& newMotd)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnMOTDChanged(guild, newMotd);
+ });
+}
+
+void ScriptMgr::OnGuildInfoChanged(Guild* guild, const std::string& newInfo)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnInfoChanged(guild, newInfo);
+ });
+}
+
+void ScriptMgr::OnGuildCreate(Guild* guild, Player* leader, const std::string& name)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnCreate(guild, leader, name);
+ });
+}
+
+void ScriptMgr::OnGuildDisband(Guild* guild)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnDisband(guild);
+ });
+}
+
+void ScriptMgr::OnGuildMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnMemberWitdrawMoney(guild, player, amount, isRepair);
+ });
+}
+
+void ScriptMgr::OnGuildMemberDepositMoney(Guild* guild, Player* player, uint32& amount)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnMemberDepositMoney(guild, player, amount);
+ });
+}
+
+void ScriptMgr::OnGuildItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
+ bool isDestBank, uint8 destContainer, uint8 destSlotId)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnItemMove(guild, player, pItem, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId);
+ });
+}
+
+void ScriptMgr::OnGuildEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnEvent(guild, eventType, playerGuid1, playerGuid2, newRank);
+ });
+}
+
+void ScriptMgr::OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
+{
+ ExecuteScript([&](GuildScript* script)
+ {
+ script->OnBankEvent(guild, eventType, tabId, playerGuid, itemOrMoney, itemStackCount, destTabId);
+ });
+}
+
+bool ScriptMgr::CanGuildSendBankList(Guild const* guild, WorldSession* session, uint8 tabId, bool sendAllSlots)
+{
+ auto ret = IsValidBoolScript([&](GuildScript* script)
+ {
+ return !script->CanGuildSendBankList(guild, session, tabId, sendAllSlots);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/InstanceMapScript.cpp b/src/server/game/Scripting/ScriptDefines/InstanceMapScript.cpp
new file mode 100644
index 000000000..18f7a9eb8
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/InstanceMapScript.cpp
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+InstanceScript* ScriptMgr::CreateInstanceScript(InstanceMap* map)
+{
+ ASSERT(map);
+
+ auto tempScript = ScriptRegistry::GetScriptById(map->GetScriptId());
+ return tempScript ? tempScript->GetInstanceScript(map) : nullptr;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/ItemScript.cpp b/src/server/game/Scripting/ScriptDefines/ItemScript.cpp
new file mode 100644
index 000000000..44e82f0aa
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/ItemScript.cpp
@@ -0,0 +1,141 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+#include "ScriptedGossip.h"
+
+bool ScriptMgr::OnQuestAccept(Player* player, Item* item, Quest const* quest)
+{
+ ASSERT(player);
+ ASSERT(item);
+ ASSERT(quest);
+
+ auto ret = IsValidBoolScript([&](AllItemScript* script)
+ {
+ return !script->CanItemQuestAccept(player, item, quest);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(item->GetScriptId());
+ ClearGossipMenuFor(player);
+ return tempScript ? tempScript->OnQuestAccept(player, item, quest) : false;
+}
+
+bool ScriptMgr::OnItemUse(Player* player, Item* item, SpellCastTargets const& targets)
+{
+ ASSERT(player);
+ ASSERT(item);
+
+ auto ret = IsValidBoolScript([&](AllItemScript* script)
+ {
+ return script->CanItemUse(player, item, targets);
+ });
+
+ if (ret && *ret)
+ {
+ return true;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(item->GetScriptId());
+ return tempScript ? tempScript->OnUse(player, item, targets) : false;
+}
+
+bool ScriptMgr::OnItemExpire(Player* player, ItemTemplate const* proto)
+{
+ ASSERT(player);
+ ASSERT(proto);
+
+ auto ret = IsValidBoolScript([&](AllItemScript* script)
+ {
+ return !script->CanItemExpire(player, proto);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(proto->ScriptId);
+ return tempScript ? tempScript->OnExpire(player, proto) : false;
+}
+
+bool ScriptMgr::OnItemRemove(Player* player, Item* item)
+{
+ ASSERT(player);
+ ASSERT(item);
+
+ auto ret = IsValidBoolScript([&](AllItemScript* script)
+ {
+ return !script->CanItemRemove(player, item);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ auto tempScript = ScriptRegistry::GetScriptById(item->GetScriptId());
+ return tempScript ? tempScript->OnRemove(player, item) : false;
+}
+
+bool ScriptMgr::OnCastItemCombatSpell(Player* player, Unit* victim, SpellInfo const* spellInfo, Item* item)
+{
+ ASSERT(player);
+ ASSERT(victim);
+ ASSERT(spellInfo);
+ ASSERT(item);
+
+ auto tempScript = ScriptRegistry::GetScriptById(item->GetScriptId());
+ return tempScript ? tempScript->OnCastItemCombatSpell(player, victim, spellInfo, item) : true;
+}
+
+void ScriptMgr::OnGossipSelect(Player* player, Item* item, uint32 sender, uint32 action)
+{
+ ASSERT(player);
+ ASSERT(item);
+
+ ExecuteScript([&](AllItemScript* script)
+ {
+ script->OnItemGossipSelect(player, item, sender, action);
+ });
+
+ if (auto tempScript = ScriptRegistry::GetScriptById(item->GetScriptId()))
+ {
+ tempScript->OnGossipSelect(player, item, sender, action);
+ }
+}
+
+void ScriptMgr::OnGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code)
+{
+ ASSERT(player);
+ ASSERT(item);
+
+ ExecuteScript([&](AllItemScript* script)
+ {
+ script->OnItemGossipSelectCode(player, item, sender, action, code);
+ });
+
+ if (auto tempScript = ScriptRegistry::GetScriptById(item->GetScriptId()))
+ {
+ tempScript->OnGossipSelectCode(player, item, sender, action, code);
+ }
+}
diff --git a/src/server/game/Scripting/ScriptDefines/LootScript.cpp b/src/server/game/Scripting/ScriptDefines/LootScript.cpp
new file mode 100644
index 000000000..b213d6468
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/LootScript.cpp
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnLootMoney(Player* player, uint32 gold)
+{
+ ASSERT(player);
+
+ ExecuteScript([&](LootScript* script)
+ {
+ script->OnLootMoney(player, gold);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/MailScript.cpp b/src/server/game/Scripting/ScriptDefines/MailScript.cpp
new file mode 100644
index 000000000..1d5cd11a1
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/MailScript.cpp
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnBeforeMailDraftSendMailTo(MailDraft* mailDraft, MailReceiver const& receiver, MailSender const& sender, MailCheckMask& checked, uint32& deliver_delay, uint32& custom_expiration, bool& deleteMailItemsFromDB, bool& sendMail)
+{
+ ExecuteScript([&](MailScript* script)
+ {
+ script->OnBeforeMailDraftSendMailTo(mailDraft, receiver, sender, checked, deliver_delay, custom_expiration, deleteMailItemsFromDB, sendMail);\
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/MiscScript.cpp b/src/server/game/Scripting/ScriptDefines/MiscScript.cpp
new file mode 100644
index 000000000..cf50229c8
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/MiscScript.cpp
@@ -0,0 +1,184 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnItemCreate(Item* item, ItemTemplate const* itemProto, Player const* owner)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnItemCreate(item, itemProto, owner);
+ });
+}
+
+bool ScriptMgr::CanApplySoulboundFlag(Item* item, ItemTemplate const* proto)
+{
+ auto ret = IsValidBoolScript([&](MiscScript* script)
+ {
+ return !script->CanApplySoulboundFlag(item, proto);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void ScriptMgr::OnConstructObject(Object* origin)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnConstructObject(origin);
+ });
+}
+
+void ScriptMgr::OnDestructObject(Object* origin)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnDestructObject(origin);
+ });
+}
+
+void ScriptMgr::OnConstructPlayer(Player* origin)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnConstructPlayer(origin);
+ });
+}
+
+void ScriptMgr::OnDestructPlayer(Player* origin)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnDestructPlayer(origin);
+ });
+}
+
+void ScriptMgr::OnConstructGroup(Group* origin)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnConstructGroup(origin);
+ });
+}
+
+void ScriptMgr::OnDestructGroup(Group* origin)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnDestructGroup(origin);
+ });
+}
+
+void ScriptMgr::OnConstructInstanceSave(InstanceSave* origin)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnConstructInstanceSave(origin);
+ });
+}
+
+void ScriptMgr::OnDestructInstanceSave(InstanceSave* origin)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnDestructInstanceSave(origin);
+ });
+}
+
+bool ScriptMgr::CanItemApplyEquipSpell(Player* player, Item* item)
+{
+ auto ret = IsValidBoolScript([&](MiscScript* script)
+ {
+ return !script->CanItemApplyEquipSpell(player, item);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ScriptMgr::CanSendAuctionHello(WorldSession const* session, ObjectGuid guid, Creature* creature)
+{
+ auto ret = IsValidBoolScript([&](MiscScript* script)
+ {
+ return !script->CanSendAuctionHello(session, guid, creature);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void ScriptMgr::ValidateSpellAtCastSpell(Player* player, uint32& oldSpellId, uint32& spellId, uint8& castCount, uint8& castFlags)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->ValidateSpellAtCastSpell(player, oldSpellId, spellId, castCount, castFlags);
+ });
+}
+
+void ScriptMgr::ValidateSpellAtCastSpellResult(Player* player, Unit* mover, Spell* spell, uint32 oldSpellId, uint32 spellId)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->ValidateSpellAtCastSpellResult(player, mover, spell, oldSpellId, spellId);
+ });
+}
+
+void ScriptMgr::OnAfterLootTemplateProcess(Loot* loot, LootTemplate const* tab, LootStore const& store, Player* lootOwner, bool personal, bool noEmptyError, uint16 lootMode)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnAfterLootTemplateProcess(loot, tab, store, lootOwner, personal, noEmptyError, lootMode);
+ });
+}
+
+void ScriptMgr::OnInstanceSave(InstanceSave* instanceSave)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnInstanceSave(instanceSave);
+ });
+}
+
+void ScriptMgr::OnPlayerSetPhase(const AuraEffect* auraEff, AuraApplication const* aurApp, uint8 mode, bool apply, uint32& newPhase)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->OnPlayerSetPhase(auraEff, aurApp, mode, apply, newPhase);
+ });
+}
+
+void ScriptMgr::GetDialogStatus(Player* player, Object* questgiver)
+{
+ ExecuteScript([&](MiscScript* script)
+ {
+ script->GetDialogStatus(player, questgiver);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/MovementHandlerScript.cpp b/src/server/game/Scripting/ScriptDefines/MovementHandlerScript.cpp
new file mode 100644
index 000000000..d6a926cca
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/MovementHandlerScript.cpp
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnPlayerMove(Player* player, MovementInfo movementInfo, uint32 opcode)
+{
+ ExecuteScript([&](MovementHandlerScript* script)
+ {
+ script->OnPlayerMove(player, movementInfo, opcode);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.cpp b/src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.cpp
new file mode 100644
index 000000000..60ae644f8
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.cpp
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+#include "OutdoorPvPMgr.h"
+
+OutdoorPvP* ScriptMgr::CreateOutdoorPvP(OutdoorPvPData const* data)
+{
+ ASSERT(data);
+
+ auto tempScript = ScriptRegistry::GetScriptById(data->ScriptId);
+ return tempScript ? tempScript->GetOutdoorPvP() : nullptr;
+}
diff --git a/src/server/game/Scripting/ScriptDefines/PetScript.cpp b/src/server/game/Scripting/ScriptDefines/PetScript.cpp
new file mode 100644
index 000000000..1d3b45b5e
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/PetScript.cpp
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnInitStatsForLevel(Guardian* guardian, uint8 petlevel)
+{
+ ExecuteScript([&](PetScript* script)
+ {
+ script->OnInitStatsForLevel(guardian, petlevel);
+ });
+}
+
+void ScriptMgr::OnCalculateMaxTalentPointsForLevel(Pet* pet, uint8 level, uint8& points)
+{
+ ExecuteScript([&](PetScript* script)
+ {
+ script->OnCalculateMaxTalentPointsForLevel(pet, level, points);
+ });
+}
+
+bool ScriptMgr::CanUnlearnSpellSet(Pet* pet, uint32 level, uint32 spell)
+{
+ auto ret = IsValidBoolScript([&](PetScript* script)
+ {
+ return !script->CanUnlearnSpellSet(pet, level, spell);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ScriptMgr::CanUnlearnSpellDefault(Pet* pet, SpellInfo const* spellEntry)
+{
+ auto ret = IsValidBoolScript([&](PetScript* script)
+ {
+ return !script->CanUnlearnSpellDefault(pet, spellEntry);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ScriptMgr::CanResetTalents(Pet* pet)
+{
+ auto ret = IsValidBoolScript([&](PetScript* script)
+ {
+ return !script->CanResetTalents(pet);
+ });
+
+ if (ret && *ret)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void ScriptMgr::OnPetAddToWorld(Pet* pet)
+{
+ ASSERT(pet);
+
+ ExecuteScript([&](PetScript* script)
+ {
+ script->OnPetAddToWorld(pet);
+ });
+}
diff --git a/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp b/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp
new file mode 100644
index 000000000..8ffd177f3
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp
@@ -0,0 +1,1514 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation; either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptMgrMacros.h"
+
+void ScriptMgr::OnBeforePlayerDurabilityRepair(Player* player, ObjectGuid npcGUID, ObjectGuid itemGUID, float& discountMod, uint8 guildBank)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnBeforeDurabilityRepair(player, npcGUID, itemGUID, discountMod, guildBank);
+ });
+}
+
+void ScriptMgr::OnGossipSelect(Player* player, uint32 menu_id, uint32 sender, uint32 action)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnGossipSelect(player, menu_id, sender, action);
+ });
+}
+
+void ScriptMgr::OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnGossipSelectCode(player, menu_id, sender, action, code);
+ });
+}
+
+void ScriptMgr::OnPlayerCompleteQuest(Player* player, Quest const* quest)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnPlayerCompleteQuest(player, quest);
+ });
+}
+
+void ScriptMgr::OnSendInitialPacketsBeforeAddToMap(Player* player, WorldPacket& data)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnSendInitialPacketsBeforeAddToMap(player, data);
+ });
+}
+
+void ScriptMgr::OnBattlegroundDesertion(Player* player, BattlegroundDesertionType const desertionType)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnBattlegroundDesertion(player, desertionType);
+ });
+}
+
+void ScriptMgr::OnPlayerReleasedGhost(Player* player)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnPlayerReleasedGhost(player);
+ });
+}
+
+void ScriptMgr::OnPVPKill(Player* killer, Player* killed)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnPVPKill(killer, killed);
+ });
+}
+
+void ScriptMgr::OnPlayerPVPFlagChange(Player* player, bool state)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnPlayerPVPFlagChange(player, state);
+ });
+}
+
+void ScriptMgr::OnCreatureKill(Player* killer, Creature* killed)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnCreatureKill(killer, killed);
+ });
+}
+
+void ScriptMgr::OnCreatureKilledByPet(Player* petOwner, Creature* killed)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnCreatureKilledByPet(petOwner, killed);
+ });
+}
+
+void ScriptMgr::OnPlayerKilledByCreature(Creature* killer, Player* killed)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnPlayerKilledByCreature(killer, killed);
+ });
+}
+
+void ScriptMgr::OnPlayerLevelChanged(Player* player, uint8 oldLevel)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnLevelChanged(player, oldLevel);
+ });
+}
+
+void ScriptMgr::OnPlayerFreeTalentPointsChanged(Player* player, uint32 points)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnFreeTalentPointsChanged(player, points);
+ });
+}
+
+void ScriptMgr::OnPlayerTalentsReset(Player* player, bool noCost)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnTalentsReset(player, noCost);
+ });
+}
+
+void ScriptMgr::OnPlayerMoneyChanged(Player* player, int32& amount)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnMoneyChanged(player, amount);
+ });
+}
+
+void ScriptMgr::OnGivePlayerXP(Player* player, uint32& amount, Unit* victim)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnGiveXP(player, amount, victim);
+ });
+}
+
+void ScriptMgr::OnPlayerReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnReputationChange(player, factionID, standing, incremental);
+ });
+}
+
+void ScriptMgr::OnPlayerReputationRankChange(Player* player, uint32 factionID, ReputationRank newRank, ReputationRank oldRank, bool increased)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnReputationRankChange(player, factionID, newRank, oldRank, increased);
+ });
+}
+
+void ScriptMgr::OnPlayerLearnSpell(Player* player, uint32 spellID)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnLearnSpell(player, spellID);
+ });
+}
+
+void ScriptMgr::OnPlayerForgotSpell(Player* player, uint32 spellID)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnForgotSpell(player, spellID);
+ });
+}
+
+void ScriptMgr::OnPlayerDuelRequest(Player* target, Player* challenger)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnDuelRequest(target, challenger);
+ });
+}
+
+void ScriptMgr::OnPlayerDuelStart(Player* player1, Player* player2)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnDuelStart(player1, player2);
+ });
+}
+
+void ScriptMgr::OnPlayerDuelEnd(Player* winner, Player* loser, DuelCompleteType type)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnDuelEnd(winner, loser, type);
+ });
+}
+
+void ScriptMgr::OnPlayerChat(Player* player, uint32 type, uint32 lang, std::string& msg)
+{
+ ExecuteScript([&](PlayerScript* script)
+ {
+ script->OnChat(player, type, lang, msg);
+ });
+}
+
+void ScriptMgr::OnBeforeSendChatMessage(Player* player, uint32& type, uint32& lang, std::string& msg)
+{
+ ExecuteScript