-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathPlayer.h
More file actions
4243 lines (3257 loc) · 156 KB
/
Copy pathPlayer.h
File metadata and controls
4243 lines (3257 loc) · 156 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
* Copyright (C) 2005-2025 MaNGOS <https://www.getmangos.eu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef MANGOS_H_PLAYER
#define MANGOS_H_PLAYER
#include "Common.h"
#include "ItemPrototype.h"
#include "Unit.h"
#include "Item.h"
#include "Database/DatabaseEnv.h"
#include "NPCHandler.h"
#include "QuestDef.h"
#include "Group.h"
#include "Bag.h"
#include "WorldSession.h"
#include "Pet.h"
#include "MapReference.h"
#include "Util.h" // for Tokens typedef
#include "AchievementMgr.h"
#include "ReputationMgr.h"
#include "BattleGround.h"
#include "DBCStores.h"
#include "SharedDefines.h"
#include "Chat.h"
#include "GMTicketMgr.h"
#include<string>
#include<vector>
struct Mail;
class Channel;
class DynamicObject;
class Creature;
class PlayerMenu;
class Transport;
class UpdateMask;
class SpellCastTargets;
class PlayerSocial;
class DungeonPersistentState;
class Spell;
class Item;
struct AreaTrigger;
#ifdef ENABLE_PLAYERBOTS
class PlayerbotAI;
class PlayerbotMgr;
#endif
typedef std::deque<Mail*> PlayerMails;
#define PLAYER_MAX_SKILLS 127
#define PLAYER_MAX_DAILY_QUESTS 25
#define PLAYER_EXPLORED_ZONES_SIZE 128
// Note: SPELLMOD_* values is aura types in fact
enum SpellModType
{
SPELLMOD_FLAT = 107, // SPELL_AURA_ADD_FLAT_MODIFIER
SPELLMOD_PCT = 108 // SPELL_AURA_ADD_PCT_MODIFIER
};
// 2^n internal values, they are never sent to the client
enum PlayerUnderwaterState
{
UNDERWATER_NONE = 0x00,
UNDERWATER_INWATER = 0x01, // terrain type is water and player is afflicted by it
UNDERWATER_INLAVA = 0x02, // terrain type is lava and player is afflicted by it
UNDERWATER_INSLIME = 0x04, // terrain type is lava and player is afflicted by it
UNDERWATER_INDARKWATER = 0x08, // terrain type is dark water and player is afflicted by it
UNDERWATER_EXIST_TIMERS = 0x10
};
enum BuyBankSlotResult
{
ERR_BANKSLOT_FAILED_TOO_MANY = 0,
ERR_BANKSLOT_INSUFFICIENT_FUNDS = 1,
ERR_BANKSLOT_NOTBANKER = 2,
ERR_BANKSLOT_OK = 3
};
enum PlayerSpellState
{
PLAYERSPELL_UNCHANGED = 0,
PLAYERSPELL_CHANGED = 1,
PLAYERSPELL_NEW = 2,
PLAYERSPELL_REMOVED = 3
};
// Structure to hold player spell information
struct PlayerSpell
{
PlayerSpellState state : 8; // State of the spell
bool active : 1; // Show in spellbook
bool dependent : 1; // Learned as result of another spell learn, skill grow, quest reward, etc
bool disabled : 1; // First rank has been learned as a result of talent learn but currently talent unlearned, save max learned ranks
};
struct PlayerTalent
{
TalentEntry const* talentEntry;
uint32 currentRank;
PlayerSpellState state;
};
typedef UNORDERED_MAP<uint32, PlayerSpell> PlayerSpellMap;
typedef UNORDERED_MAP<uint32, PlayerTalent> PlayerTalentMap;
// Structure to hold spell cooldown information
struct SpellCooldown
{
time_t end; // End time of the cooldown
uint16 itemid; // Item ID associated with the cooldown
};
typedef std::map<uint32, SpellCooldown> SpellCooldowns;
enum TrainerSpellState
{
TRAINER_SPELL_GREEN = 0,
TRAINER_SPELL_RED = 1,
TRAINER_SPELL_GRAY = 2,
TRAINER_SPELL_GREEN_DISABLED = 10 // Custom value, not sent to client: formally green but learn not allowed
};
enum ActionButtonUpdateState
{
ACTIONBUTTON_UNCHANGED = 0,
ACTIONBUTTON_CHANGED = 1,
ACTIONBUTTON_NEW = 2,
ACTIONBUTTON_DELETED = 3
};
enum ActionButtonType
{
ACTION_BUTTON_SPELL = 0x00,
ACTION_BUTTON_C = 0x01, // click?
ACTION_BUTTON_EQSET = 0x20,
ACTION_BUTTON_MACRO = 0x40,
ACTION_BUTTON_CMACRO = ACTION_BUTTON_C | ACTION_BUTTON_MACRO,
ACTION_BUTTON_ITEM = 0x80
};
#define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
#define ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
#define MAX_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1)
// Structure to hold action button information
struct ActionButton
{
ActionButton() : packedData(0), uState(ACTIONBUTTON_NEW) {}
uint32 packedData; // Packed data containing action and type
ActionButtonUpdateState uState; // Update state of the action button
// Helpers
ActionButtonType GetType() const
{
return ActionButtonType(ACTION_BUTTON_TYPE(packedData));
}
uint32 GetAction() const
{
return ACTION_BUTTON_ACTION(packedData);
}
void SetActionAndType(uint32 action, ActionButtonType type)
{
uint32 newData = action | (uint32(type) << 24);
if (newData != packedData || uState == ACTIONBUTTON_DELETED)
{
packedData = newData;
if (uState != ACTIONBUTTON_NEW)
{
uState = ACTIONBUTTON_CHANGED;
}
}
}
};
// some action button indexes used in code or clarify structure
enum ActionButtonIndex
{
ACTION_BUTTON_SHAMAN_TOTEMS_BAR = 132,
};
#define MAX_ACTION_BUTTONS 144 // checked in 3.2.0
typedef std::map<uint8, ActionButton> ActionButtonList;
enum GlyphUpdateState
{
GLYPH_UNCHANGED = 0,
GLYPH_CHANGED = 1,
GLYPH_NEW = 2,
GLYPH_DELETED = 3
};
struct Glyph
{
uint32 id;
GlyphUpdateState uState;
Glyph() : id(0), uState(GLYPH_UNCHANGED) { }
uint32 GetId() { return id; }
void SetId(uint32 newId)
{
if (newId == id)
{
return;
}
if (id == 0 && uState == GLYPH_UNCHANGED) // not exist yet in db and already saved
{
uState = GLYPH_NEW;
}
else if (newId == 0)
{
if (uState == GLYPH_NEW) // delete before add new -> no change
{
uState = GLYPH_UNCHANGED;
}
else // delete existing data
{
uState = GLYPH_DELETED;
}
}
else if (uState != GLYPH_NEW) // if not new data, change current data
{
uState = GLYPH_CHANGED;
}
id = newId;
}
};
struct PlayerCreateInfoItem
{
PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) {}
uint32 item_id; // Item ID
uint32 item_amount; // Item amount
};
typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems;
// Structure to hold player class level info
struct PlayerClassLevelInfo
{
PlayerClassLevelInfo() : basehealth(0), basemana(0) {}
uint16 basehealth; // Base health
uint16 basemana; // Base mana
};
// Structure to hold player class info
struct PlayerClassInfo
{
PlayerClassInfo() : levelInfo(NULL) { }
PlayerClassLevelInfo* levelInfo; // Level info array [level-1] 0..MaxPlayerLevel-1
};
// Structure to hold player level info
struct PlayerLevelInfo
{
PlayerLevelInfo()
{
for (int i = 0; i < MAX_STATS; ++i)
{
stats[i] = 0;
}
}
uint8 stats[MAX_STATS]; // Stats array
};
typedef std::list<uint32> PlayerCreateInfoSpells;
// Structure to hold player create info action
struct PlayerCreateInfoAction
{
PlayerCreateInfoAction() : button(0), type(0), action(0) {}
PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) {}
uint8 button; // Button index
uint8 type; // Action type
uint32 action; // Action ID
};
typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
// Structure to hold player info
struct PlayerInfo
{
// existence checked by displayId != 0 // existence checked by displayId != 0
PlayerInfo() : displayId_m(0), displayId_f(0), levelInfo(NULL), areaId(0), mapId(0), orientation(0.0f), positionX(0.0f), positionY(0.0f), positionZ(0.0f) {}
uint32 mapId; // Map ID
uint32 areaId; // Area ID
float positionX; // Position X
float positionY; // Position Y
float positionZ; // Position Z
float orientation; // Orientation
uint16 displayId_m; // Display ID for male
uint16 displayId_f; // Display ID for female
PlayerCreateInfoItems item; // Create info items
PlayerCreateInfoSpells spell; // Create info spells
PlayerCreateInfoActions action; // Create info actions
PlayerLevelInfo* levelInfo; // Level info array [level-1] 0..MaxPlayerLevel-1
};
// Structure to hold PvP info
struct PvPInfo
{
PvPInfo() : inHostileArea(false), endTimer(0) {}
bool inHostileArea; // Is in hostile area
time_t endTimer; // End timer
};
// Structure to hold duel info
struct DuelInfo
{
DuelInfo() : initiator(NULL), opponent(NULL), startTimer(0), startTime(0), outOfBound(0) {}
Player* initiator; // Initiator player
Player* opponent; // Opponent player
time_t startTimer; // Start timer
time_t startTime; // Start time
time_t outOfBound; // Out of bound timer
};
// Structure to hold area information
struct Areas
{
uint32 areaID; // Area ID
uint32 areaFlag; // Area flag
float x1; // X1 coordinate
float x2; // X2 coordinate
float y1; // Y1 coordinate
float y2; // Y2 coordinate
};
#define MAX_RUNES 6
#define RUNE_COOLDOWN (2*5*IN_MILLISECONDS) // msec
enum RuneType
{
RUNE_BLOOD = 0,
RUNE_UNHOLY = 1,
RUNE_FROST = 2,
RUNE_DEATH = 3,
NUM_RUNE_TYPES = 4
};
struct RuneInfo
{
uint8 BaseRune;
uint8 CurrentRune;
uint16 Cooldown; // msec
};
struct Runes
{
RuneInfo runes[MAX_RUNES];
uint8 runeState; // mask of available runes
void SetRuneState(uint8 index, bool set = true)
{
if (set)
{
runeState |= (1 << index); // usable
}
else
{
runeState &= ~(1 << index); // on cooldown
}
}
};
struct EnchantDuration
{
EnchantDuration() : item(NULL), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {};
EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration) { MANGOS_ASSERT(item); };
Item* item; // Item pointer
EnchantmentSlot slot; // Enchantment slot
uint32 leftduration; // Left duration
};
typedef std::list<EnchantDuration> EnchantDurationList;
typedef std::list<Item*> ItemDurationList;
enum LfgRoles
{
LEADER = 0x01,
TANK = 0x02,
HEALER = 0x04,
DAMAGE = 0x08
};
enum RaidGroupError
{
ERR_RAID_GROUP_NONE = 0,
ERR_RAID_GROUP_LOWLEVEL = 1,
ERR_RAID_GROUP_ONLY = 2,
ERR_RAID_GROUP_FULL = 3,
ERR_RAID_GROUP_REQUIREMENTS_UNMATCH = 4
};
enum DrunkenState
{
DRUNKEN_SOBER = 0,
DRUNKEN_TIPSY = 1,
DRUNKEN_DRUNK = 2,
DRUNKEN_SMASHED = 3
};
#define MAX_DRUNKEN 4
enum PlayerFlags
{
PLAYER_FLAGS_NONE = 0x00000000,
PLAYER_FLAGS_GROUP_LEADER = 0x00000001,
PLAYER_FLAGS_AFK = 0x00000002,
PLAYER_FLAGS_DND = 0x00000004,
PLAYER_FLAGS_GM = 0x00000008,
PLAYER_FLAGS_GHOST = 0x00000010,
PLAYER_FLAGS_RESTING = 0x00000020,
PLAYER_FLAGS_UNK7 = 0x00000040, // admin?
PLAYER_FLAGS_UNK8 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
PLAYER_FLAGS_IN_PVP = 0x00000200,
PLAYER_FLAGS_HIDE_HELM = 0x00000400,
PLAYER_FLAGS_HIDE_CLOAK = 0x00000800,
PLAYER_FLAGS_PARTIAL_PLAY_TIME = 0x00001000, // played long time
PLAYER_FLAGS_NO_PLAY_TIME = 0x00002000, // played too long time
PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000, // Lua_IsOutOfBounds
PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> chat tag, name prefix
PLAYER_FLAGS_ENABLE_LOW_LEVEL_RAID = 0x00010000, // triggers lua event EVENT_ENABLE_LOW_LEVEL_RAID
PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
PLAYER_FLAGS_COMMENTATOR = 0x00080000,
PLAYER_FLAGS_UNK21 = 0x00100000,
PLAYER_FLAGS_UNK22 = 0x00200000,
PLAYER_FLAGS_COMMENTATOR_UBER = 0x00400000, // something like COMMENTATOR_CAN_USE_INSTANCE_COMMAND
PLAYER_FLAGS_UNK24 = 0x00800000, // EVENT_SPELL_UPDATE_USABLE and EVENT_UPDATE_SHAPESHIFT_USABLE, disabled all abilitys on tab except autoattack
PLAYER_FLAGS_UNK25 = 0x01000000, // EVENT_SPELL_UPDATE_USABLE and EVENT_UPDATE_SHAPESHIFT_USABLE, disabled all melee ability on tab include autoattack
PLAYER_FLAGS_XP_USER_DISABLED = 0x02000000,
};
// Used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1)
// Can't use enum for uint64 values
#define PLAYER_TITLE_DISABLED UI64LIT(0x0000000000000000)
#define PLAYER_TITLE_NONE UI64LIT(0x0000000000000001)
#define PLAYER_TITLE_PRIVATE UI64LIT(0x0000000000000002) // 1
#define PLAYER_TITLE_CORPORAL UI64LIT(0x0000000000000004) // 2
#define PLAYER_TITLE_SERGEANT_A UI64LIT(0x0000000000000008) // 3
#define PLAYER_TITLE_MASTER_SERGEANT UI64LIT(0x0000000000000010) // 4
#define PLAYER_TITLE_SERGEANT_MAJOR UI64LIT(0x0000000000000020) // 5
#define PLAYER_TITLE_KNIGHT UI64LIT(0x0000000000000040) // 6
#define PLAYER_TITLE_KNIGHT_LIEUTENANT UI64LIT(0x0000000000000080) // 7
#define PLAYER_TITLE_KNIGHT_CAPTAIN UI64LIT(0x0000000000000100) // 8
#define PLAYER_TITLE_KNIGHT_CHAMPION UI64LIT(0x0000000000000200) // 9
#define PLAYER_TITLE_LIEUTENANT_COMMANDER UI64LIT(0x0000000000000400) // 10
#define PLAYER_TITLE_COMMANDER UI64LIT(0x0000000000000800) // 11
#define PLAYER_TITLE_MARSHAL UI64LIT(0x0000000000001000) // 12
#define PLAYER_TITLE_FIELD_MARSHAL UI64LIT(0x0000000000002000) // 13
#define PLAYER_TITLE_GRAND_MARSHAL UI64LIT(0x0000000000004000) // 14
#define PLAYER_TITLE_SCOUT UI64LIT(0x0000000000008000) // 15
#define PLAYER_TITLE_GRUNT UI64LIT(0x0000000000010000) // 16
#define PLAYER_TITLE_SERGEANT_H UI64LIT(0x0000000000020000) // 17
#define PLAYER_TITLE_SENIOR_SERGEANT UI64LIT(0x0000000000040000) // 18
#define PLAYER_TITLE_FIRST_SERGEANT UI64LIT(0x0000000000080000) // 19
#define PLAYER_TITLE_STONE_GUARD UI64LIT(0x0000000000100000) // 20
#define PLAYER_TITLE_BLOOD_GUARD UI64LIT(0x0000000000200000) // 21
#define PLAYER_TITLE_LEGIONNAIRE UI64LIT(0x0000000000400000) // 22
#define PLAYER_TITLE_CENTURION UI64LIT(0x0000000000800000) // 23
#define PLAYER_TITLE_CHAMPION UI64LIT(0x0000000001000000) // 24
#define PLAYER_TITLE_LIEUTENANT_GENERAL UI64LIT(0x0000000002000000) // 25
#define PLAYER_TITLE_GENERAL UI64LIT(0x0000000004000000) // 26
#define PLAYER_TITLE_WARLORD UI64LIT(0x0000000008000000) // 27
#define PLAYER_TITLE_HIGH_WARLORD UI64LIT(0x0000000010000000) // 28
#define PLAYER_TITLE_GLADIATOR UI64LIT(0x0000000020000000) // 29
#define PLAYER_TITLE_DUELIST UI64LIT(0x0000000040000000) // 30
#define PLAYER_TITLE_RIVAL UI64LIT(0x0000000080000000) // 31
#define PLAYER_TITLE_CHALLENGER UI64LIT(0x0000000100000000) // 32
#define PLAYER_TITLE_SCARAB_LORD UI64LIT(0x0000000200000000) // 33
#define PLAYER_TITLE_CONQUEROR UI64LIT(0x0000000400000000) // 34
#define PLAYER_TITLE_JUSTICAR UI64LIT(0x0000000800000000) // 35
#define PLAYER_TITLE_CHAMPION_OF_THE_NAARU UI64LIT(0x0000001000000000) // 36
#define PLAYER_TITLE_MERCILESS_GLADIATOR UI64LIT(0x0000002000000000) // 37
#define PLAYER_TITLE_OF_THE_SHATTERED_SUN UI64LIT(0x0000004000000000) // 38
#define PLAYER_TITLE_HAND_OF_ADAL UI64LIT(0x0000008000000000) // 39
#define PLAYER_TITLE_VENGEFUL_GLADIATOR UI64LIT(0x0000010000000000) // 40
#define KNOWN_TITLES_SIZE 3
#define MAX_TITLE_INDEX (KNOWN_TITLES_SIZE*64) // 3 uint64 fields
// used in (PLAYER_FIELD_BYTES, 0) byte values
enum PlayerFieldByteFlags
{
PLAYER_FIELD_BYTE_TRACK_STEALTHED = 0x02, // Track stealthed units
PLAYER_FIELD_BYTE_RELEASE_TIMER = 0x08, // Display time till auto release spirit
PLAYER_FIELD_BYTE_NO_RELEASE_WINDOW = 0x10 // Display no "release spirit" window at all
};
// used in byte (PLAYER_FIELD_BYTES2,3) values
enum PlayerFieldByte2Flags
{
PLAYER_FIELD_BYTE2_NONE = 0x00, // No flags
PLAYER_FIELD_BYTE2_DETECT_AMORE_0 = 0x02, // SPELL_AURA_DETECT_AMORE, not used as value and maybe not related to, but used in code as base for mask apply
PLAYER_FIELD_BYTE2_DETECT_AMORE_1 = 0x04, // SPELL_AURA_DETECT_AMORE value 1
PLAYER_FIELD_BYTE2_DETECT_AMORE_2 = 0x08, // SPELL_AURA_DETECT_AMORE value 2
PLAYER_FIELD_BYTE2_DETECT_AMORE_3 = 0x10, // SPELL_AURA_DETECT_AMORE value 3
PLAYER_FIELD_BYTE2_STEALTH = 0x20, // Stealth mode
PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW = 0x40 // Invisibility glow effect
};
// Mirror timer types
enum MirrorTimerType
{
FATIGUE_TIMER = 0,
BREATH_TIMER = 1,
FIRE_TIMER = 2
};
#define MAX_TIMERS 3
#define DISABLED_MIRROR_TIMER -1
// 2^n values for player extra flags
enum PlayerExtraFlags
{
// GM abilities
PLAYER_EXTRA_GM_ON = 0x0001, // GM mode on
PLAYER_EXTRA_GM_ACCEPT_TICKETS = 0x0002, // GM accepts tickets
PLAYER_EXTRA_ACCEPT_WHISPERS = 0x0004, // Accept whispers
PLAYER_EXTRA_TAXICHEAT = 0x0008, // Taxi cheat mode
PLAYER_EXTRA_GM_INVISIBLE = 0x0010, // GM invisible mode
PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages
PLAYER_EXTRA_AUCTION_NEUTRAL = 0x0040, // Neutral auction access
PLAYER_EXTRA_AUCTION_ENEMY = 0x0080, // Enemy auction access, overwrites PLAYER_EXTRA_AUCTION_NEUTRAL
// Other states
PLAYER_EXTRA_PVP_DEATH = 0x0100 // Store PvP death status until corpse creation
};
// 2^n values for at login flags
enum AtLoginFlags
{
AT_LOGIN_NONE = 0x00,
AT_LOGIN_RENAME = 0x01,
AT_LOGIN_RESET_SPELLS = 0x02,
AT_LOGIN_RESET_TALENTS = 0x04,
AT_LOGIN_CUSTOMIZE = 0x08,
AT_LOGIN_RESET_PET_TALENTS = 0x10,
AT_LOGIN_FIRST = 0x20,
};
typedef std::map<uint32, QuestStatusData> QuestStatusMap;
// Offsets for quest slots
enum QuestSlotOffsets
{
QUEST_ID_OFFSET = 0,
QUEST_STATE_OFFSET = 1,
QUEST_COUNTS_OFFSET = 2, // 2 and 3
QUEST_TIME_OFFSET = 4
};
#define MAX_QUEST_OFFSET 5
// State mask for quest slots
enum QuestSlotStateMask
{
QUEST_STATE_NONE = 0x0000, // No state
QUEST_STATE_COMPLETE = 0x0001, // Quest complete
QUEST_STATE_FAIL = 0x0002 // Quest failed
};
// States for skill updates
enum SkillUpdateState
{
SKILL_UNCHANGED = 0, // Skill unchanged
SKILL_CHANGED = 1, // Skill changed
SKILL_NEW = 2, // New skill
SKILL_DELETED = 3 // Skill deleted
};
// Structure to hold skill status data
struct SkillStatusData
{
SkillStatusData(uint8 _pos, SkillUpdateState _uState) : pos(_pos), uState(_uState) {}
uint8 pos; // Position of the skill
SkillUpdateState uState; // Update state of the skill
};
typedef UNORDERED_MAP<uint32, SkillStatusData> SkillStatusMap;
// Player slots for items
enum PlayerSlots
{
// First slot for item stored (in any way in player m_items data)
PLAYER_SLOT_START = 0,
// last+1 slot for item stored (in any way in player m_items data)
PLAYER_SLOT_END = 150,
PLAYER_SLOTS_COUNT = (PLAYER_SLOT_END - PLAYER_SLOT_START)
};
#define INVENTORY_SLOT_BAG_0 255
// Equipment slots (19 slots)
enum EquipmentSlots
{
EQUIPMENT_SLOT_START = 0,
EQUIPMENT_SLOT_HEAD = 0, // Head slot
EQUIPMENT_SLOT_NECK = 1, // Neck slot
EQUIPMENT_SLOT_SHOULDERS = 2, // Shoulders slot
EQUIPMENT_SLOT_BODY = 3, // Body slot
EQUIPMENT_SLOT_CHEST = 4, // Chest slot
EQUIPMENT_SLOT_WAIST = 5, // Waist slot
EQUIPMENT_SLOT_LEGS = 6, // Legs slot
EQUIPMENT_SLOT_FEET = 7, // Feet slot
EQUIPMENT_SLOT_WRISTS = 8, // Wrists slot
EQUIPMENT_SLOT_HANDS = 9, // Hands slot
EQUIPMENT_SLOT_FINGER1 = 10, // First finger slot
EQUIPMENT_SLOT_FINGER2 = 11, // Second finger slot
EQUIPMENT_SLOT_TRINKET1 = 12, // First trinket slot
EQUIPMENT_SLOT_TRINKET2 = 13, // Second trinket slot
EQUIPMENT_SLOT_BACK = 14, // Back slot
EQUIPMENT_SLOT_MAINHAND = 15, // Main hand slot
EQUIPMENT_SLOT_OFFHAND = 16, // Off hand slot
EQUIPMENT_SLOT_RANGED = 17, // Ranged slot
EQUIPMENT_SLOT_TABARD = 18, // Tabard slot
EQUIPMENT_SLOT_END = 19 // End of equipment slots
};
// Inventory slots (4 slots)
enum InventorySlots
{
INVENTORY_SLOT_BAG_START = 19, // Start of bag slots
INVENTORY_SLOT_BAG_END = 23 // End of bag slots
};
// Inventory pack slots (16 slots)
enum InventoryPackSlots
{
INVENTORY_SLOT_ITEM_START = 23, // Start of item slots
INVENTORY_SLOT_ITEM_END = 39 // End of item slots
};
// Bank item slots (28 slots)
enum BankItemSlots
{
BANK_SLOT_ITEM_START = 39, // Start of bank item slots
BANK_SLOT_ITEM_END = 67 // End of bank item slots
};
// Bank bag slots (7 slots)
enum BankBagSlots
{
BANK_SLOT_BAG_START = 67, // Start of bank bag slots
BANK_SLOT_BAG_END = 74 // End of bank bag slots
};
// Buy back slots (12 slots)
enum BuyBackSlots
{
// Stored in m_buybackitems
BUYBACK_SLOT_START = 74, // Start of buy back slots
BUYBACK_SLOT_END = 86 // End of buy back slots
};
// Key ring slots (32 slots)
enum KeyRingSlots
{
KEYRING_SLOT_START = 86, // Start of key ring slots
KEYRING_SLOT_END = 118 // End of key ring slots
};
enum CurrencyTokenSlots // 32 slots
{
CURRENCYTOKEN_SLOT_START = 118,
CURRENCYTOKEN_SLOT_END = 150
};
enum EquipmentSetUpdateState
{
EQUIPMENT_SET_UNCHANGED = 0,
EQUIPMENT_SET_CHANGED = 1,
EQUIPMENT_SET_NEW = 2,
EQUIPMENT_SET_DELETED = 3
};
struct EquipmentSet
{
EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW)
{
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
Items[i] = 0;
}
}
uint64 Guid;
std::string Name;
std::string IconName;
uint32 IgnoreMask;
uint32 Items[EQUIPMENT_SLOT_END];
EquipmentSetUpdateState state;
};
#define MAX_EQUIPMENT_SET_INDEX 10 // client limit
typedef std::map<uint32, EquipmentSet> EquipmentSets;
struct ItemPosCount
{
ItemPosCount(uint16 _pos, uint32 _count) : pos(_pos), count(_count) {}
bool isContainedIn(std::vector<ItemPosCount> const& vec) const;
uint16 pos;
uint32 count;
};
typedef std::vector<ItemPosCount> ItemPosCountVec;
// Trade slots
enum TradeSlots
{
TRADE_SLOT_COUNT = 7, // Total trade slots
TRADE_SLOT_TRADED_COUNT = 6, // Traded slots count
TRADE_SLOT_NONTRADED = 6 // Non-traded slots count
};
// Reasons for transfer abort
enum TransferAbortReason
{
TRANSFER_ABORT_NONE = 0x00,
TRANSFER_ABORT_ERROR = 0x01,
TRANSFER_ABORT_MAX_PLAYERS = 0x02, // Transfer Aborted: instance is full
TRANSFER_ABORT_NOT_FOUND = 0x03, // Transfer Aborted: instance not found
TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x04, // You have entered too many instances recently.
TRANSFER_ABORT_ZONE_IN_COMBAT = 0x06, // Unable to zone in while an encounter is in progress.
TRANSFER_ABORT_INSUF_EXPAN_LVL = 0x07, // You must have <TBC,WotLK> expansion installed to access this area.
TRANSFER_ABORT_DIFFICULTY = 0x08, // <Normal,Heroic,Epic> difficulty mode is not available for %s.
TRANSFER_ABORT_UNIQUE_MESSAGE = 0x09, // Until you've escaped TLK's grasp, you cannot leave this place!
TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x0A, // Additional instances cannot be launched, please try again later.
TRANSFER_ABORT_NEED_GROUP = 0x0B, // 3.1
TRANSFER_ABORT_NOT_FOUND2 = 0x0C, // 3.1
TRANSFER_ABORT_NOT_FOUND3 = 0x0D, // 3.1
TRANSFER_ABORT_NOT_FOUND4 = 0x0E, // 3.2
TRANSFER_ABORT_REALM_ONLY = 0x0F, // All players on party must be from the same realm.
TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10, // Map can't be entered at this time.
};
// Instance reset warning types
enum InstanceResetWarningType
{
RAID_INSTANCE_WARNING_HOURS = 1, // WARNING! %s is scheduled to reset in %d hour(s).
RAID_INSTANCE_WARNING_MIN = 2, // WARNING! %s is scheduled to reset in %d minute(s)!
RAID_INSTANCE_WARNING_MIN_SOON = 3, // WARNING! %s is scheduled to reset in %d minute(s). Please exit the zone or you will be returned to your bind location!
RAID_INSTANCE_WELCOME = 4, // Welcome to %s. This raid instance is scheduled to reset in %s.
RAID_INSTANCE_EXPIRED = 5
};
// PLAYER_FIELD_ARENA_TEAM_INFO_1_1 offsets
enum ArenaTeamInfoType
{
ARENA_TEAM_ID = 0,
ARENA_TEAM_TYPE = 1, // new in 3.2 - team type?
ARENA_TEAM_MEMBER = 2, // 0 - captain, 1 - member
ARENA_TEAM_GAMES_WEEK = 3,
ARENA_TEAM_GAMES_SEASON = 4,
ARENA_TEAM_WINS_SEASON = 5,
ARENA_TEAM_PERSONAL_RATING = 6,
ARENA_TEAM_END = 7
};
// Rest types
enum RestType
{
REST_TYPE_NO = 0, // No rest
REST_TYPE_IN_TAVERN = 1, // Resting in a tavern
REST_TYPE_IN_CITY = 2 // Resting in a city
};
// Duel completion types
enum DuelCompleteType
{
DUEL_INTERRUPTED = 0, // Duel interrupted
DUEL_WON = 1, // Duel won
DUEL_FLED = 2 // Duel fled
};
// Teleport options
enum TeleportToOptions
{
TELE_TO_GM_MODE = 0x01, // GM mode teleport
TELE_TO_NOT_LEAVE_TRANSPORT = 0x02, // Do not leave transport
TELE_TO_NOT_LEAVE_COMBAT = 0x04, // Do not leave combat
TELE_TO_NOT_UNSUMMON_PET = 0x08, // Do not unsummon pet
TELE_TO_SPELL = 0x10 // Teleport by spell
};
// Types of environmental damages
enum EnviromentalDamage
{
DAMAGE_EXHAUSTED = 0, // Exhausted damage
DAMAGE_DROWNING = 1, // Drowning damage
DAMAGE_FALL = 2, // Fall damage
DAMAGE_LAVA = 3, // Lava damage
DAMAGE_SLIME = 4, // Slime damage
DAMAGE_FIRE = 5, // Fire damage
DAMAGE_FALL_TO_VOID = 6 // Custom case for fall without durability loss
};
// Played time indices
enum PlayedTimeIndex
{
PLAYED_TIME_TOTAL = 0, // Total played time
PLAYED_TIME_LEVEL = 1 // Played time at current level
};
#define MAX_PLAYED_TIME_INDEX 2
// Used at player loading query list preparing, and later result selection
enum PlayerLoginQueryIndex
{
PLAYER_LOGIN_QUERY_LOADFROM,
PLAYER_LOGIN_QUERY_LOADGROUP,
PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES,
PLAYER_LOGIN_QUERY_LOADAURAS,
PLAYER_LOGIN_QUERY_LOADSPELLS,
PLAYER_LOGIN_QUERY_LOADQUESTSTATUS,
PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,
PLAYER_LOGIN_QUERY_LOADREPUTATION,
PLAYER_LOGIN_QUERY_LOADINVENTORY,
PLAYER_LOGIN_QUERY_LOADITEMLOOT,
PLAYER_LOGIN_QUERY_LOADACTIONS,
PLAYER_LOGIN_QUERY_LOADSOCIALLIST,
PLAYER_LOGIN_QUERY_LOADHOMEBIND,
PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS,
PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES,
PLAYER_LOGIN_QUERY_LOADGUILD,
PLAYER_LOGIN_QUERY_LOADARENAINFO,
PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS,
PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,
PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS,
PLAYER_LOGIN_QUERY_LOADBGDATA,
PLAYER_LOGIN_QUERY_LOADACCOUNTDATA,
PLAYER_LOGIN_QUERY_LOADSKILLS,
PLAYER_LOGIN_QUERY_LOADGLYPHS,
PLAYER_LOGIN_QUERY_LOADMAILS,
PLAYER_LOGIN_QUERY_LOADMAILEDITEMS,
PLAYER_LOGIN_QUERY_LOADTALENTS,
PLAYER_LOGIN_QUERY_LOADRANDOMBG,
PLAYER_LOGIN_QUERY_LOADWEEKLYQUESTSTATUS,
PLAYER_LOGIN_QUERY_LOADMONTHLYQUESTSTATUS,
MAX_PLAYER_LOGIN_QUERY
};
// Delayed operations for players
enum PlayerDelayedOperations
{
DELAYED_SAVE_PLAYER = 0x01,
DELAYED_RESURRECT_PLAYER = 0x02,
DELAYED_SPELL_CAST_DESERTER = 0x04,
DELAYED_BG_MOUNT_RESTORE = 0x08, ///< Flag to restore mount state after teleport from BG
DELAYED_BG_TAXI_RESTORE = 0x10, ///< Flag to restore taxi state after teleport from BG
DELAYED_END
};
// Sources of reputation
enum ReputationSource
{
REPUTATION_SOURCE_KILL, // Reputation from kills
REPUTATION_SOURCE_QUEST, // Reputation from quests
REPUTATION_SOURCE_SPELL // Reputation from spells
};
// Player summoning auto-decline time (in seconds)
#define MAX_PLAYER_SUMMON_DELAY (2*MINUTE)
#define MAX_MONEY_AMOUNT (0x7FFFFFFF-1) // Maximum money amount
// Structure to hold instance player bind information
struct InstancePlayerBind
{
DungeonPersistentState* state; // Pointer to the persistent state of the dungeon
bool perm; // Indicates if the bind is permanent
/* Permanent PlayerInstanceBinds are created in Raid/Heroic instances for players
that aren't already permanently bound when they are inside when a boss is killed
or when they enter an instance that the group leader is permanently bound to. */
InstancePlayerBind() : state(NULL), perm(false) {}
};
// Enum to represent player rest states
enum PlayerRestState
{
REST_STATE_RESTED = 0x01, // Player is rested
REST_STATE_NORMAL = 0x02, // Player is in a normal state
REST_STATE_RAF_LINKED = 0x04 // Exact use unknown
};
// Class to manage player taxi information
class PlayerTaxi
{
public:
PlayerTaxi();
~PlayerTaxi() {}
// Nodes
void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint32 level);
void LoadTaxiMask(const char* data);
// Check if a taxi node is known
bool IsTaximaskNodeKnown(uint32 nodeidx) const
{
uint8 field = uint8((nodeidx - 1) / 32);
uint32 submask = 1 << ((nodeidx - 1) % 32);
return (m_taximask[field] & submask) == submask;
}
// Set a taxi node as known
bool SetTaximaskNode(uint32 nodeidx)
{
uint8 field = uint8((nodeidx - 1) / 32);
uint32 submask = 1 << ((nodeidx - 1) % 32);
if ((m_taximask[field] & submask) != submask)
{
m_taximask[field] |= submask;
return true;
}
else
{
return false;
}
}
// Append taxi mask to data
void AppendTaximaskTo(ByteBuffer& data, bool all);
// Load taxi destinations from string
bool LoadTaxiDestinationsFromString(const std::string& values, Team team);
// Save taxi destinations to string
std::string SaveTaxiDestinationsToString();
// Clear taxi destinations
void ClearTaxiDestinations()
{
m_TaxiDestinations.clear();
}
// Add a taxi destination
void AddTaxiDestination(uint32 dest)
{
m_TaxiDestinations.push_back(dest);
}
// Get the source of the taxi
uint32 GetTaxiSource() const
{
return m_TaxiDestinations.empty() ? 0 : m_TaxiDestinations.front();
}
// Get the destination of the taxi
uint32 GetTaxiDestination() const
{
return m_TaxiDestinations.size() < 2 ? 0 : m_TaxiDestinations[1];
}
// Get the current taxi path
uint32 GetCurrentTaxiPath() const;