wow_world_base 0.3.0

Base definitions and functions for World of Warcraft game servers
Documentation
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
/// Auto generated from the original `wowm` in file [`wow_message_parser/wowm/world/spell/smsg_cast_result.wowm:8`](https://github.com/gtker/wow_messages/tree/main/wow_message_parser/wowm/world/spell/smsg_cast_result.wowm#L8):
/// ```text
/// enum CastFailureReason : u8 {
///     AFFECTING_COMBAT = 0x00;
///     ALREADY_AT_FULL_HEALTH = 0x01;
///     ALREADY_AT_FULL_POWER = 0x02;
///     ALREADY_BEING_TAMED = 0x03;
///     ALREADY_HAVE_CHARM = 0x04;
///     ALREADY_HAVE_SUMMON = 0x05;
///     ALREADY_OPEN = 0x06;
///     AURA_BOUNCED = 0x07;
///     AUTOTRACK_INTERRUPTED = 0x08;
///     BAD_IMPLICIT_TARGETS = 0x09;
///     BAD_TARGETS = 0x0a;
///     CANT_BE_CHARMED = 0x0b;
///     CANT_BE_DISENCHANTED = 0x0c;
///     CANT_BE_PROSPECTED = 0x0d;
///     CANT_CAST_ON_TAPPED = 0x0e;
///     CANT_DUEL_WHILE_INVISIBLE = 0x0f;
///     CANT_DUEL_WHILE_STEALTHED = 0x10;
///     CANT_STEALTH = 0x11;
///     CASTER_AURASTATE = 0x12;
///     CASTER_DEAD = 0x13;
///     CHARMED = 0x14;
///     CHEST_IN_USE = 0x15;
///     CONFUSED = 0x16;
///     DONT_REPORT = 0x17;
///     EQUIPPED_ITEM = 0x18;
///     EQUIPPED_ITEM_CLASS = 0x19;
///     EQUIPPED_ITEM_CLASS_MAINHAND = 0x1a;
///     EQUIPPED_ITEM_CLASS_OFFHAND = 0x1b;
///     ERROR = 0x1c;
///     FIZZLE = 0x1d;
///     FLEEING = 0x1e;
///     FOOD_LOWLEVEL = 0x1f;
///     HIGHLEVEL = 0x20;
///     HUNGER_SATIATED = 0x21;
///     IMMUNE = 0x22;
///     INTERRUPTED = 0x23;
///     INTERRUPTED_COMBAT = 0x24;
///     ITEM_ALREADY_ENCHANTED = 0x25;
///     ITEM_GONE = 0x26;
///     ITEM_NOT_FOUND = 0x27;
///     ITEM_NOT_READY = 0x28;
///     LEVEL_REQUIREMENT = 0x29;
///     LINE_OF_SIGHT = 0x2a;
///     LOWLEVEL = 0x2b;
///     LOW_CASTLEVEL = 0x2c;
///     MAINHAND_EMPTY = 0x2d;
///     MOVING = 0x2e;
///     NEED_AMMO = 0x2f;
///     NEED_AMMO_POUCH = 0x30;
///     NEED_EXOTIC_AMMO = 0x31;
///     NOPATH = 0x32;
///     NOT_BEHIND = 0x33;
///     NOT_FISHABLE = 0x34;
///     NOT_HERE = 0x35;
///     NOT_INFRONT = 0x36;
///     NOT_IN_CONTROL = 0x37;
///     NOT_KNOWN = 0x38;
///     NOT_MOUNTED = 0x39;
///     NOT_ON_TAXI = 0x3a;
///     NOT_ON_TRANSPORT = 0x3b;
///     NOT_READY = 0x3c;
///     NOT_SHAPESHIFT = 0x3d;
///     NOT_STANDING = 0x3e;
///     NOT_TRADEABLE = 0x3f;
///     NOT_TRADING = 0x40;
///     NOT_UNSHEATHED = 0x41;
///     NOT_WHILE_GHOST = 0x42;
///     NO_AMMO = 0x43;
///     NO_CHARGES_REMAIN = 0x44;
///     NO_CHAMPION = 0x45;
///     NO_COMBO_POINTS = 0x46;
///     NO_DUELING = 0x47;
///     NO_ENDURANCE = 0x48;
///     NO_FISH = 0x49;
///     NO_ITEMS_WHILE_SHAPESHIFTED = 0x4a;
///     NO_MOUNTS_ALLOWED = 0x4b;
///     NO_PET = 0x4c;
///     NO_POWER = 0x4d;
///     NOTHING_TO_DISPEL = 0x4e;
///     NOTHING_TO_STEAL = 0x4f;
///     ONLY_ABOVEWATER = 0x50;
///     ONLY_DAYTIME = 0x51;
///     ONLY_INDOORS = 0x52;
///     ONLY_MOUNTED = 0x53;
///     ONLY_NIGHTTIME = 0x54;
///     ONLY_OUTDOORS = 0x55;
///     ONLY_SHAPESHIFT = 0x56;
///     ONLY_STEALTHED = 0x57;
///     ONLY_UNDERWATER = 0x58;
///     OUT_OF_RANGE = 0x59;
///     PACIFIED = 0x5a;
///     POSSESSED = 0x5b;
///     REAGENTS = 0x5c;
///     REQUIRES_AREA = 0x5d;
///     REQUIRES_SPELL_FOCUS = 0x5e;
///     ROOTED = 0x5f;
///     SILENCED = 0x60;
///     SPELL_IN_PROGRESS = 0x61;
///     SPELL_LEARNED = 0x62;
///     SPELL_UNAVAILABLE = 0x63;
///     STUNNED = 0x64;
///     TARGETS_DEAD = 0x65;
///     TARGET_AFFECTING_COMBAT = 0x66;
///     TARGET_AURASTATE = 0x67;
///     TARGET_DUELING = 0x68;
///     TARGET_ENEMY = 0x69;
///     TARGET_ENRAGED = 0x6a;
///     TARGET_FRIENDLY = 0x6b;
///     TARGET_IN_COMBAT = 0x6c;
///     TARGET_IS_PLAYER = 0x6d;
///     TARGET_NOT_DEAD = 0x6e;
///     TARGET_NOT_IN_PARTY = 0x6f;
///     TARGET_NOT_LOOTED = 0x70;
///     TARGET_NOT_PLAYER = 0x71;
///     TARGET_NO_POCKETS = 0x72;
///     TARGET_NO_WEAPONS = 0x73;
///     TARGET_UNSKINNABLE = 0x74;
///     THIRST_SATIATED = 0x75;
///     TOO_CLOSE = 0x76;
///     TOO_MANY_OF_ITEM = 0x77;
///     TOTEMS = 0x78;
///     TRAINING_POINTS = 0x79;
///     TRY_AGAIN = 0x7a;
///     UNIT_NOT_BEHIND = 0x7b;
///     UNIT_NOT_INFRONT = 0x7c;
///     WRONG_PET_FOOD = 0x7d;
///     NOT_WHILE_FATIGUED = 0x7e;
///     TARGET_NOT_IN_INSTANCE = 0x7f;
///     NOT_WHILE_TRADING = 0x80;
///     TARGET_NOT_IN_RAID = 0x81;
///     DISENCHANT_WHILE_LOOTING = 0x82;
///     PROSPECT_WHILE_LOOTING = 0x83;
///     PROSPECT_NEED_MORE = 0x84;
///     TARGET_FREEFORALL = 0x85;
///     NO_EDIBLE_CORPSES = 0x86;
///     ONLY_BATTLEGROUNDS = 0x87;
///     TARGET_NOT_GHOST = 0x88;
///     TOO_MANY_SKILLS = 0x89;
///     TRANSFORM_UNUSABLE = 0x8a;
///     WRONG_WEATHER = 0x8b;
///     DAMAGE_IMMUNE = 0x8c;
///     PREVENTED_BY_MECHANIC = 0x8d;
///     PLAY_TIME = 0x8e;
///     REPUTATION = 0x8f;
///     MIN_SKILL = 0x90;
///     UNKNOWN = 0x91;
/// }
/// ```
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum CastFailureReason {
    /// You are in combat
    AffectingCombat,
    /// You are already at full Health.
    AlreadyAtFullHealth,
    /// You are already at full %s.
    AlreadyAtFullPower,
    /// That creature is already being tamed
    AlreadyBeingTamed,
    /// You already control a charmed creature
    AlreadyHaveCharm,
    /// You already control a summoned creature
    AlreadyHaveSummon,
    /// Already open
    AlreadyOpen,
    /// A more powerful spell is already active
    AuraBounced,
    /// Message is hidden/unused
    AutotrackInterrupted,
    /// You have no target.
    BadImplicitTargets,
    /// Invalid target
    BadTargets,
    /// Target can't be charmed
    CantBeCharmed,
    /// Item cannot be disenchanted
    CantBeDisenchanted,
    /// There are no gems in this
    CantBeProspected,
    /// Target is tapped
    CantCastOnTapped,
    /// You can't start a duel while invisible
    CantDuelWhileInvisible,
    /// You can't start a duel while stealthed
    CantDuelWhileStealthed,
    /// You are too close to enemies
    CantStealth,
    /// You can't do that yet
    CasterAurastate,
    /// You are dead
    CasterDead,
    /// Can't do that while charmed
    Charmed,
    /// That is already being used
    ChestInUse,
    /// Can't do that while confused
    Confused,
    /// Message is hidden/unused
    DontReport,
    /// Must have the proper item equipped
    EquippedItem,
    /// Must have a %s equipped
    EquippedItemClass,
    /// Must have a %s equipped in the main hand
    EquippedItemClassMainhand,
    /// Must have a %s equipped in the offhand
    EquippedItemClassOffhand,
    /// Internal error
    ErrorX,
    /// Fizzled
    Fizzle,
    /// Can't do that while fleeing
    Fleeing,
    /// That food's level is not high enough for your pet
    FoodLowlevel,
    /// Target is too high level
    Highlevel,
    /// Message is hidden/unused
    HungerSatiated,
    /// Immune
    Immune,
    /// Interrupted
    Interrupted,
    /// Interrupted
    InterruptedCombat,
    /// Item is already enchanted
    ItemAlreadyEnchanted,
    /// Item is gone
    ItemGone,
    /// Tried to enchant an item that didn't exist
    ItemNotFound,
    /// Item is not ready yet.
    ItemNotReady,
    /// You are not high enough level
    LevelRequirement,
    /// Target not in line of sight
    LineOfSight,
    /// Target is too low level
    Lowlevel,
    /// Skill not high enough
    LowCastlevel,
    /// Your weapon hand is empty
    MainhandEmpty,
    /// Can't do that while moving
    Moving,
    /// Ammo needs to be in the paper doll ammo slot before it can be fired
    NeedAmmo,
    /// Requires: %s
    NeedAmmoPouch,
    /// Requires exotic ammo: %s
    NeedExoticAmmo,
    /// No path available
    Nopath,
    /// You must be behind your target
    NotBehind,
    /// Your cast didn't land in fishable water
    NotFishable,
    /// You can't use that here
    NotHere,
    /// You must be in front of your target
    NotInfront,
    /// You are not in control of your actions
    NotInControl,
    /// Spell not learned
    NotKnown,
    /// You are mounted
    NotMounted,
    /// You are in flight
    NotOnTaxi,
    /// You are on a transport
    NotOnTransport,
    /// Spell is not ready yet.
    NotReady,
    /// You are in shapeshift form
    NotShapeshift,
    /// You must be standing to do that
    NotStanding,
    /// You can only use this on an object you own
    NotTradeable,
    /// Tried to enchant a trade item, but not trading
    NotTrading,
    /// You have to be unsheathed to do that!
    NotUnsheathed,
    /// Can't cast as ghost
    NotWhileGhost,
    /// Out of ammo
    NoAmmo,
    /// No charges remain
    NoChargesRemain,
    /// You haven't selected a champion
    NoChampion,
    /// That ability requires combo points
    NoComboPoints,
    /// Dueling isn't allowed here
    NoDueling,
    /// Not enough endurance
    NoEndurance,
    /// There aren't any fish here
    NoFish,
    /// Can't use items while shapeshifted
    NoItemsWhileShapeshifted,
    /// You can't mount here
    NoMountsAllowed,
    /// You do not have a pet
    NoPet,
    /// Dynamic pre-defined messages, no args: Not enough mana, Not enough rage, etc
    NoPower,
    /// Nothing to dispel
    NothingToDispel,
    /// Nothing to steal
    NothingToSteal,
    /// Cannot use while swimming
    OnlyAbovewater,
    /// Can only use during the day
    OnlyDaytime,
    /// Can only use indoors
    OnlyIndoors,
    /// Can only use while mounted
    OnlyMounted,
    /// Can only use during the night
    OnlyNighttime,
    /// Can only use outside
    OnlyOutdoors,
    /// Must be in %s
    OnlyShapeshift,
    /// You must be in stealth mode
    OnlyStealthed,
    /// Can only use while swimming
    OnlyUnderwater,
    /// Out of range.
    OutOfRange,
    /// Can't use that ability while pacified
    Pacified,
    /// You are possessed
    Possessed,
    /// Message is hidden/unused, supposedly implemented client-side only
    Reagents,
    /// You need to be in %s
    RequiresArea,
    /// Requires %s
    RequiresSpellFocus,
    /// You are unable to move
    Rooted,
    /// Can't do that while silenced
    Silenced,
    /// Another action is in progress
    SpellInProgress,
    /// You have already learned the spell
    SpellLearned,
    /// The spell is not available to you
    SpellUnavailable,
    /// Can't do that while stunned
    Stunned,
    /// Your target is dead
    TargetsDead,
    /// Target is in combat
    TargetAffectingCombat,
    /// You can't do that yet
    TargetAurastate,
    /// Target is currently dueling
    TargetDueling,
    /// Target is hostile
    TargetEnemy,
    /// Target is too enraged to be charmed
    TargetEnraged,
    /// Target is friendly
    TargetFriendly,
    /// The target can't be in combat
    TargetInCombat,
    /// Can't target players
    TargetIsPlayer,
    /// Target is alive
    TargetNotDead,
    /// Target is not in your party
    TargetNotInParty,
    /// Creature must be looted first
    TargetNotLooted,
    /// Target is not a player
    TargetNotPlayer,
    /// No pockets to pick
    TargetNoPockets,
    /// Target has no weapons equipped
    TargetNoWeapons,
    /// Creature is not skinnable
    TargetUnskinnable,
    /// Message is hidden/unused
    ThirstSatiated,
    /// Target too close
    TooClose,
    /// You have too many of that item already
    TooManyOfItem,
    /// Message is hidden/unused, supposedly implemented client-side only
    Totems,
    /// Not enough training points
    TrainingPoints,
    /// Failed attempt
    TryAgain,
    /// Target needs to be behind you
    UnitNotBehind,
    /// Target needs to be in front of you
    UnitNotInfront,
    /// Your pet doesn't like that food
    WrongPetFood,
    /// Can't cast while fatigued
    NotWhileFatigued,
    /// Target must be in this instance
    TargetNotInInstance,
    /// Can't cast while trading
    NotWhileTrading,
    /// Target is not in your party or raid group
    TargetNotInRaid,
    /// Cannot disenchant while looting
    DisenchantWhileLooting,
    /// Cannot prospect while looting
    ProspectWhileLooting,
    /// Message is hidden/unused, supposedly implemented client-side only
    ProspectNeedMore,
    /// Target is currently in free-for-all PvP combat
    TargetFreeforall,
    /// There are no nearby corpses to eat
    NoEdibleCorpses,
    /// Can only use in battlegrounds
    OnlyBattlegrounds,
    /// Target is not a ghost
    TargetNotGhost,
    /// Your pet can't learn any more skills
    TooManySkills,
    /// You can't use the new item
    TransformUnusable,
    /// The weather isn't right for that
    WrongWeather,
    /// You can't do that while you are immune
    DamageImmune,
    /// Can't do that while %s
    PreventedByMechanic,
    /// Maximum play time exceeded
    PlayTime,
    /// Your reputation isn't high enough
    Reputation,
    /// Your skill is not high enough.  Requires %s (%d).
    MinSkill,
    /// Generic out of bounds response:  Unknown reason
    Unknown,
}

