rodecomp/Source/Contents/Emblems/EmblemUpload.cpp
ragnarok-clanker 2b755e795a Maintenance: [forced, user-approved] Family F6 (closes family F): delete the four headers left empty or orphaned by F1-F5. WindowDial
Batch #10239 by ragnarok-clanker: forced by an admin (0 lower score(s), 0 changed function(s)); checked with 494 compiled unit(s), including every includer of Source/UI/GameSettings/GameSettingsUI.h, Source/UI/RuneSystem/UIRuneSystemWnd.h, Source/UI/Window/UINewMakeCharWnd.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/WindowDialogs.h, Source/Client/Mode/ModeTooltip.h, Source/Client/Mode/ModeCursor.h, Source/UI/Window/WindowRegistration.h.
Deletes: Source/UI/Window/WindowDialogs.h, Source/Client/Mode/ModeTooltip.h, Source/Client/Mode/ModeCursor.h, Source/UI/Window/WindowRegistration.h
2026-11-03 11:10:29 +00:00

55 lines
1.3 KiB
C++

#include "Contents/Emblems/EmblemDataMgr.h"
#include "Contents/MessageTable.h"
#include "Network/Connection/Connection.h"
#include "Network/Packets/PacketLengths.h"
#include "UI/Window/UIWindowMgr.h"
#include "Utility/Async/AsyncDiagnostic.h"
#include <json/reader.h>
#include <json/value.h>
namespace {
#pragma pack(push, 1)
struct EmblemVersionPacket {
std::uint16_t id;
std::uint32_t guildId;
std::int32_t version;
};
#pragma pack(pop)
static_assert(sizeof(EmblemVersionPacket) == 10);
}
// OFFSET: 0x005EBAD0
// FUNCTION: fn_03976
void CEmblemDataMgr::CompleteUpload(AsyncDiagnostic diagnostic, std::string response, std::uint32_t guildId) {
if (!diagnostic.success) {
return;
}
Json::Value root;
Json::Reader reader;
const std::string document(response.c_str());
if (!reader.parse(document, root, true)) {
return;
}
switch (root["Type"].asInt()) {
case 1: {
EmblemVersionPacket packet{0x0B46, guildId, root["version"].asInt()};
GetRagConnection().Send(g_packetLengths.FixedLength(packet.id), &packet);
break;
}
case 2:
case 3:
case 4: {
const char* message = LookupMessage(3586);
g_windowMgr.Confirm(message, 0, true, false, 0, "Message", 280, 120, 0);
break;
}
default:
break;
}
this->m_uploading = false;
}