Mercurial > wow > itemauditor
comparison Modules/Options.lua @ 65:32d53abee666
Converting ItemAuditor modules into true modules instead of a bunch of files that all write to the ItemAuditor table.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Tue, 27 Jul 2010 18:15:38 -0700 |
parents | e7d287cc3b02 |
children | b6c30a5156f9 |
comparison
equal
deleted
inserted
replaced
64:e92a5adf75bf | 65:32d53abee666 |
---|---|
2 local Options = ItemAuditor:NewModule("Options") | 2 local Options = ItemAuditor:NewModule("Options") |
3 | 3 |
4 local currentFaction = UnitFactionGroup("player") | 4 local currentFaction = UnitFactionGroup("player") |
5 local AHFactions = { currentFaction, 'Neutral' } | 5 local AHFactions = { currentFaction, 'Neutral' } |
6 | 6 |
7 -- TODO: Convert this to a text field. | |
7 local craftingThresholds = {5000, 10000, 50000} | 8 local craftingThresholds = {5000, 10000, 50000} |
8 local craftingThresholdsDisplay = {} | 9 local craftingThresholdsDisplay = {} |
9 | 10 |
10 local currentVersion = "@project-version@" | 11 local currentVersion = "@project-version@" |
11 | 12 |
13 craftingThresholdsDisplay[key] = ItemAuditor:FormatMoney(value, '', true) | 14 craftingThresholdsDisplay[key] = ItemAuditor:FormatMoney(value, '', true) |
14 -- craftingThresholdsDisplay[key] = value | 15 -- craftingThresholdsDisplay[key] = value |
15 end | 16 end |
16 | 17 |
17 local windowIndex = nil | 18 local windowIndex = nil |
18 function ItemAuditor:GetChatWindowList() | 19 function Options.GetChatWindowList() |
19 local windows = {} | 20 local windows = {} |
20 for i=1, NUM_CHAT_WINDOWS do | 21 for i=1, NUM_CHAT_WINDOWS do |
21 local name, _, _, _, _, _, shown, locked, docked = GetChatWindowInfo(i) | 22 local name, _, _, _, _, _, shown, locked, docked = GetChatWindowInfo(i) |
22 if (name ~= "") and (docked or shown) then | 23 if (name ~= "") and (docked or shown) then |
23 windows[i] = name | 24 windows[i] = name |
24 end | 25 end |
25 end | 26 end |
26 return windows | 27 return windows |
27 end | 28 end |
28 | 29 |
29 function ItemAuditor:GetChatWindowIndex() | 30 function Options:GetChatWindowIndex() |
30 local cf = self.db.char.output_chat_frame | 31 local cf = ItemAuditor.db.char.output_chat_frame |
31 if not windowIndex then | 32 if not windowIndex then |
32 for i=1, NUM_CHAT_WINDOWS do | 33 for i=1, NUM_CHAT_WINDOWS do |
33 local name, _, _, _, _, _, shown, locked, docked = GetChatWindowInfo(i) | 34 local name, _, _, _, _, _, shown, locked, docked = GetChatWindowInfo(i) |
34 if name ~= "" and cf ~= nil and cf == name then | 35 if name ~= "" and cf ~= nil and cf == name then |
35 self:SetChatWindow(nil, i) | 36 Options.SetChatWindow(nil, i) |
36 end | 37 end |
37 end | 38 end |
38 end | 39 end |
39 return windowIndex | 40 return windowIndex |
40 end | 41 end |
41 | 42 |
42 | 43 |
43 local selectedWindow = nil | 44 local selectedWindow = nil |
44 | 45 |
45 function ItemAuditor:SetChatWindow(info, index) | 46 function Options.SetChatWindow(info, index) |
46 windowIndex = index | 47 windowIndex = index |
47 local name = GetChatWindowInfo(windowIndex) | 48 local name = GetChatWindowInfo(windowIndex) |
48 | 49 |
49 self.db.char.output_chat_frame = name | 50 ItemAuditor.db.char.output_chat_frame = name |
50 selectedWindow = nil | 51 selectedWindow = nil |
51 end | 52 end |
52 | 53 |
53 function ItemAuditor:GetSelectedChatWindow() | 54 function Options.GetSelectedChatWindow() |
54 if not selectedWindow then | 55 if not selectedWindow then |
55 local index = self:GetChatWindowIndex() | 56 local index = Options.GetChatWindowIndex() |
56 if index then | 57 if index then |
57 selectedWindow = _G["ChatFrame"..index] | 58 selectedWindow = _G["ChatFrame"..index] |
58 end | 59 end |
59 end | 60 end |
60 if (selectedWindow) then | 61 if (selectedWindow) then |
110 }, | 111 }, |
111 output = { | 112 output = { |
112 type = "select", | 113 type = "select", |
113 name = "Output", | 114 name = "Output", |
114 desc = "", | 115 desc = "", |
115 values = 'GetChatWindowList', | 116 values = Options.GetChatWindowList, |
116 get = 'GetChatWindowIndex', | 117 get = Options.GetChatWindowIndex, |
117 set = 'SetChatWindow', | 118 set = Options.SetChatWindow, |
118 }, | 119 }, |
119 }, | 120 }, |
120 }, | 121 }, |
121 | 122 |
122 qa_options = { | 123 qa_options = { |