impl CastFailureReason {
    pub const fn as_int(&self) -> u8 {
        match self {
            Self::AffectingCombat => 0x0,
            Self::AlreadyAtFullHealth => 0x1,
            Self::AlreadyAtFullPower => 0x2,
            Self::AlreadyBeingTamed => 0x3,
            Self::AlreadyHaveCharm => 0x4,
            Self::AlreadyHaveSummon => 0x5,
            Self::AlreadyOpen => 0x6,
            Self::AuraBounced => 0x7,
            Self::AutotrackInterrupted => 0x8,
            Self::BadImplicitTargets => 0x9,
            Self::BadTargets => 0xa,
            Self::CantBeCharmed => 0xb,
            Self::CantBeDisenchanted => 0xc,
            Self::CantBeProspected => 0xd,
            Self::CantCastOnTapped => 0xe,
            Self::CantDuelWhileInvisible => 0xf,
            Self::CantDuelWhileStealthed => 0x10,
            Self::CantStealth => 0x11,
            Self::CasterAurastate => 0x12,
            Self::CasterDead => 0x13,
            Self::Charmed => 0x14,
            Self::ChestInUse => 0x15,
            Self::Confused => 0x16,
            Self::DontReport => 0x17,
            Self::EquippedItem => 0x18,
            Self::EquippedItemClass => 0x19,
            Self::EquippedItemClassMainhand => 0x1a,
            Self::EquippedItemClassOffhand => 0x1b,
            Self::ErrorX => 0x1c,
            Self::Fizzle => 0x1d,
            Self::Fleeing => 0x1e,
            Self::FoodLowlevel => 0x1f,
            Self::Highlevel => 0x20,
            Self::HungerSatiated => 0x21,
            Self::Immune => 0x22,
            Self::Interrupted => 0x23,
            Self::InterruptedCombat => 0x24,
            Self::ItemAlreadyEnchanted => 0x25,
            Self::ItemGone => 0x26,
            Self::ItemNotFound => 0x27,
            Self::ItemNotReady => 0x28,
            Self::LevelRequirement => 0x29,
            Self::LineOfSight => 0x2a,
            Self::Lowlevel => 0x2b,
            Self::LowCastlevel => 0x2c,
            Self::MainhandEmpty => 0x2d,
            Self::Moving => 0x2e,
            Self::NeedAmmo => 0x2f,
            Self::NeedAmmoPouch => 0x30,
            Self::NeedExoticAmmo => 0x31,
            Self::Nopath => 0x32,
            Self::NotBehind => 0x33,
            Self::NotFishable => 0x34,
            Self::NotHere => 0x35,
            Self::NotInfront => 0x36,
            Self::NotInControl => 0x37,
            Self::NotKnown => 0x38,
            Self::NotMounted => 0x39,
            Self::NotOnTaxi => 0x3a,
            Self::NotOnTransport => 0x3b,
            Self::NotReady => 0x3c,
            Self::NotShapeshift => 0x3d,
            Self::NotStanding => 0x3e,
            Self::NotTradeable => 0x3f,
            Self::NotTrading => 0x40,
            Self::NotUnsheathed => 0x41,
            Self::NotWhileGhost => 0x42,
            Self::NoAmmo => 0x43,
            Self::NoChargesRemain => 0x44,
            Self::NoChampion => 0x45,
            Self::NoComboPoints => 0x46,
            Self::NoDueling => 0x47,
            Self::NoEndurance => 0x48,
            Self::NoFish => 0x49,
            Self::NoItemsWhileShapeshifted => 0x4a,
            Self::NoMountsAllowed => 0x4b,
            Self::NoPet => 0x4c,
            Self::NoPower => 0x4d,
            Self::NothingToDispel => 0x4e,
            Self::NothingToSteal => 0x4f,
            Self::OnlyAbovewater => 0x50,
            Self::OnlyDaytime => 0x51,
            Self::OnlyIndoors => 0x52,
            Self::OnlyMounted => 0x53,
            Self::OnlyNighttime => 0x54,
            Self::OnlyOutdoors => 0x55,
            Self::OnlyShapeshift => 0x56,
            Self::OnlyStealthed => 0x57,
            Self::OnlyUnderwater => 0x58,
            Self::OutOfRange => 0x59,
            Self::Pacified => 0x5a,
            Self::Possessed => 0x5b,
            Self::Reagents => 0x5c,
            Self::RequiresArea => 0x5d,
            Self::RequiresSpellFocus => 0x5e,
            Self::Rooted => 0x5f,
            Self::Silenced => 0x60,
            Self::SpellInProgress => 0x61,
            Self::SpellLearned => 0x62,
            Self::SpellUnavailable => 0x63,
            Self::Stunned => 0x64,
            Self::TargetsDead => 0x65,
            Self::TargetAffectingCombat => 0x66,
            Self::TargetAurastate => 0x67,
            Self::TargetDueling => 0x68,
            Self::TargetEnemy => 0x69,
            Self::TargetEnraged => 0x6a,
            Self::TargetFriendly => 0x6b,
            Self::TargetInCombat => 0x6c,
            Self::TargetIsPlayer => 0x6d,
            Self::TargetNotDead => 0x6e,
            Self::TargetNotInParty => 0x6f,
            Self::TargetNotLooted => 0x70,
            Self::TargetNotPlayer => 0x71,
            Self::TargetNoPockets => 0x72,
            Self::TargetNoWeapons => 0x73,
            Self::TargetUnskinnable => 0x74,
            Self::ThirstSatiated => 0x75,
            Self::TooClose => 0x76,
            Self::TooManyOfItem => 0x77,
            Self::Totems => 0x78,
            Self::TrainingPoints => 0x79,
            Self::TryAgain => 0x7a,
            Self::UnitNotBehind => 0x7b,
            Self::UnitNotInfront => 0x7c,
            Self::WrongPetFood => 0x7d,
            Self::NotWhileFatigued => 0x7e,
            Self::TargetNotInInstance => 0x7f,
            Self::NotWhileTrading => 0x80,
            Self::TargetNotInRaid => 0x81,
            Self::DisenchantWhileLooting => 0x82,
            Self::ProspectWhileLooting => 0x83,
            Self::ProspectNeedMore => 0x84,
            Self::TargetFreeforall => 0x85,
            Self::NoEdibleCorpses => 0x86,
            Self::OnlyBattlegrounds => 0x87,
            Self::TargetNotGhost => 0x88,
            Self::TooManySkills => 0x89,
            Self::TransformUnusable => 0x8a,
            Self::WrongWeather => 0x8b,
            Self::DamageImmune => 0x8c,
            Self::PreventedByMechanic => 0x8d,
            Self::PlayTime => 0x8e,
            Self::Reputation => 0x8f,
            Self::MinSkill => 0x90,
            Self::Unknown => 0x91,
        }
    }

