-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathVersionCompat.lua
More file actions
53 lines (45 loc) · 1.8 KB
/
VersionCompat.lua
File metadata and controls
53 lines (45 loc) · 1.8 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
local name, addon = ...
-- ============================================================================
-- Version Compatibility Layer
-- ============================================================================
-- Centralized version detection to avoid duplicate GetBuildInfo() calls
-- throughout the codebase. This module provides runtime detection of WoW
-- version and available APIs.
--
-- Usage:
-- if addon.VERSION.USE_ATLAS then
-- -- Use Retail Atlas API
-- else
-- -- Use Classic texture paths
-- end
-- ============================================================================
local build = select(4, GetBuildInfo())
addon.VERSION = {
-- Raw build number (e.g., 120000 for Retail, 20505 for Anniversary)
build = build,
-- Version flags for quick checks
isRetail = build >= 100000, -- Retail (Dragonflight 10.0+, Midnight 12.0+)
isClassic = build < 100000, -- Classic Era, Anniversary, Cata, Wrath
-- Specific version ranges
isVanilla = build >= 11500 and build < 20000, -- Classic Era (1.15.x)
isAnniversary = build >= 20500 and build < 30000, -- Anniversary (2.5.x)
isCata = build >= 50500 and build < 60000, -- Cata Classic (5.5.x)
-- Atlas system availability (Retail only)
-- Retail uses SetAtlas() with atlas names
-- Classic uses SetTexture() with file paths
USE_ATLAS = build >= 100000,
}
-- Version info string for debugging
addon.VERSION.string = string.format(
"%s (Build %d)",
addon.VERSION.isRetail and "Retail" or
addon.VERSION.isCata and "Cata Classic" or
addon.VERSION.isAnniversary and "Anniversary" or
addon.VERSION.isVanilla and "Classic Era" or
"Unknown",
build
)
-- Log version detection at addon load
if addon.debug then
print("KeyUI: " .. addon.VERSION.string)
end