diff --git a/Source/Client/Session.h b/Source/Client/Session.h index af3de918d..fc835bd2c 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -649,6 +649,7 @@ public: void SetHotkeySkillLevel(std::uint32_t skillLevel, int index); std::int32_t MemberColor(int index); SessionShop* FindShop(const int& shopId); + int FindShopId(std::string name); CSkillInfo* FindGroupedSkill(std::uint32_t id); void AddFriend(MessengerMember& member); void AddPartyMember(MessengerMember& member); diff --git a/Source/Contents/Messenger/ClientMessenger.cpp b/Source/Contents/Messenger/ClientMessenger.cpp index 736cf327f..5fedd0a7a 100644 --- a/Source/Contents/Messenger/ClientMessenger.cpp +++ b/Source/Contents/Messenger/ClientMessenger.cpp @@ -778,14 +778,14 @@ __declspec(noinline) SessionShop* CSession::FindShop(const int& shopId) { // OFFSET: 0x00DE3B10 // FUNCTION: fn_23485 -int FindShopId(CSession& session, std::string name) { +int CSession::FindShopId(std::string name) { std::string mapName = name; if (mapName.empty()) { - mapName = session.m_navigationPlayerMap; + mapName = this->m_navigationPlayerMap; } - const auto found = session.m_nameToId.find(mapName); - if (found == session.m_nameToId.end()) { + const auto found = this->m_nameToId.find(mapName); + if (found == this->m_nameToId.end()) { return -1; } return found->second; @@ -795,7 +795,7 @@ int FindShopId(CSession& session, std::string name) { // FUNCTION: fn_05621 bool EquipmentProperties::CEquipmentWearable::UpdateActive() { const bool previous = this->m_active; - SessionShop* shop = g_session.FindShop(FindShopId(g_session, std::string())); + SessionShop* shop = g_session.FindShop(g_session.FindShopId("")); if (shop != nullptr && !shop->items.empty()) { this->m_active = shop->items[0].find(this->m_id) != shop->items[0].end(); } else { @@ -4211,7 +4211,7 @@ void EquipmentProperties::CEquipmentPropertiesMgr::RefreshExpansion(const int& k // OFFSET: 0x006B7390 // FUNCTION: fn_06206 void EquipmentProperties::CEquipmentPropertiesMgr::RefreshShop() { - const int shopId = FindShopId(g_session, std::string()); + const int shopId = g_session.FindShopId(""); if (this->shopId != shopId) { for (auto& entry : this->properties1) { const bool previous = entry.second->IsActive(); @@ -6144,7 +6144,7 @@ static_assert(offsetof(ShopItemListPacket, entries) == 5); void CGameMode::ReceiveShopItemList(const unsigned char* data) { const ShopItemListPacket* packet = reinterpret_cast(data); const int count = (packet->length - 5) / sizeof(ShopItemPacketEntry); - const int shopId = FindShopId(g_session, std::string()); + const int shopId = g_session.FindShopId(""); if (shopId != -1) { g_session.SetShopFlag(shopId, packet->flag != 0); for (int i = 0; i < count; ++i) { diff --git a/Source/Contents/Messenger/ClientMessenger.h b/Source/Contents/Messenger/ClientMessenger.h index 98ac87ace..87513bf0d 100644 --- a/Source/Contents/Messenger/ClientMessenger.h +++ b/Source/Contents/Messenger/ClientMessenger.h @@ -6,7 +6,6 @@ #include #include -class CSession; namespace EquipmentProperties { class CEquipmentPropertiesMgr; @@ -14,6 +13,5 @@ class CEquipmentPropertiesMgr; extern EquipmentProperties::CEquipmentPropertiesMgr* g_equipmentPropertiesMgr; -int FindShopId(CSession& session, std::string name); #endif diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index d42521b89..6dbe9b4a2 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -8211,7 +8211,7 @@ int UISkillDescribeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, if (g_session.m_hotkeyScript->Call("GetSkillDescript", "ddd>s", g_session.m_job, static_cast(a), b == 0 && c == 0 && d == 1, &description)) { const std::string text = description; if (!text.empty()) { - if (FindShopId(g_session, std::string()) != -1) { + if (g_session.FindShopId("") != -1) { const int delay = g_session.GetShopEntry(1, this->m_skillId).first; if (delay != 0) { const std::string line = FormatOwnedString(LookupMessage(MSI_FAIL_CALLHOMUN_OVER_100LEVEL), static_cast(delay * 0.1), delay % 10); @@ -9858,7 +9858,7 @@ void UIEquipWnd::DrawEquipSlots() { const int rowOffsets[4] = {0, 26, 52, 78}; int iconX[2] = {6, 251}; int nameX[2] = {28, 167}; - int shopId = FindShopId(g_session, std::string()); + int shopId = g_session.FindShopId(""); if (g_session.GetShopType(shopId)) { shopId = -1; }