    pub const fn variants() -> [Self; 146] {
        [
            Self::AffectingCombat,
            Self::AlreadyAtFullHealth,
            Self::AlreadyAtFullPower,
            Self::AlreadyBeingTamed,
            Self::AlreadyHaveCharm,
            Self::AlreadyHaveSummon,
            Self::AlreadyOpen,
            Self::AuraBounced,
            Self::AutotrackInterrupted,
            Self::BadImplicitTargets,
            Self::BadTargets,
            Self::CantBeCharmed,
            Self::CantBeDisenchanted,
            Self::CantBeProspected,
            Self::CantCastOnTapped,
            Self::CantDuelWhileInvisible,
            Self::CantDuelWhileStealthed,
            Self::CantStealth,
            Self::CasterAurastate,
            Self::CasterDead,
            Self::Charmed,
            Self::ChestInUse,
            Self::Confused,
            Self::DontReport,
            Self::EquippedItem,
            Self::EquippedItemClass,
            Self::EquippedItemClassMainhand,
            Self::EquippedItemClassOffhand,
            Self::ErrorX,
            Self::Fizzle,
            Self::Fleeing,
            Self::FoodLowlevel,
            Self::Highlevel,
            Self::HungerSatiated,
            Self::Immune,
            Self::Interrupted,
            Self::InterruptedCombat,
            Self::ItemAlreadyEnchanted,
            Self::ItemGone,
            Self::ItemNotFound,
            Self::ItemNotReady,
            Self::LevelRequirement,
            Self::LineOfSight,
            Self::Lowlevel,
            Self::LowCastlevel,
            Self::MainhandEmpty,
            Self::Moving,
            Self::NeedAmmo,
            Self::NeedAmmoPouch,
            Self::NeedExoticAmmo,
            Self::Nopath,
            Self::NotBehind,
            Self::NotFishable,
            Self::NotHere,
            Self::NotInfront,
            Self::NotInControl,
            Self::NotKnown,
            Self::NotMounted,
            Self::NotOnTaxi,
            Self::NotOnTransport,
            Self::NotReady,
            Self::NotShapeshift,
            Self::NotStanding,
            Self::NotTradeable,
            Self::NotTrading,
            Self::NotUnsheathed,
            Self::NotWhileGhost,
            Self::NoAmmo,
            Self::NoChargesRemain,
            Self::NoChampion,
            Self::NoComboPoints,
            Self::NoDueling,
            Self::NoEndurance,
            Self::NoFish,
            Self::NoItemsWhileShapeshifted,
            Self::NoMountsAllowed,
            Self::NoPet,
            Self::NoPower,
            Self::NothingToDispel,
            Self::NothingToSteal,
            Self::OnlyAbovewater,
            Self::OnlyDaytime,
            Self::OnlyIndoors,
            Self::OnlyMounted,
            Self::OnlyNighttime,
            Self::OnlyOutdoors,
            Self::OnlyShapeshift,
            Self::OnlyStealthed,
            Self::OnlyUnderwater,
            Self::OutOfRange,
            Self::Pacified,
            Self::Possessed,
            Self::Reagents,
            Self::RequiresArea,
            Self::RequiresSpellFocus,
            Self::Rooted,
            Self::Silenced,
            Self::SpellInProgress,
            Self::SpellLearned,
            Self::SpellUnavailable,
            Self::Stunned,
            Self::TargetsDead,
            Self::TargetAffectingCombat,
            Self::TargetAurastate,
            Self::TargetDueling,
            Self::TargetEnemy,
            Self::TargetEnraged,
            Self::TargetFriendly,
            Self::TargetInCombat,
            Self::TargetIsPlayer,
            Self::TargetNotDead,
            Self::TargetNotInParty,
            Self::TargetNotLooted,
            Self::TargetNotPlayer,
            Self::TargetNoPockets,
            Self::TargetNoWeapons,
            Self::TargetUnskinnable,
            Self::ThirstSatiated,
            Self::TooClose,
            Self::TooManyOfItem,
            Self::Totems,
            Self::TrainingPoints,
            Self::TryAgain,
            Self::UnitNotBehind,
            Self::UnitNotInfront,
            Self::WrongPetFood,
            Self::NotWhileFatigued,
            Self::TargetNotInInstance,
            Self::NotWhileTrading,
            Self::TargetNotInRaid,
            Self::DisenchantWhileLooting,
            Self::ProspectWhileLooting,
            Self::ProspectNeedMore,
            Self::TargetFreeforall,
            Self::NoEdibleCorpses,
            Self::OnlyBattlegrounds,
            Self::TargetNotGhost,
            Self::TooManySkills,
            Self::TransformUnusable,
            Self::WrongWeather,
            Self::DamageImmune,
            Self::PreventedByMechanic,
            Self::PlayTime,
            Self::Reputation,
            Self::MinSkill,
            Self::Unknown,
        ]
    }

