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

-- 怪物
monsters = {
}

-- NPC
npcs = {
}

-- 装置
gadgets = {
	{ config_id = 484, gadget_id = 70900039, pos = { x = -49.8, y = 0.7, z = 640.3 }, rot = { x = 0.0, y = 0.0, z = 0.0 }, level = 1 },
	{ config_id = 485, gadget_id = 70690006, pos = { x = -49.8, y = 0.5, z = 640.3 }, rot = { x = 0.0, y = 202.1, z = 0.0 }, level = 1 },
	{ config_id = 486, gadget_id = 70690001, pos = { x = -49.8, y = 5.0, z = 640.3 }, rot = { x = 90.0, y = 248.4, z = 0.0 }, level = 1 },
	{ config_id = 487, gadget_id = 70690001, pos = { x = -49.8, y = 20.0, z = 640.3 }, rot = { x = 90.0, y = 270.3, z = 0.0 }, level = 1 },
	{ config_id = 488, gadget_id = 70690001, pos = { x = -49.8, y = 35.0, z = 640.3 }, rot = { x = 90.0, y = 252.9, z = 0.0 }, level = 1 },
	{ config_id = 489, gadget_id = 70690001, pos = { x = -49.8, y = 50.0, z = 640.3 }, rot = { x = 90.0, y = 103.0, z = 0.0 }, level = 1 },
	{ config_id = 490, gadget_id = 70690001, pos = { x = -49.8, y = 65.0, z = 640.3 }, rot = { x = 90.0, y = 57.9, z = 0.0 }, level = 1 },
	{ config_id = 491, gadget_id = 70500000, pos = { x = -49.8, y = 80.0, z = 675.3 }, rot = { x = 0.0, y = 156.4, z = 0.0 }, level = 1, point_type = 4001001 },
	{ config_id = 492, gadget_id = 70500000, pos = { x = -49.8, y = 65.0, z = 675.3 }, rot = { x = 0.0, y = 229.6, z = 0.0 }, level = 1, point_type = 4001001 },
	{ config_id = 493, gadget_id = 70500000, pos = { x = -85.8, y = 50.0, z = 640.3 }, rot = { x = 0.0, y = 195.2, z = 0.0 }, level = 1, point_type = 4001001 },
	{ config_id = 494, gadget_id = 70500000, pos = { x = -49.8, y = 80.0, z = 605.3 }, rot = { x = 0.0, y = 263.7, z = 0.0 }, level = 1, point_type = 4001001 },
	{ config_id = 495, gadget_id = 70500000, pos = { x = -49.8, y = 20.0, z = 605.3 }, rot = { x = 0.0, y = 206.3, z = 0.0 }, level = 1, point_type = 4001001 },
	{ config_id = 496, gadget_id = 70500000, pos = { x = -15.8, y = 20.0, z = 640.3 }, rot = { x = 0.0, y = 289.5, z = 0.0 }, level = 1, point_type = 4001001 },
	{ config_id = 497, gadget_id = 70500000, pos = { x = -15.8, y = 80.0, z = 640.3 }, rot = { x = 0.0, y = 144.8, z = 0.0 }, level = 1, point_type = 4001001 },
	{ config_id = 498, gadget_id = 70690006, pos = { x = -49.8, y = 80.0, z = 645.3 }, rot = { x = 90.0, y = 0.0, z = 0.0 }, level = 1 },
	{ config_id = 499, gadget_id = 70690006, pos = { x = -44.8, y = 80.0, z = 640.3 }, rot = { x = 90.0, y = 90.0, z = 0.0 }, level = 1 },
	{ config_id = 500, gadget_id = 70690006, pos = { x = -49.8, y = 80.0, z = 635.3 }, rot = { x = 90.0, y = 180.0, z = 0.0 }, level = 1 },
	{ config_id = 501, gadget_id = 70690006, pos = { x = -54.8, y = 80.0, z = 640.3 }, rot = { x = 90.0, y = 270.0, z = 0.0 }, level = 1 },
	{ config_id = 502, gadget_id = 70690006, pos = { x = -49.8, y = 29.2, z = 605.3 }, rot = { x = 0.0, y = 202.1, z = 0.0 }, level = 1 },
	{ config_id = 503, gadget_id = 70690006, pos = { x = -49.8, y = 50.0, z = 605.3 }, rot = { x = 0.0, y = 202.1, z = 0.0 }, level = 1 },
	{ config_id = 504, gadget_id = 70690006, pos = { x = -49.8, y = 20.0, z = 605.3 }, rot = { x = 90.0, y = 0.0, z = 0.0 }, level = 1 },
	{ config_id = 505, gadget_id = 70690001, pos = { x = -49.8, y = 35.0, z = 605.3 }, rot = { x = 90.0, y = 252.9, z = 0.0 }, level = 1 },
	{ config_id = 506, gadget_id = 70690001, pos = { x = -49.8, y = 50.0, z = 605.3 }, rot = { x = 90.0, y = 252.9, z = 0.0 }, level = 1 },
	{ config_id = 507, gadget_id = 70690001, pos = { x = -49.8, y = 65.0, z = 605.3 }, rot = { x = 90.0, y = 252.9, z = 0.0 }, level = 1 },
	{ config_id = 508, gadget_id = 70900201, pos = { x = -49.8, y = 80.0, z = 675.3 }, rot = { x = 0.0, y = 343.3, z = 0.0 }, level = 1 },
	{ config_id = 509, gadget_id = 70900201, pos = { x = -49.8, y = 65.0, z = 675.3 }, rot = { x = 0.0, y = 75.8, z = 0.0 }, level = 1 },
	{ config_id = 510, gadget_id = 70900201, pos = { x = -85.8, y = 50.0, z = 640.3 }, rot = { x = 0.0, y = 273.7, z = 0.0 }, level = 1 },
	{ config_id = 511, gadget_id = 70900201, pos = { x = -49.8, y = 80.0, z = 605.3 }, rot = { x = 0.0, y = 8.8, z = 0.0 }, level = 1 },
	{ config_id = 512, gadget_id = 70900201, pos = { x = -49.8, y = 20.0, z = 605.3 }, rot = { x = 0.0, y = 51.5, z = 0.0 }, level = 1 },
	{ config_id = 513, gadget_id = 70900201, pos = { x = -15.8, y = 20.0, z = 640.3 }, rot = { x = 0.0, y = 34.5, z = 0.0 }, level = 1 },
	{ config_id = 514, gadget_id = 70900201, pos = { x = -15.8, y = 80.0, z = 640.3 }, rot = { x = 0.0, y = 343.3, z = 0.0 }, level = 1 }
}

