TrinityCore
UpdateFields.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 "UpdateFields.h"
19#include "AreaTrigger.h"
20#include "ByteBuffer.h"
21#include "Corpse.h"
22#include "DynamicObject.h"
23#include "Player.h"
25
26// This file is automatically generated, DO NOT EDIT
27
28#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
29#pragma GCC diagnostic push
30#pragma GCC diagnostic ignored "-Wunused-parameter"
31#else
32#pragma warning(push)
33#pragma warning(disable: 4100)
34#endif
35
36namespace UF
37{
38void ObjectData::WriteCreate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Object const* owner, Player const* receiver) const
39{
40 data << int32(ViewerDependentValue<EntryIDTag>::GetValue(this, owner, receiver));
41 data << uint32(ViewerDependentValue<DynamicFlagsTag>::GetValue(this, owner, receiver));
42 data << float(Scale);
43}
44
45void ObjectData::WriteUpdate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Object const* owner, Player const* receiver) const
46{
47 WriteUpdate(data, _changesMask, false, owner, receiver);
48}
49
50void ObjectData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bool ignoreNestedChangesMask, Object const* owner, Player const* receiver) const
51{
52 data.WriteBits(changesMask.GetBlock(0), 4);
53
54 data.FlushBits();
55 if (changesMask[0])
56 {
57 if (changesMask[1])
58 {
59 data << int32(ViewerDependentValue<EntryIDTag>::GetValue(this, owner, receiver));
60 }
61 if (changesMask[2])
62 {
63 data << uint32(ViewerDependentValue<DynamicFlagsTag>::GetValue(this, owner, receiver));
64 }
65 if (changesMask[3])
66 {
67 data << float(Scale);
68 }
69 }
70}
71
73{
78}
79
80void ItemEnchantment::WriteCreate(ByteBuffer& data, Item const* owner, Player const* receiver) const
81{
82 data << int32(ID);
83 data << uint32(Duration);
84 data << int16(Charges);
85 data << uint16(Inactive);
86}
87
88void ItemEnchantment::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Item const* owner, Player const* receiver) const
89{
90 Mask changesMask = _changesMask;
91 if (ignoreChangesMask)
92 changesMask.SetAll();
93
94 data.WriteBits(changesMask.GetBlock(0), 5);
95
96 data.FlushBits();
97 if (changesMask[0])
98 {
99 if (changesMask[1])
100 {
101 data << int32(ID);
102 }
103 if (changesMask[2])
104 {
105 data << uint32(Duration);
106 }
107 if (changesMask[3])
108 {
109 data << int16(Charges);
110 }
111 if (changesMask[4])
112 {
113 data << uint16(Inactive);
114 }
115 }
116}
117
119{
125}
126
127void ItemMod::WriteCreate(ByteBuffer& data, Item const* owner, Player const* receiver) const
128{
129 data << int32(Value);
130 data << uint8(Type);
131}
132
133void ItemMod::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Item const* owner, Player const* receiver) const
134{
135 data << int32(Value);
136 data << uint8(Type);
137}
138
139bool ItemMod::operator==(ItemMod const& right) const
140{
141 return Value == right.Value
142 && Type == right.Type;
143}
144
145void ItemModList::WriteCreate(ByteBuffer& data, Item const* owner, Player const* receiver) const
146{
147 data.WriteBits(Values.size(), 6);
148 for (uint32 i = 0; i < Values.size(); ++i)
149 {
150 Values[i].WriteCreate(data, owner, receiver);
151 }
152 data.FlushBits();
153}
154
155void ItemModList::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Item const* owner, Player const* receiver) const
156{
157 Mask changesMask = _changesMask;
158 if (ignoreChangesMask)
159 changesMask.SetAll();
160
161 data.WriteBits(changesMask.GetBlock(0), 1);
162
163 if (changesMask[0])
164 {
165 if (!ignoreChangesMask)
166 Values.WriteUpdateMask(data, 6);
167 else
169 }
170 data.FlushBits();
171 if (changesMask[0])
172 {
173 for (uint32 i = 0; i < Values.size(); ++i)
174 {
175 if (Values.HasChanged(i) || ignoreChangesMask)
176 {
177 Values[i].WriteUpdate(data, ignoreChangesMask, owner, receiver);
178 }
179 }
180 }
181 data.FlushBits();
182}
183
185{
188}
189
190void ArtifactPower::WriteCreate(ByteBuffer& data, Item const* owner, Player const* receiver) const
191{
192 data << int16(ArtifactPowerID);
193 data << uint8(PurchasedRank);
195}
196
197void ArtifactPower::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Item const* owner, Player const* receiver) const
198{
199 data << int16(ArtifactPowerID);
200 data << uint8(PurchasedRank);
202}
203
205{
206 return ArtifactPowerID == right.ArtifactPowerID
207 && PurchasedRank == right.PurchasedRank
209}
210
211void SocketedGem::WriteCreate(ByteBuffer& data, Item const* owner, Player const* receiver) const
212{
213 data << int32(ItemID);
214 for (uint32 i = 0; i < 16; ++i)
215 {
216 data << uint16(BonusListIDs[i]);
217 }
218 data << uint8(Context);
219}
220
221void SocketedGem::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Item const* owner, Player const* receiver) const
222{
223 Mask changesMask = _changesMask;
224 if (ignoreChangesMask)
225 changesMask.SetAll();
226
227 data.WriteBits(changesMask.GetBlocksMask(0), 1);
228 if (changesMask.GetBlock(0))
229 data.WriteBits(changesMask.GetBlock(0), 32);
230
231 data.FlushBits();
232 if (changesMask[0])
233 {
234 if (changesMask[1])
235 {
236 data << int32(ItemID);
237 }
238 if (changesMask[2])
239 {
240 data << uint8(Context);
241 }
242 }
243 if (changesMask[3])
244 {
245 for (uint32 i = 0; i < 16; ++i)
246 {
247 if (changesMask[4 + i])
248 {
249 data << uint16(BonusListIDs[i]);
250 }
251 }
252 }
253}
254
256{
261}
262
263void ItemData::WriteCreate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Item const* owner, Player const* receiver) const
264{
265 data << Owner;
266 data << ContainedIn;
267 data << Creator;
268 data << GiftCreator;
269 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
270 {
271 data << uint32(StackCount);
272 data << uint32(Expiration);
273 for (uint32 i = 0; i < 5; ++i)
274 {
275 data << int32(SpellCharges[i]);
276 }
277 }
278 data << uint32(DynamicFlags);
279 for (uint32 i = 0; i < 13; ++i)
280 {
281 Enchantment[i].WriteCreate(data, owner, receiver);
282 }
283 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
284 {
285 data << uint32(Durability);
286 data << uint32(MaxDurability);
287 }
288 data << uint32(CreatePlayedTime);
289 data << int32(Context);
290 data << int64(CreateTime);
291 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
292 {
293 data << uint64(ArtifactXP);
294 data << uint8(ItemAppearanceModID);
295 }
296 data << uint32(ArtifactPowers.size());
297 data << uint32(Gems.size());
298 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
299 {
300 data << uint32(DynamicFlags2);
301 }
302 data << ItemBonusKey;
303 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
304 {
305 data << uint16(DEBUGItemLevel);
306 }
307 for (uint32 i = 0; i < ArtifactPowers.size(); ++i)
308 {
309 ArtifactPowers[i].WriteCreate(data, owner, receiver);
310 }
311 for (uint32 i = 0; i < Gems.size(); ++i)
312 {
313 Gems[i].WriteCreate(data, owner, receiver);
314 }
315 Modifiers->WriteCreate(data, owner, receiver);
316}
317
318void ItemData::WriteUpdate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Item const* owner, Player const* receiver) const
319{
320 Mask allowedMaskForTarget({ 0xF80A727Fu, 0x000001FFu });
321 AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
322 WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver);
323}
324
325void ItemData::AppendAllowedFieldsMaskForFlag(Mask& allowedMaskForTarget, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags)
326{
327 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
328 allowedMaskForTarget |= { 0x07F58D80u, 0x00000000u };
329}
330
332{
333 Mask allowedMaskForTarget({ 0xF80A727Fu, 0x000001FFu });
334 AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
335 changesMask &= allowedMaskForTarget;
336}
337
338void ItemData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bool ignoreNestedChangesMask, Item const* owner, Player const* receiver) const
339{
340 data.WriteBits(changesMask.GetBlocksMask(0), 2);
341 for (uint32 i = 0; i < 2; ++i)
342 if (changesMask.GetBlock(i))
343 data.WriteBits(changesMask.GetBlock(i), 32);
344
345 if (changesMask[0])
346 {
347 if (changesMask[1])
348 {
349 if (!ignoreNestedChangesMask)
351 else
353 }
354 if (changesMask[2])
355 {
356 if (!ignoreNestedChangesMask)
357 Gems.WriteUpdateMask(data);
358 else
360 }
361 }
362 data.FlushBits();
363 if (changesMask[0])
364 {
365 if (changesMask[1])
366 {
367 for (uint32 i = 0; i < ArtifactPowers.size(); ++i)
368 {
369 if (ArtifactPowers.HasChanged(i) || ignoreNestedChangesMask)
370 {
371 ArtifactPowers[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
372 }
373 }
374 }
375 if (changesMask[2])
376 {
377 for (uint32 i = 0; i < Gems.size(); ++i)
378 {
379 if (Gems.HasChanged(i) || ignoreNestedChangesMask)
380 {
381 Gems[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
382 }
383 }
384 }
385 if (changesMask[3])
386 {
387 data << Owner;
388 }
389 if (changesMask[4])
390 {
391 data << ContainedIn;
392 }
393 if (changesMask[5])
394 {
395 data << Creator;
396 }
397 if (changesMask[6])
398 {
399 data << GiftCreator;
400 }
401 if (changesMask[7])
402 {
403 data << uint32(StackCount);
404 }
405 if (changesMask[8])
406 {
407 data << uint32(Expiration);
408 }
409 if (changesMask[9])
410 {
411 data << uint32(DynamicFlags);
412 }
413 if (changesMask[10])
414 {
415 data << uint32(Durability);
416 }
417 if (changesMask[11])
418 {
419 data << uint32(MaxDurability);
420 }
421 if (changesMask[12])
422 {
423 data << uint32(CreatePlayedTime);
424 }
425 if (changesMask[13])
426 {
427 data << int32(Context);
428 }
429 if (changesMask[14])
430 {
431 data << int64(CreateTime);
432 }
433 if (changesMask[15])
434 {
435 data << uint64(ArtifactXP);
436 }
437 if (changesMask[16])
438 {
439 data << uint8(ItemAppearanceModID);
440 }
441 if (changesMask[18])
442 {
443 data << uint32(DynamicFlags2);
444 }
445 if (changesMask[19])
446 {
447 data << ItemBonusKey;
448 }
449 if (changesMask[20])
450 {
451 data << uint16(DEBUGItemLevel);
452 }
453 if (changesMask[17])
454 {
455 Modifiers->WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
456 }
457 }
458 if (changesMask[21])
459 {
460 for (uint32 i = 0; i < 5; ++i)
461 {
462 if (changesMask[22 + i])
463 {
464 data << int32(SpellCharges[i]);
465 }
466 }
467 }
468 if (changesMask[27])
469 {
470 for (uint32 i = 0; i < 13; ++i)
471 {
472 if (changesMask[28 + i])
473 {
474 Enchantment[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
475 }
476 }
477 }
478}
479
481{
505}
506
507void ContainerData::WriteCreate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Bag const* owner, Player const* receiver) const
508{
509 for (uint32 i = 0; i < 36; ++i)
510 {
511 data << Slots[i];
512 }
513 data << uint32(NumSlots);
514}
515
516void ContainerData::WriteUpdate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Bag const* owner, Player const* receiver) const
517{
518 WriteUpdate(data, _changesMask, false, owner, receiver);
519}
520
521void ContainerData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bool ignoreNestedChangesMask, Bag const* owner, Player const* receiver) const
522{
523 data.WriteBits(changesMask.GetBlocksMask(0), 2);
524 for (uint32 i = 0; i < 2; ++i)
525 if (changesMask.GetBlock(i))
526 data.WriteBits(changesMask.GetBlock(i), 32);
527
528 data.FlushBits();
529 if (changesMask[0])
530 {
531 if (changesMask[1])
532 {
533 data << uint32(NumSlots);
534 }
535 }
536 if (changesMask[2])
537 {
538 for (uint32 i = 0; i < 36; ++i)
539 {
540 if (changesMask[3 + i])
541 {
542 data << Slots[i];
543 }
544 }
545 }
546}
547
549{
553}
554
555void AzeriteEmpoweredItemData::WriteCreate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, AzeriteEmpoweredItem const* owner, Player const* receiver) const
556{
557 for (uint32 i = 0; i < 5; ++i)
558 {
559 data << int32(Selections[i]);
560 }
561}
562
563void AzeriteEmpoweredItemData::WriteUpdate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, AzeriteEmpoweredItem const* owner, Player const* receiver) const
564{
565 WriteUpdate(data, _changesMask, false, owner, receiver);
566}
567
568void AzeriteEmpoweredItemData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bool ignoreNestedChangesMask, AzeriteEmpoweredItem const* owner, Player const* receiver) const
569{
570 data.WriteBits(changesMask.GetBlocksMask(0), 1);
571 if (changesMask.GetBlock(0))
572 data.WriteBits(changesMask.GetBlock(0), 32);
573
574 data.FlushBits();
575 if (changesMask[0])
576 {
577 for (uint32 i = 0; i < 5; ++i)
578 {
579 if (changesMask[1 + i])
580 {
581 data << int32(Selections[i]);
582 }
583 }
584 }
585}
586
588{
591}
592
593void UnlockedAzeriteEssence::WriteCreate(ByteBuffer& data, AzeriteItem const* owner, Player const* receiver) const
594{
595 data << uint32(AzeriteEssenceID);
596 data << uint32(Rank);
597}
598
599void UnlockedAzeriteEssence::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, AzeriteItem const* owner, Player const* receiver) const
600{
601 data << uint32(AzeriteEssenceID);
602 data << uint32(Rank);
603}
604
606{
607 return AzeriteEssenceID == right.AzeriteEssenceID
608 && Rank == right.Rank;
609}
610
611void SelectedAzeriteEssences::WriteCreate(ByteBuffer& data, AzeriteItem const* owner, Player const* receiver) const
612{
613 for (uint32 i = 0; i < 4; ++i)
614 {
615 data << uint32(AzeriteEssenceID[i]);
616 }
617 data << uint32(SpecializationID);
618 data.WriteBit(Enabled);
619 data.FlushBits();
620}
621
622void SelectedAzeriteEssences::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, AzeriteItem const* owner, Player const* receiver) const
623{
624 Mask changesMask = _changesMask;
625 if (ignoreChangesMask)
626 changesMask.SetAll();
627
628 data.WriteBits(changesMask.GetBlocksMask(0), 1);
629 if (changesMask.GetBlock(0))
630 data.WriteBits(changesMask.GetBlock(0), 32);
631
632 if (changesMask[0])
633 {
634 if (changesMask[1])
635 {
636 data.WriteBit(Enabled);
637 }
638 }
639 data.FlushBits();
640 if (changesMask[0])
641 {
642 if (changesMask[2])
643 {
644 data << uint32(SpecializationID);
645 }
646 }
647 if (changesMask[3])
648 {
649 for (uint32 i = 0; i < 4; ++i)
650 {
651 if (changesMask[4 + i])
652 {
653 data << uint32(AzeriteEssenceID[i]);
654 }
655 }
656 }
657 data.FlushBits();
658}
659
661{
666}
667
668void AzeriteItemData::WriteCreate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, AzeriteItem const* owner, Player const* receiver) const
669{
670 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
671 {
672 data << uint64(Xp);
673 data << uint32(Level);
674 data << uint32(AuraLevel);
675 data << uint32(KnowledgeLevel);
676 data << int32(DEBUGknowledgeWeek);
677 }
678 data << uint32(UnlockedEssences.size());
679 data << uint32(SelectedEssences.size());
681 for (uint32 i = 0; i < UnlockedEssences.size(); ++i)
682 {
683 UnlockedEssences[i].WriteCreate(data, owner, receiver);
684 }
685 for (uint32 i = 0; i < UnlockedEssenceMilestones.size(); ++i)
686 {
688 }
689 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
690 {
691 data.WriteBit(Enabled);
692 }
693 for (uint32 i = 0; i < SelectedEssences.size(); ++i)
694 {
695 SelectedEssences[i].WriteCreate(data, owner, receiver);
696 }
697 data.FlushBits();
698}
699
700void AzeriteItemData::WriteUpdate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, AzeriteItem const* owner, Player const* receiver) const
701{
702 Mask allowedMaskForTarget({ 0x0000001Du });
703 AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
704 WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver);
705}
706
707void AzeriteItemData::AppendAllowedFieldsMaskForFlag(Mask& allowedMaskForTarget, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags)
708{
709 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
710 allowedMaskForTarget |= { 0x000003E2u };
711}
712
714{
715 Mask allowedMaskForTarget({ 0x0000001Du });
716 AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
717 changesMask &= allowedMaskForTarget;
718}
719
720void AzeriteItemData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bool ignoreNestedChangesMask, AzeriteItem const* owner, Player const* receiver) const
721{
722 data.WriteBits(changesMask.GetBlock(0), 10);
723
724 if (changesMask[0])
725 {
726 if (changesMask[1])
727 {
728 data.WriteBit(Enabled);
729 }
730 if (changesMask[2])
731 {
732 if (!ignoreNestedChangesMask)
734 else
736 }
737 if (changesMask[3])
738 {
739 if (!ignoreNestedChangesMask)
741 else
743 }
744 if (changesMask[4])
745 {
746 if (!ignoreNestedChangesMask)
748 else
750 }
751 }
752 data.FlushBits();
753 if (changesMask[0])
754 {
755 if (changesMask[2])
756 {
757 for (uint32 i = 0; i < UnlockedEssences.size(); ++i)
758 {
759 if (UnlockedEssences.HasChanged(i) || ignoreNestedChangesMask)
760 {
761 UnlockedEssences[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
762 }
763 }
764 }
765 if (changesMask[4])
766 {
767 for (uint32 i = 0; i < UnlockedEssenceMilestones.size(); ++i)
768 {
769 if (UnlockedEssenceMilestones.HasChanged(i) || ignoreNestedChangesMask)
770 {
772 }
773 }
774 }
775 if (changesMask[3])
776 {
777 for (uint32 i = 0; i < SelectedEssences.size(); ++i)
778 {
779 if (SelectedEssences.HasChanged(i) || ignoreNestedChangesMask)
780 {
781 SelectedEssences[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
782 }
783 }
784 }
785 if (changesMask[5])
786 {
787 data << uint64(Xp);
788 }
789 if (changesMask[6])
790 {
791 data << uint32(Level);
792 }
793 if (changesMask[7])
794 {
795 data << uint32(AuraLevel);
796 }
797 if (changesMask[8])
798 {
799 data << uint32(KnowledgeLevel);
800 }
801 if (changesMask[9])
802 {
803 data << int32(DEBUGknowledgeWeek);
804 }
805 }
806 data.FlushBits();
807}
808
810{
821}
822
823void SpellCastVisual::WriteCreate(ByteBuffer& data, Object const* owner, Player const* receiver) const
824{
825 data << int32(SpellXSpellVisualID);
826 data << int32(ScriptVisualID);
827}
828
829void SpellCastVisual::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Object const* owner, Player const* receiver) const
830{
831 data << int32(SpellXSpellVisualID);
832 data << int32(ScriptVisualID);
833}
834
836{
838 && ScriptVisualID == right.ScriptVisualID;
839}
840
841void UnitChannel::WriteCreate(ByteBuffer& data, Unit const* owner, Player const* receiver) const
842{
843 data << int32(SpellID);
844 SpellVisual.WriteCreate(data, owner, receiver);
845}
846
847void UnitChannel::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Unit const* owner, Player const* receiver) const
848{
849 data << int32(SpellID);
850 SpellVisual.WriteUpdate(data, ignoreChangesMask, owner, receiver);
851}
852
853bool UnitChannel::operator==(UnitChannel const& right) const
854{
855 return SpellID == right.SpellID
856 && SpellVisual == right.SpellVisual;
857}
858
859void VisibleItem::WriteCreate(ByteBuffer& data, Unit const* owner, Player const* receiver) const
860{
861 data << int32(ItemID);
865 data << uint16(ItemVisual);
866}
867
868void VisibleItem::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Unit const* owner, Player const* receiver) const
869{
870 Mask changesMask = _changesMask;
871 if (ignoreChangesMask)
872 changesMask.SetAll();
873
874 data.WriteBits(changesMask.GetBlock(0), 6);
875
876 data.FlushBits();
877 if (changesMask[0])
878 {
879 if (changesMask[1])
880 {
881 data << int32(ItemID);
882 }
883 if (changesMask[2])
884 {
886 }
887 if (changesMask[3])
888 {
890 }
891 if (changesMask[4])
892 {
894 }
895 if (changesMask[5])
896 {
897 data << uint16(ItemVisual);
898 }
899 }
900}
901
903{
910}
911
912void PassiveSpellHistory::WriteCreate(ByteBuffer& data, Unit const* owner, Player const* receiver) const
913{
914 data << int32(SpellID);
915 data << int32(AuraSpellID);
916}
917
918void PassiveSpellHistory::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Unit const* owner, Player const* receiver) const
919{
920 data << int32(SpellID);
921 data << int32(AuraSpellID);
922}
923
925{
926 return SpellID == right.SpellID
927 && AuraSpellID == right.AuraSpellID;
928}
929
930void UnitData::WriteCreate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Unit const* owner, Player const* receiver) const
931{
932 data << int32(ViewerDependentValue<DisplayIDTag>::GetValue(this, owner, receiver));
933 for (uint32 i = 0; i < 2; ++i)
934 {
935 data << uint32(ViewerDependentValue<NpcFlagsTag>::GetValue(this, i, owner, receiver));
936 }
937 data << uint32(StateSpellVisualID);
938 data << uint32(StateAnimID);
939 data << uint32(StateAnimKitID);
940 data << uint32(StateWorldEffectIDs->size());
942 data << int32(SpellOverrideNameID);
943 for (uint32 i = 0; i < StateWorldEffectIDs->size(); ++i)
944 {
945 data << uint32((*StateWorldEffectIDs)[i]);
946 }
947 data << Charm;
948 data << Summon;
949 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
950 {
951 data << Critter;
952 }
953 data << CharmedBy;
954 data << SummonedBy;
955 data << CreatedBy;
956 data << DemonCreator;
958 data << Target;
960 data << uint64(BattlePetDBID);
961 ChannelData->WriteCreate(data, owner, receiver);
962 data << int8(SpellEmpowerStage);
964 data << uint8(Race);
965 data << uint8(ClassId);
966 data << uint8(PlayerClassId);
967 data << uint8(Sex);
968 data << uint8(DisplayPower);
970 data << int64(Health);
971 for (uint32 i = 0; i < 10; ++i)
972 {
973 data << int32(Power[i]);
974 data << int32(MaxPower[i]);
975 }
976 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner | UpdateFieldFlag::UnitAll))
977 {
978 for (uint32 i = 0; i < 10; ++i)
979 {
980 data << float(PowerRegenFlatModifier[i]);
981 data << float(PowerRegenInterruptedFlatModifier[i]);
982 }
983 }
984 data << int64(MaxHealth);
985 data << int32(Level);
986 data << int32(EffectiveLevel);
987 data << int32(ContentTuningID);
988 data << int32(ScalingLevelMin);
989 data << int32(ScalingLevelMax);
990 data << int32(ScalingLevelDelta);
991 data << int32(ScalingFactionGroup);
994 data << int32(ViewerDependentValue<FactionTemplateTag>::GetValue(this, owner, receiver));
995 for (uint32 i = 0; i < 3; ++i)
996 {
997 VirtualItems[i].WriteCreate(data, owner, receiver);
998 }
999 data << uint32(ViewerDependentValue<FlagsTag>::GetValue(this, owner, receiver));
1000 data << uint32(Flags2);
1001 data << uint32(ViewerDependentValue<Flags3Tag>::GetValue(this, owner, receiver));
1002 data << uint32(ViewerDependentValue<AuraStateTag>::GetValue(this, owner, receiver));
1003 for (uint32 i = 0; i < 2; ++i)
1004 {
1005 data << uint32(AttackRoundBaseTime[i]);
1006 }
1007 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
1008 {
1010 }
1011 data << float(BoundingRadius);
1012 data << float(CombatReach);
1013 data << float(DisplayScale);
1014 data << int32(CreatureFamily);
1015 data << int32(CreatureType);
1016 data << int32(NativeDisplayID);
1017 data << float(NativeXDisplayScale);
1018 data << int32(MountDisplayID);
1020 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner | UpdateFieldFlag::Empath))
1021 {
1022 data << float(MinDamage);
1023 data << float(MaxDamage);
1024 data << float(MinOffHandDamage);
1025 data << float(MaxOffHandDamage);
1026 }
1027 data << uint8(StandState);
1028 data << uint8(PetTalentPoints);
1029 data << uint8(VisFlags);
1030 data << uint8(AnimTier);
1031 data << uint32(PetNumber);
1032 data << uint32(PetNameTimestamp);
1033 data << uint32(PetExperience);
1035 data << float(ModCastingSpeed);
1036 data << float(ModCastingSpeedNeg);
1037 data << float(ModSpellHaste);
1038 data << float(ModHaste);
1039 data << float(ModRangedHaste);
1040 data << float(ModHasteRegen);
1041 data << float(ModTimeRate);
1042 data << int32(CreatedBySpell);
1043 data << int32(EmoteState);
1044 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
1045 {
1046 for (uint32 i = 0; i < 4; ++i)
1047 {
1048 data << int32(Stats[i]);
1049 data << int32(StatPosBuff[i]);
1050 data << int32(StatNegBuff[i]);
1051 data << int32(StatSupportBuff[i]);
1052 }
1053 }
1054 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner | UpdateFieldFlag::Empath))
1055 {
1056 for (uint32 i = 0; i < 7; ++i)
1057 {
1058 data << int32(Resistances[i]);
1059 }
1060 }
1061 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
1062 {
1063 for (uint32 i = 0; i < 7; ++i)
1064 {
1065 data << int32(BonusResistanceMods[i]);
1066 data << int32(ManaCostModifier[i]);
1067 }
1068 }
1069 data << int32(BaseMana);
1070 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
1071 {
1072 data << int32(BaseHealth);
1073 }
1074 data << uint8(SheatheState);
1075 data << uint8(ViewerDependentValue<PvpFlagsTag>::GetValue(this, owner, receiver));
1076 data << uint8(PetFlags);
1077 data << uint8(ShapeshiftForm);
1078 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
1079 {
1080 data << int32(AttackPower);
1081 data << int32(AttackPowerModPos);
1082 data << int32(AttackPowerModNeg);
1083 data << float(AttackPowerMultiplier);
1085 data << int32(RangedAttackPower);
1088 data << float(RangedAttackPowerMultiplier);
1093 data << int32(SetAttackSpeedAura);
1094 data << float(Lifesteal);
1095 data << float(MinRangedDamage);
1096 data << float(MaxRangedDamage);
1097 data << float(ManaCostMultiplier);
1098 data << float(MaxHealthModifier);
1099 }
1100 data << float(HoverHeight);
1101 data << int32(MinItemLevelCutoff);
1102 data << int32(MinItemLevel);
1103 data << int32(MaxItemLevel);
1104 data << int32(AzeriteItemLevel);
1105 data << int32(WildBattlePetLevel);
1108 data << int32(ViewerDependentValue<InteractSpellIDTag>::GetValue(this, owner, receiver));
1109 data << int32(ScaleDuration);
1110 data << int32(LooksLikeMountID);
1111 data << int32(LooksLikeCreatureID);
1112 data << int32(LookAtControllerID);
1113 data << int32(PerksVendorItemID);
1114 data << int32(TaxiNodesID);
1115 data << GuildGUID;
1116 data << uint32(PassiveSpells.size());
1117 data << uint32(WorldEffects.size());
1118 data << uint32(ChannelObjects.size());
1119 data << int32(FlightCapabilityID);
1120 data << float(GlideEventSpeedDivisor);
1121 data << uint32(SilencedSchoolMask);
1122 data << uint32(CurrentAreaID);
1123 data << NameplateAttachToGUID;
1124 for (uint32 i = 0; i < PassiveSpells.size(); ++i)
1125 {
1126 PassiveSpells[i].WriteCreate(data, owner, receiver);
1127 }
1128 for (uint32 i = 0; i < WorldEffects.size(); ++i)
1129 {
1130 data << int32(WorldEffects[i]);
1131 }
1132 for (uint32 i = 0; i < ChannelObjects.size(); ++i)
1133 {
1134 data << ChannelObjects[i];
1135 }
1136}
1137
1138void UnitData::WriteUpdate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Unit const* owner, Player const* receiver) const
1139{
1140 Mask allowedMaskForTarget({ 0xFFFFDFFFu, 0xC3FEFFFFu, 0x003DFFFFu, 0xFFFFFC01u, 0x007FFFFFu, 0x0003F800u, 0x00000000u });
1141 AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
1142 WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver);
1143}
1144
1145void UnitData::AppendAllowedFieldsMaskForFlag(Mask& allowedMaskForTarget, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags)
1146{
1147 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Owner))
1148 allowedMaskForTarget |= { 0x00002000u, 0x3C010000u, 0xFFC20000u, 0x000003FEu, 0xFF800004u, 0xFFFC07FFu, 0x01FFFFFFu };
1149 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::UnitAll))
1150 allowedMaskForTarget |= { 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0xFF800004u, 0x000007FFu, 0x00000000u };
1151 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::Empath))
1152 allowedMaskForTarget |= { 0x00000000u, 0x3C000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x000007F8u };
1153}
1154
1156{
1157 Mask allowedMaskForTarget({ 0xFFFFDFFFu, 0xC3FEFFFFu, 0x003DFFFFu, 0xFFFFFC01u, 0x007FFFFFu, 0x0003F800u, 0x00000000u });
1158 AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
1159 changesMask &= allowedMaskForTarget;
1160}
1161
1162void UnitData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bool ignoreNestedChangesMask, Unit const* owner, Player const* receiver) const
1163{
1164 data.WriteBits(changesMask.GetBlocksMask(0), 7);
1165 for (uint32 i = 0; i < 7; ++i)
1166 if (changesMask.GetBlock(i))
1167 data.WriteBits(changesMask.GetBlock(i), 32);
1168
1169 if (changesMask[0])
1170 {
1171 if (changesMask[1])
1172 {
1173 data.WriteBits(StateWorldEffectIDs->size(), 32);
1174 for (uint32 i = 0; i < StateWorldEffectIDs->size(); ++i)
1175 {
1176 data << uint32((*StateWorldEffectIDs)[i]);
1177 }
1178 }
1179 }
1180 data.FlushBits();
1181 if (changesMask[0])
1182 {
1183 if (changesMask[2])
1184 {
1185 if (!ignoreNestedChangesMask)
1187 else
1189 }
1190 if (changesMask[3])
1191 {
1192 if (!ignoreNestedChangesMask)
1194 else
1196 }
1197 if (changesMask[4])
1198 {
1199 if (!ignoreNestedChangesMask)
1201 else
1203 }
1204 }
1205 data.FlushBits();
1206 if (changesMask[0])
1207 {
1208 if (changesMask[2])
1209 {
1210 for (uint32 i = 0; i < PassiveSpells.size(); ++i)
1211 {
1212 if (PassiveSpells.HasChanged(i) || ignoreNestedChangesMask)
1213 {
1214 PassiveSpells[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
1215 }
1216 }
1217 }
1218 if (changesMask[3])
1219 {
1220 for (uint32 i = 0; i < WorldEffects.size(); ++i)
1221 {
1222 if (WorldEffects.HasChanged(i) || ignoreNestedChangesMask)
1223 {
1224 data << int32(WorldEffects[i]);
1225 }
1226 }
1227 }
1228 if (changesMask[4])
1229 {
1230 for (uint32 i = 0; i < ChannelObjects.size(); ++i)
1231 {
1232 if (ChannelObjects.HasChanged(i) || ignoreNestedChangesMask)
1233 {
1234 data << ChannelObjects[i];
1235 }
1236 }
1237 }
1238 if (changesMask[5])
1239 {
1240 data << int32(ViewerDependentValue<DisplayIDTag>::GetValue(this, owner, receiver));
1241 }
1242 if (changesMask[6])
1243 {
1244 data << uint32(StateSpellVisualID);
1245 }
1246 if (changesMask[7])
1247 {
1248 data << uint32(StateAnimID);
1249 }
1250 if (changesMask[8])
1251 {
1252 data << uint32(StateAnimKitID);
1253 }
1254 if (changesMask[9])
1255 {
1257 }
1258 if (changesMask[10])
1259 {
1260 data << int32(SpellOverrideNameID);
1261 }
1262 if (changesMask[11])
1263 {
1264 data << Charm;
1265 }
1266 if (changesMask[12])
1267 {
1268 data << Summon;
1269 }
1270 if (changesMask[13])
1271 {
1272 data << Critter;
1273 }
1274 if (changesMask[14])
1275 {
1276 data << CharmedBy;
1277 }
1278 if (changesMask[15])
1279 {
1280 data << SummonedBy;
1281 }
1282 if (changesMask[16])
1283 {
1284 data << CreatedBy;
1285 }
1286 if (changesMask[17])
1287 {
1288 data << DemonCreator;
1289 }
1290 if (changesMask[18])
1291 {
1292 data << LookAtControllerTarget;
1293 }
1294 if (changesMask[19])
1295 {
1296 data << Target;
1297 }
1298 if (changesMask[20])
1299 {
1300 data << BattlePetCompanionGUID;
1301 }
1302 if (changesMask[21])
1303 {
1304 data << uint64(BattlePetDBID);
1305 }
1306 if (changesMask[22])
1307 {
1308 ChannelData->WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
1309 }
1310 if (changesMask[23])
1311 {
1312 data << int8(SpellEmpowerStage);
1313 }
1314 if (changesMask[24])
1315 {
1316 data << uint32(SummonedByHomeRealm);
1317 }
1318 if (changesMask[25])
1319 {
1320 data << uint8(Race);
1321 }
1322 if (changesMask[26])
1323 {
1324 data << uint8(ClassId);
1325 }
1326 if (changesMask[27])
1327 {
1328 data << uint8(PlayerClassId);
1329 }
1330 if (changesMask[28])
1331 {
1332 data << uint8(Sex);
1333 }
1334 if (changesMask[29])
1335 {
1336 data << uint8(DisplayPower);
1337 }
1338 if (changesMask[30])
1339 {
1341 }
1342 if (changesMask[31])
1343 {
1344 data << int64(Health);
1345 }
1346 }
1347 if (changesMask[32])
1348 {
1349 if (changesMask[33])
1350 {
1351 data << int64(MaxHealth);
1352 }
1353 if (changesMask[34])
1354 {
1355 data << int32(Level);
1356 }
1357 if (changesMask[35])
1358 {
1359 data << int32(EffectiveLevel);
1360 }
1361 if (changesMask[36])
1362 {
1363 data << int32(ContentTuningID);
1364 }
1365 if (changesMask[37])
1366 {
1367 data << int32(ScalingLevelMin);
1368 }
1369 if (changesMask[38])
1370 {
1371 data << int32(ScalingLevelMax);
1372 }
1373 if (changesMask[39])
1374 {
1375 data << int32(ScalingLevelDelta);
1376 }
1377 if (changesMask[40])
1378 {
1379 data << int32(ScalingFactionGroup);
1380 }
1381 if (changesMask[41])
1382 {
1384 }
1385 if (changesMask[42])
1386 {
1388 }
1389 if (changesMask[43])
1390 {
1391 data << int32(ViewerDependentValue<FactionTemplateTag>::GetValue(this, owner, receiver));
1392 }
1393 if (changesMask[44])
1394 {
1395 data << uint32(ViewerDependentValue<FlagsTag>::GetValue(this, owner, receiver));
1396 }
1397 if (changesMask[45])
1398 {
1399 data << uint32(Flags2);
1400 }
1401 if (changesMask[46])
1402 {
1403 data << uint32(ViewerDependentValue<Flags3Tag>::GetValue(this, owner, receiver));
1404 }
1405 if (changesMask[47])
1406 {
1407 data << uint32(ViewerDependentValue<AuraStateTag>::GetValue(this, owner, receiver));
1408 }
1409 if (changesMask[48])
1410 {
1412 }
1413 if (changesMask[49])
1414 {
1415 data << float(BoundingRadius);
1416 }
1417 if (changesMask[50])
1418 {
1419 data << float(CombatReach);
1420 }
1421 if (changesMask[51])
1422 {
1423 data << float(DisplayScale);
1424 }
1425 if (changesMask[52])
1426 {
1427 data << int32(CreatureFamily);
1428 }
1429 if (changesMask[53])
1430 {
1431 data << int32(CreatureType);
1432 }
1433 if (changesMask[54])
1434 {
1435 data << int32(NativeDisplayID);
1436 }
1437 if (changesMask[55])
1438 {
1439 data << float(NativeXDisplayScale);
1440 }
1441 if (changesMask[56])
1442 {
1443 data << int32(MountDisplayID);
1444 }
1445 if (changesMask[57])
1446 {
1448 }
1449 if (changesMask[58])
1450 {
1451 data << float(MinDamage);
1452 }
1453 if (changesMask[59])
1454 {
1455 data << float(MaxDamage);
1456 }
1457 if (changesMask[60])
1458 {
1459 data << float(MinOffHandDamage);
1460 }
1461 if (changesMask[61])
1462 {
1463 data << float(MaxOffHandDamage);
1464 }
1465 if (changesMask[62])
1466 {
1467 data << uint8(StandState);
1468 }
1469 if (changesMask[63])
1470 {
1471 data << uint8(PetTalentPoints);
1472 }
1473 }
1474 if (changesMask[64])
1475 {
1476 if (changesMask[65])
1477 {
1478 data << uint8(VisFlags);
1479 }
1480 if (changesMask[66])
1481 {
1482 data << uint8(AnimTier);
1483 }
1484 if (changesMask[67])
1485 {
1486 data << uint32(PetNumber);
1487 }
1488 if (changesMask[68])
1489 {
1490 data << uint32(PetNameTimestamp);
1491 }
1492 if (changesMask[69])
1493 {
1494 data << uint32(PetExperience);
1495 }
1496 if (changesMask[70])
1497 {
1499 }
1500 if (changesMask[71])
1501 {
1502 data << float(ModCastingSpeed);
1503 }
1504 if (changesMask[72])
1505 {
1506 data << float(ModCastingSpeedNeg);
1507 }
1508 if (changesMask[73])
1509 {
1510 data << float(ModSpellHaste);
1511 }
1512 if (changesMask[74])
1513 {
1514 data << float(ModHaste);
1515 }
1516 if (changesMask[75])
1517 {
1518 data << float(ModRangedHaste);
1519 }
1520 if (changesMask[76])
1521 {
1522 data << float(ModHasteRegen);
1523 }
1524 if (changesMask[77])
1525 {
1526 data << float(ModTimeRate);
1527 }
1528 if (changesMask[78])
1529 {
1530 data << int32(CreatedBySpell);
1531 }
1532 if (changesMask[79])
1533 {
1534 data << int32(EmoteState);
1535 }
1536 if (changesMask[80])
1537 {
1538 data << int32(BaseMana);
1539 }
1540 if (changesMask[81])
1541 {
1542 data << int32(BaseHealth);
1543 }
1544 if (changesMask[82])
1545 {
1546 data << uint8(SheatheState);
1547 }
1548 if (changesMask[83])
1549 {
1550 data << uint8(ViewerDependentValue<PvpFlagsTag>::GetValue(this, owner, receiver));
1551 }
1552 if (changesMask[84])
1553 {
1554 data << uint8(PetFlags);
1555 }
1556 if (changesMask[85])
1557 {
1558 data << uint8(ShapeshiftForm);
1559 }
1560 if (changesMask[86])
1561 {
1562 data << int32(AttackPower);
1563 }
1564 if (changesMask[87])
1565 {
1566 data << int32(AttackPowerModPos);
1567 }
1568 if (changesMask[88])
1569 {
1570 data << int32(AttackPowerModNeg);
1571 }
1572 if (changesMask[89])
1573 {
1574 data << float(AttackPowerMultiplier);
1575 }
1576 if (changesMask[90])
1577 {
1579 }
1580 if (changesMask[91])
1581 {
1582 data << int32(RangedAttackPower);
1583 }
1584 if (changesMask[92])
1585 {
1587 }
1588 if (changesMask[93])
1589 {
1591 }
1592 if (changesMask[94])
1593 {
1594 data << float(RangedAttackPowerMultiplier);
1595 }
1596 if (changesMask[95])
1597 {
1599 }
1600 }
1601 if (changesMask[96])
1602 {
1603 if (changesMask[97])
1604 {
1606 }
1607 if (changesMask[98])
1608 {
1610 }
1611 if (changesMask[99])
1612 {
1614 }
1615 if (changesMask[100])
1616 {
1617 data << int32(SetAttackSpeedAura);
1618 }
1619 if (changesMask[101])
1620 {
1621 data << float(Lifesteal);
1622 }
1623 if (changesMask[102])
1624 {
1625 data << float(MinRangedDamage);
1626 }
1627 if (changesMask[103])
1628 {
1629 data << float(MaxRangedDamage);
1630 }
1631 if (changesMask[104])
1632 {
1633 data << float(ManaCostMultiplier);
1634 }
1635 if (changesMask[105])
1636 {
1637 data << float(MaxHealthModifier);
1638 }
1639 if (changesMask[106])
1640 {
1641 data << float(HoverHeight);
1642 }
1643 if (changesMask[107])
1644 {
1645 data << int32(MinItemLevelCutoff);
1646 }
1647 if (changesMask[108])
1648 {
1649 data << int32(MinItemLevel);
1650 }
1651 if (changesMask[109])
1652 {
1653 data << int32(MaxItemLevel);
1654 }
1655 if (changesMask[110])
1656 {
1657 data << int32(AzeriteItemLevel);
1658 }
1659 if (changesMask[111])
1660 {
1661 data << int32(WildBattlePetLevel);
1662 }
1663 if (changesMask[112])
1664 {
1666 }
1667 if (changesMask[113])
1668 {
1670 }
1671 if (changesMask[114])
1672 {
1673 data << int32(ViewerDependentValue<InteractSpellIDTag>::GetValue(this, owner, receiver));
1674 }
1675 if (changesMask[115])
1676 {
1677 data << int32(ScaleDuration);
1678 }
1679 if (changesMask[116])
1680 {
1681 data << int32(LooksLikeMountID);
1682 }
1683 if (changesMask[117])
1684 {
1685 data << int32(LooksLikeCreatureID);
1686 }
1687 if (changesMask[118])
1688 {
1689 data << int32(LookAtControllerID);
1690 }
1691 if (changesMask[119])
1692 {
1693 data << int32(PerksVendorItemID);
1694 }
1695 if (changesMask[120])
1696 {
1697 data << int32(TaxiNodesID);
1698 }
1699 if (changesMask[121])
1700 {
1701 data << GuildGUID;
1702 }
1703 if (changesMask[122])
1704 {
1705 data << int32(FlightCapabilityID);
1706 }
1707 if (changesMask[123])
1708 {
1709 data << float(GlideEventSpeedDivisor);
1710 }
1711 if (changesMask[124])
1712 {
1713 data << uint32(SilencedSchoolMask);
1714 }
1715 if (changesMask[125])
1716 {
1717 data << uint32(CurrentAreaID);
1718 }
1719 if (changesMask[126])
1720 {
1721 data << NameplateAttachToGUID;
1722 }
1723 }
1724 if (changesMask[127])
1725 {
1726 for (uint32 i = 0; i < 2; ++i)
1727 {
1728 if (changesMask[128 + i])
1729 {
1730 data << uint32(ViewerDependentValue<NpcFlagsTag>::GetValue(this, i, owner, receiver));
1731 }
1732 }
1733 }
1734 if (changesMask[130])
1735 {
1736 for (uint32 i = 0; i < 10; ++i)
1737 {
1738 if (changesMask[131 + i])
1739 {
1740 data << int32(Power[i]);
1741 }
1742 if (changesMask[141 + i])
1743 {
1744 data << int32(MaxPower[i]);
1745 }
1746 if (changesMask[151 + i])
1747 {
1748 data << float(PowerRegenFlatModifier[i]);
1749 }
1750 if (changesMask[161 + i])
1751 {
1752 data << float(PowerRegenInterruptedFlatModifier[i]);
1753 }
1754 }
1755 }
1756 if (changesMask[171])
1757 {
1758 for (uint32 i = 0; i < 3; ++i)
1759 {
1760 if (changesMask[172 + i])
1761 {
1762 VirtualItems[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
1763 }
1764 }
1765 }
1766 if (changesMask[175])
1767 {
1768 for (uint32 i = 0; i < 2; ++i)
1769 {
1770 if (changesMask[176 + i])
1771 {
1772 data << uint32(AttackRoundBaseTime[i]);
1773 }
1774 }
1775 }
1776 if (changesMask[178])
1777 {
1778 for (uint32 i = 0; i < 4; ++i)
1779 {
1780 if (changesMask[179 + i])
1781 {
1782 data << int32(Stats[i]);
1783 }
1784 if (changesMask[183 + i])
1785 {
1786 data << int32(StatPosBuff[i]);
1787 }
1788 if (changesMask[187 + i])
1789 {
1790 data << int32(StatNegBuff[i]);
1791 }
1792 if (changesMask[191 + i])
1793 {
1794 data << int32(StatSupportBuff[i]);
1795 }
1796 }
1797 }
1798 if (changesMask[195])
1799 {
1800 for (uint32 i = 0; i < 7; ++i)
1801 {
1802 if (changesMask[196 + i])
1803 {
1804 data << int32(Resistances[i]);
1805 }
1806 if (changesMask[203 + i])
1807 {
1808 data << int32(BonusResistanceMods[i]);
1809 }
1810 if (changesMask[210 + i])
1811 {
1812 data << int32(ManaCostModifier[i]);
1813 }
1814 }
1815 }
1816}
1817
1819{
1958}
1959
1960void ChrCustomizationChoice::WriteCreate(ByteBuffer& data, Object const* owner, Player const* receiver) const
1961{
1964}
1965
1966void ChrCustomizationChoice::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Object const* owner, Player const* receiver) const
1967{
1970}
1971
1973{
1976}
1977
1978void QuestLog::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
1979{
1980 data << int64(EndTime);
1981 data << int32(QuestID);
1982 data << uint32(StateFlags);
1983 data << uint32(ObjectiveFlags);
1984 for (uint32 i = 0; i < 24; ++i)
1985 {
1986 data << int16(ObjectiveProgress[i]);
1987 }
1988}
1989
1990void QuestLog::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
1991{
1992 Mask changesMask = _changesMask;
1993 if (ignoreChangesMask)
1994 changesMask.SetAll();
1995
1996 data.WriteBits(changesMask.GetBlocksMask(0), 1);
1997 if (changesMask.GetBlock(0))
1998 data.WriteBits(changesMask.GetBlock(0), 32);
1999
2000 data.FlushBits();
2001 if (changesMask[0])
2002 {
2003 if (changesMask[1])
2004 {
2005 data << int64(EndTime);
2006 }
2007 if (changesMask[2])
2008 {
2009 data << int32(QuestID);
2010 }
2011 if (changesMask[3])
2012 {
2013 data << uint32(StateFlags);
2014 }
2015 if (changesMask[4])
2016 {
2017 data << uint32(ObjectiveFlags);
2018 }
2019 }
2020 if (changesMask[5])
2021 {
2022 for (uint32 i = 0; i < 24; ++i)
2023 {
2024 if (changesMask[6 + i])
2025 {
2026 data << int16(ObjectiveProgress[i]);
2027 }
2028 }
2029 }
2030}
2031
2033{
2040}
2041
2042void ArenaCooldown::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
2043{
2044 data << int32(SpellID);
2045 data << int32(Charges);
2046 data << uint32(Flags);
2047 data << uint32(StartTime);
2048 data << uint32(EndTime);
2049 data << uint32(NextChargeTime);
2050 data << uint8(MaxCharges);
2051}
2052
2053void ArenaCooldown::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
2054{
2055 Mask changesMask = _changesMask;
2056 if (ignoreChangesMask)
2057 changesMask.SetAll();
2058
2059 data.WriteBits(changesMask.GetBlock(0), 8);
2060
2061 data.FlushBits();
2062 if (changesMask[0])
2063 {
2064 if (changesMask[1])
2065 {
2066 data << int32(SpellID);
2067 }
2068 if (changesMask[2])
2069 {
2070 data << int32(Charges);
2071 }
2072 if (changesMask[3])
2073 {
2074 data << uint32(Flags);
2075 }
2076 if (changesMask[4])
2077 {
2078 data << uint32(StartTime);
2079 }
2080 if (changesMask[5])
2081 {
2082 data << uint32(EndTime);
2083 }
2084 if (changesMask[6])
2085 {
2086 data << uint32(NextChargeTime);
2087 }
2088 if (changesMask[7])
2089 {
2090 data << uint8(MaxCharges);
2091 }
2092 }
2093}
2094
2096{
2105}
2106
2107void CTROptions::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
2108{
2110 data << uint32(Field_4);
2111 data << uint32(ExpansionLevelMask);
2112}
2113
2114void CTROptions::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
2115{
2117 data << uint32(Field_4);
2118 data << uint32(ExpansionLevelMask);
2119}
2120
2121bool CTROptions::operator==(CTROptions const& right) const
2122{
2124 && Field_4 == right.Field_4
2126}
2127
2128void DeclinedNames::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
2129{
2130 for (uint32 i = 0; i < 5; ++i)
2131 {
2132 data.WriteBits(Name[i].size(), 10);
2133 }
2134 data.FlushBits();
2135 for (uint32 i = 0; i < 5; ++i)
2136 {
2137 data.WriteString(Name[i]);
2138 }
2139 data.FlushBits();
2140}
2141
2142void DeclinedNames::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
2143{
2144 Mask changesMask = _changesMask;
2145 if (ignoreChangesMask)
2146 changesMask.SetAll();
2147
2148 data.WriteBits(changesMask.GetBlocksMask(0), 1);
2149 if (changesMask.GetBlock(0))
2150 data.WriteBits(changesMask.GetBlock(0), 32);
2151
2152 data.FlushBits();
2153 if (changesMask[0])
2154 {
2155 for (uint32 i = 0; i < 5; ++i)
2156 {
2157 if (changesMask[1 + i])
2158 {
2159 data.WriteBits(Name[i].size(), 10);
2160 }
2161 }
2162 }
2163 data.FlushBits();
2164 if (changesMask[0])
2165 {
2166 for (uint32 i = 0; i < 5; ++i)
2167 {
2168 if (changesMask[1 + i])
2169 {
2170 data.WriteString(Name[i]);
2171 }
2172 }
2173 }
2174 data.FlushBits();
2175}
2176
2178{
2181}
2182
2183void CustomTabardInfo::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
2184{
2185 data << int32(EmblemStyle);
2186 data << int32(EmblemColor);
2187 data << int32(BorderStyle);
2188 data << int32(BorderColor);
2189 data << int32(BackgroundColor);
2190}
2191
2192void CustomTabardInfo::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
2193{
2194 Mask changesMask = _changesMask;
2195 if (ignoreChangesMask)
2196 changesMask.SetAll();
2197
2198 data.WriteBits(changesMask.GetBlock(0), 6);
2199
2200 data.FlushBits();
2201 if (changesMask[0])
2202 {
2203 if (changesMask[1])
2204 {
2205 data << int32(EmblemStyle);
2206 }
2207 if (changesMask[2])
2208 {
2209 data << int32(EmblemColor);
2210 }
2211 if (changesMask[3])
2212 {
2213 data << int32(BorderStyle);
2214 }
2215 if (changesMask[4])
2216 {
2217 data << int32(BorderColor);
2218 }
2219 if (changesMask[5])
2220 {
2221 data << int32(BackgroundColor);
2222 }
2223 }
2224}
2225
2227{
2234}
2235
2236void PlayerData::WriteCreate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Player const* owner, Player const* receiver) const
2237{
2238 data << DuelArbiter;
2239 data << WowAccount;
2240 data << BnetAccount;
2241 data << uint64(GuildClubMemberID);
2242 data << LootTargetGUID;
2243 data << uint32(PlayerFlags);
2244 data << uint32(PlayerFlagsEx);
2245 data << uint32(GuildRankID);
2246 data << uint32(GuildDeleteDate);
2247 data << int32(GuildLevel);
2248 data << uint32(Customizations.size());
2249 data << uint32(QaCustomizations.size());
2250 for (uint32 i = 0; i < 2; ++i)
2251 {
2252 data << uint8(PartyType[i]);
2253 }
2254 data << uint8(NativeSex);
2255 data << uint8(Inebriation);
2256 data << uint8(PvpTitle);
2257 data << uint8(ArenaFaction);
2258 data << uint32(DuelTeam);
2259 data << int32(GuildTimeStamp);
2260 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::PartyMember))
2261 {
2262 for (uint32 i = 0; i < 175; ++i)
2263 {
2264 QuestLog[i].WriteCreate(data, owner, receiver);
2265 }
2266 data << uint32(QuestSessionQuestLog.size());
2267 }
2268 for (uint32 i = 0; i < 19; ++i)
2269 {
2270 VisibleItems[i].WriteCreate(data, owner, receiver);
2271 }
2272 data << int32(PlayerTitle);
2273 data << int32(FakeInebriation);
2274 data << uint32(VirtualPlayerRealm);
2275 data << uint32(CurrentSpecID);
2276 data << int32(TaxiMountAnimKitID);
2277 for (uint32 i = 0; i < 6; ++i)
2278 {
2279 data << float(AvgItemLevel[i]);
2280 }
2282 data << int32(HonorLevel);
2283 data << int64(LogoutTime);
2284 data << uint32(ArenaCooldowns.size());
2285 data << int32(Field_B0);
2286 data << int32(Field_B4);
2288 CtrOptions->WriteCreate(data, owner, receiver);
2289 data << int32(CovenantID);
2290 data << int32(SoulbindID);
2292 for (uint32 i = 0; i < 19; ++i)
2293 {
2294 data << uint32(Field_3120[i]);
2295 }
2296 PersonalTabard->WriteCreate(data, owner, receiver);
2297 for (uint32 i = 0; i < Customizations.size(); ++i)
2298 {
2299 Customizations[i].WriteCreate(data, owner, receiver);
2300 }
2301 for (uint32 i = 0; i < QaCustomizations.size(); ++i)
2302 {
2303 QaCustomizations[i].WriteCreate(data, owner, receiver);
2304 }
2305 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::PartyMember))
2306 {
2307 for (uint32 i = 0; i < QuestSessionQuestLog.size(); ++i)
2308 {
2309 QuestSessionQuestLog[i].WriteCreate(data, owner, receiver);
2310 }
2311 }
2312 for (uint32 i = 0; i < ArenaCooldowns.size(); ++i)
2313 {
2314 ArenaCooldowns[i].WriteCreate(data, owner, receiver);
2315 }
2316 for (uint32 i = 0; i < VisualItemReplacements.size(); ++i)
2317 {
2318 data << int32(VisualItemReplacements[i]);
2319 }
2320 data.FlushBits();
2321 data.WriteBits(Name->size(), 6);
2322 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::PartyMember))
2323 {
2325 }
2326 data.WriteBit(HasLevelLink);
2327 data.WriteBits(DeclinedNames.has_value(), 1);
2328 data << DungeonScore;
2329 data.WriteString(Name);
2330 if (DeclinedNames.has_value())
2331 {
2332 DeclinedNames->WriteCreate(data, owner, receiver);
2333 }
2334 data.FlushBits();
2335}
2336
2337void PlayerData::WriteUpdate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Player const* owner, Player const* receiver) const
2338{
2339 Mask allowedMaskForTarget({ 0xFFFFFFDDu, 0x00003FFFu, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0xC0000000u, 0xFFFFFFFFu, 0x00001FFFu });
2340 AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
2341 WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver);
2342}
2343
2344void PlayerData::AppendAllowedFieldsMaskForFlag(Mask& allowedMaskForTarget, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags)
2345{
2346 if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag::PartyMember))
2347 allowedMaskForTarget |= { 0x00000022u, 0xFFFFC000u, 0xFFFFFFFFu, 0xFFFFFFFFu, 0xFFFFFFFFu, 0xFFFFFFFFu, 0x3FFFFFFFu, 0x00000000u, 0x00000000u };
2348}
2349
2351{
2352 Mask allowedMaskForTarget({ 0xFFFFFFDDu, 0x00003FFFu, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0xC0000000u, 0xFFFFFFFFu, 0x00001FFFu });
2353 AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
2354 changesMask &= allowedMaskForTarget;
2355}
2356
2357void PlayerData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bool ignoreNestedChangesMask, Player const* owner, Player const* receiver) const
2358{
2359 data.WriteBits(changesMask.GetBlocksMask(0), 9);
2360 for (uint32 i = 0; i < 9; ++i)
2361 if (changesMask.GetBlock(i))
2362 data.WriteBits(changesMask.GetBlock(i), 32);
2363
2364 bool noQuestLogChangesMask = data.WriteBit(IsQuestLogChangesMaskSkipped());
2365 if (changesMask[0])
2366 {
2367 if (changesMask[1])
2368 {
2370 }
2371 if (changesMask[2])
2372 {
2373 data.WriteBit(HasLevelLink);
2374 }
2375 if (changesMask[3])
2376 {
2377 if (!ignoreNestedChangesMask)
2379 else
2381 }
2382 if (changesMask[4])
2383 {
2384 if (!ignoreNestedChangesMask)
2386 else
2388 }
2389 if (changesMask[5])
2390 {
2391 if (!ignoreNestedChangesMask)
2393 else
2395 }
2396 if (changesMask[6])
2397 {
2398 if (!ignoreNestedChangesMask)
2400 else
2402 }
2403 if (changesMask[7])
2404 {
2405 if (!ignoreNestedChangesMask)
2407 else
2409 }
2410 }
2411 data.FlushBits();
2412 if (changesMask[0])
2413 {
2414 if (changesMask[3])
2415 {
2416 for (uint32 i = 0; i < Customizations.size(); ++i)
2417 {
2418 if (Customizations.HasChanged(i) || ignoreNestedChangesMask)
2419 {
2420 Customizations[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
2421 }
2422 }
2423 }
2424 if (changesMask[4])
2425 {
2426 for (uint32 i = 0; i < QaCustomizations.size(); ++i)
2427 {
2428 if (QaCustomizations.HasChanged(i) || ignoreNestedChangesMask)
2429 {
2430 QaCustomizations[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
2431 }
2432 }
2433 }
2434 if (changesMask[5])
2435 {
2436 for (uint32 i = 0; i < QuestSessionQuestLog.size(); ++i)
2437 {
2438 if (QuestSessionQuestLog.HasChanged(i) || ignoreNestedChangesMask)
2439 {
2440 if (noQuestLogChangesMask)
2441 QuestSessionQuestLog[i].WriteCreate(data, owner, receiver);
2442 else
2443 QuestSessionQuestLog[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
2444 }
2445 }
2446 }
2447 if (changesMask[6])
2448 {
2449 for (uint32 i = 0; i < ArenaCooldowns.size(); ++i)
2450 {
2451 if (ArenaCooldowns.HasChanged(i) || ignoreNestedChangesMask)
2452 {
2453 ArenaCooldowns[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
2454 }
2455 }
2456 }
2457 if (changesMask[7])
2458 {
2459 for (uint32 i = 0; i < VisualItemReplacements.size(); ++i)
2460 {
2461 if (VisualItemReplacements.HasChanged(i) || ignoreNestedChangesMask)
2462 {
2463 data << int32(VisualItemReplacements[i]);
2464 }
2465 }
2466 }
2467 if (changesMask[8])
2468 {
2469 data << DuelArbiter;
2470 }
2471 if (changesMask[9])
2472 {
2473 data << WowAccount;
2474 }
2475 if (changesMask[10])
2476 {
2477 data << BnetAccount;
2478 }
2479 if (changesMask[11])
2480 {
2481 data << uint64(GuildClubMemberID);
2482 }
2483 if (changesMask[12])
2484 {
2485 data << LootTargetGUID;
2486 }
2487 if (changesMask[13])
2488 {
2489 data << uint32(PlayerFlags);
2490 }
2491 if (changesMask[14])
2492 {
2493 data << uint32(PlayerFlagsEx);
2494 }
2495 if (changesMask[15])
2496 {
2497 data << uint32(GuildRankID);
2498 }
2499 if (changesMask[16])
2500 {
2501 data << uint32(GuildDeleteDate);
2502 }
2503 if (changesMask[17])
2504 {
2505 data << int32(GuildLevel);
2506 }
2507 if (changesMask[18])
2508 {
2509 data << uint8(NativeSex);
2510 }
2511 if (changesMask[19])
2512 {
2513 data << uint8(Inebriation);
2514 }
2515 if (changesMask[20])
2516 {
2517 data << uint8(PvpTitle);
2518 }
2519 if (changesMask[21])
2520 {
2521 data << uint8(ArenaFaction);
2522 }
2523 if (changesMask[22])
2524 {
2525 data << uint32(DuelTeam);
2526 }
2527 if (changesMask[23])
2528 {
2529 data << int32(GuildTimeStamp);
2530 }
2531 if (changesMask[24])
2532 {
2533 data << int32(PlayerTitle);
2534 }
2535 if (changesMask[25])
2536 {
2537 data << int32(FakeInebriation);
2538 }
2539 if (changesMask[26])
2540 {
2541 data << uint32(VirtualPlayerRealm);
2542 }
2543 if (changesMask[27])
2544 {
2545 data << uint32(CurrentSpecID);
2546 }
2547 if (changesMask[28])
2548 {
2549 data << int32(TaxiMountAnimKitID);
2550 }
2551 if (changesMask[29])
2552 {
2554 }
2555 if (changesMask[30])
2556 {
2557 data << int32(HonorLevel);
2558 }
2559 if (changesMask[31])
2560 {
2561 data << int64(LogoutTime);
2562 }
2563 }
2564 if (changesMask[32])
2565 {
2566 if (changesMask[34])
2567 {
2568 data << int32(Field_B0);
2569 }
2570 if (changesMask[35])
2571 {
2572 data << int32(Field_B4);
2573 }
2574 if (changesMask[36])
2575 {
2577 }
2578 if (changesMask[37])
2579 {
2580 CtrOptions->WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
2581 }
2582 if (changesMask[38])
2583 {
2584 data << int32(CovenantID);
2585 }
2586 if (changesMask[39])
2587 {
2588 data << int32(SoulbindID);
2589 }
2590 if (changesMask[42])
2591 {
2592 PersonalTabard->WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
2593 }
2594 if (changesMask[33])
2595 {
2596 data.WriteBits(Name->size(), 32);
2597 }
2598 data.WriteBits(DeclinedNames.has_value(), 1);
2599 data.FlushBits();
2600 if (changesMask[40])
2601 {
2602 data << DungeonScore;
2603 }
2604 if (changesMask[33])
2605 {
2606 data.WriteString(Name);
2607 }
2608 if (changesMask[41])
2609 {
2610 if (DeclinedNames.has_value())
2611 {
2612 DeclinedNames->WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
2613 }
2614 }
2615 }
2616 if (changesMask[43])
2617 {
2618 for (uint32 i = 0; i < 2; ++i)
2619 {
2620 if (changesMask[44 + i])
2621 {
2622 data << uint8(PartyType[i]);
2623 }
2624 }
2625 }
2626 if (changesMask[46])
2627 {
2628 for (uint32 i = 0; i < 175; ++i)
2629 {
2630 if (changesMask[47 + i])
2631 {
2632 if (noQuestLogChangesMask)
2633 QuestLog[i].WriteCreate(data, owner, receiver);
2634 else
2635 QuestLog[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
2636 }
2637 }
2638 }
2639 if (changesMask[222])
2640 {
2641 for (uint32 i = 0; i < 19; ++i)
2642 {
2643 if (changesMask[223 + i])
2644 {
2645 VisibleItems[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
2646 }
2647 }
2648 }
2649 if (changesMask[242])
2650 {
2651 for (uint32 i = 0; i < 6; ++i)
2652 {
2653 if (changesMask[243 + i])
2654 {
2655 data << float(AvgItemLevel[i]);
2656 }
2657 }
2658 }
2659 if (changesMask[249])
2660 {
2661 for (uint32 i = 0; i < 19; ++i)
2662 {
2663 if (changesMask[250 + i])
2664 {
2665 data << uint32(Field_3120[i]);
2666 }
2667 }
2668 }
2669 data.FlushBits();
2670}
2671
2673{
2721}
2722
2723void SkillInfo::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
2724{
2725 for (uint32 i = 0; i < 256; ++i)
2726 {
2727 data << uint16(SkillLineID[i]);
2728 data << uint16(SkillStep[i]);
2729 data << uint16(SkillRank[i]);
2730 data << uint16(SkillStartingRank[i]);
2731 data << uint16(SkillMaxRank[i]);
2732 data << int16(SkillTempBonus[i]);
2733 data << uint16(SkillPermBonus[i]);
2734 }
2735}
2736
2737void SkillInfo::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
2738{
2739 Mask changesMask = _changesMask;
2740 if (ignoreChangesMask)
2741 changesMask.SetAll();
2742
2743 for (uint32 i = 0; i < 1; ++i)
2744 data << uint32(changesMask.GetBlocksMask(i));
2745 data.WriteBits(changesMask.GetBlocksMask(1), 25);
2746 for (uint32 i = 0; i < 57; ++i)
2747 if (changesMask.GetBlock(i))
2748 data.WriteBits(changesMask.GetBlock(i), 32);
2749
2750 data.FlushBits();
2751 if (changesMask[0])
2752 {
2753 for (uint32 i = 0; i < 256; ++i)
2754 {
2755 if (changesMask[1 + i])
2756 {
2757 data << uint16(SkillLineID[i]);
2758 }
2759 if (changesMask[257 + i])
2760 {
2761 data << uint16(SkillStep[i]);
2762 }
2763 if (changesMask[513 + i])
2764 {
2765 data << uint16(SkillRank[i]);
2766 }
2767 if (changesMask[769 + i])
2768 {
2769 data << uint16(SkillStartingRank[i]);
2770 }
2771 if (changesMask[1025 + i])
2772 {
2773 data << uint16(SkillMaxRank[i]);
2774 }
2775 if (changesMask[1281 + i])
2776 {
2777 data << int16(SkillTempBonus[i]);
2778 }
2779 if (changesMask[1537 + i])
2780 {
2781 data << uint16(SkillPermBonus[i]);
2782 }
2783 }
2784 }
2785}
2786
2788{
2797}
2798
2799void RestInfo::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
2800{
2801 data << uint32(Threshold);
2802 data << uint8(StateID);
2803}
2804
2805void RestInfo::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
2806{
2807 Mask changesMask = _changesMask;
2808 if (ignoreChangesMask)
2809 changesMask.SetAll();
2810
2811 data.WriteBits(changesMask.GetBlock(0), 3);
2812
2813 data.FlushBits();
2814 if (changesMask[0])
2815 {
2816 if (changesMask[1])
2817 {
2818 data << uint32(Threshold);
2819 }
2820 if (changesMask[2])
2821 {
2822 data << uint8(StateID);
2823 }
2824 }
2825}
2826
2828{
2832}
2833
2834void PVPInfo::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
2835{
2836 data << int8(Bracket);
2837 data << int32(PvpRatingID);
2838 data << uint32(WeeklyPlayed);
2839 data << uint32(WeeklyWon);
2840 data << uint32(SeasonPlayed);
2841 data << uint32(SeasonWon);
2842 data << uint32(Rating);
2843 data << uint32(WeeklyBestRating);
2844 data << uint32(SeasonBestRating);
2845 data << uint32(PvpTierID);
2847 data << uint32(Field_28);
2848 data << uint32(Field_2C);
2849 data << uint32(WeeklyRoundsPlayed);
2850 data << uint32(WeeklyRoundsWon);
2851 data << uint32(SeasonRoundsPlayed);
2852 data << uint32(SeasonRoundsWon);
2853 data.WriteBit(Disqualified);
2854 data.FlushBits();
2855}
2856
2857void PVPInfo::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
2858{
2859 Mask changesMask = _changesMask;
2860 if (ignoreChangesMask)
2861 changesMask.SetAll();
2862
2863 data.WriteBits(changesMask.GetBlock(0), 19);
2864
2865 if (changesMask[0])
2866 {
2867 if (changesMask[1])
2868 {
2869 data.WriteBit(Disqualified);
2870 }
2871 }
2872 data.FlushBits();
2873 if (changesMask[0])
2874 {
2875 if (changesMask[2])
2876 {
2877 data << int8(Bracket);
2878 }
2879 if (changesMask[3])
2880 {
2881 data << int32(PvpRatingID);
2882 }
2883 if (changesMask[4])
2884 {
2885 data << uint32(WeeklyPlayed);
2886 }
2887 if (changesMask[5])
2888 {
2889 data << uint32(WeeklyWon);
2890 }
2891 if (changesMask[6])
2892 {
2893 data << uint32(SeasonPlayed);
2894 }
2895 if (changesMask[7])
2896 {
2897 data << uint32(SeasonWon);
2898 }
2899 if (changesMask[8])
2900 {
2901 data << uint32(Rating);
2902 }
2903 if (changesMask[9])
2904 {
2905 data << uint32(WeeklyBestRating);
2906 }
2907 if (changesMask[10])
2908 {
2909 data << uint32(SeasonBestRating);
2910 }
2911 if (changesMask[11])
2912 {
2913 data << uint32(PvpTierID);
2914 }
2915 if (changesMask[12])
2916 {
2918 }
2919 if (changesMask[13])
2920 {
2921 data << uint32(Field_28);
2922 }
2923 if (changesMask[14])
2924 {
2925 data << uint32(Field_2C);
2926 }
2927 if (changesMask[15])
2928 {
2929 data << uint32(WeeklyRoundsPlayed);
2930 }
2931 if (changesMask[16])
2932 {
2933 data << uint32(WeeklyRoundsWon);
2934 }
2935 if (changesMask[17])
2936 {
2937 data << uint32(SeasonRoundsPlayed);
2938 }
2939 if (changesMask[18])
2940 {
2941 data << uint32(SeasonRoundsWon);
2942 }
2943 }
2944 data.FlushBits();
2945}
2946
2948{
2968}
2969
2970void CharacterRestriction::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
2971{
2972 data << int32(Field_0);
2973 data << int32(Field_4);
2974 data << int32(Field_8);
2975 data.WriteBits(Type, 5);
2976 data.FlushBits();
2977}
2978
2979void CharacterRestriction::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
2980{
2981 data << int32(Field_0);
2982 data << int32(Field_4);
2983 data << int32(Field_8);
2984 data.WriteBits(Type, 5);
2985 data.FlushBits();
2986}
2987
2989{
2990 return Field_0 == right.Field_0
2991 && Field_4 == right.Field_4
2992 && Field_8 == right.Field_8
2993 && Type == right.Type;
2994}
2995
2996void SpellPctModByLabel::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
2997{
2998 data << int32(ModIndex);
2999 data << float(ModifierValue);
3000 data << int32(LabelID);
3001}
3002
3003void SpellPctModByLabel::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3004{
3005 data << int32(ModIndex);
3006 data << float(ModifierValue);
3007 data << int32(LabelID);
3008}
3009
3011{
3012 return ModIndex == right.ModIndex
3013 && ModifierValue == right.ModifierValue
3014 && LabelID == right.LabelID;
3015}
3016
3017void SpellFlatModByLabel::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3018{
3019 data << int32(ModIndex);
3020 data << int32(ModifierValue);
3021 data << int32(LabelID);
3022}
3023
3024void SpellFlatModByLabel::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3025{
3026 data << int32(ModIndex);
3027 data << int32(ModifierValue);
3028 data << int32(LabelID);
3029}
3030
3032{
3033 return ModIndex == right.ModIndex
3034 && ModifierValue == right.ModifierValue
3035 && LabelID == right.LabelID;
3036}
3037
3038void CompletedProject::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3039{
3040 data << uint32(ProjectID);
3041 data << int64(FirstCompleted);
3042 data << uint32(CompletionCount);
3043}
3044
3045void CompletedProject::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3046{
3047 Mask changesMask = _changesMask;
3048 if (ignoreChangesMask)
3049 changesMask.SetAll();
3050
3051 data.WriteBits(changesMask.GetBlock(0), 4);
3052
3053 data.FlushBits();
3054 if (changesMask[0])
3055 {
3056 if (changesMask[1])
3057 {
3058 data << uint32(ProjectID);
3059 }
3060 if (changesMask[2])
3061 {
3062 data << int64(FirstCompleted);
3063 }
3064 if (changesMask[3])
3065 {
3066 data << uint32(CompletionCount);
3067 }
3068 }
3069}
3070
3072{
3077}
3078
3079void ResearchHistory::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3080{
3081 data << uint32(CompletedProjects.size());
3082 for (uint32 i = 0; i < CompletedProjects.size(); ++i)
3083 {
3084 CompletedProjects[i].WriteCreate(data, owner, receiver);
3085 }
3086}
3087
3088void ResearchHistory::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3089{
3090 Mask changesMask = _changesMask;
3091 if (ignoreChangesMask)
3092 changesMask.SetAll();
3093
3094 data.WriteBits(changesMask.GetBlock(0), 2);
3095
3096 if (changesMask[0])
3097 {
3098 if (changesMask[1])
3099 {
3100 if (!ignoreChangesMask)
3102 else
3104 }
3105 }
3106 data.FlushBits();
3107 if (changesMask[0])
3108 {
3109 if (changesMask[1])
3110 {
3111 for (uint32 i = 0; i < CompletedProjects.size(); ++i)
3112 {
3113 if (CompletedProjects.HasChanged(i) || ignoreChangesMask)
3114 {
3115 CompletedProjects[i].WriteUpdate(data, ignoreChangesMask, owner, receiver);
3116 }
3117 }
3118 }
3119 }
3120}
3121
3123{
3126}
3127
3128void MawPower::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3129{
3130 data << int32(Field_0);
3131 data << int32(Field_4);
3132 data << int32(Field_8);
3133}
3134
3135void MawPower::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3136{
3137 data << int32(Field_0);
3138 data << int32(Field_4);
3139 data << int32(Field_8);
3140}
3141
3142bool MawPower::operator==(MawPower const& right) const
3143{
3144 return Field_0 == right.Field_0
3145 && Field_4 == right.Field_4
3146 && Field_8 == right.Field_8;
3147}
3148
3149void MultiFloorExplore::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3150{
3151 data << uint32(WorldMapOverlayIDs.size());
3152 for (uint32 i = 0; i < WorldMapOverlayIDs.size(); ++i)
3153 {
3154 data << int32(WorldMapOverlayIDs[i]);
3155 }
3156}
3157
3158void MultiFloorExplore::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3159{
3160 data << uint32(WorldMapOverlayIDs.size());
3161 for (uint32 i = 0; i < WorldMapOverlayIDs.size(); ++i)
3162 {
3163 data << int32(WorldMapOverlayIDs[i]);
3164 }
3165 data.FlushBits();
3166}
3167
3169{
3170 return WorldMapOverlayIDs == right.WorldMapOverlayIDs;
3171}
3172
3173void RecipeProgressionInfo::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3174{
3176 data << uint16(Experience);
3177}
3178
3179void RecipeProgressionInfo::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3180{
3182 data << uint16(Experience);
3183}
3184
3186{
3188 && Experience == right.Experience;
3189}
3190
3191void ActivePlayerUnk901::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3192{
3193 data << Field_0;
3194 data << int32(Field_10);
3195}
3196
3197void ActivePlayerUnk901::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3198{
3199 Mask changesMask = _changesMask;
3200 if (ignoreChangesMask)
3201 changesMask.SetAll();
3202
3203 data.WriteBits(changesMask.GetBlock(0), 3);
3204
3205 data.FlushBits();
3206 if (changesMask[0])
3207 {
3208 if (changesMask[1])
3209 {
3210 data << Field_0;
3211 }
3212 if (changesMask[2])
3213 {
3214 data << int32(Field_10);
3215 }
3216 }
3217}
3218
3220{
3224}
3225
3226void QuestSession::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3227{
3228 data << Owner;
3229 for (uint32 i = 0; i < 950; ++i)
3230 {
3231 data << uint64(QuestCompleted[i]);
3232 }
3233}
3234
3235void QuestSession::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3236{
3237 Mask changesMask = _changesMask;
3238 if (ignoreChangesMask)
3239 changesMask.SetAll();
3240
3241 data.WriteBits(changesMask.GetBlocksMask(0), 30);
3242 for (uint32 i = 0; i < 30; ++i)
3243 if (changesMask.GetBlock(i))
3244 data.WriteBits(changesMask.GetBlock(i), 32);
3245
3246 data.FlushBits();
3247 if (changesMask[0])
3248 {
3249 if (changesMask[1])
3250 {
3251 data << Owner;
3252 }
3253 }
3254 if (changesMask[2])
3255 {
3256 for (uint32 i = 0; i < 950; ++i)
3257 {
3258 if (changesMask[3 + i])
3259 {
3260 data << uint64(QuestCompleted[i]);
3261 }
3262 }
3263 }
3264}
3265
3267{
3271}
3272
3273void ReplayedQuest::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3274{
3275 data << int32(QuestID);
3276 data << uint32(ReplayTime);
3277}
3278
3279void ReplayedQuest::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3280{
3281 Mask changesMask = _changesMask;
3282 if (ignoreChangesMask)
3283 changesMask.SetAll();
3284
3285 data.WriteBits(changesMask.GetBlock(0), 3);
3286
3287 data.FlushBits();
3288 if (changesMask[0])
3289 {
3290 if (changesMask[1])
3291 {
3292 data << int32(QuestID);
3293 }
3294 if (changesMask[2])
3295 {
3296 data << uint32(ReplayTime);
3297 }
3298 }
3299}
3300
3302{
3306}
3307
3308void TraitEntry::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3309{
3310 data << int32(TraitNodeID);
3311 data << int32(TraitNodeEntryID);
3312 data << int32(Rank);
3313 data << int32(GrantedRanks);
3314}
3315
3316void TraitEntry::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3317{
3318 data << int32(TraitNodeID);
3319 data << int32(TraitNodeEntryID);
3320 data << int32(Rank);
3321 data << int32(GrantedRanks);
3322}
3323
3324bool TraitEntry::operator==(TraitEntry const& right) const
3325{
3326 return TraitNodeID == right.TraitNodeID
3328 && Rank == right.Rank
3329 && GrantedRanks == right.GrantedRanks;
3330}
3331
3332void TraitConfig::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3333{
3334 data << int32(ID);
3335 data << int32(Type);
3336 data << uint32(Entries.size());
3337 if (Type == 2)
3338 {
3339 data << int32(SkillLineID);
3340 }
3341 if (Type == 1)
3342 {
3343 data << int32(ChrSpecializationID);
3344 data << int32(CombatConfigFlags);
3345 data << int32(LocalIdentifier);
3346 }
3347 if (Type == 3)
3348 {
3349 data << int32(TraitSystemID);
3350 }
3351 for (uint32 i = 0; i < Entries.size(); ++i)
3352 {
3353 Entries[i].WriteCreate(data, owner, receiver);
3354 }
3355 data.WriteBits(Name->size(), 9);
3356 data.WriteString(Name);
3357 data.FlushBits();
3358}
3359
3360void TraitConfig::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3361{
3362 Mask changesMask = _changesMask;
3363 if (ignoreChangesMask)
3364 changesMask.SetAll();
3365
3366 data.WriteBits(changesMask.GetBlock(0), 12);
3367
3368 if (changesMask[0])
3369 {
3370 if (changesMask[1])
3371 {
3372 if (!ignoreChangesMask)
3373 Entries.WriteUpdateMask(data);
3374 else
3376 }
3377 }
3378 data.FlushBits();
3379 if (changesMask[0])
3380 {
3381 if (changesMask[1])
3382 {
3383 for (uint32 i = 0; i < Entries.size(); ++i)
3384 {
3385 if (Entries.HasChanged(i) || ignoreChangesMask)
3386 {
3387 Entries[i].WriteUpdate(data, ignoreChangesMask, owner, receiver);
3388 }
3389 }
3390 }
3391 if (changesMask[2])
3392 {
3393 data << int32(ID);
3394 }
3395 }
3396 if (changesMask[4])
3397 {
3398 if (changesMask[5])
3399 {
3400 data << int32(Type);
3401 }
3402 if (changesMask[6])
3403 {
3404 if (Type == 2)
3405 {
3406 data << int32(SkillLineID);
3407 }
3408 }
3409 if (changesMask[7])
3410 {
3411 if (Type == 1)
3412 {
3413 data << int32(ChrSpecializationID);
3414 }
3415 }
3416 }
3417 if (changesMask[8])
3418 {
3419 if (changesMask[9])
3420 {
3421 if (Type == 1)
3422 {
3423 data << int32(CombatConfigFlags);
3424 }
3425 }
3426 if (changesMask[10])
3427 {
3428 if (Type == 1)
3429 {
3430 data << int32(LocalIdentifier);
3431 }
3432 }
3433 if (changesMask[11])
3434 {
3435 if (Type == 3)
3436 {
3437 data << int32(TraitSystemID);
3438 }
3439 }
3440 }
3441 if (changesMask[0])
3442 {
3443 if (changesMask[3])
3444 {
3445 data.WriteBits(Name->size(), 9);
3446 data.WriteString(Name);
3447 }
3448 }
3449 data.FlushBits();
3450}
3451
3453{
3464}
3465
3466void CraftingOrderItem::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3467{
3468 data << uint64(Field_0);
3469 data << ItemGUID;
3470 data << OwnerGUID;
3471 data << int32(ItemID);
3472 data << uint32(Quantity);
3473 data << int32(ReagentQuality);
3475 data.FlushBits();
3477 {
3478 data << uint8(DataSlotIndex);
3479 }
3480}
3481
3482void CraftingOrderItem::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3483{
3484 Mask changesMask = _changesMask;
3485 if (ignoreChangesMask)
3486 changesMask.SetAll();
3487
3488 data.WriteBits(changesMask.GetBlock(0), 7);
3489
3490 data.FlushBits();
3491 if (changesMask[0])
3492 {
3493 data << uint64(Field_0);
3494 }
3495 if (changesMask[1])
3496 {
3497 data << ItemGUID;
3498 }
3499 if (changesMask[2])
3500 {
3501 data << OwnerGUID;
3502 }
3503 if (changesMask[3])
3504 {
3505 data << int32(ItemID);
3506 }
3507 if (changesMask[4])
3508 {
3509 data << uint32(Quantity);
3510 }
3511 if (changesMask[5])
3512 {
3513 data << int32(ReagentQuality);
3514 }
3516 data.FlushBits();
3517 if (changesMask[6])
3518 {
3520 {
3521 data << uint8(DataSlotIndex);
3522 }
3523 }
3524}
3525
3527{
3536}
3537
3538void CraftingOrderData::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3539{
3540 data << int32(Field_0);
3541 data << uint64(OrderID);
3542 data << int32(SkillLineAbilityID);
3543 data << uint8(OrderState);
3544 data << uint8(OrderType);
3545 data << uint8(MinQuality);
3546 data << int64(ExpirationTime);
3547 data << int64(ClaimEndTime);
3548 data << int64(TipAmount);
3549 data << int64(ConsortiumCut);
3550 data << uint32(Flags);
3551 data << CustomerGUID;
3552 data << CustomerAccountGUID;
3553 data << CrafterGUID;
3554 data << PersonalCrafterGUID;
3555 data << uint32(Reagents.size());
3556 data.WriteBits(CustomerNotes->size(), 10);
3557 data.WriteBits(OutputItem.has_value(), 1);
3559 data.FlushBits();
3560 for (uint32 i = 0; i < Reagents.size(); ++i)
3561 {
3562 Reagents[i].WriteCreate(data, owner, receiver);
3563 }
3565 if (OutputItem.has_value())
3566 {
3567 OutputItem->WriteCreate(data, owner, receiver);
3568 }
3570 {
3571 data << OutputItemData;
3572 }
3573 data.FlushBits();
3574}
3575
3576void CraftingOrderData::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3577{
3578 Mask changesMask = _changesMask;
3579 if (ignoreChangesMask)
3580 changesMask.SetAll();
3581
3582 data.WriteBits(changesMask.GetBlock(0), 24);
3583
3584 if (changesMask[0])
3585 {
3586 if (changesMask[1])
3587 {
3588 if (!ignoreChangesMask)
3590 else
3592 }
3593 }
3594 data.FlushBits();
3595 if (changesMask[0])
3596 {
3597 if (changesMask[1])
3598 {
3599 for (uint32 i = 0; i < Reagents.size(); ++i)
3600 {
3601 if (Reagents.HasChanged(i) || ignoreChangesMask)
3602 {
3603 Reagents[i].WriteUpdate(data, ignoreChangesMask, owner, receiver);
3604 }
3605 }
3606 }
3607 if (changesMask[2])
3608 {
3609 data << int32(Field_0);
3610 }
3611 if (changesMask[3])
3612 {
3613 data << uint64(OrderID);
3614 }
3615 if (changesMask[4])
3616 {
3617 data << int32(SkillLineAbilityID);
3618 }
3619 }
3620 if (changesMask[5])
3621 {
3622 if (changesMask[6])
3623 {
3624 data << uint8(OrderState);
3625 }
3626 if (changesMask[7])
3627 {
3628 data << uint8(OrderType);
3629 }
3630 if (changesMask[8])
3631 {
3632 data << uint8(MinQuality);
3633 }
3634 if (changesMask[9])
3635 {
3636 data << int64(ExpirationTime);
3637 }
3638 }
3639 if (changesMask[10])
3640 {
3641 if (changesMask[11])
3642 {
3643 data << int64(ClaimEndTime);
3644 }
3645 if (changesMask[12])
3646 {
3647 data << int64(TipAmount);
3648 }
3649 if (changesMask[13])
3650 {
3651 data << int64(ConsortiumCut);
3652 }
3653 if (changesMask[14])
3654 {
3655 data << uint32(Flags);
3656 }
3657 }
3658 if (changesMask[15])
3659 {
3660 if (changesMask[16])
3661 {
3662 data << CustomerGUID;
3663 }
3664 if (changesMask[17])
3665 {
3666 data << CustomerAccountGUID;
3667 }
3668 if (changesMask[18])
3669 {
3670 data << CrafterGUID;
3671 }
3672 if (changesMask[19])
3673 {
3674 data << PersonalCrafterGUID;
3675 }
3676 }
3677 if (changesMask[20])
3678 {
3679 if (changesMask[21])
3680 {
3681 data.WriteBits(CustomerNotes->size(), 10);
3683 }
3684 data.WriteBits(OutputItem.has_value(), 1);
3686 data.FlushBits();
3687 if (changesMask[22])
3688 {
3689 if (OutputItem.has_value())
3690 {
3691 OutputItem->WriteUpdate(data, ignoreChangesMask, owner, receiver);
3692 }
3693 }
3694 if (changesMask[23])
3695 {
3697 {
3698 data << OutputItemData;
3699 }
3700 }
3701 }
3702 data.FlushBits();
3703}
3704
3706{
3727}
3728
3729void CraftingOrder::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3730{
3731 Data->WriteCreate(data, owner, receiver);
3733 data.WriteBits(Enchantments.size(), 4);
3734 data.WriteBits(Gems.size(), 2);
3735 data.FlushBits();
3737 {
3738 data << RecraftItemInfo;
3739 }
3740 for (uint32 i = 0; i < Enchantments.size(); ++i)
3741 {
3742 data << Enchantments[i];
3743 }
3744 for (uint32 i = 0; i < Gems.size(); ++i)
3745 {
3746 data << Gems[i];
3747 }
3748 data.FlushBits();
3749}
3750
3751void CraftingOrder::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3752{
3753 Mask changesMask = _changesMask;
3754 if (ignoreChangesMask)
3755 changesMask.SetAll();
3756
3757 data.WriteBits(changesMask.GetBlock(0), 4);
3758
3759 if (changesMask[0])
3760 {
3761 if (!ignoreChangesMask)
3763 else
3765 }
3766 if (changesMask[1])
3767 {
3768 if (!ignoreChangesMask)
3769 Gems.WriteUpdateMask(data, 2);
3770 else
3772 }
3773 data.FlushBits();
3774 if (changesMask[0])
3775 {
3776 for (uint32 i = 0; i < Enchantments.size(); ++i)
3777 {
3778 if (Enchantments.HasChanged(i) || ignoreChangesMask)
3779 {
3780 data << Enchantments[i];
3781 }
3782 }
3783 }
3784 if (changesMask[1])
3785 {
3786 for (uint32 i = 0; i < Gems.size(); ++i)
3787 {
3788 if (Gems.HasChanged(i) || ignoreChangesMask)
3789 {
3790 data << Gems[i];
3791 }
3792 }
3793 }
3794 if (changesMask[2])
3795 {
3796 Data->WriteUpdate(data, ignoreChangesMask, owner, receiver);
3797 }
3799 data.FlushBits();
3800 if (changesMask[3])
3801 {
3803 {
3804 data << RecraftItemInfo;
3805 }
3806 }
3807 data.FlushBits();
3808}
3809
3811{
3817}
3818
3819void PersonalCraftingOrderCount::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3820{
3821 data << int32(ProfessionID);
3822 data << uint32(Count);
3823}
3824
3825void PersonalCraftingOrderCount::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3826{
3827 Mask changesMask = _changesMask;
3828 if (ignoreChangesMask)
3829 changesMask.SetAll();
3830
3831 data.WriteBits(changesMask.GetBlock(0), 2);
3832
3833 data.FlushBits();
3834 if (changesMask[0])
3835 {
3836 data << int32(ProfessionID);
3837 }
3838 if (changesMask[1])
3839 {
3840 data << uint32(Count);
3841 }
3842}
3843
3845{
3849}
3850
3851void CategoryCooldownMod::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3852{
3853 data << int32(SpellCategoryID);
3854 data << int32(ModCooldown);
3855}
3856
3857void CategoryCooldownMod::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3858{
3859 data << int32(SpellCategoryID);
3860 data << int32(ModCooldown);
3861}
3862
3864{
3865 return SpellCategoryID == right.SpellCategoryID
3866 && ModCooldown == right.ModCooldown;
3867}
3868
3869void WeeklySpellUse::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3870{
3871 data << int32(SpellCategoryID);
3872 data << uint8(Uses);
3873}
3874
3875void WeeklySpellUse::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3876{
3877 data << int32(SpellCategoryID);
3878 data << uint8(Uses);
3879}
3880
3882{
3883 return SpellCategoryID == right.SpellCategoryID
3884 && Uses == right.Uses;
3885}
3886
3887void StablePetInfo::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3888{
3889 data << uint32(PetSlot);
3890 data << uint32(PetNumber);
3891 data << uint32(CreatureID);
3892 data << uint32(DisplayID);
3893 data << uint32(ExperienceLevel);
3894 data << uint8(PetFlags);
3895 data.WriteBits(Name->size(), 8);
3896 data.WriteString(Name);
3897 data.FlushBits();
3898}
3899
3900void StablePetInfo::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3901{
3902 Mask changesMask = _changesMask;
3903 if (ignoreChangesMask)
3904 changesMask.SetAll();
3905
3906 data.WriteBits(changesMask.GetBlock(0), 8);
3907
3908 data.FlushBits();
3909 if (changesMask[0])
3910 {
3911 if (changesMask[1])
3912 {
3913 data << uint32(PetSlot);
3914 }
3915 if (changesMask[2])
3916 {
3917 data << uint32(PetNumber);
3918 }
3919 if (changesMask[3])
3920 {
3921 data << uint32(CreatureID);
3922 }
3923 if (changesMask[4])
3924 {
3925 data << uint32(DisplayID);
3926 }
3927 if (changesMask[5])
3928 {
3929 data << uint32(ExperienceLevel);
3930 }
3931 if (changesMask[7])
3932 {
3933 data << uint8(PetFlags);
3934 }
3935 if (changesMask[6])
3936 {
3937 data.WriteBits(Name->size(), 8);
3938 data.WriteString(Name);
3939 }
3940 }
3941 data.FlushBits();
3942}
3943
3945{
3954}
3955
3956void StableInfo::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
3957{
3958 data << uint32(Pets.size());
3959 data << StableMaster;
3960 for (uint32 i = 0; i < Pets.size(); ++i)
3961 {
3962 Pets[i].WriteCreate(data, owner, receiver);
3963 }
3964}
3965
3966void StableInfo::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
3967{
3968 Mask changesMask = _changesMask;
3969 if (ignoreChangesMask)
3970 changesMask.SetAll();
3971
3972 data.WriteBits(changesMask.GetBlock(0), 3);
3973
3974 if (changesMask[0])
3975 {
3976 if (changesMask[1])
3977 {
3978 if (!ignoreChangesMask)
3979 Pets.WriteUpdateMask(data);
3980 else
3982 }
3983 }
3984 data.FlushBits();
3985 if (changesMask[0])
3986 {
3987 if (changesMask[1])
3988 {
3989 for (uint32 i = 0; i < Pets.size(); ++i)
3990 {
3991 if (Pets.HasChanged(i) || ignoreChangesMask)
3992 {
3993 Pets[i].WriteUpdate(data, ignoreChangesMask, owner, receiver);
3994 }
3995 }
3996 }
3997 if (changesMask[2])
3998 {
3999 data << StableMaster;
4000 }
4001 }
4002}
4003
4005{
4009}
4010
4011void CollectableSourceTrackedData::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
4012{
4013 data << int32(TargetType);
4014 data << int32(TargetID);
4016}
4017
4018void CollectableSourceTrackedData::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
4019{
4020 Mask changesMask = _changesMask;
4021 if (ignoreChangesMask)
4022 changesMask.SetAll();
4023
4024 data.WriteBits(changesMask.GetBlock(0), 4);
4025
4026 data.FlushBits();
4027 if (changesMask[0])
4028 {
4029 if (changesMask[1])
4030 {
4031 data << int32(TargetType);
4032 }
4033 if (changesMask[2])
4034 {
4035 data << int32(TargetID);
4036 }
4037 if (changesMask[3])
4038 {
4040 }
4041 }
4042}
4043
4045{
4050}
4051
4052void Research::WriteCreate(ByteBuffer& data, Player const* owner, Player const* receiver) const
4053{
4054 data << int16(ResearchProjectID);
4055}
4056
4057void Research::WriteUpdate(ByteBuffer& data, bool ignoreChangesMask, Player const* owner, Player const* receiver) const
4058{
4059 data << int16(ResearchProjectID);
4060}
4061
4062bool Research::operator==(Research const& right) const
4063{
4064 return ResearchProjectID == right.ResearchProjectID;
4065}
4066
4067void ActivePlayerData::WriteCreate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Player const* owner, Player const* receiver) const
4068{
4069 for (uint32 i = 0; i < 227; ++i)
4070 {
4071 data << InvSlots[i];
4072 }
4073 data << FarsightObject;
4074 data << SummonedBattlePetGUID;
4075 data << uint32(KnownTitles.size());
4076 data << uint64(Coinage);
4077 data << int32(XP);
4078 data << int32(NextLevelXP);
4079 data << int32(TrialXP);
4080 Skill->WriteCreate(data, owner, receiver);
4081 data << int32(CharacterPoints);
4082 data << int32(MaxTalentTiers);
4083 data << uint32(TrackCreatureMask);
4084 data << float(MainhandExpertise);
4085 data << float(OffhandExpertise);
4086 data << float(RangedExpertise);
4087 data << float(CombatRatingExpertise);
4088 data << float(BlockPercentage);
4089 data << float(DodgePercentage);
4090 data << float(DodgePercentageFromAttribute);
4091 data << float(ParryPercentage);
4092 data << float(ParryPercentageFromAttribute);
4093 data << float(CritPercentage);
4094 data << float(RangedCritPercentage);
4095 data << float(OffhandCritPercentage);
4096 data << float(SpellCritPercentage);
4097 data << int32(ShieldBlock);
4098 data << float(ShieldBlockCritPercentage);
4099 data << float(Mastery);
4100 data << float(Speed);
4101 data << float(Avoidance);
4102 data << float(Sturdiness);
4103 data << int32(Versatility);
4104 data << float(VersatilityBonus);
4105 data << float(PvpPowerDamage);
4106 data << float(PvpPowerHealing);
4107 for (uint32 i = 0; i < 8; ++i)
4108 {
4109 data << uint32(DataFlags[i].size());
4110 for (uint32 j = 0; j < DataFlags[i].size(); ++j)
4111 {
4112 data << uint64(DataFlags[i][j]);
4113 }
4114 }
4115 for (uint32 i = 0; i < 2; ++i)
4116 {
4117 RestInfo[i].WriteCreate(data, owner, receiver);
4118 }
4119 for (uint32 i = 0; i < 7; ++i)
4120 {
4121 data << int32(ModDamageDonePos[i]);
4122 data << int32(ModDamageDoneNeg[i]);
4123 data << float(ModDamageDonePercent[i]);
4124 data << float(ModHealingDonePercent[i]);
4125 }
4126 data << int32(ModHealingDonePos);
4127 data << float(ModHealingPercent);
4128 data << float(ModPeriodicHealingDonePercent);
4129 for (uint32 i = 0; i < 3; ++i)
4130 {
4131 data << float(WeaponDmgMultipliers[i]);
4132 data << float(WeaponAtkSpeedMultipliers[i]);
4133 }
4134 data << float(ModSpellPowerPercent);
4135 data << float(ModResiliencePercent);
4136 data << float(OverrideSpellPowerByAPPercent);
4137 data << float(OverrideAPBySpellPowerPercent);
4138 data << int32(ModTargetResistance);
4140 data << uint32(LocalFlags);
4141 data << uint8(GrantableLevels);
4142 data << uint8(MultiActionBars);
4143 data << uint8(LifetimeMaxRank);
4144 data << uint8(NumRespecs);
4145 data << uint32(PvpMedals);
4146 for (uint32 i = 0; i < 12; ++i)
4147 {
4148 data << uint32(BuybackPrice[i]);
4149 data << int64(BuybackTimestamp[i]);
4150 }
4151 data << uint16(TodayHonorableKills);
4154 data << int32(WatchedFactionIndex);
4155 for (uint32 i = 0; i < 32; ++i)
4156 {
4157 data << int32(CombatRatings[i]);
4158 }
4159 data << uint32(PvpInfo.size());
4160 data << int32(MaxLevel);
4163 for (uint32 i = 0; i < 4; ++i)
4164 {
4165 data << uint32(NoReagentCostMask[i]);
4166 }
4167 data << int32(PetSpellPower);
4168 for (uint32 i = 0; i < 2; ++i)
4169 {
4170 data << int32(ProfessionSkillLine[i]);
4171 }
4172 data << float(UiHitModifier);
4173 data << float(UiSpellHitModifier);
4174 data << int32(HomeRealmTimeOffset);
4175 data << float(ModPetHaste);
4176 data << int8(JailersTowerLevelMax);
4177 data << int8(JailersTowerLevel);
4178 data << uint8(LocalRegenFlags);
4179 data << uint8(AuraVision);
4180 data << uint8(NumBackpackSlots);
4181 data << int32(OverrideSpellsID);
4182 data << uint16(LootSpecID);
4183 data << uint32(OverrideZonePVPType);
4184 for (uint32 i = 0; i < 5; ++i)
4185 {
4186 data << uint32(BagSlotFlags[i]);
4187 }
4188 for (uint32 i = 0; i < 7; ++i)
4189 {
4190 data << uint32(BankBagSlotFlags[i]);
4191 }
4192 for (uint32 i = 0; i < 950; ++i)
4193 {
4194 data << uint64(QuestCompleted[i]);
4195 }
4196 data << int32(Honor);
4197 data << int32(HonorNextLevel);
4198 data << int32(PerksProgramCurrency);
4199 data << uint8(NumBankSlots);
4200 for (uint32 i = 0; i < 1; ++i)
4201 {
4202 data << uint32(ResearchSites[i].size());
4203 data << uint32(ResearchSiteProgress[i].size());
4204 data << uint32(Research[i].size());
4205 for (uint32 j = 0; j < ResearchSites[i].size(); ++j)
4206 {
4207 data << uint16(ResearchSites[i][j]);
4208 }
4209 for (uint32 j = 0; j < ResearchSiteProgress[i].size(); ++j)
4210 {
4211 data << uint32(ResearchSiteProgress[i][j]);
4212 }
4213 for (uint32 j = 0; j < Research[i].size(); ++j)
4214 {
4215 Research[i][j].WriteCreate(data, owner, receiver);
4216 }
4217 }
4218 data << uint32(DailyQuestsCompleted.size());
4220 data << uint32(Heirlooms.size());
4221 data << uint32(HeirloomFlags.size());
4222 data << uint32(Toys.size());
4223 data << uint32(ToyFlags.size());
4224 data << uint32(Transmog.size());
4225 data << uint32(ConditionalTransmog.size());
4226 data << uint32(SelfResSpells.size());
4227 data << uint32(RuneforgePowers.size());
4228 data << uint32(TransmogIllusions.size());
4230 data << uint32(SpellPctModByLabel.size());
4231 data << uint32(SpellFlatModByLabel.size());
4232 data << uint32(MawPowers.size());
4234 data << uint32(RecipeProgression.size());
4235 data << uint32(ReplayedQuests.size());
4236 data << uint32(TaskQuests.size());
4237 data << uint32(DisabledSpells.size());
4239 data << int32(TransportServerTime);
4242 data << uint32(TraitConfigs.size());
4244 data << uint32(CraftingOrders.size());
4246 data << uint32(CategoryCooldownMods.size());
4247 data << uint32(WeeklySpellUses.size());
4248 for (uint32 i = 0; i < 17; ++i)
4249 {
4250 data << float(ItemUpgradeHighWatermark[i]);
4251 }
4254 data << float(ItemUpgradeHighFingerWatermark);
4256 data << float(ItemUpgradeHighTrinketWatermark);
4260 for (uint32 i = 0; i < KnownTitles.size(); ++i)
4261 {
4262 data << uint64(KnownTitles[i]);
4263 }
4264 for (uint32 i = 0; i < DailyQuestsCompleted.size(); ++i)
4265 {
4266 data << int32(DailyQuestsCompleted[i]);
4267 }
4268 for (uint32 i = 0; i < AvailableQuestLineXQuestIDs.size(); ++i)
4269 {
4271 }
4272 for (uint32 i = 0; i < Heirlooms.size(); ++i)
4273 {
4274 data << int32(Heirlooms[i]);
4275 }
4276 for (uint32 i = 0; i < HeirloomFlags.size(); ++i)
4277 {
4278 data << uint32(HeirloomFlags[i]);
4279 }
4280 for (uint32 i = 0; i < Toys.size(); ++i)
4281 {
4282 data << int32(Toys[i]);
4283 }
4284 for (uint32 i = 0; i < ToyFlags.size(); ++i)
4285 {
4286 data << uint32(ToyFlags[i]);
4287 }
4288 for (uint32 i = 0; i < Transmog.size(); ++i)
4289 {
4290 data << uint32(Transmog[i]);
4291 }
4292 for (uint32 i = 0; i < ConditionalTransmog.size(); ++i)
4293 {
4294 data << int32(ConditionalTransmog[i]);
4295 }
4296 for (uint32 i = 0; i < SelfResSpells.size(); ++i)
4297 {
4298 data << int32(SelfResSpells[i]);
4299 }
4300 for (uint32 i = 0; i < RuneforgePowers.size(); ++i)
4301 {
4302 data << uint32(RuneforgePowers[i]);
4303 }
4304 for (uint32 i = 0; i < TransmogIllusions.size(); ++i)
4305 {
4306 data << uint32(TransmogIllusions[i]);
4307 }
4308 for (uint32 i = 0; i < SpellPctModByLabel.size(); ++i)
4309 {
4310 SpellPctModByLabel[i].WriteCreate(data, owner, receiver);
4311 }
4312 for (uint32 i = 0; i < SpellFlatModByLabel.size(); ++i)
4313 {
4314 SpellFlatModByLabel[i].WriteCreate(data, owner, receiver);
4315 }
4316 for (uint32 i = 0; i < MawPowers.size(); ++i)
4317 {
4318 MawPowers[i].WriteCreate(data, owner, receiver);
4319 }
4320 for (uint32 i = 0; i < MultiFloorExploration.size(); ++i)
4321 {
4322 MultiFloorExploration[i].WriteCreate(data, owner, receiver);
4323 }
4324 for (uint32 i = 0; i < RecipeProgression.size(); ++i)
4325 {
4326 RecipeProgression[i].WriteCreate(data, owner, receiver);
4327 }
4328 for (uint32 i = 0; i < ReplayedQuests.size(); ++i)
4329 {
4330 ReplayedQuests[i].WriteCreate(data, owner, receiver);
4331 }
4332 for (uint32 i = 0; i < TaskQuests.size(); ++i)
4333 {
4334 TaskQuests[i].WriteCreate(data, owner, receiver);
4335 }
4336 for (uint32 i = 0; i < DisabledSpells.size(); ++i)
4337 {
4338 data << int32(DisabledSpells[i]);
4339 }
4340 for (uint32 i = 0; i < PersonalCraftingOrderCounts.size(); ++i)
4341 {
4342 PersonalCraftingOrderCounts[i].WriteCreate(data, owner, receiver);
4343 }
4344 for (uint32 i = 0; i < CategoryCooldownMods.size(); ++i)
4345 {
4346 CategoryCooldownMods[i].WriteCreate(data, owner, receiver);
4347 }
4348 for (uint32 i = 0; i < WeeklySpellUses.size(); ++i)
4349 {
4350 WeeklySpellUses[i].WriteCreate(data, owner, receiver);
4351 }
4352 for (uint32 i = 0; i < TrackedCollectableSources.size(); ++i)
4353 {
4354 TrackedCollectableSources[i].WriteCreate(data, owner, receiver);
4355 }
4356 data.FlushBits();
4363 data.WriteBits(QuestSession.has_value(), 1);
4364 data.WriteBits(PetStable.has_value(), 1);
4365 data.FlushBits();
4366 ResearchHistory->WriteCreate(data, owner, receiver);
4367 if (QuestSession.has_value())
4368 {
4369 QuestSession->WriteCreate(data, owner, receiver);
4370 }
4371 data << FrozenPerksVendorItem;
4372 Field_1410->WriteCreate(data, owner, receiver);
4373 data << DungeonScore;
4374 for (uint32 i = 0; i < PvpInfo.size(); ++i)
4375 {
4376 PvpInfo[i].WriteCreate(data, owner, receiver);
4377 }
4378 for (uint32 i = 0; i < CharacterRestrictions.size(); ++i)
4379 {
4380 CharacterRestrictions[i].WriteCreate(data, owner, receiver);
4381 }
4382 for (uint32 i = 0; i < TraitConfigs.size(); ++i)
4383 {
4384 TraitConfigs[i].WriteCreate(data, owner, receiver);
4385 }
4386 for (uint32 i = 0; i < CraftingOrders.size(); ++i)
4387 {
4388 CraftingOrders[i].WriteCreate(data, owner, receiver);
4389 }
4390 if (PetStable.has_value())
4391 {
4392 PetStable->WriteCreate(data, owner, receiver);
4393 }
4394 data.FlushBits();
4395}
4396
4397void ActivePlayerData::WriteUpdate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisibilityFlags, Player const* owner, Player const* receiver) const
4398{
4399 WriteUpdate(data, _changesMask, false, owner, receiver);
4400}
4401
4402void ActivePlayerData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bool ignoreNestedChangesMask, Player const* owner, Player const* receiver) const
4403{
4404 for (uint32 i = 0; i < 1; ++i)
4405 data << uint32(changesMask.GetBlocksMask(i));
4406 data.WriteBits(changesMask.GetBlocksMask(1), 14);
4407 for (uint32 i = 0; i < 46; ++i)
4408 if (changesMask.GetBlock(i))
4409 data.WriteBits(changesMask.GetBlock(i), 32);
4410
4411 if (changesMask[0])
4412 {
4413 if (changesMask[1])
4414 {
4416 }
4417 if (changesMask[2])
4418 {
4420 }
4421 if (changesMask[3])
4422 {
4424 }
4425 if (changesMask[4])
4426 {
4428 }
4429 if (changesMask[5])
4430 {
4432 }
4433 if (changesMask[6])
4434 {
4436 }
4437 if (changesMask[7])
4438 {
4439 if (!ignoreNestedChangesMask)
4441 else
4443 }
4444 }
4445 if (changesMask[36])
4446 {
4447 for (uint32 i = 0; i < 8; ++i)
4448 {
4449 if (changesMask[37])
4450 {
4451 if (!ignoreNestedChangesMask)
4452 DataFlags[i].WriteUpdateMask(data);
4453 else
4455 }
4456 }
4457 }
4458 if (changesMask[36])
4459 {
4460 for (uint32 i = 0; i < 8; ++i)
4461 {
4462 if (changesMask[37])
4463 {
4464 for (uint32 j = 0; j < DataFlags[i].size(); ++j)
4465 {
4466 if (DataFlags[i].HasChanged(j) || ignoreNestedChangesMask)
4467 {
4468 data << uint64(DataFlags[i][j]);
4469 }
4470 }
4471 }
4472 }
4473 }
4474 if (changesMask[0])
4475 {
4476 if (changesMask[8])
4477 {
4478 if (!ignoreNestedChangesMask)
4480 else
4482 }
4483 }
4484 if (changesMask[38])
4485 {
4486 for (uint32 i = 0; i < 1; ++i)
4487 {
4488 if (changesMask[39])
4489 {
4490 if (!ignoreNestedChangesMask)
4491 ResearchSites[i].WriteUpdateMask(data);
4492 else
4494 }
4495 }
4496 }
4497 if (changesMask[40])
4498 {
4499 for (uint32 i = 0; i < 1; ++i)
4500 {
4501 if (changesMask[41])
4502 {
4503 if (!ignoreNestedChangesMask)
4504 ResearchSiteProgress[i].WriteUpdateMask(data);
4505 else
4507 }
4508 }
4509 }
4510 if (changesMask[42])
4511 {
4512 for (uint32 i = 0; i < 1; ++i)
4513 {
4514 if (changesMask[43])
4515 {
4516 if (!ignoreNestedChangesMask)
4517 Research[i].WriteUpdateMask(data);
4518 else
4520 }
4521 }
4522 }
4523 if (changesMask[38])
4524 {
4525 for (uint32 i = 0; i < 1; ++i)
4526 {
4527 if (changesMask[39])
4528 {
4529 for (uint32 j = 0; j < ResearchSites[i].size(); ++j)
4530 {
4531 if (ResearchSites[i].HasChanged(j) || ignoreNestedChangesMask)
4532 {
4533 data << uint16(ResearchSites[i][j]);
4534 }
4535 }
4536 }
4537 }
4538 }
4539 if (changesMask[40])
4540 {
4541 for (uint32 i = 0; i < 1; ++i)
4542 {
4543 if (changesMask[41])
4544 {
4545 for (uint32 j = 0; j < ResearchSiteProgress[i].size(); ++j)
4546 {
4547 if (ResearchSiteProgress[i].HasChanged(j) || ignoreNestedChangesMask)
4548 {
4549 data << uint32(ResearchSiteProgress[i][j]);
4550 }
4551 }
4552 }
4553 }
4554 }
4555 if (changesMask[42])
4556 {
4557 for (uint32 i = 0; i < 1; ++i)
4558 {
4559 if (changesMask[43])
4560 {
4561 for (uint32 j = 0; j < Research[i].size(); ++j)
4562 {
4563 if (Research[i].HasChanged(j) || ignoreNestedChangesMask)
4564 {
4565 Research[i][j].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
4566 }
4567 }
4568 }
4569 }
4570 }
4571 data.FlushBits();
4572 if (changesMask[0])
4573 {
4574 if (changesMask[9])
4575 {
4576 if (!ignoreNestedChangesMask)
4578 else
4580 }
4581 if (changesMask[10])
4582 {
4583 if (!ignoreNestedChangesMask)
4585 else
4587 }
4588 if (changesMask[11])
4589 {
4590 if (!ignoreNestedChangesMask)
4592 else
4594 }
4595 if (changesMask[12])
4596 {
4597 if (!ignoreNestedChangesMask)
4599 else
4601 }
4602 if (changesMask[13])
4603 {
4604 if (!ignoreNestedChangesMask)
4605 Toys.WriteUpdateMask(data);
4606 else
4608 }
4609 if (changesMask[14])
4610 {
4611 if (!ignoreNestedChangesMask)
4612 ToyFlags.WriteUpdateMask(data);
4613 else
4615 }
4616 if (changesMask[15])
4617 {
4618 if (!ignoreNestedChangesMask)
4620 else
4622 }
4623 if (changesMask[16])
4624 {
4625 if (!ignoreNestedChangesMask)
4627 else
4629 }
4630 if (changesMask[17])
4631 {
4632 if (!ignoreNestedChangesMask)
4634 else
4636 }
4637 if (changesMask[18])
4638 {
4639 if (!ignoreNestedChangesMask)
4641 else
4643 }
4644 if (changesMask[19])
4645 {
4646 if (!ignoreNestedChangesMask)
4648 else
4650 }
4651 if (changesMask[20])
4652 {
4653 if (!ignoreNestedChangesMask)
4655 else
4657 }
4658 if (changesMask[21])
4659 {
4660 if (!ignoreNestedChangesMask)
4661 SpellPctModByLabel.WriteUpdateMask(data);
4662 else
4664 }
4665 if (changesMask[22])
4666 {
4667 if (!ignoreNestedChangesMask)
4668 SpellFlatModByLabel.WriteUpdateMask(data);
4669 else
4671 }
4672 if (changesMask[23])
4673 {
4674 if (!ignoreNestedChangesMask)
4676 else
4678 }
4679 if (changesMask[24])
4680 {
4681 if (!ignoreNestedChangesMask)
4683 else
4685 }
4686 if (changesMask[25])
4687 {
4688 if (!ignoreNestedChangesMask)
4690 else
4692 }
4693 if (changesMask[26])
4694 {
4695 if (!ignoreNestedChangesMask)
4697 else
4699 }
4700 if (changesMask[27])
4701 {
4702 if (!ignoreNestedChangesMask)
4704 else
4706 }
4707 if (changesMask[28])
4708 {
4709 if (!ignoreNestedChangesMask)
4711 else
4713 }
4714 if (changesMask[29])
4715 {
4716 if (!ignoreNestedChangesMask)
4718 else
4720 }
4721 if (changesMask[30])
4722 {
4723 if (!ignoreNestedChangesMask)
4725 else
4727 }
4728 if (changesMask[31])
4729 {
4730 if (!ignoreNestedChangesMask)
4732 else
4734 }
4735 }
4736 if (changesMask[32])
4737 {
4738 if (changesMask[33])
4739 {
4740 if (!ignoreNestedChangesMask)
4742 else
4744 }
4745 if (changesMask[34])
4746 {
4747 if (!ignoreNestedChangesMask)
4749 else
4751 }
4752 if (changesMask[35])
4753 {
4754 if (!ignoreNestedChangesMask)
4756 else
4758 }
4759 }
4760 data.FlushBits();
4761 if (changesMask[0])
4762 {
4763 if (changesMask[7])
4764 {
4765 for (uint32 i = 0; i < KnownTitles.size(); ++i)
4766 {
4767 if (KnownTitles.HasChanged(i) || ignoreNestedChangesMask)
4768 {
4769 data << uint64(KnownTitles[i]);
4770 }
4771 }
4772 }
4773 if (changesMask[9])
4774 {
4775 for (uint32 i = 0; i < DailyQuestsCompleted.size(); ++i)
4776 {
4777 if (DailyQuestsCompleted.HasChanged(i) || ignoreNestedChangesMask)
4778 {
4779 data << int32(DailyQuestsCompleted[i]);
4780 }
4781 }
4782 }
4783 if (changesMask[10])
4784 {
4785 for (uint32 i = 0; i < AvailableQuestLineXQuestIDs.size(); ++i)
4786 {
4787 if (AvailableQuestLineXQuestIDs.HasChanged(i) || ignoreNestedChangesMask)
4788 {
4790 }
4791 }
4792 }
4793 if (changesMask[11])
4794 {
4795 for (uint32 i = 0; i < Heirlooms.size(); ++i)
4796 {
4797 if (Heirlooms.HasChanged(i) || ignoreNestedChangesMask)
4798 {
4799 data << int32(Heirlooms[i]);
4800 }
4801 }
4802 }
4803 if (changesMask[12])
4804 {
4805 for (uint32 i = 0; i < HeirloomFlags.size(); ++i)
4806 {
4807 if (HeirloomFlags.HasChanged(i) || ignoreNestedChangesMask)
4808 {
4809 data << uint32(HeirloomFlags[i]);
4810 }
4811 }
4812 }
4813 if (changesMask[13])
4814 {
4815 for (uint32 i = 0; i < Toys.size(); ++i)
4816 {
4817 if (Toys.HasChanged(i) || ignoreNestedChangesMask)
4818 {
4819 data << int32(Toys[i]);
4820 }
4821 }
4822 }
4823 if (changesMask[14])
4824 {
4825 for (uint32 i = 0; i < ToyFlags.size(); ++i)
4826 {
4827 if (ToyFlags.HasChanged(i) || ignoreNestedChangesMask)
4828 {
4829 data << uint32(ToyFlags[i]);
4830 }
4831 }
4832 }
4833 if (changesMask[15])
4834 {
4835 for (uint32 i = 0; i < Transmog.size(); ++i)
4836 {
4837 if (Transmog.HasChanged(i) || ignoreNestedChangesMask)
4838 {
4839 data << uint32(Transmog[i]);
4840 }
4841 }
4842 }
4843 if (changesMask[16])
4844 {
4845 for (uint32 i = 0; i < ConditionalTransmog.size(); ++i)
4846 {
4847 if (ConditionalTransmog.HasChanged(i) || ignoreNestedChangesMask)
4848 {
4849 data << int32(ConditionalTransmog[i]);
4850 }
4851 }
4852 }
4853 if (changesMask[17])
4854 {
4855 for (uint32 i = 0; i < SelfResSpells.size(); ++i)
4856 {
4857 if (SelfResSpells.HasChanged(i) || ignoreNestedChangesMask)
4858 {
4859 data << int32(SelfResSpells[i]);
4860 }
4861 }
4862 }
4863 if (changesMask[18])
4864 {
4865 for (uint32 i = 0; i < RuneforgePowers.size(); ++i)
4866 {
4867 if (RuneforgePowers.HasChanged(i) || ignoreNestedChangesMask)
4868 {
4869 data << uint32(RuneforgePowers[i]);
4870 }
4871 }
4872 }
4873 if (changesMask[19])
4874 {
4875 for (uint32 i = 0; i < TransmogIllusions.size(); ++i)
4876 {
4877 if (TransmogIllusions.HasChanged(i) || ignoreNestedChangesMask)
4878 {
4879 data << uint32(TransmogIllusions[i]);
4880 }
4881 }
4882 }