📄 enxcommand.lua
字号:
end; callback=function() clear(_ENCH('CmdClearAll')); end; feedback=function() return string.format(_ENCH('FrmtActClearall'), _ENCH('GuiClearallNote')); end; dependencies={all={checked=true;}}; difficulty=3; }; { id="DefaultAll"; type=K_BUTTON; setup={ buttonText = function() return _ENCH('GuiDefaultAllButton') end; }; text=function() return _ENCH('GuiDefaultAll') end; helptext=function() return _ENCH('GuiDefaultAllHelp') end; callback=function() default(_ENCH('CmdClearAll')); end; feedback=function() return _ENCH('FrmtActDefaultAll'); end; dependencies={all={checked=true;}}; difficulty=1; }; { id="printframe"; type=K_PULLDOWN; setup = { options = Enchantrix.Config.GetFrameNames; multiSelect = false; }; text=function() return _ENCH('GuiPrintin') end; helptext=function() return _ENCH('HelpPrintin') end; callback=function(state) Enchantrix.Config.SetFrame(state.value); end; feedback=function(state) local _, frameName = Enchantrix.Config.GetFrameNames(state.value) return string.format(_ENCH('FrmtPrintin'), frameName); end; default = { value=Enchantrix.Config.GetFrameIndex(); }; disabled = { value=Enchantrix.Config.GetFrameIndex(); }; dependencies={all={checked=true;}}; difficulty=3; }; { id="DefaultOption"; type=K_EDITBOX; setup = { callOn = {"tab", "escape", "enter"}; }; text=function() return _ENCH('GuiDefaultOption') end; helptext=function() return _ENCH('HelpDefault') end; callback = function(state) default(state.value); end; feedback = function (state) if (state.value == _ENCH('CmdClearAll')) then return _ENCH('FrmtActDefaultAll'); else return string.format(_ENCH('FrmtActDefault'), state.value); end end; default = { value = ""; }; disabled = { value = ""; }; dependencies={all={checked=true;}}; difficulty=4; }; }; }; local barkerOptions = { id="barker"; type=K_TEXT; text=function() return _ENCH('GuiBarker') -- "Enable Barker" end; helptext=function() return _ENCH('HelpBarker') -- "Turn Enchantrix Barker on or off" end; callback=function(state) genVarSet('barker', state.checked) end; feedback=function(state) if (state.checked) then return _ENCH('BarkerOn') else return _ENCH('BarkerOff') end end; check=true; default={checked=Enchantrix.Config.GetFilterDefaults('barker')}; disabled={checked=false}; difficulty=1; }; if GetLocale() == "enUS" then table.insert(optionSet.options, 3, barkerOptions) end Khaos.registerOptionSet("tooltip",optionSet); Enchantrix.State.Khaos_Registered = true; Khaos.refresh(); return true;endfunction registerAuctioneerOptions() local insertPos for key, value in ipairs(optionSet.options) do if value.id == "valuate" then insertPos = key + 1 end end if (optionSet.options[insertPos].id == 'valuate-hsp') then return end local AuctioneerOptions = { { id="valuate-hsp"; type=K_TEXT; text=function() return _ENCH('GuiValuateAverages') end; helptext=function() return _ENCH('HelpGuessAuctioneerHsp') end; callback=function(state) genVarSet('valuate-hsp', state.checked); end; feedback=function(state) if (state.checked) then return (string.format(_ENCH('FrmtActEnable'), _ENCH('ShowGuessAuctioneerHsp'))); else return (string.format(_ENCH('FrmtActDisable'), _ENCH('ShowGuessAuctioneerHsp'))); end end; check=true; default={checked = Enchantrix.Config.GetFilterDefaults('valuate-hsp')}; disabled={checked = false}; dependencies={valuate={checked=true;}, all={checked=true;}}; difficulty=2; }; { id="valuate-median"; type=K_TEXT; text=function() return _ENCH('GuiValuateMedian') end; helptext=function() return _ENCH('HelpGuessAuctioneerMedian') end; callback=function(state) genVarSet('valuate-median', state.checked); end; feedback=function(state) if (state.checked) then return (string.format(_ENCH('FrmtActEnable'), _ENCH('ShowGuessAuctioneerMed'))); else return (string.format(_ENCH('FrmtActDisable'), _ENCH('ShowGuessAuctioneerMed'))); end end; check=true; default={checked = Enchantrix.Config.GetFilterDefaults('valuate-median')}; disabled={checked = false}; dependencies={valuate={checked=true;}, all={checked=true;}}; difficulty=2; }; }; optionSet.options[insertPos - 1].helptext = function() return _ENCH('HelpValue') end; for i, opt in ipairs(AuctioneerOptions) do tinsert(optionSet.options, insertPos + i - 1, opt); end Khaos.unregisterOptionSet("Enchantrix"); Khaos.registerOptionSet("tooltip", optionSet); Khaos.refresh();endfunction auctioneerLoaded() Stubby.UnregisterAddOnHook("Auctioneer", "Enchantrix") -- Make sure we have a usable version of Auctioneer loaded (3.4 or higher) if Auctioneer and Auctioneer.Version then local ver = Enchantrix.Util.Split(Auctioneer.Version, ".") local major = tonumber(ver[1]) or 0 local minor = tonumber(ver[2]) or 0 if ver[3] == "DEV" then minor = minor + 1 end if major > 3 or (major >= 3 and minor >= 4) then Enchantrix.State.Auctioneer_Loaded = true end end if not Enchantrix.State.Auctioneer_Loaded then -- Old version of Auctioneer if not EnchantConfig.displayedAuctioneerWarning then -- Yell at the user, but only once message(_ENCH('MesgAuctVersion')) EnchantConfig.displayedAuctioneerWarning = true else Enchantrix.Util.ChatPrint(_ENCH('MesgAuctVersion')) end return end EnchantConfig.displayedAuctioneerWarning = nil if Enchantrix.State.Khaos_Registered then registerAuctioneerOptions() endendfunction setKhaosSetKeyParameter(key, parameter, value) if (Enchantrix.State.Khaos_Registered) then if (Khaos.getSetKey("Enchantrix", key)) then Khaos.setSetKeyParameter("Enchantrix", key, parameter, value) else EnhTooltip.DebugPrint("setKhaosSetKeyParameter(): key " .. key .. " does not exist") end endendfunction setKhaosSetKeyValue(key, value) if (Enchantrix.State.Khaos_Registered) then local kKey = Khaos.getSetKey("Enchantrix", key) if (not kKey) then EnhTooltip.DebugPrint("setKhaosSetKeyParameter(): key " .. key .. " does not exist") elseif (kKey.checked ~= nil) then -- EnhTooltip.DebugPrint("setKhaosSetKeyParameter(): setting ", value, " for key ", key) Khaos.setSetKeyParameter("Enchantrix", key, "checked", value) elseif (kKey.value ~= nil) then Khaos.setSetKeyParameter("Enchantrix", key, "value", value) else EnhTooltip.DebugPrint("setKhaosSetKeyParameter(): don't know how to update key ", key) end endend-- Cleaner Command Handling Functions (added by MentalPower)function handleCommand(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 = Enchantrix.Locale.DelocalizeCommand(cmd) if ((cmd == "") or (cmd == "help")) then -- /enchantrix help chatPrintHelp(); return; elseif ((cmd == "on") or (cmd == "off") or (cmd == "toggle")) then -- /enchantrix on|off|toggle onOff(cmd, chatprint); elseif (cmd == 'disable') then -- /enchantrix disable Enchantrix.Util.ChatPrint(_ENCH('MesgDisable')); Stubby.SetConfig("Enchantrix", "LoadType", "never"); elseif (cmd == 'load') then -- /enchantrix load always|never if (param == "always") or (param == "never") then Stubby.SetConfig("Enchantrix", "LoadType", param); if (chatprint) then Enchantrix.Util.ChatPrint("Setting Enchantrix to "..param.." load for this toon"); setKhaosSetKeyValue("LoadSettings", param) end end elseif (cmd == 'clear') then -- /enchantrix clear clear(param, chatprint); elseif (cmd == 'locale') then -- /enchantrix locale Enchantrix.Config.SetLocale(param, chatprint); elseif (cmd == 'default') then -- /enchantrix default default(param, chatprint); elseif (cmd == 'print-in') then -- /enchantrix print-in Enchantrix.Config.SetFrame(param, chatprint) elseif (cmd == 'bidbroker' or cmd == 'bb') then -- /enchantrix bidbroker doBidBroker(param); elseif (cmd == 'percentless' or cmd == 'pl') then doPercentLess(param); elseif (Enchantrix.Config.GetFilterDefaults(cmd) ~= nil) then genVarSet(cmd, param, chatprint); elseif (chatprint) then Enchantrix.Util.ChatPrint(string.format(_ENCH('FrmtActUnknown'), cmd)); endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -