Decompile fn_21631 (CGameMode::ReceivePlayerNameUpdate)

Batch #7315 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_21631 CGameMode::ReceivePlayerNameUpdate: logic confirmed by peer review

Peer-reviewed-by: meitogi, gordaoprogramas, aDw
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-31 06:32:22 +00:00
commit cbaaa30f21
3 changed files with 24 additions and 0 deletions

View file

@ -24,6 +24,7 @@ class CPlayer;
class CRenderObject;
struct ActorNameAllPacket;
struct ActorNameTitlePacket;
struct PlayerNameUpdatePacket;
struct GameOptionEntry;
struct CWorld;
struct TextureRegion;
@ -162,6 +163,7 @@ public:
bool GetClosestValidCell(int* x, int* y);
void ReceiveActorNameAll(const ActorNameAllPacket* packet);
void ReceiveActorNameTitle(const ActorNameTitlePacket* packet);
void ReceivePlayerNameUpdate(const PlayerNameUpdatePacket* packet);
void ReceiveColoredNotice(const unsigned char* packet);
void ReceiveNamedActionResult(const unsigned char* packet);
void ReceiveStatDump(const unsigned char* packet);

View file

@ -1,5 +1,6 @@
#include "Client/Mode/CGameMode.h"
#include "Client/Session.h"
#include "Contents/MessageTable.h"
#include "Network/ActorNamePacket.h"
#include "UI/Edit/UIEditCtrl.h"
#include "UI/Window/UIPetInfoWnd.h"
@ -30,3 +31,13 @@ void CGameMode::ReceiveActorNameTitle(const ActorNameTitlePacket* packet) {
}
}
}
// OFFSET: 0x00D1DB50
// FUNCTION: fn_21631
void CGameMode::ReceivePlayerNameUpdate(const PlayerNameUpdatePacket* packet) {
if (packet->type == 4 || packet->type == 3) {
std::string name = packet->type == 4 ? std::string(LookupMessage(581))
: std::string(std::string(packet->name, packet->name + sizeof(packet->name)).c_str());
SetPlayerName(packet->characterId, name);
}
}

View file

@ -3,6 +3,7 @@
#include <cstddef>
#include <cstdint>
#include <string>
#pragma pack(push, 1)
struct ActorNameAllPacket {
@ -21,13 +22,23 @@ struct ActorNameTitlePacket {
/* 000A */ char name[24];
/* 0022 */ char title[24];
};
struct PlayerNameUpdatePacket {
/* 0000 */ std::int16_t id;
/* 0002 */ std::int16_t type;
/* 0004 */ std::uint32_t characterId;
/* 0008 */ char name[24];
};
#pragma pack(pop)
void SetPlayerName(std::uint32_t id, std::string name);
#if defined(_WIN32) && !defined(_WIN64)
static_assert(offsetof(ActorNameAllPacket, positionName) == 0x4E);
static_assert(sizeof(ActorNameAllPacket) == 0x66);
static_assert(offsetof(ActorNameTitlePacket, title) == 0x22);
static_assert(sizeof(ActorNameTitlePacket) == 0x3A);
static_assert(sizeof(PlayerNameUpdatePacket) == 0x20);
#endif
#endif