Decompile 2 functions in Source/Contents/AdventureGuideMgr.cpp, Source/Contents/AdventureGuideMgr.h, ...

Batch #1377 by Yommy: 0 byte-identical, 2 confirmed by peer review.

- fn_05237 CAdventureGuideMgr::GetEpisodeList: logic confirmed by peer review
- fn_05238 CAdventureGuideMgr::GetContentsList: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-28 12:06:16 +00:00
commit 648ae44d9d
3 changed files with 69 additions and 1 deletions

View file

@ -58,7 +58,9 @@ public:
/* 1058 */ int m_petActionTable[5][5][7];
/* 1314 */ unsigned char unknown_1314[0x314];
/* 1628 */ int m_job;
/* 162C */ unsigned char unknown_162C[0xE4];
/* 162C */ unsigned char unknown_162C[0x24];
/* 1650 */ int m_level;
/* 1654 */ unsigned char unknown_1654[0xBC];
/* 1710 */ std::list<ItemInfo> m_inventoryItems;
/* 1718 */ unsigned char unknown_1718[0x1438];
/* 2B50 */ ItemInfo unknown_2B50[10];
@ -130,6 +132,7 @@ static_assert(sizeof(SessionRecord6144) == 0x38);
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_level) == 0x1650);
static_assert(offsetof(CSession, m_skillBundle) == 0xC);
static_assert(offsetof(CSession, m_homunSkills) == 0x84);
static_assert(offsetof(CSession, m_mercSkills) == 0x8C);

View file

@ -1,8 +1,23 @@
#include "Contents/AdventureGuideMgr.h"
#include "Client/Session.h"
#include <algorithm>
#include <iterator>
#include <optional>
// GLOBAL: gl_24502
CAdventureGuideMgr* g_adventureGuideMgr;
template <class Map>
static std::optional<typename Map::mapped_type*> FindMapped(Map& map, const typename Map::key_type& key) {
auto it = map.find(key);
if (it == map.end()) {
return std::nullopt;
}
return &it->second;
}
// OFFSET: 0x00660F70
// FUNCTION: fn_05222
CAdventureGuideMgr::CAdventureGuideMgr() : m_initialized(true) {
@ -21,3 +36,49 @@ void CAdventureGuideMgr::Destroy() {
g_adventureGuideMgr = nullptr;
}
}
// OFFSET: 0x00663890
// FUNCTION: fn_05237
void CAdventureGuideMgr::GetEpisodeList(std::list<AdventureGuideEpisode>& out) {
out.clear();
for (const AdventureGuideEpisode& episode : m_episodes) {
if (episode.order <= g_session.m_level && g_session.m_level <= episode.unknown_001C) {
out.push_back(episode);
}
}
}
// OFFSET: 0x006639D0
// FUNCTION: fn_05238
void CAdventureGuideMgr::GetContentsList(std::list<std::pair<int, AdventureGuideContents>>& out, int type, int id) {
out.clear();
std::map<int, std::map<int, AdventureGuideContents>>* table;
switch (type) {
case 1:
table = &unknown_003C;
break;
case 3:
table = &unknown_0044;
break;
case 4:
table = &unknown_004C;
break;
default:
return;
}
std::optional<std::map<int, AdventureGuideContents>*> contents = FindMapped(*table, id);
if (!contents) {
return;
}
std::copy_if((*contents)->begin(), (*contents)->end(), std::back_inserter(out),
[](const std::pair<const int, AdventureGuideContents>& entry) {
return entry.second.unknown_0004 <= g_session.m_level && g_session.m_level <= entry.second.unknown_0008;
});
out.sort([](const std::pair<int, AdventureGuideContents>& lhs, const std::pair<int, AdventureGuideContents>& rhs) {
return lhs.second.unknown_0004 < rhs.second.unknown_0004;
});
}

View file

@ -8,6 +8,7 @@
#include <list>
#include <map>
#include <string>
#include <utility>
#include <vector>
struct AdventureGuideDetail {
@ -75,6 +76,9 @@ public:
CAdventureGuideMgr();
virtual ~CAdventureGuideMgr();
void GetEpisodeList(std::list<AdventureGuideEpisode>& out);
void GetContentsList(std::list<std::pair<int, AdventureGuideContents>>& out, int type, int id);
};
extern CAdventureGuideMgr* g_adventureGuideMgr;