Mercurial > wow > itemauditor
comparison Core.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 | 67f4151d535c |
comparison
equal
deleted
inserted
replaced
15:44e70a3fdb19 | 16:56de19d9bd8d |
---|---|
1 local addonName, addonTable = ...; | 1 local addonName, addonTable = ...; |
2 _G[addonName] = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceConsole-3.0", "AceEvent-3.0", "AceBucket-3.0") | 2 _G[addonName] = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceEvent-3.0", "AceBucket-3.0") |
3 local addon = _G[addonName] | 3 local addon = _G[addonName] |
4 addonTable.ItemAuditor = addon | 4 addonTable.ItemAuditor = addon |
5 | 5 |
6 local utils = addonTable.utils | 6 local utils = addonTable.utils |
7 | 7 |
15 local GOLD = "|cFFFFD700" | 15 local GOLD = "|cFFFFD700" |
16 | 16 |
17 function addon:OnInitialize() | 17 function addon:OnInitialize() |
18 local DB_defaults = { | 18 local DB_defaults = { |
19 char = { | 19 char = { |
20 debug = false, | |
21 ah = 1, | 20 ah = 1, |
22 use_quick_auctions = false, | 21 use_quick_auctions = false, |
22 }, | |
23 profile = { | |
24 messages = { | |
25 debug = false, | |
26 cost_updates = true, | |
27 } | |
23 }, | 28 }, |
24 factionrealm = { | 29 factionrealm = { |
25 item_account = {}, | 30 item_account = {}, |
26 items = {}, | 31 items = {}, |
27 }, | 32 }, |
51 self:RemoveItem(link) | 56 self:RemoveItem(link) |
52 end | 57 end |
53 end | 58 end |
54 | 59 |
55 self:RefreshQAGroups() | 60 self:RefreshQAGroups() |
61 end | |
62 | |
63 function addon:Print(message) | |
64 local prefix = "|cFFA3CEFF"..tostring( self ).."|r: " | |
65 DEFAULT_CHAT_FRAME:AddMessage( prefix .. message) | |
56 end | 66 end |
57 | 67 |
58 function addon:GetCurrentInventory() | 68 function addon:GetCurrentInventory() |
59 local i = {} | 69 local i = {} |
60 local bagID | 70 local bagID |
227 item.invested = item.invested + value | 237 item.invested = item.invested + value |
228 itemName = GetItemInfo(realLink) | 238 itemName = GetItemInfo(realLink) |
229 end | 239 end |
230 | 240 |
231 if abs(value) > 0 then | 241 if abs(value) > 0 then |
232 self:Debug("Updated price of " .. itemName .. " to " .. self:FormatMoney(item.invested) .. "(change: " .. self:FormatMoney(value) .. ")") | 242 if item.invested <= 0 then |
233 | 243 if self.db.profile.messages.cost_updates then |
234 if item.invested <= 0 then | 244 self:Print(format("Updated price of %s from %s to %s. %sYou just made a profit of %s.", itemName, self:FormatMoney(item.invested - value), self:FormatMoney(0), GREEN, self:FormatMoney(abs(item.invested)))) |
235 self:Debug("Updated price of " .. itemName .. " to " ..self:FormatMoney(0)) | 245 end |
236 self:RemoveItem(link) | 246 self:RemoveItem(link) |
237 -- This doesn't work when you mail the only copy of an item you have to another character. | 247 -- This doesn't work when you mail the only copy of an item you have to another character. |
238 --[[ | 248 --[[ |
239 elseif item.count == 0 and realLink and Altoholic:GetItemCount(self:GetIDFromLink(realLink)) then | 249 elseif item.count == 0 and realLink and Altoholic:GetItemCount(self:GetIDFromLink(realLink)) then |
240 self:Print("You ran out of " .. itemName .. " and never recovered " .. self:FormatMoney(item.invested)) | 250 self:Print("You ran out of " .. itemName .. " and never recovered " .. self:FormatMoney(item.invested)) |
241 self:RemoveItem(link) | 251 self:RemoveItem(link) |
242 ]] | 252 ]] |
253 else | |
254 if self.db.profile.messages.cost_updates then | |
255 self:Print(format("Updated price of %s from %s to %s. (total change:%s)", itemName, self:FormatMoney(item.invested - value), self:FormatMoney(item.invested), self:FormatMoney(value))) | |
256 end | |
243 end | 257 end |
244 end | 258 end |
245 | 259 |
246 if realLink ~= nil then | 260 if realLink ~= nil then |
247 addon:UpdateQAThreshold(realLink) | 261 addon:UpdateQAThreshold(realLink) |