    pub const fn from_int(value: u8) -> Result<Self, crate::errors::EnumError> {
        match value {
            0 => Ok(Self::AffectingCombat),
            1 => Ok(Self::AlreadyAtFullHealth),
            2 => Ok(Self::AlreadyAtFullPower),
            3 => Ok(Self::AlreadyBeingTamed),
            4 => Ok(Self::AlreadyHaveCharm),
            5 => Ok(Self::AlreadyHaveSummon),
            6 => Ok(Self::AlreadyOpen),
            7 => Ok(Self::AuraBounced),
            8 => Ok(Self::AutotrackInterrupted),
            9 => Ok(Self::BadImplicitTargets),
            10 => Ok(Self::BadTargets),
            11 => Ok(Self::CantBeCharmed),
            12 => Ok(Self::CantBeDisenchanted),
            13 => Ok(Self::CantBeProspected),
            14 => Ok(Self::CantCastOnTapped),
            15 => Ok(Self::CantDuelWhileInvisible),
            16 => Ok(Self::CantDuelWhileStealthed),
            17 => Ok(Self::CantStealth),
            18 => Ok(Self::CasterAurastate),
            19 => Ok(Self::CasterDead),
            20 => Ok(Self::Charmed),
            21 => Ok(Self::ChestInUse),
            22 => Ok(Self::Confused),
            23 => Ok(Self::DontReport),
            24 => Ok(Self::EquippedItem),
            25 => Ok(Self::EquippedItemClass),
            26 => Ok(Self::EquippedItemClassMainhand),
            27 => Ok(Self::EquippedItemClassOffhand),
            28 => Ok(Self::ErrorX),
            29 => Ok(Self::Fizzle),
            30 => Ok(Self::Fleeing),
            31 => Ok(Self::FoodLowlevel),
            32 => Ok(Self::Highlevel),
            33 => Ok(Self::HungerSatiated),
            34 => Ok(Self::Immune),
            35 => Ok(Self::Interrupted),
            36 => Ok(Self::InterruptedCombat),
            37 => Ok(Self::ItemAlreadyEnchanted),
            38 => Ok(Self::ItemGone),
            39 => Ok(Self::ItemNotFound),
            40 => Ok(Self::ItemNotReady),
            41 => Ok(Self::LevelRequirement),
            42 => Ok(Self::LineOfSight),
            43 => Ok(Self::Lowlevel),
            44 => Ok(Self::LowCastlevel),
            45 => Ok(Self::MainhandEmpty),
            46 => Ok(Self::Moving),
            47 => Ok(Self::NeedAmmo),
            48 => Ok(Self::NeedAmmoPouch),
            49 => Ok(Self::NeedExoticAmmo),
            50 => Ok(Self::Nopath),
            51 => Ok(Self::NotBehind),
            52 => Ok(Self::NotFishable),
            53 => Ok(Self::NotHere),
            54 => Ok(Self::NotInfront),
            55 => Ok(Self::NotInControl),
            56 => Ok(Self::NotKnown),
            57 => Ok(Self::NotMounted),
            58 => Ok(Self::NotOnTaxi),
            59 => Ok(Self::NotOnTransport),
            60 => Ok(Self::NotReady),
            61 => Ok(Self::NotShapeshift),
            62 => Ok(Self::NotStanding),
            63 => Ok(Self::NotTradeable),
            64 => Ok(Self::NotTrading),
            65 => Ok(Self::NotUnsheathed),
            66 => Ok(Self::NotWhileGhost),
            67 => Ok(Self::NoAmmo),
            68 => Ok(Self::NoChargesRemain),
            69 => Ok(Self::NoChampion),
            70 => Ok(Self::NoComboPoints),
            71 => Ok(Self::NoDueling),
            72 => Ok(Self::NoEndurance),
            73 => Ok(Self::NoFish),
            74 => Ok(Self::NoItemsWhileShapeshifted),
            75 => Ok(Self::NoMountsAllowed),
            76 => Ok(Self::NoPet),
            77 => Ok(Self::NoPower),
            78 => Ok(Self::NothingToDispel),
            79 => Ok(Self::NothingToSteal),
            80 => Ok(Self::OnlyAbovewater),
            81 => Ok(Self::OnlyDaytime),
            82 => Ok(Self::OnlyIndoors),
            83 => Ok(Self::OnlyMounted),
            84 => Ok(Self::OnlyNighttime),
            85 => Ok(Self::OnlyOutdoors),
            86 => Ok(Self::OnlyShapeshift),
            87 => Ok(Self::OnlyStealthed),
            88 => Ok(Self::OnlyUnderwater),
            89 => Ok(Self::OutOfRange),
            90 => Ok(Self::Pacified),
            91 => Ok(Self::Possessed),
            92 => Ok(Self::Reagents),
            93 => Ok(Self::RequiresArea),
            94 => Ok(Self::RequiresSpellFocus),
            95 => Ok(Self::Rooted),
            96 => Ok(Self::Silenced),
            97 => Ok(Self::SpellInProgress),
            98 => Ok(Self::SpellLearned),
            99 => Ok(Self::SpellUnavailable),
            100 => Ok(Self::Stunned),
            101 => Ok(Self::TargetsDead),
            102 => Ok(Self::TargetAffectingCombat),
            103 => Ok(Self::TargetAurastate),
            104 => Ok(Self::TargetDueling),
            105 => Ok(Self::TargetEnemy),
            106 => Ok(Self::TargetEnraged),
            107 => Ok(Self::TargetFriendly),
            108 => Ok(Self::TargetInCombat),
            109 => Ok(Self::TargetIsPlayer),
            110 => Ok(Self::TargetNotDead),
            111 => Ok(Self::TargetNotInParty),
            112 => Ok(Self::TargetNotLooted),
            113 => Ok(Self::TargetNotPlayer),
            114 => Ok(Self::TargetNoPockets),
            115 => Ok(Self::TargetNoWeapons),
            116 => Ok(Self::TargetUnskinnable),
            117 => Ok(Self::ThirstSatiated),
            118 => Ok(Self::TooClose),
            119 => Ok(Self::TooManyOfItem),
            120 => Ok(Self::Totems),
            121 => Ok(Self::TrainingPoints),
            122 => Ok(Self::TryAgain),
            123 => Ok(Self::UnitNotBehind),
            124 => Ok(Self::UnitNotInfront),
            125 => Ok(Self::WrongPetFood),
            126 => Ok(Self::NotWhileFatigued),
            127 => Ok(Self::TargetNotInInstance),
            128 => Ok(Self::NotWhileTrading),
            129 => Ok(Self::TargetNotInRaid),
            130 => Ok(Self::DisenchantWhileLooting),
            131 => Ok(Self::ProspectWhileLooting),
            132 => Ok(Self::ProspectNeedMore),
            133 => Ok(Self::TargetFreeforall),
            134 => Ok(Self::NoEdibleCorpses),
            135 => Ok(Self::OnlyBattlegrounds),
            136 => Ok(Self::TargetNotGhost),
            137 => Ok(Self::TooManySkills),
            138 => Ok(Self::TransformUnusable),
            139 => Ok(Self::WrongWeather),
            140 => Ok(Self::DamageImmune),
            141 => Ok(Self::PreventedByMechanic),
            142 => Ok(Self::PlayTime),
            143 => Ok(Self::Reputation),
            144 => Ok(Self::MinSkill),
            145 => Ok(Self::Unknown),
            v => Err(crate::errors::EnumError::new(NAME, v as i128),)
        }
    }
}