-- 区域
regions = {
}

-- 触发器
triggers = {
	{ name = "GADGET_STATE_CHANGE_139", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "condition_EVENT_GADGET_STATE_CHANGE_139", action = "action_EVENT_GADGET_STATE_CHANGE_139" },
	{ name = "GATHER_140", event = EventType.EVENT_GATHER, source = "491", condition = "", action = "action_EVENT_GATHER_140", forbid_guest = false },
	{ name = "GATHER_141", event = EventType.EVENT_GATHER, source = "492", condition = "", action = "action_EVENT_GATHER_141", forbid_guest = false },
	{ name = "GATHER_142", event = EventType.EVENT_GATHER, source = "493", condition = "", action = "action_EVENT_GATHER_142", forbid_guest = false },
	{ name = "GATHER_143", event = EventType.EVENT_GATHER, source = "494", condition = "", action = "action_EVENT_GATHER_143", forbid_guest = false },
	{ name = "GATHER_144", event = EventType.EVENT_GATHER, source = "495", condition = "", action = "action_EVENT_GATHER_144", forbid_guest = false },
	{ name = "GATHER_145", event = EventType.EVENT_GATHER, source = "496", condition = "", action = "action_EVENT_GATHER_145", forbid_guest = false },
	{ name = "GATHER_146", event = EventType.EVENT_GATHER, source = "497", condition = "", action = "action_EVENT_GATHER_146", forbid_guest = false },
	{ name = "VARIABLE_CHANGE_149", event = EventType.EVENT_VARIABLE_CHANGE, source = "num", condition = "", action = "action_EVENT_VARIABLE_CHANGE_149", trigger_count = 7, tag = "69" }
}

