Remove unecessary garbage
Are you kidding me? Producing more trash than saving space
This commit is contained in:
92
Actions.lua
92
Actions.lua
@@ -31,7 +31,7 @@ local function RestoreActionButton(self, index, actionButton)
|
||||
|
||||
if not actionButton then return true, nil end
|
||||
|
||||
local aliases = self.db.class.spellAliases[actionButton.id] or {}
|
||||
local aliases = ActionBarSaverReloaded.spellAliases[actionButton.id] or {}
|
||||
local ids = Array.insert(aliases, actionButton.id, 1)
|
||||
|
||||
for _, id in ipairs(ids) do
|
||||
@@ -80,8 +80,8 @@ local function AddWarning(warnings, macroName, usages)
|
||||
end
|
||||
|
||||
function SaveSet(setName)
|
||||
if Str.nullOrEmpty(setName) then
|
||||
self:Print("Set name cannot be empty")
|
||||
if not setName or setName == "" then
|
||||
print("Set name cannot be empty")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -106,25 +106,25 @@ function SaveSet(setName)
|
||||
end
|
||||
end
|
||||
|
||||
self.db.class.sets[setName] = set
|
||||
self:Print(string.format("Saved set '%s'!", setName))
|
||||
Array.iter(warnings, function(warning) self:Print(warning) end)
|
||||
ActionBarSaverReloaded.sets[setName] = set
|
||||
print(string.format("Saved set '%s'!", setName))
|
||||
Array.iter(warnings, function(warning) print(warning) end)
|
||||
end
|
||||
|
||||
function RestoreSet(setName)
|
||||
if Str.nullOrEmpty(setName) then
|
||||
self:Print("Set name cannot be empty")
|
||||
if not setName or setName == "" then
|
||||
print("Set name cannot be empty")
|
||||
return
|
||||
end
|
||||
|
||||
local set = self.db.class.sets[setName]
|
||||
local set = ActionBarSaverReloaded.sets[setName]
|
||||
|
||||
if not set then
|
||||
self:Print(string.format("No set with the name '%s' exists", setName))
|
||||
print(string.format("No set with the name '%s' exists", setName))
|
||||
return
|
||||
end
|
||||
if InCombatLockdown() then
|
||||
self:Print("Cannot restore sets while in combat")
|
||||
print("Cannot restore sets while in combat")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -147,37 +147,37 @@ function RestoreSet(setName)
|
||||
end
|
||||
end
|
||||
|
||||
self:Print(string.format("Restored set '%s'", setName))
|
||||
Array.iter(messages, function(warning) self:Print(warning) end)
|
||||
print(string.format("Restored set '%s'", setName))
|
||||
Array.iter(messages, function(warning) print(warning) end)
|
||||
end
|
||||
|
||||
function DeleteSet(setName)
|
||||
if Str.nullOrEmpty(setName) then
|
||||
self:Print("Set name cannot be empty")
|
||||
if not setName or setName == "" then
|
||||
print("Set name cannot be empty")
|
||||
return
|
||||
end
|
||||
|
||||
if not self.db.class.sets[setName] then
|
||||
self:Print(string.format("No set with the name '%s' exists", setName))
|
||||
if not ActionBarSaverReloaded.sets[setName] then
|
||||
print(string.format("No set with the name '%s' exists", setName))
|
||||
return
|
||||
end
|
||||
|
||||
self.db.class.sets[setName] = nil
|
||||
ActionBarSaverReloaded.sets[setName] = nil
|
||||
|
||||
self:Print(string.format("Deleted set '%s'", setName))
|
||||
print(string.format("Deleted set '%s'", setName))
|
||||
end
|
||||
|
||||
function ListSets()
|
||||
local sets = Dict.keysAsArray(self.db.class.sets)
|
||||
local sets = Dict.keysAsArray(ActionBarSaverReloaded.sets)
|
||||
table.sort(sets)
|
||||
local setsStr = table.concat(sets, ", ")
|
||||
|
||||
self:Print(not Str.nullOrEmpty(setsStr) and setsStr or "No sets found")
|
||||
print(not Str.nullOrEmpty(setsStr) and setsStr or "No sets found")
|
||||
end
|
||||
|
||||
function AliasSpell(args)
|
||||
if Str.nullOrEmpty(args) then
|
||||
self:Print("Must provide args in the format 'spellID aliasID'")
|
||||
if not args or args == "" then
|
||||
print("Must provide args in the format 'spellID aliasID'")
|
||||
return
|
||||
end
|
||||
local spellID, aliasID = string.match(args, "(%d+)%s+(%d+)")
|
||||
@@ -186,63 +186,63 @@ function AliasSpell(args)
|
||||
aliasID = tonumber(aliasID)
|
||||
|
||||
if not (spellID and aliasID) then
|
||||
self:Print(string.format("Could not parse spellID and aliasID from '%s'", args))
|
||||
print(string.format("Could not parse spellID and aliasID from '%s'", args))
|
||||
return
|
||||
end
|
||||
|
||||
local aliases = self.db.class.spellAliases[spellID] or {}
|
||||
local aliases = ActionBarSaverReloaded.spellAliases[spellID] or {}
|
||||
|
||||
if Array.contains(aliases, aliasID) then
|
||||
self:Print(string.format("Spell %d is already aliased by %d", spellID, aliasID))
|
||||
print(string.format("Spell %d is already aliased by %d", spellID, aliasID))
|
||||
return
|
||||
end
|
||||
|
||||
table.insert(aliases, aliasID)
|
||||
self.db.class.spellAliases[spellID] = aliases
|
||||
ActionBarSaverReloaded.spellAliases[spellID] = aliases
|
||||
|
||||
self:Print(string.format("Added %d as an alias for %d", aliasID, spellID))
|
||||
print(string.format("Added %d as an alias for %d", aliasID, spellID))
|
||||
end
|
||||
|
||||
function DeleteSpellAliases(spellID)
|
||||
if Str.nullOrEmpty(spellID) then
|
||||
self:Print("Must provide a valid spellID")
|
||||
if not spellID or spellID == "" then
|
||||
print("Must provide a valid spellID")
|
||||
return
|
||||
end
|
||||
|
||||
spellID = tonumber(spellID)
|
||||
|
||||
if not self.db.class.spellAliases[spellID] then
|
||||
self:Print(string.format("No aliases to remove for spell with ID %d", spellID))
|
||||
if not ActionBarSaverReloaded.spellAliases[spellID] then
|
||||
print(string.format("No aliases to remove for spell with ID %d", spellID))
|
||||
return
|
||||
end
|
||||
|
||||
self.db.class.spellAliases[spellID] = nil
|
||||
ActionBarSaverReloaded.spellAliases[spellID] = nil
|
||||
|
||||
self:Print(string.format("Removed all aliases for spell with ID %d", spellID))
|
||||
print(string.format("Removed all aliases for spell with ID %d", spellID))
|
||||
end
|
||||
|
||||
function ListAliases()
|
||||
local aliases = self.db.class.spellAliases
|
||||
local aliases = ActionBarSaverReloaded.spellAliases
|
||||
|
||||
if Dict.isEmpty(aliases) then
|
||||
self:Print("No aliases found")
|
||||
print("No aliases found")
|
||||
return
|
||||
end
|
||||
|
||||
Dict.iter(self.db.class.spellAliases, function(spellID, aliases)
|
||||
self:Print(string.format("Spell %d is aliased by: %s", spellID, table.concat(aliases, ", ")))
|
||||
Dict.iter(ActionBarSaverReloaded.spellAliases, function(spellID, aliases)
|
||||
print(string.format("Spell %d is aliased by: %s", spellID, table.concat(aliases, ", ")))
|
||||
end)
|
||||
end
|
||||
|
||||
function PrintUsage()
|
||||
self:Print("ABS Slash commands")
|
||||
self:Print("/abs save <set> - Saves your current action bar setup under the given <set>")
|
||||
self:Print("/abs restore <set> - Restores the saved <set>")
|
||||
self:Print("/abs delete <set> - Deletes the saved <set>")
|
||||
self:Print("/abs list - Lists all saved sets")
|
||||
self:Print("/abs alias <spellID> <aliasID> - Adds an alias with <aliasID> to <spellID>")
|
||||
self:Print("/abs unalias <spellID> - Removes all aliases associated with <spellID>")
|
||||
self:Print("/abs aliases - List all spell aliases")
|
||||
print("ABS Slash commands")
|
||||
print("/abs save <set> - Saves your current action bar setup under the given <set>")
|
||||
print("/abs restore <set> - Restores the saved <set>")
|
||||
print("/abs delete <set> - Deletes the saved <set>")
|
||||
print("/abs list - Lists all saved sets")
|
||||
print("/abs alias <spellID> <aliasID> - Adds an alias with <aliasID> to <spellID>")
|
||||
print("/abs unalias <spellID> - Removes all aliases associated with <spellID>")
|
||||
print("/abs aliases - List all spell aliases")
|
||||
end
|
||||
|
||||
SlashCmdList["ABS"] = function(argv)
|
||||
|
||||
Reference in New Issue
Block a user