1#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd)]
3#[repr(u32)]
4pub enum WmoVersion {
5 Classic = 17,
7
8 Tbc = 18,
10
11 Wotlk = 19,
13
14 Cataclysm = 20,
16
17 Mop = 21,
19
20 Wod = 22,
22
23 Legion = 23,
25
26 Bfa = 24,
28
29 Shadowlands = 25,
31
32 Dragonflight = 26,
34
35 WarWithin = 27,
37}
38
39impl WmoVersion {
40 pub fn from_raw(raw: u32) -> Option<Self> {
42 match raw {
43 17 => Some(Self::Classic),
44 18 => Some(Self::Tbc),
45 19 => Some(Self::Wotlk),
46 20 => Some(Self::Cataclysm),
47 21 => Some(Self::Mop),
48 22 => Some(Self::Wod),
49 23 => Some(Self::Legion),
50 24 => Some(Self::Bfa),
51 25 => Some(Self::Shadowlands),
52 26 => Some(Self::Dragonflight),
53 27 => Some(Self::WarWithin),
54 _ => None,
55 }
56 }
57
58 pub fn to_raw(self) -> u32 {
60 self as u32
61 }
62
63 pub fn expansion_name(self) -> &'static str {
65 match self {
66 Self::Classic => "Classic/Vanilla",
67 Self::Tbc => "The Burning Crusade",
68 Self::Wotlk => "Wrath of the Lich King",
69 Self::Cataclysm => "Cataclysm",
70 Self::Mop => "Mists of Pandaria",
71 Self::Wod => "Warlords of Draenor",
72 Self::Legion => "Legion",
73 Self::Bfa => "Battle for Azeroth",
74 Self::Shadowlands => "Shadowlands",
75 Self::Dragonflight => "Dragonflight",
76 Self::WarWithin => "The War Within",
77 }
78 }
79
80 pub fn min_supported() -> Self {
82 Self::Classic
83 }
84
85 pub fn max_supported() -> Self {
87 Self::WarWithin
88 }
89
90 pub fn supports_feature(self, feature: WmoFeature) -> bool {
92 self >= feature.min_version()
93 }
94}
95
96#[derive(Debug, Clone, Copy, PartialEq, Eq)]
98pub enum WmoFeature {
99 Base,
101
102 ImprovedLighting,
104
105 SkyboxReferences,
107
108 DestructibleObjects,
110
111 ExtendedMaterials,
113
114 LiquidV2,
116
117 GlobalAmbientColor,
119
120 ParticleSystems,
122
123 ShadowBatches,
125
126 RayTracedShadows,
128
129 EnhancedMaterials,
131}
132
133impl WmoFeature {
134 pub fn min_version(self) -> WmoVersion {
136 match self {
137 Self::Base => WmoVersion::Classic,
138 Self::ImprovedLighting => WmoVersion::Tbc,
139 Self::SkyboxReferences => WmoVersion::Wotlk,
140 Self::DestructibleObjects => WmoVersion::Cataclysm,
141 Self::ExtendedMaterials => WmoVersion::Mop,
142 Self::LiquidV2 => WmoVersion::Wod,
143 Self::GlobalAmbientColor => WmoVersion::Legion,
144 Self::ParticleSystems => WmoVersion::Bfa,
145 Self::ShadowBatches => WmoVersion::Shadowlands,
146 Self::RayTracedShadows => WmoVersion::Dragonflight,
147 Self::EnhancedMaterials => WmoVersion::WarWithin,
148 }
149 }
150}