Decompile 4 functions in Source/Contents/Messenger/ClientMessenger.cpp
Batch #6043 by superintelligence: 0 byte-identical, 4 confirmed by peer review. - fn_05621 EquipmentProperties::CEquipmentWearable::UpdateActive: logic confirmed by peer review - fn_06206 EquipmentProperties::CEquipmentPropertiesMgr::RefreshShop: logic confirmed by peer review - fn_23398 FindShop: logic confirmed by peer review - fn_23485 FindShopId: logic confirmed by peer review Peer-reviewed-by: eAthena, SapitoSucio Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
d7d78cd3a9
commit
e25efe0708
1 changed files with 69 additions and 0 deletions
|
|
@ -353,6 +353,7 @@ namespace EquipmentProperties {
|
|||
int GetUnknown01BC(const int& first, const int& second, const unsigned int& third);
|
||||
void SetCurrentEquipment(CEquipment* equipment);
|
||||
void RefreshPretend();
|
||||
void RefreshShop();
|
||||
void Rebuild();
|
||||
void GetDescriptions(const int& group, std::list<std::string>& lines);
|
||||
void ApplyProperty(const char* name, lua_State* state, const int& count, const int& valuePosition, const int& indexPosition, const int& keyPosition);
|
||||
|
|
@ -422,6 +423,7 @@ namespace EquipmentProperties {
|
|||
|
||||
std::vector<CEquipmentAttachable>& GetAttachables();
|
||||
bool IsActive();
|
||||
__declspec(noinline) bool UpdateActive();
|
||||
};
|
||||
|
||||
class CEquipmentExpansion : public CEquipment {
|
||||
|
|
@ -729,6 +731,43 @@ void EquipmentProperties::CEquipment::AddProperty(const std::string& name, const
|
|||
this->m_properties += &property;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00DDE720
|
||||
// FUNCTION: fn_23398
|
||||
SessionShop* FindShop(CSession& session, const int& shopId) {
|
||||
const auto found = session.m_shops.lower_bound(shopId);
|
||||
if (found == session.m_shops.end() || shopId < found->first) {
|
||||
return nullptr;
|
||||
}
|
||||
return &found->second;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00DE3B10
|
||||
// FUNCTION: fn_23485
|
||||
int FindShopId(CSession& session, std::string name) {
|
||||
if (name.empty()) {
|
||||
name = session.m_navigationPlayerMap;
|
||||
}
|
||||
|
||||
const auto found = session.m_nameToId.lower_bound(name);
|
||||
if (found == session.m_nameToId.end() || name < found->first) {
|
||||
return -1;
|
||||
}
|
||||
return found->second;
|
||||
}
|
||||
|
||||
// OFFSET: 0x0068BDB0
|
||||
// FUNCTION: fn_05621
|
||||
bool EquipmentProperties::CEquipmentWearable::UpdateActive() {
|
||||
const bool previous = this->m_active;
|
||||
SessionShop* shop = FindShop(g_session, FindShopId(g_session, std::string()));
|
||||
if (shop != nullptr && !shop->unknown_0004.empty()) {
|
||||
this->m_active = shop->unknown_0004[0].find(this->m_id) != shop->unknown_0004[0].end();
|
||||
} else {
|
||||
this->m_active = true;
|
||||
}
|
||||
return previous != this->m_active;
|
||||
}
|
||||
|
||||
// OFFSET: 0x0068BEA0
|
||||
// FUNCTION: fn_05622
|
||||
void EquipmentProperties::CEquipment::CallOnStartEquip(lua_State* state) {
|
||||
|
|
@ -2104,6 +2143,36 @@ void EquipmentProperties::CEquipmentPropertiesMgr::RefreshExpansion(const int& k
|
|||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x006B7390
|
||||
// FUNCTION: fn_06206
|
||||
void EquipmentProperties::CEquipmentPropertiesMgr::RefreshShop() {
|
||||
const int shopId = FindShopId(g_session, std::string());
|
||||
if (this->unknown_0014 != shopId) {
|
||||
for (auto& entry : this->properties1) {
|
||||
CEquipmentWearable* equipment = entry.second;
|
||||
const bool previous = equipment->IsActive();
|
||||
this->m_dirty |= equipment->UpdateActive();
|
||||
if (previous != equipment->IsActive()) {
|
||||
if (equipment->IsActive()) {
|
||||
this->EquipItem(equipment->GetId(), false);
|
||||
for (CEquipmentAttachable& attachable : equipment->GetAttachables()) {
|
||||
this->EquipItem(attachable.GetId(), false);
|
||||
}
|
||||
} else {
|
||||
for (CEquipmentAttachable& attachable : equipment->GetAttachables()) {
|
||||
this->UnequipItem(attachable.GetId(), false);
|
||||
}
|
||||
this->UnequipItem(equipment->GetId(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this->unknown_0014 = shopId;
|
||||
if (this->unknown_0020 != nullptr) {
|
||||
this->unknown_0020->SendMsg(nullptr, 0x3C, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x006B7530
|
||||
// FUNCTION: fn_06207
|
||||
void EquipmentProperties::CEquipmentPropertiesMgr::Rebuild() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue