1use crate::{AddonApi, GameBindApi};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8#[cfg_attr(
9 feature = "strum",
10 derive(
11 strum::AsRefStr,
12 strum::Display,
13 strum::EnumCount,
14 strum::EnumIter,
15 strum::IntoStaticStr,
16 strum::VariantArray,
17 strum::VariantNames
18 )
19)]
20#[repr(C)]
21pub enum GameBind {
22 MoveForward = 0,
24 MoveBackward = 1,
25 MoveLeft = 2,
26 MoveRight = 3,
27 MoveTurnLeft = 4,
28 MoveTurnRight = 5,
29 MoveDodge = 6,
30 MoveAutoRun = 7,
31 MoveWalk = 8,
32 MoveJump = 9,
33 MoveSwimUp = 10,
34 MoveSwimDown = 11,
35 MoveAboutFace = 12,
36
37 SkillWeaponSwap = 17,
39 SkillWeapon1 = 18,
40 SkillWeapon2 = 19,
41 SkillWeapon3 = 20,
42 SkillWeapon4 = 21,
43 SkillWeapon5 = 22,
44 SkillHeal = 23,
45 SkillUtility1 = 24,
46 SkillUtility2 = 25,
47 SkillUtility3 = 26,
48 SkillElite = 27,
49 SkillProfession1 = 28,
50 SkillProfession2 = 29,
51 SkillProfession3 = 30,
52 SkillProfession4 = 31,
53 SkillProfession5 = 79,
54 SkillProfession6 = 201,
55 SkillProfession7 = 202,
56 SkillSpecialAction = 82,
57
58 TargetAlert = 131,
60 TargetCall = 32,
61 TargetTake = 33,
62 TargetCallLocal = 199,
63 TargetTakeLocal = 200,
64 TargetEnemyNearest = 34,
65 TargetEnemyNext = 35,
66 TargetEnemyPrev = 36,
67 TargetAllyNearest = 37,
68 TargetAllyNext = 38,
69 TargetAllyPrev = 39,
70 TargetLock = 40,
71 TargetSnapGroundTarget = 80,
72 TargetSnapGroundTargetToggle = 115,
73 TargetAutoTargetingDisable = 116,
74 TargetAutoTargetingToggle = 117,
75 TargetAllyTargetingMode = 197,
76 TargetAllyTargetingModeToggle = 198,
77
78 UiTradingPost = 41,
80 UiContacts = 42,
81 UiGuild = 43,
82 UiHero = 44,
83 UiInventory = 45,
84 UiPets = 46,
85 UiLogout = 47,
86 UiMail = 71,
87 UiOptions = 48,
88 UiParty = 49,
89 UiPvp = 73,
90 UiPvpBuild = 75,
91 UiScoreboard = 50,
92 UiWizardsVault = 209,
93 UiInformation = 51,
94 UiChatToggle = 70,
95 UiChatCommand = 52,
96 UiChatFocus = 53,
97 UiChatReply = 54,
98 UiToggle = 55,
99 UiSquadBroadcastChatToggle = 85,
100 UiSquadBroadcastChatCommand = 83,
101 UiSquadBroadcastChatFocus = 84,
102
103 CameraFree = 13,
105 CameraZoomIn = 14,
106 CameraZoomOut = 15,
107 CameraReverse = 16,
108 CameraActionMode = 78,
109 CameraActionModeDisable = 114,
110
111 ScreenshotNormal = 56,
113 ScreenshotStereoscopic = 57,
114
115 MapToggle = 59,
117 MapFocusPlayer = 60,
118 MapFloorDown = 61,
119 MapFloorUp = 62,
120 MapZoomIn = 63,
121 MapZoomOut = 64,
122
123 MountToggle = 152,
125 MountMovement = 130,
126 MountSecondaryMovement = 153,
127 MountRaptor = 155,
128 MountSpringer = 156,
129 MountSkimmer = 157,
130 MountJackal = 158,
131 MountGriffon = 159,
132 MountRollerBeetle = 161,
133 MountWarclaw = 169,
134 MountSkyscale = 170,
135 MountSiegeTurtle = 203,
136
137 SpectatorNearestFixed = 102,
139 SpectatorNearestPlayer = 103,
140 SpectatorPlayerRed1 = 104,
141 SpectatorPlayerRed2 = 105,
142 SpectatorPlayerRed3 = 106,
143 SpectatorPlayerRed4 = 107,
144 SpectatorPlayerRed5 = 108,
145 SpectatorPlayerBlue1 = 109,
146 SpectatorPlayerBlue2 = 110,
147 SpectatorPlayerBlue3 = 111,
148 SpectatorPlayerBlue4 = 112,
149 SpectatorPlayerBlue5 = 113,
150 SpectatorFreeCamera = 120,
151 SpectatorFreeCameraMode = 127,
152 SpectatorFreeMoveForward = 121,
153 SpectatorFreeMoveBackward = 122,
154 SpectatorFreeMoveLeft = 123,
155 SpectatorFreeMoveRight = 124,
156 SpectatorFreeMoveUp = 125,
157 SpectatorFreeMoveDown = 126,
158
159 SquadMarkerPlaceWorldArrow = 86,
161 SquadMarkerPlaceWorldCircle = 87,
162 SquadMarkerPlaceWorldHeart = 88,
163 SquadMarkerPlaceWorldSquare = 89,
164 SquadMarkerPlaceWorldStar = 90,
165 SquadMarkerPlaceWorldSwirl = 91,
166 SquadMarkerPlaceWorldTriangle = 92,
167 SquadMarkerPlaceWorldCross = 93,
168 SquadMarkerClearAllWorld = 119,
169 SquadMarkerSetAgentArrow = 94,
170 SquadMarkerSetAgentCircle = 95,
171 SquadMarkerSetAgentHeart = 96,
172 SquadMarkerSetAgentSquare = 97,
173 SquadMarkerSetAgentStar = 98,
174 SquadMarkerSetAgentSwirl = 99,
175 SquadMarkerSetAgentTriangle = 100,
176 SquadMarkerSetAgentCross = 101,
177 SquadMarkerClearAllAgent = 118,
178
179 MasteryAccess = 196,
181 MasteryAccessFishing = 204,
182 MasteryAccessSkiff = 205,
183 MasteryAccessJadeBotWaypoint = 206,
184 MasteryAccessRiftScan = 207,
185 MasteryAccessSkyscale = 208,
186 MasteryAccessHomesteadDoorway = 211,
187
188 MiscAoELoot = 74,
190 MiscInteract = 65,
191 MiscShowEnemies = 66,
192 MiscShowAllies = 67,
193 MiscStowDrawWeapon = 68,
194 MiscToggleLanguage = 69,
195 MiscTogglePetCombat = 76,
196 MiscToggleFullScreen = 160,
197 MiscToggleDecorationMode = 210,
198
199 ToyUseDefault = 162,
201 ToyUseSlotChair = 163,
202 ToyUseSlotInstrument = 164,
203 ToyUseSlotHeltItem = 165,
204 ToyUseSlotToy = 166,
205 ToyUseSlotTonic = 167,
206
207 Loadout1 = 171,
209 Loadout2 = 172,
210 Loadout3 = 173,
211 Loadout4 = 174,
212 Loadout5 = 175,
213 Loadout6 = 176,
214 Loadout7 = 177,
215 Loadout8 = 178,
216 Loadout9 = 179,
217
218 GearLoadout1 = 182,
220 GearLoadout2 = 183,
221 GearLoadout3 = 184,
222 GearLoadout4 = 185,
223 GearLoadout5 = 186,
224 GearLoadout6 = 187,
225 GearLoadout7 = 188,
226 GearLoadout8 = 189,
227 GearLoadout9 = 190,
228}
229
230pub type RawGamebindPressAsync = unsafe extern "C-unwind" fn(game_bind: GameBind);
231
232pub type RawGamebindReleaseAsync = unsafe extern "C-unwind" fn(game_bind: GameBind);
233
234pub type RawGamebindInvokeAsync = unsafe extern "C-unwind" fn(game_bind: GameBind, duration: i32);
235
236pub type RawGamebindPress = unsafe extern "C-unwind" fn(game_bind: GameBind);
237
238pub type RawGamebindRelease = unsafe extern "C-unwind" fn(game_bind: GameBind);
239
240pub type RawGamebindIsBound = unsafe extern "C-unwind" fn(game_bind: GameBind) -> bool;
241
242#[inline]
244pub fn press_gamebind_async(bind: GameBind) {
245 let GameBindApi { press_async, .. } = AddonApi::get().game_bind;
246 unsafe { press_async(bind) }
247}
248
249#[inline]
251pub fn release_gamebind_async(bind: GameBind) {
252 let GameBindApi { release_async, .. } = AddonApi::get().game_bind;
253 unsafe { release_async(bind) }
254}
255
256#[inline]
258pub fn invoke_gamebind_async(bind: GameBind, duration: i32) {
259 let GameBindApi { invoke_async, .. } = AddonApi::get().game_bind;
260 unsafe { invoke_async(bind, duration) }
261}
262
263#[inline]
265pub fn press_gamebind(bind: GameBind) {
266 let GameBindApi { press, .. } = AddonApi::get().game_bind;
267 unsafe { press(bind) }
268}
269
270#[inline]
272pub fn release_gamebind(bind: GameBind) {
273 let GameBindApi { release, .. } = AddonApi::get().game_bind;
274 unsafe { release(bind) }
275}
276
277#[inline]
279pub fn is_gamebind_bound(bind: GameBind) -> bool {
280 let GameBindApi { is_bound, .. } = AddonApi::get().game_bind;
281 unsafe { is_bound(bind) }
282}