Skip to content

Commit 1437d41

Browse files
committedJul 28, 2024
Reenable /cvar command
Thanks @xepheris for the hint
1 parent 371d279 commit 1437d41

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed
 

‎.luacheckrc

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ globals = {
9999
"UIParent",
100100
"UISpecialFrames",
101101
"Settings",
102+
"SettingsPanel",
102103
"PartyMemberFrame1",
103104
-- FrameXML globals
104105

‎.luarc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,8 @@
537537
"C_Timer",
538538
"hooksecurefunc",
539539
"GetTime",
540-
"AdvancedInterfaceOptionsSaved"
540+
"AdvancedInterfaceOptionsSaved",
541+
"SettingsPanel"
541542
],
542543
"diagnostics.disable": [
543544
"lowercase-global",

‎basicOptions.lua

+17-6
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,25 @@ function E:Init() -- Runs after our saved variables are loaded and cvars have be
129129
end
130130
SLASH_AIO1 = "/aio"
131131

132-
-- TODO: Re-enable in 11.0.2 when subcategories are fixed
133-
--[[SlashCmdList.CVAR = function()
134-
if not InCombatLockdown() then
135-
-- Does not work, opens to main category
136-
Settings.OpenToCategory(cVarCategoryID)
132+
-- TODO: Adjust in 11.0.2 when subcategories are properly fixed
133+
SlashCmdList.CVAR = function()
134+
if not InCombatLockdown() then
135+
for _, category in ipairs(SettingsPanel:GetCategoryList().allCategories) do
136+
if category.ID == mainCategoryID and category.subcategories then
137+
for _, subCategory in ipairs(category.subcategories) do
138+
if subCategory.ID == cVarCategoryID then
139+
SettingsPanel:Show()
140+
SettingsPanel:SelectCategory(subCategory)
141+
break
142+
end
143+
end
137144
end
145+
end
146+
else
147+
DEFAULT_CHAT_FRAME:AddMessage(format("%s: Can't modify interface options in combat", addonName))
138148
end
139-
SLASH_CVAR1 = "/cvar"]]
149+
end
150+
SLASH_CVAR1 = "/cvar"
140151
end
141152

142153
function addon:RecordCVar(cvar, value) -- Save cvar to DB for loading later

0 commit comments

Comments
 (0)