mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Battlefields: Move BF scripts out of game
This commit introduces the usual script interface
for battlefields.
(cherry picked from commit f7faf20254)
This commit is contained in:
@@ -84,6 +84,10 @@ template<>
|
||||
struct is_script_database_bound<AreaTriggerScript>
|
||||
: std::true_type { };
|
||||
|
||||
template<>
|
||||
struct is_script_database_bound<BattlefieldScript>
|
||||
: std::true_type { };
|
||||
|
||||
template<>
|
||||
struct is_script_database_bound<BattlegroundScript>
|
||||
: std::true_type { };
|
||||
@@ -724,6 +728,11 @@ class ScriptRegistrySwapHooks<AreaTriggerEntityScript, Base>
|
||||
AreaTrigger, AreaTriggerEntityScript, Base
|
||||
> { };
|
||||
|
||||
/// This hook is responsible for swapping BattlefieldScripts
|
||||
template<typename Base>
|
||||
class ScriptRegistrySwapHooks<BattlefieldScript, Base>
|
||||
: public UnsupportedScriptRegistrySwapHooks<Base> { };
|
||||
|
||||
/// This hook is responsible for swapping BattlegroundScript's
|
||||
template<typename Base>
|
||||
class ScriptRegistrySwapHooks<BattlegroundScript, Base>
|
||||
@@ -1720,6 +1729,12 @@ bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger, b
|
||||
return entered ? tmpscript->OnTrigger(player, trigger) : tmpscript->OnExit(player, trigger);
|
||||
}
|
||||
|
||||
Battlefield* ScriptMgr::CreateBattlefield(uint32 scriptId)
|
||||
{
|
||||
GET_SCRIPT_RET(BattlefieldScript, scriptId, tmpscript, nullptr);
|
||||
return tmpscript->GetBattlefield();
|
||||
}
|
||||
|
||||
Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/)
|
||||
{
|
||||
/// @todo Implement script-side battlegrounds.
|
||||
@@ -2437,6 +2452,12 @@ bool OnlyOnceAreaTriggerScript::OnTrigger(Player* player, AreaTriggerEntry const
|
||||
void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(InstanceScript* script, uint32 triggerId) { script->ResetAreaTriggerDone(triggerId); }
|
||||
void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(Player const* player, AreaTriggerEntry const* trigger) { if (InstanceScript* instance = player->GetInstanceScript()) ResetAreaTriggerDone(instance, trigger->ID); }
|
||||
|
||||
BattlefieldScript::BattlefieldScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<BattlefieldScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
BattlegroundScript::BattlegroundScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
@@ -2557,6 +2578,7 @@ template class TC_GAME_API ScriptRegistry<ItemScript>;
|
||||
template class TC_GAME_API ScriptRegistry<CreatureScript>;
|
||||
template class TC_GAME_API ScriptRegistry<GameObjectScript>;
|
||||
template class TC_GAME_API ScriptRegistry<AreaTriggerScript>;
|
||||
template class TC_GAME_API ScriptRegistry<BattlefieldScript>;
|
||||
template class TC_GAME_API ScriptRegistry<BattlegroundScript>;
|
||||
template class TC_GAME_API ScriptRegistry<OutdoorPvPScript>;
|
||||
template class TC_GAME_API ScriptRegistry<CommandScript>;
|
||||
|
||||
Reference in New Issue
Block a user