feat(Core/Scripting): move all script objects to separated files (#17860)

* feat(Core/Scripts): move all script objects to separated files

* Apply 5bfeabde81

* try gcc build

* again
This commit is contained in:
Winfidonarleyan 2023-12-03 03:13:20 +07:00 committed by GitHub
parent fe9bda1bc4
commit eb1ecc38a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
717 changed files with 5832 additions and 3579 deletions

View file

@ -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"

View file

@ -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"

View file

@ -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

View file

@ -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"

View file

@ -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,

View file

@ -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;

View file

@ -297,4 +297,9 @@ namespace lfg
}
}
void AddSC_LFGScripts()
{
new LFGPlayerScript();
new LFGGroupScript();
}
} // namespace lfg

View file

@ -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

View file

@ -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"

View file

@ -22,6 +22,7 @@
#include "Opcodes.h"
#include "Player.h"
#include "QuestDef.h"
#include "ScriptMgr.h"
#include "WorldPacket.h"
#include "WorldSession.h"

View file

@ -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,

View file

@ -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"

View file

@ -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:

View file

@ -17,6 +17,7 @@
#include "CreatureAI.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
#include "GameObjectAI.h"
#include "GameTime.h"
#include "GitRevision.h"

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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"

View file

@ -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"

View file

@ -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

View file

@ -17,6 +17,7 @@
#include "Vehicle.h"
#include "BattlefieldWG.h"
#include "CreatureAI.h"
#include "Log.h"
#include "MoveSplineInit.h"
#include "ObjectMgr.h"

View file

@ -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"

View file

