blob: 937d2acfc60e379ae8cbebde0a71e74c22cd7528 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "EquipmentSetPackets.h"
#include "PacketOperators.h"
namespace WorldPackets::EquipmentSet
{
WorldPacket const* EquipmentSetID::Write()
{
_worldPacket << int32(Type);
_worldPacket << uint32(SetID);
_worldPacket << uint64(GUID);
return &_worldPacket;
}
WorldPacket const* LoadEquipmentSet::Write()
{
_worldPacket << Size<uint32>(SetData);
for (EquipmentSetInfo::EquipmentSetData const* equipSet : SetData)
{
_worldPacket << int32(equipSet->Type);
_worldPacket << uint64(equipSet->Guid);
_worldPacket << uint32(equipSet->SetID);
_worldPacket << uint32(equipSet->IgnoreMask);
for (std::size_t i = 0; i < EQUIPMENT_SET_SLOTS; ++i)
{
_worldPacket << equipSet->Pieces[i];
_worldPacket << int32(equipSet->Appearances[i]);
}
_worldPacket.append(equipSet->Enchants.data(), equipSet->Enchants.size());
_worldPacket << int32(equipSet->SecondaryShoulderApparanceID);
_worldPacket << int32(equipSet->SecondaryShoulderSlot);
_worldPacket << int32(equipSet->SecondaryWeaponAppearanceID);
_worldPacket << int32(equipSet->SecondaryWeaponSlot);
_worldPacket << OptionalInit(equipSet->AssignedSpecIndex);
_worldPacket << SizedString::BitsSize<8>(equipSet->SetName);
_worldPacket << SizedString::BitsSize<9>(equipSet->SetIcon);
_worldPacket.FlushBits();
if (equipSet->AssignedSpecIndex)
_worldPacket << int32(*equipSet->AssignedSpecIndex);
_worldPacket << SizedString::Data(equipSet->SetName);
_worldPacket << SizedString::Data(equipSet->SetIcon);
}
return &_worldPacket;
}
void SaveEquipmentSet::Read()
{
_worldPacket >> As<int32>(Set.Type);
_worldPacket >> Set.Guid;
_worldPacket >> Set.SetID;
_worldPacket >> Set.IgnoreMask;
for (uint8 i = 0; i < EQUIPMENT_SET_SLOTS; ++i)
{
_worldPacket >> Set.Pieces[i];
_worldPacket >> Set.Appearances[i];
}
_worldPacket >> Set.Enchants[0];
_worldPacket >> Set.Enchants[1];
_worldPacket >> Set.SecondaryShoulderApparanceID;
_worldPacket >> Set.SecondaryShoulderSlot;
_worldPacket >> Set.SecondaryWeaponAppearanceID;
_worldPacket >> Set.SecondaryWeaponSlot;
_worldPacket >> OptionalInit(Set.AssignedSpecIndex);
_worldPacket >> SizedString::BitsSize<8>(Set.SetName);
_worldPacket >> SizedString::BitsSize<9>(Set.SetIcon);
if (Set.AssignedSpecIndex)
_worldPacket >> *Set.AssignedSpecIndex;
_worldPacket >> SizedString::Data(Set.SetName);
_worldPacket >> SizedString::Data(Set.SetIcon);
}
void DeleteEquipmentSet::Read()
{
_worldPacket >> ID;
}
void UseEquipmentSet::Read()
{
_worldPacket >> Inv;
for (uint8 i = 0; i < EQUIPMENT_SET_SLOTS; ++i)
{
_worldPacket >> Items[i].Item;
_worldPacket >> Items[i].ContainerSlot;
_worldPacket >> Items[i].Slot;
}
_worldPacket >> GUID;
}
WorldPacket const* UseEquipmentSetResult::Write()
{
_worldPacket << int32(Reason);
_worldPacket << uint64(GUID);
return &_worldPacket;
}
}
|