rodecomp/Source/Client/Session.cpp
ragnarok-clanker 574f7ad757 Decompile 18 functions in Source/Client/Session.cpp, Source/Client/Session.h
Batch #2146 by ragnarok-clanker: 0 byte-identical, 18 confirmed by peer review.

- fn_23402 CSession::FindItem1768: logic confirmed by peer review
- fn_23403 CSession::GetItem1768At: logic confirmed by peer review
- fn_23404 CSession::GetItem1768Quantity: logic confirmed by peer review
- fn_23405 CSession::FindItem1740: logic confirmed by peer review
- fn_23406 CSession::GetItem1740At: logic confirmed by peer review
- fn_23407 CSession::GetItem1740Quantity: logic confirmed by peer review
- fn_23408 CSession::FindItem1750: logic confirmed by peer review
- fn_23409 CSession::GetItem1750At: logic confirmed by peer review
- fn_23410 CSession::GetItem1750Quantity: logic confirmed by peer review
- fn_23411 CSession::FindItem1758: logic confirmed by peer review
- fn_23412 CSession::FindItem1758ByItemId: logic confirmed by peer review
- fn_23413 CSession::GetItem1758At: logic confirmed by peer review
- fn_23414 CSession::FindItem1760: logic confirmed by peer review
- fn_23416 CSession::GetItem1760At: logic confirmed by peer review
- fn_23418 CSession::GetItem1760Quantity: logic confirmed by peer review
- fn_23419 CSession::FindItem1770: logic confirmed by peer review
- fn_23420 CSession::GetItem1760Total: logic confirmed by peer review
- fn_23421 CSession::GetItem1748At: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
2026-10-29 14:39:01 +00:00

328 lines
6.6 KiB
C++

