vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | Auctioneer Addon for World of Warcraft(tm). |
||
3 | Version: 3.9.0.1000 (Kangaroo) |
||
4 | Revision: $Id: AucCommand.lua 994 2006-09-07 01:30:33Z mentalpower $ |
||
5 | |||
6 | Auctioneer command functions. |
||
7 | Functions to allow setting of values, switching commands etc. |
||
8 | |||
9 | License: |
||
10 | This program is free software; you can redistribute it and/or |
||
11 | modify it under the terms of the GNU General Public License |
||
12 | as published by the Free Software Foundation; either version 2 |
||
13 | of the License, or (at your option) any later version. |
||
14 | |||
15 | This program is distributed in the hope that it will be useful, |
||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
18 | GNU General Public License for more details. |
||
19 | |||
20 | You should have received a copy of the GNU General Public License |
||
21 | along with this program(see GPL.txt); if not, write to the Free Software |
||
22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||
23 | ]] |
||
24 | |||
25 | --Local function prototypes |
||
26 | local register, convertKhaos, getKhaosDefault, setKhaosSetKeyParameter, setKhaosSetKeyValue, getKhaosLocaleList, getKhaosDurationsList, getKhaosProtectionList, getKhaosFinishList, registerKhaos, buildCommandMap, commandMap, commandMapRev, command, chatPrintHelp, onOff, clear, alsoInclude, isValidLocale, setLocale, default, getFrameNames, getFrameIndex, setFrame, protectWindow, auctionDuration, finish, genVarSet, percentVarSet, numVarSet, setFilter, getFilterVal, getFilter, findFilterClass, setFilter, getLocale |
||
27 | |||
28 | |||
29 | function register() |
||
30 | if (Khaos) then |
||
31 | if (not Auctioneer_Khaos_Registered) then |
||
32 | registerKhaos(); |
||
33 | end |
||
34 | end |
||
35 | end |
||
36 | |||
37 | -- Convert a single key in a table of configuration settings |
||
38 | function convertConfig(t, key, values, ...) --Local |
||
39 | local modified = false; |
||
40 | local v = nil; |
||
41 | |||
42 | for i,localizedKey in ipairs(arg) do |
||
43 | if (t[localizedKey] ~= nil) then |
||
44 | v = t[localizedKey]; |
||
45 | t[localizedKey] = nil; |
||
46 | modified = true; |
||
47 | end |
||
48 | end |
||
49 | if (t[key] ~= nil) then v = t[key]; end |
||
50 | |||
51 | if (v ~= nil) then |
||
52 | if (values[v] ~= nil) then |
||
53 | t[key] = values[v]; |
||
54 | modified = true; |
||
55 | else |
||
56 | t[key] = v; |
||
57 | end |
||
58 | end |
||
59 | |||
60 | return modified; |
||
61 | end |
||
62 | |||
63 | -- Convert Khaos options to standardized keys and values |
||
64 | function convertKhaos() |
||
65 | if (not Khaos_Configurations) then return; end |
||
66 | |||
67 | -- Array that maps localized versions of strings to standardized |
||
68 | local convertOnOff = { ['apagado'] = 'off', -- esES |
||
69 | ['prendido'] = 'on', -- esES |
||
70 | } |
||
71 | |||
72 | local localeConvMap = { ['apagado'] = 'default', |
||
73 | ['prendido'] = 'default', |
||
74 | ['off'] = 'default', |
||
75 | ['on'] = 'default', |
||
76 | } |
||
77 | |||
78 | -- Format: standardizedKey, valueMap, esES, localizedKey |
||
79 | local conversions = { |
||
80 | -- Localized stuff to get rid of |
||
81 | { 'show-warning', convertOnOff, 'ver-advertencia' }, |
||
82 | { 'show-verbose', convertOnOff, 'ver-literal' }, |
||
83 | { 'show-stats', convertOnOff, 'ver-estadisticas'}, |
||
84 | { 'show-average', convertOnOff, 'ver-promedio' }, |
||
85 | { 'show-median', convertOnOff, 'ver-mediano' }, |
||
86 | { 'show-suggest', convertOnOff, 'ver-sugerencia' }, |
||
87 | { 'embed', convertOnOff, 'integrado' }, |
||
88 | { 'show-embed-blankline', convertOnOff, 'ver-integrado-lineavacia' }, |
||
89 | { 'pct-bidmarkdown', convertOnOff, 'pct-menosoferta' }, |
||
90 | { 'pct-markup', convertOnOff, 'pct-mas' }, |
||
91 | { 'pct-maxless', convertOnOff, 'pct-sinmaximo' }, |
||
92 | { 'pct-nocomp', convertOnOff, 'pct-sincomp' }, |
||
93 | { 'pct-underlow', convertOnOff, 'pct-bajomenor' }, |
||
94 | { 'pct-undermkt', convertOnOff, 'pct-bajomercado' }, |
||
95 | { 'autofill', convertOnOff, 'autoinsertar' }, |
||
96 | { 'show-link', convertOnOff, 'ver-enlace' }, |
||
97 | |||
98 | -- Changed key names |
||
99 | { 'locale', convertOnOff, 'AuctioneerLocale' }, |
||
100 | { 'printframe', convertOnOff, 'AuctioneerPrintFrame' }, |
||
101 | { 'also', convertOnOff, 'AuctioneerInclude' }, |
||
102 | { 'enabled', convertOnOff, 'AuctioneerEnable' }, |
||
103 | } |
||
104 | |||
105 | -- Prepend placeholder for the table parameter |
||
106 | for i,c in ipairs(conversions) do |
||
107 | table.insert(c, 1, nil) |
||
108 | end |
||
109 | |||
110 | for i,config in ipairs(Khaos_Configurations) do |
||
111 | if (config.configuration and config.configuration.Auctioneer) then |
||
112 | local converted = false; |
||
113 | -- Run the defined conversions |
||
114 | for i,c in ipairs(conversions) do |
||
115 | -- Replace first parameter with actual table to process |
||
116 | -- Inserting here will cause problems for the second iteration |
||
117 | c[1] = config.configuration.Auctioneer |
||
118 | converted = convertConfig(unpack(c)) or converted |
||
119 | end |
||
120 | |||
121 | if (converted) then |
||
122 | Auctioneer.Util.ChatPrint("Converted old Khaos configuration \"" .. config.name .. "\"") |
||
123 | end |
||
124 | end |
||
125 | end |
||
126 | end |
||
127 | |||
128 | function getKhaosDefault(filter) |
||
129 | if (filter == "also") then |
||
130 | return Auctioneer.Core.Constants.FilterDefaults[filter]; |
||
131 | elseif (Auctioneer.Core.Constants.FilterDefaults[filter] == 'on') then |
||
132 | return true; |
||
133 | elseif (Auctioneer.Core.Constants.FilterDefaults[filter] == 'off') then |
||
134 | return false; |
||
135 | else |
||
136 | return Auctioneer.Core.Constants.FilterDefaults[filter]; |
||
137 | end |
||
138 | end |
||
139 | |||
140 | |||
141 | function setKhaosSetKeyParameter(key, parameter, value) --Local |
||
142 | if (Auctioneer_Khaos_Registered) then |
||
143 | if (Khaos.getSetKey("Auctioneer", key)) then |
||
144 | Khaos.setSetKeyParameter("Auctioneer", key, parameter, value) |
||
145 | else |
||
146 | EnhTooltip.DebugPrint("setKhaosSetKeyParameter(): key " .. key .. " does not exist") |
||
147 | end |
||
148 | end |
||
149 | end |
||
150 | |||
151 | function setKhaosSetKeyValue(key, value) --Local |
||
152 | if (Auctioneer_Khaos_Registered) then |
||
153 | local kKey = Khaos.getSetKey("Auctioneer", key) |
||
154 | |||
155 | if (not kKey) then |
||
156 | EnhTooltip.DebugPrint("setKhaosSetKeyParameter(): key " .. key .. " does not exist") |
||
157 | elseif (kKey.checked ~= nil) then |
||
158 | if (type(value) == "string") then value = (value == "on"); end |
||
159 | Khaos.setSetKeyParameter("Auctioneer", key, "checked", value) |
||
160 | elseif (kKey.value ~= nil) then |
||
161 | Khaos.setSetKeyParameter("Auctioneer", key, "value", value) |
||
162 | else |
||
163 | EnhTooltip.DebugPrint("setKhaosSetKeyValue(): don't know how to update key ", key) |
||
164 | end |
||
165 | end |
||
166 | end |
||
167 | |||
168 | function getKhaosLocaleList() --Local |
||
169 | local options = { [_AUCT('CmdDefault')] = 'default' }; |
||
170 | for locale, data in pairs(AuctioneerLocalizations) do |
||
171 | options[locale] = locale; |
||
172 | end |
||
173 | return options |
||
174 | end |
||
175 | |||
176 | function getKhaosLoadList() --Local |
||
177 | return { |
||
178 | [_AUCT('GuiLoad_Always')] = 'always', |
||
179 | [_AUCT('GuiLoad_Never')] = 'never', |
||
180 | [_AUCT('GuiLoad_AuctionHouse')] = 'auctionhouse' |
||
181 | } |
||
182 | end |
||
183 | |||
184 | function getKhaosDurationsList() --Local |
||
185 | local list = {} |
||
186 | for i = 0, 3 do |
||
187 | list[_AUCT('CmdAuctionDuration'..i)] = i |
||
188 | end |
||
189 | return list |
||
190 | end |
||
191 | |||
192 | function getKhaosProtectionList() --Local |
||
193 | local list = {} |
||
194 | for i = 0, 2 do |
||
195 | list[_AUCT('CmdProtectWindow'..i)] = i |
||
196 | end |
||
197 | return list |
||
198 | end |
||
199 | |||
200 | function getKhaosFinishList() --Local |
||
201 | local list = {} |
||
202 | for i = 0, 2 do |
||
203 | list[_AUCT('CmdFinish'..i)] = i |
||
204 | end |
||
205 | return list |
||
206 | end |
||
207 | |||
208 | function registerKhaos() |
||
209 | |||
210 | -- Convert old Khaos settings to current optionSet |
||
211 | convertKhaos(); |
||
212 | |||
213 | local optionSet = { |
||
214 | id="Auctioneer"; |
||
215 | text="Auctioneer"; |
||
216 | helptext=function() |
||
217 | return _AUCT('GuiMainHelp') |
||
218 | end; |
||
219 | difficulty=1; |
||
220 | default={checked=true}; |
||
221 | options={ |
||
222 | { |
||
223 | id="Header"; |
||
224 | text="Auctioneer"; |
||
225 | helptext=function() |
||
226 | return _AUCT('GuiMainHelp') |
||
227 | end; |
||
228 | type=K_HEADER; |
||
229 | difficulty=1; |
||
230 | }; |
||
231 | { |
||
232 | id="enabled"; |
||
233 | type=K_TEXT; |
||
234 | text=function() |
||
235 | return _AUCT('GuiMainEnable') |
||
236 | end; |
||
237 | helptext=function() |
||
238 | return _AUCT('HelpOnoff') |
||
239 | end; |
||
240 | callback=function(state) |
||
241 | Auctioneer.Command.OnOff(state.checked); |
||
242 | end; |
||
243 | feedback=function(state) |
||
244 | if (state.checked) then |
||
245 | return _AUCT('StatOn'); |
||
246 | else |
||
247 | return _AUCT('StatOff'); |
||
248 | end |
||
249 | end; |
||
250 | check=true; |
||
251 | default={checked=true}; |
||
252 | disabled={checked=false}; |
||
253 | difficulty=1; |
||
254 | }; |
||
255 | { |
||
256 | id="LoadSettings"; |
||
257 | type=K_PULLDOWN; |
||
258 | setup = { |
||
259 | options = getKhaosLoadList; |
||
260 | multiSelect = false; |
||
261 | }; |
||
262 | text=function() |
||
263 | return _AUCT('GuiLoad') |
||
264 | end; |
||
265 | helptext=function() |
||
266 | return _AUCT('HelpLoad') |
||
267 | end; |
||
268 | callback=function(state) end; |
||
269 | feedback=function(state) |
||
270 | mainHandler("load " .. state.value, "GUI") |
||
271 | end; |
||
272 | default={value = 'auctionhouse'}; |
||
273 | disabled={value = 'never'}; |
||
274 | difficulty=1; |
||
275 | }; |
||
276 | { |
||
277 | id="locale"; |
||
278 | type=K_PULLDOWN; |
||
279 | setup = { |
||
280 | options = getKhaosLocaleList; |
||
281 | multiSelect = false; |
||
282 | }; |
||
283 | text=function() |
||
284 | return _AUCT('GuiLocale') |
||
285 | end; |
||
286 | helptext=function() |
||
287 | return _AUCT('HelpLocale') |
||
288 | end; |
||
289 | callback = function(state) |
||
290 | end; |
||
291 | feedback = function (state) |
||
292 | Auctioneer.Command.SetLocale(state.value); |
||
293 | return string.format(_AUCT('FrmtActSet'), _AUCT('CmdLocale'), state.value); |
||
294 | end; |
||
295 | default = { |
||
296 | value = Auctioneer.Command.GetLocale(); |
||
297 | }; |
||
298 | disabled = { |
||
299 | value = Auctioneer.Command.GetLocale(); |
||
300 | }; |
||
301 | dependencies={enabled={checked=true;}}; |
||
302 | difficulty=2; |
||
303 | }; |
||
304 | { |
||
305 | id="AuctioneerStatsHeader"; |
||
306 | type=K_HEADER; |
||
307 | text=function() |
||
308 | return _AUCT('GuiStatsHeader') |
||
309 | end; |
||
310 | helptext=function() |
||
311 | return _AUCT('GuiStatsHelp') |
||
312 | end; |
||
313 | difficulty=2; |
||
314 | }; |
||
315 | { |
||
316 | id="show-stats"; |
||
317 | type=K_TEXT; |
||
318 | text=function() |
||
319 | return _AUCT('GuiStatsEnable') |
||
320 | end; |
||
321 | helptext=function() |
||
322 | return _AUCT('HelpStats') |
||
323 | end; |
||
324 | callback=function(state) |
||
325 | Auctioneer.Command.GenVarSet("show-stats", state.checked); |
||
326 | end; |
||
327 | feedback=function(state) |
||
328 | if (state.checked) then |
||
329 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('ShowStats'))); |
||
330 | else |
||
331 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('ShowStats'))); |
||
332 | end |
||
333 | end; |
||
334 | check=true; |
||
335 | default={checked=getKhaosDefault('show-stats')}; |
||
336 | disabled={checked=false}; |
||
337 | dependencies={enabled={checked=true;}}; |
||
338 | difficulty=1; |
||
339 | }; |
||
340 | { |
||
341 | id="show-average"; |
||
342 | type=K_TEXT; |
||
343 | text=function() |
||
344 | return _AUCT('GuiAverages') |
||
345 | end; |
||
346 | helptext=function() |
||
347 | return _AUCT('HelpAverage') |
||
348 | end; |
||
349 | callback=function(state) |
||
350 | Auctioneer.Command.GenVarSet("show-average", state.checked); |
||
351 | end; |
||
352 | feedback=function(state) |
||
353 | if (state.checked) then |
||
354 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('ShowAverage'))); |
||
355 | else |
||
356 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('ShowAverage'))); |
||
357 | end |
||
358 | end; |
||
359 | check=true; |
||
360 | default={checked=getKhaosDefault('show-average')}; |
||
361 | disabled={checked=false}; |
||
362 | dependencies={enabled={checked=true;}}; |
||
363 | difficulty=2; |
||
364 | }; |
||
365 | { |
||
366 | id="show-median"; |
||
367 | type=K_TEXT; |
||
368 | text=function() |
||
369 | return _AUCT('GuiMedian') |
||
370 | end; |
||
371 | helptext=function() |
||
372 | return _AUCT('HelpMedian') |
||
373 | end; |
||
374 | callback=function(state) |
||
375 | Auctioneer.Command.GenVarSet("show-median", state.checked); |
||
376 | end; |
||
377 | feedback=function(state) |
||
378 | if (state.checked) then |
||
379 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('ShowMedian'))); |
||
380 | else |
||
381 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('ShowMedian'))); |
||
382 | end |
||
383 | end; |
||
384 | check=true; |
||
385 | default={checked=getKhaosDefault('show-median')}; |
||
386 | disabled={checked=false}; |
||
387 | dependencies={enabled={checked=true;}}; |
||
388 | difficulty=2; |
||
389 | }; |
||
390 | { |
||
391 | id="show-suggest"; |
||
392 | type=K_TEXT; |
||
393 | text=function() |
||
394 | return _AUCT('GuiSuggest') |
||
395 | end; |
||
396 | helptext=function() |
||
397 | return _AUCT('HelpSuggest') |
||
398 | end; |
||
399 | callback=function(state) |
||
400 | Auctioneer.Command.GenVarSet("show-suggest", state.checked); |
||
401 | end; |
||
402 | feedback=function(state) |
||
403 | if (state.checked) then |
||
404 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('ShowSuggest'))); |
||
405 | else |
||
406 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('ShowSuggest'))); |
||
407 | end |
||
408 | end; |
||
409 | check=true; |
||
410 | default={checked=getKhaosDefault('show-suggest')}; |
||
411 | disabled={checked=false}; |
||
412 | dependencies={enabled={checked=true;}}; |
||
413 | difficulty=2; |
||
414 | }; |
||
415 | { |
||
416 | id="show-verbose"; |
||
417 | type=K_TEXT; |
||
418 | text=function() |
||
419 | return _AUCT('GuiVerbose') |
||
420 | end; |
||
421 | helptext=function() |
||
422 | return _AUCT('HelpVerbose') |
||
423 | end; |
||
424 | callback=function(state) |
||
425 | Auctioneer.Command.GenVarSet("show-verbose", state.checked); |
||
426 | end; |
||
427 | feedback=function(state) |
||
428 | if (state.checked) then |
||
429 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('ShowVerbose'))); |
||
430 | else |
||
431 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('ShowVerbose'))); |
||
432 | end |
||
433 | end; |
||
434 | check=true; |
||
435 | default={checked=getKhaosDefault('show-verbose')}; |
||
436 | disabled={checked=false}; |
||
437 | dependencies={enabled={checked=true;}}; |
||
438 | difficulty=1; |
||
439 | }; |
||
440 | { |
||
441 | id="AuctioneerAuctionHouseHeader"; |
||
442 | type=K_HEADER; |
||
443 | text=function() |
||
444 | return _AUCT('GuiAuctionHouseHeader') |
||
445 | end; |
||
446 | helptext=function() |
||
447 | return _AUCT('GuiAuctionHouseHeaderHelp') |
||
448 | end; |
||
449 | difficulty=1; |
||
450 | }; |
||
451 | { |
||
452 | id="autofill"; |
||
453 | type=K_TEXT; |
||
454 | text=function() |
||
455 | return _AUCT('GuiAutofill') |
||
456 | end; |
||
457 | helptext=function() |
||
458 | return _AUCT('HelpAutofill') |
||
459 | end; |
||
460 | callback=function(state) |
||
461 | Auctioneer.Command.GenVarSet("autofill", state.checked); |
||
462 | end; |
||
463 | feedback=function(state) |
||
464 | if (state.checked) then |
||
465 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('CmdAutofill'))); |
||
466 | else |
||
467 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('CmdAutofill'))); |
||
468 | end |
||
469 | end; |
||
470 | check=true; |
||
471 | default={checked=getKhaosDefault('autofill')}; |
||
472 | disabled={checked=false}; |
||
473 | dependencies={enabled={checked=true;}}; |
||
474 | difficulty=1; |
||
475 | }; |
||
476 | { |
||
477 | id="auction-duration"; |
||
478 | type=K_PULLDOWN; |
||
479 | setup = { |
||
480 | options = getKhaosDurationsList; |
||
481 | multiSelect = false; |
||
482 | }; |
||
483 | text=function() |
||
484 | return _AUCT('GuiAuctionDuration') |
||
485 | end; |
||
486 | helptext=function() |
||
487 | return _AUCT('HelpAuctionDuration') |
||
488 | end; |
||
489 | callback=function(state) |
||
490 | Auctioneer.Command.AuctionDuration(state.value); |
||
491 | end; |
||
492 | feedback=function(state) |
||
493 | return string.format(_AUCT('FrmtAuctionDuration'), _AUCT('CmdAuctionDuration'..Auctioneer.Command.GetFilterVal('auction-duration'))); |
||
494 | end; |
||
495 | default = { value = _AUCT('CmdAuctionDuration'..Auctioneer.Core.Constants.FilterDefaults['auction-duration']) }; |
||
496 | disabled = { value = _AUCT('CmdAuctionDuration'..Auctioneer.Core.Constants.FilterDefaults['auction-duration']) }; |
||
497 | dependencies={enabled={checked=true;}}; |
||
498 | difficulty=2; |
||
499 | }; |
||
500 | { |
||
501 | id="protect-window"; |
||
502 | type=K_PULLDOWN; |
||
503 | setup = { |
||
504 | options = getKhaosProtectionList; |
||
505 | multiSelect = false; |
||
506 | }; |
||
507 | text=function() |
||
508 | return _AUCT('GuiProtectWindow') |
||
509 | end; |
||
510 | helptext=function() |
||
511 | return _AUCT('HelpProtectWindow') |
||
512 | end; |
||
513 | callback=function(state) |
||
514 | Auctioneer.Command.ProtectWindow(state.value); |
||
515 | end; |
||
516 | feedback=function(state) |
||
517 | return string.format(_AUCT('FrmtProtectWindow'), _AUCT('CmdProtectWindow'..Auctioneer.Command.GetFilterVal('protect-window'))); |
||
518 | end; |
||
519 | default = { value = _AUCT('CmdProtectWindow'..Auctioneer.Core.Constants.FilterDefaults['protect-window']) }; |
||
520 | disabled = { value = _AUCT('CmdProtectWindow'..Auctioneer.Core.Constants.FilterDefaults['protect-window']) }; |
||
521 | dependencies={enabled={checked=true;}}; |
||
522 | difficulty=3; |
||
523 | }; |
||
524 | { |
||
525 | id="finish"; |
||
526 | type=K_PULLDOWN; |
||
527 | setup = { |
||
528 | options = getKhaosFinishList; |
||
529 | multiSelect = false; |
||
530 | }; |
||
531 | text=function() |
||
532 | return _AUCT('GuiFinish') |
||
533 | end; |
||
534 | helptext=function() |
||
535 | return _AUCT('HelpFinish') |
||
536 | end; |
||
537 | callback=function(state) |
||
538 | Auctioneer.Command.Finish(state.value); |
||
539 | end; |
||
540 | feedback=function(state) |
||
541 | return string.format(_AUCT('FrmtFinish'), _AUCT('CmdFinish'..Auctioneer.Command.GetFilterVal('finish'))); |
||
542 | end; |
||
543 | default = { value = _AUCT('CmdFinish'..Auctioneer.Core.Constants.FilterDefaults['finish']) }; |
||
544 | disabled = { value = _AUCT('CmdFinish'..Auctioneer.Core.Constants.FilterDefaults['finish']) }; |
||
545 | dependencies={enabled={checked=true;}}; |
||
546 | difficulty=3; |
||
547 | }; |
||
548 | { |
||
549 | id="show-warning"; |
||
550 | type=K_TEXT; |
||
551 | text=function() |
||
552 | return _AUCT('GuiRedo') |
||
553 | end; |
||
554 | helptext=function() |
||
555 | return _AUCT('HelpRedo') |
||
556 | end; |
||
557 | callback=function(state) |
||
558 | Auctioneer.Command.GenVarSet("show-warning", state.checked); |
||
559 | end; |
||
560 | feedback=function(state) |
||
561 | if (state.checked) then |
||
562 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('ShowRedo'))); |
||
563 | else |
||
564 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('ShowRedo'))); |
||
565 | end |
||
566 | end; |
||
567 | check=true; |
||
568 | default={checked=getKhaosDefault('show-warning')}; |
||
569 | disabled={checked=false}; |
||
570 | dependencies={enabled={checked=true;}}; |
||
571 | difficulty=1; |
||
572 | }; |
||
573 | { |
||
574 | id="warn-color"; |
||
575 | type=K_TEXT; |
||
576 | text=function() |
||
577 | return _AUCT('GuiWarnColor') |
||
578 | end; |
||
579 | helptext=function() |
||
580 | return _AUCT('HelpWarnColor') |
||
581 | end; |
||
582 | callback=function(state) |
||
583 | Auctioneer.Command.GenVarSet("warn-color", state.checked); |
||
584 | end; |
||
585 | feedback=function(state) |
||
586 | if (state.checked) then |
||
587 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('CmdWarnColor'))); |
||
588 | else |
||
589 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('CmdWarnColor'))); |
||
590 | end |
||
591 | end; |
||
592 | check=true; |
||
593 | default={checked=getKhaosDefault('warn-color')}; |
||
594 | disabled={checked=false}; |
||
595 | dependencies={enabled={checked=true;}}; |
||
596 | difficulty=1; |
||
597 | }; |
||
598 | { |
||
599 | id="finish-sound"; |
||
600 | type=K_TEXT; |
||
601 | text=function() |
||
602 | return _AUCT('GuiFinishSound') |
||
603 | end; |
||
604 | helptext=function() |
||
605 | return _AUCT('HelpFinishSound') |
||
606 | end; |
||
607 | callback=function(state) |
||
608 | Auctioneer.Command.GenVarSet("finish-sound", state.checked); |
||
609 | end; |
||
610 | feedback=function(state) |
||
611 | if (state.checked) then |
||
612 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('CmdFinishSound'))); |
||
613 | else |
||
614 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('CmdFinishSound'))); |
||
615 | end |
||
616 | end; |
||
617 | check=true; |
||
618 | default={checked=getKhaosDefault('warn-color')}; |
||
619 | disabled={checked=false}; |
||
620 | dependencies={enabled={checked=true;}}; |
||
621 | difficulty=1; |
||
622 | }; |
||
623 | { |
||
624 | id="AuctioneerEmbedHeader"; |
||
625 | type=K_HEADER; |
||
626 | text=function() |
||
627 | return _AUCT('GuiEmbedHeader') |
||
628 | end; |
||
629 | helptext=function() |
||
630 | return _AUCT('HelpEmbed') |
||
631 | end; |
||
632 | difficulty=1; |
||
633 | }; |
||
634 | { |
||
635 | id="embed"; |
||
636 | type=K_TEXT; |
||
637 | text=function() |
||
638 | return _AUCT('GuiEmbed') |
||
639 | end; |
||
640 | helptext=function() |
||
641 | return _AUCT('HelpEmbed') |
||
642 | end; |
||
643 | callback=function(state) |
||
644 | Auctioneer.Command.GenVarSet("embed", state.checked); |
||
645 | end; |
||
646 | feedback=function(state) |
||
647 | if (state.checked) then |
||
648 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('CmdEmbed'))); |
||
649 | else |
||
650 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('CmdEmbed'))); |
||
651 | end |
||
652 | end; |
||
653 | check=true; |
||
654 | default={checked=getKhaosDefault('embed')}; |
||
655 | disabled={checked=false}; |
||
656 | dependencies={enabled={checked=true;}}; |
||
657 | difficulty=1; |
||
658 | }; |
||
659 | { |
||
660 | id="show-embed-blankline"; |
||
661 | type=K_TEXT; |
||
662 | text=function() |
||
663 | return _AUCT('GuiEmbedBlankline') |
||
664 | end; |
||
665 | helptext=function() |
||
666 | return _AUCT('HelpEmbedBlank') |
||
667 | end; |
||
668 | callback=function(state) |
||
669 | Auctioneer.Command.GenVarSet("show-embed-blankline", state.checked); |
||
670 | end; |
||
671 | feedback=function(state) |
||
672 | if (state.checked) then |
||
673 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('ShowEmbedBlank'))); |
||
674 | else |
||
675 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('ShowEmbedBlank'))); |
||
676 | end |
||
677 | end; |
||
678 | check=true; |
||
679 | default={checked=getKhaosDefault('show-embed-blankline')}; |
||
680 | disabled={checked=false}; |
||
681 | dependencies={embed={checked=true;}, enabled={checked=true;}}; |
||
682 | difficulty=1; |
||
683 | }; |
||
684 | { |
||
685 | id="AuctioneerClearHeader"; |
||
686 | type=K_HEADER; |
||
687 | text=function() |
||
688 | return _AUCT('GuiClearHeader') |
||
689 | end; |
||
690 | helptext=function() |
||
691 | return _AUCT('GuiClearHelp') |
||
692 | end; |
||
693 | difficulty=3; |
||
694 | }; |
||
695 | { |
||
696 | id="AuctioneerClearAll"; |
||
697 | type=K_BUTTON; |
||
698 | setup={ |
||
699 | buttonText=function() |
||
700 | return _AUCT('GuiClearallButton') |
||
701 | end; |
||
702 | }; |
||
703 | text=function() |
||
704 | return _AUCT('GuiClearall') |
||
705 | end; |
||
706 | helptext=function() |
||
707 | return _AUCT('GuiClearallHelp') |
||
708 | end; |
||
709 | callback=function() |
||
710 | Auctioneer.Command.Clear("all"); |
||
711 | end; |
||
712 | feedback=function() |
||
713 | return string.format(_AUCT('FrmtActClearall'), _AUCT('GuiClearallNote')); |
||
714 | end; |
||
715 | dependencies={enabled={checked=true;}}; |
||
716 | difficulty=3; |
||
717 | }; |
||
718 | { |
||
719 | id="AuctioneerClearSnapshot"; |
||
720 | type=K_BUTTON; |
||
721 | setup={ |
||
722 | buttonText=function() |
||
723 | return _AUCT('GuiClearsnapButton') |
||
724 | end; |
||
725 | }; |
||
726 | text=function() |
||
727 | return _AUCT('GuiClearsnap') |
||
728 | end; |
||
729 | helptext=function() |
||
730 | return _AUCT('GuiClearsnapHelp') |
||
731 | end; |
||
732 | callback=function() |
||
733 | Auctioneer.Command.Clear(_AUCT('CmdClearSnapshot')); |
||
734 | end; |
||
735 | feedback=function() |
||
736 | return _AUCT('FrmtActClearsnap'); |
||
737 | end; |
||
738 | dependencies={enabled={checked=true;}}; |
||
739 | difficulty=3; |
||
740 | }; |
||
741 | { |
||
742 | id="AuctioneerPercentsHeader"; |
||
743 | type=K_HEADER; |
||
744 | text=function() |
||
745 | return _AUCT('GuiPercentsHeader') |
||
746 | end; |
||
747 | helptext=function() |
||
748 | return _AUCT('GuiPercentsHelp') |
||
749 | end; |
||
750 | difficulty=4; |
||
751 | }; |
||
752 | { |
||
753 | id="pct-bidmarkdown"; |
||
754 | type=K_EDITBOX; |
||
755 | setup = { |
||
756 | callOn = {"tab", "escape", "enter"}; |
||
757 | }; |
||
758 | text=function() |
||
759 | return _AUCT('GuiBidmarkdown') |
||
760 | end; |
||
761 | helptext=function() |
||
762 | return _AUCT('HelpPctBidmarkdown') |
||
763 | end; |
||
764 | callback = function(state) |
||
765 | Auctioneer.Command.PercentVarSet("pct-bidmarkdown", state.value); |
||
766 | end; |
||
767 | feedback = function (state) |
||
768 | return string.format(_AUCT('FrmtActSet'), _AUCT('CmdPctBidmarkdown'), state.value.."%"); |
||
769 | end; |
||
770 | default = { value = getKhaosDefault('pct-bidmarkdown') }; |
||
771 | disabled = { value = getKhaosDefault('pct-bidmarkdown') }; |
||
772 | dependencies={enabled={checked=true;}}; |
||
773 | difficulty=4; |
||
774 | }; |
||
775 | { |
||
776 | id="pct-markup"; |
||
777 | type=K_EDITBOX; |
||
778 | setup = { |
||
779 | callOn = {"tab", "escape", "enter"}; |
||
780 | }; |
||
781 | text=function() |
||
782 | return _AUCT('GuiMarkup') |
||
783 | end; |
||
784 | helptext=function() |
||
785 | return _AUCT('HelpPctMarkup') |
||
786 | end; |
||
787 | callback = function(state) |
||
788 | Auctioneer.Command.PercentVarSet("pct-markup", state.value); |
||
789 | end; |
||
790 | feedback = function (state) |
||
791 | return string.format(_AUCT('FrmtActSet'), _AUCT('CmdPctMarkup'), state.value.."%"); |
||
792 | end; |
||
793 | default = { value = getKhaosDefault('pct-markup') }; |
||
794 | disabled = { value = getKhaosDefault('pct-markup') }; |
||
795 | dependencies={enabled={checked=true;}}; |
||
796 | difficulty=4; |
||
797 | }; |
||
798 | { |
||
799 | id="pct-maxless"; |
||
800 | type=K_EDITBOX; |
||
801 | setup = { |
||
802 | callOn = {"tab", "escape", "enter"}; |
||
803 | }; |
||
804 | text=function() |
||
805 | return _AUCT('GuiMaxless') |
||
806 | end; |
||
807 | helptext=function() |
||
808 | return _AUCT('HelpPctMaxless') |
||
809 | end; |
||
810 | callback = function(state) |
||
811 | Auctioneer.Command.PercentVarSet("pct-maxless", state.value); |
||
812 | end; |
||
813 | feedback = function (state) |
||
814 | return string.format(_AUCT('FrmtActSet'), _AUCT('CmdPctMaxless'), state.value.."%"); |
||
815 | end; |
||
816 | default = { value = getKhaosDefault('pct-maxless') }; |
||
817 | disabled = { value = getKhaosDefault('pct-maxless') }; |
||
818 | dependencies={enabled={checked=true;}}; |
||
819 | difficulty=4; |
||
820 | }; |
||
821 | { |
||
822 | id="pct-nocomp"; |
||
823 | type=K_EDITBOX; |
||
824 | setup = { |
||
825 | callOn = {"tab", "escape", "enter"}; |
||
826 | }; |
||
827 | text=function() |
||
828 | return _AUCT('GuiNocomp') |
||
829 | end; |
||
830 | helptext=function() |
||
831 | return _AUCT('HelpPctNocomp') |
||
832 | end; |
||
833 | callback = function(state) |
||
834 | Auctioneer.Command.PercentVarSet("pct-nocomp", state.value); |
||
835 | end; |
||
836 | feedback = function (state) |
||
837 | return string.format(_AUCT('FrmtActSet'), _AUCT('CmdPctNocomp'), state.value.."%"); |
||
838 | end; |
||
839 | default = { value = getKhaosDefault('pct-nocomp') }; |
||
840 | disabled = { value = getKhaosDefault('pct-nocomp') }; |
||
841 | dependencies={enabled={checked=true;}}; |
||
842 | difficulty=4; |
||
843 | }; |
||
844 | { |
||
845 | id="pct-underlow"; |
||
846 | type=K_EDITBOX; |
||
847 | setup = { |
||
848 | callOn = {"tab", "escape", "enter"}; |
||
849 | }; |
||
850 | text=function() |
||
851 | return _AUCT('GuiUnderlow') |
||
852 | end; |
||
853 | helptext=function() |
||
854 | return _AUCT('HelpPctUnderlow') |
||
855 | end; |
||
856 | callback = function(state) |
||
857 | Auctioneer.Command.PercentVarSet("pct-underlow", state.value); |
||
858 | end; |
||
859 | feedback = function (state) |
||
860 | return string.format(_AUCT('FrmtActSet'), _AUCT('CmdPctUnderlow'), state.value.."%"); |
||
861 | end; |
||
862 | default = { value = getKhaosDefault('pct-underlow') }; |
||
863 | disabled = { value = getKhaosDefault('pct-underlow') }; |
||
864 | dependencies={enabled={checked=true;}}; |
||
865 | difficulty=4; |
||
866 | }; |
||
867 | { |
||
868 | id="pct-undermkt"; |
||
869 | type=K_EDITBOX; |
||
870 | setup = { |
||
871 | callOn = {"tab", "escape", "enter"}; |
||
872 | }; |
||
873 | text=function() |
||
874 | return _AUCT('GuiUndermkt') |
||
875 | end; |
||
876 | helptext=function() |
||
877 | return _AUCT('HelpPctUndermkt') |
||
878 | end; |
||
879 | callback = function(state) |
||
880 | Auctioneer.Command.PercentVarSet("pct-undermkt", state.value); |
||
881 | end; |
||
882 | feedback = function (state) |
||
883 | return string.format(_AUCT('FrmtActSet'), _AUCT('CmdPctUndermkt'), state.value.."%"); |
||
884 | end; |
||
885 | default = { value = getKhaosDefault('pct-undermkt') }; |
||
886 | disabled = { value = getKhaosDefault('pct-undermkt') }; |
||
887 | dependencies={enabled={checked=true;}}; |
||
888 | difficulty=4; |
||
889 | }; |
||
890 | { |
||
891 | id="AuctioneerAskPriceHeader"; |
||
892 | type=K_HEADER; |
||
893 | text=function() |
||
894 | return _AUCT('GuiAskPriceHeader') |
||
895 | end; |
||
896 | helptext=function() |
||
897 | return _AUCT('GuiAskPriceHeaderHelp') |
||
898 | end; |
||
899 | difficulty=2; |
||
900 | }; |
||
901 | { |
||
902 | id="askprice"; |
||
903 | type=K_TEXT; |
||
904 | text=function() |
||
905 | return _AUCT('GuiAskPrice') |
||
906 | end; |
||
907 | helptext=function() |
||
908 | return _AUCT('HelpAskPrice') |
||
909 | end; |
||
910 | callback=function(state) |
||
911 | if (state.checked) then |
||
912 | Auctioneer.AskPrice.OnOff("on"); |
||
913 | else |
||
914 | Auctioneer.AskPrice.OnOff("off"); |
||
915 | end |
||
916 | end; |
||
917 | feedback=function(state) |
||
918 | if (state.checked) then |
||
919 | return (_AUCT('StatAskPriceOn')) |
||
920 | else |
||
921 | return (_AUCT('StatAskPriceOff')) |
||
922 | end |
||
923 | end; |
||
924 | check=true; |
||
925 | default={getKhaosDefault('askprice')}; |
||
926 | disabled={checked=false}; |
||
927 | dependencies={enabled={checked=true;}}; |
||
928 | difficulty=2; |
||
929 | }; |
||
930 | { |
||
931 | id="askprice-trigger"; |
||
932 | type=K_EDITBOX; |
||
933 | setup = { |
||
934 | callOn = {"tab", "escape", "enter"}; |
||
935 | }; |
||
936 | text=function() |
||
937 | return _AUCT('GuiAskPriceTrigger') |
||
938 | end; |
||
939 | helptext=function() |
||
940 | return _AUCT('HelpAskPriceTrigger') |
||
941 | end; |
||
942 | callback = function(state) |
||
943 | Auctioneer.AskPrice.SetTrigger(state.value) |
||
944 | end; |
||
945 | feedback = function (state) |
||
946 | return string.format(_AUCT('FrmtActSet'), "askprice ".._AUCT('CmdAskPriceTrigger'), state.value); |
||
947 | end; |
||
948 | default = { value = getKhaosDefault('askprice-trigger') }; |
||
949 | disabled = { value = getKhaosDefault('askprice-trigger') }; |
||
950 | dependencies={askprice={checked=true}, enabled={checked=true;}}; |
||
951 | difficulty=3; |
||
952 | }; |
||
953 | { |
||
954 | id="askprice-whispers"; |
||
955 | type=K_TEXT; |
||
956 | text=function() |
||
957 | return _AUCT('GuiAskPriceWhispers') |
||
958 | end; |
||
959 | helptext=function() |
||
960 | return _AUCT('HelpAskPriceWhispers') |
||
961 | end; |
||
962 | callback=function(state) |
||
963 | Auctioneer.AskPrice.GenVarSet("whispers", state.checked); |
||
964 | end; |
||
965 | feedback=function(state) |
||
966 | if (state.checked) then |
||
967 | return (string.format(_AUCT('FrmtAskPriceEnable'), "askprice ".._AUCT('CmdAskPriceWhispers'))) |
||
968 | else |
||
969 | return (string.format(_AUCT('FrmtAskPriceDisable'), "askprice ".._AUCT('CmdAskPriceWhispers'))) |
||
970 | end |
||
971 | end; |
||
972 | check=true; |
||
973 | default={getKhaosDefault('askprice-whispers')}; |
||
974 | disabled={checked=false}; |
||
975 | dependencies={askprice={checked=true}, enabled={checked=true;}}; |
||
976 | difficulty=2; |
||
977 | }; |
||
978 | { |
||
979 | id="askprice-vendor"; |
||
980 | type=K_TEXT; |
||
981 | text=function() |
||
982 | return _AUCT('GuiAskPriceVendor') |
||
983 | end; |
||
984 | helptext=function() |
||
985 | return _AUCT('HelpAskPriceVendor') |
||
986 | end; |
||
987 | callback=function(state) |
||
988 | Auctioneer.AskPrice.GenVarSet("vendor", state.checked); |
||
989 | end; |
||
990 | feedback=function(state) |
||
991 | if (state.checked) then |
||
992 | return (string.format(_AUCT('FrmtAskPriceEnable'), "askprice ".._AUCT('CmdAskPriceVendor'))) |
||
993 | else |
||
994 | return (string.format(_AUCT('FrmtAskPriceDisable'), "askprice ".._AUCT('CmdAskPriceVendor'))) |
||
995 | end |
||
996 | end; |
||
997 | check=true; |
||
998 | default={getKhaosDefault('askprice-vendor')}; |
||
999 | disabled={checked=false}; |
||
1000 | dependencies={askprice={checked=true}, enabled={checked=true;}}; |
||
1001 | difficulty=2; |
||
1002 | }; |
||
1003 | { |
||
1004 | id="askprice-party"; |
||
1005 | type=K_TEXT; |
||
1006 | text=function() |
||
1007 | return _AUCT('GuiAskPriceParty') |
||
1008 | end; |
||
1009 | helptext=function() |
||
1010 | return _AUCT('HelpAskPriceParty') |
||
1011 | end; |
||
1012 | callback=function(state) |
||
1013 | Auctioneer.AskPrice.GenVarSet("party", state.checked); |
||
1014 | end; |
||
1015 | feedback=function(state) |
||
1016 | if (state.checked) then |
||
1017 | return (string.format(_AUCT('FrmtAskPriceEnable'), "askprice ".._AUCT('CmdAskPriceParty'))) |
||
1018 | else |
||
1019 | return (string.format(_AUCT('FrmtAskPriceDisable'), "askprice ".._AUCT('CmdAskPriceParty'))) |
||
1020 | end |
||
1021 | end; |
||
1022 | check=true; |
||
1023 | default={getKhaosDefault('askprice-party')}; |
||
1024 | disabled={checked=false}; |
||
1025 | dependencies={askprice={checked=true}, enabled={checked=true;}}; |
||
1026 | difficulty=2; |
||
1027 | }; |
||
1028 | { |
||
1029 | id="askprice-guild"; |
||
1030 | type=K_TEXT; |
||
1031 | text=function() |
||
1032 | return _AUCT('GuiAskPriceGuild') |
||
1033 | end; |
||
1034 | helptext=function() |
||
1035 | return _AUCT('HelpAskPriceGuild') |
||
1036 | end; |
||
1037 | callback=function(state) |
||
1038 | Auctioneer.AskPrice.GenVarSet("guild", state.checked); |
||
1039 | end; |
||
1040 | feedback=function(state) |
||
1041 | if (state.checked) then |
||
1042 | return (string.format(_AUCT('FrmtAskPriceEnable'), "askprice ".._AUCT('CmdAskPriceGuild'))) |
||
1043 | else |
||
1044 | return (string.format(_AUCT('FrmtAskPriceDisable'), "askprice ".._AUCT('CmdAskPriceGuild'))) |
||
1045 | end |
||
1046 | end; |
||
1047 | check=true; |
||
1048 | default={getKhaosDefault('askprice-guild')}; |
||
1049 | disabled={checked=false}; |
||
1050 | dependencies={askprice={checked=true}, enabled={checked=true;}}; |
||
1051 | difficulty=2; |
||
1052 | }; |
||
1053 | { |
||
1054 | id="askprice-smart"; |
||
1055 | type=K_TEXT; |
||
1056 | text=function() |
||
1057 | return _AUCT('GuiAskPriceSmart') |
||
1058 | end; |
||
1059 | helptext=function() |
||
1060 | return _AUCT('HelpAskPriceSmart') |
||
1061 | end; |
||
1062 | callback=function(state) |
||
1063 | Auctioneer.AskPrice.GenVarSet("smart", state.checked); |
||
1064 | end; |
||
1065 | feedback=function(state) |
||
1066 | if (state.checked) then |
||
1067 | return (string.format(_AUCT('FrmtAskPriceEnable'), "askprice ".._AUCT('CmdAskPriceSmart'))) |
||
1068 | else |
||
1069 | return (string.format(_AUCT('FrmtAskPriceDisable'), "askprice ".._AUCT('CmdAskPriceSmart'))) |
||
1070 | end |
||
1071 | end; |
||
1072 | check=true; |
||
1073 | default={getKhaosDefault('askprice-smart')}; |
||
1074 | disabled={checked=false}; |
||
1075 | dependencies={askprice={checked=true}, enabled={checked=true;}}; |
||
1076 | difficulty=2; |
||
1077 | }; |
||
1078 | { |
||
1079 | id="askprice-word1"; |
||
1080 | type=K_EDITBOX; |
||
1081 | setup = { |
||
1082 | callOn = {"tab", "escape", "enter"}; |
||
1083 | }; |
||
1084 | text=function() |
||
1085 | return string.format(_AUCT('GuiAskPriceWord'), 1) |
||
1086 | end; |
||
1087 | helptext=function() |
||
1088 | return _AUCT('HelpAskPriceWord') |
||
1089 | end; |
||
1090 | callback = function(state) |
||
1091 | Auctioneer.AskPrice.SetCustomSmartWords(nil, 1, state.value) |
||
1092 | end; |
||
1093 | feedback = function (state) |
||
1094 | return string.format(_AUCT('FrmtActSet'), "askprice ".._AUCT('CmdAskPriceWord').." 1", Auctioneer.Command.GetFilterVal('askprice-word1')) |
||
1095 | end; |
||
1096 | default = { value = getKhaosDefault('askprice-word1') }; |
||
1097 | disabled = { value = getKhaosDefault('askprice-word1') }; |
||
1098 | dependencies={askprice={checked=true}, enabled={checked=true;}}; |
||
1099 | difficulty=3; |
||
1100 | }; |
||
1101 | { |
||
1102 | id="askprice-word2"; |
||
1103 | type=K_EDITBOX; |
||
1104 | setup = { |
||
1105 | callOn = {"tab", "escape", "enter"}; |
||
1106 | }; |
||
1107 | text=function() |
||
1108 | return string.format(_AUCT('GuiAskPriceWord'), 2) |
||
1109 | end; |
||
1110 | helptext=function() |
||
1111 | return _AUCT('HelpAskPriceWord') |
||
1112 | end; |
||
1113 | callback = function(state) |
||
1114 | Auctioneer.AskPrice.SetCustomSmartWords(nil, 2, state.value) |
||
1115 | end; |
||
1116 | feedback = function (state) |
||
1117 | return string.format(_AUCT('FrmtActSet'), "askprice ".._AUCT('CmdAskPriceWord').." 2", Auctioneer.Command.GetFilterVal('askprice-word2')) |
||
1118 | end; |
||
1119 | default = { value = getKhaosDefault('askprice-word2') }; |
||
1120 | disabled = { value = getKhaosDefault('askprice-word2') }; |
||
1121 | dependencies={askprice={checked=true}, enabled={checked=true;}}; |
||
1122 | difficulty=3; |
||
1123 | }; |
||
1124 | { |
||
1125 | id="askprice-ad"; |
||
1126 | type=K_TEXT; |
||
1127 | text=function() |
||
1128 | return _AUCT('GuiAskPriceAd') |
||
1129 | end; |
||
1130 | helptext=function() |
||
1131 | return _AUCT('HelpAskPriceAd') |
||
1132 | end; |
||
1133 | callback=function(state) |
||
1134 | Auctioneer.AskPrice.GenVarSet("ad", state.checked); |
||
1135 | end; |
||
1136 | feedback=function(state) |
||
1137 | if (state.checked) then |
||
1138 | return (string.format(_AUCT('FrmtAskPriceEnable'), "askprice ".._AUCT('CmdAskPriceAd'))) |
||
1139 | else |
||
1140 | return (string.format(_AUCT('FrmtAskPriceDisable'), "askprice ".._AUCT('CmdAskPriceAd'))) |
||
1141 | end |
||
1142 | end; |
||
1143 | check=true; |
||
1144 | default={getKhaosDefault('askprice-ad')}; |
||
1145 | disabled={checked=false}; |
||
1146 | dependencies={askprice={checked=true}, enabled={checked=true;}}; |
||
1147 | difficulty=2; |
||
1148 | }; |
||
1149 | { |
||
1150 | id="AuctioneerOtherHeader"; |
||
1151 | type=K_HEADER; |
||
1152 | text=function() |
||
1153 | return _AUCT('GuiOtherHeader') |
||
1154 | end; |
||
1155 | helptext=function() |
||
1156 | return _AUCT('GuiOtherHelp') |
||
1157 | end; |
||
1158 | difficulty=1; |
||
1159 | }; |
||
1160 | { |
||
1161 | id="also"; |
||
1162 | type=K_EDITBOX; |
||
1163 | setup = { |
||
1164 | callOn = {"tab", "escape", "enter"}; |
||
1165 | }; |
||
1166 | text=function() |
||
1167 | return _AUCT('GuiAlso') |
||
1168 | end; |
||
1169 | helptext=function() |
||
1170 | return _AUCT('HelpAlso') |
||
1171 | end; |
||
1172 | callback = function(state) |
||
1173 | Auctioneer.Command.AlsoInclude(state.value); |
||
1174 | end; |
||
1175 | feedback = function (state) |
||
1176 | if ((state.value == _AUCT('CmdOff')) or (state.value == "off")) then |
||
1177 | return _AUCT('GuiAlsoOff'); |
||
1178 | elseif ((state.value == _AUCT('CmdAlsoOpposite')) or (state.value == "opposite")) then |
||
1179 | return _AUCT('GuiAlsoOpposite'); |
||
1180 | elseif (not Auctioneer.Util.IsValidAlso(state.value)) then |
||
1181 | return string.format(_AUCT('FrmtUnknownArg'), state.value, _AUCT('CmdAlso')) |
||
1182 | else |
||
1183 | return string.format(_AUCT('GuiAlsoDisplay'), state.value); |
||
1184 | end |
||
1185 | end; |
||
1186 | default = { value = getKhaosDefault('also') }; |
||
1187 | disabled = { value = getKhaosDefault('also') }; |
||
1188 | dependencies={enabled={checked=true;}}; |
||
1189 | difficulty=2; |
||
1190 | }; |
||
1191 | { |
||
1192 | id="printframe"; |
||
1193 | type=K_PULLDOWN; |
||
1194 | setup = { |
||
1195 | options = Auctioneer.Command.GetFrameNames; |
||
1196 | multiSelect = false; |
||
1197 | }; |
||
1198 | text=function() |
||
1199 | return _AUCT('GuiPrintin') |
||
1200 | end; |
||
1201 | helptext=function() |
||
1202 | return _AUCT('HelpPrintin') |
||
1203 | end; |
||
1204 | callback=function(state) |
||
1205 | Auctioneer.Command.SetFrame(state.value); |
||
1206 | end; |
||
1207 | feedback=function(state) |
||
1208 | local _, frameName = Auctioneer.Command.GetFrameNames(state.value) |
||
1209 | return string.format(_AUCT('FrmtPrintin'), frameName); |
||
1210 | end; |
||
1211 | default = { value = getKhaosDefault('printframe') }; |
||
1212 | disabled = { value = getKhaosDefault('printframe') }; |
||
1213 | dependencies={enabled={checked=true;}}; |
||
1214 | difficulty=3; |
||
1215 | }; |
||
1216 | { |
||
1217 | id="show-link"; |
||
1218 | type=K_TEXT; |
||
1219 | text=function() |
||
1220 | return _AUCT('GuiLink') |
||
1221 | end; |
||
1222 | helptext=function() |
||
1223 | return _AUCT('HelpLink') |
||
1224 | end; |
||
1225 | callback=function(state) |
||
1226 | Auctioneer.Command.GenVarSet("show-link", state.checked); |
||
1227 | end; |
||
1228 | feedback=function(state) |
||
1229 | if (state.checked) then |
||
1230 | return (string.format(_AUCT('FrmtActEnable'), _AUCT('ShowLink'))) |
||
1231 | else |
||
1232 | return (string.format(_AUCT('FrmtActDisable'), _AUCT('ShowLink'))) |
||
1233 | end |
||
1234 | end; |
||
1235 | check=true; |
||
1236 | default={getKhaosDefault('show-link')}; |
||
1237 | disabled={checked=false}; |
||
1238 | dependencies={enabled={checked=true;}}; |
||
1239 | difficulty=3; |
||
1240 | }; |
||
1241 | { |
||
1242 | id="DefaultAll"; |
||
1243 | type=K_BUTTON; |
||
1244 | setup={ |
||
1245 | buttonText = function() |
||
1246 | return _AUCT('GuiDefaultAllButton') |
||
1247 | end; |
||
1248 | }; |
||
1249 | text=function() |
||
1250 | return _AUCT('GuiDefaultAll') |
||
1251 | end; |
||
1252 | helptext=function() |
||
1253 | return _AUCT('GuiDefaultAllHelp') |
||
1254 | end; |
||
1255 | callback=function() |
||
1256 | Auctioneer.Command.Default(_AUCT('CmdClearAll')); |
||
1257 | end; |
||
1258 | feedback=function() |
||
1259 | return _AUCT('FrmtActDefaultall'); |
||
1260 | end; |
||
1261 | dependencies={enabled={checked=true;}}; |
||
1262 | difficulty=1; |
||
1263 | }; |
||
1264 | { |
||
1265 | id="DefaultOption"; |
||
1266 | type=K_EDITBOX; |
||
1267 | setup = { |
||
1268 | callOn = {"tab", "escape", "enter"}; |
||
1269 | }; |
||
1270 | text=function() |
||
1271 | return _AUCT('GuiDefaultOption') |
||
1272 | end; |
||
1273 | helptext=function() |
||
1274 | return _AUCT('HelpDefault') |
||
1275 | end; |
||
1276 | callback = function(state) |
||
1277 | Auctioneer.Command.Default(state.value); |
||
1278 | end; |
||
1279 | feedback = function (state) |
||
1280 | if (state.value == _AUCT('CmdClearAll')) then |
||
1281 | return _AUCT('FrmtActDefaultall'); |
||
1282 | else |
||
1283 | return string.format(_AUCT('FrmtActDefault'), state.value); |
||
1284 | end |
||
1285 | end; |
||
1286 | default = { |
||
1287 | value = ""; |
||
1288 | }; |
||
1289 | disabled = { |
||
1290 | value = ""; |
||
1291 | }; |
||
1292 | dependencies={enabled={checked=true;}}; |
||
1293 | difficulty=4; |
||
1294 | }; |
||
1295 | }; |
||
1296 | }; |
||
1297 | |||
1298 | Khaos.registerOptionSet("tooltip", optionSet); |
||
1299 | Auctioneer_Khaos_Registered = true; |
||
1300 | Khaos.refresh(); |
||
1301 | |||
1302 | -- This setting is not actually stored in the Khaos option set and |
||
1303 | -- requires special treatment to be updated |
||
1304 | local loadType = Stubby.GetConfig("Auctioneer", "LoadType") |
||
1305 | if (not loadType) then loadType = "auctionhouse"; end |
||
1306 | setKhaosSetKeyValue("LoadSettings", loadType) |
||
1307 | end |
||
1308 | |||
1309 | |||
1310 | function buildCommandMap() |
||
1311 | Auctioneer.Command.CommandMap = nil; |
||
1312 | Auctioneer.Command.CommandMapRev = nil; |
||
1313 | |||
1314 | commandMap = { |
||
1315 | [_AUCT('CmdOn')] = 'on', |
||
1316 | [_AUCT('CmdOff')] = 'off', |
||
1317 | [_AUCT('CmdHelp')] = 'help', |
||
1318 | [_AUCT('CmdToggle')] = 'toggle', |
||
1319 | [_AUCT('CmdDisable')] = 'disable', |
||
1320 | [_AUCT('CmdClear')] = 'clear', |
||
1321 | [_AUCT('CmdLocale')] = 'locale', |
||
1322 | [_AUCT('CmdDefault')] = 'default', |
||
1323 | [_AUCT('CmdPrintin')] = 'print-in', |
||
1324 | [_AUCT('CmdAlso')] = 'also', |
||
1325 | [_AUCT('CmdEmbed')] = 'embed', |
||
1326 | [_AUCT('CmdPercentless')] = 'percentless', |
||
1327 | [_AUCT('CmdPercentlessShort')] = 'percentless', |
||
1328 | [_AUCT('CmdCompete')] = 'compete', |
||
1329 | [_AUCT('CmdScan')] = 'scan', |
||
1330 | [_AUCT('CmdAutofill')] = 'autofill', |
||
1331 | [_AUCT('CmdWarnColor')] = 'warn-color', |
||
1332 | [_AUCT('CmdFinishSound')] = 'finish-sound', |
||
1333 | [_AUCT('CmdAuctionDuration')] = 'auction-duration', |
||
1334 | [_AUCT('CmdProtectWindow')] = 'protect-window', |
||
1335 | [_AUCT('CmdFinish')] = 'finish', |
||
1336 | [_AUCT('CmdBroker')] = 'broker', |
||
1337 | [_AUCT('CmdBidbroker')] = 'bidbroker', |
||
1338 | [_AUCT('CmdBidbrokerShort')] = 'bidbroker', |
||
1339 | [_AUCT('CmdAuctionClick')] = 'auction-click', |
||
1340 | [_AUCT('CmdPctBidmarkdown')] = 'pct-bidmarkdown', |
||
1341 | [_AUCT('CmdPctMarkup')] = 'pct-markup', |
||
1342 | [_AUCT('CmdPctMaxless')] = 'pct-maxless', |
||
1343 | [_AUCT('CmdPctNocomp')] = 'pct-nocomp', |
||
1344 | [_AUCT('CmdPctUnderlow')] = 'pct-underlow', |
||
1345 | [_AUCT('CmdPctUndermkt')] = 'pct-undermkt', |
||
1346 | |||
1347 | --AskPrice related commands |
||
1348 | [_AUCT('CmdAskPriceWhispers')] = 'whispers', |
||
1349 | [_AUCT('CmdAskPriceVendor')] = 'vendor', |
||
1350 | [_AUCT('CmdAskPriceGuild')] = 'guild', |
||
1351 | [_AUCT('CmdAskPriceParty')] = 'party', |
||
1352 | [_AUCT('CmdAskPriceSmart')] = 'smart', |
||
1353 | [_AUCT('CmdAskPriceWord')] = 'word', |
||
1354 | [_AUCT('CmdAskPriceAd')] = 'ad', |
||
1355 | |||
1356 | -- Post/Search Tab related commands |
||
1357 | [_AUCT('CmdBidLimit')] = 'bid-limit', |
||
1358 | [_AUCT('CmdUpdatePrice')] = 'update-price', |
||
1359 | } |
||
1360 | |||
1361 | commandMapRev = {} |
||
1362 | for k,v in pairs(commandMap) do |
||
1363 | commandMapRev[v] = k; |
||
1364 | end |
||
1365 | |||
1366 | Auctioneer.Command.CommandMap = commandMap; |
||
1367 | Auctioneer.Command.CommandMapRev = commandMapRev; |
||
1368 | end |
||
1369 | |||
1370 | --Cleaner Command Handling Functions (added by MentalPower) |
||
1371 | function mainHandler(command, source) |
||
1372 | |||
1373 | --To print or not to print, that is the question... |
||
1374 | local chatprint = nil; |
||
1375 | |||
1376 | if (source == "GUI") then |
||
1377 | chatprint = false; |
||
1378 | |||
1379 | else |
||
1380 | chatprint = true; |
||
1381 | end; |
||
1382 | |||
1383 | --Divide the large command into smaller logical sections (Shameless copy from the original function) |
||
1384 | local i,j, cmd, param = string.find(command, "^([^ ]+) (.+)$"); |
||
1385 | |||
1386 | if (not cmd) then cmd = command; end |
||
1387 | if (not cmd) then cmd = ""; end |
||
1388 | if (not param) then param = ""; end |
||
1389 | cmd = Auctioneer.Util.DelocalizeCommand(cmd); |
||
1390 | |||
1391 | --Now for the real Command handling |
||
1392 | |||
1393 | --/auctioneer help |
||
1394 | if ((cmd == "") or (cmd == "help")) then |
||
1395 | chatPrintHelp(); |
||
1396 | |||
1397 | --/auctioneer (on|off|toggle) |
||
1398 | elseif (cmd == 'on' or cmd == 'off' or cmd == 'toggle') then |
||
1399 | onOff(cmd, chatprint); |
||
1400 | |||
1401 | --/auctioneer disable |
||
1402 | elseif (cmd == 'disable') then |
||
1403 | Auctioneer.Util.ChatPrint(_AUCT('DisableMsg')); |
||
1404 | Stubby.SetConfig("Auctioneer", "LoadType", "never"); |
||
1405 | setKhaosSetKeyValue("LoadSettings", "never") |
||
1406 | |||
1407 | --/auctioneer load (always|never|auctionhouse) |
||
1408 | elseif (cmd == 'load') then |
||
1409 | if (param == "always") or (param == "never") or (param == "auctionhouse") then |
||
1410 | Stubby.SetConfig("Auctioneer", "LoadType", param); |
||
1411 | if (chatprint) then |
||
1412 | Auctioneer.Util.ChatPrint("Setting Auctioneer to "..param.." load for this toon"); |
||
1413 | setKhaosSetKeyValue("LoadSettings", param) |
||
1414 | end |
||
1415 | end |
||
1416 | |||
1417 | --/auctioneer clear (all|snapshot|item) |
||
1418 | elseif (cmd == 'clear') then |
||
1419 | clear(param, chatprint); |
||
1420 | |||
1421 | --/auctioneer also ReamName-Faction |
||
1422 | elseif (cmd == 'also') then |
||
1423 | alsoInclude(param, chatprint); |
||
1424 | |||
1425 | --/auctioneer locale |
||
1426 | elseif (cmd == 'locale') then |
||
1427 | setLocale(param, chatprint); |
||
1428 | |||
1429 | --/auctioneer default (all|option) |
||
1430 | elseif (cmd == 'default') then |
||
1431 | default(param, chatprint); |
||
1432 | |||
1433 | --/auctioneer print-in (FrameName|FrameNumber) |
||
1434 | elseif (cmd == 'print-in') then |
||
1435 | setFrame(param, chatprint) |
||
1436 | |||
1437 | --/auctioneer broker |
||
1438 | elseif (cmd == 'broker') then |
||
1439 | Auctioneer.Filter.DoBroker(param); |
||
1440 | |||
1441 | --/auctioneer bidbroker |
||
1442 | elseif (cmd == 'bidbroker' or cmd == "bb") then |
||
1443 | Auctioneer.Filter.DoBidBroker(param); |
||
1444 | |||
1445 | --/auctioneer percentless |
||
1446 | elseif (cmd == 'percentless' or cmd == "pl") then |
||
1447 | Auctioneer.Filter.DoPercentLess(param); |
||
1448 | |||
1449 | --/auctioneer compete |
||
1450 | elseif (cmd == 'compete') then |
||
1451 | Auctioneer.Filter.DoCompeting(param); |
||
1452 | |||
1453 | --/auctioneer scan |
||
1454 | elseif (cmd == 'scan') then |
||
1455 | Auctioneer.Scanning.RequestAuctionScan(chatPrint); |
||
1456 | |||
1457 | --/auctioneer protect-window |
||
1458 | elseif (cmd == 'protect-window') then |
||
1459 | protectWindow(param, chatprint); |
||
1460 | |||
1461 | --/auctioneer auction-duration (2h|8h|24h) |
||
1462 | elseif (cmd == 'auction-duration') then |
||
1463 | auctionDuration(param, chatprint); |
||
1464 | |||
1465 | --/auctioneer finish (off|logout|exit) |
||
1466 | elseif (cmd == 'finish') then |
||
1467 | finish(param, chatprint); |
||
1468 | |||
1469 | --/auctioneer low |
||
1470 | elseif (cmd == 'low') then |
||
1471 | Auctioneer.Statistic.DoLow(param); |
||
1472 | |||
1473 | --/auctioneer med |
||
1474 | elseif (cmd == 'med') then |
||
1475 | Auctioneer.Statistic.DoMedian(param); |
||
1476 | |||
1477 | --/auctioneer hsp |
||
1478 | elseif (cmd == 'hsp') then |
||
1479 | Auctioneer.Statistic.DoHSP(param); |
||
1480 | |||
1481 | --/auctioneer askprice (vendor|guild|party|smart|trigger|ad) |
||
1482 | elseif (cmd == 'askprice') then |
||
1483 | Auctioneer.AskPrice.CommandHandler(param, source); |
||
1484 | |||
1485 | --/auctioneer (GenVars) |
||
1486 | elseif ( |
||
1487 | cmd == 'embed' or cmd == 'autofill' or cmd == 'auction-click' or |
||
1488 | cmd == 'show-verbose' or cmd == 'show-average' or cmd == 'show-link' or |
||
1489 | cmd == 'show-median' or cmd == 'show-stats' or cmd == 'show-suggest' or |
||
1490 | cmd == 'show-embed-blankline' or cmd == 'show-warning' or cmd == 'warn-color' or |
||
1491 | cmd == 'update-price' or cmd == 'finish-sound' |
||
1492 | ) then |
||
1493 | genVarSet(cmd, param, chatprint); |
||
1494 | |||
1495 | --/auctioneer (PercentVars) |
||
1496 | elseif ( |
||
1497 | cmd == 'pct-bidmarkdown' or cmd == 'pct-markup' or cmd == 'pct-maxless' or |
||
1498 | cmd == 'pct-nocomp' or cmd == 'pct-underlow' or cmd == 'pct-undermkt' |
||
1499 | ) then |
||
1500 | percentVarSet(cmd, param, chatprint); |
||
1501 | |||
1502 | --/auctioneer (NumVars) |
||
1503 | elseif (cmd == 'bid-limit') then |
||
1504 | numVarSet(cmd, param, chatprint); |
||
1505 | |||
1506 | --Command not recognized |
||
1507 | else |
||
1508 | if (chatprint) then |
||
1509 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActUnknown'), cmd)); |
||
1510 | end |
||
1511 | end |
||
1512 | end |
||
1513 | |||
1514 | --Help ME!! (The Handler) (Another shameless copy from the original function) |
||
1515 | function chatPrintHelp() |
||
1516 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtWelcome'), Auctioneer.Version), 0.8, 0.8, 0.2); |
||
1517 | |||
1518 | local onOffToggle = " (".._AUCT('CmdOn').."|".._AUCT('CmdOff').."|".._AUCT('CmdToggle')..")"; |
||
1519 | |||
1520 | local _, frameName = getFrameNames(getFrameIndex()) |
||
1521 | |||
1522 | Auctioneer.Util.ChatPrint(_AUCT('TextUsage')); |
||
1523 | Auctioneer.Util.ChatPrint(" |cffffffff/auctioneer "..onOffToggle.."|r |cff2040ff["..Auctioneer.Util.GetLocalizedFilterVal("all").."]|r\n " .. _AUCT('HelpOnoff') .. "\n\n"); |
||
1524 | Auctioneer.Util.ChatPrint(" |cffffffff/auctioneer ".._AUCT('CmdDisable').."|r\n " .. _AUCT('HelpDisable') .. "\n\n"); |
||
1525 | |||
1526 | local lineFormat = " |cffffffff/auctioneer %s "..onOffToggle.."|r |cff2040ff[%s]|r\n %s\n\n"; |
||
1527 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowVerbose'), Auctioneer.Util.GetLocalizedFilterVal('show-verbose'), _AUCT('HelpVerbose'))); |
||
1528 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowAverage'), Auctioneer.Util.GetLocalizedFilterVal('show-average'), _AUCT('HelpAverage'))); |
||
1529 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowMedian'), Auctioneer.Util.GetLocalizedFilterVal('show-median'), _AUCT('HelpMedian'))); |
||
1530 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowSuggest'), Auctioneer.Util.GetLocalizedFilterVal('show-suggest'), _AUCT('HelpSuggest'))); |
||
1531 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowStats'), Auctioneer.Util.GetLocalizedFilterVal('show-stats'), _AUCT('HelpStats'))); |
||
1532 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowLink'), Auctioneer.Util.GetLocalizedFilterVal('show-link'), _AUCT('HelpLink'))); |
||
1533 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdAutofill'), Auctioneer.Util.GetLocalizedFilterVal('autofill'), _AUCT('HelpAutofill'))); |
||
1534 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdEmbed'), Auctioneer.Util.GetLocalizedFilterVal('embed'), _AUCT('HelpEmbed'))); |
||
1535 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowEmbedBlank'), Auctioneer.Util.GetLocalizedFilterVal('show-embed-blankline'), _AUCT('HelpEmbedBlank'))); |
||
1536 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowRedo'), Auctioneer.Util.GetLocalizedFilterVal('show-warning'), _AUCT('HelpRedo'))); |
||
1537 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdAuctionClick'), Auctioneer.Util.GetLocalizedFilterVal('auction-click'), _AUCT('HelpAuctionClick'))); |
||
1538 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdWarnColor'), Auctioneer.Util.GetLocalizedFilterVal('warn-color'), _AUCT('HelpWarnColor'))); |
||
1539 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdUpdatePrice'), Auctioneer.Util.GetLocalizedFilterVal('update-price'), _AUCT('HelpUpdatePrice'))); |
||
1540 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdFinishSound'), Auctioneer.Util.GetLocalizedFilterVal('finish-sound'), _AUCT('HelpFinishSound'))); |
||
1541 | |||
1542 | lineFormat = " |cffffffff/auctioneer %s %s|r |cff2040ff[%s]|r\n %s\n\n"; |
||
1543 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdProtectWindow'), _AUCT('OptProtectWindow'), _AUCT('CmdProtectWindow'..Auctioneer.Command.GetFilterVal('protect-window')), _AUCT('HelpProtectWindow'))); |
||
1544 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdAuctionDuration'), _AUCT('OptAuctionDuration'), _AUCT('CmdAuctionDuration'..Auctioneer.Command.GetFilterVal('auction-duration')), _AUCT('HelpAuctionDuration'))); |
||
1545 | |||
1546 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdLocale'), _AUCT('OptLocale'), Auctioneer.Util.GetLocalizedFilterVal("locale"), _AUCT('HelpLocale'))); |
||
1547 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPrintin'), _AUCT('OptPrintin'), frameName, _AUCT('HelpPrintin'))); |
||
1548 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdFinish'), _AUCT('OptFinish'), _AUCT('CmdFinish'..Auctioneer.Command.GetFilterVal('finish')), _AUCT('HelpFinish'))); |
||
1549 | |||
1550 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctMarkup'), _AUCT('OptPctMarkup'), Auctioneer.Command.GetFilterVal('pct-markup'), _AUCT('HelpPctMarkup'))); |
||
1551 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctBidmarkdown'), _AUCT('OptPctBidmarkdown'), Auctioneer.Command.GetFilterVal('pct-bidmarkdown'), _AUCT('HelpPctBidmarkdown'))); |
||
1552 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctNocomp'), _AUCT('OptPctNocomp'), Auctioneer.Command.GetFilterVal('pct-nocomp'), _AUCT('HelpPctNocomp'))); |
||
1553 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctUnderlow'), _AUCT('OptPctUnderlow'), Auctioneer.Command.GetFilterVal('pct-underlow'), _AUCT('HelpPctUnderlow'))); |
||
1554 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctUndermkt'), _AUCT('OptPctUndermkt'), Auctioneer.Command.GetFilterVal('pct-undermkt'), _AUCT('HelpPctUndermkt'))); |
||
1555 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctMaxless'), _AUCT('OptPctMaxless'), Auctioneer.Command.GetFilterVal('pct-maxless'), _AUCT('HelpPctMaxless'))); |
||
1556 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdBidLimit'), _AUCT('OptBidLimit'), Auctioneer.Command.GetFilterVal('bid-limit'), _AUCT('HelpBidLimit'))); |
||
1557 | |||
1558 | Auctioneer.AskPrice.ChatPrintHelp() |
||
1559 | |||
1560 | lineFormat = " |cffffffff/auctioneer %s %s|r\n %s\n\n"; |
||
1561 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdClear'), _AUCT('OptClear'), _AUCT('HelpClear'))); |
||
1562 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdAlso'), _AUCT('OptAlso'), _AUCT('HelpAlso'))); |
||
1563 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdBroker'), _AUCT('OptBroker'), _AUCT('HelpBroker'))); |
||
1564 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdBidbroker'), _AUCT('OptBidbroker'), _AUCT('HelpBidbroker'))); |
||
1565 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPercentless'), _AUCT('OptPercentless'), _AUCT('HelpPercentless'))); |
||
1566 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdCompete'), _AUCT('OptCompete'), _AUCT('HelpCompete'))); |
||
1567 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdScan'), _AUCT('OptScan'), _AUCT('HelpScan'))); |
||
1568 | Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdDefault'), _AUCT('OptDefault'), _AUCT('HelpDefault'))); |
||
1569 | end |
||
1570 | --[[ |
||
1571 | The onOff(state, chatprint) function handles the state of the Auctioneer AddOn (whether it is currently on or off) |
||
1572 | If "on" or "off" is specified in the first argument then Auctioneer's state is changed to that value, |
||
1573 | If "toggle" is specified then it will toggle Auctioneer's state (if currently on then it will be turned off and vice-versa) |
||
1574 | |||
1575 | If a boolean (or nil) value is passed as the first argument the conversion is as follows: |
||
1576 | "true" is the same as "on" |
||
1577 | "false" is the same as "off" |
||
1578 | "nil" is the same as "toggle" |
||
1579 | |||
1580 | If chatprint is "true" then the state will also be printed to the user. |
||
1581 | ]] |
||
1582 | function onOff(state, chatprint) |
||
1583 | if (type(state) == "string") then |
||
1584 | state = Auctioneer.Util.DelocalizeFilterVal(state); |
||
1585 | |||
1586 | elseif (state == true) then |
||
1587 | state = 'on' |
||
1588 | |||
1589 | elseif (state == false) then |
||
1590 | state = 'off' |
||
1591 | |||
1592 | elseif (state == nil) then |
||
1593 | state = 'toggle' |
||
1594 | end |
||
1595 | |||
1596 | if (state == 'on' or state == 'off') then |
||
1597 | setFilter('all', state); |
||
1598 | |||
1599 | elseif (state == 'toggle') then |
||
1600 | setFilter('all', not getFilter('all')); |
||
1601 | end |
||
1602 | |||
1603 | --Print the change and alert the GUI if the command came from slash commands. Do nothing if they came from the GUI. |
||
1604 | if (chatprint) then |
||
1605 | state = getFilter('all') |
||
1606 | setKhaosSetKeyValue("enabled", state) |
||
1607 | |||
1608 | if (state) then |
||
1609 | Auctioneer.Util.ChatPrint(_AUCT('StatOn')); |
||
1610 | |||
1611 | else |
||
1612 | Auctioneer.Util.ChatPrint(_AUCT('StatOff')); |
||
1613 | end |
||
1614 | end |
||
1615 | end |
||
1616 | |||
1617 | --The following functions are almost verbatim copies of the original functions but modified in order to make them compatible with direct GUI access. |
||
1618 | function clear(param, chatprint) |
||
1619 | if (not (type(param) == "string")) then |
||
1620 | return |
||
1621 | end |
||
1622 | |||
1623 | local aKey = Auctioneer.Util.GetAuctionKey(); |
||
1624 | |||
1625 | if ((param == _AUCT('CmdClearAll')) or (param == "all")) then |
||
1626 | |||
1627 | AuctionConfig.info = {}; |
||
1628 | AuctionConfig.data[aKey] = {}; |
||
1629 | AuctionConfig.stats.histmed[aKey] = {}; |
||
1630 | AuctionConfig.stats.histcount[aKey] = {}; |
||
1631 | clear("snapshot"); |
||
1632 | elseif ((param == _AUCT('CmdClearSnapshot')) or (param == "snapshot")) then |
||
1633 | |||
1634 | AuctionConfig.snap[aKey] = {}; |
||
1635 | AuctionConfig.sbuy[aKey] = {}; |
||
1636 | Auctioneer_HSPCache[aKey] = {}; |
||
1637 | AuctionConfig.stats.snapmed[aKey] = {}; |
||
1638 | AuctionConfig.stats.snapcount[aKey] = {}; |
||
1639 | Auctioneer.Core.Variables.SnapshotItemPrices = {}; |
||
1640 | else |
||
1641 | |||
1642 | local items = Auctioneer.Util.GetItems(param); |
||
1643 | local itemLinks = Auctioneer.Util.GetItemHyperlinks(param); |
||
1644 | |||
1645 | if (items) then |
||
1646 | for pos,itemKey in ipairs(items) do |
||
1647 | |||
1648 | if (AuctionConfig.data[aKey][itemKey]) then |
||
1649 | AuctionConfig.data[aKey][itemKey] = nil; |
||
1650 | |||
1651 | AuctionConfig.stats.snapmed[aKey][itemKey] = nil; |
||
1652 | AuctionConfig.stats.histmed[aKey][itemKey] = nil; |
||
1653 | AuctionConfig.stats.histcount[aKey][itemKey] = nil; |
||
1654 | AuctionConfig.stats.snapcount[aKey][itemKey] = nil; |
||
1655 | AuctionConfig.sbuy[aKey][itemKey] = nil; |
||
1656 | |||
1657 | local count = 0; |
||
1658 | while (AuctionConfig.snap[aKey][count]) do |
||
1659 | AuctionConfig.snap[aKey][count][itemKey] = nil; |
||
1660 | count = count+1; |
||
1661 | end |
||
1662 | |||
1663 | Auctioneer_HSPCache[aKey][itemKey] = nil; |
||
1664 | |||
1665 | --These are not included in the print statement below because there could be the possiblity that an item's data was cleared but another's was not |
||
1666 | if (chatprint) then |
||
1667 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActClearOk'), itemLinks[pos])); |
||
1668 | end |
||
1669 | else |
||
1670 | if (chatprint) then |
||
1671 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActClearFail'), itemLinks[pos])); |
||
1672 | end |
||
1673 | end |
||
1674 | end |
||
1675 | end |
||
1676 | end |
||
1677 | |||
1678 | if (chatprint) then |
||
1679 | if ((param == _AUCT('CmdClearAll')) or (param == "all")) then |
||
1680 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActClearall'), aKey)); |
||
1681 | |||
1682 | elseif ((param == _AUCT('CmdClearSnapshot')) or (param == "snapshot")) then |
||
1683 | Auctioneer.Util.ChatPrint(_AUCT('FrmtActClearsnap')); |
||
1684 | end |
||
1685 | end |
||
1686 | end |
||
1687 | |||
1688 | |||
1689 | function alsoInclude(param, chatprint) |
||
1690 | local localizedParam = param; |
||
1691 | param = Auctioneer.Util.DelocalizeFilterVal(param); |
||
1692 | if ((param == _AUCT('CmdAlsoOpposite')) or (param == "opposite")) then |
||
1693 | param = "opposite"; |
||
1694 | end |
||
1695 | |||
1696 | if (not Auctioneer.Util.IsValidAlso(param)) then |
||
1697 | if (chatprint) then |
||
1698 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownRf'), param)); |
||
1699 | end |
||
1700 | return |
||
1701 | end |
||
1702 | |||
1703 | setFilter('also', param); |
||
1704 | |||
1705 | if (chatprint) then |
||
1706 | setKhaosSetKeyValue('also', param); |
||
1707 | |||
1708 | if (param == "off") then |
||
1709 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActDisable'), _AUCT('CmdAlso'))); |
||
1710 | |||
1711 | else |
||
1712 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActSet'), _AUCT('CmdAlso'), localizedParam)); |
||
1713 | end |
||
1714 | end |
||
1715 | end |
||
1716 | |||
1717 | |||
1718 | function isValidLocale(param) |
||
1719 | return (AuctioneerLocalizations and AuctioneerLocalizations[param]) |
||
1720 | end |
||
1721 | |||
1722 | |||
1723 | function setLocale(param, chatprint) |
||
1724 | param = Auctioneer.Util.DelocalizeFilterVal(param); |
||
1725 | local validLocale; |
||
1726 | |||
1727 | if (param == 'default') or (param == 'off') then |
||
1728 | Babylonian.SetOrder(''); |
||
1729 | validLocale = true; |
||
1730 | |||
1731 | elseif (Auctioneer.Command.IsValidLocale(param)) then |
||
1732 | Babylonian.SetOrder(param); |
||
1733 | validLocale = true; |
||
1734 | |||
1735 | else |
||
1736 | validLocale = false; |
||
1737 | end |
||
1738 | |||
1739 | |||
1740 | if (chatprint) then |
||
1741 | if (validLocale) then |
||
1742 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActSet'), _AUCT('CmdLocale'), param)); |
||
1743 | setKhaosSetKeyValue('locale', Babylonian.GetOrder()); |
||
1744 | |||
1745 | else |
||
1746 | Auctioneer.Util.ChatPrint(string.format(_AUCT("FrmtUnknownLocale"), param)); |
||
1747 | local locales = " "; |
||
1748 | for locale, data in pairs(AuctioneerLocalizations) do |
||
1749 | locales = locales .. " '" .. locale .. "' "; |
||
1750 | end |
||
1751 | Auctioneer.Util.ChatPrint(locales); |
||
1752 | end |
||
1753 | end |
||
1754 | |||
1755 | if (Auctioneer_Khaos_Registered) then |
||
1756 | Khaos.refresh(nil, nil, true) |
||
1757 | end |
||
1758 | |||
1759 | commandMap = nil; |
||
1760 | commandMapRev = nil; |
||
1761 | end |
||
1762 | |||
1763 | |||
1764 | function default(param, chatprint) |
||
1765 | local paramLocalized |
||
1766 | |||
1767 | if ( (param == nil) or (param == "") ) then |
||
1768 | return |
||
1769 | |||
1770 | elseif ((param == _AUCT('CmdClearAll')) or (param == "all")) then |
||
1771 | param = "all" |
||
1772 | AuctionConfig.filters = {}; |
||
1773 | |||
1774 | else |
||
1775 | paramLocalized = param |
||
1776 | param = Auctioneer.Util.DelocalizeCommand(param) |
||
1777 | setFilter(param, nil); |
||
1778 | end |
||
1779 | |||
1780 | Auctioneer.Util.SetFilterDefaults(); -- Apply defaults for settings that went missing |
||
1781 | |||
1782 | if (chatprint) then |
||
1783 | if (param == "all") then |
||
1784 | Auctioneer.Util.ChatPrint(_AUCT('FrmtActDefaultall')); |
||
1785 | for k,v in pairs(AuctionConfig.filters) do |
||
1786 | setKhaosSetKeyValue(k, Auctioneer.Command.GetFilterVal(k)); |
||
1787 | end |
||
1788 | |||
1789 | else |
||
1790 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActDefault'), paramLocalized)); |
||
1791 | setKhaosSetKeyValue(param, Auctioneer.Command.GetFilterVal(param)); |
||
1792 | end |
||
1793 | end |
||
1794 | end |
||
1795 | |||
1796 | --The following three functions were added by MentalPower to implement the /auc print-in command |
||
1797 | function getFrameNames(index) |
||
1798 | |||
1799 | local frames = {}; |
||
1800 | local frameName = ""; |
||
1801 | |||
1802 | for i=1, 10 do |
||
1803 | local name, fontSize, r, g, b, a, shown, locked, docked = GetChatWindowInfo(i); |
||
1804 | |||
1805 | if ( name == "" ) then |
||
1806 | if (i == 1) then |
||
1807 | frames[_AUCT('TextGeneral')] = 1; |
||
1808 | |||
1809 | elseif (i == 2) then |
||
1810 | frames[_AUCT('TextCombat')] = 2; |
||
1811 | end |
||
1812 | |||
1813 | else |
||
1814 | frames[name] = i; |
||
1815 | end |
||
1816 | end |
||
1817 | |||
1818 | if (type(index) == "number") then |
||
1819 | local name, fontSize, r, g, b, a, shown, locked, docked = GetChatWindowInfo(index); |
||
1820 | |||
1821 | if ( name == "" ) then |
||
1822 | if (index == 1) then |
||
1823 | frameName = _AUCT('TextGeneral'); |
||
1824 | |||
1825 | elseif (index == 2) then |
||
1826 | frameName = _AUCT('TextCombat'); |
||
1827 | end |
||
1828 | |||
1829 | else |
||
1830 | frameName = name; |
||
1831 | end |
||
1832 | end |
||
1833 | |||
1834 | return frames, frameName; |
||
1835 | end |
||
1836 | |||
1837 | |||
1838 | function getFrameIndex() |
||
1839 | if (not AuctionConfig.filters) then AuctionConfig.filters = {}; end |
||
1840 | local value = AuctionConfig.filters["printframe"]; |
||
1841 | |||
1842 | if (not value) then |
||
1843 | return 1; |
||
1844 | end |
||
1845 | return value; |
||
1846 | end |
||
1847 | |||
1848 | |||
1849 | function setFrame(frame, chatprint) |
||
1850 | local frameNumber |
||
1851 | local frameVal |
||
1852 | frameVal = tonumber(frame) |
||
1853 | |||
1854 | --If no arguments are passed, then set it to the default frame. |
||
1855 | if not (frame) then |
||
1856 | frameNumber = 1; |
||
1857 | |||
1858 | --If the frame argument is a number then set our chatframe to that number. |
||
1859 | elseif ((frameVal) ~= nil) then |
||
1860 | frameNumber = frameVal; |
||
1861 | |||
1862 | --If the frame argument is a string, find out if there's a chatframe with that name, and set our chatframe to that index. If not set it to the default frame. |
||
1863 | elseif (type(frame) == "string") then |
||
1864 | allFrames = getFrameNames(); |
||
1865 | if (allFrames[frame]) then |
||
1866 | frameNumber = allFrames[frame]; |
||
1867 | else |
||
1868 | frameNumber = 1; |
||
1869 | end |
||
1870 | |||
1871 | --If the argument is something else, set our chatframe to its default value. |
||
1872 | else |
||
1873 | frameNumber = 1; |
||
1874 | end |
||
1875 | |||
1876 | local _, frameName |
||
1877 | if (chatprint == true) then |
||
1878 | _, frameName = getFrameNames(frameNumber); |
||
1879 | if (getFrameIndex() ~= frameNumber) then |
||
1880 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtPrintin'), frameName)); |
||
1881 | end |
||
1882 | end |
||
1883 | |||
1884 | setFilter("printframe", frameNumber); |
||
1885 | |||
1886 | if (chatprint == true) then |
||
1887 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtPrintin'), frameName)); |
||
1888 | setKhaosSetKeyValue("printframe", frameNumber); |
||
1889 | end |
||
1890 | end |
||
1891 | |||
1892 | function protectWindow(param, chatprint) |
||
1893 | local mode; |
||
1894 | |||
1895 | if (param == 'never' or param == 'off' or param == _AUCT('CmdProtectWindow0') or param == _AUCT('CmdOff') or tonumber(param) == 0) then |
||
1896 | mode = 0; |
||
1897 | |||
1898 | elseif (param == 'scan' or param == _AUCT('CmdProtectWindow1') or tonumber(param) == 1) then |
||
1899 | mode = 1; |
||
1900 | |||
1901 | elseif (param == 'always' or param == _AUCT('CmdProtectWindow2') or tonumber(param) == 2) then |
||
1902 | mode = 2; |
||
1903 | |||
1904 | else |
||
1905 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, Auctioneer.Util.LocalizeCommand("protect-window"))); |
||
1906 | return |
||
1907 | end |
||
1908 | |||
1909 | setFilter("protect-window", mode); |
||
1910 | |||
1911 | if (chatprint) then |
||
1912 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtProtectWindow'), _AUCT('CmdProtectWindow' .. mode))); |
||
1913 | setKhaosSetKeyValue("protect-window", mode); |
||
1914 | end |
||
1915 | end |
||
1916 | |||
1917 | function auctionDuration(param, chatprint) |
||
1918 | local mode; |
||
1919 | |||
1920 | if (param == 'last' or param == _AUCT('CmdAuctionDuration0') or tonumber(param) == 0) then |
||
1921 | mode = 0; |
||
1922 | |||
1923 | elseif (param == '2h' or param == _AUCT('CmdAuctionDuration1') or tonumber(param) == 1) then |
||
1924 | mode = 1; |
||
1925 | |||
1926 | elseif (param == '8h' or param == _AUCT('CmdAuctionDuration2') or tonumber(param) == 2) then |
||
1927 | mode = 2; |
||
1928 | |||
1929 | elseif (param == '24h' or param == _AUCT('CmdAuctionDuration3') or tonumber(param) == 3) then |
||
1930 | mode = 3; |
||
1931 | |||
1932 | else |
||
1933 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, Auctioneer.Util.LocalizeCommand("auction-duration"))); |
||
1934 | return |
||
1935 | end |
||
1936 | |||
1937 | setFilter("auction-duration", mode); |
||
1938 | |||
1939 | if (chatprint) then |
||
1940 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtAuctionDuration'), _AUCT('CmdAuctionDuration' .. mode))); |
||
1941 | setKhaosSetKeyValue("auction-duration", mode); |
||
1942 | end |
||
1943 | end |
||
1944 | |||
1945 | function finish(param, chatprint) |
||
1946 | local mode; |
||
1947 | |||
1948 | if (param == 'off' or param == _AUCT('CmdFinish0') or tonumber(param) == 0) then |
||
1949 | mode = 0; |
||
1950 | |||
1951 | elseif (param == 'logout' or param == _AUCT('CmdFinish1') or tonumber(param) == 1) then |
||
1952 | mode = 1; |
||
1953 | |||
1954 | elseif (param == 'exit' or param == _AUCT('CmdFinish2') or tonumber(param) == 2) then |
||
1955 | mode = 2; |
||
1956 | |||
1957 | else |
||
1958 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, Auctioneer.Util.LocalizeCommand("finish"))); |
||
1959 | return |
||
1960 | end |
||
1961 | |||
1962 | setFilter("finish", mode); |
||
1963 | |||
1964 | if (chatprint) then |
||
1965 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtFinish'), _AUCT('CmdFinish' .. mode))); |
||
1966 | setKhaosSetKeyValue("finish", mode); |
||
1967 | end |
||
1968 | end |
||
1969 | |||
1970 | function genVarSet(variable, param, chatprint) |
||
1971 | if (type(param) == "string") then |
||
1972 | param = Auctioneer.Util.DelocalizeFilterVal(param); |
||
1973 | end |
||
1974 | |||
1975 | if (param == "on" or param == "off" or type(param) == "boolean") then |
||
1976 | setFilter(variable, param); |
||
1977 | elseif (param == "toggle" or param == nil or param == "") then |
||
1978 | param = setFilter(variable, not getFilter(variable)); |
||
1979 | end |
||
1980 | |||
1981 | if (chatprint) then |
||
1982 | if (getFilter(variable)) then |
||
1983 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActEnable'), Auctioneer.Util.LocalizeCommand(variable))); |
||
1984 | setKhaosSetKeyValue(variable, true) |
||
1985 | else |
||
1986 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActDisable'), Auctioneer.Util.LocalizeCommand(variable))); |
||
1987 | setKhaosSetKeyValue(variable, false) |
||
1988 | end |
||
1989 | end |
||
1990 | end |
||
1991 | |||
1992 | |||
1993 | function percentVarSet(variable, param, chatprint) |
||
1994 | local paramVal = tonumber(param); |
||
1995 | if paramVal == nil then |
||
1996 | -- failed to convert the param to a number |
||
1997 | |||
1998 | if chatprint then |
||
1999 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, variable)); |
||
2000 | end |
||
2001 | return -- invalid argument, don't do anything |
||
2002 | end |
||
2003 | -- param is a valid number, save it |
||
2004 | setFilter(variable, paramVal); |
||
2005 | |||
2006 | --Clear the HSP Cache since the profitability numbers have been updated. |
||
2007 | Auctioneer_HSPCache = {}; |
||
2008 | |||
2009 | if (chatprint) then |
||
2010 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActSet'), variable, paramVal.."%")); |
||
2011 | setKhaosSetKeyValue(variable, paramVal); |
||
2012 | end |
||
2013 | end |
||
2014 | |||
2015 | function numVarSet(variable, param, chatprint) |
||
2016 | local paramVal = tonumber(param); |
||
2017 | if paramVal == nil then |
||
2018 | -- failed to convert the param to a number |
||
2019 | |||
2020 | if chatprint then |
||
2021 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, variable)); |
||
2022 | end |
||
2023 | return -- invalid argument, don't do anything |
||
2024 | end |
||
2025 | -- param is a valid number, save it |
||
2026 | setFilter(variable, paramVal); |
||
2027 | |||
2028 | if (chatprint) then |
||
2029 | Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActSet'), variable, paramVal)); |
||
2030 | setKhaosSetKeyValue(variable, paramVal); |
||
2031 | end |
||
2032 | end |
||
2033 | |||
2034 | --This marks the end of the New Command processing code. |
||
2035 | |||
2036 | |||
2037 | function setFilter(key, value) |
||
2038 | if (not AuctionConfig.filters) then AuctionConfig.filters = {}; end |
||
2039 | if (type(value) == "boolean") then |
||
2040 | if (value) then |
||
2041 | AuctionConfig.filters[key] = 'on'; |
||
2042 | |||
2043 | else |
||
2044 | AuctionConfig.filters[key] = 'off'; |
||
2045 | end |
||
2046 | |||
2047 | else |
||
2048 | AuctionConfig.filters[key] = value; |
||
2049 | end |
||
2050 | end |
||
2051 | |||
2052 | function getFilterVal(type) |
||
2053 | if (not AuctionConfig.filters) then |
||
2054 | AuctionConfig.filters = {}; |
||
2055 | Auctioneer.Util.SetFilterDefaults(); |
||
2056 | end |
||
2057 | local val = AuctionConfig.filters[type]; |
||
2058 | if (val == nil) then |
||
2059 | val = Auctioneer.Core.Constants.FilterDefaults[type]; |
||
2060 | end |
||
2061 | return val; |
||
2062 | end |
||
2063 | |||
2064 | function getFilter(filter) |
||
2065 | value = getFilterVal(filter); |
||
2066 | if ((value == _AUCT('CmdOn')) or (value == "on")) then return true; |
||
2067 | |||
2068 | elseif ((value == _AUCT('CmdOff')) or (value == "off")) then return false; end |
||
2069 | return true; |
||
2070 | end |
||
2071 | |||
2072 | function findFilterClass(text) |
||
2073 | local totalFilters = getn(CLASS_FILTERS); |
||
2074 | for currentFilter=1, totalFilters do |
||
2075 | if (text == CLASS_FILTERS[currentFilter]) then |
||
2076 | return currentFilter, totalFilters; |
||
2077 | end |
||
2078 | end |
||
2079 | return 0, totalFilters; |
||
2080 | end |
||
2081 | |||
2082 | function filterSetFilter(checkbox, filter) |
||
2083 | checkbox.filterVal = filter; |
||
2084 | checkbox:SetChecked(getFilter(filter)); |
||
2085 | checkbox:Show(); |
||
2086 | end |
||
2087 | |||
2088 | function getLocale() |
||
2089 | local locale = Auctioneer.Command.GetFilterVal('locale'); |
||
2090 | if (locale == 'on') or (locale == 'off') or (locale == 'default') then |
||
2091 | return GetLocale(); |
||
2092 | end |
||
2093 | return locale; |
||
2094 | end |
||
2095 | |||
2096 | |||
2097 | Auctioneer.Command = { |
||
2098 | Register = register, |
||
2099 | ConvertKhaos = convertKhaos, |
||
2100 | GetKhaosDefault = getKhaosDefault, |
||
2101 | RegisterKhaos = registerKhaos, |
||
2102 | BuildCommandMap = buildCommandMap, |
||
2103 | CommandMap = commandMap, |
||
2104 | CommandMapRev = commandMapRev, |
||
2105 | MainHandler = mainHandler, |
||
2106 | ChatPrintHelp = chatPrintHelp, |
||
2107 | OnOff = onOff, |
||
2108 | Clear = clear, |
||
2109 | AlsoInclude = alsoInclude, |
||
2110 | IsValidLocale = isValidLocale, |
||
2111 | SetLocale = setLocale, |
||
2112 | Default = default, |
||
2113 | GetFrameNames = getFrameNames, |
||
2114 | GetFrameIndex = getFrameIndex, |
||
2115 | SetFrame = setFrame, |
||
2116 | ProtectWindow = protectWindow, |
||
2117 | AuctionDuration = auctionDuration, |
||
2118 | Finish = finish, |
||
2119 | GenVarSet = genVarSet, |
||
2120 | PercentVarSet = percentVarSet, |
||
2121 | NumVarSet = numVarSet, |
||
2122 | SetFilter = setFilter, |
||
2123 | GetFilterVal = getFilterVal, |
||
2124 | GetFilter = getFilter, |
||
2125 | FindFilterClass = findFilterClass, |
||
2126 | FilterSetFilter = filterSetFilter, |
||
2127 | GetLocale = getLocale, |
||
2128 | } |