Mercurial > wow > itemauditor
comparison Modules/Utils.lua @ 86:8d5ad3b71f6f
Removed references to Skillet in core functionality. Skillet really should be optional.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Sat, 07 Aug 2010 11:16:21 -0700 |
parents | 32d53abee666 |
children | 26f45b6e8d4d |
comparison
equal
deleted
inserted
replaced
85:a425f8345087 | 86:8d5ad3b71f6f |
---|---|
63 return (copper or 0) + ((gold or 0) * COPPER_PER_GOLD) + ((silver or 0) * COPPER_PER_SILVER) | 63 return (copper or 0) + ((gold or 0) * COPPER_PER_GOLD) + ((silver or 0) * COPPER_PER_SILVER) |
64 end | 64 end |
65 | 65 |
66 | 66 |
67 local tmp_item_cache = {} | 67 local tmp_item_cache = {} |
68 function Utils.GetItemID(itemName) | 68 function Utils.GetItemID(item) |
69 if tmp_item_cache[itemName] == nil then | 69 if not item then |
70 local _, itemLink = GetItemInfo (itemName); | 70 return nil |
71 end | |
72 | |
73 if tmp_item_cache[item] == nil then | |
74 -- Whether item is a link or a name, both should return the full link | |
75 DevTools_Dump(item) | |
76 local _, itemLink = GetItemInfo (item); | |
71 if itemLink ~= nil then | 77 if itemLink ~= nil then |
72 local _, _, _, _, itemID = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") | 78 local _, _, _, _, itemID = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") |
73 tmp_item_cache[itemName] = tonumber(itemID) | 79 tmp_item_cache[item] = tonumber(itemID) |
74 end | 80 end |
75 end | 81 end |
76 | 82 |
77 if tmp_item_cache[itemName] == nil then | 83 if tmp_item_cache[item] == nil then |
78 for link, data in pairs(ItemAuditor.db.factionrealm.items) do | 84 for link, data in pairs(ItemAuditor.db.factionrealm.items) do |
79 local name, itemLink = GetItemInfo (link); | 85 local name, itemLink = GetItemInfo (link); |
80 if name == itemName then | 86 if name == item then |
81 local _, _, _, _, itemID = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") | 87 local _, _, _, _, itemID = string.find(itemLink, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") |
82 tmp_item_cache[itemName] = tonumber(itemID) | 88 tmp_item_cache[item] = tonumber(itemID) |
83 end | 89 end |
84 end | 90 end |
85 | 91 |
86 end | 92 end |
87 | 93 |
88 return tmp_item_cache[itemName] | 94 return tmp_item_cache[item] |
89 end | 95 end |
90 | 96 |
91 | 97 |
92 function ItemAuditor:GetLinkFromName(itemName) | 98 function ItemAuditor:GetLinkFromName(itemName) |
93 local itemID = self:GetItemID(itemName) | 99 local itemID = self:GetItemID(itemName) |