mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-06 17:08:23 +01:00
Battlefields: Move BF scripts out of game
This commit introduces the usual script interface for battlefields.
This commit is contained in:
committed by
Peter Keresztes Schmidt
parent
7b3d691c0b
commit
f7faf20254
@@ -77,6 +77,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 { };
|
||||
@@ -595,6 +599,11 @@ class ScriptRegistrySwapHooks<GameObjectScript, Base>
|
||||
GameObject, GameObjectScript, 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>
|
||||
@@ -1591,6 +1600,12 @@ bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger)
|
||||
return tmpscript->OnTrigger(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.
|
||||
@@ -2226,6 +2241,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)
|
||||
{
|
||||
@@ -2322,6 +2343,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