13 Commits

Author SHA1 Message Date
1759ebfab6 Release 1.2.3 2025-05-08 14:55:05 +02:00
798043c7aa Try to save keybinds when restoring 2025-05-08 14:54:58 +02:00
396ef0437f Release 1.2.2 2025-05-07 21:40:10 +02:00
d92fe23d8a Update meta 2025-05-07 21:40:07 +02:00
1b09f262d5 Do more hacky shit
I hate this api
2025-05-07 21:39:49 +02:00
f17078c8a8 Release 1.2.0 2025-05-07 21:30:45 +02:00
3e85b9933e Add support for CLICK keybinds
What a cancer API FUCK YOU BLIZZARD
2025-05-07 21:30:38 +02:00
53e201e414 Add machined russian translation of readme 2025-05-06 23:09:23 +02:00
4f7a07c337 FIX the fucking release
I forgot to rename repo OOPS
2025-05-06 23:07:29 +02:00
0637832bdd Release 1.1.2 2025-05-06 23:07:17 +02:00
1b4e3dd688 Fix the god damn git add 2025-05-06 23:06:57 +02:00
717a8ee015 Release 1.1.1 2025-05-06 23:06:40 +02:00
b9a671b0f2 Release 1.1.0 2025-05-06 23:05:55 +02:00
6 changed files with 103 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
## Interface: 70300 ## Interface: 70300
## Title: ActionBarSaver: Daved ## Title: ActionBarSaver: Daved
## Version: 1.0.0 ## Version: 1.2.3
## Notes: Manage, save, restore, import and export action bar and keybind profiles ## Notes: Manage, save, restore, import and export action bar and keybind profiles
## Author: Phat phuck dave ## Author: Phat phuck dave
## SavedVariables: ActionBarSaverDaved, KeybindSaverDaved ## SavedVariables: ActionBarSaverDaved, KeybindSaverDaved

View File

@@ -39,13 +39,19 @@ local pickupActionButton = {
} }
---@param index number ---@param index number
---@param actionButton {type: string, id: number|string} ---@return nil
---@return boolean, number? local function ClearActionButton(index)
local function RestoreActionButton(index, actionButton)
if GetActionInfo(index) then if GetActionInfo(index) then
PickupAction(index) PickupAction(index)
ClearCursor() ClearCursor()
end end
end
---@param index number
---@param actionButton {type: string, id: number|string}
---@return boolean, number?
local function RestoreActionButton(index, actionButton)
ClearActionButton(index)
if not actionButton then return true, nil end if not actionButton then return true, nil end
@@ -174,6 +180,7 @@ function RestoreActionbarSet(setName)
for i = 1, MAX_ACTION_BUTTONS do for i = 1, MAX_ACTION_BUTTONS do
local actionButton = set[i] local actionButton = set[i]
ClearActionButton(i)
if actionButton then if actionButton then
if IsMacro(actionButton) and duplicates[actionButton.id] then if IsMacro(actionButton) and duplicates[actionButton.id] then
---@cast actionButton {type: string, id: string} ---@cast actionButton {type: string, id: string}

View File