#[cfg(feature = "print-testcase")]
impl CastFailureReason {
    pub const fn as_test_case_value(&self) -> &'static str {
        match self {
            Self::AffectingCombat => "AFFECTING_COMBAT",
            Self::AlreadyAtFullHealth => "ALREADY_AT_FULL_HEALTH",
            Self::AlreadyAtFullPower => "ALREADY_AT_FULL_POWER",
            Self::AlreadyBeingTamed => "ALREADY_BEING_TAMED",
            Self::AlreadyHaveCharm => "ALREADY_HAVE_CHARM",
            Self::AlreadyHaveSummon => "ALREADY_HAVE_SUMMON",
            Self::AlreadyOpen => "ALREADY_OPEN",
            Self::AuraBounced => "AURA_BOUNCED",
            Self::AutotrackInterrupted => "AUTOTRACK_INTERRUPTED",
            Self::BadImplicitTargets => "BAD_IMPLICIT_TARGETS",
            Self::BadTargets => "BAD_TARGETS",
            Self::CantBeCharmed => "CANT_BE_CHARMED",
            Self::CantBeDisenchanted => "CANT_BE_DISENCHANTED",
            Self::CantBeProspected => "CANT_BE_PROSPECTED",
            Self::CantCastOnTapped => "CANT_CAST_ON_TAPPED",
            Self::CantDuelWhileInvisible => "CANT_DUEL_WHILE_INVISIBLE",
            Self::CantDuelWhileStealthed => "CANT_DUEL_WHILE_STEALTHED",
            Self::CantStealth => "CANT_STEALTH",
            Self::CasterAurastate => "CASTER_AURASTATE",
            Self::CasterDead => "CASTER_DEAD",
            Self::Charmed => "CHARMED",
            Self::ChestInUse => "CHEST_IN_USE",
            Self::Confused => "CONFUSED",
            Self::DontReport => "DONT_REPORT",
            Self::EquippedItem => "EQUIPPED_ITEM",
            Self::EquippedItemClass => "EQUIPPED_ITEM_CLASS",
            Self::EquippedItemClassMainhand => "EQUIPPED_ITEM_CLASS_MAINHAND",
            Self::EquippedItemClassOffhand => "EQUIPPED_ITEM_CLASS_OFFHAND",
            Self::ErrorX => "ERROR",
            Self::Fizzle => "FIZZLE",
            Self::Fleeing => "FLEEING",
            Self::FoodLowlevel => "FOOD_LOWLEVEL",
            Self::Highlevel => "HIGHLEVEL",
            Self::HungerSatiated => "HUNGER_SATIATED",
            Self::Immune => "IMMUNE",
            Self::Interrupted => "INTERRUPTED",
            Self::InterruptedCombat => "INTERRUPTED_COMBAT",
            Self::ItemAlreadyEnchanted => "ITEM_ALREADY_ENCHANTED",
            Self::ItemGone => "ITEM_GONE",
            Self::ItemNotFound => "ITEM_NOT_FOUND",
            Self::ItemNotReady => "ITEM_NOT_READY",
            Self::LevelRequirement => "LEVEL_REQUIREMENT",
            Self::LineOfSight => "LINE_OF_SIGHT",
            Self::Lowlevel => "LOWLEVEL",
            Self::LowCastlevel => "LOW_CASTLEVEL",
            Self::MainhandEmpty => "MAINHAND_EMPTY",
            Self::Moving => "MOVING",
            Self::NeedAmmo => "NEED_AMMO",
            Self::NeedAmmoPouch => "NEED_AMMO_POUCH",
            Self::NeedExoticAmmo => "NEED_EXOTIC_AMMO",
            Self::Nopath => "NOPATH",
            Self::NotBehind => "NOT_BEHIND",
            Self::NotFishable => "NOT_FISHABLE",
            Self::NotHere => "NOT_HERE",
            Self::NotInfront => "NOT_INFRONT",
            Self::NotInControl => "NOT_IN_CONTROL",
            Self::NotKnown => "NOT_KNOWN",
            Self::NotMounted => "NOT_MOUNTED",
            Self::NotOnTaxi => "NOT_ON_TAXI",
            Self::NotOnTransport => "NOT_ON_TRANSPORT",
            Self::NotReady => "NOT_READY",
            Self::NotShapeshift => "NOT_SHAPESHIFT",
            Self::NotStanding => "NOT_STANDING",
            Self::NotTradeable => "NOT_TRADEABLE",
            Self::NotTrading => "NOT_TRADING",
            Self::NotUnsheathed => "NOT_UNSHEATHED",
            Self::NotWhileGhost => "NOT_WHILE_GHOST",
            Self::NoAmmo => "NO_AMMO",
            Self::NoChargesRemain => "NO_CHARGES_REMAIN",
            Self::NoChampion => "NO_CHAMPION",
            Self::NoComboPoints => "NO_COMBO_POINTS",
            Self::NoDueling => "NO_DUELING",
            Self::NoEndurance => "NO_ENDURANCE",
            Self::NoFish => "NO_FISH",
            Self::NoItemsWhileShapeshifted => "NO_ITEMS_WHILE_SHAPESHIFTED",
            Self::NoMountsAllowed => "NO_MOUNTS_ALLOWED",
            Self::NoPet => "NO_PET",
            Self::NoPower => "NO_POWER",
            Self::NothingToDispel => "NOTHING_TO_DISPEL",
            Self::NothingToSteal => "NOTHING_TO_STEAL",
            Self::OnlyAbovewater => "ONLY_ABOVEWATER",
            Self::OnlyDaytime => "ONLY_DAYTIME",
            Self::OnlyIndoors => "ONLY_INDOORS",
            Self::OnlyMounted => "ONLY_MOUNTED",
            Self::OnlyNighttime => "ONLY_NIGHTTIME",
            Self::OnlyOutdoors => "ONLY_OUTDOORS",
            Self::OnlyShapeshift => "ONLY_SHAPESHIFT",
            Self::OnlyStealthed => "ONLY_STEALTHED",
            Self::OnlyUnderwater => "ONLY_UNDERWATER",
            Self::OutOfRange => "OUT_OF_RANGE",
            Self::Pacified => "PACIFIED",
            Self::Possessed => "POSSESSED",
            Self::Reagents => "REAGENTS",
            Self::RequiresArea => "REQUIRES_AREA",
            Self::RequiresSpellFocus => "REQUIRES_SPELL_FOCUS",
            Self::Rooted => "ROOTED",
            Self::Silenced => "SILENCED",
            Self::SpellInProgress => "SPELL_IN_PROGRESS",
            Self::SpellLearned => "SPELL_LEARNED",
            Self::SpellUnavailable => "SPELL_UNAVAILABLE",
            Self::Stunned => "STUNNED",
            Self::TargetsDead => "TARGETS_DEAD",
            Self::TargetAffectingCombat => "TARGET_AFFECTING_COMBAT",
            Self::TargetAurastate => "TARGET_AURASTATE",
            Self::TargetDueling => "TARGET_DUELING",
            Self::TargetEnemy => "TARGET_ENEMY",
            Self::TargetEnraged => "TARGET_ENRAGED",
            Self::TargetFriendly => "TARGET_FRIENDLY",
            Self::TargetInCombat => "TARGET_IN_COMBAT",
            Self::TargetIsPlayer => "TARGET_IS_PLAYER",
            Self::TargetNotDead => "TARGET_NOT_DEAD",
            Self::TargetNotInParty => "TARGET_NOT_IN_PARTY",
            Self::TargetNotLooted => "TARGET_NOT_LOOTED",
            Self::TargetNotPlayer => "TARGET_NOT_PLAYER",
            Self::TargetNoPockets => "TARGET_NO_POCKETS",
            Self::TargetNoWeapons => "TARGET_NO_WEAPONS",
            Self::TargetUnskinnable => "TARGET_UNSKINNABLE",
            Self::ThirstSatiated => "THIRST_SATIATED",
            Self::TooClose => "TOO_CLOSE",
            Self::TooManyOfItem => "TOO_MANY_OF_ITEM",
            Self::Totems => "TOTEMS",
            Self::TrainingPoints => "TRAINING_POINTS",
            Self::TryAgain => "TRY_AGAIN",
            Self::UnitNotBehind => "UNIT_NOT_BEHIND",
            Self::UnitNotInfront => "UNIT_NOT_INFRONT",
            Self::WrongPetFood => "WRONG_PET_FOOD",
            Self::NotWhileFatigued => "NOT_WHILE_FATIGUED",
            Self::TargetNotInInstance => "TARGET_NOT_IN_INSTANCE",
            Self::NotWhileTrading => "NOT_WHILE_TRADING",
            Self::TargetNotInRaid => "TARGET_NOT_IN_RAID",
            Self::DisenchantWhileLooting => "DISENCHANT_WHILE_LOOTING",
            Self::ProspectWhileLooting => "PROSPECT_WHILE_LOOTING",
            Self::ProspectNeedMore => "PROSPECT_NEED_MORE",
            Self::TargetFreeforall => "TARGET_FREEFORALL",
            Self::NoEdibleCorpses => "NO_EDIBLE_CORPSES",
            Self::OnlyBattlegrounds => "ONLY_BATTLEGROUNDS",
            Self::TargetNotGhost => "TARGET_NOT_GHOST",
            Self::TooManySkills => "TOO_MANY_SKILLS",
            Self::TransformUnusable => "TRANSFORM_UNUSABLE",
            Self::WrongWeather => "WRONG_WEATHER",
            Self::DamageImmune => "DAMAGE_IMMUNE",
            Self::PreventedByMechanic => "PREVENTED_BY_MECHANIC",
            Self::PlayTime => "PLAY_TIME",
            Self::Reputation => "REPUTATION",
            Self::MinSkill => "MIN_SKILL",
            Self::Unknown => "UNKNOWN",
        }
    }

}

