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