mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/PacketIO: Port guild packets to classes as example of new self-validating strings
(cherry picked from commit f0fe5f8b66)
This commit is contained in:
@@ -2192,7 +2192,7 @@ void Guild::SendPermissions(WorldSession* session) const
|
||||
|
||||
WorldPackets::Guild::GuildPermissionsQueryResults queryResult;
|
||||
queryResult.RankID = rankId;
|
||||
queryResult.WithdrawGoldLimit = int32(_GetRankBankMoneyPerDay(rankId));
|
||||
queryResult.WithdrawGoldLimit = _GetRankBankMoneyPerDay(rankId);
|
||||
queryResult.Flags = _GetRankRights(rankId);
|
||||
queryResult.NumTabs = _GetPurchasedTabsSize();
|
||||
queryResult.Tab.reserve(GUILD_BANK_MAX_TABS);
|
||||
|
||||
@@ -127,12 +127,6 @@ void WorldSession::HandleGuildUpdateMotdText(WorldPackets::Guild::GuildUpdateMot
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_UPDATE_MOTD_TEXT [%s]: MOTD: %s", GetPlayerInfo().c_str(), packet.MotdText.c_str());
|
||||
|
||||
if (!DisallowHyperlinksAndMaybeKick(packet.MotdText))
|
||||
return;
|
||||
|
||||
if (packet.MotdText.size() > 255)
|
||||
return;
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->HandleSetMOTD(this, packet.MotdText);
|
||||
}
|
||||
@@ -142,12 +136,6 @@ void WorldSession::HandleGuildSetMemberNote(WorldPackets::Guild::GuildSetMemberN
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_SET_NOTE [%s]: Target: %s, Note: %s, Public: %u",
|
||||
GetPlayerInfo().c_str(), packet.NoteeGUID.ToString().c_str(), packet.Note.c_str(), packet.IsPublic);
|
||||
|
||||
if (!DisallowHyperlinksAndMaybeKick(packet.Note))
|
||||
return;
|
||||
|
||||
if (packet.Note.size() > 31)
|
||||
return;
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->HandleSetMemberNote(this, packet.Note, packet.NoteeGUID, packet.IsPublic);
|
||||
}
|
||||
@@ -166,12 +154,6 @@ void WorldSession::HandleGuildAddRank(WorldPackets::Guild::GuildAddRank& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_ADD_RANK [%s]: Rank: %s", GetPlayerInfo().c_str(), packet.Name.c_str());
|
||||
|
||||
if (!DisallowHyperlinksAndMaybeKick(packet.Name))
|
||||
return;
|
||||
|
||||
if (packet.Name.size() > 15)
|
||||
return;
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->HandleAddNewRank(this, packet.Name);
|
||||
}
|
||||
@@ -188,12 +170,6 @@ void WorldSession::HandleGuildUpdateInfoText(WorldPackets::Guild::GuildUpdateInf
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_UPDATE_INFO_TEXT [%s]: %s", GetPlayerInfo().c_str(), packet.InfoText.c_str());
|
||||
|
||||
if (!DisallowHyperlinksAndMaybeKick(packet.InfoText))
|
||||
return;
|
||||
|
||||
if (packet.InfoText.size() > 500)
|
||||
return;
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->HandleSetInfo(this, packet.InfoText);
|
||||
}
|
||||
@@ -491,12 +467,6 @@ void WorldSession::HandleGuildBankUpdateTab(WorldPackets::Guild::GuildBankUpdate
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: [%s], TabId: %u, Name: %s, Icon: %s"
|
||||
, GetPlayerInfo().c_str(), packet.Banker.ToString().c_str(), packet.BankTab, packet.Name.c_str(), packet.Icon.c_str());
|
||||
|
||||
if (!DisallowHyperlinksAndMaybeKick(packet.Name))
|
||||
return;
|
||||
|
||||
if ((packet.Name.size() > 15) || (packet.Icon.size() > 127))
|
||||
return;
|
||||
|
||||
if (!packet.Name.empty() && !packet.Icon.empty())
|
||||
if (GetPlayer()->GetGameObjectIfCanInteractWith(packet.Banker, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
@@ -523,12 +493,6 @@ void WorldSession::HandleGuildBankSetTabText(WorldPackets::Guild::GuildBankSetTa
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_SET_GUILD_BANK_TEXT [%s]: TabId: %u, Text: %s", GetPlayerInfo().c_str(), packet.Tab, packet.TabText.c_str());
|
||||
|
||||
if (!DisallowHyperlinksAndMaybeKick(packet.TabText))
|
||||
return;
|
||||
|
||||
if (packet.TabText.size() > 500)
|
||||
return;
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->SetBankTabText(packet.Tab, packet.TabText);
|
||||
}
|
||||
@@ -539,12 +503,6 @@ void WorldSession::HandleGuildSetRankPermissions(WorldPackets::Guild::GuildSetRa
|
||||
if (!guild)
|
||||
return;
|
||||
|
||||
if (!DisallowHyperlinksAndMaybeKick(packet.RankName))
|
||||
return;
|
||||
|
||||
if (packet.RankName.size() > 15)
|
||||
return;
|
||||
|
||||
GuildBankRightsAndSlotsVec rightsAndSlots(GUILD_BANK_MAX_TABS);
|
||||
for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
|
||||
rightsAndSlots[tabId] = GuildBankRightsAndSlots(tabId, uint8(packet.TabFlags[tabId]), uint32(packet.TabWithdrawItemLimit[tabId]));
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace WorldPackets
|
||||
|
||||
void Read() override;
|
||||
|
||||
std::string MotdText;
|
||||
String<255, Strings::NoHyperlinks> MotdText;
|
||||
};
|
||||
|
||||
class GuildCommandResult final : public ServerPacket
|
||||
@@ -452,9 +452,9 @@ namespace WorldPackets
|
||||
uint32 WithdrawGoldLimit = 0;
|
||||
uint32 Flags = 0;
|
||||
uint32 OldFlags = 0;
|
||||
uint32 TabFlags[GUILD_BANK_MAX_TABS];
|
||||
uint32 TabWithdrawItemLimit[GUILD_BANK_MAX_TABS];
|
||||
std::string RankName;
|
||||
uint32 TabFlags[GUILD_BANK_MAX_TABS] = { };
|
||||
uint32 TabWithdrawItemLimit[GUILD_BANK_MAX_TABS] = { };
|
||||
String<15, Strings::NoHyperlinks> RankName;
|
||||
};
|
||||
|
||||
class GuildAddRank final : public ClientPacket
|
||||
@@ -464,7 +464,7 @@ namespace WorldPackets
|
||||
|
||||
void Read() override;
|
||||
|
||||
std::string Name;
|
||||
String<15, Strings::NoHyperlinks> Name;
|
||||
int32 RankOrder = 0;
|
||||
};
|
||||
|
||||
@@ -551,7 +551,7 @@ namespace WorldPackets
|
||||
|
||||
void Read() override;
|
||||
|
||||
std::string InfoText;
|
||||
String<500, Strings::NoHyperlinks> InfoText;
|
||||
};
|
||||
|
||||
class GuildSetMemberNote final : public ClientPacket
|
||||
@@ -563,7 +563,7 @@ namespace WorldPackets
|
||||
|
||||
ObjectGuid NoteeGUID;
|
||||
bool IsPublic = false; ///< 0 == Officer, 1 == Public
|
||||
std::string Note;
|
||||
String<31, Strings::NoHyperlinks> Note;
|
||||
};
|
||||
|
||||
class GuildMemberUpdateNote final : public ServerPacket
|
||||
@@ -738,8 +738,8 @@ namespace WorldPackets
|
||||
|
||||
ObjectGuid Banker;
|
||||
uint8 BankTab = 0;
|
||||
std::string Name;
|
||||
std::string Icon;
|
||||
String<15, Strings::NoHyperlinks> Name;
|
||||
String<127> Icon;
|
||||
};
|
||||
|
||||
class GuildBankDepositMoney final : public ClientPacket
|
||||
@@ -1062,7 +1062,7 @@ namespace WorldPackets
|
||||
void Read() override;
|
||||
|
||||
int32 Tab = 0;
|
||||
std::string TabText;
|
||||
String<500, Strings::NoHyperlinks> TabText;
|
||||
};
|
||||
|
||||
class GuildQueryNews final : public ClientPacket
|
||||
@@ -1142,10 +1142,10 @@ namespace WorldPackets
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 CurrentCount[GUILD_CHALLENGES_TYPES];
|
||||
int32 MaxCount[GUILD_CHALLENGES_TYPES];
|
||||
int32 Gold[GUILD_CHALLENGES_TYPES];
|
||||
int32 MaxLevelGold[GUILD_CHALLENGES_TYPES];
|
||||
int32 CurrentCount[GUILD_CHALLENGES_TYPES] = { };
|
||||
int32 MaxCount[GUILD_CHALLENGES_TYPES] = { };
|
||||
int32 Gold[GUILD_CHALLENGES_TYPES] = { };
|
||||
int32 MaxLevelGold[GUILD_CHALLENGES_TYPES] = { };
|
||||
};
|
||||
|
||||
class SaveGuildEmblem final : public ClientPacket
|
||||
|
||||
Reference in New Issue
Block a user