Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
|
ea094ff075 | ||
|
a1a80c4035 | ||
|
662814e302 | ||
|
8bd61fe0bd |
3 changed files with 67 additions and 58 deletions
|
@ -1,4 +1,54 @@
|
|||
local _, u = ...
|
||||
-- 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 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
|
||||
local myBinds = {
|
||||
|
@ -105,9 +155,9 @@ end
|
|||
local function setBindingRM(key, action)
|
||||
unsetBinding(action);
|
||||
if SetBinding(key, action) then
|
||||
u.success(key .. " -> " .. action);
|
||||
success(key .. " -> " .. action);
|
||||
else
|
||||
u.error("Failed to set binding " .. key .. " to " .. action);
|
||||
error("Failed to set binding " .. key .. " to " .. action);
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -115,8 +165,8 @@ local function applyBindingSet(set)
|
|||
for key, action in pairs(set) do
|
||||
setBindingRM(key, action)
|
||||
end
|
||||
u.info("Bindings set!")
|
||||
u.warn("Dont forget to reload your UI.")
|
||||
info("Bindings set!")
|
||||
warn("Dont forget to reload your UI.")
|
||||
end
|
||||
|
||||
local function enableBars()
|
||||
|
@ -138,7 +188,7 @@ local function enableBars()
|
|||
end
|
||||
|
||||
local function BindsHandler(msg, editbox)
|
||||
u.guards()
|
||||
guards()
|
||||
if msg == "" then
|
||||
applyBindingSet(myBinds)
|
||||
enableBars()
|
||||
|
@ -147,7 +197,7 @@ local function BindsHandler(msg, editbox)
|
|||
applyBindingSet(cameraBinds)
|
||||
end
|
||||
SaveBindings(1)
|
||||
u.guards()
|
||||
guards()
|
||||
end
|
||||
|
||||
-- Register the /hello command
|
||||
|
|
10
ImbusBinds.toc
Normal file
10
ImbusBinds.toc
Normal file
|
@ -0,0 +1,10 @@
|
|||
## Interface: 11200
|
||||
## Title: ImbusBinds
|
||||
## Author: Imbus
|
||||
## Version: 0.1.2
|
||||
## 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
|
51
Util.lua
51
Util.lua
|
@ -1,51 +0,0 @@
|
|||
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
|
Loading…
Reference in a new issue