@@ -24,6 +24,10 @@ local function SaveKeybindSet(setName)
for i = 1, numBindings do for i = 1, numBindings do
local command, _, key1, key2 = GetBinding(i) local command, _, key1, key2 = GetBinding(i)
if string.find(command, "CLICK ") then
-- What a stupid fucking api, so fucking idiotic, retarded
command, key2 = strsplit(":", command)
end
if key1 or key2 then set[command] = { if key1 or key2 then set[command] = {
key1 = key1, key1 = key1,
key2 = key2, key2 = key2,
@@ -34,6 +38,21 @@ local function SaveKeybindSet(setName)
print(string.format("Saved keybind set '%s'!", setName)) print(string.format("Saved keybind set '%s'!", setName))
end end
---@param command string
---@return nil
local function UnbindCommand(command)
if not command or command == "" then
print("Cannot unbind an empty command")
return
end
local keys = { GetBindingKey(command) }
for _, key in ipairs(keys) do
-- print("Unbinding", key)
SetBinding(key)
end
end
---@param setName string ---@param setName string
---@return nil ---@return nil
local function RestoreKeybindSet(setName) local function RestoreKeybindSet(setName)
@@ -53,12 +72,27 @@ local function RestoreKeybindSet(setName)
-- Restore saved bindings -- Restore saved bindings
for command, keys in pairs(set) do for command, keys in pairs(set) do
if keys.key1 then SetBinding(keys.key1, command) end UnbindCommand(command)
if keys.key2 then SetBinding(keys.key2, command) end -- This fucking catastrophe binds a KEY(2) to CLICK A BUTTON (command) as a MOUSE BUTTON (key1)
if string.find(command, "CLICK ") and keys.key2 then
command = string.gsub(command, "CLICK ", "")
local ok = SetBindingClick(keys.key2, command, keys.key1)
if not ok then print("Failed to bind click", keys.key1, command) end
else
if keys.key1 then
local ok = SetBinding(keys.key1, command)
if not ok then print("Failed to bind", keys.key1, command) end
end
if keys.key2 then
local ok = SetBinding(keys.key2, command)
if not ok then print("Failed to bind", keys.key2, command) end
end
end
end end
-- Save the changes -- Save the changes
SaveBindings(GetCurrentBindingSet()) SaveBindings(GetCurrentBindingSet())
SaveBindings(1)
print(string.format("Restored keybind set '%s'", setName)) print(string.format("Restored keybind set '%s'", setName))
end end
@@ -108,14 +142,18 @@ local function ImportKeybindSet(setName, importStr)
local lines = { strsplit("\n", importStr) } local lines = { strsplit("\n", importStr) }
for _, line in ipairs(lines) do for _, line in ipairs(lines) do
local command, key = strsplit(":", line) local command, key, key2 = strsplit(":", line)
if command and key then if command and key then
if not set[command] then set[command] = {} end if string.find(command, "CLICK ") then
if not set[command].key1 then -- I can't believe we have to do this bullshit...
set[command].key1 = key local tmp = key
else key = key2
set[command].key2 = key key2 = tmp
end end
if not set[command] then set[command] = {
key1 = key,
key2 = key2,
} end
end end
end end
@@ -185,9 +223,14 @@ local function ExportKeybindSet(setName)
local export = {} local export = {}
for command, keys in pairs(set) do for command, keys in pairs(set) do
if keys.key1 then table.insert(export, string.format("%s:%s", command, keys.key1)) end if command and keys and (keys.key1 or keys.key2) then
if keys.key2 then table.insert(export, string.format("%s:%s", command, keys.key2)) end local formatted = command
if keys.key1 then formatted = formatted .. ":" .. keys.key1 end
if keys.key2 then formatted = formatted .. ":" .. keys.key2 end
export[#export + 1] = formatted
end end
end
table.sort(export)
local exportStr = table.concat(export, "\n") local exportStr = table.concat(export, "\n")
importExportFrame:Show() importExportFrame:Show()

2
Meta

Submodule Meta updated: 51a48175fa...9aae83307e

View File

@@ -32,3 +32,38 @@ The addon also includes a keybind saver that allows you to save and restore your
## Known Issues ## Known Issues
* Aliases do not work both ways. If you alias `Berserking` as `War Stomp` and then save a set that contains `Berserking`, it will work properly if you restore that set on a tauren. However, if you save a set that contains `War Stomp` and try to restore it on a troll, it will fail. This will be addressed in a future version. * Aliases do not work both ways. If you alias `Berserking` as `War Stomp` and then save a set that contains `Berserking`, it will work properly if you restore that set on a tauren. However, if you save a set that contains `War Stomp` and try to restore it on a troll, it will fail. This will be addressed in a future version.
---
## Обзор
ActionBarSaver:Daved - это аддон для сохранения и восстановления профилей панели действий и привязок клавиш. Это полная переработка оригинального аддона ActionBarSaver.
Все наборы сохраняются по классу, а не по персонажу. Кроме того, при просмотре профилей вы будете видеть только профили, относящиеся к вашему классу.
## Использование ActionBarSaver
`/abs save <set>` - Сохраняет ваш текущий набор панели действий под данным <set>\
`/abs restore <set>` - Восстанавливает сохраненный <set>\
`/abs delete <set>` - Удаляет сохраненный <set>\
`/abs list` - Списывает все сохраненные наборы\
`/abs alias <spellID> <aliasID>` - Добавляет псевдоним с <aliasID> к <spellID>\
`/abs unalias <spellID>` - Удаляет все псевдонимы, связанные с <spellID>\
`/abs aliases` - Списывает все псевдонимы заклинаний\
`/abs export <set>` - Открывает окно для экспорта данного <set>\
`/abs import <set>` - Открывает окно для импорта набора панели действий
## Использование KeybindSaver
Аддон также включает в себя сохранитель привязок, который позволяет сохранять и восстанавливать ваши привязки. Это полезно для поддержания различных настроек привязок для разных специализаций или ситуаций.
`/kbs save <set>` - Сохраняет ваши текущие привязки под данным <set>\
`/kbs restore <set>` - Восстанавливает сохраненный <set>\
`/kbs delete <set>` - Удаляет сохраненный <set>\
`/kbs list` - Списывает все сохраненные наборы\
`/kbs export <set>` - Открывает окно для экспорта данного <set>\
`/kbs import <set>` - Открывает окно для импорта набора привязок
## Известные проблемы
* Псевдонимы не работают в обе стороны. Если вы дадите псевдоним `Berserking` как `War Stomp` и затем сохраните набор, содержащий `Berserking`, он будет работать должным образом, если вы восстановите этот набор на таурене. Однако, если вы сохраните набор, содержащий `War Stomp`, и попытаетесь восстановить его на тролле, он не сработает. Это будет исправлено в будущей версии.

View File

@@ -16,8 +16,7 @@ echo "Tag: $TAG"
echo "Building the thing..." echo "Building the thing..."
sed -i "s/## Version: .*/## Version: $TAG/" ActionBarSaverDaved.toc sed -i "s/## Version: .*/## Version: $TAG/" ActionBarSaverDaved.toc
sed -i "s/local VERSION = .*/local VERSION = \"$TAG\"/" ActionBarSaverDaved.lua git add ActionBarSaverDaved.toc
git add ActionBarSaverDaved.toc ActionBarSaverDaved.lua
git commit -m "Release $TAG" git commit -m "Release $TAG"
git tag -f $TAG git tag -f $TAG
git push origin $TAG git push origin $TAG
@@ -31,7 +30,7 @@ rm -rf ActionBarSaverDaved
echo "Creating a release..." echo "Creating a release..."
TOKEN="$GITEA_API_KEY" TOKEN="$GITEA_API_KEY"
GITEA="https://git.site.quack-lab.dev" GITEA="https://git.site.quack-lab.dev"
REPO="dave/wow_ABS" REPO="dave/wow-ActionBarSaverDaved"
# Create a release # Create a release
RELEASE_RESPONSE=$(curl -s -X POST \ RELEASE_RESPONSE=$(curl -s -X POST \
-H "Authorization: token $TOKEN" \ -H "Authorization: token $TOKEN" \