Add movement packed GUID, inventory money display, and character screen buttons

Fix movement packets to include packed player GUID prefix so the server
tracks position. Fix inventory money display being clipped by child panels.
Add Back and Delete Character buttons to character selection screen with
two-step delete confirmation.
This commit is contained in:
Kelsi 2026-02-06 03:24:46 -08:00
parent e327344a9b
commit 20f89b2d4a
9 changed files with 156 additions and 15 deletions

View file

@ -103,10 +103,14 @@ public:
const std::vector<Character>& getCharacters() const { return characters; }
void createCharacter(const CharCreateData& data);
void deleteCharacter(uint64_t characterGuid);
using CharCreateCallback = std::function<void(bool success, const std::string& message)>;
void setCharCreateCallback(CharCreateCallback cb) { charCreateCallback_ = std::move(cb); }
using CharDeleteCallback = std::function<void(bool success)>;
void setCharDeleteCallback(CharDeleteCallback cb) { charDeleteCallback_ = std::move(cb); }
/**
* Select and log in with a character
* @param characterGuid GUID of character to log in with
@ -601,6 +605,7 @@ private:
WorldConnectSuccessCallback onSuccess;
WorldConnectFailureCallback onFailure;
CharCreateCallback charCreateCallback_;
CharDeleteCallback charDeleteCallback_;
bool pendingCharCreateResult_ = false;
bool pendingCharCreateSuccess_ = false;
std::string pendingCharCreateMsg_;

View file

@ -14,6 +14,7 @@ enum class Opcode : uint16_t {
CMSG_AUTH_SESSION = 0x1ED,
CMSG_CHAR_CREATE = 0x036,
CMSG_CHAR_ENUM = 0x037,
CMSG_CHAR_DELETE = 0x038,
CMSG_PLAYER_LOGIN = 0x03D,
// ---- Movement ----
@ -38,6 +39,7 @@ enum class Opcode : uint16_t {
SMSG_AUTH_RESPONSE = 0x1EE,
SMSG_CHAR_CREATE = 0x03A,
SMSG_CHAR_ENUM = 0x03B,
SMSG_CHAR_DELETE = 0x03C,
SMSG_PONG = 0x1DD,
SMSG_LOGIN_VERIFY_WORLD = 0x236,
SMSG_ACCOUNT_DATA_TIMES = 0x209,

View file

@ -429,7 +429,7 @@ public:
* @param info Movement info
* @return Packet ready to send
*/
static network::Packet build(Opcode opcode, const MovementInfo& info);
static network::Packet build(Opcode opcode, const MovementInfo& info, uint64_t playerGuid = 0);
};
// Forward declare Entity types

View file

@ -31,6 +31,8 @@ public:
}
void setOnCreateCharacter(std::function<void()> cb) { onCreateCharacter = std::move(cb); }
void setOnBack(std::function<void()> cb) { onBack = std::move(cb); }
void setOnDeleteCharacter(std::function<void(uint64_t)> cb) { onDeleteCharacter = std::move(cb); }
/**
* Check if a character has been selected
@ -42,6 +44,11 @@ public:
*/
uint64_t getSelectedGuid() const { return selectedCharacterGuid; }
/**
* Update status message
*/
void setStatus(const std::string& message);
private:
// UI state
int selectedCharacterIndex = -1;
@ -54,11 +61,9 @@ private:
// Callbacks
std::function<void(uint64_t)> onCharacterSelected;
std::function<void()> onCreateCharacter;
/**
* Update status message
*/
void setStatus(const std::string& message);
std::function<void()> onBack;
std::function<void(uint64_t)> onDeleteCharacter;
bool confirmDelete = false;
/**
* Get faction color based on race