-- 变量
variables = {
	{ name = "num", value = 0, no_refresh = true }
}

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

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

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

suites = {
	{
		-- suite_id = 1,
		-- description = ,
		monsters = { },
		gadgets = { 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514 },
		regions = { },
		triggers = { "GADGET_STATE_CHANGE_139", "GATHER_140", "GATHER_141", "GATHER_142", "GATHER_143", "GATHER_144", "GATHER_145", "GATHER_146", "VARIABLE_CHANGE_149" },
		rand_weight = 100
	}
}

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

-- 触发条件
function condition_EVENT_GADGET_STATE_CHANGE_139(context, evt)
	if 484 ~= evt.param2 or GadgetState.GearStart ~= evt.param1 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_GADGET_STATE_CHANGE_139(context, evt)
	-- 创建编号为0（该挑战的识别id),挑战内容为167的区域挑战，具体参数填写方式，见DungeonChallengeData表中的注释，所有填写的值都必须是int类型
	if 0 ~= ScriptLib.ActiveChallenge(context, 0, 167, 60, 3, 69, 7) then
		return -1
	end
	
	return 0
end

-- 触发条件

-- 触发操作
function action_EVENT_GATHER_140(context, evt)
		if 0 ~= ScriptLib.KillEntityByConfigId(context, { config_id = 508 }) then
		    return -1
		end
	
		if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "num", 1) then
	  	return -1
		end
		
		return 0
end

-- 触发条件

-- 触发操作
function action_EVENT_GATHER_141(context, evt)
		if 0 ~= ScriptLib.KillEntityByConfigId(context, { config_id = 509 }) then
		    return -1
		end
	
		if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "num", 1) then
	  	return -1
		end
		
		return 0
end

-- 触发条件

-- 触发操作
function action_EVENT_GATHER_142(context, evt)
		if 0 ~= ScriptLib.KillEntityByConfigId(context, { config_id = 510 }) then
		    return -1
		end
	
		if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "num", 1) then
	  	return -1
		end
		
		return 0
end

-- 触发条件

-- 触发操作
function action_EVENT_GATHER_143(context, evt)
		if 0 ~= ScriptLib.KillEntityByConfigId(context, { config_id = 511 }) then
		    return -1
		end
	
		if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "num", 1) then
	  	return -1
		end
		
		return 0
end

-- 触发条件

-- 触发操作
function action_EVENT_GATHER_144(context, evt)
		if 0 ~= ScriptLib.KillEntityByConfigId(context, { config_id = 512 }) then
		    return -1
		end
	
		if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "num", 1) then
	  	return -1
		end
		
		return 0
end

-- 触发条件

-- 触发操作
function action_EVENT_GATHER_145(context, evt)
		if 0 ~= ScriptLib.KillEntityByConfigId(context, { config_id = 513 }) then
		    return -1
		end
	
		if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "num", 1) then
	  	return -1
		end
		
		return 0
end

-- 触发条件

-- 触发操作
function action_EVENT_GATHER_146(context, evt)
		if 0 ~= ScriptLib.KillEntityByConfigId(context, { config_id = 514 }) then
		    return -1
		end
	
		if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "num", 1) then
	  	return -1
		end
		
		return 0
end

-- 触发条件

-- 触发操作
function action_EVENT_VARIABLE_CHANGE_149(context, evt)
	-- 将configid为 484 的物件更改为状态 GadgetState.Default
	if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, 484, GadgetState.Default) then
			return -1
		end 
	
	return 0
end
