diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 6f98fd9fc..88a14a1a2 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -16,13 +16,13 @@
*/
#include "SmartAI.h"
+#include "AreaTriggerScript.h"
#include "CellImpl.h"
#include "GridDefines.h"
#include "GridNotifiers.h"
#include "Group.h"
#include "ObjectDefines.h"
#include "ObjectMgr.h"
-#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellMgr.h"
#include "Vehicle.h"
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index d664f78ee..a315ba935 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -29,6 +29,7 @@
#include "Creature.h"
#include "CreatureTextMgr.h"
#include "Formulas.h"
+#include "GameEventMgr.h"
#include "GameGraveyard.h"
#include "GridNotifiersImpl.h"
#include "GroupMgr.h"
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 67544e8b1..65eaeaf76 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -45,7 +45,7 @@ class BattlegroundIC;
struct PvPDifficultyEntry;
struct GraveyardStruct;
-enum BattlegroundDesertionType
+enum BattlegroundDesertionType : uint8
{
BG_DESERTION_TYPE_LEAVE_BG = 0, // player leaves the BG
BG_DESERTION_TYPE_OFFLINE = 1, // player is kicked from BG because offline
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 46f91221f..8336352ea 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -43,6 +43,7 @@
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
+#include "ScriptMgr.h"
#include "SharedDefines.h"
#include "World.h"
#include "WorldPacket.h"
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index 9c1a9670d..da147e61d 100644
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
@@ -37,7 +37,7 @@ WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId);
-enum ContentLevels
+enum ContentLevels : uint8
{
CONTENT_1_60 = 0,
CONTENT_61_70,
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index e2f0726ce..3de529c90 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -34,6 +34,7 @@
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
+#include "ScriptMgr.h"
#include "SharedDefines.h"
#include "SocialMgr.h"
#include "SpellAuras.h"
@@ -43,9 +44,6 @@ namespace lfg
{
LFGMgr::LFGMgr(): m_lfgProposalId(1), m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK)), m_Testing(false)
{
- new LFGPlayerScript();
- new LFGGroupScript();
-
for (uint8 team = 0; team < 2; ++team)
{
m_raidBrowserUpdateTimer[team] = 10000;
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index 02b907d67..cabd4543f 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -297,4 +297,9 @@ namespace lfg
}
}
+ void AddSC_LFGScripts()
+ {
+ new LFGPlayerScript();
+ new LFGGroupScript();
+ }
} // namespace lfg
diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h
index e140eaf10..8173fb1bc 100644
--- a/src/server/game/DungeonFinding/LFGScripts.h
+++ b/src/server/game/DungeonFinding/LFGScripts.h
@@ -19,16 +19,15 @@
* Interaction between core and LFGScripts
*/
-#include "Common.h"
-#include "ScriptMgr.h"
-#include "SharedDefines.h"
+#include "GroupScript.h"
+#include "ObjectGuid.h"
+#include "PlayerScript.h"
class Player;
class Group;
namespace lfg
{
-
class LFGPlayerScript : public PlayerScript
{
public:
@@ -55,4 +54,6 @@ namespace lfg
void OnInviteMember(Group* group, ObjectGuid guid) override;
};
+ void AddSC_LFGScripts();
+
} // namespace lfg
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 4eb0b85e4..c761660eb 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -31,13 +31,13 @@
#include "GroupMgr.h"
#include "Log.h"
#include "LootMgr.h"
-#include "MapMgr.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "OutdoorPvPMgr.h"
#include "Pet.h"
#include "Player.h"
#include "PoolMgr.h"
+#include "ScriptMgr.h"
#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 393627795..b2969580d 100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -22,6 +22,7 @@
#include "Opcodes.h"
#include "Player.h"
#include "QuestDef.h"
+#include "ScriptMgr.h"
#include "WorldPacket.h"
#include "WorldSession.h"
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 300e7a6a1..e7da6c7a8 100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -36,7 +36,7 @@ struct ItemSetEffect
};
// EnumUtils: DESCRIBE THIS
-enum InventoryResult
+enum InventoryResult : uint8
{
EQUIP_ERR_OK = 0,
EQUIP_ERR_CANT_EQUIP_LEVEL_I = 1,
@@ -158,7 +158,7 @@ enum SellResult
};
// -1 from client enchantment slot number
-enum EnchantmentSlot
+enum EnchantmentSlot : uint8
{
PERM_ENCHANTMENT_SLOT = 0,
TEMP_ENCHANTMENT_SLOT = 1,
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 5bd634c0d..5e10ef17e 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -21,6 +21,7 @@
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Group.h"
+#include "InstanceScript.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "PetPackets.h"
diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp
index dfeb8ed6d..50d83a692 100644
--- a/src/server/game/Entities/Player/KillRewarder.cpp
+++ b/src/server/game/Entities/Player/KillRewarder.cpp
@@ -20,6 +20,7 @@
#include "Group.h"
#include "Pet.h"
#include "Player.h"
+#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
// KillRewarder incapsulates logic of rewarding player upon kill with:
diff --git a/src/server/game/Entities/Player/PlayerQuest.cpp b/src/server/game/Entities/Player/PlayerQuest.cpp
index 4056534a7..659e84c72 100644
--- a/src/server/game/Entities/Player/PlayerQuest.cpp
+++ b/src/server/game/Entities/Player/PlayerQuest.cpp
@@ -17,6 +17,7 @@
#include "CreatureAI.h"
#include "DisableMgr.h"
+#include "GameEventMgr.h"
#include "GameObjectAI.h"
#include "GameTime.h"
#include "GitRevision.h"
diff --git a/src/server/game/Entities/Player/PlayerUpdates.cpp b/src/server/game/Entities/Player/PlayerUpdates.cpp
index 1f137edb4..e56e3e3dc 100644
--- a/src/server/game/Entities/Player/PlayerUpdates.cpp
+++ b/src/server/game/Entities/Player/PlayerUpdates.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "AchievementMgr.h"
#include "BattlefieldMgr.h"
#include "CellImpl.h"
#include "Channel.h"
@@ -35,6 +36,7 @@
#include "SpellMgr.h"
#include "UpdateFieldFlags.h"
#include "Vehicle.h"
+#include "Weather.h"
#include "WeatherMgr.h"
#include "WorldStatePackets.h"
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 230c424bd..ec358ec78 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -53,6 +53,7 @@
#include "PetAI.h"
#include "Player.h"
#include "ReputationMgr.h"
+#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index d26069725..8488193f0 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -391,7 +391,7 @@ enum UnitMoveType
extern float baseMoveSpeed[MAX_MOVE_TYPE];
extern float playerBaseMoveSpeed[MAX_MOVE_TYPE];
-enum WeaponAttackType
+enum WeaponAttackType : uint8
{
BASE_ATTACK = 0,
OFF_ATTACK = 1,
@@ -430,7 +430,7 @@ enum CombatRating
#define MAX_COMBAT_RATING 25
-enum DamageEffectType
+enum DamageEffectType : uint8
{
DIRECT_DAMAGE = 0, // used for normal weapon damage (not for class abilities or spells)
SPELL_DIRECT_DAMAGE = 1, // spell/class abilities damage
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index b33502da2..e6ca90428 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -17,6 +17,7 @@
#include "Vehicle.h"
#include "BattlefieldWG.h"
+#include "CreatureAI.h"
#include "Log.h"
#include "MoveSplineInit.h"
#include "ObjectMgr.h"
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index f18597bec..0849bf9e1 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -35,7 +35,6 @@
#include "GroupMgr.h"
#include "GuildMgr.h"
#include "LFGMgr.h"
-#include "Language.h"
#include "Log.h"
#include "MapMgr.h"
#include "Pet.h"
@@ -45,6 +44,7 @@
#include "Spell.h"
#include "SpellMgr.h"
#include "SpellScript.h"
+#include "SpellScriptLoader.h"
#include "StringConvert.h"
#include "Tokenize.h"
#include "Transport.h"
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index 1659711b1..87317f376 100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -45,7 +45,7 @@ struct MapEntry;
#define MAX_RAID_SUBGROUPS MAXRAIDSIZE/MAXGROUPSIZE
#define TARGETICONCOUNT 8
-enum RollVote
+enum RollVote : uint8
{
PASS = 0,
NEED = 1,
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 4ab089472..7bb348caf 100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -23,6 +23,7 @@
#include "DisableMgr.h"
#include "GameTime.h"
#include "Group.h"
+#include "LFGMgr.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "Opcodes.h"
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index 9609d8b64..7bea72443 100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -18,6 +18,7 @@
#include "DatabaseEnv.h"
#include "Group.h"
#include "GroupMgr.h"
+#include "LFGMgr.h"
#include "Language.h"
#include "Log.h"
#include "MiscPackets.h"
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 0c7e8fa5d..df7272d68 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -29,6 +29,7 @@
#include "GossipDef.h"
#include "Group.h"
#include "GuildMgr.h"
+#include "InstanceScript.h"
#include "Language.h"
#include "Log.h"
#include "LootMgr.h"
@@ -1425,7 +1426,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recv_data)
return;
}
- if (IsSharedDifficultyMap(groupGuy->GetMap()->GetId()) && (_player->GetRaidDifficulty() >= 0 && uint32(mode % 2) == uint32(_player->GetRaidDifficulty() % 2)) && group->isRaidGroup())
+ if (IsSharedDifficultyMap(groupGuy->GetMap()->GetId()) && (uint32(mode % 2) == uint32(_player->GetRaidDifficulty() % 2)) && group->isRaidGroup())
{
if (!currMap)
currMap = groupGuy->GetMap();
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index 71ea33391..fb5553176 100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -52,7 +52,7 @@ enum EncounterFrameType
ENCOUNTER_FRAME_REFRESH_FRAMES = 7, // Xinef: can be used to refresh frames after unit was destroyed from client and send back (phase changes)
};
-enum EncounterState
+enum EncounterState : uint8
{
NOT_STARTED = 0,
IN_PROGRESS = 1,
diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h
index 8bff3ebac..957f8374e 100644
--- a/src/server/game/Mails/Mail.h
+++ b/src/server/game/Mails/Mail.h
@@ -42,7 +42,7 @@ enum MailMessageType
MAIL_CALENDAR = 5
};
-enum MailCheckMask
+enum MailCheckMask : uint8
{
MAIL_CHECK_MASK_NONE = 0x00,
MAIL_CHECK_MASK_READ = 0x01,
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 7cafb39ff..50e4a4c00 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -303,7 +303,7 @@ typedef std::map CreatureGroupHol
typedef std::unordered_map ZoneDynamicInfoMap;
typedef std::set TransportsContainer;
-enum EncounterCreditType
+enum EncounterCreditType : uint8
{
ENCOUNTER_CREDIT_KILL_CREATURE = 0,
ENCOUNTER_CREDIT_CAST_SPELL = 1,
diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h
index 92b9d1757..eba9431c7 100644
--- a/src/server/game/Miscellaneous/Formulas.h
+++ b/src/server/game/Miscellaneous/Formulas.h
@@ -18,8 +18,13 @@
#ifndef ACORE_FORMULAS_H
#define ACORE_FORMULAS_H
-#include "ScriptMgr.h"
#include "SharedDefines.h"
+#include
+
+class Player;
+class Unit;
+
+enum ContentLevels : uint8;
namespace Acore::Honor
{
diff --git a/src/server/game/Motd/MotdMgr.cpp b/src/server/game/Motd/MotdMgr.cpp
index 5b39fc6bc..7b382f3af 100644
--- a/src/server/game/Motd/MotdMgr.cpp
+++ b/src/server/game/Motd/MotdMgr.cpp
@@ -17,10 +17,11 @@
#include "MotdMgr.h"
#include "Config.h"
-#include "Opcodes.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
#include "ScriptMgr.h"
+#include "Timer.h"
#include "Tokenize.h"
-#include "Util.h"
#include "WorldPacket.h"
#include
diff --git a/src/server/game/Scripting/ScriptDefines/AccountScript.cpp b/src/server/game/Scripting/ScriptDefines/AccountScript.cpp
index ff12bd54e..31705babc 100644
--- a/src/server/game/Scripting/ScriptDefines/AccountScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AccountScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "AccountScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -89,10 +90,13 @@ bool ScriptMgr::CanAccountCreateCharacter(uint32 accountId, uint8 charRace, uint
return !script->CanAccountCreateCharacter(accountId, charRace, charClass);
});
- if (ret && *ret)
- {
- return false;
- }
-
- return true;
+ return ReturnValidBool(ret);
}
+
+AccountScript::AccountScript(char const* name) :
+ ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AccountScript.h b/src/server/game/Scripting/ScriptDefines/AccountScript.h
new file mode 100644
index 000000000..a88e4152b
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AccountScript.h
@@ -0,0 +1,54 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ACCOUNT_SCRIPT_H_
+#define SCRIPT_OBJECT_ACCOUNT_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class AccountScript : public ScriptObject
+{
+protected:
+ AccountScript(const char* name);
+
+public:
+ // Called when an account logged in successfully
+ virtual void OnAccountLogin(uint32 /*accountId*/) { }
+
+ // Called when an ip logged in successfully
+ virtual void OnLastIpUpdate(uint32 /*accountId*/, std::string /*ip*/) { }
+
+ // Called when an account login failed
+ virtual void OnFailedAccountLogin(uint32 /*accountId*/) { }
+
+ // Called when Email is successfully changed for Account
+ virtual void OnEmailChange(uint32 /*accountId*/) { }
+
+ // Called when Email failed to change for Account
+ virtual void OnFailedEmailChange(uint32 /*accountId*/) { }
+
+ // Called when Password is successfully changed for Account
+ virtual void OnPasswordChange(uint32 /*accountId*/) { }
+
+ // Called when Password failed to change for Account
+ virtual void OnFailedPasswordChange(uint32 /*accountId*/) { }
+
+ // Called when creating a character on the Account
+ [[nodiscard]] virtual bool CanAccountCreateCharacter(uint32 /*accountId*/, uint8 /*charRace*/, uint8 /*charClass*/) { return true;}
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.cpp b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.cpp
index 8031a2524..9e0e44e67 100644
--- a/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "AchievementCriteriaScript.h"
#include "ScriptMgr.h"
bool ScriptMgr::OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target, uint32 criteria_id)
@@ -25,3 +26,11 @@ bool ScriptMgr::OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target, u
auto tempScript = ScriptRegistry::GetScriptById(scriptId);
return tempScript ? tempScript->OnCheck(source, target, criteria_id) : false;
}
+
+AchievementCriteriaScript::AchievementCriteriaScript(char const* name) :
+ ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.h b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.h
new file mode 100644
index 000000000..9e097fbe0
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AchievementCriteriaScript.h
@@ -0,0 +1,34 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ACHIEVEMENT_CRITERIA_SCRIPT_H_
+#define SCRIPT_OBJECT_ACHIEVEMENT_CRITERIA_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class AchievementCriteriaScript : public ScriptObject
+{
+protected:
+ AchievementCriteriaScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return true; }
+
+ [[nodiscard]] virtual bool OnCheck(Player* /*source*/, Unit* /*target*/, uint32 /*criteria_id*/) { return true; };
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/AchievementScript.cpp b/src/server/game/Scripting/ScriptDefines/AchievementScript.cpp
index e99ade7e4..4dc58634d 100644
--- a/src/server/game/Scripting/ScriptDefines/AchievementScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AchievementScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "AchievementScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -56,7 +57,7 @@ bool ScriptMgr::IsRealmCompleted(AchievementGlobalMgr const* globalmgr, Achievem
return true;
}
-void ScriptMgr::OnBeforeCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntryList const* achievementCriteriaList)
+void ScriptMgr::OnBeforeCheckCriteria(AchievementMgr* mgr, std::list const* achievementCriteriaList)
{
ExecuteScript([&](AchievementScript* script)
{
@@ -78,3 +79,11 @@ bool ScriptMgr::CanCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntry c
return true;
}
+
+AchievementScript::AchievementScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AchievementScript.h b/src/server/game/Scripting/ScriptDefines/AchievementScript.h
new file mode 100644
index 000000000..d1e8ab076
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AchievementScript.h
@@ -0,0 +1,45 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ACHIEVEMENT_SCRIPT_H_
+#define SCRIPT_OBJECT_ACHIEVEMENT_SCRIPT_H_
+
+#include "Duration.h"
+#include "ScriptObject.h"
+#include
+
+class AchievementScript : public ScriptObject
+{
+protected:
+ AchievementScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return false; }
+
+ // After complete global acvievement
+ virtual void SetRealmCompleted(AchievementEntry const* /*achievement*/) { }
+
+ [[nodiscard]] virtual bool IsCompletedCriteria(AchievementMgr* /*mgr*/, AchievementCriteriaEntry const* /*achievementCriteria*/, AchievementEntry const* /*achievement*/, CriteriaProgress const* /*progress*/) { return true; }
+
+ [[nodiscard]] virtual bool IsRealmCompleted(AchievementGlobalMgr const* /*globalmgr*/, AchievementEntry const* /*achievement*/, SystemTimePoint /*completionTime*/) { return true; }
+
+ virtual void OnBeforeCheckCriteria(AchievementMgr* /*mgr*/, std::list const* /*achievementCriteriaList*/) { }
+
+ [[nodiscard]] virtual bool CanCheckCriteria(AchievementMgr* /*mgr*/, AchievementCriteriaEntry const* /*achievementCriteria*/) { return true; }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/BGScript.cpp b/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.cpp
similarity index 73%
rename from src/server/game/Scripting/ScriptDefines/BGScript.cpp
rename to src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.cpp
index 3e06e2ce3..b5828687a 100644
--- a/src/server/game/Scripting/ScriptDefines/BGScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.cpp
@@ -15,12 +15,13 @@
* with this program. If not, see .
*/
+#include "AllBattlegroundScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
void ScriptMgr::OnBattlegroundStart(Battleground* bg)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnBattlegroundStart(bg);
});
@@ -28,7 +29,7 @@ void ScriptMgr::OnBattlegroundStart(Battleground* bg)
void ScriptMgr::OnBattlegroundEndReward(Battleground* bg, Player* player, TeamId winnerTeamId)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnBattlegroundEndReward(bg, player, winnerTeamId);
});
@@ -36,7 +37,7 @@ void ScriptMgr::OnBattlegroundEndReward(Battleground* bg, Player* player, TeamId
void ScriptMgr::OnBattlegroundUpdate(Battleground* bg, uint32 diff)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnBattlegroundUpdate(bg, diff);
});
@@ -44,7 +45,7 @@ void ScriptMgr::OnBattlegroundUpdate(Battleground* bg, uint32 diff)
void ScriptMgr::OnBattlegroundAddPlayer(Battleground* bg, Player* player)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnBattlegroundAddPlayer(bg, player);
});
@@ -52,7 +53,7 @@ void ScriptMgr::OnBattlegroundAddPlayer(Battleground* bg, Player* player)
void ScriptMgr::OnBattlegroundBeforeAddPlayer(Battleground* bg, Player* player)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnBattlegroundBeforeAddPlayer(bg, player);
});
@@ -60,7 +61,7 @@ void ScriptMgr::OnBattlegroundBeforeAddPlayer(Battleground* bg, Player* player)
void ScriptMgr::OnBattlegroundRemovePlayerAtLeave(Battleground* bg, Player* player)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnBattlegroundRemovePlayerAtLeave(bg, player);
});
@@ -69,7 +70,7 @@ void ScriptMgr::OnBattlegroundRemovePlayerAtLeave(Battleground* bg, Player* play
void ScriptMgr::OnAddGroup(BattlegroundQueue* queue, GroupQueueInfo* ginfo, uint32& index, Player* leader, Group* group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry,
uint8 arenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 matchmakerRating, uint32 arenaTeamId, uint32 opponentsArenaTeamId)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnAddGroup(queue, ginfo, index, leader, group, bgTypeId, bracketEntry,
arenaType, isRated, isPremade, arenaRating, matchmakerRating, arenaTeamId, opponentsArenaTeamId);
@@ -78,7 +79,7 @@ void ScriptMgr::OnAddGroup(BattlegroundQueue* queue, GroupQueueInfo* ginfo, uint
bool ScriptMgr::CanFillPlayersToBG(BattlegroundQueue* queue, Battleground* bg, BattlegroundBracketId bracket_id)
{
- auto ret = IsValidBoolScript([&](BGScript* script)
+ auto ret = IsValidBoolScript([&](AllBattlegroundScript* script)
{
return !script->CanFillPlayersToBG(queue, bg, bracket_id);
});
@@ -88,7 +89,7 @@ bool ScriptMgr::CanFillPlayersToBG(BattlegroundQueue* queue, Battleground* bg, B
bool ScriptMgr::IsCheckNormalMatch(BattlegroundQueue* queue, Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers)
{
- auto ret = IsValidBoolScript([&](BGScript* script)
+ auto ret = IsValidBoolScript([&](AllBattlegroundScript* script)
{
return script->IsCheckNormalMatch(queue, bgTemplate, bracket_id, minPlayers, maxPlayers);
});
@@ -98,7 +99,7 @@ bool ScriptMgr::IsCheckNormalMatch(BattlegroundQueue* queue, Battleground* bgTem
void ScriptMgr::OnQueueUpdate(BattlegroundQueue* queue, uint32 diff, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnQueueUpdate(queue, diff, bgTypeId, bracket_id, arenaType, isRated, arenaRating);
});
@@ -106,7 +107,7 @@ void ScriptMgr::OnQueueUpdate(BattlegroundQueue* queue, uint32 diff, Battlegroun
bool ScriptMgr::CanSendMessageBGQueue(BattlegroundQueue* queue, Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry)
{
- auto ret = IsValidBoolScript([&](BGScript* script)
+ auto ret = IsValidBoolScript([&](AllBattlegroundScript* script)
{
return !script->CanSendMessageBGQueue(queue, leader, bg, bracketEntry);
});
@@ -116,7 +117,7 @@ bool ScriptMgr::CanSendMessageBGQueue(BattlegroundQueue* queue, Player* leader,
bool ScriptMgr::OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* queue, Player* leader, GroupQueueInfo* ginfo, PvPDifficultyEntry const* bracketEntry, bool isRated)
{
- auto ret = IsValidBoolScript([&](BGScript* script)
+ auto ret = IsValidBoolScript([&](AllBattlegroundScript* script)
{
return !script->OnBeforeSendJoinMessageArenaQueue(queue, leader, ginfo, bracketEntry, isRated);
});
@@ -126,7 +127,7 @@ bool ScriptMgr::OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* queue, Play
bool ScriptMgr::OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* queue, GroupQueueInfo* ginfo)
{
- auto ret = IsValidBoolScript([&](BGScript* script)
+ auto ret = IsValidBoolScript([&](AllBattlegroundScript* script)
{
return !script->OnBeforeSendExitMessageArenaQueue(queue, ginfo);
});
@@ -136,7 +137,7 @@ bool ScriptMgr::OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* queue, Grou
void ScriptMgr::OnBattlegroundEnd(Battleground* bg, TeamId winnerTeam)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnBattlegroundEnd(bg, winnerTeam);
});
@@ -144,7 +145,7 @@ void ScriptMgr::OnBattlegroundEnd(Battleground* bg, TeamId winnerTeam)
void ScriptMgr::OnBattlegroundDestroy(Battleground* bg)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnBattlegroundDestroy(bg);
});
@@ -152,8 +153,16 @@ void ScriptMgr::OnBattlegroundDestroy(Battleground* bg)
void ScriptMgr::OnBattlegroundCreate(Battleground* bg)
{
- ExecuteScript([&](BGScript* script)
+ ExecuteScript([&](AllBattlegroundScript* script)
{
script->OnBattlegroundCreate(bg);
});
}
+
+AllBattlegroundScript::AllBattlegroundScript(char const* name) :
+ ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.h b/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.h
new file mode 100644
index 000000000..379cc4635
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.h
@@ -0,0 +1,115 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ALL_BATTLEGROUND_SCRIPT_H_
+#define SCRIPT_OBJECT_ALL_BATTLEGROUND_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+enum BattlegroundBracketId : uint8;
+enum BattlegroundTypeId : uint8;
+enum TeamId : uint8;
+
+class AllBattlegroundScript : public ScriptObject
+{
+protected:
+ AllBattlegroundScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return false; }
+
+ /**
+ * @brief This hook runs before start Battleground
+ *
+ * @param bg Contains information about the Battleground
+ */
+ virtual void OnBattlegroundStart(Battleground* /*bg*/) { }
+
+ // End Battleground
+ virtual void OnBattlegroundEndReward(Battleground* /*bg*/, Player* /*player*/, TeamId /*winnerTeamId*/) { }
+
+ // Update Battlegroud
+ virtual void OnBattlegroundUpdate(Battleground* /*bg*/, uint32 /*diff*/) { }
+
+ // Add Player in Battlegroud
+ virtual void OnBattlegroundAddPlayer(Battleground* /*bg*/, Player* /*player*/) { }
+
+ // Before added player in Battlegroud
+ virtual void OnBattlegroundBeforeAddPlayer(Battleground* /*bg*/, Player* /*player*/) { }
+
+ // Remove player at leave BG
+ virtual void OnBattlegroundRemovePlayerAtLeave(Battleground* /*bg*/, Player* /*player*/) { }
+
+ virtual void OnQueueUpdate(BattlegroundQueue* /*queue*/, uint32 /* diff */, BattlegroundTypeId /* bgTypeId */, BattlegroundBracketId /* bracket_id */, uint8 /* arenaType */, bool /* isRated */, uint32 /* arenaRating */) { }
+
+ virtual void OnAddGroup(BattlegroundQueue* /*queue*/, GroupQueueInfo* /*ginfo*/, uint32& /*index*/, Player* /*leader*/, Group* /*group*/, BattlegroundTypeId /* bgTypeId */, PvPDifficultyEntry const* /* bracketEntry */,
+ uint8 /* arenaType */, bool /* isRated */, bool /* isPremade */, uint32 /* arenaRating */, uint32 /* matchmakerRating */, uint32 /* arenaTeamId */, uint32 /* opponentsArenaTeamId */) { }
+
+ [[nodiscard]] virtual bool CanFillPlayersToBG(BattlegroundQueue* /*queue*/, Battleground* /*bg*/, BattlegroundBracketId /*bracket_id*/) { return true; }
+
+ [[nodiscard]] virtual bool IsCheckNormalMatch(BattlegroundQueue* /*queue*/, Battleground* /*bgTemplate*/, BattlegroundBracketId /*bracket_id*/, uint32 /*minPlayers*/, uint32 /*maxPlayers*/) { return false; };
+
+ [[nodiscard]] virtual bool CanSendMessageBGQueue(BattlegroundQueue* /*queue*/, Player* /*leader*/, Battleground* /*bg*/, PvPDifficultyEntry const* /*bracketEntry*/) { return true; }
+
+ /**
+ * @brief This hook runs before sending the join message during the arena queue, allowing you to run extra operations or disabling the join message
+ *
+ * @param queue Contains information about the Arena queue
+ * @param leader Contains information about the player leader
+ * @param ginfo Contains information about the group of the queue
+ * @param bracketEntry Contains information about the bracket
+ * @param isRated Contains information about rated arena or skirmish
+ * @return True if you want to continue sending the message, false if you want to disable the message
+ */
+ [[nodiscard]] virtual bool OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* /*queue*/, Player* /*leader*/, GroupQueueInfo* /*ginfo*/, PvPDifficultyEntry const* /*bracketEntry*/, bool /*isRated*/) { return true; }
+
+ /**
+ * @brief This hook runs before sending the exit message during the arena queue, allowing you to run extra operations or disabling the exit message
+ *
+ * @param queue Contains information about the Arena queue
+ * @param ginfo Contains information about the group of the queue
+ * @return True if you want to continue sending the message, false if you want to disable the message
+ */
+ [[nodiscard]] virtual bool OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* /*queue*/, GroupQueueInfo* /*ginfo*/) { return true; }
+
+ /**
+ * @brief This hook runs after end Battleground
+ *
+ * @param bg Contains information about the Battleground
+ * @param TeamId Contains information about the winneer team
+ */
+ virtual void OnBattlegroundEnd(Battleground* /*bg*/, TeamId /*winner team*/) { }
+
+ /**
+ * @brief This hook runs before Battleground destroy
+ *
+ * @param bg Contains information about the Battleground
+ */
+ virtual void OnBattlegroundDestroy(Battleground* /*bg*/) { }
+
+ /**
+ * @brief This hook runs after Battleground create
+ *
+ * @param bg Contains information about the Battleground
+ */
+ virtual void OnBattlegroundCreate(Battleground* /*bg*/) { }
+};
+
+// Compatibility for old scripts
+using BGScript = AllBattlegroundScript;
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/CommandSC.cpp b/src/server/game/Scripting/ScriptDefines/AllCommandScript.cpp
similarity index 76%
rename from src/server/game/Scripting/ScriptDefines/CommandSC.cpp
rename to src/server/game/Scripting/ScriptDefines/AllCommandScript.cpp
index 22cb02592..b30b9e601 100644
--- a/src/server/game/Scripting/ScriptDefines/CommandSC.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AllCommandScript.cpp
@@ -15,12 +15,13 @@
* with this program. If not, see .
*/
+#include "AllCommandScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
void ScriptMgr::OnHandleDevCommand(Player* player, bool& enable)
{
- ExecuteScript([&](CommandSC* script)
+ ExecuteScript([&](AllCommandScript* script)
{
script->OnHandleDevCommand(player, enable);
});
@@ -28,15 +29,16 @@ void ScriptMgr::OnHandleDevCommand(Player* player, bool& enable)
bool ScriptMgr::CanExecuteCommand(ChatHandler& handler, std::string_view cmdStr)
{
- auto ret = IsValidBoolScript([&](CommandSC* script)
+ auto ret = IsValidBoolScript([&](AllCommandScript* script)
{
return !script->CanExecuteCommand(handler, cmdStr);
});
- if (ret && *ret)
- {
- return false;
- }
-
- return true;
+ return ReturnValidBool(ret);
+}
+
+AllCommandScript::AllCommandScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
}
diff --git a/src/server/game/Scripting/ScriptDefines/AllCommandScript.h b/src/server/game/Scripting/ScriptDefines/AllCommandScript.h
new file mode 100644
index 000000000..68d582490
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllCommandScript.h
@@ -0,0 +1,45 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ALL_COMMAND_SCRIPT_H_
+#define SCRIPT_OBJECT_ALL_COMMAND_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class AllCommandScript : public ScriptObject
+{
+protected:
+ AllCommandScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return false; }
+
+ virtual void OnHandleDevCommand(Player* /*player*/, bool& /*enable*/) { }
+
+ /**
+ * @brief This hook runs execute chat command
+ *
+ * @param handler Contains information about the ChatHandler
+ * @param cmdStr Contains information about the command name
+ */
+ [[nodiscard]] virtual bool CanExecuteCommand(ChatHandler& /*handler*/, std::string_view /*cmdStr*/) { return true; }
+};
+
+// Compatibility for old scripts
+using CommandSC = AllCommandScript;
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/AllCreatureScript.cpp b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.cpp
index ab588dcdd..7d4e286e3 100644
--- a/src/server/game/Scripting/ScriptDefines/AllCreatureScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "AllCreatureScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -77,3 +78,11 @@ void ScriptMgr::Creature_SelectLevel(const CreatureTemplate* cinfo, Creature* cr
//
// return true;
//}
+
+AllCreatureScript::AllCreatureScript(const char* name) :
+ ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AllCreatureScript.h b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.h
new file mode 100644
index 000000000..a4f83dd2b
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllCreatureScript.h
@@ -0,0 +1,107 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ALL_CREATURE_SCRIPT_H_
+#define SCRIPT_OBJECT_ALL_CREATURE_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class AllCreatureScript : public ScriptObject
+{
+protected:
+ AllCreatureScript(const char* name);
+
+public:
+ // Called from End of Creature Update.
+ virtual void OnAllCreatureUpdate(Creature* /*creature*/, uint32 /*diff*/) { }
+
+ // Called just before the level of the creature is set.
+ virtual void OnBeforeCreatureSelectLevel(const CreatureTemplate* /*cinfo*/, Creature* /*creature*/, uint8& /*level*/) { }
+
+ // Called from End of Creature SelectLevel.
+ virtual void Creature_SelectLevel(const CreatureTemplate* /*cinfo*/, Creature* /*creature*/) { }
+
+ /**
+ * @brief This hook runs after add creature in world
+ *
+ * @param creature Contains information about the Creature
+ */
+ virtual void OnCreatureAddWorld(Creature* /*creature*/) { }
+
+ /**
+ * @brief This hook runs after remove creature in world
+ *
+ * @param creature Contains information about the Creature
+ */
+ virtual void OnCreatureRemoveWorld(Creature* /*creature*/) { }
+
+ /**
+ * @brief This hook runs after creature has been saved to DB
+ *
+ * @param creature Contains information about the Creature
+ */
+ virtual void OnCreatureSaveToDB(Creature* /*creature*/) { }
+
+ /**
+ * @brief This hook called when a player opens a gossip dialog with the creature.
+ *
+ * @param player Contains information about the Player
+ * @param creature Contains information about the Creature
+ *
+ * @return False if you want to continue, true if you want to disable
+ */
+ [[nodiscard]] virtual bool CanCreatureGossipHello(Player* /*player*/, Creature* /*creature*/) { return false; }
+
+ /**
+ * @brief This hook called when a player selects a gossip item in the creature's gossip menu.
+ *
+ * @param player Contains information about the Player
+ * @param creature Contains information about the Creature
+ * @param sender Contains information about the sender type
+ * @param action Contains information about the action id
+ *
+ * @return False if you want to continue, true if you want to disable
+ */
+ [[nodiscard]] virtual bool CanCreatureGossipSelect(Player* /*player*/, Creature* /*creature*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
+
+ /**
+ * @brief This hook called when a player selects a gossip with a code in the creature's gossip menu.
+ *
+ * @param player Contains information about the Player
+ * @param creature Contains information about the Creature
+ * @param sender Contains information about the sender type
+ * @param action Contains information about the action id
+ * @param code Contains information about the code entered
+ *
+ * @return True if you want to continue, false if you want to disable
+ */
+ [[nodiscard]] virtual bool CanCreatureGossipSelectCode(Player* /*player*/, Creature* /*creature*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { return false; }
+
+ // Called when a player accepts a quest from the creature.
+ [[nodiscard]] virtual bool CanCreatureQuestAccept(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/) { return false; }
+
+ // Called when a player selects a quest reward.
+ [[nodiscard]] virtual bool CanCreatureQuestReward(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
+
+ // Called when a CreatureAI object is needed for the creature.
+ [[nodiscard]] virtual CreatureAI* GetCreatureAI(Creature* /*creature*/) const { return nullptr; }
+
+ //Called Whenever the UNIT_BYTE2_FLAG_FFA_PVP Bit is set on the creature
+ virtual void OnFfaPvpStateUpdate(Creature* /*creature*/, bool /*InPvp*/) {}
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.cpp
index 933ef025f..55bd6cd16 100644
--- a/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "AllGameObjectScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -47,3 +48,11 @@ void ScriptMgr::OnGameObjectSaveToDB(GameObject* go)
script->OnGameObjectSaveToDB(go);
});
}
+
+AllGameObjectScript::AllGameObjectScript(const char* name) :
+ ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.h b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.h
new file mode 100644
index 000000000..2dd5ba2a7
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.h
@@ -0,0 +1,89 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ALL_GAMEOBJECT_SCRIPT_H_
+#define SCRIPT_OBJECT_ALL_GAMEOBJECT_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class AllGameObjectScript : public ScriptObject
+{
+protected:
+ AllGameObjectScript(const char* name);
+
+public:
+ /**
+ * @brief This hook runs after add game object in world
+ *
+ * @param go Contains information about the GameObject
+ */
+ virtual void OnGameObjectAddWorld(GameObject* /*go*/) { }
+ /**
+ * @brief This hook runs after the game object iis saved to the database
+ *
+ * @param go Contains information about the GameObject
+ */
+ virtual void OnGameObjectSaveToDB(GameObject* /*go*/) { }
+ /**
+ * @brief This hook runs after remove game object in world
+ *
+ * @param go Contains information about the GameObject
+ */
+ virtual void OnGameObjectRemoveWorld(GameObject* /*go*/) { }
+
+ /**
+ * @brief This hook runs after remove game object in world
+ *
+ * @param go Contains information about the GameObject
+ */
+ virtual void OnGameObjectUpdate(GameObject* /*go*/, uint32 /*diff*/) { }
+
+ // Called when a player opens a gossip dialog with the gameobject.
+ [[nodiscard]] virtual bool CanGameObjectGossipHello(Player* /*player*/, GameObject* /*go*/) { return false; }
+
+ // Called when a player selects a gossip item in the gameobject's gossip menu.
+ [[nodiscard]] virtual bool CanGameObjectGossipSelect(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
+
+ // Called when a player selects a gossip with a code in the gameobject's gossip menu.
+ [[nodiscard]] virtual bool CanGameObjectGossipSelectCode(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { return false; }
+
+ // Called when a player accepts a quest from the gameobject.
+ [[nodiscard]] virtual bool CanGameObjectQuestAccept(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/) { return false; }
+
+ // Called when a player selects a quest reward.
+ [[nodiscard]] virtual bool CanGameObjectQuestReward(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
+
+ // Called when the game object is destroyed (destructible buildings only).
+ virtual void OnGameObjectDestroyed(GameObject* /*go*/, Player* /*player*/) { }
+
+ // Called when the game object is damaged (destructible buildings only).
+ virtual void OnGameObjectDamaged(GameObject* /*go*/, Player* /*player*/) { }
+
+ // Called when the health of a game object is modified (destructible buildings only).
+ virtual void OnGameObjectModifyHealth(GameObject* /*go*/, Unit* /*attackerOrHealer*/, int32& /*change*/, SpellInfo const* /*spellInfo*/) { }
+
+ // Called when the game object loot state is changed.
+ virtual void OnGameObjectLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { }
+
+ // Called when the game object state is changed.
+ virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { }
+
+ // Called when a GameObjectAI object is needed for the gameobject.
+ virtual GameObjectAI* GetGameObjectAI(GameObject* /*go*/) const { return nullptr; }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/ItemScript.cpp b/src/server/game/Scripting/ScriptDefines/AllItemScript.cpp
similarity index 90%
rename from src/server/game/Scripting/ScriptDefines/ItemScript.cpp
rename to src/server/game/Scripting/ScriptDefines/AllItemScript.cpp
index 44e82f0aa..c276bb5d0 100644
--- a/src/server/game/Scripting/ScriptDefines/ItemScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AllItemScript.cpp
@@ -15,6 +15,8 @@
* with this program. If not, see .
*/
+#include "AllItemScript.h"
+#include "ItemScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
#include "ScriptedGossip.h"
@@ -139,3 +141,18 @@ void ScriptMgr::OnGossipSelectCode(Player* player, Item* item, uint32 sender, ui
tempScript->OnGossipSelectCode(player, item, sender, action, code);
}
}
+
+AllItemScript::AllItemScript(const char* name) :
+ ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+ItemScript::ItemScript(const char* name) :
+ ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AllItemScript.h b/src/server/game/Scripting/ScriptDefines/AllItemScript.h
new file mode 100644
index 000000000..94c54c4b0
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllItemScript.h
@@ -0,0 +1,48 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ALL_ITEM_SCRIPT_H_
+#define SCRIPT_OBJECT_ALL_ITEM_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class AllItemScript : public ScriptObject
+{
+protected:
+ AllItemScript(const char* name);
+
+public:
+ // Called when a player accepts a quest from the item.
+ [[nodiscard]] virtual bool CanItemQuestAccept(Player* /*player*/, Item* /*item*/, Quest const* /*quest*/) { return true; }
+
+ // Called when a player uses the item.
+ [[nodiscard]] virtual bool CanItemUse(Player* /*player*/, Item* /*item*/, SpellCastTargets const& /*targets*/) { return false; }
+
+ // Called when the item is destroyed.
+ [[nodiscard]] virtual bool CanItemRemove(Player* /*player*/, Item* /*item*/) { return true; }
+
+ // Called when the item expires (is destroyed).
+ [[nodiscard]] virtual bool CanItemExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return true; }
+
+ // Called when a player selects an option in an item gossip window
+ virtual void OnItemGossipSelect(Player* /*player*/, Item* /*item*/, uint32 /*sender*/, uint32 /*action*/) { }
+
+ // Called when a player selects an option in an item gossip window
+ virtual void OnItemGossipSelectCode(Player* /*player*/, Item* /*item*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/AllMapScript.cpp b/src/server/game/Scripting/ScriptDefines/AllMapScript.cpp
index 5dc11d58b..e35700a12 100644
--- a/src/server/game/Scripting/ScriptDefines/AllMapScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AllMapScript.cpp
@@ -15,122 +15,65 @@
* with this program. If not, see .
*/
+#include "AllMapScript.h"
+#include "BattlegroundMapScript.h"
+#include "InstanceMapScript.h"
+#include "PlayerScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
+#include "WorldMapScript.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)
+ void ForeachMaps(Map* map, std::function const& executeHook)
{
auto mapEntry = map->GetEntry();
-
if (!mapEntry)
{
return;
}
- if (!mapEntry->IsWorldMap())
+ if constexpr (std::is_same_v)
+ {
+ if (!mapEntry->IsWorldMap())
+ {
+ return;
+ }
+ }
+ else if constexpr (std::is_same_v)
+ {
+ if (!mapEntry->IsDungeon())
+ {
+ return;
+ }
+ }
+ else if constexpr (std::is_same_v)
+ {
+ if (!mapEntry->IsBattleground())
+ {
+ return;
+ }
+ }
+ else
+ {
+ static_assert(Acore::dependant_false_v, "Unsupported type used for ForeachMaps");
+ }
+
+ if (ScriptRegistry::ScriptPointerList.empty())
{
return;
}
- if (ScriptRegistry::ScriptPointerList.empty())
+ for (auto const& [scriptID, script] : ScriptRegistry::ScriptPointerList)
{
- return;
- }
-
- for (auto const& [scriptID, script] : ScriptRegistry::ScriptPointerList)
- {
- MapEntry const* mapEntry = script->GetEntry();
- if (!mapEntry)
+ auto const scriptEntry = script->GetEntry();
+ if (!scriptEntry)
{
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())
+ if (scriptEntry->MapID != map->GetId())
{
continue;
}
@@ -151,22 +94,22 @@ void ScriptMgr::OnCreateMap(Map* map)
});
ForeachMaps(map,
- [&](WorldMapScript* script)
- {
- script->OnCreate(map);
- });
+ [&](WorldMapScript* script)
+ {
+ script->OnCreate(map);
+ });
ForeachMaps(map,
- [&](InstanceMapScript* script)
- {
- script->OnCreate((InstanceMap*)map);
- });
+ [&](InstanceMapScript* script)
+ {
+ script->OnCreate((InstanceMap*)map);
+ });
ForeachMaps(map,
- [&](BattlegroundMapScript* script)
- {
- script->OnCreate((BattlegroundMap*)map);
- });
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnCreate((BattlegroundMap*)map);
+ });
}
void ScriptMgr::OnDestroyMap(Map* map)
@@ -179,22 +122,22 @@ void ScriptMgr::OnDestroyMap(Map* map)
});
ForeachMaps(map,
- [&](WorldMapScript* script)
- {
- script->OnDestroy(map);
- });
+ [&](WorldMapScript* script)
+ {
+ script->OnDestroy(map);
+ });
ForeachMaps(map,
- [&](InstanceMapScript* script)
- {
- script->OnDestroy((InstanceMap*)map);
- });
+ [&](InstanceMapScript* script)
+ {
+ script->OnDestroy((InstanceMap*)map);
+ });
ForeachMaps(map,
- [&](BattlegroundMapScript* script)
- {
- script->OnDestroy((BattlegroundMap*)map);
- });
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnDestroy((BattlegroundMap*)map);
+ });
}
void ScriptMgr::OnLoadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
@@ -203,22 +146,22 @@ void ScriptMgr::OnLoadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
ASSERT(gmap);
ForeachMaps(map,
- [&](WorldMapScript* script)
- {
- script->OnLoadGridMap(map, gmap, gx, gy);
- });
+ [&](WorldMapScript* script)
+ {
+ script->OnLoadGridMap(map, gmap, gx, gy);
+ });
ForeachMaps(map,
- [&](InstanceMapScript* script)
- {
- script->OnLoadGridMap((InstanceMap*)map, gmap, gx, gy);
- });
+ [&](InstanceMapScript* script)
+ {
+ script->OnLoadGridMap((InstanceMap*)map, gmap, gx, gy);
+ });
ForeachMaps(map,
- [&](BattlegroundMapScript* script)
- {
- script->OnLoadGridMap((BattlegroundMap*)map, gmap, gx, gy);
- });
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnLoadGridMap((BattlegroundMap*)map, gmap, gx, gy);
+ });
}
void ScriptMgr::OnUnloadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
@@ -227,22 +170,22 @@ void ScriptMgr::OnUnloadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
ASSERT(gmap);
ForeachMaps(map,
- [&](WorldMapScript* script)
- {
- script->OnUnloadGridMap(map, gmap, gx, gy);
- });
+ [&](WorldMapScript* script)
+ {
+ script->OnUnloadGridMap(map, gmap, gx, gy);
+ });
ForeachMaps(map,
- [&](InstanceMapScript* script)
- {
- script->OnUnloadGridMap((InstanceMap*)map, gmap, gx, gy);
- });
+ [&](InstanceMapScript* script)
+ {
+ script->OnUnloadGridMap((InstanceMap*)map, gmap, gx, gy);
+ });
ForeachMaps(map,
- [&](BattlegroundMapScript* script)
- {
- script->OnUnloadGridMap((BattlegroundMap*)map, gmap, gx, gy);
- });
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnUnloadGridMap((BattlegroundMap*)map, gmap, gx, gy);
+ });
}
void ScriptMgr::OnPlayerEnterMap(Map* map, Player* player)
@@ -255,28 +198,28 @@ void ScriptMgr::OnPlayerEnterMap(Map* map, Player* player)
script->OnPlayerEnterAll(map, player);
});
- ExecuteScript([&](PlayerScript* script)
+ ExecuteScript([=](PlayerScript* script)
{
script->OnMapChanged(player);
});
ForeachMaps(map,
- [&](WorldMapScript* script)
- {
- script->OnPlayerEnter(map, player);
- });
+ [&](WorldMapScript* script)
+ {
+ script->OnPlayerEnter(map, player);
+ });
ForeachMaps(map,
- [&](InstanceMapScript* script)
- {
- script->OnPlayerEnter((InstanceMap*)map, player);
- });
+ [&](InstanceMapScript* script)
+ {
+ script->OnPlayerEnter((InstanceMap*)map, player);
+ });
ForeachMaps(map,
- [&](BattlegroundMapScript* script)
- {
- script->OnPlayerEnter((BattlegroundMap*)map, player);
- });
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnPlayerEnter((BattlegroundMap*)map, player);
+ });
}
void ScriptMgr::OnPlayerLeaveMap(Map* map, Player* player)
@@ -290,22 +233,22 @@ void ScriptMgr::OnPlayerLeaveMap(Map* map, Player* player)
});
ForeachMaps(map,
- [&](WorldMapScript* script)
- {
- script->OnPlayerLeave(map, player);
- });
+ [&](WorldMapScript* script)
+ {
+ script->OnPlayerLeave(map, player);
+ });
ForeachMaps(map,
- [&](InstanceMapScript* script)
- {
- script->OnPlayerLeave((InstanceMap*)map, player);
- });
+ [&](InstanceMapScript* script)
+ {
+ script->OnPlayerLeave((InstanceMap*)map, player);
+ });
ForeachMaps(map,
- [&](BattlegroundMapScript* script)
- {
- script->OnPlayerLeave((BattlegroundMap*)map, player);
- });
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnPlayerLeave((BattlegroundMap*)map, player);
+ });
}
void ScriptMgr::OnMapUpdate(Map* map, uint32 diff)
@@ -318,22 +261,22 @@ void ScriptMgr::OnMapUpdate(Map* map, uint32 diff)
});
ForeachMaps(map,
- [&](WorldMapScript* script)
- {
- script->OnUpdate(map, diff);
- });
+ [&](WorldMapScript* script)
+ {
+ script->OnUpdate(map, diff);
+ });
ForeachMaps(map,
- [&](InstanceMapScript* script)
- {
- script->OnUpdate((InstanceMap*)map, diff);
- });
+ [&](InstanceMapScript* script)
+ {
+ script->OnUpdate((InstanceMap*)map, diff);
+ });
ForeachMaps(map,
- [&](BattlegroundMapScript* script)
- {
- script->OnUpdate((BattlegroundMap*)map, diff);
- });
+ [&](BattlegroundMapScript* script)
+ {
+ script->OnUpdate((BattlegroundMap*)map, diff);
+ });
}
void ScriptMgr::OnBeforeCreateInstanceScript(InstanceMap* instanceMap, InstanceScript* instanceData, bool load, std::string data, uint32 completedEncounterMask)
@@ -351,3 +294,11 @@ void ScriptMgr::OnDestroyInstance(MapInstanced* mapInstanced, Map* map)
script->OnDestroyInstance(mapInstanced, map);
});
}
+
+AllMapScript::AllMapScript(const char* name) :
+ ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AllMapScript.h b/src/server/game/Scripting/ScriptDefines/AllMapScript.h
new file mode 100644
index 000000000..f97198866
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllMapScript.h
@@ -0,0 +1,87 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ALL_MAP_SCRIPT_H_
+#define SCRIPT_OBJECT_ALL_MAP_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class AllMapScript : public ScriptObject
+{
+protected:
+ AllMapScript(const char* name);
+
+public:
+ /**
+ * @brief This hook called when a player enters any Map
+ *
+ * @param map Contains information about the Map
+ * @param player Contains information about the Player
+ */
+ virtual void OnPlayerEnterAll(Map* /*map*/, Player* /*player*/) { }
+
+ /**
+ * @brief This hook called when a player leave any Map
+ *
+ * @param map Contains information about the Map
+ * @param player Contains information about the Player
+ */
+ virtual void OnPlayerLeaveAll(Map* /*map*/, Player* /*player*/) { }
+
+ /**
+ * @brief This hook called before create instance script
+ *
+ * @param instanceMap Contains information about the WorldSession
+ * @param instanceData Contains information about the WorldPacket
+ * @param load if true loading instance save data
+ * @param data Contains information about the instance save data
+ * @param completedEncounterMask Contains information about the completed encouter mask
+ */
+ virtual void OnBeforeCreateInstanceScript(InstanceMap* /*instanceMap*/, InstanceScript* /*instanceData*/, bool /*load*/, std::string /*data*/, uint32 /*completedEncounterMask*/) { }
+
+ /**
+ * @brief This hook called before destroy instance
+ *
+ * @param mapInstanced Contains information about the MapInstanced
+ * @param map Contains information about the Map
+ */
+ virtual void OnDestroyInstance(MapInstanced* /*mapInstanced*/, Map* /*map*/) { }
+
+ /**
+ * @brief This hook called before creating map
+ *
+ * @param map Contains information about the Map
+ */
+ virtual void OnCreateMap(Map* /*map*/) { }
+
+ /**
+ * @brief This hook called before destroing map
+ *
+ * @param map Contains information about the Map
+ */
+ virtual void OnDestroyMap(Map* /*map*/) { }
+
+ /**
+ * @brief This hook called before updating map
+ *
+ * @param map Contains information about the Map
+ * @param diff Contains information about the diff time
+ */
+ virtual void OnMapUpdate(Map* /*map*/, uint32 /*diff*/) { }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/AllScriptsObjects.h b/src/server/game/Scripting/ScriptDefines/AllScriptsObjects.h
new file mode 100644
index 000000000..aad81c070
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllScriptsObjects.h
@@ -0,0 +1,69 @@
+/*
+ * 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 .
+ */
+
+#ifndef ALL_SCRIPT_OBJECTS_H_
+#define ALL_SCRIPT_OBJECTS_H_
+
+#include "AccountScript.h"
+#include "AchievementCriteriaScript.h"
+#include "AchievementScript.h"
+#include "AllBattlegroundScript.h"
+#include "AllCommandScript.h"
+#include "AllCreatureScript.h"
+#include "AllGameObjectScript.h"
+#include "AllItemScript.h"
+#include "AllMapScript.h"
+#include "AllSpellScript.h"
+#include "AreaTriggerScript.h"
+#include "ArenaScript.h"
+#include "ArenaTeamScript.h"
+#include "AuctionHouseScript.h"
+#include "BattlegroundMapScript.h"
+#include "BattlegroundScript.h"
+#include "CommandScript.h"
+#include "ConditionScript.h"
+#include "CreatureScript.h"
+#include "DatabaseScript.h"
+#include "DynamicObjectScript.h"
+#include "ElunaScript.h"
+#include "FormulaScript.h"
+#include "GameEventScript.h"
+#include "GameObjectScript.h"
+#include "GlobalScript.h"
+#include "GroupScript.h"
+#include "GuildScript.h"
+#include "InstanceMapScript.h"
+#include "ItemScript.h"
+#include "LootScript.h"
+#include "MailScript.h"
+#include "MiscScript.h"
+#include "ModuleScript.h"
+#include "MovementHandlerScript.h"
+#include "OutdoorPvPScript.h"
+#include "PetScript.h"
+#include "PlayerScript.h"
+#include "ServerScript.h"
+#include "SpellScriptLoader.h"
+#include "TransportScript.h"
+#include "UnitScript.h"
+#include "VehicleScript.h"
+#include "WeatherScript.h"
+#include "WorldMapScript.h"
+#include "WorldObjectScript.h"
+#include "WorldScript.h"
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/SpellSC.cpp b/src/server/game/Scripting/ScriptDefines/AllSpellScript.cpp
similarity index 77%
rename from src/server/game/Scripting/ScriptDefines/SpellSC.cpp
rename to src/server/game/Scripting/ScriptDefines/AllSpellScript.cpp
index c84bb104e..b0f4948bb 100644
--- a/src/server/game/Scripting/ScriptDefines/SpellSC.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AllSpellScript.cpp
@@ -15,12 +15,13 @@
* with this program. If not, see .
*/
+#include "AllSpellScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
void ScriptMgr::OnCalcMaxDuration(Aura const* aura, int32& maxDuration)
{
- ExecuteScript([&](SpellSC* script)
+ ExecuteScript([&](AllSpellScript* script)
{
script->OnCalcMaxDuration(aura, maxDuration);
});
@@ -28,7 +29,7 @@ void ScriptMgr::OnCalcMaxDuration(Aura const* aura, int32& maxDuration)
bool ScriptMgr::CanModAuraEffectDamageDone(AuraEffect const* auraEff, Unit* target, AuraApplication const* aurApp, uint8 mode, bool apply)
{
- auto ret = IsValidBoolScript([&](SpellSC* script)
+ auto ret = IsValidBoolScript([&](AllSpellScript* script)
{
return !script->CanModAuraEffectDamageDone(auraEff, target, aurApp, mode, apply);
});
@@ -43,7 +44,7 @@ bool ScriptMgr::CanModAuraEffectDamageDone(AuraEffect const* auraEff, Unit* targ
bool ScriptMgr::CanModAuraEffectModDamagePercentDone(AuraEffect const* auraEff, Unit* target, AuraApplication const* aurApp, uint8 mode, bool apply)
{
- auto ret = IsValidBoolScript([&](SpellSC* script)
+ auto ret = IsValidBoolScript([&](AllSpellScript* script)
{
return !script->CanModAuraEffectModDamagePercentDone(auraEff, target, aurApp, mode, apply);
});
@@ -58,7 +59,7 @@ bool ScriptMgr::CanModAuraEffectModDamagePercentDone(AuraEffect const* auraEff,
void ScriptMgr::OnSpellCheckCast(Spell* spell, bool strict, SpellCastResult& res)
{
- ExecuteScript([&](SpellSC* script)
+ ExecuteScript([&](AllSpellScript* script)
{
script->OnSpellCheckCast(spell, strict, res);
});
@@ -66,7 +67,7 @@ void ScriptMgr::OnSpellCheckCast(Spell* spell, bool strict, SpellCastResult& res
bool ScriptMgr::CanPrepare(Spell* spell, SpellCastTargets const* targets, AuraEffect const* triggeredByAura)
{
- auto ret = IsValidBoolScript([&](SpellSC* script)
+ auto ret = IsValidBoolScript([&](AllSpellScript* script)
{
return !script->CanPrepare(spell, targets, triggeredByAura);
});
@@ -81,7 +82,7 @@ bool ScriptMgr::CanPrepare(Spell* spell, SpellCastTargets const* targets, AuraEf
bool ScriptMgr::CanScalingEverything(Spell* spell)
{
- auto ret = IsValidBoolScript([&](SpellSC* script)
+ auto ret = IsValidBoolScript([&](AllSpellScript* script)
{
return script->CanScalingEverything(spell);
});
@@ -96,7 +97,7 @@ bool ScriptMgr::CanScalingEverything(Spell* spell)
bool ScriptMgr::CanSelectSpecTalent(Spell* spell)
{
- auto ret = IsValidBoolScript([&](SpellSC* script)
+ auto ret = IsValidBoolScript([&](AllSpellScript* script)
{
return !script->CanSelectSpecTalent(spell);
});
@@ -111,7 +112,7 @@ bool ScriptMgr::CanSelectSpecTalent(Spell* spell)
void ScriptMgr::OnScaleAuraUnitAdd(Spell* spell, Unit* target, uint32 effectMask, bool checkIfValid, bool implicit, uint8 auraScaleMask, TargetInfo& targetInfo)
{
- ExecuteScript([&](SpellSC* script)
+ ExecuteScript([&](AllSpellScript* script)
{
script->OnScaleAuraUnitAdd(spell, target, effectMask, checkIfValid, implicit, auraScaleMask, targetInfo);
});
@@ -119,7 +120,7 @@ void ScriptMgr::OnScaleAuraUnitAdd(Spell* spell, Unit* target, uint32 effectMask
void ScriptMgr::OnRemoveAuraScaleTargets(Spell* spell, TargetInfo& targetInfo, uint8 auraScaleMask, bool& needErase)
{
- ExecuteScript([&](SpellSC* script)
+ ExecuteScript([&](AllSpellScript* script)
{
script->OnRemoveAuraScaleTargets(spell, targetInfo, auraScaleMask, needErase);
});
@@ -127,7 +128,7 @@ void ScriptMgr::OnRemoveAuraScaleTargets(Spell* spell, TargetInfo& targetInfo, u
void ScriptMgr::OnBeforeAuraRankForLevel(SpellInfo const* spellInfo, SpellInfo const* latestSpellInfo, uint8 level)
{
- ExecuteScript([&](SpellSC* script)
+ ExecuteScript([&](AllSpellScript* script)
{
script->OnBeforeAuraRankForLevel(spellInfo, latestSpellInfo, level);
});
@@ -135,7 +136,7 @@ void ScriptMgr::OnBeforeAuraRankForLevel(SpellInfo const* spellInfo, SpellInfo c
void ScriptMgr::OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, GameObject* gameObjTarget)
{
- ExecuteScript([&](SpellSC* script)
+ ExecuteScript([&](AllSpellScript* script)
{
script->OnDummyEffect(caster, spellID, effIndex, gameObjTarget);
});
@@ -143,7 +144,7 @@ void ScriptMgr::OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex
void ScriptMgr::OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Creature* creatureTarget)
{
- ExecuteScript([&](SpellSC* script)
+ ExecuteScript([&](AllSpellScript* script)
{
script->OnDummyEffect(caster, spellID, effIndex, creatureTarget);
});
@@ -151,8 +152,16 @@ void ScriptMgr::OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex
void ScriptMgr::OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Item* itemTarget)
{
- ExecuteScript([&](SpellSC* script)
+ ExecuteScript([&](AllSpellScript* script)
{
script->OnDummyEffect(caster, spellID, effIndex, itemTarget);
});
}
+
+AllSpellScript::AllSpellScript(char const* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AllSpellScript.h b/src/server/game/Scripting/ScriptDefines/AllSpellScript.h
new file mode 100644
index 000000000..2e1899403
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AllSpellScript.h
@@ -0,0 +1,89 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ALL_SPELL_SCRIPT_H_
+#define SCRIPT_OBJECT_ALL_SPELL_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+enum SpellCastResult : uint8;
+enum SpellEffIndex : uint8;
+
+class AllSpellScript : public ScriptObject
+{
+protected:
+ AllSpellScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return false; }
+
+ // Calculate max duration in applying aura
+ virtual void OnCalcMaxDuration(Aura const* /*aura*/, int32& /*maxDuration*/) { }
+
+ [[nodiscard]] virtual bool CanModAuraEffectDamageDone(AuraEffect const* /*auraEff*/, Unit* /*target*/, AuraApplication const* /*aurApp*/, uint8 /*mode*/, bool /*apply*/) { return true; }
+
+ [[nodiscard]] virtual bool CanModAuraEffectModDamagePercentDone(AuraEffect const* /*auraEff*/, Unit* /*target*/, AuraApplication const* /*aurApp*/, uint8 /*mode*/, bool /*apply*/) { return true; }
+
+ virtual void OnSpellCheckCast(Spell* /*spell*/, bool /*strict*/, SpellCastResult& /*res*/) { }
+
+ [[nodiscard]] virtual bool CanPrepare(Spell* /*spell*/, SpellCastTargets const* /*targets*/, AuraEffect const* /*triggeredByAura*/) { return true; }
+
+ [[nodiscard]] virtual bool CanScalingEverything(Spell* /*spell*/) { return false; }
+
+ [[nodiscard]] virtual bool CanSelectSpecTalent(Spell* /*spell*/) { return true; }
+
+ virtual void OnScaleAuraUnitAdd(Spell* /*spell*/, Unit* /*target*/, uint32 /*effectMask*/, bool /*checkIfValid*/, bool /*implicit*/, uint8 /*auraScaleMask*/, TargetInfo& /*targetInfo*/) { }
+
+ virtual void OnRemoveAuraScaleTargets(Spell* /*spell*/, TargetInfo& /*targetInfo*/, uint8 /*auraScaleMask*/, bool& /*needErase*/) { }
+
+ virtual void OnBeforeAuraRankForLevel(SpellInfo const* /*spellInfo*/, SpellInfo const* /*latestSpellInfo*/, uint8 /*level*/) { }
+
+ /**
+ * @brief This hook called after spell dummy effect
+ *
+ * @param caster Contains information about the WorldObject
+ * @param spellID Contains information about the spell id
+ * @param effIndex Contains information about the SpellEffIndex
+ * @param gameObjTarget Contains information about the GameObject
+ */
+ virtual void OnDummyEffect(WorldObject* /*caster*/, uint32 /*spellID*/, SpellEffIndex /*effIndex*/, GameObject* /*gameObjTarget*/) { }
+
+ /**
+ * @brief This hook called after spell dummy effect
+ *
+ * @param caster Contains information about the WorldObject
+ * @param spellID Contains information about the spell id
+ * @param effIndex Contains information about the SpellEffIndex
+ * @param creatureTarget Contains information about the Creature
+ */
+ virtual void OnDummyEffect(WorldObject* /*caster*/, uint32 /*spellID*/, SpellEffIndex /*effIndex*/, Creature* /*creatureTarget*/) { }
+
+ /**
+ * @brief This hook called after spell dummy effect
+ *
+ * @param caster Contains information about the WorldObject
+ * @param spellID Contains information about the spell id
+ * @param effIndex Contains information about the SpellEffIndex
+ * @param itemTarget Contains information about the Item
+ */
+ virtual void OnDummyEffect(WorldObject* /*caster*/, uint32 /*spellID*/, SpellEffIndex /*effIndex*/, Item* /*itemTarget*/) { }
+};
+
+// Compatibility for old scripts
+using SpellSC = AllSpellScript;
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.cpp b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.cpp
index fa3a04deb..6d3429606 100644
--- a/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.cpp
@@ -15,6 +15,9 @@
* with this program. If not, see .
*/
+#include "AreaTriggerScript.h"
+#include "ElunaScript.h"
+#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -36,3 +39,43 @@ bool ScriptMgr::OnAreaTrigger(Player* player, AreaTrigger const* trigger)
auto tempScript = ScriptRegistry::GetScriptById(sObjectMgr->GetAreaTriggerScriptId(trigger->entry));
return tempScript ? tempScript->OnTrigger(player, trigger) : false;
}
+
+AreaTriggerScript::AreaTriggerScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+bool OnlyOnceAreaTriggerScript::OnTrigger(Player* player, AreaTrigger const* trigger)
+{
+ uint32 const triggerId = trigger->entry;
+
+ if (InstanceScript* instance = player->GetInstanceScript())
+ {
+ if (instance->IsAreaTriggerDone(triggerId))
+ {
+ return true;
+ }
+ else
+ {
+ instance->MarkAreaTriggerDone(triggerId);
+ }
+ }
+
+ return _OnTrigger(player, trigger);
+}
+
+void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(InstanceScript* script, uint32 triggerId)
+{
+ script->ResetAreaTriggerDone(triggerId);
+}
+
+void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(Player const* player, AreaTrigger const* trigger)
+{
+ if (InstanceScript* instance = player->GetInstanceScript())
+ {
+ ResetAreaTriggerDone(instance, trigger->entry);
+ }
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.h b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.h
new file mode 100644
index 000000000..1ce1e59d0
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AreaTriggerScript.h
@@ -0,0 +1,48 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_AREA_TRIGGER_SCRIPT_H_
+#define SCRIPT_OBJECT_AREA_TRIGGER_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class AreaTriggerScript : public ScriptObject
+{
+protected:
+ AreaTriggerScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return true; }
+
+ // Called when the area trigger is activated by a player.
+ [[nodiscard]] virtual bool OnTrigger(Player* /*player*/, AreaTrigger const* /*trigger*/) { return false; }
+};
+
+class OnlyOnceAreaTriggerScript : public AreaTriggerScript
+{
+ using AreaTriggerScript::AreaTriggerScript;
+
+public:
+ [[nodiscard]] bool OnTrigger(Player* /*player*/, AreaTrigger const* /*trigger*/) override;
+
+protected:
+ virtual bool _OnTrigger(Player* /*player*/, AreaTrigger const* /*trigger*/) = 0;
+ void ResetAreaTriggerDone(InstanceScript* /*instance*/, uint32 /*triggerId*/);
+ void ResetAreaTriggerDone(Player const* /*player*/, AreaTrigger const* /*trigger*/);
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/ArenaScript.cpp b/src/server/game/Scripting/ScriptDefines/ArenaScript.cpp
index 0bfc33184..89303ba95 100644
--- a/src/server/game/Scripting/ScriptDefines/ArenaScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/ArenaScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "ArenaScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -55,3 +56,11 @@ bool ScriptMgr::CanSaveToDB(ArenaTeam* team)
return true;
}
+
+ArenaScript::ArenaScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/ArenaScript.h b/src/server/game/Scripting/ScriptDefines/ArenaScript.h
new file mode 100644
index 000000000..0d7cb7e93
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/ArenaScript.h
@@ -0,0 +1,41 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ARENA_SCRIPT_H_
+#define SCRIPT_OBJECT_ARENA_SCRIPT_H_
+
+#include "ObjectGuid.h"
+#include "ScriptObject.h"
+
+class ArenaScript : public ScriptObject
+{
+protected:
+
+ ArenaScript(const char* name);
+
+public:
+
+ [[nodiscard]] bool IsDatabaseBound() const override { return false; }
+
+ [[nodiscard]] virtual bool CanAddMember(ArenaTeam* /*team*/, ObjectGuid /*PlayerGuid*/) { return true; }
+
+ virtual void OnGetPoints(ArenaTeam* /*team*/, uint32 /*memberRating*/, float& /*points*/) { }
+
+ [[nodiscard]] virtual bool CanSaveToDB(ArenaTeam* /*team*/) { return true; }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.cpp b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.cpp
index 25555347a..7ddf58f9f 100644
--- a/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "ArenaTeamScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -57,3 +58,11 @@ void ScriptMgr::OnSetArenaMaxPlayersPerTeam(const uint8 arenaType, uint32& maxPl
script->OnSetArenaMaxPlayersPerTeam(arenaType, maxPlayerPerTeam);
});
}
+
+ArenaTeamScript::ArenaTeamScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.h b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.h
new file mode 100644
index 000000000..256d5c510
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/ArenaTeamScript.h
@@ -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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ARENA_TEAM_SCRIPT_H_
+#define SCRIPT_OBJECT_ARENA_TEAM_SCRIPT_H_
+
+#include "Battleground.h"
+#include "ScriptObject.h"
+
+class ArenaTeamScript : public ScriptObject
+{
+protected:
+ ArenaTeamScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return false; };
+
+ virtual void OnGetSlotByType(const uint32 /*type*/, uint8& /*slot*/) {}
+ virtual void OnGetArenaPoints(ArenaTeam* /*team*/, float& /*points*/) {}
+ virtual void OnTypeIDToQueueID(const BattlegroundTypeId /*bgTypeId*/, const uint8 /*arenaType*/, uint32& /*queueTypeID*/) {}
+ virtual void OnQueueIdToArenaType(const BattlegroundQueueTypeId /*bgQueueTypeId*/, uint8& /*ArenaType*/) {}
+ virtual void OnSetArenaMaxPlayersPerTeam(const uint8 /*arenaType*/, uint32& /*maxPlayerPerTeam*/) {}
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.cpp b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.cpp
index e0255d26d..4664d1b95 100644
--- a/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "AuctionHouseScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -117,3 +118,11 @@ void ScriptMgr::OnBeforeAuctionHouseMgrUpdate()
script->OnBeforeAuctionHouseMgrUpdate();
});
}
+
+AuctionHouseScript::AuctionHouseScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.h b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.h
new file mode 100644
index 000000000..02cacd112
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/AuctionHouseScript.h
@@ -0,0 +1,63 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_AUCTION_HOUSE_SCRIPT_H_
+#define SCRIPT_OBJECT_AUCTION_HOUSE_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class AuctionHouseScript : public ScriptObject
+{
+protected:
+ AuctionHouseScript(const char* name);
+
+public:
+ // Called when an auction is added to an auction house.
+ virtual void OnAuctionAdd(AuctionHouseObject* /*ah*/, AuctionEntry* /*entry*/) { }
+
+ // Called when an auction is removed from an auction house.
+ virtual void OnAuctionRemove(AuctionHouseObject* /*ah*/, AuctionEntry* /*entry*/) { }
+
+ // Called when an auction was succesfully completed.
+ virtual void OnAuctionSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* /*entry*/) { }
+
+ // Called when an auction expires.
+ virtual void OnAuctionExpire(AuctionHouseObject* /*ah*/, AuctionEntry* /*entry*/) { }
+
+ // Called before sending the mail concerning a won auction
+ virtual void OnBeforeAuctionHouseMgrSendAuctionWonMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*bidder*/, uint32& /*bidder_accId*/, bool& /*sendNotification*/, bool& /*updateAchievementCriteria*/, bool& /*sendMail*/) { }
+
+ // Called before sending the mail concerning a pending sale
+ virtual void OnBeforeAuctionHouseMgrSendAuctionSalePendingMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*owner*/, uint32& /*owner_accId*/, bool& /*sendMail*/) { }
+
+ // Called before sending the mail concerning a successful auction
+ virtual void OnBeforeAuctionHouseMgrSendAuctionSuccessfulMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*owner*/, uint32& /*owner_accId*/, uint32& /*profit*/, bool& /*sendNotification*/, bool& /*updateAchievementCriteria*/, bool& /*sendMail*/) { }
+
+ // Called before sending the mail concerning an expired auction
+ virtual void OnBeforeAuctionHouseMgrSendAuctionExpiredMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*owner*/, uint32& /*owner_accId*/, bool& /*sendNotification*/, bool& /*sendMail*/) { }
+
+ // Called before sending the mail concerning an outbidded auction
+ virtual void OnBeforeAuctionHouseMgrSendAuctionOutbiddedMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*oldBidder*/, uint32& /*oldBidder_accId*/, Player* /*newBidder*/, uint32& /*newPrice*/, bool& /*sendNotification*/, bool& /*sendMail*/) { }
+
+ // Called before sending the mail concerning an cancelled auction
+ virtual void OnBeforeAuctionHouseMgrSendAuctionCancelledToBidderMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*bidder*/, uint32& /*bidder_accId*/, bool& /*sendMail*/) { }
+
+ // Called before updating the auctions
+ virtual void OnBeforeAuctionHouseMgrUpdate() { }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.cpp b/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.cpp
new file mode 100644
index 000000000..1d0ac139a
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.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 "BattlegroundMapScript.h"
+#include "Log.h"
+#include "ScriptMgr.h"
+
+BattlegroundMapScript::BattlegroundMapScript(const char* name, uint32 mapId) :
+ ScriptObject(name), MapScript(mapId)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+void BattlegroundMapScript::checkValidity()
+{
+ checkMap();
+
+ if (GetEntry() && !GetEntry()->IsBattleground())
+ {
+ LOG_ERROR("maps.script", "BattlegroundMapScript for map {} is invalid.", GetEntry()->MapID);
+ }
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.h b/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.h
new file mode 100644
index 000000000..c0c9c4518
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/BattlegroundMapScript.h
@@ -0,0 +1,34 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_BATTLEGROUND_MAP_SCRIPT_H_
+#define SCRIPT_OBJECT_BATTLEGROUND_MAP_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class BattlegroundMapScript : public ScriptObject, public MapScript
+{
+protected:
+ BattlegroundMapScript(const char* name, uint32 mapId);
+
+public:
+ [[nodiscard]] bool isAfterLoadScript() const override { return true; }
+
+ void checkValidity() override;
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/BattlegroundScript.cpp b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.cpp
index 272b62f0a..89cb1462e 100644
--- a/src/server/game/Scripting/ScriptDefines/BattlegroundScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "BattlegroundScript.h"
#include "ScriptMgr.h"
Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/)
@@ -23,3 +24,11 @@ Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/)
ABORT();
return nullptr;
}
+
+BattlegroundScript::BattlegroundScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/BattlegroundScript.h b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.h
new file mode 100644
index 000000000..70b59f2d4
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/BattlegroundScript.h
@@ -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 .
+ */
+
+#ifndef SCRIPT_OBJECT_BATTLEGROUND_SCRIPT_H_
+#define SCRIPT_OBJECT_BATTLEGROUND_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class BattlegroundScript : public ScriptObject
+{
+protected:
+ BattlegroundScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return true; }
+
+ // Should return a fully valid Battleground object for the type ID.
+ [[nodiscard]] virtual Battleground* GetBattleground() const = 0;
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/CommandScript.cpp b/src/server/game/Scripting/ScriptDefines/CommandScript.cpp
index e0b7c0afc..5d930ec0a 100644
--- a/src/server/game/Scripting/ScriptDefines/CommandScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/CommandScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "CommandScript.h"
#include "Chat.h"
#include "ScriptMgr.h"
@@ -30,3 +31,11 @@ Acore::ChatCommands::ChatCommandTable ScriptMgr::GetChatCommands()
return table;
}
+
+CommandScript::CommandScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/CommandScript.h b/src/server/game/Scripting/ScriptDefines/CommandScript.h
new file mode 100644
index 000000000..397332481
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/CommandScript.h
@@ -0,0 +1,34 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_COMMAND_SCRIPT_H_
+#define SCRIPT_OBJECT_COMMAND_SCRIPT_H_
+
+#include "ScriptObject.h"
+#include
+
+class CommandScript : public ScriptObject
+{
+protected:
+ CommandScript(const char* name);
+
+public:
+ // Should return a pointer to a valid command table (ChatCommand array) to be used by ChatHandler.
+ [[nodiscard]] virtual std::vector GetCommands() const = 0;
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/ConditionScript.cpp b/src/server/game/Scripting/ScriptDefines/ConditionScript.cpp
index 99aacfc82..eab4efb6f 100644
--- a/src/server/game/Scripting/ScriptDefines/ConditionScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/ConditionScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "ConditionScript.h"
#include "ScriptMgr.h"
bool ScriptMgr::OnConditionCheck(Condition* condition, ConditionSourceInfo& sourceInfo)
@@ -24,3 +25,11 @@ bool ScriptMgr::OnConditionCheck(Condition* condition, ConditionSourceInfo& sour
auto tempScript = ScriptRegistry::GetScriptById(condition->ScriptId);
return tempScript ? tempScript->OnConditionCheck(condition, sourceInfo) : true;
}
+
+ConditionScript::ConditionScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/ConditionScript.h b/src/server/game/Scripting/ScriptDefines/ConditionScript.h
new file mode 100644
index 000000000..3f7295e82
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/ConditionScript.h
@@ -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 .
+ */
+
+#ifndef SCRIPT_OBJECT_CONDITION_SCRIPT_H_
+#define SCRIPT_OBJECT_CONDITION_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class ConditionScript : public ScriptObject
+{
+protected:
+ ConditionScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return true; }
+
+ // Called when a single condition is checked for a player.
+ [[nodiscard]] virtual bool OnConditionCheck(Condition* /*condition*/, ConditionSourceInfo& /*sourceInfo*/) { return true; }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/CreatureScript.cpp b/src/server/game/Scripting/ScriptDefines/CreatureScript.cpp
index 375489a3c..d1a76580d 100644
--- a/src/server/game/Scripting/ScriptDefines/CreatureScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/CreatureScript.cpp
@@ -15,6 +15,8 @@
* with this program. If not, see .
*/
+#include "CreatureScript.h"
+#include "AllCreatureScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
#include "ScriptedGossip.h"
@@ -192,3 +194,11 @@ void ScriptMgr::OnCreatureUpdate(Creature* creature, uint32 diff)
tempScript->OnUpdate(creature, diff);
}
}
+
+CreatureScript::CreatureScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/CreatureScript.h b/src/server/game/Scripting/ScriptDefines/CreatureScript.h
new file mode 100644
index 000000000..4fab28f94
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/CreatureScript.h
@@ -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 .
+ */
+
+#ifndef SCRIPT_OBJECT_CREATURE_SCRIPT_H_
+#define SCRIPT_OBJECT_CREATURE_SCRIPT_H_
+
+#include "QuestDef.h"
+#include "ScriptObject.h"
+
+class CreatureScript : public ScriptObject, public UpdatableScript
+{
+protected:
+ CreatureScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return true; }
+
+ // Called when a player opens a gossip dialog with the creature.
+ [[nodiscard]] virtual bool OnGossipHello(Player* /*player*/, Creature* /*creature*/) { return false; }
+
+ // Called when a player selects a gossip item in the creature's gossip menu.
+ [[nodiscard]] virtual bool OnGossipSelect(Player* /*player*/, Creature* /*creature*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
+
+ // Called when a player selects a gossip with a code in the creature's gossip menu.
+ [[nodiscard]] virtual bool OnGossipSelectCode(Player* /*player*/, Creature* /*creature*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { return false; }
+
+ // Called when a player accepts a quest from the creature.
+ [[nodiscard]] virtual bool OnQuestAccept(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/) { return false; }
+
+ // Called when a player selects a quest in the creature's quest menu.
+ [[nodiscard]] virtual bool OnQuestSelect(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/) { return false; }
+
+ // Called when a player completes a quest with the creature.
+ [[nodiscard]] virtual bool OnQuestComplete(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/) { return false; }
+
+ // Called when a player selects a quest reward.
+ [[nodiscard]] virtual bool OnQuestReward(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
+
+ // Called when the dialog status between a player and the creature is requested.
+ virtual uint32 GetDialogStatus(Player* /*player*/, Creature* /*creature*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
+
+ // Called when a CreatureAI object is needed for the creature.
+ virtual CreatureAI* GetAI(Creature* /*creature*/) const { return nullptr; }
+
+ //Called whenever the UNIT_BYTE2_FLAG_FFA_PVP bit is Changed on the player
+ virtual void OnFfaPvpStateUpdate(Creature* /*player*/, bool /*result*/) { }
+};
+
+template
+class GenericCreatureScript : public CreatureScript
+{
+public:
+ GenericCreatureScript(char const* name) : CreatureScript(name) { }
+ CreatureAI* GetAI(Creature* me) const override { return new AI(me); }
+};
+
+#define RegisterCreatureAI(ai_name) new GenericCreatureScript(#ai_name)
+
+template
+class FactoryCreatureScript : public CreatureScript
+{
+public:
+ FactoryCreatureScript(char const* name) : CreatureScript(name) { }
+ CreatureAI* GetAI(Creature* me) const override { return AIFactory(me); }
+};
+
+#define RegisterCreatureAIWithFactory(ai_name, factory_fn) new FactoryCreatureScript(#ai_name)
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/DatabaseScript.cpp b/src/server/game/Scripting/ScriptDefines/DatabaseScript.cpp
index 2bc860e0b..fcb21f187 100644
--- a/src/server/game/Scripting/ScriptDefines/DatabaseScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/DatabaseScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "DatabaseScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -33,3 +34,10 @@ void ScriptMgr::OnAfterDatabaseLoadCreatureTemplates(std::vectorOnAfterDatabaseLoadCreatureTemplates(creatureTemplates);
});
}
+
+DatabaseScript::DatabaseScript(const char* name) : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/DatabaseScript.h b/src/server/game/Scripting/ScriptDefines/DatabaseScript.h
new file mode 100644
index 000000000..c975626d4
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/DatabaseScript.h
@@ -0,0 +1,50 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_DATABASE_SCRIPT_H_
+#define SCRIPT_OBJECT_DATABASE_SCRIPT_H_
+
+#include "ScriptObject.h"
+#include
+
+class DatabaseScript : public ScriptObject
+{
+protected:
+
+ DatabaseScript(const char* name);
+
+public:
+
+ [[nodiscard]] bool IsDatabaseBound() const override { return false; }
+
+ /**
+ * @brief Called after all databases are loaded
+ *
+ * @param updateFlags Update flags from the loader
+ */
+ virtual void OnAfterDatabasesLoaded(uint32 /*updateFlags*/) { }
+
+ /**
+ * @brief Called after all creature template data has been loaded from the database. This hook could be called multiple times, not just at server startup.
+ *
+ * @param creatureTemplates Pointer to a modifiable vector of creature templates. Indexed by Entry ID.
+ */
+ virtual void OnAfterDatabaseLoadCreatureTemplates(std::vector /*creatureTemplates*/) { }
+
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.cpp
index cf2f3ebf1..a3dc5ebfa 100644
--- a/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "DynamicObjectScript.h"
#include "ScriptMgr.h"
void ScriptMgr::OnDynamicObjectUpdate(DynamicObject* dynobj, uint32 diff)
@@ -26,3 +27,11 @@ void ScriptMgr::OnDynamicObjectUpdate(DynamicObject* dynobj, uint32 diff)
script->OnUpdate(dynobj, diff);
}
}
+
+DynamicObjectScript::DynamicObjectScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.h b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.h
new file mode 100644
index 000000000..b29f5a6bc
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/DynamicObjectScript.h
@@ -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 .
+ */
+
+#ifndef SCRIPT_OBJECT_DYNAMIC_OBJECT_SCRIPT_H_
+#define SCRIPT_OBJECT_DYNAMIC_OBJECT_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class DynamicObjectScript : public ScriptObject, public UpdatableScript
+{
+protected:
+ DynamicObjectScript(const char* name);
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/ElunaScript.cpp b/src/server/game/Scripting/ScriptDefines/ElunaScript.cpp
new file mode 100644
index 000000000..fbaa7af76
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/ElunaScript.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 "ElunaScript.h"
+#include "ScriptMgr.h"
+
+ElunaScript::ElunaScript(const char* name) : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/ElunaScript.h b/src/server/game/Scripting/ScriptDefines/ElunaScript.h
new file mode 100644
index 000000000..da028a7ba
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/ElunaScript.h
@@ -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 .
+ */
+
+#ifndef SCRIPT_OBJECT_ELUNA_SCRIPT_H_
+#define SCRIPT_OBJECT_ELUNA_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class ElunaScript : public ScriptObject
+{
+protected:
+ ElunaScript(const char* name);
+
+public:
+ /**
+ * @brief This hook called when the weather changes in the zone this script is associated with.
+ *
+ * @param weather Contains information about the Weather
+ * @param state Contains information about the WeatherState
+ * @param grade Contains information about the grade
+ */
+ virtual void OnWeatherChange(Weather* /*weather*/, WeatherState /*state*/, float /*grade*/) { }
+
+ // Called when the area trigger is activated by a player.
+ [[nodiscard]] virtual bool CanAreaTrigger(Player* /*player*/, AreaTrigger const* /*trigger*/) { return false; }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/FormulaScript.cpp b/src/server/game/Scripting/ScriptDefines/FormulaScript.cpp
index c4d029b0a..d9b276f78 100644
--- a/src/server/game/Scripting/ScriptDefines/FormulaScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/FormulaScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "FormulaScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -92,3 +93,11 @@ void ScriptMgr::OnBeforeUpdatingPersonalRating(int32& mod, uint32 type)
script->OnBeforeUpdatingPersonalRating(mod, type);
});
}
+
+FormulaScript::FormulaScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/FormulaScript.h b/src/server/game/Scripting/ScriptDefines/FormulaScript.h
new file mode 100644
index 000000000..7f664be16
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/FormulaScript.h
@@ -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 .
+ */
+
+#ifndef SCRIPT_OBJECT_FORMULA_SCRIPT_H_
+#define SCRIPT_OBJECT_FORMULA_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+enum XPColorChar : uint8;
+
+class FormulaScript : public ScriptObject
+{
+protected:
+ FormulaScript(const char* name);
+
+public:
+ // Called after calculating honor.
+ virtual void OnHonorCalculation(float& /*honor*/, uint8 /*level*/, float /*multiplier*/) { }
+
+ // Called after gray level calculation.
+ virtual void OnGrayLevelCalculation(uint8& /*grayLevel*/, uint8 /*playerLevel*/) { }
+
+ // Called after calculating experience color.
+ virtual void OnColorCodeCalculation(XPColorChar& /*color*/, uint8 /*playerLevel*/, uint8 /*mobLevel*/) { }
+
+ // Called after calculating zero difference.
+ virtual void OnZeroDifferenceCalculation(uint8& /*diff*/, uint8 /*playerLevel*/) { }
+
+ // Called after calculating base experience gain.
+ virtual void OnBaseGainCalculation(uint32& /*gain*/, uint8 /*playerLevel*/, uint8 /*mobLevel*/, ContentLevels /*content*/) { }
+
+ // Called after calculating experience gain.
+ virtual void OnGainCalculation(uint32& /*gain*/, Player* /*player*/, Unit* /*unit*/) { }
+
+ // Called when calculating the experience rate for group experience.
+ virtual void OnGroupRateCalculation(float& /*rate*/, uint32 /*count*/, bool /*isRaid*/) { }
+
+ // Called after calculating arena rating changes
+ virtual void OnAfterArenaRatingCalculation(Battleground* const /*bg*/, int32& /*winnerMatchmakerChange*/, int32& /*loserMatchmakerChange*/, int32& /*winnerChange*/, int32& /*loserChange*/) { };
+
+ // Called before modifying a player's personal rating
+ virtual void OnBeforeUpdatingPersonalRating(int32& /*mod*/, uint32 /*type*/) { }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/GameEventScript.cpp b/src/server/game/Scripting/ScriptDefines/GameEventScript.cpp
index 2382092ab..5714bf433 100644
--- a/src/server/game/Scripting/ScriptDefines/GameEventScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/GameEventScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "GameEventScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -41,3 +42,11 @@ void ScriptMgr::OnGameEventCheck(uint16 EventID)
script->OnEventCheck(EventID);
});
}
+
+GameEventScript::GameEventScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/GameEventScript.h b/src/server/game/Scripting/ScriptDefines/GameEventScript.h
new file mode 100644
index 000000000..9fe40a3f3
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/GameEventScript.h
@@ -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 .
+ */
+
+#ifndef SCRIPT_OBJECT_GAME_EVENT_SCRIPT_H_
+#define SCRIPT_OBJECT_GAME_EVENT_SCRIPT_H_
+
+#include "ScriptObject.h"
+
+class GameEventScript : public ScriptObject
+{
+protected:
+ GameEventScript(const char* name);
+
+public:
+ // Runs on start event
+ virtual void OnStart(uint16 /*EventID*/) { }
+
+ // Runs on stop event
+ virtual void OnStop(uint16 /*EventID*/) { }
+
+ // Runs on event check
+ virtual void OnEventCheck(uint16 /*EventID*/) { }
+};
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/GameObjectScript.cpp b/src/server/game/Scripting/ScriptDefines/GameObjectScript.cpp
index 54dc08228..0deb121d0 100644
--- a/src/server/game/Scripting/ScriptDefines/GameObjectScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/GameObjectScript.cpp
@@ -15,6 +15,8 @@
* with this program. If not, see .
*/
+#include "GameObjectScript.h"
+#include "AllGameObjectScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
#include "ScriptedGossip.h"
@@ -36,7 +38,7 @@ bool ScriptMgr::OnGossipHello(Player* player, GameObject* go)
auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId());
ClearGossipMenuFor(player);
- return tempScript ? tempScript->OnGossipHello(player, go) : false;
+ return tempScript && tempScript->OnGossipHello(player, go);
}
bool ScriptMgr::OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action)
@@ -237,3 +239,11 @@ GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go)
auto tempScript = ScriptRegistry::GetScriptById(go->GetScriptId());
return tempScript ? tempScript->GetAI(go) : nullptr;
}
+
+GameObjectScript::GameObjectScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/GameObjectScript.h b/src/server/game/Scripting/ScriptDefines/GameObjectScript.h
new file mode 100644
index 000000000..4038eafac
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/GameObjectScript.h
@@ -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 .
+ */
+
+#ifndef SCRIPT_OBJECT_GAMEOBJECT_SCRIPT_H_
+#define SCRIPT_OBJECT_GAMEOBJECT_SCRIPT_H_
+
+#include "QuestDef.h"
+#include "ScriptObject.h"
+
+class GameObjectScript : public ScriptObject, public UpdatableScript
+{
+protected:
+ GameObjectScript(const char* name);
+
+public:
+ [[nodiscard]] bool IsDatabaseBound() const override { return true; }
+
+ // Called when a player opens a gossip dialog with the gameobject.
+ [[nodiscard]] virtual bool OnGossipHello(Player* /*player*/, GameObject* /*go*/) { return false; }
+
+ // Called when a player selects a gossip item in the gameobject's gossip menu.
+ [[nodiscard]] virtual bool OnGossipSelect(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
+
+ // Called when a player selects a gossip with a code in the gameobject's gossip menu.
+ [[nodiscard]] virtual bool OnGossipSelectCode(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { return false; }
+
+ // Called when a player accepts a quest from the gameobject.
+ [[nodiscard]] virtual bool OnQuestAccept(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/) { return false; }
+
+ // Called when a player selects a quest reward.
+ [[nodiscard]] virtual bool OnQuestReward(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
+
+ // Called when the dialog status between a player and the gameobject is requested.
+ virtual uint32 GetDialogStatus(Player* /*player*/, GameObject* /*go*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
+
+ // Called when the game object is destroyed (destructible buildings only).
+ virtual void OnDestroyed(GameObject* /*go*/, Player* /*player*/) { }
+
+ // Called when the game object is damaged (destructible buildings only).
+ virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { }
+
+ // Called when the health of a game object is modified (destructible buildings only).
+ virtual void OnModifyHealth(GameObject* /*go*/, Unit* /*attackerOrHealer*/, int32& /*change*/, SpellInfo const* /*spellInfo*/) { }
+
+ // Called when the game object loot state is changed.
+ virtual void OnLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { }
+
+ // Called when the game object state is changed.
+ virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { }
+
+ // Called when a GameObjectAI object is needed for the gameobject.
+ virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return nullptr; }
+};
+
+// Cannot be used due gob scripts not working like this
+template
+class GenericGameObjectScript : public GameObjectScript
+{
+public:
+ GenericGameObjectScript(char const* name) : GameObjectScript(name) { }
+ GameObjectAI* GetAI(GameObject* me) const override { return new AI(me); }
+};
+
+#define RegisterGameObjectAI(ai_name) new GenericGameObjectScript(#ai_name)
+
+// Cannot be used due gob scripts not working like this
+template class FactoryGameObjectScript : public GameObjectScript
+{
+public:
+ FactoryGameObjectScript(char const* name) : GameObjectScript(name) {}
+ GameObjectAI* GetAI(GameObject* me) const override { return AIFactory(me); }
+};
+
+#define RegisterGameObjectAIWithFactory(ai_name, factory_fn) new FactoryGameObjectScript(#ai_name)
+
+#endif
diff --git a/src/server/game/Scripting/ScriptDefines/GlobalScript.cpp b/src/server/game/Scripting/ScriptDefines/GlobalScript.cpp
index 4206c0618..7ad7b251e 100644
--- a/src/server/game/Scripting/ScriptDefines/GlobalScript.cpp
+++ b/src/server/game/Scripting/ScriptDefines/GlobalScript.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see .
*/
+#include "GlobalScript.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptMgr.h"
@@ -86,11 +87,11 @@ bool ScriptMgr::OnItemRoll(Player const* player, LootStoreItem const* lootStoreI
return true;
}
-bool ScriptMgr::OnBeforeLootEqualChanced(Player const* player, LootStoreItemList EqualChanced, Loot& loot, LootStore const& store)
+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);
+ return !script->OnBeforeLootEqualChanced(player, equalChanced, loot, store);
});
if (ret && *ret)
@@ -230,3 +231,11 @@ void ScriptMgr::OnBeforeSetBossState(uint32 id, EncounterState newState, Encount
script->OnBeforeSetBossState(id, newState, oldState, instance);
});
}
+
+GlobalScript::GlobalScript(const char* name)
+ : ScriptObject(name)
+{
+ ScriptRegistry::AddScript(this);
+}
+
+template class AC_GAME_API ScriptRegistry;
diff --git a/src/server/game/Scripting/ScriptDefines/GlobalScript.h b/src/server/game/Scripting/ScriptDefines/GlobalScript.h
new file mode 100644
index 000000000..7dd370a3a
--- /dev/null
+++ b/src/server/game/Scripting/ScriptDefines/GlobalScript.h
@@ -0,0 +1,77 @@
+/*
+ * 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 .
+ */
+
+#ifndef SCRIPT_OBJECT_GLOBAL_SCRIPT_H_
+#define SCRIPT_OBJECT_GLOBAL_SCRIPT_H_
+
+#include "DBCEnums.h"
+#include "ObjectGuid.h"
+#include "ScriptObject.h"
+#include