TrinityCore
Loading...
Searching...
No Matches
QueryPackets.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "QueryPackets.h"
19
25
27{
28 _worldPacket << uint32(CreatureID | (Allow ? 0x00000000 : 0x80000000)); // creature entry
29
30 if (Allow)
31 {
32 _worldPacket << Stats.Name;
33 _worldPacket << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty
34 _worldPacket << Stats.Title;
35 _worldPacket << Stats.CursorName; // "Directions" for guard, string for Icons 2.3.0
36 _worldPacket << uint32(Stats.Flags); // flags
37 _worldPacket << uint32(Stats.CreatureType); // CreatureType.dbc
38 _worldPacket << uint32(Stats.CreatureFamily); // CreatureFamily.dbc
39 _worldPacket << uint32(Stats.Classification); // Creature Rank (elite, boss, etc)
40 _worldPacket.append(Stats.ProxyCreatureID, MAX_KILL_CREDIT); // new in 3.1, kill credit
41 _worldPacket.append(Stats.CreatureDisplayID, MAX_CREATURE_MODELS); // Modelid
42 _worldPacket << float(Stats.HpMulti); // dmg/hp modifier
43 _worldPacket << float(Stats.EnergyMulti); // dmg/mana modifier
44 _worldPacket << uint8(Stats.Leader);
45 _worldPacket.append(Stats.QuestItems, MAX_CREATURE_QUEST_ITEMS);
46 _worldPacket << uint32(Stats.CreatureMovementInfoID); // CreatureMovementInfo.dbc
47 }
48
49 return &_worldPacket;
50}
51
53{
54 _worldPacket >> Player;
55}
56
58{
59 data << lookupData.Name;
60 data << lookupData.RealmName;
61 data << uint8(lookupData.Race);
62 data << uint8(lookupData.Sex);
63 data << uint8(lookupData.ClassID);
64 data << uint8(lookupData.DeclinedNames != nullptr);
65
66 if (lookupData.DeclinedNames)
67 for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
68 data << lookupData.DeclinedNames->name[i];
69
70 return data;
71}
72
74{
75 _worldPacket << Player.WriteAsPacked();
76 _worldPacket << uint8(Result);
77
78 if (Data)
79 _worldPacket << *Data;
80
81 return &_worldPacket;
82}
83
85{
86 _worldPacket >> GameObjectID;
87 _worldPacket >> Guid;
88}
89
91{
92 _worldPacket << uint32(GameObjectID | (Allow ? 0x00000000 : 0x80000000));
93
94 if (Allow)
95 {
96 _worldPacket << uint32(Stats.Type);
97 _worldPacket << uint32(Stats.DisplayID);
98 _worldPacket << Stats.Name;
99 _worldPacket << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4
100 _worldPacket << Stats.IconName; // 2.0.3, string. Icon name to use instead of default icon for go's (ex: "Attack" makes sword)
101 _worldPacket << Stats.CastBarCaption; // 2.0.3, string. Text will appear in Cast Bar when using GO (ex: "Collecting")
102 _worldPacket << Stats.UnkString; // 2.0.3, string
103 _worldPacket.append(Stats.Data, MAX_GAMEOBJECT_DATA);
104 _worldPacket << float(Stats.Size); // go size
105 _worldPacket.append(Stats.QuestItems, MAX_GAMEOBJECT_QUEST_ITEMS);
106 }
107
108 return &_worldPacket;
109}
110
112{
113 _worldPacket << uint8(Valid);
114
115 if (Valid)
116 {
117 _worldPacket << int32(MapID);
118 _worldPacket << Position;
119 _worldPacket << int32(ActualMapID);
120 _worldPacket << uint32(Transport);
121 }
122
123 return &_worldPacket;
124}
125
127{
128 _worldPacket >> Transport;
129}
130
132{
133 _worldPacket << Position;
134 _worldPacket << float(Facing);
135
136 return &_worldPacket;
137}
138
140{
141 _worldPacket >> ItemID;
142}
143
145{
146 _worldPacket << uint32(ItemID | (Allow ? 0x00000000 : 0x80000000));
147
148 if (Allow)
149 {
150 _worldPacket << Stats.Class;
151 _worldPacket << Stats.SubClass;
152 _worldPacket << Stats.SoundOverrideSubclass;
153 _worldPacket << Stats.Name;
154 _worldPacket << uint8(0x00); //Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name...
155 _worldPacket << uint8(0x00); //Name3; // blizz not send name there, just uint8(0x00);
156 _worldPacket << uint8(0x00); //Name4; // blizz not send name there, just uint8(0x00);
157 _worldPacket << Stats.DisplayInfoID;
158 _worldPacket << Stats.Quality;
159 _worldPacket << Stats.Flags;
160 _worldPacket << Stats.Flags2;
161 _worldPacket << Stats.BuyPrice;
162 _worldPacket << Stats.SellPrice;
163 _worldPacket << Stats.InventoryType;
164 _worldPacket << Stats.AllowableClass;
165 _worldPacket << Stats.AllowableRace;
166 _worldPacket << Stats.ItemLevel;
167 _worldPacket << Stats.RequiredLevel;
168 _worldPacket << Stats.RequiredSkill;
169 _worldPacket << Stats.RequiredSkillRank;
170 _worldPacket << Stats.RequiredSpell;
171 _worldPacket << Stats.RequiredHonorRank;
172 _worldPacket << Stats.RequiredCityRank;
173 _worldPacket << Stats.RequiredReputationFaction;
174 _worldPacket << Stats.RequiredReputationRank;
175 _worldPacket << int32(Stats.MaxCount);
176 _worldPacket << int32(Stats.Stackable);
177 _worldPacket << Stats.ContainerSlots;
178 _worldPacket << Stats.StatsCount; // item stats count
179 for (uint32 i = 0; i < Stats.StatsCount; ++i)
180 {
181 _worldPacket << Stats.ItemStat[i].ItemStatType;
182 _worldPacket << Stats.ItemStat[i].ItemStatValue;
183 }
184 _worldPacket << Stats.ScalingStatDistribution; // scaling stats distribution
185 _worldPacket << Stats.ScalingStatValue; // some kind of flags used to determine stat values column
186 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
187 {
188 _worldPacket << Stats.Damage[i].DamageMin;
189 _worldPacket << Stats.Damage[i].DamageMax;
190 _worldPacket << Stats.Damage[i].DamageType;
191 }
192
193 // resistances (7)
194 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
195 _worldPacket << Stats.Resistance[i];
196
197 _worldPacket << Stats.Delay;
198 _worldPacket << Stats.AmmoType;
199 _worldPacket << Stats.RangedModRange;
200
201 for (uint8 s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
202 {
203 // spells are validated on template loading
204 if (Stats.Spells[s].SpellId > 0)
205 {
206 _worldPacket << Stats.Spells[s].SpellId;
207 _worldPacket << Stats.Spells[s].SpellTrigger;
208 _worldPacket << int32(Stats.Spells[s].SpellCharges);
209 _worldPacket << uint32(Stats.Spells[s].SpellCooldown);
210 _worldPacket << uint32(Stats.Spells[s].SpellCategory);
211 _worldPacket << uint32(Stats.Spells[s].SpellCategoryCooldown);
212 }
213 else
214 {
215 _worldPacket << uint32(0);
216 _worldPacket << uint32(0);
217 _worldPacket << uint32(0);
218 _worldPacket << uint32(-1);
219 _worldPacket << uint32(0);
220 _worldPacket << uint32(-1);
221 }
222 }
223 _worldPacket << Stats.Bonding;
224 _worldPacket << Stats.Description;
225 _worldPacket << Stats.PageText;
226 _worldPacket << Stats.LanguageID;
227 _worldPacket << Stats.PageMaterial;
228 _worldPacket << Stats.StartQuest;
229 _worldPacket << Stats.LockID;
230 _worldPacket << int32(Stats.Material);
231 _worldPacket << Stats.Sheath;
232 _worldPacket << Stats.RandomProperty;
233 _worldPacket << Stats.RandomSuffix;
234 _worldPacket << Stats.Block;
235 _worldPacket << Stats.ItemSet;
236 _worldPacket << Stats.MaxDurability;
237 _worldPacket << Stats.Area;
238 _worldPacket << Stats.Map; // Added in 1.12.x & 2.0.1 client branch
239 _worldPacket << Stats.BagFamily;
240 _worldPacket << Stats.TotemCategory;
241 for (uint8 s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s)
242 {
243 _worldPacket << Stats.Socket[s].Color;
244 _worldPacket << Stats.Socket[s].Content;
245 }
246 _worldPacket << Stats.SocketBonus;
247 _worldPacket << Stats.GemProperties;
248 _worldPacket << Stats.RequiredDisenchantSkill;
249 _worldPacket << Stats.ArmorDamageModifier;
250 _worldPacket << Stats.Duration; // added in 2.4.2.8209, duration (seconds)
251 _worldPacket << Stats.ItemLimitCategory; // WotLK, ItemLimitCategory
252 _worldPacket << Stats.HolidayId; // Holiday.dbc?
253 }
254
255 return &_worldPacket;
256}
257
259{
260 _worldPacket >> MissingQuestCount; // quest count, max=25
261
262 if (MissingQuestCount <= MAX_QUEST_LOG_SIZE)
263 {
264 for (uint8 i = 0; i < MissingQuestCount; ++i)
265 _worldPacket >> MissingQuestPOIs[i];
266 }
267
268 _worldPacket.rfinish();
269}
static const uint32 MAX_CREATURE_QUEST_ITEMS
static const uint8 MAX_KILL_CREDIT
static const uint32 MAX_CREATURE_MODELS
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define MAX_GAMEOBJECT_QUEST_ITEMS
#define MAX_ITEM_PROTO_SOCKETS
#define MAX_ITEM_PROTO_DAMAGES
#define MAX_ITEM_PROTO_SPELLS
ByteBuffer & operator<<(ByteBuffer &buf, ObjectGuid const &guid)
#define MAX_QUEST_LOG_SIZE
Definition QuestDef.h:36
@ SPELL_SCHOOL_NORMAL
@ MAX_SPELL_SCHOOL
#define MAX_GAMEOBJECT_DATA
Stats
#define MAX_DECLINED_NAME_CASES
Data
WorldPacket _worldPacket
Definition Packet.h:42
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
std::string name[MAX_DECLINED_NAME_CASES]