Compare commits

..

15 commits
1.12 ... master

Author SHA1 Message Date
Imbus
295dc15844 Version bumps 2025-02-22 09:44:49 +01:00
Imbus
e4fdafb12b Versioning script 2025-02-22 09:43:44 +01:00
Imbus
c05d0f9ddd Globals 2025-02-22 09:40:31 +01:00
Imbus
56162b82c9 Better versioning 2025-02-22 09:40:25 +01:00
Imbus
7eb4efd423 Version info 2025-02-22 09:22:52 +01:00
Imbus
7e06bbb11b Info when enabling action bars 2025-02-22 09:15:20 +01:00
Imbus
b149abc34e luarc global markings 2025-02-22 09:08:49 +01:00
Imbus
edb863e8fe Some help messages, default to no action 2025-02-22 09:08:40 +01:00
Imbus
191e3665b0 Mistype fix 2025-02-22 08:59:43 +01:00
Imbus
7eb6888888 Switch action bar 1 with action bar 2 binds, for better defaults when form-switching 2025-02-22 08:54:56 +01:00
Imbus
636be3546d Add support for Warmane (default) and Turtle 2025-02-10 14:39:25 +01:00
Imbus
0c6cc172e3 Notes on symbols 2024-08-16 14:55:06 +02:00
Imbus
8a89bf0d4b Disable undefined globals and add config from SabineWren/wow-api-type-definitions 2024-08-16 14:53:36 +02:00
Imbus
a3ed13202e Reformat 2024-08-16 12:48:16 +02:00
Imbus
46d657d02b Formatting options and ignoring undefined globals error from linter 2024-08-16 12:48:01 +02:00
12 changed files with 264 additions and 177 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
wow-api-type-definitions

25
.luarc.json Normal file
View file

@ -0,0 +1,25 @@
{
"diagnostics.globals": [
"arg",
"arg1",
"arg2",
"arg3",
"arg4",
"arg5",
"arg6",
"arg7",
"arg8",
"arg9",
"event",
"SetBinding",
"SetCVar",
"MultiActionBar_Update",
"SetActionBarToggles",
"SaveBindings",
"SlashCmdList",
"GetAddOnMetadata"
],
"runtime.version": "Lua 5.1",
"type.inferParamType": true,
"workspace.library": ["wow-api-type-definitions"]
}

6
.stylua.toml Normal file
View file

@ -0,0 +1,6 @@
column_width = 160
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "None"

View file

@ -1,205 +1,167 @@
-- local _, u = ... local _, u = ...
u.version = GetAddOnMetadata("ImbusBinds", "Version")
-- Hex formatted as "AARRGGBB"
local COLOR = {
blue = "FF" .. "0000FF",
green = "FF" .. "00FF00",
red = "FF" .. "FF0000",
legendary = "FF" .. "A335EE",
heirloom = "FF" .. "E6CC80",
warning = "FF" .. "EED202",
}
-- Wrap the text in a color code
local function colorWrap(text, colorCode)
return "|c" .. colorCode .. text .. "|r"
end
-- Special case of the color function
local function prefix()
return colorWrap("ImbusBinds> ", COLOR.legendary)
end
-- Special print
local function bprint(msg)
print(prefix() .. msg)
end
-- Prints some separators
function guards()
local accum = ""
for _ = 1, 30 do
accum = accum .. "="
end
print(colorWrap(accum, COLOR.legendary))
end
function info(msg)
bprint(colorWrap(msg, COLOR.heirloom))
end
function warn(msg)
bprint(colorWrap(msg, COLOR.warning))
end
function error(msg)
bprint(colorWrap(msg, COLOR.red))
end
function success(msg)
bprint(colorWrap(msg, COLOR.green))
end
-- https://wowpedia.fandom.com/wiki/BindingID -- https://wowpedia.fandom.com/wiki/BindingID
local myBinds = { local myBinds = {
-- Movement -- Movement
["A"] = "STRAFELEFT", ['A'] = 'STRAFELEFT',
["D"] = "STRAFERIGHT", ['D'] = 'STRAFERIGHT',
-- Character and bag toggles, since c and b are used for strafing -- Character and bag toggles, since c and b are used for strafing
["F1"] = "OPENALLBAGS", ['F1'] = 'OPENALLBAGS',
["F2"] = "TOGGLECHARACTER0", ['F2'] = 'TOGGLECHARACTER0',
-- Action Bar 1 -- Action Bar 1
["1"] = "ACTIONBUTTON1", ['BUTTON5'] = 'ACTIONBUTTON1',
["2"] = "ACTIONBUTTON2", ['BUTTON4'] = 'ACTIONBUTTON2',
["3"] = "ACTIONBUTTON3", ['SHIFT-BUTTON5'] = 'ACTIONBUTTON3',
["4"] = "ACTIONBUTTON4", ['SHIFT-BUTTON4'] = 'ACTIONBUTTON4',
["5"] = "ACTIONBUTTON5", ['CTRL-BUTTON5'] = 'ACTIONBUTTON5',
["6"] = "ACTIONBUTTON6", ['CTRL-BUTTON4'] = 'ACTIONBUTTON6',
["SHIFT-1"] = "ACTIONBUTTON7", ['BUTTON3'] = 'ACTIONBUTTON7',
["SHIFT-2"] = "ACTIONBUTTON8", ['SHIFT-BUTTON3'] = 'ACTIONBUTTON8',
["SHIFT-3"] = "ACTIONBUTTON9", ['CTRL-BUTTON3'] = 'ACTIONBUTTON9',
["SHIFT-4"] = "ACTIONBUTTON10", ['§'] = 'ACTIONBUTTON10',
["SHIFT-5"] = "ACTIONBUTTON11", ['SHIFT-§'] = 'ACTIONBUTTON11',
["SHIFT-6"] = "ACTIONBUTTON12", ['CTRL-§'] = 'ACTIONBUTTON12',
-- Action Bar 2 -- Action Bar 2
["BUTTON5"] = "MULTIACTIONBAR1BUTTON1", ['1'] = 'MULTIACTIONBAR1BUTTON1',
["BUTTON4"] = "MULTIACTIONBAR1BUTTON2", ['2'] = 'MULTIACTIONBAR1BUTTON2',
["SHIFT-BUTTON5"] = "MULTIACTIONBAR1BUTTON3", ['3'] = 'MULTIACTIONBAR1BUTTON3',
["SHIFT-BUTTON4"] = "MULTIACTIONBAR1BUTTON4", ['4'] = 'MULTIACTIONBAR1BUTTON4',
["CTRL-BUTTON5"] = "MULTIACTIONBAR1BUTTON5", ['5'] = 'MULTIACTIONBAR1BUTTON5',
["CTRL-BUTTON4"] = "MULTIACTIONBAR1BUTTON6", ['6'] = 'MULTIACTIONBAR1BUTTON6',
["BUTTON3"] = "MULTIACTIONBAR1BUTTON7", ['SHIFT-1'] = 'MULTIACTIONBAR1BUTTON7',
["SHIFT-BUTTON3"] = "MULTIACTIONBAR1BUTTON8", ['SHIFT-2'] = 'MULTIACTIONBAR1BUTTON8',
["CTRL-BUTTON3"] = "MULTIACTIONBAR1BUTTON9", ['SHIFT-3'] = 'MULTIACTIONBAR1BUTTON9',
["§"] = "MULTIACTIONBAR1BUTTON10", ['SHIFT-4'] = 'MULTIACTIONBAR1BUTTON10',
["SHIFT-§"] = "MULTIACTIONBAR1BUTTON11", ['SHIFT-5'] = 'MULTIACTIONBAR1BUTTON11',
["CTRL-§"] = "MULTIACTIONBAR1BUTTON12", ['SHIFT-6'] = 'MULTIACTIONBAR1BUTTON12',
-- Action Bar 3 -- Action Bar 3
["Q"] = "MULTIACTIONBAR2BUTTON1", ['Q'] = 'MULTIACTIONBAR2BUTTON1',
["E"] = "MULTIACTIONBAR2BUTTON2", ['E'] = 'MULTIACTIONBAR2BUTTON2',
["R"] = "MULTIACTIONBAR2BUTTON3", ['R'] = 'MULTIACTIONBAR2BUTTON3',
["T"] = "MULTIACTIONBAR2BUTTON4", ['T'] = 'MULTIACTIONBAR2BUTTON4',
["F"] = "MULTIACTIONBAR2BUTTON5", ['F'] = 'MULTIACTIONBAR2BUTTON5',
["G"] = "MULTIACTIONBAR2BUTTON6", ['G'] = 'MULTIACTIONBAR2BUTTON6',
["SHIFT-Q"] = "MULTIACTIONBAR2BUTTON7", ['SHIFT-Q'] = 'MULTIACTIONBAR2BUTTON7',
["SHIFT-E"] = "MULTIACTIONBAR2BUTTON8", ['SHIFT-E'] = 'MULTIACTIONBAR2BUTTON8',
["SHIFT-R"] = "MULTIACTIONBAR2BUTTON9", ['SHIFT-R'] = 'MULTIACTIONBAR2BUTTON9',
["SHIFT-T"] = "MULTIACTIONBAR2BUTTON10", ['SHIFT-T'] = 'MULTIACTIONBAR2BUTTON10',
["SHIFT-F"] = "MULTIACTIONBAR2BUTTON11", ['SHIFT-F'] = 'MULTIACTIONBAR2BUTTON11',
["SHIFT-G"] = "MULTIACTIONBAR2BUTTON12", ['SHIFT-G'] = 'MULTIACTIONBAR2BUTTON12',
-- Action Bar 4 -- Action Bar 4
["S"] = "MULTIACTIONBAR3BUTTON1", ['S'] = 'MULTIACTIONBAR3BUTTON1',
["Z"] = "MULTIACTIONBAR3BUTTON2", ['Z'] = 'MULTIACTIONBAR3BUTTON2',
["X"] = "MULTIACTIONBAR3BUTTON3", ['X'] = 'MULTIACTIONBAR3BUTTON3',
["C"] = "MULTIACTIONBAR3BUTTON4", ['C'] = 'MULTIACTIONBAR3BUTTON4',
["V"] = "MULTIACTIONBAR3BUTTON5", ['V'] = 'MULTIACTIONBAR3BUTTON5',
["B"] = "MULTIACTIONBAR3BUTTON6", ['B'] = 'MULTIACTIONBAR3BUTTON6',
["SHIFT-S"] = "MULTIACTIONBAR3BUTTON7", ['SHIFT-S'] = 'MULTIACTIONBAR3BUTTON7',
["SHIFT-Z"] = "MULTIACTIONBAR3BUTTON8", ['SHIFT-Z'] = 'MULTIACTIONBAR3BUTTON8',
["SHIFT-X"] = "MULTIACTIONBAR3BUTTON9", ['SHIFT-X'] = 'MULTIACTIONBAR3BUTTON9',
["SHIFT-C"] = "MULTIACTIONBAR3BUTTON10", ['SHIFT-C'] = 'MULTIACTIONBAR3BUTTON10',
["SHIFT-V"] = "MULTIACTIONBAR3BUTTON11", ['SHIFT-V'] = 'MULTIACTIONBAR3BUTTON11',
["SHIFT-B"] = "MULTIACTIONBAR3BUTTON12", ['SHIFT-B'] = 'MULTIACTIONBAR3BUTTON12',
-- Action Bar 5 -- Action Bar 5
["CTRL-Q"] = "MULTIACTIONBAR4BUTTON1", ['CTRL-Q'] = 'MULTIACTIONBAR4BUTTON1',
["CTRL-E"] = "MULTIACTIONBAR4BUTTON2", ['CTRL-E'] = 'MULTIACTIONBAR4BUTTON2',
["CTRL-R"] = "MULTIACTIONBAR4BUTTON3", ['CTRL-R'] = 'MULTIACTIONBAR4BUTTON3',
["CTRL-T"] = "MULTIACTIONBAR4BUTTON4", ['CTRL-T'] = 'MULTIACTIONBAR4BUTTON4',
["CTRL-F"] = "MULTIACTIONBAR4BUTTON5", ['CTRL-F'] = 'MULTIACTIONBAR4BUTTON5',
["CTRL-G"] = "MULTIACTIONBAR4BUTTON6", ['CTRL-G'] = 'MULTIACTIONBAR4BUTTON6',
["CTRL-1"] = "MULTIACTIONBAR4BUTTON7", ['CTRL-1'] = 'MULTIACTIONBAR4BUTTON7',
["CTRL-2"] = "MULTIACTIONBAR4BUTTON8", ['CTRL-2'] = 'MULTIACTIONBAR4BUTTON8',
["CTRL-3"] = "MULTIACTIONBAR4BUTTON9", ['CTRL-3'] = 'MULTIACTIONBAR4BUTTON9',
["CTRL-4"] = "MULTIACTIONBAR4BUTTON10", ['CTRL-4'] = 'MULTIACTIONBAR4BUTTON10',
["CTRL-5"] = "MULTIACTIONBAR4BUTTON11", ['CTRL-5'] = 'MULTIACTIONBAR4BUTTON11',
["CTRL-6"] = "MULTIACTIONBAR4BUTTON12", ['CTRL-6'] = 'MULTIACTIONBAR4BUTTON12',
} }
local cameraBinds = { local cameraBinds = {
-- Remove zoom from mousewheel -- Remove zoom from mousewheel
["-"] = "CAMERAZOOMOUT", ['-'] = 'CAMERAZOOMOUT',
["+"] = "CAMERAZOOMIN", ['+'] = 'CAMERAZOOMIN',
["MOUSEWHEELUP"] = "STARTAUTORUN", ['MOUSEWHEELUP'] = 'STARTAUTORUN',
["MOUSEWHEELDOWN"] = "FOLLOWTARGET", ['MOUSEWHEELDOWN'] = 'FOLLOWTARGET',
} }
-- Unsets a binding, if it exists -- Unsets a binding, if it exists
local function unsetBinding(action) local function unsetBinding(action)
local key1, key2 = GetBindingKey(action); local key1, key2 = GetBindingKey(action)
if key1 then if key1 then
SetBinding(key1, nil); SetBinding(key1, nil)
end end
if key2 then if key2 then
SetBinding(key2, nil); SetBinding(key2, nil)
end end
end end
-- Same as SetBinding, but removes the old binding first -- Same as SetBinding, but removes the old binding first
local function setBindingRM(key, action) local function setBindingRM(key, action)
unsetBinding(action); unsetBinding(action)
if SetBinding(key, action) then if SetBinding(key, action) then
success(key .. " -> " .. action); u.success(key .. ' -> ' .. action)
else else
error("Failed to set binding " .. key .. " to " .. action); u.error('Failed to set binding ' .. key .. ' to ' .. action)
end end
end end
local function applyBindingSet(set) local function applyBindingSet(set)
for key, action in pairs(set) do for key, action in pairs(set) do
setBindingRM(key, action) setBindingRM(key, action)
end end
info("Bindings set!") u.info 'Bindings set!'
warn("Dont forget to reload your UI.") u.warn 'Dont forget to reload your UI.'
end end
local function enableBars() local function enableBars()
SetActionBarToggles(1, 1, 1, 1); SetActionBarToggles(1, 1, 1, 1)
SHOW_MULTI_ACTIONBAR_1 = 1 --Bottom Left Bar SHOW_MULTI_ACTIONBAR_1 = 1 --Bottom Left Bar
SHOW_MULTI_ACTIONBAR_2 = 1 --Bottom Right Bar SHOW_MULTI_ACTIONBAR_2 = 1 --Bottom Right Bar
SHOW_MULTI_ACTIONBAR_3 = 1 --Right Bar SHOW_MULTI_ACTIONBAR_3 = 1 --Right Bar
SHOW_MULTI_ACTIONBAR_4 = 1 --Right Bar 2 SHOW_MULTI_ACTIONBAR_4 = 1 --Right Bar 2
MultiActionBar_Update(); MultiActionBar_Update()
SetCVar("alwaysShowActionBars", 1); SetCVar('alwaysShowActionBars', 1)
SetCVar("lockActionBars", 1); SetCVar('lockActionBars', 1)
SetCVar("countdownForCooldowns", 1); SetCVar('countdownForCooldowns', 1)
SetCVar("cameraDistanceMaxZoomFactor", 2); SetCVar('cameraDistanceMaxZoomFactor', 2)
SetCVar("instantQuestText", 1); SetCVar('instantQuestText', 1)
SetCVar("nameplateShowAll", 1); SetCVar('nameplateShowAll', 1)
SetCVar("nameplateShowEnemies", 1); SetCVar('nameplateShowEnemies', 1)
SetCVar("nameplateMaxDistance", 35); SetCVar('nameplateMaxDistance', 35)
SetCVar("enableFloatingCombatText", 1); SetCVar('enableFloatingCombatText', 1)
end end
local function BindsHandler(msg, editbox) local function BindsHandler(msg, editbox)
guards() u.guards()
if msg == "" then if msg == '' then
applyBindingSet(myBinds) u.info 'Welcome to the ImbusBinds keybinding script'
enableBars() u.info('Version: ' .. u.version)
end u.info 'Usage:'
if msg == "camera" then u.info ' /binds set - To set general bindings'
applyBindingSet(cameraBinds) u.info ' /binds camera - To set camera binds to +/-'
end u.info ' /binds bars - Enable all action bars'
SaveBindings(1) end
guards() if msg == 'set' then
applyBindingSet(myBinds)
end
if msg == 'camera' then
applyBindingSet(cameraBinds)
end
if msg == 'bars' then
enableBars()
u.info 'Bars set!'
end
SaveBindings(1)
u.guards()
end end
-- Register the /hello command -- Register the /binds command
SLASH_BINDS1 = "/binds" SLASH_BINDS1 = '/binds'
SlashCmdList["BINDS"] = BindsHandler SlashCmdList['BINDS'] = BindsHandler

View file

@ -1,7 +1,7 @@
## Interface: 11200 ## Interface: 30300
## Title: ImbusBinds ## Title: ImbusBinds
## Author: Imbus ## Author: Imbus
## Version: 0.1.2 ## Version: v0.1.5
## Notes: Simple addon for a sane default keybind setup ## Notes: Simple addon for a sane default keybind setup
## URL: https://git.silversoft.se/Imbus/ImbusBinds ## URL: https://git.silversoft.se/Imbus/ImbusBinds
## IconTexture: Interface\Icons\Inv_qiraj_jewelglyphed ## IconTexture: Interface\Icons\Inv_qiraj_jewelglyphed

View file

@ -1,7 +1,7 @@
## Interface: 100107 ## Interface: 100107
## Title: ImbusBinds ## Title: ImbusBinds
## Author: Imbus ## Author: Imbus
## Version: 0.1.2 ## Version: v0.1.5
## Notes: Simple addon for a sane default keybind setup ## Notes: Simple addon for a sane default keybind setup
## URL: https://git.silversoft.se/Imbus/ImbusBinds ## URL: https://git.silversoft.se/Imbus/ImbusBinds
## IconTexture: Interface\Icons\Inv_qiraj_jewelglyphed ## IconTexture: Interface\Icons\Inv_qiraj_jewelglyphed