const NAME: &str = "CastFailureReason";

impl Default for CastFailureReason {
    fn default() -> Self {
        Self::AffectingCombat
    }
}

impl std::fmt::Display for CastFailureReason {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::AffectingCombat => f.write_str("AffectingCombat"),
            Self::AlreadyAtFullHealth => f.write_str("AlreadyAtFullHealth"),
            Self::AlreadyAtFullPower => f.write_str("AlreadyAtFullPower"),
            Self::AlreadyBeingTamed => f.write_str("AlreadyBeingTamed"),
            Self::AlreadyHaveCharm => f.write_str("AlreadyHaveCharm"),
            Self::AlreadyHaveSummon => f.write_str("AlreadyHaveSummon"),
            Self::AlreadyOpen => f.write_str("AlreadyOpen"),
            Self::AuraBounced => f.write_str("AuraBounced"),
            Self::AutotrackInterrupted => f.write_str("AutotrackInterrupted"),
            Self::BadImplicitTargets => f.write_str("BadImplicitTargets"),
            Self::BadTargets => f.write_str("BadTargets"),
            Self::CantBeCharmed => f.write_str("CantBeCharmed"),
            Self::CantBeDisenchanted => f.write_str("CantBeDisenchanted"),
            Self::CantBeProspected => f.write_str("CantBeProspected"),
            Self::CantCastOnTapped => f.write_str("CantCastOnTapped"),
            Self::CantDuelWhileInvisible => f.write_str("CantDuelWhileInvisible"),
            Self::CantDuelWhileStealthed => f.write_str("CantDuelWhileStealthed"),
            Self::CantStealth => f.write_str("CantStealth"),
            Self::CasterAurastate => f.write_str("CasterAurastate"),
            Self::CasterDead => f.write_str("CasterDead"),
            Self::Charmed => f.write_str("Charmed"),
            Self::ChestInUse => f.write_str("ChestInUse"),
            Self::Confused => f.write_str("Confused"),
            Self::DontReport => f.write_str("DontReport"),
            Self::EquippedItem => f.write_str("EquippedItem"),
            Self::EquippedItemClass => f.write_str("EquippedItemClass"),
            Self::EquippedItemClassMainhand => f.write_str("EquippedItemClassMainhand"),
            Self::EquippedItemClassOffhand => f.write_str("EquippedItemClassOffhand"),
            Self::ErrorX => f.write_str("ErrorX"),
            Self::Fizzle => f.write_str("Fizzle"),
            Self::Fleeing => f.write_str("Fleeing"),
            Self::FoodLowlevel => f.write_str("FoodLowlevel"),
            Self::Highlevel => f.write_str("Highlevel"),
            Self::HungerSatiated => f.write_str("HungerSatiated"),
            Self::Immune => f.write_str("Immune"),
            Self::Interrupted => f.write_str("Interrupted"),
            Self::InterruptedCombat => f.write_str("InterruptedCombat"),
            Self::ItemAlreadyEnchanted => f.write_str("ItemAlreadyEnchanted"),
            Self::ItemGone => f.write_str("ItemGone"),
            Self::ItemNotFound => f.write_str("ItemNotFound"),
            Self::ItemNotReady => f.write_str("ItemNotReady"),
            Self::LevelRequirement => f.write_str("LevelRequirement"),
            Self::LineOfSight => f.write_str("LineOfSight"),
            Self::Lowlevel => f.write_str("Lowlevel"),
            Self::LowCastlevel => f.write_str("LowCastlevel"),
            Self::MainhandEmpty => f.write_str("MainhandEmpty"),
            Self::Moving => f.write_str("Moving"),
            Self::NeedAmmo => f.write_str("NeedAmmo"),
            Self::NeedAmmoPouch => f.write_str("NeedAmmoPouch"),
            Self::NeedExoticAmmo => f.write_str("NeedExoticAmmo"),
            Self::Nopath => f.write_str("Nopath"),
            Self::NotBehind => f.write_str("NotBehind"),
            Self::NotFishable => f.write_str("NotFishable"),
            Self::NotHere => f.write_str("NotHere"),
            Self::NotInfront => f.write_str("NotInfront"),
            Self::NotInControl => f.write_str("NotInControl"),
            Self::NotKnown => f.write_str("NotKnown"),
            Self::NotMounted => f.write_str("NotMounted"),
            Self::NotOnTaxi => f.write_str("NotOnTaxi"),
            Self::NotOnTransport => f.write_str("NotOnTransport"),
            Self::NotReady => f.write_str("NotReady"),
            Self::NotShapeshift => f.write_str("NotShapeshift"),
            Self::NotStanding => f.write_str("NotStanding"),
            Self::NotTradeable => f.write_str("NotTradeable"),
            Self::NotTrading => f.write_str("NotTrading"),
            Self::NotUnsheathed => f.write_str("NotUnsheathed"),
            Self::NotWhileGhost => f.write_str("NotWhileGhost"),
            Self::NoAmmo => f.write_str("NoAmmo"),
            Self::NoChargesRemain => f.write_str("NoChargesRemain"),
            Self::NoChampion => f.write_str("NoChampion"),
            Self::NoComboPoints => f.write_str("NoComboPoints"),
            Self::NoDueling => f.write_str("NoDueling"),
            Self::NoEndurance => f.write_str("NoEndurance"),
            Self::NoFish => f.write_str("NoFish"),
            Self::NoItemsWhileShapeshifted => f.write_str("NoItemsWhileShapeshifted"),
            Self::NoMountsAllowed => f.write_str("NoMountsAllowed"),
            Self::NoPet => f.write_str("NoPet"),
            Self::NoPower => f.write_str("NoPower"),
            Self::NothingToDispel => f.write_str("NothingToDispel"),
            Self::NothingToSteal => f.write_str("NothingToSteal"),
            Self::OnlyAbovewater => f.write_str("OnlyAbovewater"),
            Self::OnlyDaytime => f.write_str("OnlyDaytime"),
            Self::OnlyIndoors => f.write_str("OnlyIndoors"),
            Self::OnlyMounted => f.write_str("OnlyMounted"),
            Self::OnlyNighttime => f.write_str("OnlyNighttime"),
            Self::OnlyOutdoors => f.write_str("OnlyOutdoors"),
            Self::OnlyShapeshift => f.write_str("OnlyShapeshift"),
            Self::OnlyStealthed => f.write_str("OnlyStealthed"),
            Self::OnlyUnderwater => f.write_str("OnlyUnderwater"),
            Self::OutOfRange => f.write_str("OutOfRange"),
            Self::Pacified => f.write_str("Pacified"),
            Self::Possessed => f.write_str("Possessed"),
            Self::Reagents => f.write_str("Reagents"),
            Self::RequiresArea => f.write_str("RequiresArea"),
            Self::RequiresSpellFocus => f.write_str("RequiresSpellFocus"),
            Self::Rooted => f.write_str("Rooted"),
            Self::Silenced => f.write_str("Silenced"),
            Self::SpellInProgress => f.write_str("SpellInProgress"),
            Self::SpellLearned => f.write_str("SpellLearned"),
            Self::SpellUnavailable => f.write_str("SpellUnavailable"),
            Self::Stunned => f.write_str("Stunned"),
            Self::TargetsDead => f.write_str("TargetsDead"),
            Self::TargetAffectingCombat => f.write_str("TargetAffectingCombat"),
            Self::TargetAurastate => f.write_str("TargetAurastate"),
            Self::TargetDueling => f.write_str("TargetDueling"),
            Self::TargetEnemy => f.write_str("TargetEnemy"),
            Self::TargetEnraged => f.write_str("TargetEnraged"),
            Self::TargetFriendly => f.write_str("TargetFriendly"),
            Self::TargetInCombat => f.write_str("TargetInCombat"),
            Self::TargetIsPlayer => f.write_str("TargetIsPlayer"),
            Self::TargetNotDead => f.write_str("TargetNotDead"),
            Self::TargetNotInParty => f.write_str("TargetNotInParty"),
            Self::TargetNotLooted => f.write_str("TargetNotLooted"),
            Self::TargetNotPlayer => f.write_str("TargetNotPlayer"),
            Self::TargetNoPockets => f.write_str("TargetNoPockets"),
            Self::TargetNoWeapons => f.write_str("TargetNoWeapons"),
            Self::TargetUnskinnable => f.write_str("TargetUnskinnable"),
            Self::ThirstSatiated => f.write_str("ThirstSatiated"),
            Self::TooClose => f.write_str("TooClose"),
            Self::TooManyOfItem => f.write_str("TooManyOfItem"),
            Self::Totems => f.write_str("Totems"),
            Self::TrainingPoints => f.write_str("TrainingPoints"),
            Self::TryAgain => f.write_str("TryAgain"),
            Self::UnitNotBehind => f.write_str("UnitNotBehind"),
            Self::UnitNotInfront => f.write_str("UnitNotInfront"),
            Self::WrongPetFood => f.write_str("WrongPetFood"),
            Self::NotWhileFatigued => f.write_str("NotWhileFatigued"),
            Self::TargetNotInInstance => f.write_str("TargetNotInInstance"),
            Self::NotWhileTrading => f.write_str("NotWhileTrading"),
            Self::TargetNotInRaid => f.write_str("TargetNotInRaid"),
            Self::DisenchantWhileLooting => f.write_str("DisenchantWhileLooting"),
            Self::ProspectWhileLooting => f.write_str("ProspectWhileLooting"),
            Self::ProspectNeedMore => f.write_str("ProspectNeedMore"),
            Self::TargetFreeforall => f.write_str("TargetFreeforall"),
            Self::NoEdibleCorpses => f.write_str("NoEdibleCorpses"),
            Self::OnlyBattlegrounds => f.write_str("OnlyBattlegrounds"),
            Self::TargetNotGhost => f.write_str("TargetNotGhost"),
            Self::TooManySkills => f.write_str("TooManySkills"),
            Self::TransformUnusable => f.write_str("TransformUnusable"),
            Self::WrongWeather => f.write_str("WrongWeather"),
            Self::DamageImmune => f.write_str("DamageImmune"),
            Self::PreventedByMechanic => f.write_str("PreventedByMechanic"),
            Self::PlayTime => f.write_str("PlayTime"),
            Self::Reputation => f.write_str("Reputation"),
            Self::MinSkill => f.write_str("MinSkill"),
            Self::Unknown => f.write_str("Unknown"),
        }
    }
}

