Skip to main content

tentacli_traits/types/
player.rs

1use std::fmt::Debug;
2use std::ops::{Index, IndexMut};
3
4use bitflags::bitflags;
5
6pub type EquipId = u32;
7
8pub enum EquipmentSlots {
9    HEAD = 0,
10    NECK = 1,
11    SHOULDERS = 2,
12    BODY = 3,
13    CHEST = 4,
14    WAIST = 5,
15    LEGS = 6,
16    FEET = 7,
17    WRISTS = 8,
18    HANDS = 9,
19    FINGER1 = 10,
20    FINGER2 = 11,
21    TRINKET1 = 12,
22    TRINKET2 = 13,
23    BACK = 14,
24    MAINHAND = 15,
25    OFFHAND = 16,
26    RANGED = 17,
27    TABARD = 18,
28    END = 19,
29}
30
31impl Index<EquipmentSlots> for Vec<EquipId> {
32    type Output = EquipId;
33    fn index(&self, index: EquipmentSlots) -> &Self::Output {
34        &self[index as usize]
35    }
36}
37
38impl IndexMut<EquipmentSlots> for Vec<EquipId> {
39    fn index_mut(&mut self, index: EquipmentSlots) -> &mut Self::Output {
40        &mut self[index as usize]
41    }
42}
43
44#[non_exhaustive]
45pub struct Gender;
46
47#[allow(dead_code)]
48impl Gender {
49    pub const GENDER_MALE: u8 = 0;
50    pub const GENDER_FEMALE: u8 = 1;
51    pub const GENDER_NONE: u8 = 2;
52}
53
54#[non_exhaustive]
55pub struct Race;
56
57#[allow(dead_code)]
58impl Race {
59    pub const HUMAN: u8 = 1;
60    pub const ORC: u8 = 2;
61    pub const DWARF: u8 = 3;
62    pub const NIGHTELF: u8 = 4;
63    pub const UNDEAD: u8 = 5;
64    pub const TAUREN: u8 = 6;
65    pub const GNOME: u8 = 7;
66    pub const TROLL: u8 = 8;
67    pub const GOBLIN: u8 = 9;
68    pub const BLOODELF: u8 = 10;
69    pub const DRAENEI: u8 = 11;
70    pub const FEL_ORC: u8 = 12;
71    pub const NAGA: u8 = 13;
72    pub const BROKEN: u8 = 14;
73    pub const SKELETON: u8 = 15;
74    pub const VRYKUL: u8 = 16;
75    pub const TUSKARR: u8 = 17;
76    pub const FOREST_TROLL: u8 = 18;
77    pub const TAUNKA: u8 = 19;
78    pub const NORTHREND_SKELETON: u8 = 20;
79    pub const ICE_TROLL: u8 = 21;
80}
81
82#[non_exhaustive]
83pub struct Class;
84
85#[allow(dead_code)]
86impl Class {
87    pub const WARRIOR: u8 = 1;
88    pub const PALADIN: u8 = 2;
89    pub const HUNTER: u8 = 3;
90    pub const ROGUE: u8 = 4;
91    pub const PRIEST: u8 = 5;
92    pub const DEATH_KNIGHT: u8 = 6;
93    pub const SHAMAN: u8 = 7;
94    pub const MAGE: u8 = 8;
95    pub const WARLOCK: u8 = 9;
96    pub const DRUID: u8 = 11;
97}
98
99bitflags! {
100    #[derive(Default, Clone, Debug, PartialEq)]
101    pub struct UnitFlags: u32 {
102        // Movement checks disabled; likely paired with loss of client control packet.
103        // We use it to add custom cliffwalking to GM mode until actual usecases will be known.
104        const UNK_0 = 0x00000001;
105        // not attackable
106        const SPAWNING = 0x00000002;
107        // Generic unspecified loss of control initiated by server script,
108        // movement checks disabled; paired with loss of client control packet.
109        const CLIENT_CONTROL_LOST = 0x00000004;
110        // players, pets, totems, guardians, companions, charms; any units associated with players
111        const PLAYER_CONTROLLED = 0x00000008;
112        const RENAME = 0x00000010;
113        // don't take reagents for spells with SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP
114        const PREPARATION = 0x00000020;
115        const UNK_6 = 0x00000040;
116        // ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE
117        const NOT_ATTACKABLE_1 = 0x00000080;
118        // Target is immune to players
119        const IMMUNE_TO_PLAYER = 0x00000100;
120        // Target is immune to Non-Player Characters
121        const IMMUNE_TO_NPC = 0x00000200;
122        // loot animation
123        const LOOTING = 0x00000400;
124        // in combat?; 2.0.8
125        const PET_IN_COMBAT = 0x00000800;
126        // changed in 3.0.3
127        const PVP_DEPRECATED = 0x00001000;
128        // silenced; 2.1.1
129        const SILENCED = 0x00002000;
130        // 2.0.8
131        const UNK_14 = 0x00004000;
132        // related to jerky movement in water?
133        const SWIMMING = 0x00008000;
134        // is not targetable by attack or spell
135        const UNTARGETABLE = 0x00010000;
136        // 3.0.3 ok
137        const PACIFIED = 0x00020000;
138        // Unit is a subject to stun; turn and strafe movement disabled
139        const STUNNED = 0x00040000;
140        const IN_COMBAT = 0x00080000;
141        // Unit is on taxi; paired with a duplicate loss of client control packet (likely a legacy serverside hack).
142        // Disables any spellcasts not allowed in taxi flight client-side.
143        const TAXI_FLIGHT = 0x00100000;
144        // 3.0.3, disable melee spells casting...; "Required melee weapon" added to melee spells tooltip.
145        const DISARMED = 0x00200000;
146        // Unit is a subject to confused movement, movement checks disabled; paired with loss of client control packet.
147        const CONFUSED = 0x00400000;
148        // Unit is a subject to fleeing movement, movement checks disabled; paired with loss of client control packet.
149        const FLEEING = 0x00800000;
150        // Unit is under remote control by another unit, movement checks disabled;
151        // paired with loss of client control packet. New master is allowed to use melee attack
152        // and can't select this unit via mouse in the world (as if it was own character).
153        const POSSESSED = 0x01000000;
154        const UNINTERACTIBLE = 0x02000000;
155        const SKINNABLE = 0x04000000;
156        const MOUNT = 0x08000000;
157        const UNK_28 = 0x10000000;
158        // used in Feing Death spell
159        const PREVENT_ANIM = 0x20000000;
160        const SHEATHE = 0x40000000;
161        const IMMUNE = 0x80000000;
162    }
163}
164
165bitflags! {
166    #[derive(Default, Clone, Debug, PartialEq)]
167    pub struct UnitFlags2: u32 {
168        const FEIGN_DEATH = 0x00000001;
169        // Hides body and body armor. Weapons and shoulder and head armor still visible
170        const HIDE_BODY = 0x00000002;
171        const IGNORE_REPUTATION = 0x00000004;
172        const COMPREHEND_LANG = 0x00000008;
173         // Used in SPELL_AURA_MIRROR_IMAGE
174        const CLONED = 0x00000010;
175        const DO_NOT_FADE_IN = 0x00000020;
176        const FORCE_MOVE = 0x00000040;
177        // also shield case
178        const DISARM_OFFHAND = 0x00000080;
179        const UNK8 = 0x00000100;
180        const UNK9 = 0x00000200;
181        const DISARM_RANGED = 0x00000400;
182        const REGENERATE_POWER = 0x00000800;
183        const SPELL_CLICK_IN_GROUP = 0x00001000;
184        const SPELL_CLICK_DISABLED = 0x00002000;
185        const INTERACT_ANY_REACTION = 0x00004000;
186        const UNK15 = 0x00008000;
187        const UNK16 = 0x00010000;
188        const ALLOW_CHEAT_SPELLS = 0x00040000;
189    }
190}
191
192bitflags! {
193    #[derive(Default, Clone, Debug, PartialEq)]
194    pub struct PlayerFlags: u32 {
195        const NONE = 0x00000000;
196        const GROUP_LEADER = 0x00000001;
197        const AFK = 0x00000002;
198        const DND = 0x00000004;
199        const GM = 0x00000008;
200        const GHOST = 0x00000010;
201        const RESTING = 0x00000020;
202        const UNK7 = 0x00000040;
203        // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
204        const UNK8 = 0x00000080;
205        // Player has been involved in a PvP combat and will be attacked by contested guards
206        const CONTESTED_PVP = 0x00000100;
207        // Stores player's permanent PvP flag preference
208        const PVP_DESIRED = 0x00000200;
209        const HIDE_HELM = 0x00000400;
210        const HIDE_CLOAK = 0x00000800;
211        // played long time
212        const PARTIAL_PLAY_TIME = 0x00001000;
213        // played too long time
214        const NO_PLAY_TIME = 0x00002000;
215        // Lua_IsOutOfBounds
216        const IS_OUT_OF_BOUNDS = 0x00004000;
217        // <Dev> chat tag; name prefix
218        const DEVELOPER = 0x00008000;
219        // triggers lua event EVENT_ENABLE_LOW_LEVEL_RAID
220        const ENABLE_LOW_LEVEL_RAID = 0x00010000;
221        // taxi benchmark mode (on/off) (2.0.1)
222        const TAXI_BENCHMARK = 0x00020000;
223        // 3.0.2; pvp timer active (after you disable pvp manually or leave pvp zones)
224        const PVP_TIMER = 0x00040000;
225        // first appeared in TBC
226        const COMMENTATOR = 0x00080000;
227        const UNK21 = 0x00100000;
228        const UNK22 = 0x00200000;
229        // something like COMMENTATOR_CAN_USE_INSTANCE_COMMAND
230        const COMMENTATOR_UBER = 0x00400000;
231        // EVENT_SPELL_UPDATE_USABLE and EVENT_UPDATE_SHAPESHIFT_USABLE; disabled all abilitys on tab except autoattack
232        const ALLOW_ONLY_ABILITY = 0x00800000;
233        // EVENT_SPELL_UPDATE_USABLE and EVENT_UPDATE_SHAPESHIFT_USABLE;
234        // disabled all melee ability on tab include autoattack
235        const UNK25 = 0x01000000;
236        const XP_USER_DISABLED = 0x02000000;
237    }
238}
239
240#[non_exhaustive]
241pub struct CharacterCreateResponseCode;
242
243#[allow(dead_code)]
244impl CharacterCreateResponseCode {
245    pub const CHAR_CREATE_IN_PROGRESS: u8 = 46;
246    pub const CHAR_CREATE_SUCCESS: u8 = 47;
247    pub const CHAR_CREATE_ERROR: u8 = 48;
248    pub const CHAR_CREATE_FAILED: u8 = 49;
249    pub const CHAR_CREATE_NAME_IN_USE: u8 = 50;
250    pub const CHAR_CREATE_DISABLED: u8 = 51;
251    pub const CHAR_CREATE_PVP_TEAMS_VIOLATION: u8 = 52;
252    pub const CHAR_CREATE_SERVER_LIMIT: u8 = 53;
253    pub const CHAR_CREATE_ACCOUNT_LIMIT: u8 = 54;
254    pub const CHAR_CREATE_SERVER_QUEUE: u8 = 55;
255    pub const CHAR_CREATE_ONLY_EXISTING: u8 = 56;
256    pub const CHAR_CREATE_EXPANSION: u8 = 57;
257    pub const CHAR_CREATE_EXPANSION_CLASS: u8 = 58;
258    pub const CHAR_CREATE_LEVEL_REQUIREMENT: u8 = 59;
259    pub const CHAR_CREATE_UNIQUE_CLASS_LIMIT: u8 = 60;
260    pub const CHAR_CREATE_CHARACTER_IN_GUILD: u8 = 61;
261    pub const CHAR_CREATE_RESTRICTED_RACECLASS: u8 = 62;
262    pub const CHAR_CREATE_CHARACTER_CHOOSE_RACE: u8 = 63;
263    pub const CHAR_CREATE_CHARACTER_ARENA_LEADER: u8 = 64;
264    pub const CHAR_CREATE_CHARACTER_DELETE_MAIL: u8 = 65;
265    pub const CHAR_CREATE_CHARACTER_SWAP_FACTION: u8 = 66;
266    pub const CHAR_CREATE_CHARACTER_RACE_ONLY: u8 = 67;
267    pub const CHAR_CREATE_CHARACTER_GOLD_LIMIT: u8 = 68;
268    pub const CHAR_CREATE_FORCE_LOGIN: u8 = 69;
269}