diff --git a/Source/Contents/Actors/MercenaryAI.cpp b/Source/Contents/Actors/MercenaryAI.cpp new file mode 100644 index 0000000..415c25b --- /dev/null +++ b/Source/Contents/Actors/MercenaryAI.cpp @@ -0,0 +1,18 @@ +#include "Contents/Actors/MercenaryAI.h" + +extern "C" { +#include +} + +// OFFSET: 0x00D9E3F0 + +// OFFSET: 0x00D9E430 + +// OFFSET: 0x00D9E570 +// FUNCTION: fn_22331 +void CMercenaryAI::Shutdown() { + if (this->state) { + lua_close(this->state); + this->state = nullptr; + } +} diff --git a/Source/Contents/Actors/MercenaryAI.h b/Source/Contents/Actors/MercenaryAI.h new file mode 100644 index 0000000..a63f496 --- /dev/null +++ b/Source/Contents/Actors/MercenaryAI.h @@ -0,0 +1,32 @@ +#ifndef RAGNAROK_SOURCE_CONTENTS_ACTORS_MERCENARYAI_H +#define RAGNAROK_SOURCE_CONTENTS_ACTORS_MERCENARYAI_H + +#include +#include + +struct lua_State; + +class CMercenaryAI { +public: + /* 0004 */ lua_State* state; + /* 0008 */ std::uint32_t actionStarted; + /* 000C */ std::uint32_t actionDuration; + /* 0010 */ int kind; + /* 0014 */ std::uint32_t lastTick; + + virtual ~CMercenaryAI(); + + explicit CMercenaryAI(int kind); + void Shutdown(); +}; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(CMercenaryAI) == 0x18); +static_assert(offsetof(CMercenaryAI, state) == 0x4); +static_assert(offsetof(CMercenaryAI, actionStarted) == 0x8); +static_assert(offsetof(CMercenaryAI, actionDuration) == 0xC); +static_assert(offsetof(CMercenaryAI, kind) == 0x10); +static_assert(offsetof(CMercenaryAI, lastTick) == 0x14); +#endif + +#endif diff --git a/compile.json b/compile.json index 6c5879a..777aa63 100644 --- a/compile.json +++ b/compile.json @@ -266,6 +266,7 @@ "Source/Contents/ActorNameDirectory.cpp": 4, "Source/Contents/Actors/AttackMotion.cpp": 4, "Source/Contents/Actors/GameObject.cpp": 4, + "Source/Contents/Actors/MercenaryAI.cpp": 4, "Source/Contents/Actors/RenderObject.cpp": 4, "Source/Contents/Actors/RenderObjectState.cpp": 4, "Source/Contents/Actors/SpriteDrawingPolicy.cpp": 4,