📄 auccommand.lua
字号:
if (param == 'default') or (param == 'off') then Babylonian.SetOrder(''); validLocale = true; elseif (Auctioneer.Command.IsValidLocale(param)) then Babylonian.SetOrder(param); validLocale = true; else validLocale = false; end if (chatprint) then if (validLocale) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActSet'), _AUCT('CmdLocale'), param)); setKhaosSetKeyValue('locale', Babylonian.GetOrder()); else Auctioneer.Util.ChatPrint(string.format(_AUCT("FrmtUnknownLocale"), param)); local locales = " "; for locale, data in pairs(AuctioneerLocalizations) do locales = locales .. " '" .. locale .. "' "; end Auctioneer.Util.ChatPrint(locales); end end if (Auctioneer_Khaos_Registered) then Khaos.refresh(nil, nil, true) end commandMap = nil; commandMapRev = nil;endfunction default(param, chatprint) local paramLocalized if ( (param == nil) or (param == "") ) then return elseif ((param == _AUCT('CmdClearAll')) or (param == "all")) then param = "all" AuctionConfig.filters = {}; else paramLocalized = param param = Auctioneer.Util.DelocalizeCommand(param) setFilter(param, nil); end Auctioneer.Util.SetFilterDefaults(); -- Apply defaults for settings that went missing if (chatprint) then if (param == "all") then Auctioneer.Util.ChatPrint(_AUCT('FrmtActDefaultall')); for k,v in pairs(AuctionConfig.filters) do setKhaosSetKeyValue(k, Auctioneer.Command.GetFilterVal(k)); end else Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActDefault'), paramLocalized)); setKhaosSetKeyValue(param, Auctioneer.Command.GetFilterVal(param)); end endend--The following three functions were added by MentalPower to implement the /auc print-in commandfunction getFrameNames(index) local frames = {}; local frameName = ""; for i=1, 10 do local name, fontSize, r, g, b, a, shown, locked, docked = GetChatWindowInfo(i); if ( name == "" ) then if (i == 1) then frames[_AUCT('TextGeneral')] = 1; elseif (i == 2) then frames[_AUCT('TextCombat')] = 2; end else frames[name] = i; end end if (type(index) == "number") then local name, fontSize, r, g, b, a, shown, locked, docked = GetChatWindowInfo(index); if ( name == "" ) then if (index == 1) then frameName = _AUCT('TextGeneral'); elseif (index == 2) then frameName = _AUCT('TextCombat'); end else frameName = name; end end return frames, frameName;endfunction getFrameIndex() if (not AuctionConfig.filters) then AuctionConfig.filters = {}; end local value = AuctionConfig.filters["printframe"]; if (not value) then return 1; end return value;endfunction setFrame(frame, chatprint) local frameNumber local frameVal frameVal = tonumber(frame) --If no arguments are passed, then set it to the default frame. if not (frame) then frameNumber = 1; --If the frame argument is a number then set our chatframe to that number. elseif ((frameVal) ~= nil) then frameNumber = frameVal; --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. elseif (type(frame) == "string") then allFrames = getFrameNames(); if (allFrames[frame]) then frameNumber = allFrames[frame]; else frameNumber = 1; end --If the argument is something else, set our chatframe to its default value. else frameNumber = 1; end local _, frameName if (chatprint == true) then _, frameName = getFrameNames(frameNumber); if (getFrameIndex() ~= frameNumber) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtPrintin'), frameName)); end end setFilter("printframe", frameNumber); if (chatprint == true) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtPrintin'), frameName)); setKhaosSetKeyValue("printframe", frameNumber); endendfunction protectWindow(param, chatprint) local mode; if (param == 'never' or param == 'off' or param == _AUCT('CmdProtectWindow0') or param == _AUCT('CmdOff') or tonumber(param) == 0) then mode = 0; elseif (param == 'scan' or param == _AUCT('CmdProtectWindow1') or tonumber(param) == 1) then mode = 1; elseif (param == 'always' or param == _AUCT('CmdProtectWindow2') or tonumber(param) == 2) then mode = 2; else Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, Auctioneer.Util.LocalizeCommand("protect-window"))); return end setFilter("protect-window", mode); if (chatprint) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtProtectWindow'), _AUCT('CmdProtectWindow' .. mode))); setKhaosSetKeyValue("protect-window", mode); endendfunction auctionDuration(param, chatprint) local mode; if (param == 'last' or param == _AUCT('CmdAuctionDuration0') or tonumber(param) == 0) then mode = 0; elseif (param == '2h' or param == _AUCT('CmdAuctionDuration1') or tonumber(param) == 1) then mode = 1; elseif (param == '8h' or param == _AUCT('CmdAuctionDuration2') or tonumber(param) == 2) then mode = 2; elseif (param == '24h' or param == _AUCT('CmdAuctionDuration3') or tonumber(param) == 3) then mode = 3; else Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, Auctioneer.Util.LocalizeCommand("auction-duration"))); return end setFilter("auction-duration", mode); if (chatprint) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtAuctionDuration'), _AUCT('CmdAuctionDuration' .. mode))); setKhaosSetKeyValue("auction-duration", mode); endendfunction finish(param, chatprint) local mode; if (param == 'off' or param == _AUCT('CmdFinish0') or tonumber(param) == 0) then mode = 0; elseif (param == 'logout' or param == _AUCT('CmdFinish1') or tonumber(param) == 1) then mode = 1; elseif (param == 'exit' or param == _AUCT('CmdFinish2') or tonumber(param) == 2) then mode = 2; elseif (param == 'reloadui' or param == _AUCT('CmdFinish3') or tonumber(param) == 3) then mode = 3; else Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, Auctioneer.Util.LocalizeCommand("finish"))); return end setFilter("finish", mode); if (chatprint) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtFinish'), _AUCT('CmdFinish' .. mode))); setKhaosSetKeyValue("finish", mode); endendfunction genVarSet(variable, param, chatprint) if (type(param) == "string") then param = Auctioneer.Util.DelocalizeFilterVal(param); end if (param == "on" or param == "off" or type(param) == "boolean") then setFilter(variable, param); elseif (param == "toggle" or param == nil or param == "") then param = setFilter(variable, not getFilter(variable)); end if (chatprint) then if (getFilter(variable)) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActEnable'), Auctioneer.Util.LocalizeCommand(variable))); setKhaosSetKeyValue(variable, true) else Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActDisable'), Auctioneer.Util.LocalizeCommand(variable))); setKhaosSetKeyValue(variable, false) end endendfunction percentVarSet(variable, param, chatprint) local paramVal = tonumber(param); if paramVal == nil then -- failed to convert the param to a number if chatprint then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, variable)); end return -- invalid argument, don't do anything end -- param is a valid number, save it setFilter(variable, paramVal); --Clear the HSP Cache since the profitability numbers have been updated. Auctioneer_HSPCache = {}; if (chatprint) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActSet'), variable, paramVal.."%")); setKhaosSetKeyValue(variable, paramVal); endendfunction numVarSet(variable, param, chatprint) local paramVal = tonumber(param); if paramVal == nil then -- failed to convert the param to a number if chatprint then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtUnknownArg'), param, variable)); end return -- invalid argument, don't do anything end -- param is a valid number, save it setFilter(variable, paramVal); if (chatprint) then Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActSet'), variable, paramVal)); setKhaosSetKeyValue(variable, paramVal); endend--This marks the end of the New Command processing code.function setFilter(key, value) if (not AuctionConfig.filters) then AuctionConfig.filters = {}; end if (type(value) == "boolean") then if (value) then AuctionConfig.filters[key] = 'on'; else AuctionConfig.filters[key] = 'off'; end else AuctionConfig.filters[key] = value; endendfunction getFilterVal(type) if (not AuctionConfig.filters) then AuctionConfig.filters = {}; Auctioneer.Util.SetFilterDefaults(); end local val = AuctionConfig.filters[type]; if (val == nil) then val = Auctioneer.Core.Constants.FilterDefaults[type]; end return val;endfunction getFilter(filter) value = getFilterVal(filter); if ((value == _AUCT('CmdOn')) or (value == "on")) then return true; elseif ((value == _AUCT('CmdOff')) or (value == "off")) then return false; end return true;endfunction findFilterClass(text) local totalFilters = getn(CLASS_FILTERS); for currentFilter=1, totalFilters do if (text == CLASS_FILTERS[currentFilter]) then return currentFilter, totalFilters; end end return 0, totalFilters;endfunction filterSetFilter(checkbox, filter) checkbox.filterVal = filter; checkbox:SetChecked(getFilter(filter)); checkbox:Show();endfunction getLocale() local locale = Auctioneer.Command.GetFilterVal('locale'); if (locale == 'on') or (locale == 'off') or (locale == 'default') then return GetLocale(); end return locale;endAuctioneer.Command = { Register = register, ConvertKhaos = convertKhaos, GetKhaosDefault = getKhaosDefault, RegisterKhaos = registerKhaos, BuildCommandMap = buildCommandMap, CommandMap = commandMap, CommandMapRev = commandMapRev, MainHandler = mainHandler, ChatPrintHelp = chatPrintHelp, OnOff = onOff, Clear = clear, AlsoInclude = alsoInclude, IsValidLocale = isValidLocale, SetLocale = setLocale, Default = default, GetFrameNames = getFrameNames, GetFrameIndex = getFrameIndex, SetFrame = setFrame, ProtectWindow = protectWindow, AuctionDuration = auctionDuration, Finish = finish, GenVarSet = genVarSet, PercentVarSet = percentVarSet, NumVarSet = numVarSet, SetFilter = setFilter, GetFilterVal = getFilterVal, GetFilter = getFilter, FindFilterClass = findFilterClass, FilterSetFilter = filterSetFilter, GetLocale = getLocale,}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -