Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Clicked/Clicked2.toc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Core\StringUtils.lua
Core\Serializer.lua
Core\Upgrader.lua

Modules\ConfigWindow.lua
Modules\Minimap.lua

Conditions\ConditionRegistry.lua
Expand Down
27 changes: 10 additions & 17 deletions Clicked/Core/Clicked.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ local Addon = select(2, ...)

local isPlayerInCombat = false
local isInitialized = false
local openConfigOnCombatExit = false
local wasHouseEditorActive = false

--- @type table<string, boolean>
Expand All @@ -37,23 +36,25 @@ local function HandleChatCommand(input)

while true do
local arg, next = AceConsole:GetArgs(input, 1, start)
table.insert(args, arg)

if next == 1e9 then
break
end

table.insert(args, arg)
start = next
end

if #args == 0 then
if InCombatLockdown() then
openConfigOnCombatExit = true
Clicked2:LogWarning(Addon.L["Binding configuration will open once you leave combat."])
else
Addon.BindingConfig.Window:Open()
for _, module in Clicked2:IterateModules() do
--- @cast module SlashCommandHandler
local handler = module.HandleSlashCommand

if type(handler) == "function" and handler(module, args) then
return
end
elseif #args == 1 then
end

if #args == 1 then
if args[1] == "opt" or args[1] == "options" then
Addon:OpenSettingsMenu("Clicked2")
elseif args[1] == "dump" then
Expand All @@ -78,9 +79,6 @@ local function PLAYER_REGEN_DISABLED()
Clicked2:LogVerbose("Received event {eventName}", "PLAYER_REGEN_DISABLED")

isPlayerInCombat = true
openConfigOnCombatExit = Addon.BindingConfig.Window:IsOpen()

Addon.BindingConfig.Window:Close()

if Addon:IsCombatProcessRequired() then
Clicked2:ProcessActiveBindings()
Expand All @@ -97,11 +95,6 @@ local function PLAYER_REGEN_ENABLED()
if Addon:IsCombatProcessRequired() then
Clicked2:ProcessActiveBindings()
end

if openConfigOnCombatExit then
Addon.BindingConfig.Window:Open()
openConfigOnCombatExit = false
end
end

local function PLAYER_ENTERING_WORLD()
Expand Down
3 changes: 3 additions & 0 deletions Clicked/Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
--- @class AddonOptionsProvider
--- @field public GetAddonOptions fun(self: AddonOptionsProvider): table<string, AceConfig.OptionsTable>

--- @class SlashCommandHandler
--- @field public HandleSlashCommand fun(self: SlashCommandHandler, args: string[]): boolean

--- @class Profile
--- @field public version integer
--- @field public options Profile.Options
Expand Down
63 changes: 63 additions & 0 deletions Clicked/Modules/ConfigWindow.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
-- Clicked, a World of Warcraft keybind manager.
-- Copyright (C) 2026 Kevin Krol
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.

--- @class Addon
local Addon = select(2, ...)

--- @class ConfigWindowModule : AceModule, AceEvent-3.0, LibLog-1.0.Logger, SlashCommandHandler
local Prototype = {}

--- @protected
function Prototype:OnInitialize()
self:RegisterEvent("PLAYER_REGEN_DISABLED", self.PLAYER_REGEN_DISABLED, self)
self:RegisterEvent("PLAYER_REGEN_ENABLED", self.PLAYER_REGEN_ENABLED, self)

self:LogDebug("Initialized config window module")
end

--- @param args string[]
--- @return boolean
function Prototype:HandleSlashCommand(args)
if #args == 0 then
if InCombatLockdown() then
self.openConfigPending = true
self:LogWarning(Addon.L["Binding configuration will open once you leave combat."])
else
Addon.BindingConfig.Window:Open()
end

return true
end

return false
end

--- @private
function Prototype:PLAYER_REGEN_DISABLED()
self.openConfigPending = Addon.BindingConfig.Window:IsOpen()

Addon.BindingConfig.Window:Close()
end

--- @private
function Prototype:PLAYER_REGEN_ENABLED()
if self.openConfigPending then
Addon.BindingConfig.Window:Open()
self.openConfigPending = false
end
end

Clicked2:NewModule("ConfigWindow", Prototype, "AceEvent-3.0")