rodecomp/Source/Client/Mode/GameModeNames.cpp
ragnarok-clanker c932ad6499 Maintenance: Resubmission of 15134 without the 12 struct/type renames (their new names changed mangled symbols in 17 functions). Rena
Batch #15141 by ragnarok-clanker: no function's compiled code changes; checked with 537 compiled unit(s), including every includer of Source/Client/Input/LanguageTC.h, Source/Client/Mode/CGameMode.h, Source/Client/Mode/CLoginMode.h, Source/Client/Replay.h, Source/Client/Session.h, Source/Contents/AchievementMgr.h, Source/Contents/Actors/CharacterRender.h, Source/Contents/Actors/EffectActors.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/Pc.h, Source/Contents/EnchantMgr.h, Source/Contents/GuildInfo.h, Source/Contents/Messenger/MessengerWindows.h, Source/Contents/Schedule/TimeScheduler.h, Source/Contents/Sound/SoundMgr.h, Source/Contents/SpriteLayerDrawing.h, Source/Contents/TableMng.h, Source/Contents/World/SkyBox.h, Source/UI/Chat/UINewChatWnd.h, Source/UI/Text/CreateLineInfo.h, Source/UI/UIGradeEnchantWnd.h, Source/UI/Window/UINewSelectCharWnd.h, Source/UI/Window/UINewSkillListWnd.h, Source/UI/Window/UIPetInfoWnd.h, Source/UI/Window/UIReplayRECControlWnd.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl.
2026-11-09 12:21:09 +00:00

161 lines
3.8 KiB
C++

#include "Client/Application/Launcher.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Session.h"
#include "Contents/Actors/GameActor.h"
#include "Contents/GuildMgr.h"
#include "File/File.h"
#include <cstdio>
#include <cstring>
// GLOBAL: gl_24759
std::vector<int> g_monsterJobs;
// OFFSET: 0x00AD1C50
// FUNCTION: fn_17815
__declspec(noinline) void TraceSelectionRange(int first, int last) {
}
// OFFSET: 0x00AD1C70
// FUNCTION: fn_17816
__declspec(noinline) void TraceSelection(int selection) {
}
// OFFSET: 0x00DDC6F0
// FUNCTION: fn_23368
ITEM_INFO CSession::GetEquippedItemAt(int index) const {
if (index == 15) {
return LookupClientItemByIdentity(this->m_inventoryItems, this->equippedArrowIndex);
}
if (static_cast<unsigned int>(index) <= 9) {
return this->equippedItems[index];
}
return ITEM_INFO(0);
}
// OFFSET: 0x00E3D290
// FUNCTION: fn_24184
__declspec(noinline) unsigned char CSession::IsAllyActor(std::uint32_t aid, int job) {
CGameActor* actor = static_cast<CGameActor*>(this->FindGameActor(aid));
if (actor) {
switch (actor->objectType) {
case 1:
case 6:
case 12:
return 1;
}
}
return this->IsNpcJob(job);
}
// OFFSET: 0x00CD3400
// FUNCTION: fn_21263
std::uint32_t CGameMode::FindChatRoomActorId(std::uint32_t key) {
const auto found = this->chatRoomActorIds.find(key);
if (found != this->chatRoomActorIds.end()) {
return found->second;
}
return 0;
}
// OFFSET: 0x00CD3470
// FUNCTION: fn_21264
std::string CGameMode::ActorName(std::uint32_t id) {
return this->nameCard.Name(id);
}
// OFFSET: 0x00CD34D0
// FUNCTION: fn_21265
std::uint32_t CGameMode::ActorNameColor(int job, std::uint32_t aid) {
if (IsMonsterJob(aid)) {
return 0xFFFF;
}
if (MonsterJobColor(aid)) {
return MonsterJobColor(aid);
}
if (g_session.IsAllyActor(aid, job) == 1) {
return 0xF7B895;
}
if ((job > 1000 && job < 3999) || static_cast<unsigned int>(job - 20021) <= 11978) {
return 0xC3C3FF;
}
return 0xFFFFFF;
}
// OFFSET: 0x00CD3570
// FUNCTION: fn_21266
const CActorNameCard& CGameMode::LookupNameCard(std::uint32_t id) {
return this->nameCard.Lookup(id);
}
// OFFSET: 0x00CD3580
// FUNCTION: fn_21267
const char* CSession::GetDamageSkinAuxiliaryName() const {
return this->damageSkinAuxiliaryName.c_str();
}
// OFFSET: 0x00CD35A0
// FUNCTION: fn_21268
const char* CSession::GetDamageSpriteName() const {
return this->damageSpriteName.c_str();
}
// OFFSET: 0x00CD3A30
// FUNCTION: fn_21272
const char* CGameMode::DragItemName() {
switch (this->drag.source) {
case 2:
case 24: {
const ITEM_INFO item = g_session.GetEquippedItemAt(this->drag.slot);
return item.identity[1] > 0 ? item.itemId.c_str() : nullptr;
}
default:
if (this->drag.name.size() == 0) {
return nullptr;
}
return this->drag.name.c_str();
}
}
// OFFSET: 0x00CD3B10
// FUNCTION: fn_21273
bool CGameMode::AppendGuildEmblem(std::vector<char>& output, std::vector<std::string>& names, int guildId, int) {
if (guildId <= 0) {
return false;
}
char path[260];
std::memset(path, 0, sizeof(path));
std::string name = g_guildMgr->GetEmblemFilename(guildId);
for (const std::string& existing : names) {
if (std::strcmp(name.c_str(), existing.c_str()) == 0) {
return false;
}
}
std::sprintf(path, "%s\\_tmpEmblem\\%s", g_applicationDirectory, name.c_str());
CFile file;
if (!file.Open(path, 0, true, false)) {
file.Close();
return false;
}
const std::uint32_t size = file.GetSize();
output.resize(size + 4 + name.size(), 0);
*reinterpret_cast<std::uint32_t*>(output.data()) = static_cast<std::uint32_t>(name.size());
std::memcpy(output.data() + 4, name.c_str(), name.size());
file.Read(output.data() + name.size() + 4, size);
file.Close();
names.push_back(name);
return true;
}