impl TryFrom<u8> for CastFailureReason {
    type Error = crate::errors::EnumError;
    fn try_from(value: u8) -> Result<Self, Self::Error> {
        Self::from_int(value)
    }
}

impl TryFrom<u16> for CastFailureReason {
    type Error = crate::errors::EnumError;
    fn try_from(value: u16) -> Result<Self, Self::Error> {
        TryInto::<u8>::try_into(value)
            .map_err(|_| crate::errors::EnumError::new(NAME, value.into()))?
            .try_into()
    }
}

impl TryFrom<u32> for CastFailureReason {
    type Error = crate::errors::EnumError;
    fn try_from(value: u32) -> Result<Self, Self::Error> {
        TryInto::<u8>::try_into(value)
            .map_err(|_| crate::errors::EnumError::new(NAME, value.into()))?
            .try_into()
    }
}

impl TryFrom<u64> for CastFailureReason {
    type Error = crate::errors::EnumError;
    fn try_from(value: u64) -> Result<Self, Self::Error> {
        TryInto::<u8>::try_into(value)
            .map_err(|_| crate::errors::EnumError::new(NAME, value.into()))?
            .try_into()
    }
}

impl TryFrom<i8> for CastFailureReason {
    type Error = crate::errors::EnumError;
    fn try_from(value: i8) -> Result<Self, Self::Error> {
        let v = u8::from_le_bytes(value.to_le_bytes());
        Self::from_int(v)
    }
}