#include "Client/Session.h"
#include "Contents/Jobs/JobId.h"
#include "Network/TextEncoding.h"
#include <cstdlib>
#include <cstring>
#include <windows.h>
// STATIC: 0x01732638
// GLOBAL: gl_24474
CSession g_session;
// OFFSET: 0x00DDE860
// FUNCTION: fn_23401
int CSession::MercSkillLevel(int skillId) const {
const int index = skillId - 8200;
if (index > -1) {
return this->m_mercSkillLevels[index];
}
return 0;
}
// OFFSET: 0x00E13B00
// FUNCTION: fn_23826
int CSession::SyncUnknown0E98() {
if (this->unknown_0E98 != this->unknown_5558) {
this->unknown_0E98 = this->unknown_5558;
}
return this->unknown_0E98;
}
// OFFSET: 0x00DF9B90
// FUNCTION: fn_23562
int CSession::IsExchangeItemListFull() {
return this->GetFilledExchangeItemList() == 10;
}
// OFFSET: 0x00DFFCF0
// FUNCTION: fn_23633
void CSession::ClearItemSelection() {
for (ITEM_INFO& item : this->m_inventoryItems) {
if (item.unknown_0074[1] == 1) {
item.unknown_0074[1] = 0;
}
}
}
// OFFSET: 0x00E3CFF0
// FUNCTION: fn_24179
bool CSession::IsDoramJob(int job) const {
switch (job) {
case JT_TRIBE_DORAM:
case JT_DO_SUMMONER:
case JT_DO_CART_SUMMONER:
case JT_DO_SUMMONER_B:
case JT_DO_CART_SUMMONER_B:
case JT_SPIRIT_HANDLER:
case JT_SPIRIT_HANDLER_RIDING:
return true;
default:
return false;
}
}
// OFFSET: 0x00DFF1F0
// FUNCTION: fn_23614
char* CSession::ConvertTooltipText(const char* source, char* output) const {
if (output != source) {
std::strcpy(output, source);
}
for (char* current = output; *current != '\0'; current = CharNextExA(static_cast<WORD>(g_textCodePage), current, 0)) {
if (*current == '_') {
*current = ' ';
}
}
return output;
}
// OFFSET: 0x00DDE890
// FUNCTION: fn_23402
ITEM_INFO CSession::FindItem1768(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1768) {
if (item.unknown_0000[1] == id) {
return item;
}
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDE920
// FUNCTION: fn_23403
ITEM_INFO CSession::GetItem1768At(int index) const {
if (this->unknown_1768.empty()) {
return ITEM_INFO(0);
}
int position = 0;
for (const ITEM_INFO& item : this->unknown_1768) {
if (position == index) {
return item;
}
++position;
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDE9C0
// FUNCTION: fn_23404
int CSession::GetItem1768Quantity(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1768) {
if (item.unknown_0000[1] == id) {
return item.quantity;
}
}
return 0;
}
// OFFSET: 0x00DDE9F0
// FUNCTION: fn_23405
ITEM_INFO CSession::FindItem1740(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1740) {
if (item.unknown_0000[1] == id) {
return item;
}
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDEA80
// FUNCTION: fn_23406
ITEM_INFO CSession::GetItem1740At(int index) const {
if (this->unknown_1740.empty()) {
return ITEM_INFO(0);
}
int position = 0;
for (const ITEM_INFO& item : this->unknown_1740) {
if (position == index) {
return item;
}
++position;
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDEB20
// FUNCTION: fn_23407
int CSession::GetItem1740Quantity(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1740) {
if (item.unknown_0000[1] == id) {
return item.quantity;
}
}
return 0;
}
// OFFSET: 0x00DDEB50
// FUNCTION: fn_23408
ITEM_INFO CSession::FindItem1750(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1750) {
if (item.unknown_0000[1] == id) {
return item;
}
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDEBE0
// FUNCTION: fn_23409
ITEM_INFO CSession::GetItem1750At(int index) const {
if (this->unknown_1750.empty()) {
return ITEM_INFO(0);
}
int position = 0;
for (const ITEM_INFO& item : this->unknown_1750) {
if (position == index) {
return item;
}
++position;
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDEC80
// FUNCTION: fn_23410
int CSession::GetItem1750Quantity(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1750) {
if (item.unknown_0000[1] == id) {
return item.quantity;
}
}
return 0;
}
// OFFSET: 0x00DDECB0
// FUNCTION: fn_23411
ITEM_INFO CSession::FindItem1758(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1758) {
if (item.unknown_0000[1] == id) {
return item;
}
}
return ITEM_INFO();
}
// OFFSET: 0x00DDED40
// FUNCTION: fn_23412
ITEM_INFO CSession::FindItem1758ByItemId(int itemId) const {
for (const ITEM_INFO& item : this->unknown_1758) {
if (std::atoi(item.itemId.c_str()) == itemId) {
return item;
}
}
return ITEM_INFO();
}
// OFFSET: 0x00DDEDE0
// FUNCTION: fn_23413
ITEM_INFO CSession::GetItem1758At(int index) const {
if (this->unknown_1758.empty()) {
return ITEM_INFO(0);
}
int position = 0;
for (const ITEM_INFO& item : this->unknown_1758) {
if (position == index) {
return item;
}
++position;
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDEEB0
// FUNCTION: fn_23414
ITEM_INFO CSession::FindItem1760(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1760) {
if (item.unknown_0000[1] == id) {
return item;
}
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDF000
// FUNCTION: fn_23416
ITEM_INFO CSession::GetItem1760At(int index) const {
int position = 0;
for (const ITEM_INFO& item : this->unknown_1760) {
if (position == index) {
return item;
}
++position;
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDF0F0
// FUNCTION: fn_23418
int CSession::GetItem1760Quantity(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1760) {
if (item.unknown_0000[1] == id) {
return item.quantity;
}
}
return 0;
}
// OFFSET: 0x00DDF120
// FUNCTION: fn_23419
ITEM_INFO CSession::FindItem1770(std::uint32_t id) const {
for (const ITEM_INFO& item : this->unknown_1770) {
if (item.unknown_0000[1] == id) {
return item;
}
}
return ITEM_INFO(0);
}
// OFFSET: 0x00DDF1B0
// FUNCTION: fn_23420
long long CSession::GetItem1760Total() const {
long long total = 0;
for (const ITEM_INFO& item : this->unknown_1760) {
total += static_cast<long long>(item.quantity) * static_cast<int>(item.unknown_0014[1]);
}
return total;
}
// OFFSET: 0x00DDF200
// FUNCTION: fn_23421
ITEM_INFO CSession::GetItem1748At(int index) const {
if (this->unknown_1748.empty()) {
return ITEM_INFO(0);
}
int position = 0;
for (const ITEM_INFO& item : this->unknown_1748) {
if (position == index) {
return item;
}
++position;
}
return ITEM_INFO(0);
}