Mercurial > wow > itemauditor
comparison Core.lua @ 1:6c87720c301c
comment/debugging code cleanup
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Thu, 20 May 2010 22:34:37 -0700 |
| parents | 169f5211fc7f |
| children | bbcf81868171 |
comparison
equal
deleted
inserted
replaced
| 0:169f5211fc7f | 1:6c87720c301c |
|---|---|
| 9 local ORANGE = "|cFFFF7F00" | 9 local ORANGE = "|cFFFF7F00" |
| 10 local TEAL = "|cFF00FF9A" | 10 local TEAL = "|cFF00FF9A" |
| 11 local GOLD = "|cFFFFD700" | 11 local GOLD = "|cFFFFD700" |
| 12 | 12 |
| 13 function addon:OnInitialize() | 13 function addon:OnInitialize() |
| 14 -- declare defaults to be used in the DB | |
| 15 local DB_defaults = { | 14 local DB_defaults = { |
| 16 char = { | 15 char = { |
| 17 debug = false | 16 debug = false |
| 18 }, | 17 }, |
| 19 factionrealm = { | 18 factionrealm = { |
| 20 item_account = {} | 19 item_account = {} |
| 21 }, | 20 }, |
| 22 } | 21 } |
| 23 self.db = LibStub("AceDB-3.0"):New("ItemAuditorDB", DB_defaults, true) | 22 self.db = LibStub("AceDB-3.0"):New("ItemAuditorDB", DB_defaults, true) |
| 24 self.db.factionrealm.backup = self.db.factionrealm.item_account | |
| 25 | 23 |
| 26 self.db.char.debug = true | 24 self.db.char.debug = true |
| 27 | 25 |
| 28 --[[ | |
| 29 Fine Thread = 510 | |
| 30 Greater Magic Essence = 120000 | |
| 31 Simple Kilt = 5913 | |
| 32 Bolt of Linen Cloth = 5672 | |
| 33 ]] | |
| 34 | |
| 35 self:RegisterOptions() | 26 self:RegisterOptions() |
| 36 | |
| 37 self:Debug("Hello, world! OnInitialize") | |
| 38 | 27 |
| 39 self:RegisterEvent("MAIL_SHOW") | 28 self:RegisterEvent("MAIL_SHOW") |
| 40 self:WatchBags() | 29 self:WatchBags() |
| 41 end | 30 end |
| 42 | 31 |
| 43 function IA_tcount(tab) | 32 local function IA_tcount(tab) |
| 44 local n = #tab | 33 local n = #tab |
| 45 if (n == 0) then | 34 if (n == 0) then |
| 46 for _ in pairs(tab) do | 35 for _ in pairs(tab) do |
| 47 n = n + 1 | 36 n = n + 1 |
| 48 end | 37 end |
| 89 | 78 |
| 90 function addon:RegisterOptions() | 79 function addon:RegisterOptions() |
| 91 self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ItemAuditor", "ItemAuditor") | 80 self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ItemAuditor", "ItemAuditor") |
| 92 | 81 |
| 93 LibStub("AceConfig-3.0"):RegisterOptionsTable("ItemAuditor", options, {"ia"}) | 82 LibStub("AceConfig-3.0"):RegisterOptionsTable("ItemAuditor", options, {"ia"}) |
| 94 | |
| 95 self:RegisterChatCommand("fuck", "ChatCommand") | |
| 96 end | 83 end |
| 97 | 84 |
| 98 function addon:GetMessage(info) | 85 function addon:GetMessage(info) |
| 99 return self.message | 86 return self.message |
| 100 end | 87 end |
| 241 self.lastMailScan = self:ScanMail() | 228 self.lastMailScan = self:ScanMail() |
| 242 self:UnregisterEvent("MAIL_SHOW") | 229 self:UnregisterEvent("MAIL_SHOW") |
| 243 self:RegisterEvent("MAIL_CLOSED") | 230 self:RegisterEvent("MAIL_CLOSED") |
| 244 self:RegisterEvent("MAIL_INBOX_UPDATE") | 231 self:RegisterEvent("MAIL_INBOX_UPDATE") |
| 245 self:Debug("MAIL_SHOW complete") | 232 self:Debug("MAIL_SHOW complete") |
| 246 -- the mail scanner will handle everything | |
| 247 -- self:UnwatchBags() | |
| 248 end | 233 end |
| 249 | 234 |
| 250 function addon:MAIL_CLOSED() | 235 function addon:MAIL_CLOSED() |
| 251 addon:UnregisterEvent("MAIL_CLOSED") | 236 addon:UnregisterEvent("MAIL_CLOSED") |
| 252 self:UnregisterEvent("MAIL_INBOX_UPDATE") | 237 self:UnregisterEvent("MAIL_INBOX_UPDATE") |
| 253 self:RegisterEvent("MAIL_SHOW") | 238 self:RegisterEvent("MAIL_SHOW") |
| 254 -- self:WatchBags() | |
| 255 end | 239 end |
| 256 | 240 |
| 257 function addon:MAIL_INBOX_UPDATE() | 241 function addon:MAIL_INBOX_UPDATE() |
| 258 local newScan = addon:ScanMail() | 242 local newScan = addon:ScanMail() |
| 259 local diff | 243 local diff |
| 358 end | 342 end |
| 359 end | 343 end |
| 360 | 344 |
| 361 self.lastInventory = currentInventory | 345 self.lastInventory = currentInventory |
| 362 end | 346 end |
| 363 -- /run ItemAuditor.db.factionrealm.item_account["Tiger Lily"] = -586625 | |
| 364 -- /run ItemAuditor.db.factionrealm.item_account["Icy Pigment"] = -12303 | |
| 365 -- /run ItemAuditor.db.factionrealm.item_account["Azure Pigment"] = -258357 | |
| 366 | 347 |
| 367 function addon:GetItemCost(itemName, countModifier) | 348 function addon:GetItemCost(itemName, countModifier) |
| 368 local invested = abs(self.db.factionrealm.item_account[itemName] or 0) | 349 local invested = abs(self.db.factionrealm.item_account[itemName] or 0) |
| 369 | 350 |
| 370 if invested > 0 then | 351 if invested > 0 then |