10
ImbusBinds_Turtle.toc Normal file
View file

@ -0,0 +1,10 @@
## Interface: 11200
## Title: ImbusBinds
## Author: Imbus
## Version: v0.1.5
## Notes: Simple addon for a sane default keybind setup
## URL: https://git.silversoft.se/Imbus/ImbusBinds
## IconTexture: Interface\Icons\Inv_qiraj_jewelglyphed
Util.lua
ImbusBinds.lua

10
ImbusBinds_Warmane.toc Normal file
View file

@ -0,0 +1,10 @@
## Interface: 30300
## Title: ImbusBinds
## Author: Imbus
## Version: v0.1.5
## Notes: Simple addon for a sane default keybind setup
## URL: https://git.silversoft.se/Imbus/ImbusBinds
## IconTexture: Interface\Icons\Inv_qiraj_jewelglyphed
Util.lua
ImbusBinds.lua

View file

@ -1,7 +1,7 @@
## Interface: 30403 ## Interface: 30403
## Title: ImbusBinds ## Title: ImbusBinds
## Author: Imbus ## Author: Imbus
## Version: 0.1.2 ## Version: v0.1.5
## Notes: Simple addon for a sane default keybind setup ## Notes: Simple addon for a sane default keybind setup
## URL: https://git.silversoft.se/Imbus/ImbusBinds ## URL: https://git.silversoft.se/Imbus/ImbusBinds
## IconTexture: Interface\Icons\Inv_qiraj_jewelglyphed ## IconTexture: Interface\Icons\Inv_qiraj_jewelglyphed

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# Default keybinds
See [wow-api-type-definitions](https://github.com/SabineWren/wow-api-type-definitions)
## For LSP symbols:
Clone inside this repo:
`git clone git@github.com:SabineWren/wow-api-type-definitions.git`

51
Util.lua Normal file
View file

@ -0,0 +1,51 @@
local _, u = ...
-- Hex formatted as "AARRGGBB"
local COLOR = {
blue = 'FF' .. '0000FF',
green = 'FF' .. '00FF00',
red = 'FF' .. 'FF0000',
legendary = 'FF' .. 'A335EE',
heirloom = 'FF' .. 'E6CC80',
warning = 'FF' .. 'EED202',
}
-- Wrap the text in a color code
local function colorWrap(text, colorCode)
return '|c' .. colorCode .. text .. '|r'
end
-- Special case of the color function
local function prefix()
return colorWrap('ImbusBinds> ', COLOR.legendary)
end
-- Special print
local function bprint(msg)
print(prefix() .. msg)
end
-- Prints some separators
function u.guards()
local accum = ''
for _ = 1, 30 do
accum = accum .. '='
end
print(colorWrap(accum, COLOR.legendary))
end
function u.info(msg)
bprint(colorWrap(msg, COLOR.heirloom))
end
function u.warn(msg)
bprint(colorWrap(msg, COLOR.warning))
end
function u.error(msg)
bprint(colorWrap(msg, COLOR.red))
end
function u.success(msg)
bprint(colorWrap(msg, COLOR.green))
end

13
set_version.sh Normal file
View file

@ -0,0 +1,13 @@
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <semver>"
exit 1
fi
SEMVER="$1"
# Update all *.toc files
sed -i -E "s/^(## Version: ).*/\1$SEMVER/" ./*.toc
echo "Updated all .toc files with version $SEMVER"