Batch #17237 by ragnarok-clanker: no function's compiled code changes; checked with 105 compiled unit(s), including every includer of Source/Linkage/Source/Client/Mode/LoginMode.cpp.h, Source/Linkage/Source/Client/Session/SessionAchievements.cpp.h, Source/Linkage/Source/Client/Session/SessionPredicates.cpp.h, Source/Linkage/Source/Client/Session/SessionState.cpp.h, Source/Linkage/Source/Contents/Achievement/AchievementMgr.cpp.h, Source/Linkage/Source/Contents/Actors/ActorPickNode.cpp.h, Source/Linkage/Source/Contents/Actors/MercenaryAI.cpp.h, Source/Linkage/Source/Contents/Actors/Resources/RobeResources.cpp.h, Source/Linkage/Source/Contents/CashEmotion/CashEmotionMgr.cpp.h, Source/Linkage/Source/Contents/Effects/EffectResourceSwitcher.cpp.h, Source/Linkage/Source/Contents/Effects/Particles/AnimatedEmitterEffect.cpp.h, Source/Linkage/Source/Contents/Effects/Particles/Particle.cpp.h, Source/Linkage/Source/Contents/Effects/Skills/MonsterSkillEffects.cpp.h, Source/Linkage/Source/Contents/Emblems/EmblemCache.cpp.h, Source/Linkage/Source/Contents/Emblems/EmblemDataDownloadAsyncWork.cpp.h, Source/Linkage/Source/Contents/Emblems/EmblemDataMgr.cpp.h, Source/Linkage/Source/Contents/Emblems/EmblemDataUploadAsyncWork.cpp.h, Source/Linkage/Source/Contents/Emblems/GuildEmblemLookup.cpp.h, Source/Linkage/Source/Contents/Hotkeys/EmotionHotkeys.cpp.h, Source/Linkage/Source/Contents/Items/ItemInfo.cpp.h, Source/Linkage/Source/Contents/Items/ItemNaming.cpp.h, Source/Linkage/Source/Contents/Map/PrivateAirplaneMgr.cpp.h, Source/Linkage/Source/Contents/Map/TownInfoMgr.cpp.h, Source/Linkage/Source/Contents/Messenger/MessengerMember.cpp.h, Source/Linkage/Source/Contents/Messenger/WhisperBlockMgr.cpp.h, Source/Linkage/Source/Contents/Models/ModelLighting.cpp.h, Source/Linkage/Source/Contents/Movies/BinkMovies.cpp.h, Source/Linkage/Source/Contents/Navigation/NavigationDestinations.cpp.h, Source/Linkage/Source/Contents/Navigation/NavigationRequest.cpp.h, Source/Linkage/Source/Contents/Navigation/NavigationRoute.cpp.h, Source/Linkage/Source/Contents/Party/AgencyRequests.cpp.h, Source/Linkage/Source/Contents/Party/LoadPartyInfoAsyncWork.cpp.h, Source/Linkage/Source/Contents/Party/LoadPartyListAsyncWork.cpp.h, Source/Linkage/Source/Contents/Party/RegisterPartyAsyncWork.cpp.h, Source/Linkage/Source/Contents/Repute/ReputeMgr.cpp.h, Source/Linkage/Source/Contents/Sound/SoundMgr.cpp.h, Source/Linkage/Source/Contents/Store/MCStoreInfoBackup.cpp.h, Source/Linkage/Source/Contents/Store/MCStoreInfoBackupAsyncWork.cpp.h, Source/Linkage/Source/Contents/Time/ClientTiming.cpp.h, Source/Linkage/Source/Contents/UserData/AccountLinkedUserDataLoadAsyncWork.cpp.h, Source/Linkage/Source/Contents/UserData/AccountLinkedUserDataMgr.cpp.h, Source/Linkage/Source/Contents/UserData/AccountLinkedUserDataSaveAsyncWork.cpp.h, Source/Linkage/Source/Contents/UserData/CharacterConfigSave.cpp.h, Source/Linkage/Source/Contents/UserData/CharacterLinkedUserDataLoadAsyncWork.cpp.h, Source/Linkage/Source/Contents/UserData/CharacterLinkedUserDataSaveAsyncWork.cpp.h, Source/Linkage/Source/File/DirectoryRemoval.cpp.h, Source/Linkage/Source/Network/NIPAddr.cpp.h, Source/Linkage/Source/Network/Packets/ActorNamePacket.cpp.h, Source/Linkage/Source/Render/Device/RenderBackends.cpp.h, Source/Linkage/Source/Render/Primitives/ScreenLine.cpp.h, Source/Linkage/Source/Render/Text/EmbedFont.cpp.h, Source/Linkage/Source/Resource/Models/RmaResource.cpp.h, Source/Linkage/Source/Resource/ResourceFailures.cpp.h, Source/Linkage/Source/Script/LuaScript.cpp.h, Source/Linkage/Source/Security/NProtectGameGuardMgr.cpp.h, Source/Linkage/Source/UI/Acceptance/UIExchangeAcceptWnd.cpp.h, Source/Linkage/Source/UI/Achievement/UIAchWnd.cpp.h, Source/Linkage/Source/UI/Buttons/UINaviLinkButton.cpp.h, Source/Linkage/Source/UI/CashShop/UICashShopWnd.cpp.h, Source/Linkage/Source/UI/Chat/UIChatRoomTitle.cpp.h, Source/Linkage/Source/UI/Dialogs/UIMessageBox.cpp.h, Source/Linkage/Source/UI/Dialogs/UINoteWnd.cpp.h, Source/Linkage/Source/UI/Edit/UIEditCtrl3.cpp.h, Source/Linkage/Source/UI/Enchant/UIEnchantUI.cpp.h, Source/Linkage/Source/UI/EntryQueue/UIEntryQueueWnd.cpp.h, Source/Linkage/Source/UI/Events/UICheckAttendanceWnd.cpp.h, Source/Linkage/Source/UI/GameSettings/GameSettingsUI.cpp.h, Source/Linkage/Source/UI/GameSettings/UIHotkeyGuideWnd.cpp.h, Source/Linkage/Source/UI/Gauges/UIBarGraph.cpp.h, Source/Linkage/Source/UI/Guild/UIGuildHelperWnd.cpp.h, Source/Linkage/Source/UI/Items/UIEquipmentPropertiesWnd.cpp.h, Source/Linkage/Source/UI/Items/UIItemReformWnd.cpp.h, Source/Linkage/Source/UI/Items/UIItemStoreComboBox.cpp.h, Source/Linkage/Source/UI/Items/UILapineBoxWnd.cpp.h, Source/Linkage/Source/UI/Items/UIMakeTargetProcessWnd.cpp.h, Source/Linkage/Source/UI/Items/UIMerchantItemLogWnd.cpp.h, Source/Linkage/Source/UI/Items/UISwapEquipmentWnd.cpp.h, Source/Linkage/Source/UI/Lists/UIChatHisBox.cpp.h, Source/Linkage/Source/UI/Lists/UIComboBoxDefWnd.cpp.h, Source/Linkage/Source/UI/Login/UIPasswordWnd.cpp.h, Source/Linkage/Source/UI/Macro/UIMacroDetectorWnd.cpp.h, Source/Linkage/Source/UI/Navigation/NavigationLink.cpp.h, Source/Linkage/Source/UI/Party/UIApplyForPartyWnd.cpp.h, Source/Linkage/Source/UI/Party/UIRegisterPartyWnd.cpp.h, Source/Linkage/Source/UI/Party/UISeekPartyMBWnd.cpp.h, Source/Linkage/Source/UI/Quest/UIRecommendedQuestInfo.cpp.h, Source/Linkage/Source/UI/Repute/UIReputeWnd.cpp.h, Source/Linkage/Source/UI/Rodex/UIRodexComposeWnd.cpp.h, Source/Linkage/Source/UI/RuneSystem/UIRuneSystemWnd.cpp.h, Source/Linkage/Source/UI/Shop/UIMerchantShopTitle.cpp.h, Source/Linkage/Source/UI/Shortcuts/UIShortCutWnd.cpp.h, Source/Linkage/Source/UI/Skill/UIGraffiStrboxWnd.cpp.h, Source/Linkage/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp.h, Source/Linkage/Source/UI/Status/UIBasicInfoWnd.cpp.h, Source/Linkage/Source/UI/Text/ColoredText.cpp.h, Source/Linkage/Source/UI/Text/ItemLinkDisplay.cpp.h, Source/Linkage/Source/UI/Text/TextMarkup.cpp.h, Source/Linkage/Source/UI/Text/UITagTextViewer.cpp.h, Source/Linkage/Source/UI/Text/UITextViewer.cpp.h, Source/Linkage/Source/UI/Window/UIFrameWnd.cpp.h, Source/Linkage/Source/UI/Window/UIWindow.cpp.h, Source/Linkage/Source/UI/Window/UIWindowFactory.cpp.h, Source/Linkage/Source/UI/Window/WindowRegistration.cpp.h, Source/Linkage/Source/UI/Window/WindowRetirement.cpp.h, Source/Linkage/Source/Utility/Threading/NThread.cpp.h.
175 lines
4.6 KiB
C++
175 lines
4.6 KiB
C++
#include "UI/Window/UIEnums.h"
|
|
#include "Contents/UserData/AccountService.h"
|
|
#include "Contents/Async/AsyncWorkMgr.h"
|
|
#include "Contents/Store/MCStoreInfoBackup.h"
|
|
#include "Contents/Tables/MessageTable.h"
|
|
#include "Client/Session/Session.h"
|
|
#include "UI/Window/UIWindowMgr.h"
|
|
#include "Utility/Async/AsyncDiagnostic.h"
|
|
|
|
#include "Resource/MSGSTRINGID.h"
|
|
#include <algorithm>
|
|
#include <json/reader.h>
|
|
#include <json/value.h>
|
|
#include <json/writer.h>
|
|
|
|
// OFFSET: 0x00605BF0
|
|
// FUNCTION: fn_04226
|
|
CMCStoreInfoBackup::CMCStoreInfoBackup() : loaded(false), pendingSaves(0), saveUrl(""), loadUrl(""), title(""), type(0) {
|
|
this->enabled = true;
|
|
}
|
|
|
|
// OFFSET: 0x00605D70
|
|
// FUNCTION: fn_04227
|
|
CMCStoreInfoBackup::~CMCStoreInfoBackup() = default;
|
|
|
|
// OFFSET: 0x00605EC0
|
|
// FUNCTION: fn_04229
|
|
void CMCStoreInfoBackup::Clear() {
|
|
this->items.clear();
|
|
}
|
|
|
|
// OFFSET: 0x00606BB0
|
|
// FUNCTION: fn_04234
|
|
int CMCStoreInfoBackup::Restore(unsigned char wholeItem, int maximum) {
|
|
CSession& lists = g_session;
|
|
int examined = 0;
|
|
auto saved = this->items.begin();
|
|
|
|
while (saved != this->items.end() && examined < maximum) {
|
|
std::pair<bool, ITEM_INFO> found = lists.FindMerchantMyShopItem(*saved, wholeItem);
|
|
|
|
if (!found.first) {
|
|
saved = this->items.erase(saved);
|
|
} else {
|
|
if (wholeItem == 0) {
|
|
found.second.quantity = std::min(found.second.quantity, saved->quantity);
|
|
}
|
|
|
|
if (found.second.identity[1] != 0) {
|
|
lists.AddMerchantPurchaseSavedItem(found.second, wholeItem, 0);
|
|
lists.RemoveMerchantMyShopItem(found.second, wholeItem, 0);
|
|
}
|
|
|
|
++saved;
|
|
}
|
|
|
|
++examined;
|
|
}
|
|
|
|
return examined;
|
|
}
|
|
|
|
// OFFSET: 0x00605EE0
|
|
// FUNCTION: fn_04230
|
|
std::string CMCStoreInfoBackup::LoadUrl() const {
|
|
return this->loadUrl;
|
|
}
|
|
|
|
// OFFSET: 0x00605F40
|
|
// FUNCTION: fn_04231
|
|
std::string CMCStoreInfoBackup::SaveUrl() const {
|
|
return this->saveUrl;
|
|
}
|
|
|
|
// OFFSET: 0x006070E0
|
|
// FUNCTION: fn_04237
|
|
void CMCStoreInfoBackup::Reset(LuaScript& settings, LuaScript& tables, const char* host, const char* port, const char* overrideKey) {
|
|
this->loaded = false;
|
|
this->title = "";
|
|
this->items.clear();
|
|
const std::string base = ResolveAccountServiceBase(settings, tables, host, port, overrideKey);
|
|
|
|
if (!base.empty()) {
|
|
this->saveUrl = base + "/MerchantStore/save";
|
|
this->loadUrl = base + "/MerchantStore/load";
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00605FA0
|
|
// FUNCTION: fn_04232
|
|
void CMCStoreInfoBackup::CompleteLoad(
|
|
AsyncDiagnostic diagnostic, std::uint32_t, std::uint32_t, std::string, std::string response
|
|
) {
|
|
if (!diagnostic.success) {
|
|
return;
|
|
}
|
|
|
|
Json::Value root;
|
|
Json::Reader reader;
|
|
|
|
if (!reader.parse(std::string(response.c_str()), root, true)) {
|
|
return;
|
|
}
|
|
|
|
switch (root["Type"].asInt()) {
|
|
case 1:
|
|
this->ImportData(root["data"]);
|
|
this->loaded = true;
|
|
break;
|
|
case 4:
|
|
this->loaded = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00607810
|
|
// FUNCTION: fn_04239
|
|
void CMCStoreInfoBackup::CompleteSave(AsyncDiagnostic diagnostic, std::string response) {
|
|
--this->pendingSaves;
|
|
|
|
if (!diagnostic.success) {
|
|
return;
|
|
}
|
|
|
|
Json::Value root;
|
|
Json::Reader reader;
|
|
|
|
if (!reader.parse(std::string(response.c_str()), root, true)) {
|
|
return;
|
|
}
|
|
|
|
if (root["Type"].asInt() != 1) {
|
|
return;
|
|
}
|
|
|
|
g_windowMgr.SendNotice(UIM_OPENCHATWND, 0, 0, 0, 0, 0);
|
|
|
|
if (this->type == 0) {
|
|
g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast<std::intptr_t>(LookupMessage(MSI_EQUIP_FAIL_DURING_BARTER)), 0xFFFF, 0, 0, 0);
|
|
} else if (this->type == 1) {
|
|
g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast<std::intptr_t>(LookupMessage(MSI_BARTER_ITEMLIST)), 0xFFFF, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00606DE0
|
|
// FUNCTION: fn_04235
|
|
void CMCStoreInfoBackup::Load(
|
|
std::uint32_t accountId, std::uint32_t characterId, std::string accountName, int type
|
|
) {
|
|
if (accountId == 0 || characterId == 0) {
|
|
return;
|
|
}
|
|
|
|
g_asyncWorkMgr->LoadStore(accountId, characterId, accountName, this->LoadUrl(),
|
|
std::string(reinterpret_cast<const char*>(&g_session.webServiceLoginData[0x08]), 16), type);
|
|
}
|
|
|
|
// OFFSET: 0x00606EB0
|
|
// FUNCTION: fn_04236
|
|
void CMCStoreInfoBackup::Save(int type) {
|
|
this->type = type;
|
|
Json::Value root;
|
|
Json::Value data;
|
|
this->ExportData(data);
|
|
|
|
if (!data.isNull()) {
|
|
root["data"] = data;
|
|
Json::StyledWriter writer;
|
|
const std::string response = writer.write(root);
|
|
g_asyncWorkMgr->SaveStore(g_session.m_aid, g_session.m_gid, std::string(g_session.m_accountName.c_str()), this->SaveUrl(),
|
|
std::string(reinterpret_cast<const char*>(&g_session.webServiceLoginData[8]), 16), response, this->type);
|
|
|
|
++this->pendingSaves;
|
|
}
|
|
}
|