From 14d4bf3cc512786eb70ac2553c2f2439221c766c Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Fri, 2 Sep 2022 13:49:38 -0500 Subject: [PATCH] Script for aborting a wbl zone transfer (#766) --- dScripts/CMakeLists.txt | 1 + dScripts/CppScripts.cpp | 8 ++++++++ dScripts/WblGenericZone.cpp | 10 ++++++++++ dScripts/WblGenericZone.h | 10 ++++++++++ 4 files changed, 29 insertions(+) create mode 100644 dScripts/WblGenericZone.cpp create mode 100644 dScripts/WblGenericZone.h diff --git a/dScripts/CMakeLists.txt b/dScripts/CMakeLists.txt index 66e3b65b..0a907a05 100644 --- a/dScripts/CMakeLists.txt +++ b/dScripts/CMakeLists.txt @@ -247,6 +247,7 @@ set(DSCRIPT_SOURCES "ActivityManager.cpp" "WaveBossHammerling.cpp" "WaveBossHorsemen.cpp" "WaveBossSpiderling.cpp" + "WblGenericZone.cpp" "WhFans.cpp" "WildAmbients.cpp" "WishingWellServer.cpp" diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 7d114cd3..d313f2f9 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -288,6 +288,9 @@ #include "RockHydrantBroken.h" #include "WhFans.h" +// WBL scripts +#include "WblGenericZone.h" + //Big bad global bc this is a namespace and not a class: InvalidScript* invalidToReturn = new InvalidScript(); std::map m_Scripts; @@ -834,12 +837,17 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new BuccaneerValiantShip(); else if (scriptName == "scripts\\EquipmentScripts\\FireFirstSkillonStartup.lua") script = new FireFirstSkillonStartup(); + // FB else if (scriptName == "scripts\\ai\\NS\\WH\\L_ROCKHYDRANT_BROKEN.lua") script = new RockHydrantBroken(); else if (scriptName == "scripts\\ai\\NS\\L_NS_WH_FANS.lua") script = new WhFans(); + // WBL + else if (scriptName == "scripts\\zone\\LUPs\\WBL_generic_zone.lua") + script = new WblGenericZone(); + //Ignore these scripts: else if (scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua") script = invalidToReturn; diff --git a/dScripts/WblGenericZone.cpp b/dScripts/WblGenericZone.cpp new file mode 100644 index 00000000..5a670d8e --- /dev/null +++ b/dScripts/WblGenericZone.cpp @@ -0,0 +1,10 @@ +#include "WblGenericZone.h" +#include "Player.h" + +void WblGenericZone::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { + if (args == m_WblAbortMsg) { + if (!sender) return; + auto player = dynamic_cast(sender); + if (player) player->SendToZone(m_WblMainZone); + } +} diff --git a/dScripts/WblGenericZone.h b/dScripts/WblGenericZone.h new file mode 100644 index 00000000..55b66e81 --- /dev/null +++ b/dScripts/WblGenericZone.h @@ -0,0 +1,10 @@ +#pragma once +#include "CppScripts.h" +class WblGenericZone : public CppScripts::Script +{ +public: + void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override; +private: + const LWOMAPID m_WblMainZone = 1600; + const std::string m_WblAbortMsg = "AbortWBLZone"; +};