--================================================================
-- 
-- 配置
-- 
--================================================================

-- 怪物
monsters = {
}

-- NPC
npcs = {
}

-- 装置
gadgets = {
	{ config_id = 329, gadget_id = 70310002, pos = { x = 584.3, y = -54.5, z = 202.9 }, rot = { x = 0.0, y = 93.3, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 330, gadget_id = 70310002, pos = { x = 584.3, y = -54.5, z = 210.1 }, rot = { x = 0.0, y = 90.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 331, gadget_id = 70310001, pos = { x = 579.4, y = -60.1, z = 216.3 }, rot = { x = 0.0, y = 277.4, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 332, gadget_id = 70310001, pos = { x = 576.6, y = -60.1, z = 216.4 }, rot = { x = 0.0, y = 318.8, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 333, gadget_id = 70310001, pos = { x = 552.5, y = -68.5, z = 223.1 }, rot = { x = 0.0, y = 2.2, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 334, gadget_id = 70310001, pos = { x = 546.4, y = -68.5, z = 215.0 }, rot = { x = 0.0, y = 300.7, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 339, gadget_id = 70310001, pos = { x = 542.2, y = -63.1, z = 197.1 }, rot = { x = 0.0, y = 16.6, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 340, gadget_id = 70310001, pos = { x = 541.2, y = -59.7, z = 192.7 }, rot = { x = 0.0, y = 260.9, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 341, gadget_id = 70310002, pos = { x = 524.3, y = -62.6, z = 212.9 }, rot = { x = 0.0, y = 180.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 342, gadget_id = 70310002, pos = { x = 523.4, y = -62.7, z = 214.0 }, rot = { x = 0.0, y = 270.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 343, gadget_id = 70310002, pos = { x = 524.4, y = -62.8, z = 200.5 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 344, gadget_id = 70310002, pos = { x = 510.0, y = -64.9, z = 199.6 }, rot = { x = 0.0, y = 90.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 345, gadget_id = 70310002, pos = { x = 510.0, y = -62.8, z = 213.9 }, rot = { x = 0.0, y = 90.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 350, gadget_id = 70310001, pos = { x = 440.5, y = -28.5, z = 276.0 }, rot = { x = 0.0, y = 183.1, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 351, gadget_id = 70310001, pos = { x = 446.2, y = -28.5, z = 280.5 }, rot = { x = 0.0, y = 23.3, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 352, gadget_id = 70310001, pos = { x = 467.3, y = -28.5, z = 256.3 }, rot = { x = 0.0, y = 45.4, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 356, gadget_id = 70310002, pos = { x = 414.4, y = -19.2, z = 169.2 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 357, gadget_id = 70310002, pos = { x = 414.3, y = -19.2, z = 177.8 }, rot = { x = 0.0, y = 180.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 358, gadget_id = 70310002, pos = { x = 402.2, y = -16.5, z = 159.4 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 359, gadget_id = 70310002, pos = { x = 373.4, y = -16.3, z = 159.4 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 360, gadget_id = 70310002, pos = { x = 373.3, y = -15.9, z = 187.2 }, rot = { x = 0.0, y = 180.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 361, gadget_id = 70310002, pos = { x = 402.1, y = -16.2, z = 187.2 }, rot = { x = 0.0, y = 180.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 409, gadget_id = 70310002, pos = { x = 489.9, y = -51.3, z = 261.4 }, rot = { x = 0.0, y = 3.1, z = 0.0 }, level = 1 },
	{ config_id = 410, gadget_id = 70310002, pos = { x = 484.2, y = -51.3, z = 261.4 }, rot = { x = 0.0, y = 3.1, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 412, gadget_id = 70310002, pos = { x = 489.9, y = -51.3, z = 271.4 }, rot = { x = 0.0, y = 180.0, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 413, gadget_id = 70310002, pos = { x = 484.2, y = -51.3, z = 271.5 }, rot = { x = 0.0, y = 180.0, z = 0.0 }, level = 1 },
	{ config_id = 414, gadget_id = 70210031, pos = { x = 479.1, y = -54.7, z = 266.3 }, rot = { x = 0.0, y = 89.2, z = 0.0 }, level = 1, chest_drop_id = 1000104, type = GadgetType.GADGET_DUNGEON_SECRET_CHEST },
	{ config_id = 415, gadget_id = 70310001, pos = { x = 479.4, y = -54.7, z = 264.1 }, rot = { x = 0.0, y = 260.9, z = 0.0 }, level = 1, state = GadgetState.GearStart },
	{ config_id = 416, gadget_id = 70310001, pos = { x = 479.4, y = -54.7, z = 268.4 }, rot = { x = 0.0, y = 260.9, z = 0.0 }, level = 1, state = GadgetState.GearStart }
}

-- 区域
regions = {
	{ config_id = 39, shape = RegionShape.SPHERE, radius = 5, pos = { x = 615.1, y = -57.5, z = 207.0 } }
}

-- 触发器
triggers = {
	{ name = "CLIENT_EXECUTE_39", event = EventType.EVENT_CLIENT_EXECUTE, source = "FireSourceChange", condition = "", action = "action_EVENT_CLIENT_EXECUTE_39", trigger_count = 0 }
}

-- 变量
variables = {
}

--================================================================
-- 
-- 初始化配置
-- 
--================================================================

-- 初始化时创建
init_config = {
	suite = 1,
	rand_suite = true,
	npcs = { }
}

--================================================================
-- 
-- 小组配置
-- 
--================================================================

suites = {
	{
		-- suite_id = 0,
		-- description = ,
		monsters = { },
		gadgets = { 329, 330, 331, 332, 333, 334, 339, 340, 341, 342, 343, 344, 345, 350, 351, 352, 356, 357, 358, 359, 360, 361, 409, 410, 412, 413, 414, 415, 416 },
		regions = { 39 },
		triggers = { "CLIENT_EXECUTE_39" },
		rand_weight = 100
	}
}

--================================================================
-- 
-- 触发器
-- 
--================================================================

-- 触发条件

-- 触发操作
function action_EVENT_CLIENT_EXECUTE_39(context, evt)
	-- 针对groupid为 220008006 中该config对应的物件进行状态改变操作
	local this_gadget = ScriptLib.GetGadgetConfigId(context, { gadget_eid = evt.source_eid })
		--ScriptLib.PrintLog("config_id="..this_gadget)
	
		if evt.param1 == 1 then
			ScriptLib.SetGroupGadgetStateByConfigId(context, 220008006, this_gadget, GadgetState.GearStart )
			return 0
		end
	
		if evt.param1 == 0 then
			ScriptLib.SetGroupGadgetStateByConfigId(context, 220008006, this_gadget, GadgetState.Default )
			return 0
		end
	
	return 0
end
