212 lines
7.0 KiB
Go
212 lines
7.0 KiB
Go
-- 基础信息
|
||
local base_info = {
|
||
group_id = 133103567
|
||
}
|
||
|
||
-- Trigger变量
|
||
local defs = {
|
||
max_gear = 3,
|
||
timer = 15,
|
||
group_id = 133103567,
|
||
gadget_1 = 567001,
|
||
gadget_2 = 567002,
|
||
gadget_3 = 567003,
|
||
gadget_4 = 0,
|
||
gadget_chest = 567004
|
||
}
|
||
|
||
--================================================================
|
||
--
|
||
-- 配置
|
||
--
|
||
--================================================================
|
||
|
||
-- 怪物
|
||
monsters = {
|
||
}
|
||
|
||
-- NPC
|
||
npcs = {
|
||
}
|
||
|
||
-- 装置
|
||
gadgets = {
|
||
{ config_id = 567001, gadget_id = 70900051, pos = { x = 1010.652, y = 301.459, z = 1327.617 }, rot = { x = 0.000, y = 330.800, z = 0.000 }, level = 24, state = GadgetState.Action01, persistent = true, area_id = 6 },
|
||
{ config_id = 567002, gadget_id = 70900051, pos = { x = 1021.042, y = 301.769, z = 1335.384 }, rot = { x = 0.000, y = 329.000, z = 0.000 }, level = 24, state = GadgetState.Action01, persistent = true, area_id = 6 },
|
||
{ config_id = 567003, gadget_id = 70900051, pos = { x = 1012.066, y = 302.108, z = 1336.031 }, rot = { x = 0.000, y = 59.100, z = 0.000 }, level = 24, state = GadgetState.Action01, persistent = true, area_id = 6 },
|
||
{ config_id = 567004, gadget_id = 70211111, pos = { x = 1015.086, y = 301.576, z = 1332.008 }, rot = { x = 353.377, y = 322.861, z = 2.580 }, level = 21, drop_tag = "解谜中级璃月", showcutscene = true, isOneoff = true, persistent = true, explore = { name = "chest", exp = 1 }, area_id = 6 }
|
||
}
|
||
|
||
-- 区域
|
||
regions = {
|
||
}
|
||
|
||
-- 触发器
|
||
triggers = {
|
||
{ config_id = 1567005, name = "GADGET_CREATE_567005", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "condition_EVENT_GADGET_CREATE_567005", action = "action_EVENT_GADGET_CREATE_567005", trigger_count = 0 },
|
||
{ config_id = 1567006, name = "GADGET_STATE_CHANGE_567006", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "condition_EVENT_GADGET_STATE_CHANGE_567006", action = "action_EVENT_GADGET_STATE_CHANGE_567006", trigger_count = 0 },
|
||
{ config_id = 1567007, name = "TIMER_EVENT_567007", event = EventType.EVENT_TIMER_EVENT, source = "", condition = "condition_EVENT_TIMER_EVENT_567007", action = "action_EVENT_TIMER_EVENT_567007", trigger_count = 0 },
|
||
{ config_id = 1567008, name = "VARIABLE_CHANGE_567008", event = EventType.EVENT_VARIABLE_CHANGE, source = "", condition = "condition_EVENT_VARIABLE_CHANGE_567008", action = "action_EVENT_VARIABLE_CHANGE_567008", trigger_count = 0 },
|
||
{ config_id = 1567009, name = "GROUP_REFRESH_567009", event = EventType.EVENT_GROUP_REFRESH, source = "", condition = "", action = "action_EVENT_GROUP_REFRESH_567009", trigger_count = 0 }
|
||
}
|
||
|
||
-- 变量
|
||
variables = {
|
||
{ config_id = 1, name = "active_count", value = 0, no_refresh = false }
|
||
}
|
||
|
||
--================================================================
|
||
--
|
||
-- 初始化配置
|
||
--
|
||
--================================================================
|
||
|
||
-- 初始化时创建
|
||
init_config = {
|
||
suite = 1,
|
||
end_suite = 0,
|
||
rand_suite = false
|
||
}
|
||
|
||
--================================================================
|
||
--
|
||
-- 小组配置
|
||
--
|
||
--================================================================
|
||
|
||
suites = {
|
||
{
|
||
-- suite_id = 1,
|
||
-- description = suite_1,
|
||
monsters = { },
|
||
gadgets = { 567001, 567002, 567003 },
|
||
regions = { },
|
||
triggers = { "GADGET_CREATE_567005", "GADGET_STATE_CHANGE_567006", "TIMER_EVENT_567007", "VARIABLE_CHANGE_567008", "GROUP_REFRESH_567009" },
|
||
rand_weight = 100
|
||
}
|
||
}
|
||
|
||
--================================================================
|
||
--
|
||
-- 触发器
|
||
--
|
||
--================================================================
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_GADGET_CREATE_567005(context, evt)
|
||
if 567001 ~= evt.param1 then
|
||
return false
|
||
end
|
||
|
||
-- 判断变量"active_count"为0
|
||
if ScriptLib.GetGroupVariableValue(context, "active_count") ~= 0 then
|
||
return false
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_GADGET_CREATE_567005(context, evt)
|
||
-- 重新生成指定group,指定suite
|
||
if 0 ~= ScriptLib.RefreshGroup(context, { group_id = 133103567, suite = 1 }) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : refresh_group_to_suite")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_GADGET_STATE_CHANGE_567006(context, evt)
|
||
if defs.gadget_1 ~= evt.param2 and defs.gadget_2 ~= evt.param2 and defs.gadget_3 ~= evt.param2 and defs.gadget_4 ~= evt.param2 then
|
||
return false
|
||
end
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_GADGET_STATE_CHANGE_567006(context, evt)
|
||
if 0 == ScriptLib.GetGroupVariableValue(context, "active_count") then
|
||
ScriptLib.MarkPlayerAction(context, 1001, 1, 1)
|
||
end
|
||
if evt.param1 == GadgetState.Action01 then
|
||
ScriptLib.ChangeGroupVariableValue(context, "active_count", -1)
|
||
elseif evt.param1 == GadgetState.Action02 then
|
||
ScriptLib.ChangeGroupVariableValue(context, "active_count", 1)
|
||
ScriptLib.CreateGroupTimerEvent(context, defs.group_id, tostring(evt.param2), defs.timer)
|
||
else
|
||
return -1
|
||
end
|
||
return 0
|
||
end
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_TIMER_EVENT_567007(context, evt)
|
||
if evt.source_name ~= tostring(defs.gadget_1) and evt.source_name ~= tostring(defs.gadget_2) and evt.source_name ~= tostring(defs.gadget_3) and evt.source_name ~= tostring(defs.gadget_4) then
|
||
return false
|
||
end
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_TIMER_EVENT_567007(context, evt)
|
||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, tonumber(evt.source_name), GadgetState.Action01) then
|
||
return -1
|
||
end
|
||
return 0
|
||
end
|
||
|
||
-- 触发条件
|
||
function condition_EVENT_VARIABLE_CHANGE_567008(context, evt)
|
||
if evt.param1 == evt.param2 then return false end
|
||
|
||
if evt.param1 == -1 then
|
||
ScriptLib.MarkPlayerAction(context, 1001, 4, 1)
|
||
end
|
||
if evt.param1 ~= defs.max_gear then
|
||
return false
|
||
end
|
||
return true
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_VARIABLE_CHANGE_567008(context, evt)
|
||
ScriptLib.CancelGroupTimerEvent(context, defs.group_id, tostring(defs.gadget_1))
|
||
ScriptLib.CancelGroupTimerEvent(context, defs.group_id, tostring(defs.gadget_2))
|
||
ScriptLib.CancelGroupTimerEvent(context, defs.group_id, tostring(defs.gadget_3))
|
||
ScriptLib.CancelGroupTimerEvent(context, defs.group_id, tostring(defs.gadget_4))
|
||
|
||
if defs.gadget_1 ~= 0 then
|
||
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_1, GadgetState.GearStart)
|
||
end
|
||
|
||
if defs.gadget_2 ~= 0 then
|
||
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_2, GadgetState.GearStart)
|
||
end
|
||
|
||
if defs.gadget_3 ~=0 then
|
||
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_3, GadgetState.GearStart)
|
||
end
|
||
|
||
if defs.gadget_4 ~=0 then
|
||
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_4, GadgetState.GearStart)
|
||
end
|
||
|
||
if ScriptLib.CreateGadget(context, { config_id = defs.gadget_chest }) ~= 0 then
|
||
return -1
|
||
end
|
||
ScriptLib.MarkPlayerAction(context, 1001, 3, 1)
|
||
return 0
|
||
end
|
||
|
||
-- 触发操作
|
||
function action_EVENT_GROUP_REFRESH_567009(context, evt)
|
||
-- 将本组内变量名为 "active_count" 的变量设置为 0
|
||
if 0 ~= ScriptLib.SetGroupVariableValue(context, "active_count", 0) then
|
||
ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_groupVariable")
|
||
return -1
|
||
end
|
||
|
||
return 0
|
||
end |