Batch #14814 by kyoshi: 0 byte-identical, 14 confirmed by peer review. - fn_02567 NRecycleObjectPool<CAccountLinkedUserDataLoadAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02568 NRecycleObjectPool<CLoadPartyInfoAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02569 NRecycleObjectPool<CChangePartyMasterAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02570 NRecycleObjectPool<CStopRecruitingAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02571 NRecycleObjectPool<CRegisterPartyAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02572 NRecycleObjectPool<CLoadMyPartyAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02573 NRecycleObjectPool<CLoadPartyListAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02574 NRecycleObjectPool<CMCStoreInfoBackupSaveAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02575 NRecycleObjectPool<CMCStoreInfoBackupLoadAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02576 NRecycleObjectPool<CEmblemDataDownloadAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02577 NRecycleObjectPool<CEmblemDataUploadAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02578 NRecycleObjectPool<CCharacterLinkedUserDataSaveAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02579 NRecycleObjectPool<CCharacterLinkedUserDataLoadAsyncWork>::Release: logic confirmed by peer review (already on main) - fn_02580 NRecycleObjectPool<CAccountLinkedUserDataSaveAsyncWork>::Release: logic confirmed by peer review (already on main) Peer-reviewed-by: secret, Tanke, codeplay Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
137 lines
5.5 KiB
C++
137 lines
5.5 KiB
C++
#include "Contents/Party/AdventurerAgencyMgr.h"
|
|
#include "Contents/Party/ChangePartyMasterAsyncWork.h"
|
|
#include "Network/Http/CURLPostHander.h"
|
|
#include "Network/TextEncoding.h"
|
|
#include "Utility/Cipher/XorBytes.h"
|
|
#include "Utility/Text/FormatString.h"
|
|
|
|
#include <cstdio>
|
|
#include <windows.h>
|
|
#include <timeapi.h>
|
|
|
|
namespace {
|
|
constexpr char sourceFile[] = "C:\\repositories\\RagnarokClient\\RagnarokClient\\Contents\\AdventurerAgency\\CChangePartyMasterAsyncWork.cpp";
|
|
|
|
// INLINED
|
|
__forceinline AsyncDiagnostic Diagnostic(bool success, const char* text, std::uint32_t line) {
|
|
std::string message = text;
|
|
return AsyncDiagnostic(&success, &message, sourceFile, &line);
|
|
}
|
|
|
|
template <std::size_t Length, std::uint64_t Key>
|
|
class EncryptedName {
|
|
public:
|
|
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
|
|
for (std::uint64_t index = 0; index < Length; ++index) {
|
|
this->m_text[index] = source[index];
|
|
}
|
|
}
|
|
|
|
~EncryptedName() {
|
|
for (std::uint64_t index = 0; index < Length; ++index) {
|
|
this->m_text[index] = 0;
|
|
}
|
|
}
|
|
|
|
const char* Text() {
|
|
if (this->m_encrypted) {
|
|
utility::XorBytes(this->m_text, Length, Key);
|
|
this->m_encrypted = false;
|
|
}
|
|
|
|
return reinterpret_cast<const char*>(this->m_text);
|
|
}
|
|
|
|
private:
|
|
/* 0000 */ std::uint8_t m_text[Length];
|
|
bool m_encrypted;
|
|
};
|
|
|
|
// INLINED
|
|
template <std::uint64_t Key, std::size_t Length>
|
|
const char* DecryptName(const std::uint8_t (&source)[Length]) {
|
|
thread_local EncryptedName<Length, Key> name(source);
|
|
return name.Text();
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x005CD7B0
|
|
// FUNCTION: fn_03677
|
|
CChangePartyMasterAsyncWork::CChangePartyMasterAsyncWork()
|
|
: NAsyncWork("Change_PartyMaster"), m_accountId(0), m_characterId(0), m_token(""), m_worldName(""), m_response(""), m_url(""),
|
|
m_diagnostic(false, std::string(DecryptName<0x2FF3C5036D070127ULL>({0x52, 0x6F, 0x6C, 0x03, 0x74, 0xAA, 0x9D, 0x2F})), sourceFile, 27), m_windows(nullptr) {
|
|
}
|
|
|
|
// INLINED
|
|
CChangePartyMasterAsyncWork::~CChangePartyMasterAsyncWork() = default;
|
|
|
|
// OFFSET: 0x005CE080
|
|
// FUNCTION: fn_03681
|
|
void CChangePartyMasterAsyncWork::Reset() {
|
|
}
|
|
|
|
// OFFSET: 0x005CDDA0
|
|
// FUNCTION: fn_03680
|
|
void CChangePartyMasterAsyncWork::Bind(
|
|
std::uint32_t accountId, std::uint32_t characterId, std::string characterName, std::uint32_t targetAccountId, std::uint32_t targetCharacterId,
|
|
std::string targetName, std::string worldName, std::string url, std::string token, WindowManagerWindows& windows
|
|
) {
|
|
this->m_group = timeGetTime();
|
|
this->m_accountId = accountId;
|
|
this->m_characterId = characterId;
|
|
this->m_key = 0;
|
|
this->m_characterName = characterName;
|
|
this->m_targetAccountId = targetAccountId;
|
|
this->m_targetCharacterId = targetCharacterId;
|
|
this->m_targetName = targetName;
|
|
this->m_worldName = worldName;
|
|
this->m_url = url;
|
|
this->m_token = token;
|
|
AsyncDiagnostic diagnostic = Diagnostic(false, DecryptName<0x17359BF953C367B3ULL>({0xC6, 0x09, 0xA8, 0x3D, 0x8E, 0xF4, 0x5B, 0x17}), 55);
|
|
this->m_diagnostic.MoveFrom(diagnostic);
|
|
this->m_windows = &windows;
|
|
}
|
|
|
|
// OFFSET: 0x005CE150
|
|
// FUNCTION: fn_03683
|
|
bool CChangePartyMasterAsyncWork::Execute() {
|
|
char account[64] = {};
|
|
StringFormat(account, sizeof(account), _TRUNCATE, "%lu", this->m_accountId);
|
|
char character[64] = {};
|
|
StringFormat(character, sizeof(character), _TRUNCATE, "%lu", this->m_characterId);
|
|
char targetAccount[64] = {};
|
|
StringFormat(targetAccount, sizeof(targetAccount), _TRUNCATE, "%lu", this->m_targetAccountId);
|
|
char targetCharacter[64] = {};
|
|
StringFormat(targetCharacter, sizeof(targetCharacter), _TRUNCATE, "%lu", this->m_targetCharacterId);
|
|
std::string world = ToUtf8(this->m_worldName);
|
|
std::string name = ToUtf8(this->m_characterName);
|
|
std::string targetName = ToUtf8(this->m_targetName);
|
|
CCURLPostHander handler(this->m_url);
|
|
handler.AddField(DecryptName<0x3375B1C7DBB5FD55ULL>({0x14, 0xB4, 0xF1, 0xDB}), account, 4);
|
|
handler.AddField(DecryptName<0x1D6D75EDE7CD311FULL>({0x58, 0x78, 0x89, 0xE7}), character, 4);
|
|
handler.AddField(DecryptName<0x59278F63D79F3DA1ULL>({0xE2, 0x55, 0xFE, 0xA5, 0x2D, 0xEE, 0x4A, 0x3C, 0xA1}), name, 4);
|
|
handler.AddField(DecryptName<0x812BE72BCD5707B7ULL>({0xE3, 0x68, 0x08, 0x8C, 0x62, 0xA3, 0x2B}), targetAccount, 4);
|
|
handler.AddField(DecryptName<0xD3755DD95F47A909ULL>({0x5D, 0xC6, 0x18, 0x18, 0x90, 0x19, 0x75}), targetCharacter, 4);
|
|
handler.AddField(DecryptName<0x31D7C1EDA345E36DULL>({0x39, 0x8C, 0x1A, 0xE0, 0x85, 0xA0, 0xA5, 0x7F, 0x0C, 0x8E, 0x20, 0xA3}), targetName, 4);
|
|
handler.AddField(DecryptName<0xD98F03A52D35636DULL>({0x3A, 0x0C, 0x47, 0x41, 0xC1, 0x4D, 0xEE, 0xB4, 0x08, 0x63}), world, 4);
|
|
handler.AddField(DecryptName<0x0F0F8B6B8F9D19D1ULL>({0x90, 0x6C, 0xE9, 0xE7, 0x3F, 0xE4, 0x64, 0x6A, 0xBF, 0x19}), this->m_token, 4);
|
|
|
|
if (handler.Perform() != 0) {
|
|
AsyncDiagnostic diagnostic = Diagnostic(false, DecryptName<0x91651D81F559F971ULL>({0x17, 0x98, 0x30, 0x99, 0x81}), 113);
|
|
this->m_diagnostic.MoveFrom(diagnostic);
|
|
} else {
|
|
this->m_response = FromUtf8(handler.Response());
|
|
AsyncDiagnostic diagnostic = Diagnostic(true, DecryptName<0x73D1674B61DF7B0BULL>({0x78, 0x0E, 0xBC, 0x02, 0x2E, 0x14, 0xA2, 0x73}), 122);
|
|
this->m_diagnostic.MoveFrom(diagnostic);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
// OFFSET: 0x005CE090
|
|
// FUNCTION: fn_03682
|
|
void CChangePartyMasterAsyncWork::Complete() {
|
|
g_adventurerAgencyMgr->CompleteChangeMaster(this->m_diagnostic, this->m_response, *this->m_windows);
|
|
}
|
|
|
|
template void std::deque<CChangePartyMasterAsyncWork*>::push_back(CChangePartyMasterAsyncWork*&&);
|