impl TryFrom<i16> for CastFailureReason {
    type Error = crate::errors::EnumError;
    fn try_from(value: i16) -> Result<Self, Self::Error> {
        TryInto::<u8>::try_into(value)
            .map_err(|_| crate::errors::EnumError::new(NAME, value.into()))?
            .try_into()
    }
}

impl TryFrom<i32> for CastFailureReason {
    type Error = crate::errors::EnumError;
    fn try_from(value: i32) -> Result<Self, Self::Error> {
        TryInto::<u8>::try_into(value)
            .map_err(|_| crate::errors::EnumError::new(NAME, value.into()))?
            .try_into()
    }
}

impl TryFrom<i64> for CastFailureReason {
    type Error = crate::errors::EnumError;
    fn try_from(value: i64) -> Result<Self, Self::Error> {
        TryInto::<u8>::try_into(value)
            .map_err(|_| crate::errors::EnumError::new(NAME, value.into()))?
            .try_into()
    }
}

impl TryFrom<usize> for CastFailureReason {
    type Error = crate::errors::EnumError;
    fn try_from(value: usize) -> Result<Self, Self::Error> {
        TryInto::<u8>::try_into(value)
            .map_err(|_| crate::errors::EnumError::new(NAME, value as i128))?
            .try_into()
    }
}