comparison Modules/Utils.lua @ 8:0271e781b154

Working on converting the database to store items as links instead of names.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 23 Jun 2010 23:47:48 -0700
parents bbba2fae0f69
children 374dd1a90d02
comparison
equal deleted inserted replaced
7:bbba2fae0f69 8:0271e781b154
12 prefix = "-" 12 prefix = "-"
13 end 13 end
14 return prefix .. Altoholic:GetMoneyString(abs(money), WHITE, false) 14 return prefix .. Altoholic:GetMoneyString(abs(money), WHITE, false)
15 end 15 end
16 16
17 -- This is only here to make sure this doesn't blow up if ReplaceItemCache is never called 17 -- This is only here to make sure this doesn't blow up if ReplaceItemCache is never called
18 local item_db = {} 18 local item_db = {}
19 19
20 function addon:ReplaceItemCache(new_cache) 20 function addon:ReplaceItemCache(new_cache)
21 item_db = new_cache 21 item_db = new_cache
22 end 22 end
69 end 69 end
70 end 70 end
71 return n 71 return n
72 end 72 end
73 73
74 function addon:GetSafeLink(link)
75 if link ~= string.match(link, '.-:[-0-9]+[:0-9]*') then
76 link = link and string.match(link, "|H(.-):([-0-9]+):([0-9]+)|h")
77 end
78 return link and string.gsub(link, ":0:0:0:0:0:0", "")
79 end
80
81 function addon:GetIDFromLink(link)
82 local _, _, _, _, Id = string.find(link, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
83 return tonumber(Id)
84 end
74 85
75 function addon:GetDebug(info) 86 function addon:GetDebug(info)
76 return true 87 return true
77 -- return self.db.char.debug 88 -- return self.db.char.debug
78 end 89 end