Mercurial > wow > itemauditor
comparison Modules/Utils.lua @ 16:56de19d9bd8d
Cleaned up the messages. You can turn the notifications of price changes off and those messages will only show gold or silver if they are more than 0. I have also removed the dependency on AceConsole because it doesn't allow changing the color of the addon name when I print messages.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Sat, 03 Jul 2010 10:05:53 -0700 |
parents | 44e70a3fdb19 |
children | ff9a698caebc |
comparison
equal
deleted
inserted
replaced
15:44e70a3fdb19 | 16:56de19d9bd8d |
---|---|
2 local addon = _G[addonName] | 2 local addon = _G[addonName] |
3 | 3 |
4 addonTable.utils = addon | 4 addonTable.utils = addon |
5 IAUtils = addon | 5 IAUtils = addon |
6 | 6 |
7 function addon:FormatMoney(money) | 7 function addon:FormatMoney(copper) |
8 color = "|cFFFFFFFF" | |
8 local prefix = "" | 9 local prefix = "" |
9 if money < 0 then | 10 if copper < 0 then |
10 prefix = "-" | 11 prefix = "-" |
12 copper = abs(copper) | |
11 end | 13 end |
12 return prefix .. Altoholic:GetMoneyString(abs(money), WHITE, false) | 14 |
15 local gold = floor( copper / 10000 ); | |
16 copper = mod(copper, 10000) | |
17 local silver = floor( copper / 100 ); | |
18 copper = mod(copper, 100) | |
19 | |
20 | |
21 copper = color..format(COPPER_AMOUNT_TEXTURE, copper, 13, 13) | |
22 if silver > 0 or gold > 0 then | |
23 silver = color..format(SILVER_AMOUNT_TEXTURE, silver, 13, 13) .. ' ' | |
24 else | |
25 silver = "" | |
26 end | |
27 if gold > 0 then | |
28 gold = color..format(GOLD_AMOUNT_TEXTURE, gold, 13, 13) .. ' ' | |
29 else | |
30 gold = "" | |
31 end | |
32 | |
33 return format("%s%s%s%s", prefix, gold, silver, copper) | |
13 end | 34 end |
14 | 35 |
15 -- This is only here to make sure this doesn't blow up if ReplaceItemCache is never called | 36 -- This is only here to make sure this doesn't blow up if ReplaceItemCache is never called |
16 local item_db = {} | 37 local item_db = {} |
17 | 38 |