Mercurial > wow > itemauditor
changeset 55:234896be4087
Adding an option to direct ItemAuditor output to a different chat frame
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Thu, 22 Jul 2010 23:17:57 -0700 |
parents | 52f691a2a3a4 |
children | 8afc1ac9bf58 |
files | CHANGELOG.txt Core.lua Modules/Options.lua |
diffstat | 3 files changed, 60 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGELOG.txt Wed Jul 21 22:40:21 2010 -0700 +++ b/CHANGELOG.txt Thu Jul 22 23:17:57 2010 -0700 @@ -1,3 +1,7 @@ +2010-07-22 Asa Ayers <Asa.Ayers@Gmail.com> + +- I Added an option to direct ItemAuditor output to a different chat frame. + 2010-07-21 Asa Ayers <Asa.Ayers@Gmail.com> - Fixed a bug where if you attached money and items to a piece of mail it would count all of the money as postage.
--- a/Core.lua Wed Jul 21 22:40:21 2010 -0700 +++ b/Core.lua Thu Jul 22 23:17:57 2010 -0700 @@ -18,6 +18,7 @@ use_quick_auctions = false, crafting_threshold = 1, auction_threshold = 0.15, + output_chat_frame = nil, }, profile = { messages = { @@ -109,8 +110,7 @@ local printPrefix = "|cFFA3CEFFItemAuditor|r: " function addon:Print(message, ...) message = format(message, ...) - DEFAULT_CHAT_FRAME:AddMessage( printPrefix .. tostring(message)) - self:Log(message) + self:GetSelectedChatWindow():AddMessage( printPrefix .. tostring(message)) end function addon:GetCurrentInventory()
--- a/Modules/Options.lua Wed Jul 21 22:40:21 2010 -0700 +++ b/Modules/Options.lua Thu Jul 22 23:17:57 2010 -0700 @@ -12,6 +12,52 @@ -- craftingThresholdsDisplay[key] = value end +local windowIndex = nil +function addon:GetChatWindowList() + local windows = {} + for i=1, NUM_CHAT_WINDOWS do + local name, _, _, _, _, _, shown, locked, docked = GetChatWindowInfo(i) + if (name ~= "") and (docked or shown) then + windows[i] = name + end + end + return windows +end + +function addon:GetChatWindowIndex() + local cf = self.db.char.output_chat_frame + if not windowIndex then + for i=1, NUM_CHAT_WINDOWS do + local name, _, _, _, _, _, shown, locked, docked = GetChatWindowInfo(i) + if name ~= "" and cf ~= nil and cf == name then + self:SetChatWindow(nil, i) + end + end + end + return windowIndex +end + + +local selectedWindow = nil + +function addon:SetChatWindow(info, index) + windowIndex = index + local name = GetChatWindowInfo(windowIndex) + + self.db.char.output_chat_frame = name + selectedWindow = nil +end + +function addon:GetSelectedChatWindow() + if not selectedWindow then + selectedWindow = _G["ChatFrame"..self:GetChatWindowIndex()] + end + if (selectedWindow) then + return selectedWindow + end + return DEFAULT_CHAT_FRAME +end + local options = { handler = addon, name = "ItemAuditor", @@ -57,6 +103,14 @@ disabled = 'IsQADisabled', order = 1, }, + output = { + type = "select", + name = "Output", + desc = "", + values = 'GetChatWindowList', + get = 'GetChatWindowIndex', + set = 'SetChatWindow', + }, }, },