Skip to content

Commit a2e4f87

Browse files
committed
Added an option to disable treating numpad keys as number keys (closes #30)
1 parent d39d86f commit a2e4f87

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

main.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,13 @@ end
505505
function DialogKey:HandleKey(key)
506506
if not InCombatLockdown() then self.frame:SetPropagateKeyboardInput(true) end
507507
local doAction = (key == self.db.keys[1] or key == self.db.keys[2])
508-
local keynum = doAction and 1 or tonumber(key)
509-
if key:match("^NUMPAD") then
510-
keynum = tonumber((key:gsub("NUMPAD", "")))
511-
end
512-
if key == "0" or key == "NUMPAD0" then
508+
local keynum = tonumber(key)
509+
if doAction then
510+
keynum = 1
511+
elseif key == "0" or (key == "NUMPAD0" and self.db.treatNumpadAsNumbers) then
513512
keynum = 10
513+
elseif key:match("^NUMPAD") and self.db.treatNumpadAsNumbers then
514+
keynum = tonumber((key:gsub("NUMPAD", "")))
514515
end
515516
if not doAction and not keynum then return end
516517
if self:ShouldIgnoreInput() then return end

options.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ns.defaultOptions = {
1717
dialogBlacklist = {},
1818
--- @type table<string, number> # [frameName] = priority
1919
customFrames = {},
20+
treatNumpadAsNumbers = true,
2021
numKeysForGossip = true,
2122
numKeysForQuestRewards = true,
2223
dontClickSummons = true,
@@ -252,6 +253,12 @@ function ns:GetOptionsTable()
252253
desc = "Gossip options for in-progress quests are ignored, and only completed or unaccepted quests are clicked",
253254
descStyle = "inline", width = "full", type = "toggle",
254255
},
256+
treatNumpadAsNumbers = {
257+
order = increment(),
258+
name = wrapName("Treat Numpad keys as Number keys"),
259+
desc = "Allow using Numpad keys (Numpad 1 -> Numpad 0) as alternatives to the number keys (1 -> 0)",
260+
descStyle = "inline", width = "full", type = "toggle",
261+
},
255262
numKeysForGossip = {
256263
order = increment(),
257264
name = wrapName("Number keys for Gossip"),

0 commit comments

Comments
 (0)