1.0.6 Hotfix: 修正nin条件判断错误

This commit is contained in:
Eigeen 2023-12-28 22:51:26 +08:00
parent 8348dd2a36
commit 81e49afecb
Signed by: eigeen
GPG Key ID: B730E75AFABD2ED8
1 changed files with 19 additions and 24 deletions

View File

@ -1,5 +1,5 @@
-- 猫猫虫的 LuaEngine 插件管理框架 -- 猫猫虫的 LuaEngine 插件管理框架
-- @version: 1.0.4 -- @version: 1.0.6
-- --
-- 自动加载以下目录的lua模块 -- 自动加载以下目录的lua模块
-- ./eigeen_modules -- ./eigeen_modules
@ -21,16 +21,16 @@
-- --
-- 具体用法请参考具体插件示例 -- 具体用法请参考具体插件示例
-- --
local Speed = require("utils/Speed") local Speed = require("utils.Speed")
local Keypad = require("utils/Keypad") local Keypad = require("utils.Keypad")
local Macro = require("utils/Macro") local Macro = require("utils.Macro")
local Utils = require("utils.Utils")
-- consts -- consts
local MODULE_ROOT = "./Lua/eigeen_modules" local MODULE_ROOT = "./Lua/eigeen_modules"
-- local NON_ACTIVE_MAPS = {301, 302, 303, 305, 306}
-- globals -- globals
-- 所有模块列表仅在初始化时加载。后续处理都基于此列表因此增删改mod需要重载此框架 -- 所有模块列表仅在初始化时加载。后续处理都基于此列表因此增删改mod需要重载
local Modules = {} local Modules = {}
local Ctx = {} local Ctx = {}
@ -42,15 +42,6 @@ local LastWeaponType = 0
-- 上一次的地图ID -- 上一次的地图ID
local LastMapID = 0 local LastMapID = 0
local function isIn(tbl, target)
for key, value in pairs(tbl) do
if target == value then
return true
end
end
return false
end
local function loadAllModules() local function loadAllModules()
local modules = {} local modules = {}
-- 自动导入 -- 自动导入
@ -99,10 +90,10 @@ local function _checkCondition(value, condValue)
setCondResult(value >= condVal) setCondResult(value >= condVal)
elseif key == "le" then elseif key == "le" then
setCondResult(value <= condVal) setCondResult(value <= condVal)
elseif key == "in" then elseif key == "tin" then
setCondResult(isIn(condVal, value)) setCondResult(Utils:IsIn(condVal, value))
elseif key == "nin" then elseif key == "nin" then
setCondResult(not isIn(condVal, value)) setCondResult(not Utils:IsIn(condVal, value))
else else
setCondResult(false) setCondResult(false)
end end
@ -205,12 +196,15 @@ function on_time()
Keypad = Keypad, Keypad = Keypad,
Macro = Macro Macro = Macro
} }
-- local MetaCtx = { -- 一键重载功能
-- Speed = Speed:new(Ctx.playerData), -- 同时按下左右花括号键
-- Keypad = Keypad Keypad.UseChronoscope({219, 221}, 1, function ()
-- } on_init()
-- MetaCtx.__index = MetaCtx ExecuteModules = buildExecuteModules(Ctx)
-- setmetatable(Ctx, MetaCtx) Message("已重载所有模块")
return
end)
-- 建立遍历专用表而不是遍历modules主表。条件判断操作更改后刷新遍历专用表。 -- 建立遍历专用表而不是遍历modules主表。条件判断操作更改后刷新遍历专用表。
local wpType = Ctx.playerData.Weapon.type local wpType = Ctx.playerData.Weapon.type
if Ctx.playerData.Weapon.type ~= LastWeaponType then if Ctx.playerData.Weapon.type ~= LastWeaponType then
@ -232,6 +226,7 @@ end
function on_init() function on_init()
Modules = loadAllModules() Modules = loadAllModules()
ExecuteModules = {}
executeOnInit(Modules) executeOnInit(Modules)
end end