mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
Core/PacketIO: Added more utilities for packet writing for strings and optionals implemented with unique_ptr
# Conflicts: # src/server/game/Server/Packets/LFGPackets.cpp
This commit is contained in:
@@ -17,7 +17,9 @@
|
||||
|
||||
#include "LFGPackets.h"
|
||||
|
||||
void WorldPackets::LFG::DFJoin::Read()
|
||||
namespace WorldPackets::LFG
|
||||
{
|
||||
void DFJoin::Read()
|
||||
{
|
||||
QueueAsGroup = _worldPacket.ReadBit();
|
||||
bool hasPartyIndex = _worldPacket.ReadBit();
|
||||
@@ -30,12 +32,12 @@ void WorldPackets::LFG::DFJoin::Read()
|
||||
_worldPacket >> slot;
|
||||
}
|
||||
|
||||
void WorldPackets::LFG::DFLeave::Read()
|
||||
void DFLeave::Read()
|
||||
{
|
||||
_worldPacket >> Ticket;
|
||||
}
|
||||
|
||||
void WorldPackets::LFG::DFProposalResponse::Read()
|
||||
void DFProposalResponse::Read()
|
||||
{
|
||||
_worldPacket >> Ticket;
|
||||
_worldPacket >> InstanceID;
|
||||
@@ -43,7 +45,7 @@ void WorldPackets::LFG::DFProposalResponse::Read()
|
||||
Accepted = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
void WorldPackets::LFG::DFSetRoles::Read()
|
||||
void DFSetRoles::Read()
|
||||
{
|
||||
bool hasPartyIndex = _worldPacket.ReadBit();
|
||||
_worldPacket >> RolesDesired;
|
||||
@@ -51,24 +53,24 @@ void WorldPackets::LFG::DFSetRoles::Read()
|
||||
_worldPacket >> PartyIndex.emplace();
|
||||
}
|
||||
|
||||
void WorldPackets::LFG::DFBootPlayerVote::Read()
|
||||
void DFBootPlayerVote::Read()
|
||||
{
|
||||
Vote = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
void WorldPackets::LFG::DFTeleport::Read()
|
||||
void DFTeleport::Read()
|
||||
{
|
||||
TeleportOut = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
void WorldPackets::LFG::DFGetSystemInfo::Read()
|
||||
void DFGetSystemInfo::Read()
|
||||
{
|
||||
Player = _worldPacket.ReadBit();
|
||||
if (_worldPacket.ReadBit())
|
||||
_worldPacket >> PartyIndex.emplace();
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGBlackListSlot const& lfgBlackListSlot)
|
||||
ByteBuffer& operator<<(ByteBuffer& data, LFGBlackListSlot const& lfgBlackListSlot)
|
||||
{
|
||||
data << uint32(lfgBlackListSlot.Slot);
|
||||
data << uint32(lfgBlackListSlot.Reason);
|
||||
@@ -79,20 +81,20 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGBlackListSlot con
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGBlackList const& blackList)
|
||||
ByteBuffer& operator<<(ByteBuffer& data, LFGBlackList const& blackList)
|
||||
{
|
||||
data.WriteBit(blackList.PlayerGuid.has_value());
|
||||
data << uint32(blackList.Slot.size());
|
||||
if (blackList.PlayerGuid)
|
||||
data << *blackList.PlayerGuid;
|
||||
|
||||
for (WorldPackets::LFG::LFGBlackListSlot const& slot : blackList.Slot)
|
||||
for (LFGBlackListSlot const& slot : blackList.Slot)
|
||||
data << slot;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LfgPlayerDungeonInfo const& playerDungeonInfo)
|
||||
ByteBuffer& operator<<(ByteBuffer& data, LfgPlayerDungeonInfo const& playerDungeonInfo)
|
||||
{
|
||||
data << uint32(playerDungeonInfo.Slot);
|
||||
data << int32(playerDungeonInfo.CompletionQuantity);
|
||||
@@ -115,13 +117,13 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LfgPlayerDungeonInfo
|
||||
data.FlushBits();
|
||||
|
||||
data << playerDungeonInfo.Rewards;
|
||||
for (WorldPackets::LFG::LfgPlayerQuestReward const& shortageReward : playerDungeonInfo.ShortageReward)
|
||||
for (LfgPlayerQuestReward const& shortageReward : playerDungeonInfo.ShortageReward)
|
||||
data << shortageReward;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LfgPlayerInfo::Write()
|
||||
WorldPacket const* LfgPlayerInfo::Write()
|
||||
{
|
||||
_worldPacket << uint32(Dungeon.size());
|
||||
_worldPacket << BlackList;
|
||||
@@ -131,16 +133,16 @@ WorldPacket const* WorldPackets::LFG::LfgPlayerInfo::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LfgPartyInfo::Write()
|
||||
WorldPacket const* LfgPartyInfo::Write()
|
||||
{
|
||||
_worldPacket << uint32(Player.size());
|
||||
for (WorldPackets::LFG::LFGBlackList const& player : Player)
|
||||
for (LFGBlackList const& player : Player)
|
||||
_worldPacket << player;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LFGUpdateStatus::Write()
|
||||
WorldPacket const* LFGUpdateStatus::Write()
|
||||
{
|
||||
_worldPacket << Ticket;
|
||||
_worldPacket << uint8(SubType);
|
||||
@@ -167,7 +169,7 @@ WorldPacket const* WorldPackets::LFG::LFGUpdateStatus::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::RoleChosen::Write()
|
||||
WorldPacket const* RoleChosen::Write()
|
||||
{
|
||||
_worldPacket << Player;
|
||||
_worldPacket << uint8(RoleMask);
|
||||
@@ -177,7 +179,7 @@ WorldPacket const* WorldPackets::LFG::RoleChosen::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGRoleCheckUpdateMember const& lfgRoleCheckUpdateMember)
|
||||
ByteBuffer& operator<<(ByteBuffer& data, LFGRoleCheckUpdateMember const& lfgRoleCheckUpdateMember)
|
||||
{
|
||||
data << lfgRoleCheckUpdateMember.Guid;
|
||||
data << uint8(lfgRoleCheckUpdateMember.RolesDesired);
|
||||
@@ -188,7 +190,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGRoleCheckUpdateMe
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LFGRoleCheckUpdate::Write()
|
||||
WorldPacket const* LFGRoleCheckUpdate::Write()
|
||||
{
|
||||
_worldPacket << uint8(PartyIndex);
|
||||
_worldPacket << uint8(RoleCheckStatus);
|
||||
@@ -213,7 +215,7 @@ WorldPacket const* WorldPackets::LFG::LFGRoleCheckUpdate::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LFGJoinResult::Write()
|
||||
WorldPacket const* LFGJoinResult::Write()
|
||||
{
|
||||
_worldPacket << Ticket;
|
||||
_worldPacket << uint8(Result);
|
||||
@@ -234,7 +236,7 @@ WorldPacket const* WorldPackets::LFG::LFGJoinResult::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LFGQueueStatus::Write()
|
||||
WorldPacket const* LFGQueueStatus::Write()
|
||||
{
|
||||
_worldPacket << Ticket;
|
||||
_worldPacket << uint32(Slot);
|
||||
@@ -251,7 +253,7 @@ WorldPacket const* WorldPackets::LFG::LFGQueueStatus::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGPlayerRewards const& lfgPlayerRewards)
|
||||
ByteBuffer& operator<<(ByteBuffer& data, LFGPlayerRewards const& lfgPlayerRewards)
|
||||
{
|
||||
data.WriteBit(lfgPlayerRewards.RewardItem.has_value());
|
||||
data.WriteBit(lfgPlayerRewards.RewardCurrency.has_value());
|
||||
@@ -266,7 +268,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGPlayerRewards con
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LFGPlayerReward::Write()
|
||||
WorldPacket const* LFGPlayerReward::Write()
|
||||
{
|
||||
_worldPacket << uint32(QueuedSlot);
|
||||
_worldPacket << uint32(ActualSlot);
|
||||
@@ -280,31 +282,31 @@ WorldPacket const* WorldPackets::LFG::LFGPlayerReward::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LfgBootInfo const& lfgBootInfo)
|
||||
ByteBuffer& operator<<(ByteBuffer& data, LfgBootInfo const& lfgBootInfo)
|
||||
{
|
||||
data.WriteBit(lfgBootInfo.VoteInProgress);
|
||||
data.WriteBit(lfgBootInfo.VotePassed);
|
||||
data.WriteBit(lfgBootInfo.MyVoteCompleted);
|
||||
data.WriteBit(lfgBootInfo.MyVote);
|
||||
data.WriteBits(lfgBootInfo.Reason.length(), 8);
|
||||
data << Bits<1>(lfgBootInfo.VoteInProgress);
|
||||
data << Bits<1>(lfgBootInfo.VotePassed);
|
||||
data << Bits<1>(lfgBootInfo.MyVoteCompleted);
|
||||
data << Bits<1>(lfgBootInfo.MyVote);
|
||||
data << SizedString::BitsSize<8>(lfgBootInfo.Reason);
|
||||
data << lfgBootInfo.Target;
|
||||
data << uint32(lfgBootInfo.TotalVotes);
|
||||
data << uint32(lfgBootInfo.BootVotes);
|
||||
data << int32(lfgBootInfo.TimeLeft);
|
||||
data << uint32(lfgBootInfo.VotesNeeded);
|
||||
data.WriteString(lfgBootInfo.Reason);
|
||||
data << SizedString::Data(lfgBootInfo.Reason);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LfgBootPlayer::Write()
|
||||
WorldPacket const* LfgBootPlayer::Write()
|
||||
{
|
||||
_worldPacket << Info;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGProposalUpdatePlayer const& lfgProposalUpdatePlayer)
|
||||
ByteBuffer& operator<<(ByteBuffer& data, LFGProposalUpdatePlayer const& lfgProposalUpdatePlayer)
|
||||
{
|
||||
data << uint8(lfgProposalUpdatePlayer.Roles);
|
||||
data.WriteBit(lfgProposalUpdatePlayer.Me);
|
||||
@@ -317,7 +319,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::LFG::LFGProposalUpdatePla
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LFGProposalUpdate::Write()
|
||||
WorldPacket const* LFGProposalUpdate::Write()
|
||||
{
|
||||
_worldPacket << Ticket;
|
||||
_worldPacket << uint64(InstanceID);
|
||||
@@ -339,17 +341,18 @@ WorldPacket const* WorldPackets::LFG::LFGProposalUpdate::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LFGOfferContinue::Write()
|
||||
WorldPacket const* LFGOfferContinue::Write()
|
||||
{
|
||||
_worldPacket << uint32(Slot);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::LFG::LFGTeleportDenied::Write()
|
||||
WorldPacket const* LFGTeleportDenied::Write()
|
||||
{
|
||||
_worldPacket.WriteBits(Reason, 4);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,6 +388,35 @@ namespace WorldPackets
|
||||
template<typename T>
|
||||
inline OptionalInitReaderWriter<T> OptionalInit(Optional<T>& value) { return { value }; }
|
||||
|
||||
template<typename T>
|
||||
struct PtrInitWriter
|
||||
{
|
||||
std::unique_ptr<T> const& Ptr;
|
||||
|
||||
friend inline ByteBuffer& operator<<(ByteBuffer& data, PtrInitWriter const& opt)
|
||||
{
|
||||
data.WriteBit(opt.Ptr != nullptr);
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct PtrInitReaderWriter : PtrInitWriter<T>
|
||||
{
|
||||
friend inline ByteBuffer& operator>>(ByteBuffer& data, PtrInitReaderWriter const& opt)
|
||||
{
|
||||
if (data.ReadBit())
|
||||
const_cast<std::unique_ptr<T>&>(opt.Ptr) = std::make_unique<T>();
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline PtrInitWriter<T> OptionalInit(std::unique_ptr<T> const& value) { return { value }; }
|
||||
|
||||
template<typename T>
|
||||
inline PtrInitReaderWriter<T> OptionalInit(std::unique_ptr<T>& value) { return { value }; }
|
||||
|
||||
template<uint32 BitCount, typename T>
|
||||
struct BitsWriter
|
||||
{
|
||||
@@ -443,6 +472,106 @@ namespace WorldPackets
|
||||
|
||||
template<uint32 BitCount, typename Container>
|
||||
inline BitsSizeReaderWriter<BitCount, Container> BitsSize(Container& value) { return { value }; }
|
||||
|
||||
namespace SizedString
|
||||
{
|
||||
template<uint32 BitCount, typename Container>
|
||||
inline BitsSizeWriter<BitCount, Container> BitsSize(Container const& value) { return { value }; }
|
||||
|
||||
template<uint32 BitCount, typename Container>
|
||||
inline BitsSizeReaderWriter<BitCount, Container> BitsSize(Container& value) { return { value }; }
|
||||
|
||||
template<typename Container>
|
||||
struct SizedStringWriter
|
||||
{
|
||||
Container const& Value;
|
||||
|
||||
friend inline ByteBuffer& operator<<(ByteBuffer& data, SizedStringWriter const& string)
|
||||
{
|
||||
data.WriteString(string.Value);
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Container>
|
||||
struct SizedStringReaderWriter : SizedStringWriter<Container>
|
||||
{
|
||||
friend inline ByteBuffer& operator>>(ByteBuffer& data, SizedStringReaderWriter const& string)
|
||||
{
|
||||
const_cast<Container&>(string.Value) = data.ReadString(string.Value.length());
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Container>
|
||||
inline SizedStringWriter<Container> Data(Container const& value) { return { value }; }
|
||||
|
||||
template<typename Container>
|
||||
inline SizedStringReaderWriter<Container> Data(Container& value) { return { value }; }
|
||||
}
|
||||
|
||||
// SizedCString (sends size + string + null terminator but only if not empty)
|
||||
namespace SizedCString
|
||||
{
|
||||
template<uint32 BitCount, typename Container>
|
||||
struct SizeWriter
|
||||
{
|
||||
Container const& Value;
|
||||
|
||||
friend inline ByteBuffer& operator<<(ByteBuffer& data, SizeWriter const& bits)
|
||||
{
|
||||
data.WriteBits(static_cast<uint32>(bits.Value.length() + 1), BitCount);
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
template<uint32 BitCount, typename Container>
|
||||
struct SizeReaderWriter : SizeWriter<BitCount, Container>
|
||||
{
|
||||
friend inline ByteBuffer& operator>>(ByteBuffer& data, SizeReaderWriter const& bits)
|
||||
{
|
||||
if (uint32 bytesIncludingNullTerminator = data.ReadBits(BitCount); bytesIncludingNullTerminator > 1)
|
||||
const_cast<Container&>(bits.Value).resize(bytesIncludingNullTerminator - 1);
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
template<uint32 BitCount, typename Container>
|
||||
inline SizeWriter<BitCount, Container> BitsSize(Container const& value) { return { value }; }
|
||||
|
||||
template<uint32 BitCount, typename Container>
|
||||
inline SizeReaderWriter<BitCount, Container> BitsSize(Container& value) { return { value }; }
|
||||
|
||||
template<typename Container>
|
||||
struct DataWriter
|
||||
{
|
||||
Container const& Value;
|
||||
|
||||
friend inline ByteBuffer& operator<<(ByteBuffer& data, DataWriter const& string)
|
||||
{
|
||||
if (!string.Value.empty())
|
||||
data << string.Value;
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Container>
|
||||
struct DataReaderWriter : DataWriter<Container>
|
||||
{
|
||||
friend inline ByteBuffer& operator>>(ByteBuffer& data, DataReaderWriter const& string)
|
||||
{
|
||||
const_cast<Container&>(string.Value) = data.ReadString(string.Value.length());
|
||||
data.read_skip<char>(); // null terminator
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Container>
|
||||
inline DataWriter<Container> Data(Container const& value) { return { value }; }
|
||||
|
||||
template<typename Container>
|
||||
inline DataReaderWriter<Container> Data(Container& value) { return { value }; }
|
||||
};
|
||||
}
|
||||
|
||||
#endif // PacketUtilities_h__
|
||||
|
||||
@@ -16,14 +16,17 @@
|
||||
*/
|
||||
|
||||
#include "PetitionPackets.h"
|
||||
#include "PacketUtilities.h"
|
||||
|
||||
void WorldPackets::Petition::QueryPetition::Read()
|
||||
namespace WorldPackets::Petition
|
||||
{
|
||||
void QueryPetition::Read()
|
||||
{
|
||||
_worldPacket >> PetitionID;
|
||||
_worldPacket >> ItemGUID;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Petition::PetitionInfo const& petitionInfo)
|
||||
ByteBuffer& operator<<(ByteBuffer& data, PetitionInfo const& petitionInfo)
|
||||
{
|
||||
data << int32(petitionInfo.PetitionID);
|
||||
data << petitionInfo.Petitioner;
|
||||
@@ -41,24 +44,24 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Petition::PetitionInfo co
|
||||
data << int32(petitionInfo.StaticType);
|
||||
data << uint32(petitionInfo.Muid);
|
||||
|
||||
data.WriteBits(petitionInfo.Title.length(), 7);
|
||||
data.WriteBits(petitionInfo.BodyText.length(), 12);
|
||||
data << SizedString::BitsSize<7>(petitionInfo.Title);
|
||||
data << SizedString::BitsSize<12>(petitionInfo.BodyText);
|
||||
|
||||
for (std::size_t i = 0; i < petitionInfo.Choicetext.size(); ++i)
|
||||
data.WriteBits(petitionInfo.Choicetext[i].length(), 6);
|
||||
for (std::string const& choiceText : petitionInfo.Choicetext)
|
||||
data << SizedString::BitsSize<6>(choiceText);
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
for (std::size_t i = 0; i < petitionInfo.Choicetext.size(); ++i)
|
||||
data.WriteString(petitionInfo.Choicetext[i]);
|
||||
for (std::string const& choiceText : petitionInfo.Choicetext)
|
||||
data << SizedString::Data(choiceText);
|
||||
|
||||
data.WriteString(petitionInfo.Title);
|
||||
data.WriteString(petitionInfo.BodyText);
|
||||
data << SizedString::Data(petitionInfo.Title);
|
||||
data << SizedString::Data(petitionInfo.BodyText);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Petition::QueryPetitionResponse::Write()
|
||||
WorldPacket const* QueryPetitionResponse::Write()
|
||||
{
|
||||
_worldPacket << uint32(PetitionID);
|
||||
_worldPacket.WriteBit(Allow);
|
||||
@@ -70,12 +73,12 @@ WorldPacket const* WorldPackets::Petition::QueryPetitionResponse::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Petition::PetitionShowList::Read()
|
||||
void PetitionShowList::Read()
|
||||
{
|
||||
_worldPacket >> PetitionUnit;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Petition::ServerPetitionShowList::Write()
|
||||
WorldPacket const* ServerPetitionShowList::Write()
|
||||
{
|
||||
_worldPacket << Unit;
|
||||
_worldPacket << Price;
|
||||
@@ -83,7 +86,7 @@ WorldPacket const* WorldPackets::Petition::ServerPetitionShowList::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Petition::PetitionBuy::Read()
|
||||
void PetitionBuy::Read()
|
||||
{
|
||||
uint32 titleLen = _worldPacket.ReadBits(7);
|
||||
|
||||
@@ -92,12 +95,12 @@ void WorldPackets::Petition::PetitionBuy::Read()
|
||||
Title = _worldPacket.ReadString(titleLen);
|
||||
}
|
||||
|
||||
void WorldPackets::Petition::PetitionShowSignatures::Read()
|
||||
void PetitionShowSignatures::Read()
|
||||
{
|
||||
_worldPacket >> Item;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Petition::ServerPetitionShowSignatures::Write()
|
||||
WorldPacket const* ServerPetitionShowSignatures::Write()
|
||||
{
|
||||
_worldPacket << Item;
|
||||
_worldPacket << Owner;
|
||||
@@ -114,13 +117,13 @@ WorldPacket const* WorldPackets::Petition::ServerPetitionShowSignatures::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Petition::SignPetition::Read()
|
||||
void SignPetition::Read()
|
||||
{
|
||||
_worldPacket >> PetitionGUID;
|
||||
_worldPacket >> Choice;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Petition::PetitionSignResults::Write()
|
||||
WorldPacket const* PetitionSignResults::Write()
|
||||
{
|
||||
_worldPacket << Item;
|
||||
_worldPacket << Player;
|
||||
@@ -131,24 +134,24 @@ WorldPacket const* WorldPackets::Petition::PetitionSignResults::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Petition::PetitionAlreadySigned::Write()
|
||||
WorldPacket const* PetitionAlreadySigned::Write()
|
||||
{
|
||||
_worldPacket << SignerGUID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Petition::DeclinePetition::Read()
|
||||
void DeclinePetition::Read()
|
||||
{
|
||||
_worldPacket >> PetitionGUID;
|
||||
}
|
||||
|
||||
void WorldPackets::Petition::TurnInPetition::Read()
|
||||
void TurnInPetition::Read()
|
||||
{
|
||||
_worldPacket >> Item;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Petition::TurnInPetitionResult::Write()
|
||||
WorldPacket const* TurnInPetitionResult::Write()
|
||||
{
|
||||
_worldPacket.WriteBits(Result, 4);
|
||||
_worldPacket.FlushBits();
|
||||
@@ -156,20 +159,20 @@ WorldPacket const* WorldPackets::Petition::TurnInPetitionResult::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Petition::OfferPetition::Read()
|
||||
void OfferPetition::Read()
|
||||
{
|
||||
_worldPacket >> ItemGUID;
|
||||
_worldPacket >> TargetPlayer;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Petition::OfferPetitionError::Write()
|
||||
WorldPacket const* OfferPetitionError::Write()
|
||||
{
|
||||
_worldPacket << PlayerGUID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Petition::PetitionRenameGuild::Read()
|
||||
void PetitionRenameGuild::Read()
|
||||
{
|
||||
_worldPacket >> PetitionGuid;
|
||||
|
||||
@@ -179,7 +182,7 @@ void WorldPackets::Petition::PetitionRenameGuild::Read()
|
||||
NewGuildName = _worldPacket.ReadString(nameLen);
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Petition::PetitionRenameGuildResponse::Write()
|
||||
WorldPacket const* PetitionRenameGuildResponse::Write()
|
||||
{
|
||||
_worldPacket << PetitionGuid;
|
||||
|
||||
@@ -190,3 +193,4 @@ WorldPacket const* WorldPackets::Petition::PetitionRenameGuildResponse::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,6 +241,4 @@ namespace WorldPackets
|
||||
}
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Petition::PetitionInfo const& petitionInfo);
|
||||
|
||||
#endif // PetitionPackets_h__
|
||||
|
||||
@@ -49,14 +49,14 @@ WorldPacket const* WorldPackets::Ticket::GMTicketCaseStatus::Write()
|
||||
_worldPacket << uint64(c.CharacterID);
|
||||
_worldPacket << int32(c.WaitTimeOverrideMinutes);
|
||||
|
||||
_worldPacket.WriteBits(c.Url.size(), 11);
|
||||
_worldPacket.WriteBits(c.WaitTimeOverrideMessage.size(), 10);
|
||||
_worldPacket << SizedString::BitsSize<11>(c.Url);
|
||||
_worldPacket << SizedString::BitsSize<10>(c.WaitTimeOverrideMessage);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
_worldPacket.WriteString(c.Url);
|
||||
_worldPacket.WriteString(c.WaitTimeOverrideMessage);
|
||||
_worldPacket << SizedString::Data(c.Url);
|
||||
_worldPacket << SizedString::Data(c.WaitTimeOverrideMessage);
|
||||
}
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user