Mercurial > wow > inventory
comparison Core.lua @ 176:26c750a10b14
Renamed Inventorium debug channel to IMDebug (so it?s easier to recognize only IM changes, not from other addons), write /im d to register this new channel.
Implemented stock alerts.
Added ?don?t alert at characters? option which allows you to track groups at characters without being bothered about low stock.
You can change the speed of the stock alert at the extra config tab.
author | Zerotorescue |
---|---|
date | Sun, 30 Jan 2011 15:39:18 +0100 |
parents | d367da49a490 |
children | 38cc9221202d |
comparison
equal
deleted
inserted
replaced
175:7aa0850952ef | 176:26c750a10b14 |
---|---|
39 -- General | 39 -- General |
40 auctionPricingAddon = "Auctioneer", | 40 auctionPricingAddon = "Auctioneer", |
41 itemCountAddon = "Altoholic", | 41 itemCountAddon = "Altoholic", |
42 craftingAddon = "AdvancedTradeSkillWindow", | 42 craftingAddon = "AdvancedTradeSkillWindow", |
43 trackAtCharacters = { }, | 43 trackAtCharacters = { }, |
44 dontAlertAtCharacters = { }, | |
44 localItemData = { | 45 localItemData = { |
45 ["Bag"] = true, | 46 ["Bag"] = true, |
46 ["Auction House"] = true, | 47 ["Auction House"] = true, |
47 }, | 48 }, |
48 | 49 |
64 summaryThresholdShow = 10, | 65 summaryThresholdShow = 10, |
65 summaryHidePriceThreshold = false, | 66 summaryHidePriceThreshold = false, |
66 | 67 |
67 -- Global (can't be overridden) | 68 -- Global (can't be overridden) |
68 hideHelp = false, | 69 hideHelp = false, |
70 scanInterval = "0.1", -- string because the associated select requires it to be | |
69 summary = { | 71 summary = { |
70 speed = 5, | 72 speed = 5, |
71 width = 700, | 73 width = 700, |
72 height = 600, | 74 height = 600, |
73 }, | 75 }, |
110 self:RegisterSlash(function(this) | 112 self:RegisterSlash(function(this) |
111 this.debugChannel = false; | 113 this.debugChannel = false; |
112 for i = 1, NUM_CHAT_WINDOWS do | 114 for i = 1, NUM_CHAT_WINDOWS do |
113 local name = GetChatWindowInfo(i); | 115 local name = GetChatWindowInfo(i); |
114 | 116 |
115 if string.upper(name) == "DEBUG" then | 117 if string.upper(name) == "IMDEBUG" then |
116 addon:Print("A debug channel already exists, removing the old one... (" .. i .. ")"); | 118 addon:Print("A debug channel already exists, removing the old one... (" .. i .. ")"); |
117 FCF_Close(_G["ChatFrame" .. i]); | 119 FCF_Close(_G["ChatFrame" .. i]); |
118 end | 120 end |
119 end | 121 end |
120 | 122 |
121 if not this.debugChannel then | 123 if not this.debugChannel then |
122 -- Create a new debug channel | 124 -- Create a new debug channel |
123 local chatFrame = FCF_OpenNewWindow('Debug'); | 125 local chatFrame = FCF_OpenNewWindow('IMDebug'); |
124 ChatFrame_RemoveAllMessageGroups(chatFrame); | 126 ChatFrame_RemoveAllMessageGroups(chatFrame); |
125 this.debugChannel = chatFrame; | 127 this.debugChannel = chatFrame; |
126 | 128 |
127 addon:Print("New debug channel created."); | 129 addon:Print("New debug channel created."); |
128 end | 130 end |
129 end, { "d", "debug" }); | 131 end, { "d", "debug", "imdebug" }); |
130 | 132 |
131 -- Remember this character is on this account | 133 -- Remember this character is on this account |
132 local playerName = UnitName("player"); | 134 local playerName = UnitName("player"); |
133 if not self.db.factionrealm.characters[playerName] then | 135 if not self.db.factionrealm.characters[playerName] then |
134 self.db.factionrealm.characters[playerName] = true; | 136 self.db.factionrealm.characters[playerName] = true; |
371 function addon:DisplayItemCount(value, minimumStock) | 373 function addon:DisplayItemCount(value, minimumStock) |
372 if value == -1 then | 374 if value == -1 then |
373 return "|cffffff00Unknown|r"; | 375 return "|cffffff00Unknown|r"; |
374 elseif value == -3 then | 376 elseif value == -3 then |
375 return "|cffffff00Unknown|r"; | 377 return "|cffffff00Unknown|r"; |
378 elseif value == -4 then | |
379 return "|cffffff00-|r"; | |
376 else | 380 else |
377 return sformat("%s / %d", self:ColorCode(value, minimumStock), minimumStock); | 381 return sformat("%s / %d", self:ColorCode(value, minimumStock), minimumStock); |
378 end | 382 end |
379 end | 383 end |
380 | 384 |
505 return itemLink; | 509 return itemLink; |
506 end | 510 end |
507 | 511 |
508 -- Debug | 512 -- Debug |
509 | 513 |
510 local function ReadableTable(t) | 514 local function ReadableTable(t, includeKeys, jumps) |
511 local temp = ""; | 515 local tabs = ""; |
512 | 516 for i = 1, (jumps or 0) do |
517 tabs = tabs .. " "; | |
518 end | |
519 | |
520 local temp = "{\n"; | |
521 | |
513 for i, v in pairs(t) do | 522 for i, v in pairs(t) do |
514 temp = temp .. " {"; | |
515 if type(v) == "table" then | 523 if type(v) == "table" then |
516 temp = temp .. ReadableTable(v) .. ","; | 524 if includeKeys then |
525 local key = (type(i) == "number" and tostring(i)) or string.format("\"%s\"", tostring(i)); | |
526 | |
527 temp = string.format("%s%s [%s] => %s,\n", temp, tabs, key, ReadableTable(v, includeKeys, (jumps or 0) + 1)); | |
528 else | |
529 temp = string.format("%s%s %s,\n", temp, tabs, ReadableTable(v, includeKeys, (jumps or 0) + 1)); | |
530 end | |
517 else | 531 else |
518 temp = temp .. tostring(v) .. ","; | 532 if includeKeys then |
519 end | 533 local key = (type(i) == "number" and tostring(i)) or string.format("\"%s\"", tostring(i)); |
520 temp = temp .. "}"; | 534 local value = (type(v) == "number" and tostring(v)) or string.format("\"%s\"", tostring(v)); |
521 end | 535 |
522 | 536 temp = string.format("%s%s [%s] => %s,\n", temp, tabs, key, value); |
537 else | |
538 local value = (type(v) == "number" and tostring(v)) or string.format("\"%s\"", tostring(v)); | |
539 | |
540 temp = string.format("%s%s %s,\n", temp, tabs, value); | |
541 end | |
542 end | |
543 end | |
544 temp = temp .. tabs .. "}"; | |
545 | |
523 return temp; | 546 return temp; |
524 end | 547 end |
525 | 548 |
526 function addon:Debug(t, ...) | 549 function addon:Debug(t, ...) |
527 if not self.debugChannel and self.debugChannel ~= false then | 550 if not self.debugChannel and self.debugChannel ~= false then |
529 self.debugChannel = false; | 552 self.debugChannel = false; |
530 | 553 |
531 for i = 1, NUM_CHAT_WINDOWS do | 554 for i = 1, NUM_CHAT_WINDOWS do |
532 local name = GetChatWindowInfo(i); | 555 local name = GetChatWindowInfo(i); |
533 | 556 |
534 if name:upper() == "DEBUG" then | 557 if name:upper() == "IMDEBUG" then |
535 self.debugChannel = _G["ChatFrame" .. i]; | 558 self.debugChannel = _G["ChatFrame" .. i]; |
536 end | 559 end |
537 end | 560 end |
538 end | 561 end |
539 | 562 |
540 if self.debugChannel then | 563 if self.debugChannel then |
541 if type(t) == "table" then | 564 if type(t) == "table" then |
542 t = ReadableTable(t); | 565 t = ReadableTable(t, true); |
543 end | 566 end |
544 | 567 |
545 self.debugChannel:AddMessage("|cffffff00Inventorium|r:" .. sformat(t, ...)); | 568 self.debugChannel:AddMessage("|cffffff00Inventorium|r:" .. sformat(t, ...)); |
546 end | 569 end |
547 end | 570 end |