📄 auccommand.lua
字号:
[_AUCT('CmdAutofill')] = 'autofill', [_AUCT('CmdWarnColor')] = 'warn-color', [_AUCT('CmdAuctionDuration')] = 'auction-duration', [_AUCT('CmdProtectWindow')] = 'protect-window', [_AUCT('CmdFinish')] = 'finish', [_AUCT('CmdBroker')] = 'broker', [_AUCT('CmdBidbroker')] = 'bidbroker', [_AUCT('CmdBidbrokerShort')] = 'bidbroker', [_AUCT('CmdAuctionClick')] = 'auction-click', [_AUCT('CmdPctBidmarkdown')] = 'pct-bidmarkdown', [_AUCT('CmdPctMarkup')] = 'pct-markup', [_AUCT('CmdPctMaxless')] = 'pct-maxless', [_AUCT('CmdPctNocomp')] = 'pct-nocomp', [_AUCT('CmdPctUnderlow')] = 'pct-underlow', [_AUCT('CmdPctUndermkt')] = 'pct-undermkt', --AskPrice related commands [_AUCT('CmdAskPriceVendor')] = 'vendor', [_AUCT('CmdAskPriceGuild')] = 'guild', [_AUCT('CmdAskPriceParty')] = 'party', [_AUCT('CmdAskPriceSmart')] = 'smart', [_AUCT('CmdAskPriceAd')] = 'ad', -- Post/Search Tab related commands [_AUCT('CmdBidLimit')] = 'bid-limit', [_AUCT('CmdUpdatePrice')] = 'update-price', } commandMapRev = {} for k,v in pairs(commandMap) do commandMapRev[v] = k; end Auctioneer.Command.CommandMap = commandMap; Auctioneer.Command.CommandMapRev = commandMapRev;end--Cleaner Command Handling Functions (added by MentalPower)function mainHandler(command, source) --To print or not to print, that is the question... local chatprint = nil; if (source == "GUI") then chatprint = false; else chatprint = true; end; --Divide the large command into smaller logical sections (Shameless copy from the original function) local i,j, cmd, param = string.find(command, "^([^ ]+) (.+)$"); if (not cmd) then cmd = command; end if (not cmd) then cmd = ""; end if (not param) then param = ""; end cmd = Auctioneer.Util.DelocalizeCommand(cmd); --Now for the real Command handling --/auctioneer help if ((cmd == "") or (cmd == "help")) then chatPrintHelp(); --/auctioneer (on|off|toggle) elseif (cmd == 'on' or cmd == 'off' or cmd == 'toggle') then onOff(cmd, chatprint); --/auctioneer disable elseif (cmd == 'disable') then Auctioneer.Util.ChatPrint(_AUCT('DisableMsg')); Stubby.SetConfig("Auctioneer", "LoadType", "never"); setKhaosSetKeyValue("LoadSettings", "never") --/auctioneer load (always|never|auctionhouse) elseif (cmd == 'load') then if (param == "always") or (param == "never") or (param == "auctionhouse") then Stubby.SetConfig("Auctioneer", "LoadType", param); if (chatprint) then Auctioneer.Util.ChatPrint("Setting Auctioneer to "..param.." load for this toon"); setKhaosSetKeyValue("LoadSettings", param) end end --/auctioneer clear (all|snapshot|item) elseif (cmd == 'clear') then clear(param, chatprint); --/auctioneer also ReamName-Faction elseif (cmd == 'also') then alsoInclude(param, chatprint); --/auctioneer locale elseif (cmd == 'locale') then setLocale(param, chatprint); --/auctioneer default (all|option) elseif (cmd == 'default') then default(param, chatprint); --/auctioneer print-in (FrameName|FrameNumber) elseif (cmd == 'print-in') then setFrame(param, chatprint) --/auctioneer broker elseif (cmd == 'broker') then Auctioneer.Filter.DoBroker(param); --/auctioneer bidbroker elseif (cmd == 'bidbroker' or cmd == "bb") then Auctioneer.Filter.DoBidBroker(param); --/auctioneer percentless elseif (cmd == 'percentless' or cmd == "pl") then Auctioneer.Filter.DoPercentLess(param); --/auctioneer compete elseif (cmd == 'compete') then Auctioneer.Filter.DoCompeting(param); --/auctioneer scan elseif (cmd == 'scan') then Auctioneer.Scanning.RequestAuctionScan(); --/auctioneer protect-window elseif (cmd == 'protect-window') then protectWindow(param, chatprint); --/auctioneer auction-duration (2h|8h|24h) elseif (cmd == 'auction-duration') then auctionDuration(param, chatprint); --/auctioneer finish (off|logout|exit) elseif (cmd == 'finish') then finish(param, chatprint); --/auctioneer low elseif (cmd == 'low') then Auctioneer.Statistic.DoLow(param); --/auctioneer med elseif (cmd == 'med') then Auctioneer.Statistic.DoMedian(param); --/auctioneer hsp elseif (cmd == 'hsp') then Auctioneer.Statistic.DoHSP(param); --/auctioneer askprice (vendor|guild|party|smart|trigger|ad) elseif (cmd == 'askprice') then Auctioneer.AskPrice.CommandHandler(param, source); --/auctioneer (GenVars) elseif (cmd == 'embed' or cmd == 'autofill' or cmd == 'auction-click' or cmd == 'show-verbose' or cmd == 'show-average' or cmd == 'show-link' or cmd == 'show-median' or cmd == 'show-stats' or cmd == 'show-suggest' or cmd == 'show-embed-blankline' or cmd == 'show-warning' or cmd == 'warn-color' or cmd == 'update-price') then genVarSet(cmd, param, chatprint); --/auctioneer (PercentVars) elseif (cmd == 'pct-bidmarkdown' or cmd == 'pct-markup' or cmd == "pct-maxless" or cmd == "pct-nocomp" or cmd == "pct-underlow" or cmd == "pct-undermkt") then percentVarSet(cmd, param, chatprint); --/auctioneer (NumVars) elseif (cmd == 'bid-limit') then numVarSet(cmd, param, chatprint); --Command not recognized else if (chatprint) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActUnknown'), cmd)); end endend--Help ME!! (The Handler) (Another shameless copy from the original function)function chatPrintHelp() Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtWelcome'), Auctioneer.Version), 0.8, 0.8, 0.2); local onOffToggle = " (".._AUCT('CmdOn').."|".._AUCT('CmdOff').."|".._AUCT('CmdToggle')..")"; local lineFormat = " |cffffffff/auctioneer %s "..onOffToggle.."|r |cff2040ff[%s]|r - %s"; local _, frameName = getFrameNames(getFrameIndex()); Auctioneer.Util.ChatPrint(_AUCT('TextUsage')); Auctioneer.Util.ChatPrint(" |cffffffff/auctioneer "..onOffToggle.."|r |cff2040ff["..Auctioneer.Util.GetLocalizedFilterVal("all").."]|r - " .. _AUCT('HelpOnoff')); Auctioneer.Util.ChatPrint(" |cffffffff/auctioneer ".._AUCT('CmdDisable').."|r - " .. _AUCT('HelpDisable')); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowVerbose'), Auctioneer.Util.GetLocalizedFilterVal('show-verbose'), _AUCT('HelpVerbose'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowAverage'), Auctioneer.Util.GetLocalizedFilterVal('show-average'), _AUCT('HelpAverage'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowMedian'), Auctioneer.Util.GetLocalizedFilterVal('show-median'), _AUCT('HelpMedian'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowSuggest'), Auctioneer.Util.GetLocalizedFilterVal('show-suggest'), _AUCT('HelpSuggest'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowStats'), Auctioneer.Util.GetLocalizedFilterVal('show-stats'), _AUCT('HelpStats'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowLink'), Auctioneer.Util.GetLocalizedFilterVal('show-link'), _AUCT('HelpLink'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdAutofill'), Auctioneer.Util.GetLocalizedFilterVal('autofill'), _AUCT('HelpAutofill'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdEmbed'), Auctioneer.Util.GetLocalizedFilterVal('embed'), _AUCT('HelpEmbed'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowEmbedBlank'), Auctioneer.Util.GetLocalizedFilterVal('show-embed-blankline'), _AUCT('HelpEmbedBlank'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('ShowRedo'), Auctioneer.Util.GetLocalizedFilterVal('show-warning'), _AUCT('HelpRedo'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdAuctionClick'), Auctioneer.Util.GetLocalizedFilterVal('auction-click'), _AUCT('HelpAuctionClick'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdWarnColor'), Auctioneer.Util.GetLocalizedFilterVal('warn-color'), _AUCT('HelpWarnColor'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdUpdatePrice'), Auctioneer.Util.GetLocalizedFilterVal('update-price'), _AUCT('HelpUpdatePrice'))); lineFormat = " |cffffffff/auctioneer %s %s|r |cff2040ff[%s]|r - %s"; Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdProtectWindow'), _AUCT('OptProtectWindow'), _AUCT('CmdProtectWindow'..Auctioneer.Command.GetFilterVal('protect-window')), _AUCT('HelpProtectWindow')));--[[ --this line is causing hangs, disabled for now pending further investigation. Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdAuctionDuration'), _AUCT('OptAuctionDuration'), _AUCT('CmdAuctionDuration'..Auctioneer.Command.GetFilterVal('auction-duration')), _AUCT('HelpAuctionDuration')));]] Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdLocale'), _AUCT('OptLocale'), Auctioneer.Util.GetLocalizedFilterVal("locale"), _AUCT('HelpLocale'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPrintin'), _AUCT('OptPrintin'), frameName, _AUCT('HelpPrintin'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdFinish'), _AUCT('OptFinish'), _AUCT('CmdFinish'..Auctioneer.Command.GetFilterVal('finish')), _AUCT('HelpFinish'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctMarkup'), _AUCT('OptPctMarkup'), Auctioneer.Command.GetFilterVal('pct-markup'), _AUCT('HelpPctMarkup'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctBidmarkdown'), _AUCT('OptPctBidmarkdown'), Auctioneer.Command.GetFilterVal('pct-bidmarkdown'), _AUCT('HelpPctBidmarkdown'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctNocomp'), _AUCT('OptPctNocomp'), Auctioneer.Command.GetFilterVal('pct-nocomp'), _AUCT('HelpPctNocomp'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctUnderlow'), _AUCT('OptPctUnderlow'), Auctioneer.Command.GetFilterVal('pct-underlow'), _AUCT('HelpPctUnderlow'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctUndermkt'), _AUCT('OptPctUndermkt'), Auctioneer.Command.GetFilterVal('pct-undermkt'), _AUCT('HelpPctUndermkt'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPctMaxless'), _AUCT('OptPctMaxless'), Auctioneer.Command.GetFilterVal('pct-maxless'), _AUCT('HelpPctMaxless'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdBidLimit'), _AUCT('OptBidLimit'), Auctioneer.Command.GetFilterVal('bid-limit'), _AUCT('HelpBidLimit'))); Auctioneer.AskPrice.ChatPrintHelp() lineFormat = " |cffffffff/auctioneer %s %s|r - %s"; Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdClear'), _AUCT('OptClear'), _AUCT('HelpClear'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdAlso'), _AUCT('OptAlso'), _AUCT('HelpAlso'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdBroker'), _AUCT('OptBroker'), _AUCT('HelpBroker'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdBidbroker'), _AUCT('OptBidbroker'), _AUCT('HelpBidbroker'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdPercentless'), _AUCT('OptPercentless'), _AUCT('HelpPercentless'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdCompete'), _AUCT('OptCompete'), _AUCT('HelpCompete'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdScan'), _AUCT('OptScan'), _AUCT('HelpScan'))); Auctioneer.Util.ChatPrint(string.format(lineFormat, _AUCT('CmdDefault'), _AUCT('OptDefault'), _AUCT('HelpDefault')));end--[[ The onOff(state, chatprint) function handles the state of the Auctioneer AddOn (whether it is currently on or off) If "on" or "off" is specified in the first argument then Auctioneer's state is changed to that value, If "toggle" is specified then it will toggle Auctioneer's state (if currently on then it will be turned off and vice-versa) If a boolean (or nil) value is passed as the first argument the conversion is as follows: "true" is the same as "on" "false" is the same as "off" "nil" is the same as "toggle" If chatprint is "true" then the state will also be printed to the user.]]function onOff(state, chatprint) if (type(state) == "string") then state = Auctioneer.Util.DelocalizeFilterVal(state); elseif (state == true) then state = 'on' elseif (state == false) then state = 'off' elseif (state == nil) then state = 'toggle' end if (state == 'on' or state == 'off') then setFilter('all', state); elseif (state == 'toggle') then setFilter('all', not getFilter('all')); end --Print the change and alert the GUI if the command came from slash commands. Do nothing if they came from the GUI. if (chatprint) then state = getFilter('all') setKhaosSetKeyValue("enabled", state) if (state) then Auctioneer.Util.ChatPrint(_AUCT('StatOn')); else Auctioneer.Util.ChatPrint(_AUCT('StatOff')); end endend--The following functions are almost verbatim copies of the original functions but modified in order to make them compatible with direct GUI access.function clear(param, chatprint) if (not param) or (not type(param) == "string") then return end local aKey = Auctioneer.Util.GetAuctionKey(); if ((param == _AUCT('CmdClearAll')) or (param == "all")) then AuctionConfig.info = {}; AuctionConfig.data[aKey] = {}; AuctionConfig.stats.histmed[aKey] = {}; AuctionConfig.stats.histcount[aKey] = {}; clear("snapshot"); elseif ((param == _AUCT('CmdClearSnapshot')) or (param == "snapshot")) then AuctionConfig.snap[aKey] = {}; AuctionConfig.sbuy[aKey] = {}; Auctioneer_HSPCache[aKey] = {}; AuctionConfig.stats.snapmed[aKey] = {}; AuctionConfig.stats.snapcount[aKey] = {}; Auctioneer.Core.Variables.SnapshotItemPrices = {}; else local items = Auctioneer.Util.GetItems(param); local itemLinks = Auctioneer.Util.GetItemHyperlinks(param); if (items) then for pos,itemKey in pairs(items) do if (AuctionConfig.data[aKey][itemKey]) then AuctionConfig.data[aKey][itemKey] = nil; if (AuctionConfig.stats.snapmed[aKey][itemKey]) then AuctionConfig.stats.snapmed[aKey][itemKey] = nil; end if (AuctionConfig.stats.histmed[aKey][itemKey]) then AuctionConfig.stats.histmed[aKey][itemKey] = nil; end if (AuctionConfig.stats.histcount[aKey][itemKey]) then AuctionConfig.stats.histcount[aKey][itemKey] = nil; end if (AuctionConfig.stats.snapcount[aKey][itemKey]) then AuctionConfig.stats.snapcount[aKey][itemKey] = nil; end if (AuctionConfig.sbuy[aKey][itemKey]) then AuctionConfig.sbuy[aKey][itemKey] = nil; end local count = 0; while (AuctionConfig.snap[aKey][count]) do if (AuctionConfig.snap[aKey][count][itemKey]) then AuctionConfig.snap[aKey][count][itemKey] =nil; end count = count+1; end if (Auctioneer_HSPCache[aKey][itemKey]) then Auctioneer_HSPCache[aKey][itemKey] = nil; end --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 if (chatprint) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActClearOk'), itemLinks[pos])); end else if (chatprint) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActClearFail'), itemLinks[pos])); end end end end end if (chatprint) then if ((param == _AUCT('CmdClearAll')) or (param == "all")) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActClearall'), aKey)); elseif ((param == _AUCT('CmdClearSnapshot')) or (param == "snapshot")) then Auctioneer.Util.ChatPrint(_AUCT('FrmtActClearsnap')); end endendfunction alsoInclude(param, chatprint) local localizedParam = param; param = Auctioneer.Util.DelocalizeFilterVal(param); if ((param == _AUCT('CmdAlsoOpposite')) or (param == "opposite")) then param = "opposite"; end if (not Auctioneer.Util.IsValidAlso(param)) then if (chatprint) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownRf'), param)); end return end setFilter('also', param); if (chatprint) then setKhaosSetKeyValue('also', param); if (param == "off") then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActDisable'), _AUCT('CmdAlso'))); else Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActSet'), _AUCT('CmdAlso'), localizedParam)); end endendfunction isValidLocale(param) return (AuctioneerLocalizations and AuctioneerLocalizations[param])endfunction setLocale(param, chatprint) param = Auctioneer.Util.DelocalizeFilterVal(param); local validLocale;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -