Mercurial > wow > inventory
comparison Modules/Config.lua @ 161:fcc95c62d232
Premade groups can now be combined into a single group to allow easier adding of a combination (e.g. all glyphs at once).
| author | Zerotorescue |
|---|---|
| date | Sun, 23 Jan 2011 18:24:00 +0100 |
| parents | e136c99fe5bb |
| children | e31b68c119df |
comparison
equal
deleted
inserted
replaced
| 160:08b887885bd5 | 161:fcc95c62d232 |
|---|---|
| 236 end | 236 end |
| 237 | 237 |
| 238 -- Parse items in group and show these | 238 -- Parse items in group and show these |
| 239 for itemId, _ in pairs(addon.db.profile.groups[groupName].items) do | 239 for itemId, _ in pairs(addon.db.profile.groups[groupName].items) do |
| 240 ref[itemId] = tblRemoveItemTemplate; | 240 ref[itemId] = tblRemoveItemTemplate; |
| 241 end | |
| 242 end | |
| 243 | |
| 244 local function ImportPremadeItemsGroup(groupName, name) | |
| 245 local premadeItemGroup = addon.defaultGroups[name]; | |
| 246 | |
| 247 addon:Print(("Importing items from the premade group \"|cfffed000%s|r\"."):format(name)); | |
| 248 | |
| 249 -- Remember we imported this group and it's version so if it is ever changed, people can be notified | |
| 250 if not addon.db.profile.groups[groupName].premadeGroups then | |
| 251 addon.db.profile.groups[groupName].premadeGroups = {}; | |
| 252 end | |
| 253 addon.db.profile.groups[groupName].premadeGroups[name] = premadeItemGroup.version; | |
| 254 | |
| 255 for itemId, version in pairs(premadeItemGroup.items) do | |
| 256 if version > 0 then | |
| 257 -- Sanity check | |
| 258 itemId = itemId and tonumber(itemId); | |
| 259 | |
| 260 local itemData = addon.ItemData:New(itemId); | |
| 261 | |
| 262 if not itemId then | |
| 263 addon:Print(("\"|cfffed000%s|r\" is not a number."):format(name), addon.Colors.Red); | |
| 264 elseif itemData:InGroup() then | |
| 265 addon:Print(("Skipping |cfffed000%s|r as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red); | |
| 266 elseif itemData:AddToGroup(groupName) then | |
| 267 addon:Print(("Added %s to the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), groupName ), addon.Colors.Green); | |
| 268 end | |
| 269 end | |
| 241 end | 270 end |
| 242 end | 271 end |
| 243 | 272 |
| 244 -- Default group | 273 -- Default group |
| 245 local defaultGroup = { | 274 local defaultGroup = { |
| 985 return temp; | 1014 return temp; |
| 986 end, | 1015 end, |
| 987 set = function(info, value) | 1016 set = function(info, value) |
| 988 local groupName = groupIdToName[info[2]]; | 1017 local groupName = groupIdToName[info[2]]; |
| 989 | 1018 |
| 990 addon:Print(("Importing items from the premade group \"|cfffed000%s|r\"."):format(value)); | 1019 local premadeItemGroup = addon.defaultGroups[value]; |
| 991 | 1020 |
| 992 -- Remember we imported this group and it's version so if it is ever changed, people can be notified | 1021 if premadeItemGroup.isParent and premadeItemGroup.childs then |
| 993 if not addon.db.profile.groups[groupName].premadeGroups then | 1022 for _, premadeItemGroupName in pairs(premadeItemGroup.childs) do |
| 994 addon.db.profile.groups[groupName].premadeGroups = {}; | 1023 ImportPremadeItemsGroup(groupName, premadeItemGroupName); |
| 995 end | |
| 996 addon.db.profile.groups[groupName].premadeGroups[value] = addon.defaultGroups[value].version; | |
| 997 | |
| 998 for itemId, version in pairs(addon.defaultGroups[value].items) do | |
| 999 if version > 0 then | |
| 1000 -- Sanity check | |
| 1001 itemId = itemId and tonumber(itemId); | |
| 1002 | |
| 1003 local itemData = addon.ItemData:New(itemId); | |
| 1004 | |
| 1005 if not itemId then | |
| 1006 addon:Print(("\"|cfffed000%s|r\" is not a number."):format(value), addon.Colors.Red); | |
| 1007 elseif itemData:InGroup() then | |
| 1008 addon:Print(("Skipping |cfffed000%s|r as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red); | |
| 1009 elseif itemData:AddToGroup(groupName) then | |
| 1010 addon:Print(("Added %s to the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), groupName ), addon.Colors.Green); | |
| 1011 end | |
| 1012 end | 1024 end |
| 1025 else | |
| 1026 ImportPremadeItemsGroup(groupName, value); | |
| 1013 end | 1027 end |
| 1014 | 1028 |
| 1015 if AceConfigRegistry then | 1029 if AceConfigRegistry then |
| 1016 -- Now rebuild the list | 1030 -- Now rebuild the list |
| 1017 AceConfigRegistry:NotifyChange("InventoriumOptions"); | 1031 AceConfigRegistry:NotifyChange("InventoriumOptions"); |
