-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
utils.lua
58 lines (47 loc) · 2.02 KB
/
utils.lua
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
local _, addon = ...
--------------------------------------
-- Utility functions
--------------------------------------
function addon.IsClassicEra()
return WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
end
function addon.IsClassic()
return WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC
end
function addon.IsRetail()
return WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
end
function addon.getActionCamMode()
local cameraDynamicPitch = C_CVar.GetCVarBool("test_cameraDynamicPitch")
local cameraHeadMovementStrength = C_CVar.GetCVarBool("test_cameraHeadMovementStrength")
local cameraOverShoulder = C_CVar.GetCVarBool("test_cameraOverShoulder")
local cameraTargetFocusInteractEnable = C_CVar.GetCVarBool("test_cameraTargetFocusInteractEnable")
local cameraTargetFocusEnemyEnable = C_CVar.GetCVarBool("test_cameraTargetFocusEnemyEnable")
if cameraDynamicPitch and cameraHeadMovementStrength and cameraOverShoulder and cameraTargetFocusInteractEnable and cameraTargetFocusEnemyEnable then
return "full"
elseif cameraDynamicPitch and cameraHeadMovementStrength and cameraOverShoulder and cameraTargetFocusInteractEnable and not cameraTargetFocusEnemyEnable then
return "on"
elseif cameraDynamicPitch and not cameraHeadMovementStrength and not cameraOverShoulder and not cameraTargetFocusInteractEnable and not cameraTargetFocusEnemyEnable then
return "basic"
else
return "default"
end
end
function addon.getCustomVar(cvar)
return AdvancedInterfaceOptionsSaved.CustomVars[cvar]
end
function addon.setCustomVar(cvar, value)
AdvancedInterfaceOptionsSaved.CustomVars[cvar] = value
end
-- C_Console.GetAllCommands is now ConsoleGetAllCommands as of 10.2.0
addon.GetAllCommands = ConsoleGetAllCommands or C_Console and C_Console.GetAllCommands
-- value, defaultValue, isStoredServerAccount, isStoredServerCharacter, isLockedFromUser, isSecure, isReadOnly
addon.GetCVarInfo = C_CVar.GetCVarInfo
function addon:CVarExists(cvar)
return not not select(
2,
pcall(function()
return addon.GetCVarInfo(cvar)
end)
)
end