rodecomp/Source/Contents/ReputeMgr.cpp
ragnarok-clanker 3f81146835 Decompile 7 functions in Source/Contents/ReputeMgr.cpp, Source/Contents/ReputeMgr.h, ...
Batch #4498 by youko: 1 byte-identical, 6 confirmed by peer review.

- fn_04290 CReputeMgr::GetGroupNames: logic confirmed by peer review
- fn_04291 CReputeMgr::GetGroupReputes: logic confirmed by peer review
- fn_04292 CReputeMgr::GetAllReputes: logic confirmed by peer review
- fn_04297 CReputeMgr::SetPoint: logic confirmed by peer review
- fn_04298 CReputeMgr::FindReputes: logic confirmed by peer review
- fn_04299 CReputeMgr::SetPointsReceived: logic confirmed by peer review
- fn_04312 UIReputeWnd::Slot02: byte-identical

Peer-reviewed-by: eAthena, willerthal, KWDev
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
Adds to the build: Source/Contents/ReputeMgr.cpp, Source/UI/UIReputeWnd.cpp
2026-10-30 03:37:37 +00:00

99 lines
2.9 KiB
C++

#include "Contents/ReputeMgr.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/UIWindowMgr.h"
#include <algorithm>
#include <utility>
// OFFSET: 0x0060D8B0
// FUNCTION: fn_04290
std::vector<std::string> CReputeMgr::GetGroupNames() const {
std::vector<std::string> names;
std::for_each(this->m_groups.begin(), this->m_groups.end(), [&names](std::pair<const std::uint64_t, ReputeGroup> group) {
names.push_back(group.second.name);
});
return names;
}
// OFFSET: 0x0060D930
// FUNCTION: fn_04291
std::vector<const ReputeInfo*> CReputeMgr::GetGroupReputes(const std::string& groupName) const {
std::vector<const ReputeInfo*> reputes;
for (auto group = this->m_groups.begin(); group != this->m_groups.end(); ++group) {
if (group->second.name == groupName) {
for (auto id = group->second.reputes.begin(); id != group->second.reputes.end(); ++id) {
auto found = this->m_infos.find(*id);
if (found == this->m_infos.end()) {
continue;
}
const ReputeInfo& info = found->second;
if (info.visibility == REPUTE_VISIBLE || (info.visibility == REPUTE_VISIBLE_WITH_POINT && info.point != 0)) {
reputes.push_back(&info);
}
}
}
}
return reputes;
}
// OFFSET: 0x0060DAB0
// FUNCTION: fn_04292
std::vector<const ReputeInfo*> CReputeMgr::GetAllReputes() const {
std::vector<const ReputeInfo*> reputes;
for (auto group = this->m_groups.begin(); group != this->m_groups.end(); ++group) {
for (auto id = group->second.reputes.begin(); id != group->second.reputes.end(); ++id) {
auto found = this->m_infos.find(*id);
if (found == this->m_infos.end()) {
continue;
}
const ReputeInfo& info = found->second;
if (info.visibility == REPUTE_VISIBLE || (info.visibility == REPUTE_VISIBLE_WITH_POINT && info.point != 0)) {
reputes.push_back(&info);
}
}
}
return reputes;
}
// OFFSET: 0x0060E5B0
// FUNCTION: fn_04297
void CReputeMgr::SetPoint(std::uint64_t id, std::int64_t point) {
auto found = this->m_infos.find(id);
if (found != this->m_infos.end()) {
found->second.point = point;
}
}
// OFFSET: 0x0060E610
// FUNCTION: fn_04298
std::vector<const ReputeInfo*> CReputeMgr::FindReputes(const std::string& keyword) const {
std::vector<const ReputeInfo*> reputes;
for (auto entry = this->m_infos.begin(); entry != this->m_infos.end(); ++entry) {
const ReputeInfo& info = entry->second;
if (info.name.find(keyword) == std::string::npos) {
continue;
}
if (info.visibility == REPUTE_VISIBLE || (info.visibility == REPUTE_VISIBLE_WITH_POINT && info.point != 0)) {
reputes.push_back(&info);
}
}
return reputes;
}
// OFFSET: 0x0060E830
// FUNCTION: fn_04299
void CReputeMgr::SetPointsReceived(bool received) {
this->m_waitingForPoints = !received;
if (received == true) {
UIWindow* window = g_windowMgr.LookupWindow(346);
if (window) {
window->SendMsg(nullptr, 136, 0, 0, 0, 0);
}
}
}