diff --git a/Source/Client/Session.h b/Source/Client/Session.h index 06ac95b..1c75307 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -178,7 +178,9 @@ public: /* 6198 */ const char* const* m_doramFemaleHeadNames; /* 619C */ unsigned char unknown_619C[0x1D44]; /* 7EE0 */ std::map m_robeAlpha; - /* 7EE8 */ unsigned char unknown_7EE8[0xC0]; + /* 7EE8 */ unsigned char unknown_7EE8[0x94]; + /* 7F7C */ bool m_homunculusAutoFeed; + /* 7F7D */ unsigned char unknown_7F7D[0x2B]; /* 7FA8 */ CInstantVar m_options; /* 7FB4 */ unsigned char unknown_7FB4[0xC0]; /* 8074 */ int unknown_8074; @@ -271,6 +273,8 @@ public: void LoadXmlTables(); std::string GetAccessoryName(int id); void CollectCardItems(); + void SetHomunculusAutoFeed(bool enabled); + void SetPetAutoFeed(bool enabled); int GetRobeAlpha(int robeId); bool IsTopLayerRobe(int robe); int IsSkillIdInRange6018(unsigned id) const; @@ -303,6 +307,7 @@ static_assert(offsetof(CSession, m_prohibitionLog) == 0x754); static_assert(offsetof(SessionRecord6144, unknown_002C) == 0x2C); static_assert(offsetof(SessionRecord6144, unknown_0030) == 0x30); static_assert(offsetof(CSession, m_additionalSkills) == 0x4); +static_assert(offsetof(CSession, m_homunculusAutoFeed) == 0x7F7C); static_assert(offsetof(CSession, m_options) == 0x7FA8); static_assert(offsetof(CSession, m_nameToId) == 0x80B4); static_assert(offsetof(CSession, m_level) == 0x1650); diff --git a/Source/Contents/ClientState.cpp b/Source/Contents/ClientState.cpp index 0129be8..cfe416a 100644 --- a/Source/Contents/ClientState.cpp +++ b/Source/Contents/ClientState.cpp @@ -1,9 +1,40 @@ #include "Contents/ClientState.h" #include "Client/Session.h" +#include "Contents/MessageTable.h" #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" +#include + +// GLOBAL: gl_24492 +bool g_homunculusAutoFeed; + +// GLOBAL: gl_24493 +bool g_petAutoFeed; + +// OFFSET: 0x00E48930 +// FUNCTION: fn_24222 +void CSession::SetHomunculusAutoFeed(bool enabled) { + int message; + if (enabled == true) { + this->m_homunculusAutoFeed = true; + message = 3282; + } else { + g_homunculusAutoFeed = false; + message = 3283; + } + + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(message)), 0x64FFFF, 0, 0, 0); +} + +// OFFSET: 0x00E48980 +// FUNCTION: fn_24223 +void CSession::SetPetAutoFeed(bool enabled) { + g_petAutoFeed = enabled == true; + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(enabled ? 2579 : 2580)), 0x64FFFF, 0, 0, 0); +} + // OFFSET: 0x00E48B00 // FUNCTION: fn_24225 void CSession::CollectCardItems() { diff --git a/Source/Contents/ClientState.h b/Source/Contents/ClientState.h index e915454..6bf911f 100644 --- a/Source/Contents/ClientState.h +++ b/Source/Contents/ClientState.h @@ -1,6 +1,9 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_CLIENTSTATE_H #define RAGNAROK_SOURCE_CONTENTS_CLIENTSTATE_H +extern bool g_homunculusAutoFeed; +extern bool g_petAutoFeed; + void RequestBasicInfoRefresh(); #endif