From bcf4062a457ba761f043c3e900b79e1588e8ab42 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 29 Oct 2026 00:00:14 +0000 Subject: [PATCH] Decompile fn_23789 (CSession::GetMonsterSkillInfo) Batch #1927 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_23789 CSession::GetMonsterSkillInfo: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/Contents/MonsterXmlActions.cpp --- Source/Client/Session.h | 5 ++ Source/Contents/MonsterXmlActions.cpp | 85 +++++++++++++++++++++++++++ data/compile.json | 1 + 3 files changed, 91 insertions(+) create mode 100644 Source/Contents/MonsterXmlActions.cpp diff --git a/Source/Client/Session.h b/Source/Client/Session.h index 74f451ff..e5229788 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -269,6 +269,8 @@ public: CSkillInfo AdditionalSkillAt(int index) const; CSkillInfo HomunSkillAt(int index) const; void DeleteProhibitionLog(std::uint32_t aid, std::uint32_t minutes, WindowDialogs& dialogs); + int IsAdminSubMode(int subMode); + void GetMonsterSkillInfo(const char* monster, int skill, int* action, int* loopType, WindowDialogs& dialogs); const char* DecodePlayerName() const; void NotifyHomunSkillWindows(); void NotifyMercSkillWindows(); @@ -336,6 +338,9 @@ public: }; extern CSession g_session; +extern std::vector g_adminAccountIds; + +bool IsAdminAccount(int aid); #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(SessionRecord6144) == 0x38); diff --git a/Source/Contents/MonsterXmlActions.cpp b/Source/Contents/MonsterXmlActions.cpp new file mode 100644 index 00000000..97e52998 --- /dev/null +++ b/Source/Contents/MonsterXmlActions.cpp @@ -0,0 +1,85 @@ +#include "Client/Session.h" +#include "Contents/MessageTable.h" +#include "UI/Window/WindowDialogs.h" + +#include +#include +#include +#include + +// GLOBAL: gl_24750 +std::vector g_adminAccountIds; + +// OFFSET: 0x00AD1BE0 +// FUNCTION: fn_17812 +bool IsAdminAccount(int aid) { + for (int value : g_adminAccountIds) { + if (value == aid) { + return true; + } + } + + return false; +} + +// OFFSET: 0x00DFA390 +// FUNCTION: fn_23572 +int CSession::IsAdminSubMode(int subMode) { + if (IsAdminAccount(this->m_aid) && subMode == 7) { + return 1; + } + + return 0; +} + +// OFFSET: 0x00E09B50 +// FUNCTION: fn_23789 +void CSession::GetMonsterSkillInfo(const char* monster, int skill, int* action, int* loopType, WindowDialogs& dialogs) { + *action = -1; + + char tableName[21]; + std::memcpy(tableName, "Monster_Action_Table", sizeof(tableName)); + XmlNode* table = this->m_monsterSkillInfo.FindChild(DecodeMessageRot(tableName)); + if (!table) { + return; + } + + char number[8]; + char skillName[8]; + _itoa(skill, number, 10); + std::sprintf(skillName, "_%s", number); + + char monsterName[256]; + std::strcpy(monsterName, monster); + _strlwr(monsterName); + XmlNode* entry = table->FindChild(DecodeMessageRot(monsterName)); + if (!entry) { + return; + } + + XmlNode* skillNode = entry->FindChild(DecodeMessageRot(skillName)); + if (!skillNode) { + return; + } + + char fieldName[9]; + std::memcpy(fieldName, "action", 7); + XmlNode* actionNode = skillNode->FindChild(DecodeMessageRot(fieldName)); + std::memcpy(fieldName, "loopType", 9); + XmlNode* loopNode = skillNode->FindChild(DecodeMessageRot(fieldName)); + + if (this->IsAdminSubMode(1) && (!actionNode || !loopNode)) { + *action = 0; + *loopType = 0; + dialogs.Confirm("에러발생. 클라이언트 담당자 에게 에러 사실을 통보 하세요. 위치 - CPlayer :: GetMonsterSkillInfo", 0, true, false, 0, "Message", 280, 120, 0); + dialogs.Confirm("action 또는 loopType 이 존재하지 않음.", 0, true, false, 0, "Message", 280, 120, 0); + return; + } + + char actionText[8]; + char loopText[8]; + std::sprintf(actionText, DecodeMessageRot(const_cast(actionNode->Text().c_str()))); + std::sprintf(loopText, DecodeMessageRot(const_cast(loopNode->Text().c_str()))); + *action = std::atoi(actionText); + *loopType = std::atoi(loopText); +} diff --git a/data/compile.json b/data/compile.json index 07e845cb..94232066 100644 --- a/data/compile.json +++ b/data/compile.json @@ -380,6 +380,7 @@ "Source/Contents/Models/ModelTextureAnimation.cpp": 3, "Source/Contents/MonsterResources.cpp": 4, "Source/Contents/MonsterSpeech.cpp": 4, + "Source/Contents/MonsterXmlActions.cpp": 4, "Source/Contents/MovementRoute.cpp": 4, "Source/Contents/MovementRouteInterpolation.cpp": 4, "Source/Contents/Movies/BinkMovie.cpp": 3,