From b70e7334e87800330ab549a4e8f653e1a878a594 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Fri, 26 Aug 2022 22:58:41 -0500 Subject: [PATCH] Parrot crash script to become a sneaky ninja and steal the pirate's booty (#752) --- dScripts/CMakeLists.txt | 1 + dScripts/CppScripts.cpp | 3 +++ dScripts/GfParrotCrash.cpp | 13 +++++++++++++ dScripts/GfParrotCrash.h | 13 +++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 dScripts/GfParrotCrash.cpp create mode 100644 dScripts/GfParrotCrash.h diff --git a/dScripts/CMakeLists.txt b/dScripts/CMakeLists.txt index 13b14ad8..440ca69f 100644 --- a/dScripts/CMakeLists.txt +++ b/dScripts/CMakeLists.txt @@ -116,6 +116,7 @@ set(DSCRIPT_SOURCES "ActivityManager.cpp" "GfJailWalls.cpp" "GfMaelstromGeyser.cpp" "GfOrgan.cpp" + "GfParrotCrash.cpp" "GfTikiTorch.cpp" "GrowingFlower.cpp" "HydrantBroken.cpp" diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 44b79d9b..37a0ecf7 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -119,6 +119,7 @@ #include "GfArchway.h" #include "GfMaelstromGeyser.h" #include "PirateRep.h" +#include "GfParrotCrash.h" // SG Scripts #include "SGCannon.h" @@ -504,6 +505,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new GfMaelstromGeyser(); else if (scriptName == "scripts\\ai\\GF\\L_PIRATE_REP.lua") script = new PirateRep(); + else if (scriptName == "scripts\\ai\\GF\\L_GF_PARROT_CRASH.lua") + script = new GfParrotCrash(); // SG else if (scriptName == "scripts\\ai\\MINIGAME\\SG_GF\\SERVER\\SG_CANNON.lua") diff --git a/dScripts/GfParrotCrash.cpp b/dScripts/GfParrotCrash.cpp new file mode 100644 index 00000000..6b76a51d --- /dev/null +++ b/dScripts/GfParrotCrash.cpp @@ -0,0 +1,13 @@ +#include "GfParrotCrash.h" +#include "SkillComponent.h" +#include "Entity.h" +#include "dLogger.h" + +void GfParrotCrash::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { + auto* skillComponent = self->GetComponent(); + if (args == "Slow") { + skillComponent->CalculateBehavior(m_SlowSkillID, m_SlowBehaviorID, sender->GetObjectID()); + } else if (args == "Unslow") { + skillComponent->CalculateBehavior(m_UnslowSkillID, m_UnslowBehaviorID, sender->GetObjectID()); + } +} diff --git a/dScripts/GfParrotCrash.h b/dScripts/GfParrotCrash.h new file mode 100644 index 00000000..fe70a16c --- /dev/null +++ b/dScripts/GfParrotCrash.h @@ -0,0 +1,13 @@ +#pragma once +#include "CppScripts.h" + +class GfParrotCrash : 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 uint32_t m_SlowSkillID = 795; + const uint32_t m_SlowBehaviorID = 14214; + const uint32_t m_UnslowSkillID = 796; + const uint32_t m_UnslowBehaviorID = 14215; +}; +