Mercurial > wow > inventory
comparison Modules/Config.lua @ 140:cd461a41723c
Now keeping track how many times an item has been queued into your favorite crafting addon.
| author | Zerotorescue |
|---|---|
| date | Tue, 18 Jan 2011 11:34:48 +0100 |
| parents | a27948591159 |
| children | 311eb97cb983 |
comparison
equal
deleted
inserted
replaced
| 139:e336a94359d8 | 140:cd461a41723c |
|---|---|
| 93 name = function(info) | 93 name = function(info) |
| 94 local itemName, _, itemRarity = GetItemInfo(info[#info]); | 94 local itemName, _, itemRarity = GetItemInfo(info[#info]); |
| 95 return tostring( 7 - (itemRarity or 0) ) .. (itemName or ""); | 95 return tostring( 7 - (itemRarity or 0) ) .. (itemName or ""); |
| 96 end, | 96 end, |
| 97 get = function(info) | 97 get = function(info) |
| 98 return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side | 98 return tostring(info[#info]); -- Ace is going to be bitching about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side |
| 99 end, | 99 end, |
| 100 set = function(groupId, itemData) | 100 set = function(groupId, itemData) |
| 101 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info. | 101 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info. |
| 102 | 102 |
| 103 if itemData then | 103 if itemData then |
| 150 | 150 |
| 151 if not addon.db.profile.groups[groupName].items then | 151 if not addon.db.profile.groups[groupName].items then |
| 152 addon.db.profile.groups[groupName].items = {}; | 152 addon.db.profile.groups[groupName].items = {}; |
| 153 end | 153 end |
| 154 | 154 |
| 155 -- Merge all items from all groups together | 155 -- Merge all items from all groups together (we only use this to check if an item is already in a group) |
| 156 local items = {}; | 156 local items = {}; |
| 157 for groupName, values in pairs(addon.db.profile.groups) do | 157 for groupName, values in pairs(addon.db.profile.groups) do |
| 158 if values.items then | 158 if values.items then |
| 159 for itemId, _ in pairs(values.items) do | 159 for itemId, count in pairs(values.items) do |
| 160 items[itemId] = true; | 160 items[itemId] = tonumber(count) or 0; |
| 161 end | 161 end |
| 162 end | 162 end |
| 163 end | 163 end |
| 164 | 164 |
| 165 local ref = options.args.groups.args[info[2]].args.add.args.list.args; | 165 local ref = options.args.groups.args[info[2]].args.add.args.list.args; |
| 2015 temp.name = nil; | 2015 temp.name = nil; |
| 2016 addon:Print(("Importing %s..."):format(name)); | 2016 addon:Print(("Importing %s..."):format(name)); |
| 2017 | 2017 |
| 2018 if temp.items then | 2018 if temp.items then |
| 2019 -- Remove items that are already in another group | 2019 -- Remove items that are already in another group |
| 2020 for value, _ in pairs(temp.items) do | 2020 for value, count in pairs(temp.items) do |
| 2021 local itemId = tonumber(value); | 2021 local itemId = tonumber(value); |
| 2022 | 2022 |
| 2023 local itemData = addon.ItemData:New(itemId); | 2023 local itemData = addon.ItemData:New(itemId); |
| 2024 | 2024 |
| 2025 if not itemId then | 2025 if not itemId then |
| 2029 addon:Print(("Skipping %s as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red); | 2029 addon:Print(("Skipping %s as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red); |
| 2030 temp.items[value] = nil; | 2030 temp.items[value] = nil; |
| 2031 else | 2031 else |
| 2032 -- Ensure the keys are numeric | 2032 -- Ensure the keys are numeric |
| 2033 temp.items[value] = nil; | 2033 temp.items[value] = nil; |
| 2034 temp.items[itemId] = true; | 2034 temp.items[itemId] = tonumber(count) or 0; |
| 2035 end | 2035 end |
| 2036 end | 2036 end |
| 2037 end | 2037 end |
| 2038 | 2038 |
| 2039 -- Ensure this data isn't received (this would be silly/buggy as exports from other accounts - with different characters - won't know what to do with this) | 2039 -- Ensure this data isn't received (this would be silly/buggy as exports from other accounts - with different characters - won't know what to do with this) |
