From 2d7d8f45f430ebb71227bda47f670de4af5aa570 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 18:04:12 +0000 Subject: [PATCH] Decompile fn_05257 (AdventureGuideEntry::IsAvailable) Batch #5930 by ntrl: 0 byte-identical, 1 confirmed by peer review. - fn_05257 AdventureGuideEntry::IsAvailable: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, KWDev, Snow, System4z Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/AdventureGuideMgr.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Source/Contents/AdventureGuideMgr.cpp b/Source/Contents/AdventureGuideMgr.cpp index 907a52f8..5fa70e1e 100644 --- a/Source/Contents/AdventureGuideMgr.cpp +++ b/Source/Contents/AdventureGuideMgr.cpp @@ -1612,3 +1612,25 @@ bool CAdventureGuideMgr::IsAvailable(int type, int id) const { } // OFFSET: 0x00667510 +// FUNCTION: fn_05257 +bool AdventureGuideEntry::IsAvailable(int itemId) const { + if (g_session.m_level < this->unknown_0004 || this->unknown_0008 < g_session.m_level) { + return false; + } + + int code = 0; + g_luaScript->Call("GetEquipJob", "d>d", itemId, &code); + if (!CJobCodeForItem::s_instance) { + CJobCodeForItem::s_instance = new (std::nothrow) CJobCodeForItem; + } + CJobCodeForItem* jobs = CJobCodeForItem::s_instance; + if (code == 0xFFFFE) { + const auto group = jobs->m_jobGroups.find(0); + return group != jobs->m_jobGroups.end() && group->second.find(g_session.m_job) == group->second.end(); + } + if (code == 0xFFFFF) { + return true; + } + const auto found = jobs->m_jobCodes.find(code); + return found != jobs->m_jobCodes.end() && found->second.find(g_session.m_job) != found->second.end(); +}