mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-15 00:54:08 +00:00
wire: guild packets and DisplayGuildCreateBox as structs
The guild packets of the 1.10.64 client (docs/Guilds.md) as Serialize/Deserialize structs, laid out the way the client's packet handlers read them: GUILD_CREATE_RESPONSE, GUILD_INVITE, GUILD_INVITE_INITIAL_RESPONSE, _FINAL_RESPONSE, _CONFIRM, GUILD_ADD_PLAYER, GUILD_REMOVE_PLAYER, GUILD_LOGIN_LOGOUT and GUILD_DATA (ClientPackets), the world packet TMP_GUILD_CREATE the create box sends, the chat packets the client sends through its world (GUILD_INVITE, GUILD_INVITE_RESPONSE, GUILD_LEAVE, GUILD_GET_ALL), DLU's world <-> chat packets (GUILD_CREATE, GUILD_KICK, GUILD_GET_STATUS as the chat server's guild update to a world, and GUILD_SET_RANK and GUILD_DISBAND appended to MessageType::Chat after CREATE_TEAM) and the game message DisplayGuildCreateBox (626). Fixed-size names always keep a NUL, since the client reads them as C strings. Enums eGuildCreateResponse, eGuildInviteResponse, eGuildInviteFinalResponse, eGuildRank and eGuildLeaveReason. Nothing sends them yet. Check: GuildPacketsTests compares every packet with the bytes at the client's offsets. Nothing to check in game. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -539,3 +539,112 @@ bool ChatPackets::RoutedFromClient::Deserialize(RakNet::BitStream& bitStream) {
|
||||
if (!data.empty()) VALIDATE_READ(bitStream.ReadBits(data.data(), BYTES_TO_BITS(data.size()), true));
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---- Guilds ----
|
||||
|
||||
void ChatPackets::GuildInvite::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(unknown);
|
||||
bitStream.Write(invitedPlayer);
|
||||
}
|
||||
|
||||
bool ChatPackets::GuildInvite::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(unknown));
|
||||
VALIDATE_READ(bitStream.Read(invitedPlayer));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChatPackets::GuildInviteResponse::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(unknown);
|
||||
bitStream.Write(declined);
|
||||
}
|
||||
|
||||
bool ChatPackets::GuildInviteResponse::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(unknown));
|
||||
VALIDATE_READ(bitStream.Read(declined));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChatPackets::GuildLeave::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(unknown);
|
||||
}
|
||||
|
||||
bool ChatPackets::GuildLeave::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(unknown));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChatPackets::GuildGetAll::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(unknown);
|
||||
}
|
||||
|
||||
bool ChatPackets::GuildGetAll::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(unknown));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChatPackets::GuildCreate::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(guildName);
|
||||
}
|
||||
|
||||
bool ChatPackets::GuildCreate::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(guildName));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChatPackets::GuildKick::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(unknown);
|
||||
bitStream.Write(kickedPlayer);
|
||||
}
|
||||
|
||||
bool ChatPackets::GuildKick::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(unknown));
|
||||
VALIDATE_READ(bitStream.Read(kickedPlayer));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChatPackets::GuildSetRank::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(targetPlayer);
|
||||
bitStream.Write(rank);
|
||||
}
|
||||
|
||||
bool ChatPackets::GuildSetRank::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(targetPlayer));
|
||||
VALIDATE_READ(bitStream.Read(rank));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChatPackets::GuildDisband::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(playerID);
|
||||
}
|
||||
|
||||
bool ChatPackets::GuildDisband::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChatPackets::GuildStatus::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(characterID);
|
||||
bitStream.Write(guildID);
|
||||
bitStream.Write(guildName);
|
||||
}
|
||||
|
||||
bool ChatPackets::GuildStatus::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(characterID));
|
||||
VALIDATE_READ(bitStream.Read(guildID));
|
||||
VALIDATE_READ(bitStream.Read(guildName));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -375,6 +375,104 @@ namespace ChatPackets {
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// Guilds (docs/Guilds.md). The client sends GUILD_INVITE, GUILD_INVITE_RESPONSE, GUILD_LEAVE and GUILD_GET_ALL
|
||||
// (routed like the ones above); the others are DLU's world <-> chat packets.
|
||||
|
||||
// Invite a player (by name) to the sender's guild
|
||||
struct GuildInvite : public LUBitStream {
|
||||
LWOOBJID playerID{};
|
||||
uint32_t unknown{};
|
||||
LUWString invitedPlayer{ 33 };
|
||||
|
||||
GuildInvite() : LUBitStream(ServiceType::CHAT, MessageType::Chat::GUILD_INVITE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// The answer to the invite in the message box (button 1 accepts: declined 0)
|
||||
struct GuildInviteResponse : public LUBitStream {
|
||||
LWOOBJID playerID{};
|
||||
uint32_t unknown{};
|
||||
uint8_t declined{};
|
||||
|
||||
GuildInviteResponse() : LUBitStream(ServiceType::CHAT, MessageType::Chat::GUILD_INVITE_RESPONSE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// Leave the guild. The client sends 66 more bytes of whatever was on its stack; they are not read.
|
||||
struct GuildLeave : public LUBitStream {
|
||||
LWOOBJID playerID{};
|
||||
uint32_t unknown{};
|
||||
|
||||
GuildLeave() : LUBitStream(ServiceType::CHAT, MessageType::Chat::GUILD_LEAVE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// The player's guild and its members (answered with ClientPackets::GuildData)
|
||||
struct GuildGetAll : public LUBitStream {
|
||||
LWOOBJID playerID{};
|
||||
uint32_t unknown{};
|
||||
|
||||
GuildGetAll() : LUBitStream(ServiceType::CHAT, MessageType::Chat::GUILD_GET_ALL) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// World -> chat: the name from the client's TMP_GUILD_CREATE
|
||||
struct GuildCreate : public LUBitStream {
|
||||
LWOOBJID playerID{};
|
||||
LUWString guildName{ 31 };
|
||||
|
||||
GuildCreate() : LUBitStream(ServiceType::CHAT, MessageType::Chat::GUILD_CREATE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// World -> chat: /gkick (the client never sends GUILD_KICK; the layout is the team kick's)
|
||||
struct GuildKick : public LUBitStream {
|
||||
LWOOBJID playerID{};
|
||||
uint32_t unknown{};
|
||||
LUWString kickedPlayer{ 33 };
|
||||
|
||||
GuildKick() : LUBitStream(ServiceType::CHAT, MessageType::Chat::GUILD_KICK) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// World -> chat: change a member's rank (eGuildRank; LEADER hands the guild over)
|
||||
struct GuildSetRank : public LUBitStream {
|
||||
LWOOBJID playerID{};
|
||||
LUWString targetPlayer{ 33 };
|
||||
uint8_t rank{};
|
||||
|
||||
GuildSetRank() : LUBitStream(ServiceType::CHAT, MessageType::Chat::GUILD_SET_RANK) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// World -> chat: the leader disbands the guild
|
||||
struct GuildDisband : public LUBitStream {
|
||||
LWOOBJID playerID{};
|
||||
|
||||
GuildDisband() : LUBitStream(ServiceType::CHAT, MessageType::Chat::GUILD_DISBAND) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// Chat -> the character's world: its guild changed; the world puts it in the character component (guild 0: none).
|
||||
// guildName is what other players may see (empty while the name waits for moderation).
|
||||
struct GuildStatus : public LUBitStream {
|
||||
LWOOBJID characterID{};
|
||||
LWOOBJID guildID{};
|
||||
LUWString guildName{ 31 };
|
||||
|
||||
GuildStatus() : LUBitStream(ServiceType::CHAT, MessageType::Chat::GUILD_GET_STATUS) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Chat-service packets the client receives, from the chat server (routed through the player's world) or from its world.
|
||||
*/
|
||||
|
||||
@@ -913,3 +913,175 @@ namespace ClientPackets {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ClientPackets {
|
||||
LUWString Guild::FixedName(const std::string& name, const uint32_t size) {
|
||||
auto wide = GeneralUtils::UTF8ToUTF16(name);
|
||||
if (size > 0 && wide.size() >= size) wide.resize(size - 1);
|
||||
return LUWString(wide, size);
|
||||
}
|
||||
|
||||
namespace {
|
||||
void WriteName(RakNet::BitStream& bitStream, const std::string& name, const uint32_t size) {
|
||||
bitStream.Write(Guild::FixedName(name, size));
|
||||
}
|
||||
|
||||
bool ReadName(RakNet::BitStream& bitStream, std::string& name, const uint32_t size) {
|
||||
LUWString value(size);
|
||||
VALIDATE_READ(bitStream.Read(value));
|
||||
name = value.GetAsString();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadByteBool(RakNet::BitStream& bitStream, bool& value) {
|
||||
uint8_t byte{};
|
||||
VALIDATE_READ(bitStream.Read(byte));
|
||||
value = byte != 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void GuildCreateResponse::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(result);
|
||||
bitStream.Write(guildID);
|
||||
WriteName(bitStream, guildName, Guild::NAME_SIZE);
|
||||
}
|
||||
|
||||
bool GuildCreateResponse::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(result));
|
||||
VALIDATE_READ(bitStream.Read(guildID));
|
||||
return ReadName(bitStream, guildName, Guild::NAME_SIZE);
|
||||
}
|
||||
|
||||
void GuildInvite::Serialize(RakNet::BitStream& bitStream) const {
|
||||
WriteName(bitStream, inviterName, Guild::PLAYER_NAME_SIZE);
|
||||
WriteName(bitStream, guildName, Guild::NAME_SIZE);
|
||||
}
|
||||
|
||||
bool GuildInvite::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(ReadName(bitStream, inviterName, Guild::PLAYER_NAME_SIZE));
|
||||
return ReadName(bitStream, guildName, Guild::NAME_SIZE);
|
||||
}
|
||||
|
||||
void GuildInviteInitialResponse::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(response);
|
||||
WriteName(bitStream, playerName, Guild::PLAYER_NAME_SIZE);
|
||||
}
|
||||
|
||||
bool GuildInviteInitialResponse::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(response));
|
||||
return ReadName(bitStream, playerName, Guild::PLAYER_NAME_SIZE);
|
||||
}
|
||||
|
||||
void GuildInviteFinalResponse::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(response);
|
||||
WriteName(bitStream, playerName, Guild::PLAYER_NAME_SIZE);
|
||||
}
|
||||
|
||||
bool GuildInviteFinalResponse::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(response));
|
||||
return ReadName(bitStream, playerName, Guild::PLAYER_NAME_SIZE);
|
||||
}
|
||||
|
||||
void GuildInviteConfirm::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write<uint8_t>(failed);
|
||||
WriteName(bitStream, guildName, Guild::PLAYER_NAME_SIZE);
|
||||
}
|
||||
|
||||
bool GuildInviteConfirm::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(ReadByteBool(bitStream, failed));
|
||||
return ReadName(bitStream, guildName, Guild::PLAYER_NAME_SIZE);
|
||||
}
|
||||
|
||||
void GuildAddPlayer::Serialize(RakNet::BitStream& bitStream) const {
|
||||
WriteName(bitStream, playerName, Guild::PLAYER_NAME_SIZE);
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(rank);
|
||||
WriteZone(bitStream, zoneID);
|
||||
bitStream.Write<uint8_t>(online);
|
||||
}
|
||||
|
||||
bool GuildAddPlayer::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(ReadName(bitStream, playerName, Guild::PLAYER_NAME_SIZE));
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(rank));
|
||||
VALIDATE_READ(ReadZone(bitStream, zoneID));
|
||||
return ReadByteBool(bitStream, online);
|
||||
}
|
||||
|
||||
void GuildRemovePlayer::Serialize(RakNet::BitStream& bitStream) const {
|
||||
bitStream.Write(reason);
|
||||
WriteName(bitStream, playerName, Guild::PLAYER_NAME_SIZE);
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write(newLeaderID);
|
||||
}
|
||||
|
||||
bool GuildRemovePlayer::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(bitStream.Read(reason));
|
||||
VALIDATE_READ(ReadName(bitStream, playerName, Guild::PLAYER_NAME_SIZE));
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(bitStream.Read(newLeaderID));
|
||||
return true;
|
||||
}
|
||||
|
||||
void GuildLoginLogout::Serialize(RakNet::BitStream& bitStream) const {
|
||||
WriteName(bitStream, playerName, Guild::PLAYER_NAME_SIZE);
|
||||
bitStream.Write(playerID);
|
||||
bitStream.Write<uint8_t>(online);
|
||||
WriteZone(bitStream, zoneID);
|
||||
bitStream.Write<uint8_t>(worldUpdateOnly);
|
||||
}
|
||||
|
||||
bool GuildLoginLogout::Deserialize(RakNet::BitStream& bitStream) {
|
||||
VALIDATE_READ(ReadName(bitStream, playerName, Guild::PLAYER_NAME_SIZE));
|
||||
VALIDATE_READ(bitStream.Read(playerID));
|
||||
VALIDATE_READ(ReadByteBool(bitStream, online));
|
||||
VALIDATE_READ(ReadZone(bitStream, zoneID));
|
||||
return ReadByteBool(bitStream, worldUpdateOnly);
|
||||
}
|
||||
|
||||
void GuildData::Serialize(RakNet::BitStream& bitStream) const {
|
||||
constexpr uint32_t DATE_SIZE = 11;
|
||||
bitStream.Write(status);
|
||||
WriteName(bitStream, guildName, Guild::NAME_SIZE);
|
||||
WriteName(bitStream, joinDate, DATE_SIZE);
|
||||
WriteName(bitStream, foundDate, DATE_SIZE);
|
||||
bitStream.Write(reputation);
|
||||
bitStream.Write(unknown1);
|
||||
bitStream.Write(unknown2);
|
||||
bitStream.Write(unknown3);
|
||||
bitStream.Write<uint16_t>(members.size());
|
||||
for (const auto& member : members) {
|
||||
bitStream.Write(member.rank);
|
||||
bitStream.Write<uint8_t>(member.online);
|
||||
WriteZone(bitStream, member.zoneID);
|
||||
bitStream.Write(member.playerID);
|
||||
WriteName(bitStream, member.name, Guild::PLAYER_NAME_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
bool GuildData::Deserialize(RakNet::BitStream& bitStream) {
|
||||
constexpr uint32_t DATE_SIZE = 11;
|
||||
VALIDATE_READ(bitStream.Read(status));
|
||||
VALIDATE_READ(ReadName(bitStream, guildName, Guild::NAME_SIZE));
|
||||
VALIDATE_READ(ReadName(bitStream, joinDate, DATE_SIZE));
|
||||
VALIDATE_READ(ReadName(bitStream, foundDate, DATE_SIZE));
|
||||
VALIDATE_READ(bitStream.Read(reputation));
|
||||
VALIDATE_READ(bitStream.Read(unknown1));
|
||||
VALIDATE_READ(bitStream.Read(unknown2));
|
||||
VALIDATE_READ(bitStream.Read(unknown3));
|
||||
uint16_t count{};
|
||||
VALIDATE_READ(bitStream.Read(count));
|
||||
members.clear();
|
||||
for (uint16_t i = 0; i < count; i++) {
|
||||
Member member;
|
||||
VALIDATE_READ(bitStream.Read(member.rank));
|
||||
VALIDATE_READ(ReadByteBool(bitStream, member.online));
|
||||
VALIDATE_READ(ReadZone(bitStream, member.zoneID));
|
||||
VALIDATE_READ(bitStream.Read(member.playerID));
|
||||
VALIDATE_READ(ReadName(bitStream, member.name, Guild::PLAYER_NAME_SIZE));
|
||||
members.push_back(std::move(member));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#include "eAddFriendResponseType.h"
|
||||
#include "eAddIgnoreResponse.h"
|
||||
#include "eBlueprintSaveResponseType.h"
|
||||
#include "eGuildCreateResponse.h"
|
||||
#include "eGuildInviteResponse.h"
|
||||
#include "eGuildRank.h"
|
||||
#include "eUgcResourceType.h"
|
||||
#include "MessageType/Client.h"
|
||||
#include "MessageType/Game.h"
|
||||
@@ -549,6 +552,133 @@ namespace ClientPackets {
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Guild packets (docs/Guilds.md), written by the chat server and routed through the player's world. The client
|
||||
* copies them into packed structs: every string is a fixed-size UTF-16 buffer it reads up to the first NUL, so
|
||||
* DLU writes at most size - 1 characters.
|
||||
*/
|
||||
namespace Guild {
|
||||
// Guild names are 31 characters on the wire (30 and a NUL); player names 33
|
||||
constexpr uint32_t NAME_SIZE = 31;
|
||||
constexpr uint32_t PLAYER_NAME_SIZE = 33;
|
||||
// A UTF-8 name as a buffer of `size` characters, cut so a NUL is always left
|
||||
LUWString FixedName(const std::string& name, uint32_t size);
|
||||
}
|
||||
|
||||
// The answer to the player's TMP_GUILD_CREATE
|
||||
struct GuildCreateResponse : public LUBitStream {
|
||||
eGuildCreateResponse result{};
|
||||
LWOOBJID guildID{}; // the client doesn't read it
|
||||
std::string guildName; // 31 characters on the wire
|
||||
|
||||
GuildCreateResponse() : LUBitStream(ServiceType::CLIENT, MessageType::Client::GUILD_CREATE_RESPONSE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// Someone invites the player to their guild; the client asks the player with a message box
|
||||
struct GuildInvite : public LUBitStream {
|
||||
std::string inviterName; // 33 characters on the wire
|
||||
std::string guildName; // 31
|
||||
|
||||
GuildInvite() : LUBitStream(ServiceType::CLIENT, MessageType::Client::GUILD_INVITE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// What happened to the invite the player sent
|
||||
struct GuildInviteInitialResponse : public LUBitStream {
|
||||
eGuildInviteResponse response{};
|
||||
std::string playerName; // the invited player; 33 characters on the wire
|
||||
|
||||
GuildInviteInitialResponse() : LUBitStream(ServiceType::CLIENT, MessageType::Client::GUILD_INVITE_INITIAL_RESPONSE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// The invited player's answer, to the inviter
|
||||
struct GuildInviteFinalResponse : public LUBitStream {
|
||||
eGuildInviteFinalResponse response{};
|
||||
std::string playerName; // the invited player; 33 characters on the wire
|
||||
|
||||
GuildInviteFinalResponse() : LUBitStream(ServiceType::CLIENT, MessageType::Client::GUILD_INVITE_FINAL_RESPONSE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// To the player who accepted an invite: whether they are in the guild now (the client then asks for its data)
|
||||
struct GuildInviteConfirm : public LUBitStream {
|
||||
bool failed{}; // one byte
|
||||
std::string guildName; // 33 characters on the wire
|
||||
|
||||
GuildInviteConfirm() : LUBitStream(ServiceType::CLIENT, MessageType::Client::GUILD_INVITE_CONFIRM) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// Someone joined the player's guild
|
||||
struct GuildAddPlayer : public LUBitStream {
|
||||
std::string playerName; // 33 characters on the wire
|
||||
LWOOBJID playerID{};
|
||||
eGuildRank rank{};
|
||||
LWOZONEID zoneID{};
|
||||
bool online{}; // one byte
|
||||
|
||||
GuildAddPlayer() : LUBitStream(ServiceType::CLIENT, MessageType::Client::GUILD_ADD_PLAYER) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// Someone left or was kicked from the player's guild (the player themself: the client drops the guild)
|
||||
struct GuildRemovePlayer : public LUBitStream {
|
||||
eGuildLeaveReason reason{};
|
||||
std::string playerName; // 33 characters on the wire
|
||||
LWOOBJID playerID{};
|
||||
LWOOBJID newLeaderID{}; // 0: the leader didn't change; otherwise that member's rank becomes leader
|
||||
|
||||
GuildRemovePlayer() : LUBitStream(ServiceType::CLIENT, MessageType::Client::GUILD_REMOVE_PLAYER) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// A guildmate logged in or out, or changed worlds (worldUpdateOnly: no chat line)
|
||||
struct GuildLoginLogout : public LUBitStream {
|
||||
std::string playerName; // 33 characters on the wire
|
||||
LWOOBJID playerID{};
|
||||
bool online{}; // one byte
|
||||
LWOZONEID zoneID{};
|
||||
bool worldUpdateOnly{}; // one byte
|
||||
|
||||
GuildLoginLogout() : LUBitStream(ServiceType::CLIENT, MessageType::Client::GUILD_LOGIN_LOGOUT) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// The player's guild and every member (the answer to GUILD_GET_ALL)
|
||||
struct GuildData : public LUBitStream {
|
||||
struct Member {
|
||||
eGuildRank rank{};
|
||||
bool online{}; // one byte
|
||||
LWOZONEID zoneID{}; // the client reads it only for online members
|
||||
LWOOBJID playerID{};
|
||||
std::string name; // 33 characters on the wire
|
||||
};
|
||||
|
||||
uint8_t status{}; // the client only takes 0 (DLU sends 1 to a player in no guild)
|
||||
std::string guildName; // 31 characters on the wire
|
||||
std::string joinDate; // 11 characters on the wire; the client doesn't show it
|
||||
std::string foundDate; // 11
|
||||
int32_t reputation{}; // the client doesn't use it
|
||||
int32_t unknown1{};
|
||||
int32_t unknown2{};
|
||||
uint16_t unknown3{};
|
||||
std::vector<Member> members; // u16 count; the client ignores data with none
|
||||
|
||||
GuildData() : LUBitStream(ServiceType::CLIENT, MessageType::Client::GUILD_DATA) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CLIENTPACKETS_H
|
||||
|
||||
@@ -227,6 +227,19 @@ namespace WorldPackets {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TmpGuildCreate::Serialize(RakNet::BitStream& bitStream) const {
|
||||
auto name = guildName;
|
||||
if (name.size() >= NAME_SIZE) name.resize(NAME_SIZE - 1);
|
||||
bitStream.Write(LUWString(name, NAME_SIZE));
|
||||
}
|
||||
|
||||
bool TmpGuildCreate::Deserialize(RakNet::BitStream& bitStream) {
|
||||
LUWString name(NAME_SIZE);
|
||||
VALIDATE_READ(bitStream.Read(name));
|
||||
guildName = name.string;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MailPacket::Serialize(RakNet::BitStream& bitStream) const {
|
||||
WriteAll(bitStream, data);
|
||||
}
|
||||
|
||||
@@ -192,6 +192,17 @@ namespace WorldPackets {
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// Client -> server. The name the player typed in the guild create box (docs/Guilds.md); the client sends it only
|
||||
// when it is not in a guild. The client's name for it: MSG_WORLD_CLIENT_TMP_GUILD_CREATE.
|
||||
struct TmpGuildCreate : public WorldLUBitStream {
|
||||
static constexpr uint32_t NAME_SIZE = 31; // characters on the wire; the client puts at most 30 and a NUL
|
||||
std::u16string guildName;
|
||||
|
||||
TmpGuildCreate() : WorldLUBitStream(MessageType::World::TMP_GUILD_CREATE) {}
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
};
|
||||
|
||||
// Client -> server. The client's anti cheat noticed something.
|
||||
struct HandleFunness : public WorldLUBitStream {
|
||||
float cheatInfo{};
|
||||
|
||||
Reference in New Issue
Block a user