rodecomp/Source/UI/Party/UIPartyInfoWnd.cpp
ragnarok-clanker 8b3ba20b56 Maintenance: [forced, user-approved] Family G9: remove the adventurer-agency bundle family: AgencyRequestContext, StopRecruitingConte
Batch #10208 by ragnarok-clanker: forced by an admin (10 lower score(s), 42 changed function(s)); checked with 119 compiled unit(s), including every includer of Source/Client/ModeBaseEvents.h, Source/Contents/Async/AsyncWorkMgr.h, Source/Contents/Configuration/ServiceConfiguration.h, Source/Contents/Party/AdventurerAgencyMgr.h, Source/Contents/Party/LoadPartyInfoAsyncWork.h, Source/Contents/Party/PartyJoinResult.h, Source/Contents/Party/RegisterPartyAsyncWork.h, Source/Contents/Party/StopRecruitingAsyncWork.h, Source/UI/Party/UIAdvenPartyBoardWnd.h, Source/UI/Party/UIApplyForPartyWnd.h, Source/UI/Party/UIPartyInfoWnd.h, Source/UI/Party/UIRegisterPartyWnd.h, Source/Contents/Party/AgencyRequestContext.h.
Deletes: Source/Contents/Party/AgencyRequestContext.h
2026-11-02 22:46:30 +00:00

140 lines
4.2 KiB
C++

#include "Client/Session.h"
#include "Contents/MessageTable.h"
#include "File/ShortcutFilename.h"
#include "Render/DeviceContext/DeviceContext.h"
#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "UI/Text/TextFitting.h"
#include "UI/Party/UIPartyInfoWnd.h"
#include "UI/Window/UIWindowMgr.h"
#include <cstdio>
// OFFSET: 0x007BAE20
// FUNCTION: fn_09277
UIPartyInfoWnd::UIPartyInfoWnd(UIWindowContext& windows)
: UIBitmapButton(windows), tanker(0), dealer(0), healer(0), assist(0) {
this->m_drawLabel = 0;
}
// OFFSET: 0x007BB740
UIPartyInfoWnd::~UIPartyInfoWnd() = default;
// OFFSET: 0x007BBEF0
// FUNCTION: fn_09293
CAdvenPartyInfo* UIPartyInfoWnd::Info() {
return &this->info;
}
// OFFSET: 0x007BBF00
// FUNCTION: fn_09294
const char* UIPartyInfoWnd::TypeName(int value) {
if (value == 0) {
return LookupMessage(3377);
}
return value >= 1 && value <= 6 ? LookupMessage(3359 + value) : "";
}
// OFFSET: 0x007C1E20
// FUNCTION: fn_09320
void UIPartyInfoWnd::SetInfo(const CAdvenPartyInfo& value) {
this->m_disabled = 0;
this->m_drawLabel = 1;
this->memo = value.memo;
char text[10] = {};
_snprintf_s(text, sizeof(text), _TRUNCATE, "%d~%d", value.minimumLevel, value.maximumLevel);
this->levels = text;
this->tanker = value.tanker;
this->healer = value.healer;
this->dealer = value.dealer;
this->assist = value.assist;
this->type = value.type;
this->name = value.characterName;
this->info = value;
}
// INLINED
void UIPartyInfoWnd::Reset() {
this->m_drawLabel = 0;
this->memo.clear();
this->levels.clear();
this->tanker = 1;
this->dealer = 1;
this->assist = 1;
this->type = 0;
this->name.clear();
this->m_disabled = 1;
this->Invalidate();
}
// OFFSET: 0x007BF8C0
// FUNCTION: fn_09304
void UIPartyInfoWnd::Paint() {
this->geometry.surface->Fill(nullptr, 0xFFFF00FFu);
if (this->m_drawLabel == 0) {
return;
}
CBitmapRes* background = nullptr;
if (this->geometry.unknown_0030 <= 2) {
background = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(this->m_names[this->geometry.unknown_0030].c_str()));
}
if (this->m_disabled != 0 && !this->m_names[3].empty()) {
background = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(this->m_names[3].c_str()));
}
if (background) {
this->DrawBitmap(0, 0, &background->image, false);
}
const auto text = [&](int x, const char* value, int bytes = 0) { this->DrawTextAt(x, 5, value, bytes, 0, 12, 0, 0, 0); };
text(11, this->levels.c_str());
text(64, TypeName(this->type));
constexpr char prefix[] = "유저인터페이스\\UIadventurerAgency\\";
const char* jobs[] = {"def", "heal", "atk", "buf"};
const bool flags[] = {this->info.tanker, this->info.healer, this->info.dealer, this->info.assist};
for (int index = 0; index < 4; ++index) {
const std::string path = std::string(prefix) + "btn_job_" + jobs[index] + (flags[index] ? "_on.bmp" : "_off.bmp");
auto* resource = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(path.c_str()));
this->DrawBitmap(109 + index * 18, 3, resource ? &resource->image : nullptr, false);
}
const std::string fitted = FitText(*this->geometry.surface, this->name, 119);
text(192, fitted.c_str(), static_cast<int>(fitted.size()));
text(315, this->memo.c_str(), static_cast<int>(this->memo.size()));
if (this->m_invalidateParent != 0 && this->parent) {
this->parent->Invalidate();
}
}
// OFFSET: 0x007BFCA0
// FUNCTION: fn_09308
void UIPartyInfoWnd::Slot31(int x, int y) {
if (this->m_disabled == 0) {
this->UIButton::Slot31(x, y);
}
}
// OFFSET: 0x007BFE90
// FUNCTION: fn_09310
void UIPartyInfoWnd::Slot33(int, int) {
if (this->m_disabled != 0 || this->info.accountId == g_session.m_aid || this->info.characterId == g_session.m_gid) {
return;
}
const std::string name = this->info.characterName;
const char* relationship = g_windowMgr.IsFriend(name.c_str()) ? LookupMessage(102) : nullptr;
if (g_session.IsGuildMemberAccount(this->info.accountId)) {
relationship = "GuildMember";
}
const std::string code = ShortcutFilename(this->info.characterId);
g_windowMgr.SendNotice(14, reinterpret_cast<std::intptr_t>(name.c_str()), reinterpret_cast<std::intptr_t>(relationship), reinterpret_cast<std::intptr_t>(code.c_str()), 0, 0);
}