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.
125 lines
3.8 KiB
C++
125 lines
3.8 KiB
C++
#include "UI/Window/UIEnums.h"
|
|
#include "UI/Window/WindowId.h"
|
|
#include "Client/Session/Session.h"
|
|
#include "Contents/Achievement/AchievementMgr.h"
|
|
#include "Contents/Jobs/JobInheritance.h"
|
|
#include "UI/Window/UIWindow.h"
|
|
#include "UI/Window/UIWindowMgr.h"
|
|
#include "Contents/Tables/MessageTable.h"
|
|
#include "Utility/Text/FormatString.h"
|
|
|
|
#include "Resource/MSGSTRINGID.h"
|
|
#include <algorithm>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
struct JobTitleLess {
|
|
bool operator()(int left, int right) const;
|
|
};
|
|
|
|
// OFFSET: 0x00E063F0
|
|
// FUNCTION: fn_23735
|
|
bool JobTitleLess::operator()(int left, int right) const {
|
|
std::string leftTitle = GetJobTitleString(left);
|
|
std::string rightTitle = GetJobTitleString(right);
|
|
return leftTitle < rightTitle;
|
|
}
|
|
|
|
// OFFSET: 0x00E064C0
|
|
// FUNCTION: fn_23736
|
|
int CSession::AddAchievementJobTitle(int id) {
|
|
int value = g_achievementMgr->GetRewardTitleId(id);
|
|
if (value == -1) {
|
|
return -1;
|
|
}
|
|
|
|
if (std::find(this->jobTitles.begin(), this->jobTitles.end(), value) != this->jobTitles.end()) {
|
|
return -1;
|
|
}
|
|
|
|
this->jobTitles.push_back(value);
|
|
std::sort(this->jobTitles.begin(), this->jobTitles.end(), JobTitleLess());
|
|
|
|
if (UIWindow* window = g_windowMgr.LookupWindow(WID_EQUIPWND)) {
|
|
window->SendMsg(nullptr, UM_REFRESH, 0, 0, 0, 0);
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
// OFFSET: 0x00E06580
|
|
// FUNCTION: fn_23737
|
|
bool CSession::ToggleTrackedAchievement(int id) {
|
|
std::vector<SessionRecord6178>& tracked = this->trackedAchievements;
|
|
auto found = tracked.begin();
|
|
while (found != tracked.end() && found->id != id) {
|
|
++found;
|
|
}
|
|
|
|
SessionRecord6144* progress;
|
|
auto record = this->achievements.find(id);
|
|
if (record != this->achievements.end()) {
|
|
progress = &record->second;
|
|
} else {
|
|
this->achievements.insert(std::make_pair(id, SessionRecord6144()));
|
|
reinterpret_cast<unsigned char*>(&this->achievements[id].completionFlags)[0] = 1;
|
|
progress = &this->achievements[id];
|
|
}
|
|
|
|
if (!progress) {
|
|
return false;
|
|
}
|
|
|
|
if (found != tracked.end()) {
|
|
tracked.erase(found);
|
|
} else {
|
|
if (tracked.size() >= 3) {
|
|
g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast<std::intptr_t>(LookupMessage(MSI_GET_ROULLETE_PRIZE)), 0x64FFFF, 0, 0, 0);
|
|
return false;
|
|
}
|
|
|
|
AchievementInfo info;
|
|
g_achievementMgr->GetAchievement(info, id);
|
|
|
|
SessionRecord6178 entry;
|
|
entry.id = id;
|
|
entry.completed = reinterpret_cast<const unsigned char*>(&progress->completionFlags)[1];
|
|
entry.title = info.title;
|
|
|
|
for (unsigned int i = 0; i < info.rewards.size(); ++i) {
|
|
const AchievementReward& reward = info.rewards[i];
|
|
std::string text;
|
|
bool completed = false;
|
|
|
|
if (info.progressMode == 0) {
|
|
if (reward.text.size() > 40) {
|
|
text = static_cast<const std::string&>(FormatOwnedString("- %s...", reward.text.substr(0, 40).c_str()));
|
|
} else {
|
|
text = static_cast<const std::string&>(FormatOwnedString("- %s", reward.text.c_str()));
|
|
}
|
|
|
|
completed = static_cast<int>(progress->objectives[i]) > 0;
|
|
} else if (info.progressMode == 1) {
|
|
std::string count = FormatOwnedString("(%d/%d)", progress->objectives[i], reward.targetCount);
|
|
if (reward.text.size() + count.size() > 40) {
|
|
text = static_cast<const std::string&>(FormatOwnedString("- %s...%s", reward.text.substr(0, 40 - count.size()).c_str(), count.c_str()));
|
|
} else {
|
|
text = static_cast<const std::string&>(FormatOwnedString("- %s %s", reward.text.c_str(), count.c_str()));
|
|
}
|
|
|
|
completed = static_cast<int>(progress->objectives[i]) == reward.targetCount;
|
|
}
|
|
|
|
entry.objectives.emplace_back(text, completed);
|
|
}
|
|
|
|
tracked.push_back(entry);
|
|
}
|
|
|
|
if (tracked.size() == 0) {
|
|
g_windowMgr.CloseWindow(WID_ACHTRACINGWND);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|