diff --git a/ActionBarSaverReloaded.toc b/ActionBarSaverDaved.toc similarity index 100% rename from ActionBarSaverReloaded.toc rename to ActionBarSaverDaved.toc diff --git a/Actions.lua b/Actions.lua index ac3a2cf..9e87796 100644 --- a/Actions.lua +++ b/Actions.lua @@ -499,13 +499,6 @@ function PrintUsage() print("/abs aliases - List all spell aliases") print("/abs export - Brings up a dialog to export the given ") print("/abs import - Brings up a dialog to import the given ") - print("KBS Slash commands") - print("/kbs save - Saves your current keybind setup under the given ") - print("/kbs restore - Restores the saved ") - print("/kbs delete - Deletes the saved ") - print("/kbs list - Lists all saved sets") - print("/kbs export - Brings up a dialog to export the given ") - print("/kbs import - Brings up a dialog to import the given ") end SlashCmdList["ABS"] = function(argv) diff --git a/KeybindSaver.lua b/KeybindSaver.lua index 8722a16..df614e1 100644 --- a/KeybindSaver.lua +++ b/KeybindSaver.lua @@ -1,4 +1,4 @@ -local ADDON_NAME, shared = ... +local ADDON_NAME = ... -- Initialize saved variables local frame = CreateFrame("Frame") @@ -61,17 +61,20 @@ importExportFrameTextBox:SetScript("OnEscapePressed", function(self) end end) +---@param setName string +---@return nil local function SaveSet(setName) if not setName or setName == "" then print("Set name cannot be empty") return end + ---@type table local set = {} local numBindings = GetNumBindings() for i = 1, numBindings do - local command, category, key1, key2 = GetBinding(i) + local command, _, key1, key2 = GetBinding(i) if key1 or key2 then set[command] = { key1 = key1, key2 = key2, @@ -82,6 +85,8 @@ local function SaveSet(setName) print(string.format("Saved keybind set '%s'!", setName)) end +---@param setName string +---@return nil local function RestoreSet(setName) if not setName or setName == "" then print("Set name cannot be empty") @@ -108,6 +113,8 @@ local function RestoreSet(setName) print(string.format("Restored keybind set '%s'", setName)) end +---@param setName string +---@return nil local function DeleteSet(setName) if not setName or setName == "" then print("Set name cannot be empty") @@ -123,6 +130,7 @@ local function DeleteSet(setName) print(string.format("Deleted keybind set '%s'", setName)) end +---@return nil local function ListSets() local sets = {} for setName in pairs(KeybindSaverDaved.sets) do @@ -138,6 +146,8 @@ local function ListSets() end end +---@param setName string +---@return nil local function ExportSet(setName) local set = KeybindSaverDaved.sets[setName] if not set then @@ -157,6 +167,9 @@ local function ExportSet(setName) importExportFrameTextBox:SetFocus() end +---@param setName string +---@param importStr string +---@return nil local function ImportSet(setName, importStr) if not setName or setName == "" then print("Set name cannot be empty") @@ -182,6 +195,8 @@ local function ImportSet(setName, importStr) print(string.format("Imported keybind set '%s'", setName)) end +---@param setName string +---@return nil local function ImportSetDialogue(setName) if not setName or setName == "" then print("Set name cannot be empty") @@ -193,6 +208,7 @@ local function ImportSetDialogue(setName) importExportFrameTextBox:SetFocus() end +---@return nil local function PrintUsage() print("Keybind Saver Slash Commands:") print("/kbs save - Saves your current keybinds under the given ") @@ -203,7 +219,6 @@ local function PrintUsage() print("/kbs import - Opens a window to import a keybind set") end --- Register slash commands SLASH_KBS1 = "/kbs" SlashCmdList["KBS"] = function(argv) local args = { strsplit(" ", argv) } diff --git a/Main.lua b/Main.lua index eb05127..910d08a 100644 --- a/Main.lua +++ b/Main.lua @@ -1,30 +1,18 @@ -local ADDON_NAME, shared = ... +local ADDON_NAME = ... local frame = CreateFrame("Frame") frame:RegisterEvent("ADDON_LOADED") frame:SetScript("OnEvent", function(self, event, addon) if addon ~= ADDON_NAME then return end + ---@class ActionBarSaverDaved + ---@field spellAliases table ActionBarSaverDaved = ActionBarSaverDaved or {} ActionBarSaverDaved.spellAliases = ActionBarSaverDaved.spellAliases or {} ActionBarSaverDaved.sets = ActionBarSaverDaved.sets or {} -end) --- function ABS:OnInitialize() --- self.commands = { --- save = self.actions.SaveSet, --- restore = self.actions.RestoreSet, --- delete = self.actions.DeleteSet, --- list = self.actions.ListSets, --- alias = self.actions.AliasSpell, --- unalias = self.actions.DeleteSpellAliases, --- aliases = self.actions.ListAliases, --- } --- end --- --- function ABS:HandleCommands(input) --- local cmd, args = Str.split(input, " ", 2) --- local fn = self.commands[Str.toLower(cmd)] --- --- if fn then fn(self, args) else self.actions.PrintUsage(self) end --- end + ---@class KeybindSaverDaved + ---@field sets table> + KeybindSaverDaved = KeybindSaverDaved or {} + KeybindSaverDaved.sets = KeybindSaverDaved.sets or {} +end) diff --git a/README.md b/README.md index e73c794..f6b1246 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,11 @@ ## Overview -ActionBarSaver:Daved is an addon for saving and restoring action bar profiles. It is based on the original ActionBarSaver addon but is a full re-write. +ActionBarSaver:Daved is an addon for saving and restoring action bar profiles and keybindings. It is based on the original ActionBarSaver addon but is a full re-write. All sets are saved by class rather than by character. Additionally, when you list profiles, you will only see profiles that pertain to your class. -Features such as rename have been deleted for simplicity. To perform a rename, simply save the set with a new name and delete the old set. Additionally, restoring a set will no longer try to re-create macros that do not exist. It will simply notify you of the missing macro and restore nothing for that slot. ABS:R will not work properly if you have multiple macros with the same name, and will warn you of potential issues if you restore a set that has a macro with a shared name. - -A new feature has been added for setting up aliases for spells. A common use case for this would be restoring a single set for two characters that share a class but have a different race. For example, you could create a set on a troll shaman that contains `Berserking` and then add an alias for `War Stomp` using `/abs alias 20554 20549`. If you do this, when you restore a set it will first try to restore the proper spell but will also try each alias that you set up. A spell can have as many aliases as you want. - -## Usage +## Action Bar Saver Usage `/abs save ` - Saves your current action bar setup under the given \ `/abs restore ` - Restores the saved \ @@ -18,7 +14,20 @@ A new feature has been added for setting up aliases for spells. A common use cas `/abs list` - Lists all saved sets\ `/abs alias ` - Adds an alias with to \ `/abs unalias ` - Removes all aliases associated with \ -`/abs aliases` - List all spell aliases +`/abs aliases` - List all spell aliases\ +`/abs export ` - Opens a window to export the given \ +`/abs import ` - Opens a window to import an action bar set + +## Keybind Saver Usage + +The addon also includes a keybind saver that allows you to save and restore your keybindings. This is useful for maintaining different keybind setups for different specs or situations. + +`/kbs save ` - Saves your current keybinds under the given \ +`/kbs restore ` - Restores the saved \ +`/kbs delete ` - Deletes the saved \ +`/kbs list` - Lists all saved sets\ +`/kbs export ` - Opens a window to export the given \ +`/kbs import ` - Opens a window to import a keybind set ## Known Issues diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md deleted file mode 100644 index 62af3fc..0000000 --- a/RELEASE_NOTES.md +++ /dev/null @@ -1,31 +0,0 @@ -## 1.0.7 (2024-06-30) - -- Updated for Cata classic - -## 1.0.6 (2023-08-29) - -- TOC bump for ICC patch - -## 1.0.5 (2023-06-20) - -- TOC bump for ToGC patch - -## 1.0.4 (2023-01-18) - -- TOC bump for WOTLK patch - -## 1.0.3 (2022-11-09) - -- Fixed bug with equipment sets not being restored properly - -## 1.0.2 (2022-10-27) - -- Fixed bug where totem sets were not being saved or restored - -## 1.0.1 (2022-09-26) - -- Fixed bug related to restoring sets containing companions and mounts - -## 1.0.0 (2022-07-15) - -- Initial re-write of the addon