Mercurial > wow > inventory
diff Core.lua @ 10:c4d0e5d47e10
Ok, please don?t crash again you silly Ace3 multiselect dropdown box. I know you?re itchy, but there?s nothing I can do for you.
Cleaned up group management layout, added a duplicate group button.
Track at character data is erased when exporting/importing groups.
Duplicate items are erased when importing groups.
Bug fixes and speed increases in Summary.
Added a button to refresh the cache.
Added a slider to increase caching speed.
Auction value will no longer be cached if the threshold was set to 0.
author | Zerotorescue |
---|---|
date | Tue, 12 Oct 2010 02:08:37 +0200 |
parents | 3bac0bdd59e2 |
children | 10a2244f7ff0 |
line wrap: on
line diff
--- a/Core.lua Sun Oct 10 04:37:21 2010 +0200 +++ b/Core.lua Tue Oct 12 02:08:37 2010 +0200 @@ -527,6 +527,7 @@ end end end, + confirm = true, dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. }, }, @@ -1017,6 +1018,7 @@ return temp; end, get = GetMultiOption, + confirm = true, dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. arg = "overrideTrackAtCharacters", }, @@ -1143,16 +1145,16 @@ name = "Group Management", desc = "Rename, delete or export this group.", args = { - rename = { + actions = { order = 10, type = "group", - name = "Rename", + name = "Actions", inline = true, args = { rename = { order = 10, type = "input", - name = "New group name", + name = "Rename group - New name", desc = "Change the name of this group to something else. You can also use item links here as you wish.", validate = ValidateGroupName, set = function(info, value) @@ -1170,18 +1172,27 @@ get = function(info) return groupIdToName[info[2]]; end, - width = "double", }, - }, - }, - delete = { - order = 20, - type = "group", - name = "Delete", - inline = true, - args = { + duplicate = { + order = 20, + type = "input", + name = "Duplicate group - New name", + desc = "Duplicate this group. You can also use item links here as you wish.\n\nAll item data will be erased.", + validate = ValidateGroupName, + set = function(info, value) + local oldGroupName = groupIdToName[info[2]]; + + addon.db.global.groups[value] = CopyTable(addon.db.global.groups[oldGroupName]); + + -- Reset item data (duplicate items me no want) + addon.db.global.groups[value].items = nil; + + addon:FillGroupOptions(); + end, + get = false, + }, delete = { - order = 10, + order = 30, type = "execute", name = "Delete group", desc = "Delete the currently selected group.", @@ -1198,7 +1209,7 @@ }, }, export = { - order = 30, + order = 40, type = "group", name = "Export", inline = true, @@ -1455,51 +1466,42 @@ end local result, temp = AceSerializer:Deserialize(current); - local name; if not temp.name then print("|cffff0000The provided data is not supported.|r"); - return; + elseif ValidateGroupName(nil, temp.name) ~= true then + print(("|cffff0000Aborting: A group named \"%s\" already exists.|r"):format(temp.name)); else - name = temp.name; + local name = temp.name; temp.name = nil; print(("Importing %s..."):format(name)); + + -- Remove items that are already in another group + for value, _ in pairs(temp.items) do + local itemId = tonumber(itemid); + + if not itemId then + print(("\"%s\" is not a number."):format(value)); + temp.items[value] = nil; + elseif InGroup(itemId) then + print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId))); + temp.items[value] = nil; + else + -- Ensure the keys are numeric + temp.items[value] = nil; + temp.items[itemId] = true; + end + end + + -- Ensure this data isn't received (this would be buggy as exports from other accounts won't know what to do with this) + temp.trackAtCharacters = nil; + temp.overrideTrackAtCharacters = nil; + + self.db.global.groups[name] = temp; end - - local newGroupName = string.trim(string.lower(name or "")); - - for name in pairs(self.db.global.groups) do - if string.lower(name) == newGroupName then - print(("|cffff0000Aborting: A group named \"%s\" already exists.|r"):format(name)); - return; - end - end - - -- Remove items that are already in another group - for value, _ in pairs(temp.items) do - local itemId = tonumber(itemid); - - if not itemId then - print(("\"%s\" is not a number."):format(value)); - temp.items[value] = nil; - elseif InGroup(itemId) then - print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId))); - temp.items[value] = nil; - else - -- Ensure the keys are numeric - temp.items[value] = nil; - temp.items[itemId] = true; - end - end - - -- Ensure this data isn't received (this would be buggy as exports from other accounts won't know what to do with this) - temp.trackAtCharacters = nil; - temp.overrideTrackAtCharacters = nil; - - self.db.global.groups[name] = temp; - - self:FillGroupOptions(); end + + self:FillGroupOptions(); end, get = false, width = "full",