From 5728e103c3e230b36114b80a7b61d8ea40c06dd7 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 05:54:13 +0000 Subject: [PATCH] Decompile 7 functions in Source/Client/SessionPredicates.cpp, Source/Client/Session.h Batch #4672 by eAthena: 0 byte-identical, 7 confirmed by peer review. - fn_23850 CSession::IsState291To303: logic confirmed by peer review - fn_23852 CSession::IsType0Or4: logic confirmed by peer review - fn_23879 CSession::IsMonsterActor: logic confirmed by peer review - fn_23880 CSession::IsLocalPlayerAid: logic confirmed by peer review - fn_23881 CSession::IsHomunAid: logic confirmed by peer review - fn_23882 CSession::IsMercenaryAid: logic confirmed by peer review - fn_23885 CSession::IsPetAid: logic confirmed by peer review Peer-reviewed-by: youko, Bruwuno Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). Adds to the build: Source/Client/SessionPredicates.cpp --- Source/Client/Session.h | 8 +++ Source/Client/SessionPredicates.cpp | 89 +++++++++++++++++++++++++++++ data/compile.json | 1 + 3 files changed, 98 insertions(+) create mode 100644 Source/Client/SessionPredicates.cpp diff --git a/Source/Client/Session.h b/Source/Client/Session.h index 24f36554..5c1c6220 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -19,6 +19,7 @@ #include class CActRes; +class CGameActor; class CRenderObject; class LuaScript; struct JobNameInitialization; @@ -359,6 +360,13 @@ public: int GetMapProperty12() const; int GetMapProperty13() const; bool HasUnknown6178Records() const; + int IsState291To303(int state) const; + int IsType0Or4(int type) const; + int IsMonsterActor(CGameActor* actor) const; + int IsLocalPlayerAid(std::uint32_t aid) const; + bool IsHomunAid(std::uint32_t aid) const; + bool IsMercenaryAid(std::uint32_t aid) const; + bool IsPetAid(std::uint32_t aid) const; bool IsEquipItemType(int type) const; bool IsMiscItemType(int type) const; bool IsSuperNoviceJob(int job) const; diff --git a/Source/Client/SessionPredicates.cpp b/Source/Client/SessionPredicates.cpp new file mode 100644 index 00000000..b9d1dbcf --- /dev/null +++ b/Source/Client/SessionPredicates.cpp @@ -0,0 +1,89 @@ +#include "Client/Mode/CGameMode.h" +#include "Client/Mode/ModeMgr.h" +#include "Client/Session.h" +#include "Contents/Actors/GameActor.h" +#include "Contents/Actors/Pc.h" +#include "Contents/World/World.h" + +#include + +// OFFSET: 0x00E1D6B0 +// FUNCTION: fn_23850 +int CSession::IsState291To303(int state) const { + switch (state) { + case 291: + case 292: + case 293: + case 294: + case 295: + case 297: + case 298: + case 299: + case 300: + case 301: + case 302: + case 303: + return 1; + default: + return 0; + } +} + +// OFFSET: 0x00E1D850 +// FUNCTION: fn_23852 +int CSession::IsType0Or4(int type) const { + if (type == 0 || type == 4) { + return 1; + } + return 0; +} + +// OFFSET: 0x00E1DD50 +// FUNCTION: fn_23879 +int CSession::IsMonsterActor(CGameActor* actor) const { + if (!actor) { + return 0; + } + + const int job = actor->GetEffectiveJob(-1); + if ((job > 1000 && job < 4000) || (job >= 20021 && job <= 31999)) { + return 1; + } + + if (actor->GetEffectiveJob(-1) >= 2114) { + actor->GetEffectiveJob(-1); + } + return 0; +} + +// OFFSET: 0x00E1DDB0 +// FUNCTION: fn_23880 +int CSession::IsLocalPlayerAid(std::uint32_t aid) const { + if (aid == 0) { + return 0; + } + + CPlayer* player = static_cast(g_modeMgr.GetGameMode())->scene->player; + if (player && aid == static_cast(player->Slot50())) { + return 1; + } + return 0; +} + +// OFFSET: 0x00E1DDF0 +// FUNCTION: fn_23881 +bool CSession::IsHomunAid(std::uint32_t aid) const { + return aid != 0xFFFFFFFF && aid == *reinterpret_cast(&this->unknown_5570[8]); +} + +// OFFSET: 0x00E1DE10 +// FUNCTION: fn_23882 +bool CSession::IsMercenaryAid(std::uint32_t aid) const { + return aid != 0xFFFFFFFF && aid == *reinterpret_cast(&this->unknown_5620[8]); +} + +// OFFSET: 0x00E1DF00 +// FUNCTION: fn_23885 +bool CSession::IsPetAid(std::uint32_t aid) const { + return aid != 0xFFFFFFFF && aid == this->unknown_1010; +} diff --git a/data/compile.json b/data/compile.json index fc9aa423..750d436f 100644 --- a/data/compile.json +++ b/data/compile.json @@ -280,6 +280,7 @@ "Source/Client/ReplayPacketRecorder.cpp": 2, "Source/Client/Session.cpp": 0, "Source/Client/SessionParty.cpp": 0, + "Source/Client/SessionPredicates.cpp": 0, "Source/Client/Stove/StoveMgr.cpp": 0, "Source/Client/Timer.cpp": 0, "Source/Contents/AchievementMgr.cpp": 4,