Mercurial > wow > inventory
diff 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 |
line wrap: on
line diff
--- a/Core.lua Thu Jan 27 22:51:55 2011 +0100 +++ b/Core.lua Sun Jan 30 15:39:18 2011 +0100 @@ -41,6 +41,7 @@ itemCountAddon = "Altoholic", craftingAddon = "AdvancedTradeSkillWindow", trackAtCharacters = { }, + dontAlertAtCharacters = { }, localItemData = { ["Bag"] = true, ["Auction House"] = true, @@ -66,6 +67,7 @@ -- Global (can't be overridden) hideHelp = false, + scanInterval = "0.1", -- string because the associated select requires it to be summary = { speed = 5, width = 700, @@ -112,7 +114,7 @@ for i = 1, NUM_CHAT_WINDOWS do local name = GetChatWindowInfo(i); - if string.upper(name) == "DEBUG" then + if string.upper(name) == "IMDEBUG" then addon:Print("A debug channel already exists, removing the old one... (" .. i .. ")"); FCF_Close(_G["ChatFrame" .. i]); end @@ -120,13 +122,13 @@ if not this.debugChannel then -- Create a new debug channel - local chatFrame = FCF_OpenNewWindow('Debug'); + local chatFrame = FCF_OpenNewWindow('IMDebug'); ChatFrame_RemoveAllMessageGroups(chatFrame); this.debugChannel = chatFrame; addon:Print("New debug channel created."); end - end, { "d", "debug" }); + end, { "d", "debug", "imdebug" }); -- Remember this character is on this account local playerName = UnitName("player"); @@ -373,6 +375,8 @@ return "|cffffff00Unknown|r"; elseif value == -3 then return "|cffffff00Unknown|r"; + elseif value == -4 then + return "|cffffff00-|r"; else return sformat("%s / %d", self:ColorCode(value, minimumStock), minimumStock); end @@ -507,19 +511,38 @@ -- Debug -local function ReadableTable(t) - local temp = ""; - +local function ReadableTable(t, includeKeys, jumps) + local tabs = ""; + for i = 1, (jumps or 0) do + tabs = tabs .. " "; + end + + local temp = "{\n"; + for i, v in pairs(t) do - temp = temp .. " {"; if type(v) == "table" then - temp = temp .. ReadableTable(v) .. ","; + if includeKeys then + local key = (type(i) == "number" and tostring(i)) or string.format("\"%s\"", tostring(i)); + + temp = string.format("%s%s [%s] => %s,\n", temp, tabs, key, ReadableTable(v, includeKeys, (jumps or 0) + 1)); + else + temp = string.format("%s%s %s,\n", temp, tabs, ReadableTable(v, includeKeys, (jumps or 0) + 1)); + end else - temp = temp .. tostring(v) .. ","; + if includeKeys then + local key = (type(i) == "number" and tostring(i)) or string.format("\"%s\"", tostring(i)); + local value = (type(v) == "number" and tostring(v)) or string.format("\"%s\"", tostring(v)); + + temp = string.format("%s%s [%s] => %s,\n", temp, tabs, key, value); + else + local value = (type(v) == "number" and tostring(v)) or string.format("\"%s\"", tostring(v)); + + temp = string.format("%s%s %s,\n", temp, tabs, value); + end end - temp = temp .. "}"; end - + temp = temp .. tabs .. "}"; + return temp; end @@ -531,7 +554,7 @@ for i = 1, NUM_CHAT_WINDOWS do local name = GetChatWindowInfo(i); - if name:upper() == "DEBUG" then + if name:upper() == "IMDEBUG" then self.debugChannel = _G["ChatFrame" .. i]; end end @@ -539,7 +562,7 @@ if self.debugChannel then if type(t) == "table" then - t = ReadableTable(t); + t = ReadableTable(t, true); end self.debugChannel:AddMessage("|cffffff00Inventorium|r:" .. sformat(t, ...));