Mercurial > wow > itemauditor
comparison Modules/Utils.lua @ 58:bdf3aba93aa9
Refactored the way the window for /ia invested works so I can add more tabs.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Sun, 25 Jul 2010 15:51:00 -0700 |
| parents | 003de902ae64 |
| children | e7d287cc3b02 |
comparison
equal
deleted
inserted
replaced
| 57:9cb0bc93ed11 | 58:bdf3aba93aa9 |
|---|---|
| 35 else | 35 else |
| 36 gold = "" | 36 gold = "" |
| 37 end | 37 end |
| 38 | 38 |
| 39 return format("%s%s%s%s", prefix, gold, silver, copper) | 39 return format("%s%s%s%s", prefix, gold, silver, copper) |
| 40 end | |
| 41 | |
| 42 -- Copied from QuickAuctions | |
| 43 function ItemAuditor.validateMoney(value) | |
| 44 local gold = tonumber(string.match(value, "([0-9]+)|c([0-9a-fA-F]+)g|r") or string.match(value, "([0-9]+)g")) | |
| 45 local silver = tonumber(string.match(value, "([0-9]+)|c([0-9a-fA-F]+)s|r") or string.match(value, "([0-9]+)s")) | |
| 46 local copper = tonumber(string.match(value, "([0-9]+)|c([0-9a-fA-F]+)c|r") or string.match(value, "([0-9]+)c")) | |
| 47 | |
| 48 if( not gold and not silver and not copper ) then | |
| 49 return false; | |
| 50 -- return L["Invalid monney format entered, should be \"#g#s#c\", \"25g4s50c\" is 25 gold, 4 silver, 50 copper."] | |
| 51 end | |
| 52 | |
| 53 return true | |
| 54 end | |
| 55 | |
| 56 -- Copied from QuickAuctions | |
| 57 function ItemAuditor.parseMoney(value) | |
| 58 local gold = tonumber(string.match(value, "([0-9]+)|c([0-9a-fA-F]+)g|r") or string.match(value, "([0-9]+)g")) | |
| 59 local silver = tonumber(string.match(value, "([0-9]+)|c([0-9a-fA-F]+)s|r") or string.match(value, "([0-9]+)s")) | |
| 60 local copper = tonumber(string.match(value, "([0-9]+)|c([0-9a-fA-F]+)c|r") or string.match(value, "([0-9]+)c")) | |
| 61 | |
| 62 -- Convert it all into copper | |
| 63 return (copper or 0) + ((gold or 0) * COPPER_PER_GOLD) + ((silver or 0) * COPPER_PER_SILVER) | |
| 64 | |
| 40 end | 65 end |
| 41 | 66 |
| 42 -- This is only here to make sure this doesn't blow up if ReplaceItemCache is never called | 67 -- This is only here to make sure this doesn't blow up if ReplaceItemCache is never called |
| 43 local item_db = {} | 68 local item_db = {} |
| 44 | 69 |
