From e707207ffafcd07682e040a7677c0def01e61d34 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Thu, 25 Aug 2022 15:50:13 -0500 Subject: [PATCH] Add FV Geyser script (#748) * Add FV Geyser script * remove uneeded include * const --- dScripts/CMakeLists.txt | 1 + dScripts/CppScripts.cpp | 4 ++++ dScripts/FvMaelstromGeyser.cpp | 18 ++++++++++++++++++ dScripts/FvMaelstromGeyser.h | 18 ++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 dScripts/FvMaelstromGeyser.cpp create mode 100644 dScripts/FvMaelstromGeyser.h diff --git a/dScripts/CMakeLists.txt b/dScripts/CMakeLists.txt index 4476ad7c..9bc088cb 100644 --- a/dScripts/CMakeLists.txt +++ b/dScripts/CMakeLists.txt @@ -99,6 +99,7 @@ set(DSCRIPT_SOURCES "ActivityManager.cpp" "FvFreeGfNinjas.cpp" "FvHorsemenTrigger.cpp" "FvMaelstromCavalry.cpp" + "FvMaelstromGeyser.cpp" "FvMaelstromDragon.cpp" "FvNinjaGuard.cpp" "FvPandaServer.cpp" diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 82cd2ebc..5f10a2a5 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -147,6 +147,7 @@ #include "FvPassThroughWall.h" #include "FvBounceOverWall.h" #include "FvFong.h" +#include "FvMaelstromGeyser.h" // FB Scripts #include "AgJetEffectServer.h" @@ -576,6 +577,9 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new FvBounceOverWall(); else if (scriptName == "scripts\\02_server\\Map\\FV\\L_NPC_FONG.lua") script = new FvFong(); + else if (scriptName == "scripts\\ai\\FV\\L_FV_MAELSTROM_GEYSER.lua") { + script = new FvMaelstromGeyser(); + } //Misc: if (scriptName == "scripts\\02_server\\Map\\General\\L_EXPLODING_ASSET.lua") diff --git a/dScripts/FvMaelstromGeyser.cpp b/dScripts/FvMaelstromGeyser.cpp new file mode 100644 index 00000000..66aa43dc --- /dev/null +++ b/dScripts/FvMaelstromGeyser.cpp @@ -0,0 +1,18 @@ +#include "FvMaelstromGeyser.h" +#include "SkillComponent.h" + +void FvMaelstromGeyser::OnStartup(Entity* self) { + self->AddTimer(m_StartSkillTimerName, m_StartSkillTimerTime); + self->AddTimer(m_KillSelfTimerName, m_KillSelfTimerTime); +} + +void FvMaelstromGeyser::OnTimerDone(Entity* self, std::string timerName) { + if (timerName == m_StartSkillTimerName) { + auto* skillComponent = self->GetComponent(); + skillComponent->CalculateBehavior(m_SkillID, m_BehaviorID, LWOOBJID_EMPTY, true); + } + if (timerName == m_KillSelfTimerName) { + self->Smash(LWOOBJID_EMPTY, eKillType::SILENT); + } +} + diff --git a/dScripts/FvMaelstromGeyser.h b/dScripts/FvMaelstromGeyser.h new file mode 100644 index 00000000..245eb56e --- /dev/null +++ b/dScripts/FvMaelstromGeyser.h @@ -0,0 +1,18 @@ +#pragma once +#include "CppScripts.h" + +class FvMaelstromGeyser final : public CppScripts::Script +{ +public: + void OnStartup(Entity* self) override; + void OnTimerDone(Entity* self, std::string timerName) override; + + +private: + const std::string m_StartSkillTimerName = "startSkill"; + const float m_StartSkillTimerTime = 2.0; + const std::string m_KillSelfTimerName = "killSelf"; + const float m_KillSelfTimerTime = 5.5; + const uint32_t m_SkillID = 831; + const uint32_t m_BehaviorID = 15500; +};