@ -45,7 +45,7 @@ struct MapEntry;
#define MAX_RAID_SUBGROUPS MAXRAIDSIZE/MAXGROUPSIZE
#define TARGETICONCOUNT 8
enum RollVote
enum RollVote : uint8
{
PASS = 0,
NEED = 1,

View file

@ -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"

View file

@ -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"

View file

@ -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();

View file

@ -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,

View file

@ -42,7 +42,7 @@ enum MailMessageType
MAIL_CALENDAR = 5
};
enum MailCheckMask
enum MailCheckMask : uint8
{
MAIL_CHECK_MASK_NONE = 0x00,
MAIL_CHECK_MASK_READ = 0x01,

View file

@ -303,7 +303,7 @@ typedef std::map<uint32/*leaderDBGUID*/, CreatureGroup*> CreatureGroupHol
typedef std::unordered_map<uint32 /*zoneId*/, ZoneDynamicInfo> ZoneDynamicInfoMap;
typedef std::set<MotionTransport*> TransportsContainer;
enum EncounterCreditType
enum EncounterCreditType : uint8
{
ENCOUNTER_CREDIT_KILL_CREATURE = 0,
ENCOUNTER_CREDIT_CAST_SPELL = 1,

View file

@ -18,8 +18,13 @@
#ifndef ACORE_FORMULAS_H
#define ACORE_FORMULAS_H
#include "ScriptMgr.h"
#include "SharedDefines.h"
#include <cmath>
class Player;
class Unit;
enum ContentLevels : uint8;
namespace Acore::Honor
{

View file

@ -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 <iterator>

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<AccountScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AccountScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<AchievementCriteriaScript>::GetScriptById(scriptId);
return tempScript ? tempScript->OnCheck(source, target, criteria_id) : false;
}
AchievementCriteriaScript::AchievementCriteriaScript(char const* name) :
ScriptObject(name)
{
ScriptRegistry<AchievementCriteriaScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AchievementCriteriaScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<AchievementCriteriaEntry const*> const* achievementCriteriaList)
{
ExecuteScript<AchievementScript>([&](AchievementScript* script)
{
@ -78,3 +79,11 @@ bool ScriptMgr::CanCheckCriteria(AchievementMgr* mgr, AchievementCriteriaEntry c
return true;
}
AchievementScript::AchievementScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<AchievementScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AchievementScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_ACHIEVEMENT_SCRIPT_H_
#define SCRIPT_OBJECT_ACHIEVEMENT_SCRIPT_H_
#include "Duration.h"
#include "ScriptObject.h"
#include <list>
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<AchievementCriteriaEntry const*> const* /*achievementCriteriaList*/) { }
[[nodiscard]] virtual bool CanCheckCriteria(AchievementMgr* /*mgr*/, AchievementCriteriaEntry const* /*achievementCriteria*/) { return true; }
};
#endif

View file

@ -15,12 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AllBattlegroundScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
void ScriptMgr::OnBattlegroundStart(Battleground* bg)
{
ExecuteScript<BGScript>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
auto ret = IsValidBoolScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
auto ret = IsValidBoolScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
auto ret = IsValidBoolScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
auto ret = IsValidBoolScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
auto ret = IsValidBoolScript<AllBattlegroundScript>([&](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>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](AllBattlegroundScript* script)
{
script->OnBattlegroundEnd(bg, winnerTeam);
});
@ -144,7 +145,7 @@ void ScriptMgr::OnBattlegroundEnd(Battleground* bg, TeamId winnerTeam)
void ScriptMgr::OnBattlegroundDestroy(Battleground* bg)
{
ExecuteScript<BGScript>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](AllBattlegroundScript* script)
{
script->OnBattlegroundDestroy(bg);
});
@ -152,8 +153,16 @@ void ScriptMgr::OnBattlegroundDestroy(Battleground* bg)
void ScriptMgr::OnBattlegroundCreate(Battleground* bg)
{
ExecuteScript<BGScript>([&](BGScript* script)
ExecuteScript<AllBattlegroundScript>([&](AllBattlegroundScript* script)
{
script->OnBattlegroundCreate(bg);
});
}
AllBattlegroundScript::AllBattlegroundScript(char const* name) :
ScriptObject(name)
{
ScriptRegistry<AllBattlegroundScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AllBattlegroundScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,12 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AllCommandScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
void ScriptMgr::OnHandleDevCommand(Player* player, bool& enable)
{
ExecuteScript<CommandSC>([&](CommandSC* script)
ExecuteScript<AllCommandScript>([&](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>([&](CommandSC* script)
auto ret = IsValidBoolScript<AllCommandScript>([&](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<AllCommandScript>::AddScript(this);
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<AllCreatureScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AllCreatureScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<AllGameObjectScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AllGameObjectScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<AllItemScript>::AddScript(this);
}
ItemScript::ItemScript(const char* name) :
ScriptObject(name)
{
ScriptRegistry<ItemScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AllItemScript>;
template class AC_GAME_API ScriptRegistry<ItemScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,122 +15,65 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AllMapScript.h"
#include "BattlegroundMapScript.h"
#include "InstanceMapScript.h"
#include "PlayerScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
#include "WorldMapScript.h"
namespace
{
template<class ScriptName>
inline void ForeachMaps([[maybe_unused]] Map* map, [[maybe_unused]] std::function<void(ScriptName*)> executeHook)
{
static_assert(Acore::dependant_false_v<ScriptName>, "Unsupported type used for ForeachMaps");
}
template<>
inline void ForeachMaps(Map* map, std::function<void(WorldMapScript*)> executeHook)
void ForeachMaps(Map* map, std::function<void(ScriptName*)> const& executeHook)
{
auto mapEntry = map->GetEntry();
if (!mapEntry)
{
return;
}
if (!mapEntry->IsWorldMap())
if constexpr (std::is_same_v<ScriptName, WorldMapScript>)
{
if (!mapEntry->IsWorldMap())
{
return;
}
}
else if constexpr (std::is_same_v<ScriptName, InstanceMapScript>)
{
if (!mapEntry->IsDungeon())
{
return;
}
}
else if constexpr (std::is_same_v<ScriptName, BattlegroundMapScript>)
{
if (!mapEntry->IsBattleground())
{
return;
}
}
else
{
static_assert(Acore::dependant_false_v<ScriptName>, "Unsupported type used for ForeachMaps");
}
if (ScriptRegistry<ScriptName>::ScriptPointerList.empty())
{
return;
}
if (ScriptRegistry<WorldMapScript>::ScriptPointerList.empty())
for (auto const& [scriptID, script] : ScriptRegistry<ScriptName>::ScriptPointerList)
{
return;
}
for (auto const& [scriptID, script] : ScriptRegistry<WorldMapScript>::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<void(InstanceMapScript*)> executeHook)
{
auto mapEntry = map->GetEntry();
if (!mapEntry)
{
return;
}
if (!mapEntry->IsDungeon())
{
return;
}
if (ScriptRegistry<InstanceMapScript>::ScriptPointerList.empty())
{
return;
}
for (auto const& [scriptID, script] : ScriptRegistry<InstanceMapScript>::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<void(BattlegroundMapScript*)> executeHook)
{
auto mapEntry = map->GetEntry();
if (!mapEntry)
{
return;
}
if (!mapEntry->IsBattleground())
{
return;
}
if (ScriptRegistry<BattlegroundMapScript>::ScriptPointerList.empty())
{
return;
}
for (auto const& [scriptID, script] : ScriptRegistry<BattlegroundMapScript>::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<WorldMapScript>(map,
[&](WorldMapScript* script)
{
script->OnCreate(map);
});
[&](WorldMapScript* script)
{
script->OnCreate(map);
});
ForeachMaps<InstanceMapScript>(map,
[&](InstanceMapScript* script)
{
script->OnCreate((InstanceMap*)map);
});
[&](InstanceMapScript* script)
{
script->OnCreate((InstanceMap*)map);
});
ForeachMaps<BattlegroundMapScript>(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<WorldMapScript>(map,
[&](WorldMapScript* script)
{
script->OnDestroy(map);
});
[&](WorldMapScript* script)
{
script->OnDestroy(map);
});
ForeachMaps<InstanceMapScript>(map,
[&](InstanceMapScript* script)
{
script->OnDestroy((InstanceMap*)map);
});
[&](InstanceMapScript* script)
{
script->OnDestroy((InstanceMap*)map);
});
ForeachMaps<BattlegroundMapScript>(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<WorldMapScript>(map,
[&](WorldMapScript* script)
{
script->OnLoadGridMap(map, gmap, gx, gy);
});
[&](WorldMapScript* script)
{
script->OnLoadGridMap(map, gmap, gx, gy);
});
ForeachMaps<InstanceMapScript>(map,
[&](InstanceMapScript* script)
{
script->OnLoadGridMap((InstanceMap*)map, gmap, gx, gy);
});
[&](InstanceMapScript* script)
{
script->OnLoadGridMap((InstanceMap*)map, gmap, gx, gy);
});
ForeachMaps<BattlegroundMapScript>(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<WorldMapScript>(map,
[&](WorldMapScript* script)
{
script->OnUnloadGridMap(map, gmap, gx, gy);
});
[&](WorldMapScript* script)
{
script->OnUnloadGridMap(map, gmap, gx, gy);
});
ForeachMaps<InstanceMapScript>(map,
[&](InstanceMapScript* script)
{
script->OnUnloadGridMap((InstanceMap*)map, gmap, gx, gy);
});
[&](InstanceMapScript* script)
{
script->OnUnloadGridMap((InstanceMap*)map, gmap, gx, gy);
});
ForeachMaps<BattlegroundMapScript>(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>([&](PlayerScript* script)
ExecuteScript<PlayerScript>([=](PlayerScript* script)
{
script->OnMapChanged(player);
});
ForeachMaps<WorldMapScript>(map,
[&](WorldMapScript* script)
{
script->OnPlayerEnter(map, player);
});
[&](WorldMapScript* script)
{
script->OnPlayerEnter(map, player);
});
ForeachMaps<InstanceMapScript>(map,
[&](InstanceMapScript* script)
{
script->OnPlayerEnter((InstanceMap*)map, player);
});
[&](InstanceMapScript* script)
{
script->OnPlayerEnter((InstanceMap*)map, player);
});
ForeachMaps<BattlegroundMapScript>(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<WorldMapScript>(map,
[&](WorldMapScript* script)
{
script->OnPlayerLeave(map, player);
});
[&](WorldMapScript* script)
{
script->OnPlayerLeave(map, player);
});
ForeachMaps<InstanceMapScript>(map,
[&](InstanceMapScript* script)
{
script->OnPlayerLeave((InstanceMap*)map, player);
});
[&](InstanceMapScript* script)
{
script->OnPlayerLeave((InstanceMap*)map, player);
});
ForeachMaps<BattlegroundMapScript>(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<WorldMapScript>(map,
[&](WorldMapScript* script)
{
script->OnUpdate(map, diff);
});
[&](WorldMapScript* script)
{
script->OnUpdate(map, diff);
});
ForeachMaps<InstanceMapScript>(map,
[&](InstanceMapScript* script)
{
script->OnUpdate((InstanceMap*)map, diff);
});
[&](InstanceMapScript* script)
{
script->OnUpdate((InstanceMap*)map, diff);
});
ForeachMaps<BattlegroundMapScript>(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<AllMapScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AllMapScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,12 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AllSpellScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
void ScriptMgr::OnCalcMaxDuration(Aura const* aura, int32& maxDuration)
{
ExecuteScript<SpellSC>([&](SpellSC* script)
ExecuteScript<AllSpellScript>([&](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>([&](SpellSC* script)
auto ret = IsValidBoolScript<AllSpellScript>([&](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>([&](SpellSC* script)
auto ret = IsValidBoolScript<AllSpellScript>([&](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>([&](SpellSC* script)
ExecuteScript<AllSpellScript>([&](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>([&](SpellSC* script)
auto ret = IsValidBoolScript<AllSpellScript>([&](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>([&](SpellSC* script)
auto ret = IsValidBoolScript<AllSpellScript>([&](AllSpellScript* script)
{
return script->CanScalingEverything(spell);
});
@ -96,7 +97,7 @@ bool ScriptMgr::CanScalingEverything(Spell* spell)
bool ScriptMgr::CanSelectSpecTalent(Spell* spell)
{
auto ret = IsValidBoolScript<SpellSC>([&](SpellSC* script)
auto ret = IsValidBoolScript<AllSpellScript>([&](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>([&](SpellSC* script)
ExecuteScript<AllSpellScript>([&](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>([&](SpellSC* script)
ExecuteScript<AllSpellScript>([&](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>([&](SpellSC* script)
ExecuteScript<AllSpellScript>([&](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>([&](SpellSC* script)
ExecuteScript<AllSpellScript>([&](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>([&](SpellSC* script)
ExecuteScript<AllSpellScript>([&](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>([&](SpellSC* script)
ExecuteScript<AllSpellScript>([&](AllSpellScript* script)
{
script->OnDummyEffect(caster, spellID, effIndex, itemTarget);
});
}
AllSpellScript::AllSpellScript(char const* name)
: ScriptObject(name)
{
ScriptRegistry<AllSpellScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AllSpellScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<AreaTriggerScript>::GetScriptById(sObjectMgr->GetAreaTriggerScriptId(trigger->entry));
return tempScript ? tempScript->OnTrigger(player, trigger) : false;
}
AreaTriggerScript::AreaTriggerScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<AreaTriggerScript>::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<AreaTriggerScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<ArenaScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<ArenaScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<ArenaTeamScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<ArenaTeamScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<AuctionHouseScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<AuctionHouseScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "BattlegroundMapScript.h"
#include "Log.h"
#include "ScriptMgr.h"
BattlegroundMapScript::BattlegroundMapScript(const char* name, uint32 mapId) :
ScriptObject(name), MapScript<BattlegroundMap>(mapId)
{
ScriptRegistry<BattlegroundMapScript>::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<BattlegroundMapScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_BATTLEGROUND_MAP_SCRIPT_H_
#define SCRIPT_OBJECT_BATTLEGROUND_MAP_SCRIPT_H_
#include "ScriptObject.h"
class BattlegroundMapScript : public ScriptObject, public MapScript<BattlegroundMap>
{
protected:
BattlegroundMapScript(const char* name, uint32 mapId);
public:
[[nodiscard]] bool isAfterLoadScript() const override { return true; }
void checkValidity() override;
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<BattlegroundScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<BattlegroundScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<CommandScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<CommandScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_COMMAND_SCRIPT_H_
#define SCRIPT_OBJECT_COMMAND_SCRIPT_H_
#include "ScriptObject.h"
#include <vector>
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<Acore::ChatCommands::ChatCommandBuilder> GetCommands() const = 0;
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<ConditionScript>::GetScriptById(condition->ScriptId);
return tempScript ? tempScript->OnConditionCheck(condition, sourceInfo) : true;
}
ConditionScript::ConditionScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<ConditionScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<ConditionScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<CreatureScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<CreatureScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_CREATURE_SCRIPT_H_
#define SCRIPT_OBJECT_CREATURE_SCRIPT_H_
#include "QuestDef.h"
#include "ScriptObject.h"
class CreatureScript : public ScriptObject, public UpdatableScript<Creature>
{
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 AI>
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>(#ai_name)
template <class AI, AI*(*AIFactory)(Creature*)>
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, &factory_fn>(#ai_name)
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "DatabaseScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@ -33,3 +34,10 @@ void ScriptMgr::OnAfterDatabaseLoadCreatureTemplates(std::vector<CreatureTemplat
script->OnAfterDatabaseLoadCreatureTemplates(creatureTemplates);
});
}
DatabaseScript::DatabaseScript(const char* name) : ScriptObject(name)
{
ScriptRegistry<DatabaseScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<DatabaseScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_DATABASE_SCRIPT_H_
#define SCRIPT_OBJECT_DATABASE_SCRIPT_H_
#include "ScriptObject.h"
#include <vector>
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<CreatureTemplate*> /*creatureTemplates*/) { }
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<DynamicObjectScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<DynamicObjectScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_DYNAMIC_OBJECT_SCRIPT_H_
#define SCRIPT_OBJECT_DYNAMIC_OBJECT_SCRIPT_H_
#include "ScriptObject.h"
class DynamicObjectScript : public ScriptObject, public UpdatableScript<DynamicObject>
{
protected:
DynamicObjectScript(const char* name);
};
#endif

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "ElunaScript.h"
#include "ScriptMgr.h"
ElunaScript::ElunaScript(const char* name) : ScriptObject(name)
{
ScriptRegistry<ElunaScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<ElunaScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<FormulaScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<FormulaScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<GameEventScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<GameEventScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View file

@ -15,6 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<GameObjectScript>::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<GameObjectScript>::GetScriptById(go->GetScriptId());
return tempScript ? tempScript->GetAI(go) : nullptr;
}
GameObjectScript::GameObjectScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<GameObjectScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<GameObjectScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_GAMEOBJECT_SCRIPT_H_
#define SCRIPT_OBJECT_GAMEOBJECT_SCRIPT_H_
#include "QuestDef.h"
#include "ScriptObject.h"
class GameObjectScript : public ScriptObject, public UpdatableScript<GameObject>
{
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 AI>
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>(#ai_name)
// Cannot be used due gob scripts not working like this
template <class AI, AI* (*AIFactory)(GameObject*)> 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, &factory_fn>(#ai_name)
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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>([&](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<GlobalScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<GlobalScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_GLOBAL_SCRIPT_H_
#define SCRIPT_OBJECT_GLOBAL_SCRIPT_H_
#include "DBCEnums.h"
#include "ObjectGuid.h"
#include "ScriptObject.h"
#include <map>
// following hooks can be used anywhere and are not db bounded
class GlobalScript : public ScriptObject
{
protected:
GlobalScript(const char* name);
public:
// items
virtual void OnItemDelFromDB(CharacterDatabaseTransaction /*trans*/, ObjectGuid::LowType /*itemGuid*/) { }
virtual void OnMirrorImageDisplayItem(Item const* /*item*/, uint32& /*display*/) { }
// loot
virtual void OnAfterRefCount(Player const* /*player*/, LootStoreItem* /*LootStoreItem*/, Loot& /*loot*/, bool /*canRate*/, uint16 /*lootMode*/, uint32& /*maxcount*/, LootStore const& /*store*/) { }
virtual void OnAfterCalculateLootGroupAmount(Player const* /*player*/, Loot& /*loot*/, uint16 /*lootMode*/, uint32& /*groupAmount*/, LootStore const& /*store*/) { }
virtual void OnBeforeDropAddItem(Player const* /*player*/, Loot& /*loot*/, bool /*canRate*/, uint16 /*lootMode*/, LootStoreItem* /*LootStoreItem*/, LootStore const& /*store*/) { }
virtual bool OnItemRoll(Player const* /*player*/, LootStoreItem const* /*LootStoreItem*/, float& /*chance*/, Loot& /*loot*/, LootStore const& /*store*/) { return true; };
virtual bool OnBeforeLootEqualChanced(Player const* /*player*/, std::list<LootStoreItem*> /*EqualChanced*/, Loot& /*loot*/, LootStore const& /*store*/) { return true; }
virtual void OnInitializeLockedDungeons(Player* /*player*/, uint8& /*level*/, uint32& /*lockData*/, lfg::LFGDungeonData const* /*dungeon*/) { }
virtual void OnAfterInitializeLockedDungeons(Player* /*player*/) { }
// On Before arena points distribution
virtual void OnBeforeUpdateArenaPoints(ArenaTeam* /*at*/, std::map<ObjectGuid, uint32>& /*ap*/) { }
// Called when a dungeon encounter is updated.
virtual void OnAfterUpdateEncounterState(Map* /*map*/, EncounterCreditType /*type*/, uint32 /*creditEntry*/, Unit* /*source*/, Difficulty /*difficulty_fixed*/, std::list<DungeonEncounter const*> const* /*encounters*/, uint32 /*dungeonCompleted*/, bool /*updated*/) { }
// Called before the phase for a WorldObject is set
virtual void OnBeforeWorldObjectSetPhaseMask(WorldObject const* /*worldObject*/, uint32& /*oldPhaseMask*/, uint32& /*newPhaseMask*/, bool& /*useCombinedPhases*/, bool& /*update*/) { }
// Called when checking if an aura spell is affected by a mod
virtual bool OnIsAffectedBySpellModCheck(SpellInfo const* /*affectSpell*/, SpellInfo const* /*checkSpell*/, SpellModifier const* /*mod*/) { return true; };
// Called when checking for spell negative healing modifiers
virtual bool OnSpellHealingBonusTakenNegativeModifiers(Unit const* /*target*/, Unit const* /*caster*/, SpellInfo const* /*spellInfo*/, float& /*val*/) { return false; };
// Called after loading spell dbc corrections
virtual void OnLoadSpellCustomAttr(SpellInfo* /*spell*/) { }
// Called when checking if a player can see the creature loot item
virtual bool OnAllowedForPlayerLootCheck(Player const* /*player*/, ObjectGuid /*source*/) { return false; };
// Called when checking if a player can see the creature loot (if it can click the corpse f.e)
virtual bool OnAllowedToLootContainerCheck(Player const* /*player*/, ObjectGuid /*source*/) { return false; };
// Called when instance id is removed from database (e.g. instance reset)
virtual void OnInstanceIdRemoved(uint32 /*instanceId*/) { }
// Called when any raid boss has their state updated (e.g. pull, reset, kill)
virtual void OnBeforeSetBossState(uint32 /*id*/, EncounterState /*newState*/, EncounterState /*oldState*/, Map* /*instance*/) { }
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GroupScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@ -90,3 +91,11 @@ void ScriptMgr::OnCreate(Group* group, Player* leader)
script->OnCreate(group, leader);
});
}
GroupScript::GroupScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<GroupScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<GroupScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_GROUP_SCRIPT_H_
#define SCRIPT_OBJECT_GROUP_SCRIPT_H_
#include "ObjectGuid.h"
#include "ScriptObject.h"
enum RemoveMethod : uint8;
class GroupScript : public ScriptObject
{
protected:
GroupScript(const char* name);
public:
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
// Called when a member is added to a group.
virtual void OnAddMember(Group* /*group*/, ObjectGuid /*guid*/) { }
// Called when a member is invited to join a group.
virtual void OnInviteMember(Group* /*group*/, ObjectGuid /*guid*/) { }
// Called when a member is removed from a group.
virtual void OnRemoveMember(Group* /*group*/, ObjectGuid /*guid*/, RemoveMethod /*method*/, ObjectGuid /*kicker*/, const char* /*reason*/) { }
// Called when the leader of a group is changed.
virtual void OnChangeLeader(Group* /*group*/, ObjectGuid /*newLeaderGuid*/, ObjectGuid /*oldLeaderGuid*/) { }
// Called when a group is disbanded.
virtual void OnDisband(Group* /*group*/) { }
[[nodiscard]] virtual bool CanGroupJoinBattlegroundQueue(Group const* /*group*/, Player* /*member*/, Battleground const* /*bgTemplate*/, uint32 /*MinPlayerCount*/, bool /*isRated*/, uint32 /*arenaSlot*/) { return true; }
virtual void OnCreate(Group* /*group*/, Player* /*leader*/) { }
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GuildScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@ -121,3 +122,11 @@ bool ScriptMgr::CanGuildSendBankList(Guild const* guild, WorldSession* session,
return true;
}
GuildScript::GuildScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<GuildScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<GuildScript>;

View file

@ -0,0 +1,67 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_GUILD_SCRIPT_H_
#define SCRIPT_OBJECT_GUILD_SCRIPT_H_
#include "ObjectGuid.h"
#include "ScriptObject.h"
class GuildScript : public ScriptObject
{
protected:
GuildScript(const char* name);
public:
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
// Called when a member is added to the guild.
virtual void OnAddMember(Guild* /*guild*/, Player* /*player*/, uint8& /*plRank*/) { }
// Called when a member is removed from the guild.
virtual void OnRemoveMember(Guild* /*guild*/, Player* /*player*/, bool /*isDisbanding*/, bool /*isKicked*/) { }
// Called when the guild MOTD (message of the day) changes.
virtual void OnMOTDChanged(Guild* /*guild*/, const std::string& /*newMotd*/) { }
// Called when the guild info is altered.
virtual void OnInfoChanged(Guild* /*guild*/, const std::string& /*newInfo*/) { }
// Called when a guild is created.
virtual void OnCreate(Guild* /*guild*/, Player* /*leader*/, const std::string& /*name*/) { }
// Called when a guild is disbanded.
virtual void OnDisband(Guild* /*guild*/) { }
// Called when a guild member withdraws money from a guild bank.
virtual void OnMemberWitdrawMoney(Guild* /*guild*/, Player* /*player*/, uint32& /*amount*/, bool /*isRepair*/) { }
// Called when a guild member deposits money in a guild bank.
virtual void OnMemberDepositMoney(Guild* /*guild*/, Player* /*player*/, uint32& /*amount*/) { }
// Called when a guild member moves an item in a guild bank.
virtual void OnItemMove(Guild* /*guild*/, Player* /*player*/, Item* /*pItem*/, bool /*isSrcBank*/, uint8 /*srcContainer*/, uint8 /*srcSlotId*/,
bool /*isDestBank*/, uint8 /*destContainer*/, uint8 /*destSlotId*/) { }
virtual void OnEvent(Guild* /*guild*/, uint8 /*eventType*/, ObjectGuid::LowType /*playerGuid1*/, ObjectGuid::LowType /*playerGuid2*/, uint8 /*newRank*/) { }
virtual void OnBankEvent(Guild* /*guild*/, uint8 /*eventType*/, uint8 /*tabId*/, ObjectGuid::LowType /*playerGuid*/, uint32 /*itemOrMoney*/, uint16 /*itemStackCount*/, uint8 /*destTabId*/) { }
[[nodiscard]] virtual bool CanGuildSendBankList(Guild const* /*guild*/, WorldSession* /*session*/, uint8 /*tabId*/, bool /*sendAllSlots*/) { return true; }
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "InstanceMapScript.h"
#include "ScriptMgr.h"
InstanceScript* ScriptMgr::CreateInstanceScript(InstanceMap* map)
@ -24,3 +25,21 @@ InstanceScript* ScriptMgr::CreateInstanceScript(InstanceMap* map)
auto tempScript = ScriptRegistry<InstanceMapScript>::GetScriptById(map->GetScriptId());
return tempScript ? tempScript->GetInstanceScript(map) : nullptr;
}
InstanceMapScript::InstanceMapScript(const char* name, uint32 mapId) :
ScriptObject(name), MapScript<InstanceMap>(mapId)
{
ScriptRegistry<InstanceMapScript>::AddScript(this);
}
void InstanceMapScript::checkValidity()
{
checkMap();
if (GetEntry() && !GetEntry()->IsDungeon())
{
LOG_ERROR("maps.script", "InstanceMapScript for map {} is invalid.", GetEntry()->MapID);
}
}
template class AC_GAME_API ScriptRegistry<InstanceMapScript>;

View file

@ -0,0 +1,37 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_INSTANCE_MAP_SCRIPT_H_
#define SCRIPT_OBJECT_INSTANCE_MAP_SCRIPT_H_
#include "ScriptObject.h"
class InstanceMapScript : public ScriptObject, public MapScript<InstanceMap>
{
protected:
InstanceMapScript(const char* name, uint32 mapId);
public:
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
void checkValidity() override;
// Gets an InstanceScript object for this instance.
virtual InstanceScript* GetInstanceScript(InstanceMap* /*map*/) const { return nullptr; }
};
#endif

View file

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_ITEM_SCRIPT_H_
#define SCRIPT_OBJECT_ITEM_SCRIPT_H_
#include "ScriptObject.h"
class ItemScript : public ScriptObject
{
protected:
ItemScript(const char* name);
public:
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Called when a player accepts a quest from the item.
[[nodiscard]] virtual bool OnQuestAccept(Player* /*player*/, Item* /*item*/, Quest const* /*quest*/) { return false; }
// Called when a player uses the item.
[[nodiscard]] virtual bool OnUse(Player* /*player*/, Item* /*item*/, SpellCastTargets const& /*targets*/) { return false; }
// Called when the item is destroyed.
[[nodiscard]] virtual bool OnRemove(Player* /*player*/, Item* /*item*/) { return false; }
// Called before casting a combat spell from this item (chance on hit spells of item template, can be used to prevent cast if returning false)
[[nodiscard]] virtual bool OnCastItemCombatSpell(Player* /*player*/, Unit* /*victim*/, SpellInfo const* /*spellInfo*/, Item* /*item*/) { return true; }
// Called when the item expires (is destroyed).
[[nodiscard]] virtual bool OnExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return false; }
// Called when a player selects an option in an item gossip window
virtual void OnGossipSelect(Player* /*player*/, Item* /*item*/, uint32 /*sender*/, uint32 /*action*/) { }
// Called when a player selects an option in an item gossip window
virtual void OnGossipSelectCode(Player* /*player*/, Item* /*item*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { }
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "LootScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@ -27,3 +28,8 @@ void ScriptMgr::OnLootMoney(Player* player, uint32 gold)
script->OnLootMoney(player, gold);
});
}
LootScript::LootScript(const char* name) : ScriptObject(name)
{
ScriptRegistry<LootScript>::AddScript(this);
}

View file

@ -0,0 +1,40 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_LOOT_SCRIPT_H_
#define SCRIPT_OBJECT_LOOT_SCRIPT_H_
#include "ScriptObject.h"
class LootScript : public ScriptObject
{
protected:
LootScript(const char* name);
public:
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
/**
* @brief This hook called before money loot
*
* @param player Contains information about the Player
* @param gold Contains information about money
*/
virtual void OnLootMoney(Player* /*player*/, uint32 /*gold*/) { }
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MailScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@ -25,3 +26,11 @@ void ScriptMgr::OnBeforeMailDraftSendMailTo(MailDraft* mailDraft, MailReceiver c
script->OnBeforeMailDraftSendMailTo(mailDraft, receiver, sender, checked, deliver_delay, custom_expiration, deleteMailItemsFromDB, sendMail);\
});
}
MailScript::MailScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<MailScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<MailScript>;

View file

@ -0,0 +1,33 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_MAIL_SCRIPT_H_
#define SCRIPT_OBJECT_MAIL_SCRIPT_H_
#include "ScriptObject.h"
class MailScript : public ScriptObject
{
protected:
MailScript(const char* name);
public:
// Called before mail is sent
virtual void OnBeforeMailDraftSendMailTo(MailDraft* /*mailDraft*/, MailReceiver const& /*receiver*/, MailSender const& /*sender*/, MailCheckMask& /*checked*/, uint32& /*deliver_delay*/, uint32& /*custom_expiration*/, bool& /*deleteMailItemsFromDB*/, bool& /*sendMail*/) { }
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MiscScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@ -182,3 +183,11 @@ void ScriptMgr::GetDialogStatus(Player* player, Object* questgiver)
script->GetDialogStatus(player, questgiver);
});
}
MiscScript::MiscScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<MiscScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<MiscScript>;

View file

@ -0,0 +1,75 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_MISC_SCRIPT_H_
#define SCRIPT_OBJECT_MISC_SCRIPT_H_
#include "ObjectGuid.h"
#include "ScriptObject.h"
class MiscScript : public ScriptObject
{
protected:
MiscScript(const char* name);
public:
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
virtual void OnConstructObject(Object* /*origin*/) { }
virtual void OnDestructObject(Object* /*origin*/) { }
virtual void OnConstructPlayer(Player* /*origin*/) { }
virtual void OnDestructPlayer(Player* /*origin*/) { }
virtual void OnConstructGroup(Group* /*origin*/) { }
virtual void OnDestructGroup(Group* /*origin*/) { }
virtual void OnConstructInstanceSave(InstanceSave* /*origin*/) { }
virtual void OnDestructInstanceSave(InstanceSave* /*origin*/) { }
virtual void OnItemCreate(Item* /*item*/, ItemTemplate const* /*itemProto*/, Player const* /*owner*/) { }
[[nodiscard]] virtual bool CanApplySoulboundFlag(Item* /*item*/, ItemTemplate const* /*proto*/) { return true; }
[[nodiscard]] virtual bool CanItemApplyEquipSpell(Player* /*player*/, Item* /*item*/) { return true; }
[[nodiscard]] virtual bool CanSendAuctionHello(WorldSession const* /*session*/, ObjectGuid /*guid*/, Creature* /*creature*/) { return true; }
virtual void ValidateSpellAtCastSpell(Player* /*player*/, uint32& /*oldSpellId*/, uint32& /*spellId*/, uint8& /*castCount*/, uint8& /*castFlags*/) { }
virtual void ValidateSpellAtCastSpellResult(Player* /*player*/, Unit* /*mover*/, Spell* /*spell*/, uint32 /*oldSpellId*/, uint32 /*spellId*/) { }
virtual void OnAfterLootTemplateProcess(Loot* /*loot*/, LootTemplate const* /*tab*/, LootStore const& /*store*/, Player* /*lootOwner*/, bool /*personal*/, bool /*noEmptyError*/, uint16 /*lootMode*/) { }
virtual void OnPlayerSetPhase(const AuraEffect* /*auraEff*/, AuraApplication const* /*aurApp*/, uint8 /*mode*/, bool /*apply*/, uint32& /*newPhase*/) { }
virtual void OnInstanceSave(InstanceSave* /*instanceSave*/) { }
/**
* @brief This hook called before get Quest Dialog Status
*
* @param player Contains information about the Player
* @param questgiver Contains information about the Object
*/
virtual void GetDialogStatus(Player* /*player*/, Object* /*questgiver*/) { }
};
#endif

View file

@ -0,0 +1,27 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ModuleScript.h"
#include "ScriptMgr.h"
ModuleScript::ModuleScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<ModuleScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<ModuleScript>;

View file

@ -0,0 +1,31 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_MODULE_SCRIPT_H_
#define SCRIPT_OBJECT_MODULE_SCRIPT_H_
#include "ScriptObject.h"
// this class can be used to be extended by Modules
// creating their own custom hooks inside the module itself
class ModuleScript : public ScriptObject
{
protected:
ModuleScript(const char* name);
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MovementHandlerScript.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@ -25,3 +26,11 @@ void ScriptMgr::OnPlayerMove(Player* player, MovementInfo movementInfo, uint32 o
script->OnPlayerMove(player, movementInfo, opcode);
});
}
MovementHandlerScript::MovementHandlerScript(const char* name) :
ScriptObject(name)
{
ScriptRegistry<MovementHandlerScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<MovementHandlerScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_MOVEMENT_SCRIPT_H_
#define SCRIPT_OBJECT_MOVEMENT_SCRIPT_H_
#include "Object.h"
#include "ScriptObject.h"
class MovementHandlerScript : public ScriptObject
{
protected:
MovementHandlerScript(const char* name);
public:
//Called whenever a player moves
virtual void OnPlayerMove(Player* /*player*/, MovementInfo /*movementInfo*/, uint32 /*opcode*/) { }
};
#endif

View file

@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "OutdoorPvPScript.h"
#include "OutdoorPvPMgr.h"
#include "ScriptMgr.h"
@ -25,3 +26,11 @@ OutdoorPvP* ScriptMgr::CreateOutdoorPvP(OutdoorPvPData const* data)
auto tempScript = ScriptRegistry<OutdoorPvPScript>::GetScriptById(data->ScriptId);
return tempScript ? tempScript->GetOutdoorPvP() : nullptr;
}
OutdoorPvPScript::OutdoorPvPScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<OutdoorPvPScript>::AddScript(this);
}
template class AC_GAME_API ScriptRegistry<OutdoorPvPScript>;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef SCRIPT_OBJECT_OUTDOOR_PVP_SCRIPT_H_
#define SCRIPT_OBJECT_OUTDOOR_PVP_SCRIPT_H_
#include "ScriptObject.h"
class OutdoorPvPScript : public ScriptObject
{
protected:
OutdoorPvPScript(const char* name);
public:
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Should return a fully valid OutdoorPvP object for the type ID.
[[nodiscard]] virtual OutdoorPvP* GetOutdoorPvP() const = 0;
};
#endif

Some files were not shown because too many files have changed in this diff Show more