mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 10:00:28 +00:00
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:
@@ -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>;
|
||||
|
||||
54
src/server/game/Scripting/ScriptDefines/AccountScript.h
Normal file
54
src/server/game/Scripting/ScriptDefines/AccountScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
@@ -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
|
||||
@@ -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>;
|
||||
|
||||
45
src/server/game/Scripting/ScriptDefines/AchievementScript.h
Normal file
45
src/server/game/Scripting/ScriptDefines/AchievementScript.h
Normal 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
|
||||
@@ -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>;
|
||||
115
src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.h
Normal file
115
src/server/game/Scripting/ScriptDefines/AllBattlegroundScript.h
Normal 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
|
||||
@@ -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);
|
||||
}
|
||||
45
src/server/game/Scripting/ScriptDefines/AllCommandScript.h
Normal file
45
src/server/game/Scripting/ScriptDefines/AllCommandScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
107
src/server/game/Scripting/ScriptDefines/AllCreatureScript.h
Normal file
107
src/server/game/Scripting/ScriptDefines/AllCreatureScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
@@ -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
|
||||
@@ -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>;
|
||||
48
src/server/game/Scripting/ScriptDefines/AllItemScript.h
Normal file
48
src/server/game/Scripting/ScriptDefines/AllItemScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
87
src/server/game/Scripting/ScriptDefines/AllMapScript.h
Normal file
87
src/server/game/Scripting/ScriptDefines/AllMapScript.h
Normal 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
|
||||
69
src/server/game/Scripting/ScriptDefines/AllScriptsObjects.h
Normal file
69
src/server/game/Scripting/ScriptDefines/AllScriptsObjects.h
Normal 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
|
||||
@@ -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>;
|
||||
89
src/server/game/Scripting/ScriptDefines/AllSpellScript.h
Normal file
89
src/server/game/Scripting/ScriptDefines/AllSpellScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
48
src/server/game/Scripting/ScriptDefines/AreaTriggerScript.h
Normal file
48
src/server/game/Scripting/ScriptDefines/AreaTriggerScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
41
src/server/game/Scripting/ScriptDefines/ArenaScript.h
Normal file
41
src/server/game/Scripting/ScriptDefines/ArenaScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
39
src/server/game/Scripting/ScriptDefines/ArenaTeamScript.h
Normal file
39
src/server/game/Scripting/ScriptDefines/ArenaTeamScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
63
src/server/game/Scripting/ScriptDefines/AuctionHouseScript.h
Normal file
63
src/server/game/Scripting/ScriptDefines/AuctionHouseScript.h
Normal 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
|
||||
@@ -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>;
|
||||
@@ -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
|
||||
@@ -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>;
|
||||
|
||||
35
src/server/game/Scripting/ScriptDefines/BattlegroundScript.h
Normal file
35
src/server/game/Scripting/ScriptDefines/BattlegroundScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
34
src/server/game/Scripting/ScriptDefines/CommandScript.h
Normal file
34
src/server/game/Scripting/ScriptDefines/CommandScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
35
src/server/game/Scripting/ScriptDefines/ConditionScript.h
Normal file
35
src/server/game/Scripting/ScriptDefines/ConditionScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
83
src/server/game/Scripting/ScriptDefines/CreatureScript.h
Normal file
83
src/server/game/Scripting/ScriptDefines/CreatureScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
50
src/server/game/Scripting/ScriptDefines/DatabaseScript.h
Normal file
50
src/server/game/Scripting/ScriptDefines/DatabaseScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
@@ -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
|
||||
26
src/server/game/Scripting/ScriptDefines/ElunaScript.cpp
Normal file
26
src/server/game/Scripting/ScriptDefines/ElunaScript.cpp
Normal 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>;
|
||||
42
src/server/game/Scripting/ScriptDefines/ElunaScript.h
Normal file
42
src/server/game/Scripting/ScriptDefines/ElunaScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
59
src/server/game/Scripting/ScriptDefines/FormulaScript.h
Normal file
59
src/server/game/Scripting/ScriptDefines/FormulaScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
39
src/server/game/Scripting/ScriptDefines/GameEventScript.h
Normal file
39
src/server/game/Scripting/ScriptDefines/GameEventScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
90
src/server/game/Scripting/ScriptDefines/GameObjectScript.h
Normal file
90
src/server/game/Scripting/ScriptDefines/GameObjectScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
77
src/server/game/Scripting/ScriptDefines/GlobalScript.h
Normal file
77
src/server/game/Scripting/ScriptDefines/GlobalScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
54
src/server/game/Scripting/ScriptDefines/GroupScript.h
Normal file
54
src/server/game/Scripting/ScriptDefines/GroupScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
67
src/server/game/Scripting/ScriptDefines/GuildScript.h
Normal file
67
src/server/game/Scripting/ScriptDefines/GuildScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
37
src/server/game/Scripting/ScriptDefines/InstanceMapScript.h
Normal file
37
src/server/game/Scripting/ScriptDefines/InstanceMapScript.h
Normal 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
|
||||
53
src/server/game/Scripting/ScriptDefines/ItemScript.h
Normal file
53
src/server/game/Scripting/ScriptDefines/ItemScript.h
Normal 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
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
40
src/server/game/Scripting/ScriptDefines/LootScript.h
Normal file
40
src/server/game/Scripting/ScriptDefines/LootScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
33
src/server/game/Scripting/ScriptDefines/MailScript.h
Normal file
33
src/server/game/Scripting/ScriptDefines/MailScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
75
src/server/game/Scripting/ScriptDefines/MiscScript.h
Normal file
75
src/server/game/Scripting/ScriptDefines/MiscScript.h
Normal 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
|
||||
27
src/server/game/Scripting/ScriptDefines/ModuleScript.cpp
Normal file
27
src/server/game/Scripting/ScriptDefines/ModuleScript.cpp
Normal 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>;
|
||||
31
src/server/game/Scripting/ScriptDefines/ModuleScript.h
Normal file
31
src/server/game/Scripting/ScriptDefines/ModuleScript.h
Normal 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
|
||||
@@ -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>;
|
||||
|
||||
@@ -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
|
||||
@@ -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>;
|
||||
|
||||
35
src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.h
Normal file
35
src/server/game/Scripting/ScriptDefines/OutdoorPvPScript.h
Normal 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
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PetScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptMgrMacros.h"
|
||||
|
||||
@@ -88,3 +89,11 @@ void ScriptMgr::OnPetAddToWorld(Pet* pet)
|
||||
script->OnPetAddToWorld(pet);
|
||||
});
|
||||
}
|
||||
|
||||
PetScript::PetScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<PetScript>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<PetScript>;
|
||||
|
||||
49
src/server/game/Scripting/ScriptDefines/PetScript.h
Normal file
49
src/server/game/Scripting/ScriptDefines/PetScript.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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_PET_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_PET_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
class PetScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
PetScript(const char* name);
|
||||
|
||||
public:
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
virtual void OnInitStatsForLevel(Guardian* /*guardian*/, uint8 /*petlevel*/) { }
|
||||
|
||||
virtual void OnCalculateMaxTalentPointsForLevel(Pet* /*pet*/, uint8 /*level*/, uint8& /*points*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanUnlearnSpellSet(Pet* /*pet*/, uint32 /*level*/, uint32 /*spell*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanUnlearnSpellDefault(Pet* /*pet*/, SpellInfo const* /*spellInfo*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanResetTalents(Pet* /*pet*/) { return true; }
|
||||
|
||||
/**
|
||||
* @brief This hook called after add pet in world
|
||||
*
|
||||
* @param pet Contains information about the Pet
|
||||
*/
|
||||
virtual void OnPetAddToWorld(Pet* /*pet*/) { }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PlayerScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptMgrMacros.h"
|
||||
|
||||
@@ -1696,3 +1697,11 @@ bool ScriptMgr::AnticheatCheckMovementInfo(Player* player, MovementInfo const& m
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerScript::PlayerScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<PlayerScript>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<PlayerScript>;
|
||||
|
||||
563
src/server/game/Scripting/ScriptDefines/PlayerScript.h
Normal file
563
src/server/game/Scripting/ScriptDefines/PlayerScript.h
Normal file
@@ -0,0 +1,563 @@
|
||||
/*
|
||||
* 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_PLAYER_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_PLAYER_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
// TODO to remove
|
||||
#include "AchievementMgr.h"
|
||||
|
||||
class PlayerScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
PlayerScript(const char* name);
|
||||
|
||||
public:
|
||||
virtual void OnPlayerReleasedGhost(Player* /*player*/) { }
|
||||
|
||||
// Called on Send Initial Packets Before Add To Map
|
||||
virtual void OnSendInitialPacketsBeforeAddToMap(Player* /*player*/, WorldPacket& /*data*/) {}
|
||||
|
||||
// Called when a player does a desertion action (see BattlegroundDesertionType)
|
||||
virtual void OnBattlegroundDesertion(Player* /*player*/, BattlegroundDesertionType const /*desertionType*/) { }
|
||||
|
||||
// Called when a player completes a quest
|
||||
virtual void OnPlayerCompleteQuest(Player* /*player*/, Quest const* /*quest_id*/) { }
|
||||
|
||||
// Called when a player kills another player
|
||||
virtual void OnPVPKill(Player* /*killer*/, Player* /*killed*/) { }
|
||||
|
||||
// Called when a player toggles pvp
|
||||
virtual void OnPlayerPVPFlagChange(Player* /*player*/, bool /*state*/) { }
|
||||
|
||||
// Called when a player kills a creature
|
||||
virtual void OnCreatureKill(Player* /*killer*/, Creature* /*killed*/) { }
|
||||
|
||||
// Called when a player's pet kills a creature
|
||||
virtual void OnCreatureKilledByPet(Player* /*PetOwner*/, Creature* /*killed*/) { }
|
||||
|
||||
// Called when a player is killed by a creature
|
||||
virtual void OnPlayerKilledByCreature(Creature* /*killer*/, Player* /*killed*/) { }
|
||||
|
||||
// Called when a player's level changes (right after the level is applied)
|
||||
virtual void OnLevelChanged(Player* /*player*/, uint8 /*oldlevel*/) { }
|
||||
|
||||
// Called when a player's free talent points change (right before the change is applied)
|
||||
virtual void OnFreeTalentPointsChanged(Player* /*player*/, uint32 /*points*/) { }
|
||||
|
||||
// Called when a player's talent points are reset (right before the reset is done)
|
||||
virtual void OnTalentsReset(Player* /*player*/, bool /*noCost*/) { }
|
||||
|
||||
// Called after a player switches specs using the dual spec system
|
||||
virtual void OnAfterSpecSlotChanged(Player* /*player*/, uint8 /*newSlot*/) { }
|
||||
|
||||
// Called for player::update
|
||||
virtual void OnBeforeUpdate(Player* /*player*/, uint32 /*p_time*/) { }
|
||||
virtual void OnUpdate(Player* /*player*/, uint32 /*p_time*/) { }
|
||||
|
||||
// Called when a player's money is modified (before the modification is done)
|
||||
virtual void OnMoneyChanged(Player* /*player*/, int32& /*amount*/) { }
|
||||
|
||||
// Called before looted money is added to a player
|
||||
virtual void OnBeforeLootMoney(Player* /*player*/, Loot* /*loot*/) {}
|
||||
|
||||
// Called when a player gains XP (before anything is given)
|
||||
virtual void OnGiveXP(Player* /*player*/, uint32& /*amount*/, Unit* /*victim*/, uint8 /*xpSource*/) { }
|
||||
|
||||
// Called when a player's reputation changes (before it is actually changed)
|
||||
virtual bool OnReputationChange(Player* /*player*/, uint32 /*factionID*/, int32& /*standing*/, bool /*incremental*/) { return true; }
|
||||
|
||||
// Called when a player's reputation rank changes (before it is actually changed)
|
||||
virtual void OnReputationRankChange(Player* /*player*/, uint32 /*factionID*/, ReputationRank /*newRank*/, ReputationRank /*olRank*/, bool /*increased*/) { }
|
||||
|
||||
// Called when a player learned new spell
|
||||
virtual void OnLearnSpell(Player* /*player*/, uint32 /*spellID*/) {}
|
||||
|
||||
// Called when a player forgot spell
|
||||
virtual void OnForgotSpell(Player* /*player*/, uint32 /*spellID*/) {}
|
||||
|
||||
// Called when a duel is requested
|
||||
virtual void OnDuelRequest(Player* /*target*/, Player* /*challenger*/) { }
|
||||
|
||||
// Called when a duel starts (after 3s countdown)
|
||||
virtual void OnDuelStart(Player* /*player1*/, Player* /*player2*/) { }
|
||||
|
||||
// Called when a duel ends
|
||||
virtual void OnDuelEnd(Player* /*winner*/, Player* /*loser*/, DuelCompleteType /*type*/) { }
|
||||
|
||||
// The following methods are called when a player sends a chat message.
|
||||
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/) { }
|
||||
|
||||
virtual void OnBeforeSendChatMessage(Player* /*player*/, uint32& /*type*/, uint32& /*lang*/, std::string& /*msg*/) { }
|
||||
|
||||
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Player* /*receiver*/) { }
|
||||
|
||||
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Group* /*group*/) { }
|
||||
|
||||
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Guild* /*guild*/) { }
|
||||
|
||||
virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Channel* /*channel*/) { }
|
||||
|
||||
// Both of the below are called on emote opcodes.
|
||||
virtual void OnEmote(Player* /*player*/, uint32 /*emote*/) { }
|
||||
|
||||
virtual void OnTextEmote(Player* /*player*/, uint32 /*textEmote*/, uint32 /*emoteNum*/, ObjectGuid /*guid*/) { }
|
||||
|
||||
// Called in Spell::Cast.
|
||||
virtual void OnSpellCast(Player* /*player*/, Spell* /*spell*/, bool /*skipCheck*/) { }
|
||||
|
||||
// Called during data loading
|
||||
virtual void OnLoadFromDB(Player* /*player*/) { };
|
||||
|
||||
// Called when a player logs in.
|
||||
virtual void OnLogin(Player* /*player*/) { }
|
||||
|
||||
// Called when a player logs out.
|
||||
virtual void OnLogout(Player* /*player*/) { }
|
||||
|
||||
// Called when a player is created.
|
||||
virtual void OnCreate(Player* /*player*/) { }
|
||||
|
||||
// Called when a player is deleted.
|
||||
virtual void OnDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { }
|
||||
|
||||
// Called when a player delete failed.
|
||||
virtual void OnFailedDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { }
|
||||
|
||||
// Called when a player is about to be saved.
|
||||
virtual void OnSave(Player* /*player*/) { }
|
||||
|
||||
// Called when a player is bound to an instance
|
||||
virtual void OnBindToInstance(Player* /*player*/, Difficulty /*difficulty*/, uint32 /*mapId*/, bool /*permanent*/) { }
|
||||
|
||||
// Called when a player switches to a new zone
|
||||
virtual void OnUpdateZone(Player* /*player*/, uint32 /*newZone*/, uint32 /*newArea*/) { }
|
||||
|
||||
// Called when a player switches to a new area (more accurate than UpdateZone)
|
||||
virtual void OnUpdateArea(Player* /*player*/, uint32 /*oldArea*/, uint32 /*newArea*/) { }
|
||||
|
||||
// Called when a player changes to a new map (after moving to new map)
|
||||
virtual void OnMapChanged(Player* /*player*/) { }
|
||||
|
||||
// Called before a player is being teleported to new coords
|
||||
[[nodiscard]] virtual bool OnBeforeTeleport(Player* /*player*/, uint32 /*mapid*/, float /*x*/, float /*y*/, float /*z*/, float /*orientation*/, uint32 /*options*/, Unit* /*target*/) { return true; }
|
||||
|
||||
// Called when team/faction is set on player
|
||||
virtual void OnUpdateFaction(Player* /*player*/) { }
|
||||
|
||||
// Called when a player is added to battleground
|
||||
virtual void OnAddToBattleground(Player* /*player*/, Battleground* /*bg*/) { }
|
||||
|
||||
// Called when a player queues a Random Dungeon using the RDF (Random Dungeon Finder)
|
||||
virtual void OnQueueRandomDungeon(Player* /*player*/, uint32 & /*rDungeonId*/) { }
|
||||
|
||||
// Called when a player is removed from battleground
|
||||
virtual void OnRemoveFromBattleground(Player* /*player*/, Battleground* /*bg*/) { }
|
||||
|
||||
// Called when a player complete an achievement
|
||||
virtual void OnAchiComplete(Player* /*player*/, AchievementEntry const* /*achievement*/) { }
|
||||
|
||||
// Called before player complete an achievement, can be used to disable achievements in certain conditions
|
||||
virtual bool OnBeforeAchiComplete(Player* /*player*/, AchievementEntry const* /*achievement*/) { return true; }
|
||||
|
||||
// Called when a player complete an achievement criteria
|
||||
virtual void OnCriteriaProgress(Player* /*player*/, AchievementCriteriaEntry const* /*criteria*/) { }
|
||||
|
||||
// Called before player complete an achievement criteria, can be used to disable achievement criteria in certain conditions
|
||||
virtual bool OnBeforeCriteriaProgress(Player* /*player*/, AchievementCriteriaEntry const* /*criteria*/) { return true; }
|
||||
|
||||
// Called when an Achievement is saved to DB
|
||||
virtual void OnAchiSave(CharacterDatabaseTransaction /*trans*/, Player* /*player*/, uint16 /*achId*/, CompletedAchievementData /*achiData*/) { }
|
||||
|
||||
// Called when an Criteria is saved to DB
|
||||
virtual void OnCriteriaSave(CharacterDatabaseTransaction /*trans*/, Player* /*player*/, uint16 /*achId*/, CriteriaProgress /*criteriaData*/) { }
|
||||
|
||||
// Called when a player selects an option in a player gossip window
|
||||
virtual void OnGossipSelect(Player* /*player*/, uint32 /*menu_id*/, uint32 /*sender*/, uint32 /*action*/) { }
|
||||
|
||||
// Called when a player selects an option in a player gossip window
|
||||
virtual void OnGossipSelectCode(Player* /*player*/, uint32 /*menu_id*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { }
|
||||
|
||||
// On player getting charmed
|
||||
virtual void OnBeingCharmed(Player* /*player*/, Unit* /*charmer*/, uint32 /*oldFactionId*/, uint32 /*newFactionId*/) { }
|
||||
|
||||
// To change behaviour of set visible item slot
|
||||
virtual void OnAfterSetVisibleItemSlot(Player* /*player*/, uint8 /*slot*/, Item* /*item*/) { }
|
||||
|
||||
// After an item has been moved from inventory
|
||||
virtual void OnAfterMoveItemFromInventory(Player* /*player*/, Item* /*it*/, uint8 /*bag*/, uint8 /*slot*/, bool /*update*/) { }
|
||||
|
||||
// After an item has been equipped
|
||||
virtual void OnEquip(Player* /*player*/, Item* /*it*/, uint8 /*bag*/, uint8 /*slot*/, bool /*update*/) { }
|
||||
|
||||
// After player enters queue for BG
|
||||
virtual void OnPlayerJoinBG(Player* /*player*/) { }
|
||||
|
||||
// After player enters queue for Arena
|
||||
virtual void OnPlayerJoinArena(Player* /*player*/) { }
|
||||
|
||||
//Called when trying to get a team ID of a slot > 2 (This is for custom teams created by modules)
|
||||
virtual void GetCustomGetArenaTeamId(Player const* /*player*/, uint8 /*slot*/, uint32& /*teamID*/) const { }
|
||||
|
||||
//Called when trying to get players personal rating of an arena slot > 2 (This is for custom teams created by modules)
|
||||
virtual void GetCustomArenaPersonalRating(Player const* /*player*/, uint8 /*slot*/, uint32& /*rating*/) const { }
|
||||
|
||||
//Called after the normal slots (0..2) for arena have been evaluated so that custom arena teams could modify it if nececasry
|
||||
virtual void OnGetMaxPersonalArenaRatingRequirement(Player const* /*player*/, uint32 /*minSlot*/, uint32& /*maxArenaRating*/) const {}
|
||||
|
||||
//After looting item
|
||||
virtual void OnLootItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/, ObjectGuid /*lootguid*/) { }
|
||||
|
||||
//Before looting item
|
||||
virtual void OnBeforeFillQuestLootItem(Player* /*player*/, LootItem& /*item*/) { }
|
||||
|
||||
//After looting item (includes master loot).
|
||||
virtual void OnStoreNewItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/) { }
|
||||
|
||||
//After creating item (eg profession item creation)
|
||||
virtual void OnCreateItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/) { }
|
||||
|
||||
// After receiving item as a quest reward
|
||||
virtual void OnQuestRewardItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/) { }
|
||||
|
||||
// When placing a bid or buying out an auction
|
||||
[[nodiscard]] virtual bool CanPlaceAuctionBid(Player* /*player*/, AuctionEntry* /*auction*/) { return true; }
|
||||
|
||||
// After receiving item as a group roll reward
|
||||
virtual void OnGroupRollRewardItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/, RollVote /*voteType*/, Roll* /*roll*/) { }
|
||||
|
||||
//Before opening an item
|
||||
[[nodiscard]] virtual bool OnBeforeOpenItem(Player* /*player*/, Item* /*item*/) { return true; }
|
||||
|
||||
// After completed a quest
|
||||
[[nodiscard]] virtual bool OnBeforeQuestComplete(Player* /*player*/, uint32 /*quest_id*/) { return true; }
|
||||
|
||||
// Called after computing the XP reward value for a quest
|
||||
virtual void OnQuestComputeXP(Player* /*player*/, Quest const* /*quest*/, uint32& /*xpValue*/) { }
|
||||
|
||||
// Before durability repair action, you can even modify the discount value
|
||||
virtual void OnBeforeDurabilityRepair(Player* /*player*/, ObjectGuid /*npcGUID*/, ObjectGuid /*itemGUID*/, float&/*discountMod*/, uint8 /*guildBank*/) { }
|
||||
|
||||
//Before buying something from any vendor
|
||||
virtual void OnBeforeBuyItemFromVendor(Player* /*player*/, ObjectGuid /*vendorguid*/, uint32 /*vendorslot*/, uint32& /*item*/, uint8 /*count*/, uint8 /*bag*/, uint8 /*slot*/) { };
|
||||
|
||||
//Before buying something from any vendor
|
||||
virtual void OnBeforeStoreOrEquipNewItem(Player* /*player*/, uint32 /*vendorslot*/, uint32& /*item*/, uint8 /*count*/, uint8 /*bag*/, uint8 /*slot*/, ItemTemplate const* /*pProto*/, Creature* /*pVendor*/, VendorItem const* /*crItem*/, bool /*bStore*/) { };
|
||||
|
||||
//After buying something from any vendor
|
||||
virtual void OnAfterStoreOrEquipNewItem(Player* /*player*/, uint32 /*vendorslot*/, Item* /*item*/, uint8 /*count*/, uint8 /*bag*/, uint8 /*slot*/, ItemTemplate const* /*pProto*/, Creature* /*pVendor*/, VendorItem const* /*crItem*/, bool /*bStore*/) { };
|
||||
|
||||
virtual void OnAfterUpdateMaxPower(Player* /*player*/, Powers& /*power*/, float& /*value*/) { }
|
||||
|
||||
virtual void OnAfterUpdateMaxHealth(Player* /*player*/, float& /*value*/) { }
|
||||
|
||||
virtual void OnBeforeUpdateAttackPowerAndDamage(Player* /*player*/, float& /*level*/, float& /*val2*/, bool /*ranged*/) { }
|
||||
virtual void OnAfterUpdateAttackPowerAndDamage(Player* /*player*/, float& /*level*/, float& /*base_attPower*/, float& /*attPowerMod*/, float& /*attPowerMultiplier*/, bool /*ranged*/) { }
|
||||
|
||||
virtual void OnBeforeInitTalentForLevel(Player* /*player*/, uint8& /*level*/, uint32& /*talentPointsForLevel*/) { }
|
||||
|
||||
virtual void OnFirstLogin(Player* /*player*/) { }
|
||||
|
||||
virtual void OnSetMaxLevel(Player* /*player*/, uint32& /*maxPlayerLevel*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanJoinInBattlegroundQueue(Player* /*player*/, ObjectGuid /*BattlemasterGuid*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*joinAsGroup*/, GroupJoinBattlegroundResult& /*err*/) { return true; }
|
||||
virtual bool ShouldBeRewardedWithMoneyInsteadOfExp(Player* /*player*/) { return false; }
|
||||
|
||||
// Called before the player's temporary summoned creature has initialized it's stats
|
||||
virtual void OnBeforeTempSummonInitStats(Player* /*player*/, TempSummon* /*tempSummon*/, uint32& /*duration*/) { }
|
||||
|
||||
// Called before the player's guardian / pet has initialized it's stats for the player's level
|
||||
virtual void OnBeforeGuardianInitStatsForLevel(Player* /*player*/, Guardian* /*guardian*/, CreatureTemplate const* /*cinfo*/, PetType& /*petType*/) { }
|
||||
|
||||
// Called after the player's guardian / pet has initialized it's stats for the player's level
|
||||
virtual void OnAfterGuardianInitStatsForLevel(Player* /*player*/, Guardian* /*guardian*/) { }
|
||||
|
||||
// Called before loading a player's pet from the DB
|
||||
virtual void OnBeforeLoadPetFromDB(Player* /*player*/, uint32& /*petentry*/, uint32& /*petnumber*/, bool& /*current*/, bool& /*forceLoadFromDB*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanJoinInArenaQueue(Player* /*player*/, ObjectGuid /*BattlemasterGuid*/, uint8 /*arenaslot*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*joinAsGroup*/, uint8 /*IsRated*/, GroupJoinBattlegroundResult& /*err*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanBattleFieldPort(Player* /*player*/, uint8 /*arenaType*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*action*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanGroupInvite(Player* /*player*/, std::string& /*membername*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanGroupAccept(Player* /*player*/, Group* /*group*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanSellItem(Player* /*player*/, Item* /*item*/, Creature* /*creature*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanSendMail(Player* /*player*/, ObjectGuid /*receiverGuid*/, ObjectGuid /*mailbox*/, std::string& /*subject*/, std::string& /*body*/, uint32 /*money*/, uint32 /*COD*/, Item* /*item*/) { return true; }
|
||||
|
||||
virtual void PetitionBuy(Player* /*player*/, Creature* /*creature*/, uint32& /*charterid*/, uint32& /*cost*/, uint32& /*type*/) { }
|
||||
|
||||
virtual void PetitionShowList(Player* /*player*/, Creature* /*creature*/, uint32& /*CharterEntry*/, uint32& /*CharterDispayID*/, uint32& /*CharterCost*/) { }
|
||||
|
||||
virtual void OnRewardKillRewarder(Player* /*player*/, bool /*isDungeon*/, float& /*rate*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanGiveMailRewardAtGiveLevel(Player* /*player*/, uint8 /*level*/) { return true; }
|
||||
|
||||
virtual void OnDeleteFromDB(CharacterDatabaseTransaction /*trans*/, uint32 /*guid*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanRepopAtGraveyard(Player* /*player*/) { return true; }
|
||||
|
||||
virtual void OnGetMaxSkillValue(Player* /*player*/, uint32 /*skill*/, int32& /*result*/, bool /*IsPure*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called before gathering skill gain is applied to the character.
|
||||
*
|
||||
* @param player Contains information about the Player sender
|
||||
* @param skill_id Contains information about the skill line
|
||||
* @param current Contains the current skill level for skill
|
||||
* @param gray Contains the gray skill level for current application
|
||||
* @param green Contains the green skill level for current application
|
||||
* @param yellow Contains the yellow skill level for current application
|
||||
* @param gain Contains the amount of points that should be added to the Player
|
||||
*/
|
||||
virtual void OnUpdateGatheringSkill(Player* /*player*/, uint32 /*skill_id*/, uint32 /*current*/, uint32 /*gray*/, uint32 /*green*/, uint32 /*yellow*/, uint32& /*gain*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook is called before crafting skill gain is applied to the character.
|
||||
*
|
||||
* @param player Contains information about the Player sender
|
||||
* @param skill Contains information about the skill line
|
||||
* @param current_level Contains the current skill level for skill
|
||||
* @param gain Contains the amount of points that should be added to the Player
|
||||
*/
|
||||
virtual void OnUpdateCraftingSkill(Player* /*player*/, SkillLineAbilityEntry const* /*skill*/, uint32 /*current_level*/, uint32& /*gain*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool OnUpdateFishingSkill(Player* /*player*/, int32 /*skill*/, int32 /*zone_skill*/, int32 /*chance*/, int32 /*roll*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanAreaExploreAndOutdoor(Player* /*player*/) { return true; }
|
||||
|
||||
virtual void OnVictimRewardBefore(Player* /*player*/, Player* /*victim*/, uint32& /*killer_title*/, uint32& /*victim_title*/) { }
|
||||
|
||||
virtual void OnVictimRewardAfter(Player* /*player*/, Player* /*victim*/, uint32& /*killer_title*/, uint32& /*victim_rank*/, float& /*honor_f*/) { }
|
||||
|
||||
virtual void OnCustomScalingStatValueBefore(Player* /*player*/, ItemTemplate const* /*proto*/, uint8 /*slot*/, bool /*apply*/, uint32& /*CustomScalingStatValue*/) { }
|
||||
|
||||
virtual void OnCustomScalingStatValue(Player* /*player*/, ItemTemplate const* /*proto*/, uint32& /*statType*/, int32& /*val*/, uint8 /*itemProtoStatNumber*/, uint32 /*ScalingStatValue*/, ScalingStatValuesEntry const* /*ssv*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanArmorDamageModifier(Player* /*player*/) { return true; }
|
||||
|
||||
virtual void OnGetFeralApBonus(Player* /*player*/, int32& /*feral_bonus*/, int32 /*dpsMod*/, ItemTemplate const* /*proto*/, ScalingStatValuesEntry const* /*ssv*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanApplyWeaponDependentAuraDamageMod(Player* /*player*/, Item* /*item*/, WeaponAttackType /*attackType*/, AuraEffect const* /*aura*/, bool /*apply*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanApplyEquipSpell(Player* /*player*/, SpellInfo const* /*spellInfo*/, Item* /*item*/, bool /*apply*/, bool /*form_change*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanApplyEquipSpellsItemSet(Player* /*player*/, ItemSetEffect* /*eff*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanCastItemCombatSpell(Player* /*player*/, Unit* /*target*/, WeaponAttackType /*attType*/, uint32 /*procVictim*/, uint32 /*procEx*/, Item* /*item*/, ItemTemplate const* /*proto*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanCastItemUseSpell(Player* /*player*/, Item* /*item*/, SpellCastTargets const& /*targets*/, uint8 /*cast_count*/, uint32 /*glyphIndex*/) { return true; }
|
||||
|
||||
virtual void OnApplyAmmoBonuses(Player* /*player*/, ItemTemplate const* /*proto*/, float& /*currentAmmoDPS*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanEquipItem(Player* /*player*/, uint8 /*slot*/, uint16& /*dest*/, Item* /*pItem*/, bool /*swap*/, bool /*not_loading*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanUnequipItem(Player* /*player*/, uint16 /*pos*/, bool /*swap*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanUseItem(Player* /*player*/, ItemTemplate const* /*proto*/, InventoryResult& /*result*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanSaveEquipNewItem(Player* /*player*/, Item* /*item*/, uint16 /*pos*/, bool /*update*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanApplyEnchantment(Player* /*player*/, Item* /*item*/, EnchantmentSlot /*slot*/, bool /*apply*/, bool /*apply_dur*/, bool /*ignore_condition*/) { return true; }
|
||||
|
||||
virtual void OnGetQuestRate(Player* /*player*/, float& /*result*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool PassedQuestKilledMonsterCredit(Player* /*player*/, Quest const* /*qinfo*/, uint32 /*entry*/, uint32 /*real_entry*/, ObjectGuid /*guid*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CheckItemInSlotAtLoadInventory(Player* /*player*/, Item* /*item*/, uint8 /*slot*/, uint8& /*err*/, uint16& /*dest*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool NotAvoidSatisfy(Player* /*player*/, DungeonProgressionRequirements const* /*ar*/, uint32 /*target_map*/, bool /*report*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool NotVisibleGloballyFor(Player* /*player*/, Player const* /*u*/) { return true; }
|
||||
|
||||
virtual void OnGetArenaPersonalRating(Player* /*player*/, uint8 /*slot*/, uint32& /*result*/) { }
|
||||
|
||||
virtual void OnGetArenaTeamId(Player* /*player*/, uint8 /*slot*/, uint32& /*result*/) { }
|
||||
|
||||
virtual void OnIsFFAPvP(Player* /*player*/, bool& /*result*/) { }
|
||||
|
||||
//Fires whenever the UNIT_BYTE2_FLAG_FFA_PVP bit is Changed on the player
|
||||
virtual void OnFfaPvpStateUpdate(Player* /*player*/, bool /*result*/) { }
|
||||
|
||||
virtual void OnIsPvP(Player* /*player*/, bool& /*result*/) { }
|
||||
|
||||
virtual void OnGetMaxSkillValueForLevel(Player* /*player*/, uint16& /*result*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool NotSetArenaTeamInfoField(Player* /*player*/, uint8 /*slot*/, ArenaTeamInfoType /*type*/, uint32 /*value*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanJoinLfg(Player* /*player*/, uint8 /*roles*/, std::set<uint32>& /*dungeons*/, const std::string& /*comment*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanEnterMap(Player* /*player*/, MapEntry const* /*entry*/, InstanceTemplate const* /*instance*/, MapDifficulty const* /*mapDiff*/, bool /*loginCheck*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanInitTrade(Player* /*player*/, Player* /*target*/) { return true; }
|
||||
|
||||
virtual void OnSetServerSideVisibility(Player* /*player*/, ServerSideVisibilityType& /*type*/, AccountTypes& /*sec*/) { }
|
||||
|
||||
virtual void OnSetServerSideVisibilityDetect(Player* /*player*/, ServerSideVisibilityType& /*type*/, AccountTypes& /*sec*/) { }
|
||||
|
||||
virtual void OnPlayerResurrect(Player* /*player*/, float /*restore_percent*/, bool /*applySickness*/) { }
|
||||
|
||||
// Called before selecting the graveyard when releasing spirit
|
||||
virtual void OnBeforeChooseGraveyard(Player* /*player*/, TeamId /*teamId*/, bool /*nearCorpse*/, uint32& /*graveyardOverride*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called before player sending message in default chat
|
||||
*
|
||||
* @param player Contains information about the Player sender
|
||||
* @param type Contains information about the chat message type
|
||||
* @param language Contains information about the language type
|
||||
* @param msg Contains information about the message
|
||||
*
|
||||
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||
*/
|
||||
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/) { return true; }
|
||||
|
||||
/**
|
||||
* @brief This hook called before player sending message to other player via private
|
||||
*
|
||||
* @param player Contains information about the Player sender
|
||||
* @param type Contains information about the chat message type
|
||||
* @param language Contains information about the language type
|
||||
* @param msg Contains information about the message
|
||||
* @param receiver Contains information about the Player receiver
|
||||
*
|
||||
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||
*/
|
||||
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/, Player* /*receiver*/) { return true; }
|
||||
|
||||
/**
|
||||
* @brief This hook called before player sending message to group
|
||||
*
|
||||
* @param player Contains information about the Player sender
|
||||
* @param type Contains information about the chat message type
|
||||
* @param language Contains information about the language type
|
||||
* @param msg Contains information about the message
|
||||
* @param group Contains information about the Group
|
||||
*
|
||||
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||
*/
|
||||
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/, Group* /*group*/) { return true; }
|
||||
|
||||
/**
|
||||
* @brief This hook called before player sending message to guild
|
||||
*
|
||||
* @param player Contains information about the Player sender
|
||||
* @param type Contains information about the chat message type
|
||||
* @param language Contains information about the language type
|
||||
* @param msg Contains information about the message
|
||||
* @param guild Contains information about the Guild
|
||||
*
|
||||
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||
*/
|
||||
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/, Guild* /*guild*/) { return true; }
|
||||
|
||||
/**
|
||||
* @brief This hook called before player sending message to channel
|
||||
*
|
||||
* @param player Contains information about the Player sender
|
||||
* @param type Contains information about the chat message type
|
||||
* @param language Contains information about the language type
|
||||
* @param msg Contains information about the message
|
||||
* @param channel Contains information about the Channel
|
||||
*
|
||||
* @return True if you want to continue sending the message, false if you want to disable sending the message
|
||||
*/
|
||||
[[nodiscard]] virtual bool CanPlayerUseChat(Player* /*player*/, uint32 /*type*/, uint32 /*language*/, std::string& /*msg*/, Channel* /*channel*/) { return true; }
|
||||
|
||||
/**
|
||||
* @brief This hook called after player learning talents
|
||||
*
|
||||
* @param player Contains information about the Player
|
||||
* @param talentId Contains information about the talent id
|
||||
* @param talentRank Contains information about the talent rank
|
||||
* @param spellid Contains information about the spell id
|
||||
*/
|
||||
virtual void OnPlayerLearnTalents(Player* /*player*/, uint32 /*talentId*/, uint32 /*talentRank*/, uint32 /*spellid*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called after player entering combat
|
||||
*
|
||||
* @param player Contains information about the Player
|
||||
* @param Unit Contains information about the Unit
|
||||
*/
|
||||
virtual void OnPlayerEnterCombat(Player* /*player*/, Unit* /*enemy*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called after player leave combat
|
||||
*
|
||||
* @param player Contains information about the Player
|
||||
*/
|
||||
virtual void OnPlayerLeaveCombat(Player* /*player*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called after player abandoning quest
|
||||
*
|
||||
* @param player Contains information about the Player
|
||||
* @param questId Contains information about the quest id
|
||||
*/
|
||||
virtual void OnQuestAbandon(Player* /*player*/, uint32 /*questId*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called before other CanFlyChecks are applied
|
||||
*
|
||||
* @param player Contains information about the Player
|
||||
* @param mapId Contains information about the current map id
|
||||
* @param zoneId Contains information about the current zone
|
||||
* @param bySpell Contains information about the spell that invoked the check
|
||||
*/
|
||||
[[nodiscard]] virtual bool OnCanPlayerFlyInZone(Player* /*player*/, uint32 /*mapId*/, uint32 /*zoneId*/, SpellInfo const* /*bySpell*/) { return true; }
|
||||
|
||||
// Passive Anticheat System
|
||||
virtual void AnticheatSetSkipOnePacketForASH(Player* /*player*/, bool /*apply*/) { }
|
||||
virtual void AnticheatSetCanFlybyServer(Player* /*player*/, bool /*apply*/) { }
|
||||
virtual void AnticheatSetUnderACKmount(Player* /*player*/) { }
|
||||
virtual void AnticheatSetRootACKUpd(Player* /*player*/) { }
|
||||
virtual void AnticheatSetJumpingbyOpcode(Player* /*player*/, bool /*jump*/) { }
|
||||
virtual void AnticheatUpdateMovementInfo(Player* /*player*/, MovementInfo const& /*movementInfo*/) { }
|
||||
[[nodiscard]] virtual bool AnticheatHandleDoubleJump(Player* /*player*/, Unit* /*mover*/) { return true; }
|
||||
[[nodiscard]] virtual bool AnticheatCheckMovementInfo(Player* /*player*/, MovementInfo const& /*movementInfo*/, Unit* /*mover*/, bool /*jump*/) { return true; }
|
||||
|
||||
/**
|
||||
* @brief This hook is called, to avoid displaying the error message that the body has already been stripped
|
||||
*
|
||||
* @param player Contains information about the Player
|
||||
*
|
||||
* @return true Avoiding displaying the error message that the loot has already been taken.
|
||||
*/
|
||||
virtual bool CanSendErrorAlreadyLooted(Player* /*player*/) { return true; }
|
||||
|
||||
/**
|
||||
* @brief It is used when an item is taken from a creature.
|
||||
*
|
||||
* @param player Contains information about the Player
|
||||
*
|
||||
*/
|
||||
virtual void OnAfterCreatureLoot(Player* /*player*/) { }
|
||||
|
||||
/**
|
||||
* @brief After a creature's money is taken
|
||||
*
|
||||
* @param player Contains information about the Player
|
||||
*/
|
||||
virtual void OnAfterCreatureLootMoney(Player* /*player*/) { }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ServerScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptMgrMacros.h"
|
||||
|
||||
@@ -95,3 +96,11 @@ bool ScriptMgr::CanPacketSend(WorldSession* session, WorldPacket const& packet)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ServerScript::ServerScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<ServerScript>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<ServerScript>;
|
||||
|
||||
62
src/server/game/Scripting/ScriptDefines/ServerScript.h
Normal file
62
src/server/game/Scripting/ScriptDefines/ServerScript.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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_SERVER_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_SERVER_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
class ServerScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
ServerScript(const char* name);
|
||||
|
||||
public:
|
||||
// Called when reactive socket I/O is started (WorldSocketMgr).
|
||||
virtual void OnNetworkStart() { }
|
||||
|
||||
// Called when reactive I/O is stopped.
|
||||
virtual void OnNetworkStop() { }
|
||||
|
||||
// Called when a remote socket establishes a connection to the server. Do not store the socket object.
|
||||
virtual void OnSocketOpen(std::shared_ptr<WorldSocket> /*socket*/) { }
|
||||
|
||||
// Called when a socket is closed. Do not store the socket object, and do not rely on the connection
|
||||
// being open; it is not.
|
||||
virtual void OnSocketClose(std::shared_ptr<WorldSocket> /*socket*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called when a packet is sent to a client. The packet object is a copy of the original packet, so reading and modifying it is safe.
|
||||
*
|
||||
* @param session Contains information about the WorldSession
|
||||
* @param packet Contains information about the WorldPacket
|
||||
* @return True if you want to continue sending the packet, false if you want to disallow sending the packet
|
||||
*/
|
||||
[[nodiscard]] virtual bool CanPacketSend(WorldSession* /*session*/, WorldPacket& /*packet*/) { return true; }
|
||||
|
||||
/**
|
||||
* @brief Called when a (valid) packet is received by a client. The packet object is a copy of the original packet, so
|
||||
* reading and modifying it is safe. Make sure to check WorldSession pointer before usage, it might be null in case of auth packets
|
||||
*
|
||||
* @param session Contains information about the WorldSession
|
||||
* @param packet Contains information about the WorldPacket
|
||||
* @return True if you want to continue receive the packet, false if you want to disallow receive the packet
|
||||
*/
|
||||
[[nodiscard]] virtual bool CanPacketReceive(WorldSession* /*session*/, WorldPacket& /*packet*/) { return true; }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "SpellScriptLoader.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
@@ -74,3 +75,11 @@ void ScriptMgr::CreateSpellScriptLoaders(uint32 spellId, std::vector<std::pair<S
|
||||
scriptVector.emplace_back(tempScript, itr);
|
||||
}
|
||||
}
|
||||
|
||||
SpellScriptLoader::SpellScriptLoader(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<SpellScriptLoader>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<SpellScriptLoader>;
|
||||
|
||||
144
src/server/game/Scripting/ScriptDefines/SpellScriptLoader.h
Normal file
144
src/server/game/Scripting/ScriptDefines/SpellScriptLoader.h
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* 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_SPELL_SCRIPT_LOADER_H_
|
||||
#define SCRIPT_OBJECT_SPELL_SCRIPT_LOADER_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
#include "Tuples.h"
|
||||
#include "Types.h"
|
||||
|
||||
class SpellScriptLoader : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
SpellScriptLoader(const char* name);
|
||||
|
||||
public:
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
|
||||
|
||||
// Should return a fully valid SpellScript pointer.
|
||||
[[nodiscard]] virtual SpellScript* GetSpellScript() const { return nullptr; }
|
||||
|
||||
// Should return a fully valid AuraScript pointer.
|
||||
[[nodiscard]] virtual AuraScript* GetAuraScript() const { return nullptr; }
|
||||
};
|
||||
|
||||
namespace Acore::SpellScripts
|
||||
{
|
||||
template<typename T>
|
||||
using is_SpellScript = std::is_base_of<SpellScript, T>;
|
||||
|
||||
template<typename T>
|
||||
using is_AuraScript = std::is_base_of<AuraScript, T>;
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
class GenericSpellAndAuraScriptLoader : public SpellScriptLoader
|
||||
{
|
||||
using SpellScriptType = typename Acore::find_type_if_t<Acore::SpellScripts::is_SpellScript, Ts...>;
|
||||
using AuraScriptType = typename Acore::find_type_if_t<Acore::SpellScripts::is_AuraScript, Ts...>;
|
||||
using ArgsType = typename Acore::find_type_if_t<Acore::is_tuple, Ts...>;
|
||||
|
||||
public:
|
||||
GenericSpellAndAuraScriptLoader(char const* name, ArgsType&& args) : SpellScriptLoader(name), _args(std::move(args)) { }
|
||||
|
||||
private:
|
||||
[[nodiscard]] SpellScript* GetSpellScript() const override
|
||||
{
|
||||
if constexpr (!std::is_same_v<SpellScriptType, Acore::find_type_end>)
|
||||
{
|
||||
return Acore::new_from_tuple<SpellScriptType>(_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] AuraScript* GetAuraScript() const override
|
||||
{
|
||||
if constexpr (!std::is_same_v<AuraScriptType, Acore::find_type_end>)
|
||||
{
|
||||
return Acore::new_from_tuple<AuraScriptType>(_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ArgsType _args;
|
||||
};
|
||||
|
||||
#define RegisterSpellScriptWithArgs(spell_script, script_name, ...) new GenericSpellAndAuraScriptLoader<spell_script, decltype(std::make_tuple(__VA_ARGS__))>(script_name, std::make_tuple(__VA_ARGS__))
|
||||
#define RegisterSpellScript(spell_script) RegisterSpellScriptWithArgs(spell_script, #spell_script)
|
||||
#define RegisterSpellAndAuraScriptPairWithArgs(script_1, script_2, script_name, ...) new GenericSpellAndAuraScriptLoader<script_1, script_2, decltype(std::make_tuple(__VA_ARGS__))>(script_name, std::make_tuple(__VA_ARGS__))
|
||||
#define RegisterSpellAndAuraScriptPair(script_1, script_2) RegisterSpellAndAuraScriptPairWithArgs(script_1, script_2, #script_1)
|
||||
|
||||
//namespace Acore::SpellScripts
|
||||
//{
|
||||
// template<typename T>
|
||||
// using is_SpellScript = std::is_base_of<SpellScript, T>;
|
||||
//
|
||||
// template<typename T>
|
||||
// using is_AuraScript = std::is_base_of<AuraScript, T>;
|
||||
//}
|
||||
//
|
||||
//template <typename... Ts>
|
||||
//class GenericSpellAndAuraScriptLoader : public SpellScriptLoader
|
||||
//{
|
||||
// using SpellScriptType = typename Acore::find_type_if_t<Acore::SpellScripts::is_SpellScript, Ts...>;
|
||||
// using AuraScriptType = typename Acore::find_type_if_t<Acore::SpellScripts::is_AuraScript, Ts...>;
|
||||
// using ArgsType = typename Acore::find_type_if_t<Acore::is_tuple, Ts...>;
|
||||
//
|
||||
//public:
|
||||
// GenericSpellAndAuraScriptLoader(std::string_view name, ArgsType&& args) : SpellScriptLoader(name), _args(std::move(args)) { }
|
||||
//
|
||||
//private:
|
||||
// [[nodiscard]] SpellScript* GetSpellScript() const override
|
||||
// {
|
||||
// if constexpr (!std::is_same_v<SpellScriptType, Acore::find_type_end>)
|
||||
// {
|
||||
// return Acore::new_from_tuple<SpellScriptType>(_args);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return nullptr;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// [[nodiscard]] AuraScript* GetAuraScript() const override
|
||||
// {
|
||||
// if constexpr (!std::is_same_v<AuraScriptType, Acore::find_type_end>)
|
||||
// {
|
||||
// return Acore::new_from_tuple<AuraScriptType>(_args);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return nullptr;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ArgsType _args;
|
||||
//};
|
||||
//
|
||||
//#define RegisterSpellScriptWithArgs(spell_script, script_name, ...) new GenericSpellAndAuraScriptLoader<spell_script, decltype(std::make_tuple(__VA_ARGS__))>(script_name, std::make_tuple(__VA_ARGS__))
|
||||
//#define RegisterSpellScript(spell_script) RegisterSpellScriptWithArgs(spell_script, #spell_script)
|
||||
//#define RegisterSpellAndAuraScriptPairWithArgs(script_1, script_2, script_name, ...) new GenericSpellAndAuraScriptLoader<script_1, script_2, decltype(std::make_tuple(__VA_ARGS__))>(script_name, std::make_tuple(__VA_ARGS__))
|
||||
//#define RegisterSpellAndAuraScriptPair(script_1, script_2) RegisterSpellAndAuraScriptPairWithArgs(script_1, script_2, #script_1)
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TransportScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Transport.h"
|
||||
|
||||
@@ -68,3 +69,11 @@ void ScriptMgr::OnRelocate(Transport* transport, uint32 waypointId, uint32 mapId
|
||||
tempScript->OnRelocate(transport, waypointId, mapId, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
TransportScript::TransportScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<TransportScript>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<TransportScript>;
|
||||
|
||||
44
src/server/game/Scripting/ScriptDefines/TransportScript.h
Normal file
44
src/server/game/Scripting/ScriptDefines/TransportScript.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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_TRANSPORT_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_TRANSPORT_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
class TransportScript : public ScriptObject, public UpdatableScript<Transport>
|
||||
{
|
||||
protected:
|
||||
TransportScript(const char* name);
|
||||
|
||||
public:
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
|
||||
|
||||
// Called when a player boards the transport.
|
||||
virtual void OnAddPassenger(Transport* /*transport*/, Player* /*player*/) { }
|
||||
|
||||
// Called when a creature boards the transport.
|
||||
virtual void OnAddCreaturePassenger(Transport* /*transport*/, Creature* /*creature*/) { }
|
||||
|
||||
// Called when a player exits the transport.
|
||||
virtual void OnRemovePassenger(Transport* /*transport*/, Player* /*player*/) { }
|
||||
|
||||
// Called when transport moves.
|
||||
virtual void OnRelocate(Transport* /*transport*/, uint32 /*waypointId*/, uint32 /*mapId*/, float /*x*/, float /*y*/, float /*z*/) { }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "UnitScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptMgrMacros.h"
|
||||
|
||||
@@ -250,3 +251,12 @@ void ScriptMgr::OnAuraApply(Unit* unit, Aura* aura)
|
||||
script->OnAuraApply(unit, aura);
|
||||
});
|
||||
}
|
||||
|
||||
UnitScript::UnitScript(const char* name, bool addToScripts) :
|
||||
ScriptObject(name)
|
||||
{
|
||||
if (addToScripts)
|
||||
ScriptRegistry<UnitScript>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<UnitScript>;
|
||||
|
||||
89
src/server/game/Scripting/ScriptDefines/UnitScript.h
Normal file
89
src/server/game/Scripting/ScriptDefines/UnitScript.h
Normal 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_UNIT_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_UNIT_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
enum ReputationRank : uint8;
|
||||
class ByteBuffer;
|
||||
|
||||
class UnitScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
UnitScript(const char* name, bool addToScripts = true);
|
||||
|
||||
public:
|
||||
// Called when a unit deals healing to another unit
|
||||
virtual void OnHeal(Unit* /*healer*/, Unit* /*reciever*/, uint32& /*gain*/) { }
|
||||
|
||||
// Called when a unit deals damage to another unit
|
||||
virtual void OnDamage(Unit* /*attacker*/, Unit* /*victim*/, uint32& /*damage*/) { }
|
||||
|
||||
// Called when DoT's Tick Damage is being Dealt
|
||||
// Attacker can be nullptr if he is despawned while the aura still exists on target
|
||||
virtual void ModifyPeriodicDamageAurasTick(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/, SpellInfo const* /*spellInfo*/) { }
|
||||
|
||||
// Called when Melee Damage is being Dealt
|
||||
virtual void ModifyMeleeDamage(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/) { }
|
||||
|
||||
// Called when Spell Damage is being Dealt
|
||||
virtual void ModifySpellDamageTaken(Unit* /*target*/, Unit* /*attacker*/, int32& /*damage*/, SpellInfo const* /*spellInfo*/) { }
|
||||
|
||||
// Called when Heal is Recieved
|
||||
virtual void ModifyHealReceived(Unit* /*target*/, Unit* /*healer*/, uint32& /*heal*/, SpellInfo const* /*spellInfo*/) { }
|
||||
|
||||
//Called when Damage is Dealt
|
||||
virtual uint32 DealDamage(Unit* /*AttackerUnit*/, Unit* /*pVictim*/, uint32 damage, DamageEffectType /*damagetype*/) { return damage; }
|
||||
|
||||
virtual void OnBeforeRollMeleeOutcomeAgainst(Unit const* /*attacker*/, Unit const* /*victim*/, WeaponAttackType /*attType*/, int32& /*attackerMaxSkillValueForLevel*/, int32& /*victimMaxSkillValueForLevel*/, int32& /*attackerWeaponSkill*/, int32& /*victimDefenseSkill*/, int32& /*crit_chance*/, int32& /*miss_chance*/, int32& /*dodge_chance*/, int32& /*parry_chance*/, int32& /*block_chance*/ ) { };
|
||||
|
||||
virtual void OnAuraApply(Unit* /*unit*/, Aura* /*aura*/) { }
|
||||
|
||||
virtual void OnAuraRemove(Unit* /*unit*/, AuraApplication* /*aurApp*/, AuraRemoveMode /*mode*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool IfNormalReaction(Unit const* /*unit*/, Unit const* /*target*/, ReputationRank& /*repRank*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool IsNeedModSpellDamagePercent(Unit const* /*unit*/, AuraEffect* /*auraEff*/, float& /*doneTotalMod*/, SpellInfo const* /*spellProto*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool IsNeedModMeleeDamagePercent(Unit const* /*unit*/, AuraEffect* /*auraEff*/, float& /*doneTotalMod*/, SpellInfo const* /*spellProto*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool IsNeedModHealPercent(Unit const* /*unit*/, AuraEffect* /*auraEff*/, float& /*doneTotalMod*/, SpellInfo const* /*spellProto*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool CanSetPhaseMask(Unit const* /*unit*/, uint32 /*newPhaseMask*/, bool /*update*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual bool IsCustomBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player const* /*target*/, uint16 /*index*/) { return false; }
|
||||
|
||||
[[nodiscard]] virtual bool OnBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player* /*target*/, uint16 /*index*/) { return false; }
|
||||
|
||||
/**
|
||||
* @brief This hook runs in Unit::Update
|
||||
*
|
||||
* @param unit Contains information about the Unit
|
||||
* @param diff Contains information about the diff time
|
||||
*/
|
||||
virtual void OnUnitUpdate(Unit* /*unit*/, uint32 /*diff*/) { }
|
||||
|
||||
virtual void OnDisplayIdChange(Unit* /*unit*/, uint32 /*displayId*/) { }
|
||||
|
||||
virtual void OnUnitEnterEvadeMode(Unit* /*unit*/, uint8 /*evadeReason*/) { }
|
||||
virtual void OnUnitEnterCombat(Unit* /*unit*/, Unit* /*victim*/) { }
|
||||
virtual void OnUnitDeath(Unit* /*unit*/, Unit* /*killer*/) { }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "VehicleScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
@@ -86,3 +87,11 @@ void ScriptMgr::OnRemovePassenger(Vehicle* veh, Unit* passenger)
|
||||
tempScript->OnRemovePassenger(veh, passenger);
|
||||
}
|
||||
}
|
||||
|
||||
VehicleScript::VehicleScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<VehicleScript>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<VehicleScript>;
|
||||
|
||||
48
src/server/game/Scripting/ScriptDefines/VehicleScript.h
Normal file
48
src/server/game/Scripting/ScriptDefines/VehicleScript.h
Normal 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_VEHICLE_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_VEHICLE_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
class VehicleScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
VehicleScript(const char* name);
|
||||
|
||||
public:
|
||||
// Called after a vehicle is installed.
|
||||
virtual void OnInstall(Vehicle* /*veh*/) { }
|
||||
|
||||
// Called after a vehicle is uninstalled.
|
||||
virtual void OnUninstall(Vehicle* /*veh*/) { }
|
||||
|
||||
// Called when a vehicle resets.
|
||||
virtual void OnReset(Vehicle* /*veh*/) { }
|
||||
|
||||
// Called after an accessory is installed in a vehicle.
|
||||
virtual void OnInstallAccessory(Vehicle* /*veh*/, Creature* /*accessory*/) { }
|
||||
|
||||
// Called after a passenger is added to a vehicle.
|
||||
virtual void OnAddPassenger(Vehicle* /*veh*/, Unit* /*passenger*/, int8 /*seatId*/) { }
|
||||
|
||||
// Called after a passenger is removed from a vehicle.
|
||||
virtual void OnRemovePassenger(Vehicle* /*veh*/, Unit* /*passenger*/) { }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "WeatherScript.h"
|
||||
#include "ElunaScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptMgrMacros.h"
|
||||
|
||||
@@ -42,3 +44,11 @@ void ScriptMgr::OnWeatherUpdate(Weather* weather, uint32 diff)
|
||||
tempScript->OnUpdate(weather, diff);
|
||||
}
|
||||
}
|
||||
|
||||
WeatherScript::WeatherScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<WeatherScript>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<WeatherScript>;
|
||||
|
||||
35
src/server/game/Scripting/ScriptDefines/WeatherScript.h
Normal file
35
src/server/game/Scripting/ScriptDefines/WeatherScript.h
Normal 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_WEATHER_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_WEATHER_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
class WeatherScript : public ScriptObject, public UpdatableScript<Weather>
|
||||
{
|
||||
protected:
|
||||
WeatherScript(const char* name);
|
||||
|
||||
public:
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
|
||||
|
||||
// Called when the weather changes in the zone, this script is associated with.
|
||||
virtual void OnChange(Weather* /*weather*/, WeatherState /*state*/, float /*grade*/) { }
|
||||
};
|
||||
|
||||
#endif
|
||||
38
src/server/game/Scripting/ScriptDefines/WorldMapScript.cpp
Normal file
38
src/server/game/Scripting/ScriptDefines/WorldMapScript.cpp
Normal 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 "WorldMapScript.h"
|
||||
#include "Log.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
WorldMapScript::WorldMapScript(const char* name, uint32 mapId) :
|
||||
ScriptObject(name), MapScript<Map>(mapId)
|
||||
{
|
||||
ScriptRegistry<WorldMapScript>::AddScript(this);
|
||||
}
|
||||
|
||||
void WorldMapScript::checkValidity()
|
||||
{
|
||||
checkMap();
|
||||
|
||||
if (GetEntry() && !GetEntry()->IsWorldMap())
|
||||
{
|
||||
LOG_ERROR("maps.script", "WorldMapScript for map {} is invalid.", GetEntry()->MapID);
|
||||
}
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<WorldMapScript>;
|
||||
34
src/server/game/Scripting/ScriptDefines/WorldMapScript.h
Normal file
34
src/server/game/Scripting/ScriptDefines/WorldMapScript.h
Normal 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_WORLD_MAP_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_WORLD_MAP_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
class WorldMapScript : public ScriptObject, public MapScript<Map>
|
||||
{
|
||||
protected:
|
||||
WorldMapScript(const char* name, uint32 mapId);
|
||||
|
||||
public:
|
||||
[[nodiscard]] bool isAfterLoadScript() const override { return true; }
|
||||
|
||||
void checkValidity() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "WorldObjectScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptMgrMacros.h"
|
||||
|
||||
@@ -67,3 +68,10 @@ void ScriptMgr::OnWorldObjectUpdate(WorldObject* object, uint32 diff)
|
||||
script->OnWorldObjectUpdate(object, diff);
|
||||
});
|
||||
}
|
||||
|
||||
WorldObjectScript::WorldObjectScript(const char* name) : ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<WorldObjectScript>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<WorldObjectScript>;
|
||||
|
||||
68
src/server/game/Scripting/ScriptDefines/WorldObjectScript.h
Normal file
68
src/server/game/Scripting/ScriptDefines/WorldObjectScript.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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_WORLD_OBJECT_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_WORLD_OBJECT_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
class WorldObjectScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
WorldObjectScript(const char* name);
|
||||
|
||||
public:
|
||||
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
|
||||
|
||||
/**
|
||||
* @brief This hook called before destroy world object
|
||||
*
|
||||
* @param object Contains information about the WorldObject
|
||||
*/
|
||||
virtual void OnWorldObjectDestroy(WorldObject* /*object*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called after create world object
|
||||
*
|
||||
* @param object Contains information about the WorldObject
|
||||
*/
|
||||
virtual void OnWorldObjectCreate(WorldObject* /*object*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called after world object set to map
|
||||
*
|
||||
* @param object Contains information about the WorldObject
|
||||
*/
|
||||
virtual void OnWorldObjectSetMap(WorldObject* /*object*/, Map* /*map*/ ) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called after world object reset
|
||||
*
|
||||
* @param object Contains information about the WorldObject
|
||||
*/
|
||||
virtual void OnWorldObjectResetMap(WorldObject* /*object*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook called after world object update
|
||||
*
|
||||
* @param object Contains information about the WorldObject
|
||||
* @param diff Contains information about the diff time
|
||||
*/
|
||||
virtual void OnWorldObjectUpdate(WorldObject* /*object*/, uint32 /*diff*/) { }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "WorldScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptMgrMacros.h"
|
||||
|
||||
@@ -121,3 +122,11 @@ void ScriptMgr::OnAfterUnloadAllMaps()
|
||||
script->OnAfterUnloadAllMaps();
|
||||
});
|
||||
}
|
||||
|
||||
WorldScript::WorldScript(const char* name) :
|
||||
ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<WorldScript>::AddScript(this);
|
||||
}
|
||||
|
||||
template class AC_GAME_API ScriptRegistry<WorldScript>;
|
||||
|
||||
77
src/server/game/Scripting/ScriptDefines/WorldScript.h
Normal file
77
src/server/game/Scripting/ScriptDefines/WorldScript.h
Normal 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_WORLD_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_WORLD_SCRIPT_H_
|
||||
|
||||
#include "ScriptObject.h"
|
||||
|
||||
class WorldScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
WorldScript(const char* name);
|
||||
|
||||
public:
|
||||
// Called when the open/closed state of the world changes.
|
||||
virtual void OnOpenStateChange(bool /*open*/) { }
|
||||
|
||||
// Called after the world configuration is (re)loaded.
|
||||
virtual void OnAfterConfigLoad(bool /*reload*/) { }
|
||||
|
||||
// Called when loading custom database tables
|
||||
virtual void OnLoadCustomDatabaseTable() { }
|
||||
|
||||
// Called before the world configuration is (re)loaded.
|
||||
virtual void OnBeforeConfigLoad(bool /*reload*/) { }
|
||||
|
||||
// Called before the message of the day is changed.
|
||||
virtual void OnMotdChange(std::string& /*newMotd*/) { }
|
||||
|
||||
// Called when a world shutdown is initiated.
|
||||
virtual void OnShutdownInitiate(ShutdownExitCode /*code*/, ShutdownMask /*mask*/) { }
|
||||
|
||||
// Called when a world shutdown is cancelled.
|
||||
virtual void OnShutdownCancel() { }
|
||||
|
||||
// Called on every world tick (don't execute too heavy code here).
|
||||
virtual void OnUpdate(uint32 /*diff*/) { }
|
||||
|
||||
// Called when the world is started.
|
||||
virtual void OnStartup() { }
|
||||
|
||||
// Called when the world is actually shut down.
|
||||
virtual void OnShutdown() { }
|
||||
|
||||
/**
|
||||
* @brief Called after all maps are unloaded from core
|
||||
*/
|
||||
virtual void OnAfterUnloadAllMaps() { }
|
||||
|
||||
/**
|
||||
* @brief This hook runs before finalizing the player world session. Can be also used to mutate the cache version of the Client.
|
||||
*
|
||||
* @param version The cache version that we will be sending to the Client.
|
||||
*/
|
||||
virtual void OnBeforeFinalizePlayerWorldSession(uint32& /*cacheVersion*/) { }
|
||||
|
||||
/**
|
||||
* @brief This hook runs after all scripts loading and before itialized
|
||||
*/
|
||||
virtual void OnBeforeWorldInitialized() { }
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user