-- 基础信息
local base_info = {
	group_id = 133004910
}

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

-- 怪物
monsters = {
	{ config_id = 910021, monster_id = 28020507, pos = { x = 2218.084, y = 211.990, z = -897.797 }, rot = { x = 0.000, y = 21.353, z = 0.000 }, level = 1, drop_tag = "走兽", pose_id = 4, area_id = 1 },
	{ config_id = 910022, monster_id = 28020507, pos = { x = 2221.100, y = 209.990, z = -921.016 }, rot = { x = 0.000, y = 296.412, z = 0.000 }, level = 1, drop_tag = "走兽", pose_id = 4, area_id = 1 },
	{ config_id = 910023, monster_id = 28020507, pos = { x = 2269.183, y = 211.156, z = -931.720 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, drop_tag = "走兽", pose_id = 4, area_id = 1 },
	{ config_id = 910024, monster_id = 28020507, pos = { x = 2288.553, y = 213.990, z = -907.464 }, rot = { x = 0.000, y = 280.512, z = 0.000 }, level = 1, drop_tag = "走兽", pose_id = 4, area_id = 1 },
	{ config_id = 910025, monster_id = 28020507, pos = { x = 2257.366, y = 215.990, z = -868.918 }, rot = { x = 0.000, y = 168.141, z = 0.000 }, level = 1, drop_tag = "走兽", pose_id = 12, area_id = 1 },
	{ config_id = 910042, monster_id = 28020507, pos = { x = 2257.439, y = 215.990, z = -868.932 }, rot = { x = 0.000, y = 174.343, z = 0.000 }, level = 1, drop_tag = "走兽", pose_id = 12, area_id = 1 }
}

-- NPC
npcs = {
}

-- 装置
gadgets = {
	{ config_id = 910001, gadget_id = 70710014, pos = { x = 2253.015, y = 215.947, z = -873.180 }, rot = { x = 0.000, y = 282.439, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910002, gadget_id = 70710014, pos = { x = 2246.375, y = 215.990, z = -871.587 }, rot = { x = 0.000, y = 292.668, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910003, gadget_id = 70710014, pos = { x = 2235.938, y = 216.090, z = -868.579 }, rot = { x = 0.000, y = 243.805, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910004, gadget_id = 70710014, pos = { x = 2227.360, y = 215.988, z = -880.715 }, rot = { x = 0.000, y = 207.861, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910005, gadget_id = 70710014, pos = { x = 2213.756, y = 209.990, z = -906.000 }, rot = { x = 0.000, y = 202.104, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910006, gadget_id = 70710014, pos = { x = 2214.043, y = 209.990, z = -914.639 }, rot = { x = 0.000, y = 133.335, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910007, gadget_id = 70710014, pos = { x = 2226.805, y = 209.990, z = -924.341 }, rot = { x = 0.000, y = 97.239, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910008, gadget_id = 70710014, pos = { x = 2284.772, y = 213.993, z = -905.503 }, rot = { x = 0.000, y = 317.888, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910009, gadget_id = 70710014, pos = { x = 2239.935, y = 211.990, z = -920.935 }, rot = { x = 0.000, y = 116.485, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910010, gadget_id = 70710014, pos = { x = 2250.607, y = 212.090, z = -926.570 }, rot = { x = 0.000, y = 116.625, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910011, gadget_id = 70710014, pos = { x = 2258.657, y = 209.990, z = -930.407 }, rot = { x = 0.000, y = 100.247, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910012, gadget_id = 70710014, pos = { x = 2275.797, y = 211.992, z = -929.719 }, rot = { x = 0.000, y = 73.360, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910013, gadget_id = 70710014, pos = { x = 2289.267, y = 213.990, z = -924.269 }, rot = { x = 0.000, y = 67.966, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910014, gadget_id = 70710014, pos = { x = 2285.142, y = 215.990, z = -896.064 }, rot = { x = 0.000, y = 354.506, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910015, gadget_id = 70710014, pos = { x = 2298.098, y = 213.990, z = -918.383 }, rot = { x = 0.000, y = 14.007, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910016, gadget_id = 70710014, pos = { x = 2295.548, y = 213.990, z = -911.051 }, rot = { x = 0.000, y = 295.349, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910017, gadget_id = 70710014, pos = { x = 2282.301, y = 215.990, z = -888.647 }, rot = { x = 0.000, y = 296.798, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910018, gadget_id = 70710014, pos = { x = 2273.318, y = 215.990, z = -884.243 }, rot = { x = 0.000, y = 297.688, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910019, gadget_id = 70710014, pos = { x = 2267.776, y = 215.990, z = -881.421 }, rot = { x = 0.000, y = 314.533, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910020, gadget_id = 70710014, pos = { x = 2262.884, y = 215.947, z = -877.025 }, rot = { x = 0.000, y = 313.379, z = 0.000 }, level = 1, area_id = 1 },
	{ config_id = 910030, gadget_id = 70710024, pos = { x = 2217.615, y = 211.990, z = -899.330 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 2, area_id = 1 },
	{ config_id = 910033, gadget_id = 70710024, pos = { x = 2221.656, y = 209.990, z = -921.944 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, area_id = 1 },
	{ config_id = 910034, gadget_id = 70710024, pos = { x = 2268.974, y = 211.143, z = -931.913 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, area_id = 1 },
	{ config_id = 910035, gadget_id = 70710024, pos = { x = 2288.145, y = 213.990, z = -908.347 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, area_id = 1 }
}

-- 区域
regions = {
	{ config_id = 910043, shape = RegionShape.SPHERE, radius = 8, pos = { x = 2223.379, y = 214.017, z = -889.092 }, area_id = 1 }
}

-- 触发器
triggers = {
	{ config_id = 1910026, name = "ANY_MONSTER_DIE_910026", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_910026", action = "action_EVENT_ANY_MONSTER_DIE_910026", trigger_count = 0 },
	{ config_id = 1910027, name = "ANY_MONSTER_DIE_910027", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_910027", action = "action_EVENT_ANY_MONSTER_DIE_910027", trigger_count = 0 },
	{ config_id = 1910028, name = "ANY_MONSTER_DIE_910028", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_910028", action = "action_EVENT_ANY_MONSTER_DIE_910028", trigger_count = 0 },
	{ config_id = 1910029, name = "ANY_MONSTER_DIE_910029", event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "condition_EVENT_ANY_MONSTER_DIE_910029", action = "action_EVENT_ANY_MONSTER_DIE_910029", trigger_count = 0 },
	{ config_id = 1910031, name = "SELECT_OPTION_910031", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "condition_EVENT_SELECT_OPTION_910031", action = "action_EVENT_SELECT_OPTION_910031", trigger_count = 0 },
	{ config_id = 1910032, name = "GADGET_CREATE_910032", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "condition_EVENT_GADGET_CREATE_910032", action = "action_EVENT_GADGET_CREATE_910032", trigger_count = 0 },
	{ config_id = 1910036, name = "SELECT_OPTION_910036", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "condition_EVENT_SELECT_OPTION_910036", action = "action_EVENT_SELECT_OPTION_910036", trigger_count = 0 },
	{ config_id = 1910037, name = "SELECT_OPTION_910037", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "condition_EVENT_SELECT_OPTION_910037", action = "action_EVENT_SELECT_OPTION_910037", trigger_count = 0 },
	{ config_id = 1910038, name = "SELECT_OPTION_910038", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "condition_EVENT_SELECT_OPTION_910038", action = "action_EVENT_SELECT_OPTION_910038", trigger_count = 0 },
	{ config_id = 1910039, name = "GADGET_CREATE_910039", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "condition_EVENT_GADGET_CREATE_910039", action = "action_EVENT_GADGET_CREATE_910039", trigger_count = 0 },
	{ config_id = 1910040, name = "GADGET_CREATE_910040", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "condition_EVENT_GADGET_CREATE_910040", action = "action_EVENT_GADGET_CREATE_910040", trigger_count = 0 },
	{ config_id = 1910041, name = "GADGET_CREATE_910041", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "condition_EVENT_GADGET_CREATE_910041", action = "action_EVENT_GADGET_CREATE_910041", trigger_count = 0 },
	{ config_id = 1910043, name = "ENTER_REGION_910043", event = EventType.EVENT_ENTER_REGION, source = "", condition = "condition_EVENT_ENTER_REGION_910043", action = "", trigger_count = 0 }
}

-- 变量
variables = {
}

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

-- 初始化时创建
init_config = {
	suite = 6,
	end_suite = 0,
	rand_suite = false
}

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

suites = {
	{
		-- suite_id = 1,
		-- description = ,
		monsters = { 910021 },
		gadgets = { 910001, 910002, 910003, 910004, 910030 },
		regions = { 910043 },
		triggers = { "ANY_MONSTER_DIE_910026", "SELECT_OPTION_910031", "GADGET_CREATE_910032", "ENTER_REGION_910043" },
		rand_weight = 100
	},
	{
		-- suite_id = 2,
		-- description = suite_2,
		monsters = { 910022 },
		gadgets = { 910005, 910006, 910033 },
		regions = { },
		triggers = { "ANY_MONSTER_DIE_910027", "SELECT_OPTION_910036", "GADGET_CREATE_910039" },
		rand_weight = 100
	},
	{
		-- suite_id = 3,
		-- description = suite_3,
		monsters = { 910023 },
		gadgets = { 910007, 910009, 910010, 910011, 910034 },
		regions = { },
		triggers = { "ANY_MONSTER_DIE_910028", "SELECT_OPTION_910037", "GADGET_CREATE_910040" },
		rand_weight = 100
	},
	{
		-- suite_id = 4,
		-- description = suite_4,
		monsters = { 910024 },
		gadgets = { 910012, 910013, 910015, 910016, 910035 },
		regions = { },
		triggers = { "ANY_MONSTER_DIE_910029", "SELECT_OPTION_910038", "GADGET_CREATE_910041" },
		rand_weight = 100
	},
	{
		-- suite_id = 5,
		-- description = suite_5,
		monsters = { 910025 },
		gadgets = { 910008, 910014, 910017, 910018, 910019, 910020 },
		regions = { },
		triggers = { },
		rand_weight = 100
	},
	{
		-- suite_id = 6,
		-- description = suite_6,
		monsters = { },
		gadgets = { },
		regions = { },
		triggers = { },
		rand_weight = 100
	},
	{
		-- suite_id = 7,
		-- description = suite_7,
		monsters = { 910042 },
		gadgets = { },
		regions = { },
		triggers = { },
		rand_weight = 100
	}
}

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

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_910026(context, evt)
	--判断死亡怪物的configid是否为 910021
	if evt.param1 ~= 910021 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_910026(context, evt)
	-- 通知任务系统完成条件类型"LUA通知"，复杂参数为quest_param的进度+1
	if 0 ~= ScriptLib.AddQuestProgress(context, "133004910") then
		ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : add_quest_progress")
	  return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_910027(context, evt)
	--判断死亡怪物的configid是否为 910022
	if evt.param1 ~= 910022 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_910027(context, evt)
	-- 通知任务系统完成条件类型"LUA通知"，复杂参数为quest_param的进度+1
	if 0 ~= ScriptLib.AddQuestProgress(context, "133004910") then
		ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : add_quest_progress")
	  return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_910028(context, evt)
	--判断死亡怪物的configid是否为 910023
	if evt.param1 ~= 910023 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_910028(context, evt)
	-- 通知任务系统完成条件类型"LUA通知"，复杂参数为quest_param的进度+1
	if 0 ~= ScriptLib.AddQuestProgress(context, "133004910") then
		ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : add_quest_progress")
	  return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_MONSTER_DIE_910029(context, evt)
	--判断死亡怪物的configid是否为 910024
	if evt.param1 ~= 910024 then
	    return false
	 end
	  
	
	return true
end

-- 触发操作
function action_EVENT_ANY_MONSTER_DIE_910029(context, evt)
	-- 通知任务系统完成条件类型"LUA通知"，复杂参数为quest_param的进度+1
	if 0 ~= ScriptLib.AddQuestProgress(context, "133004910") then
		ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : add_quest_progress")
	  return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_SELECT_OPTION_910031(context, evt)
	-- 判断是gadgetid 910030 option_id 2903
	if 910030 ~= evt.param1 then
		return false	
	end
	
	if 2903 ~= evt.param2 then
		return false
	end
	
	
	return true
end

-- 触发操作
function action_EVENT_SELECT_OPTION_910031(context, evt)
	-- 通知任务系统完成条件类型"LUA通知"，复杂参数为quest_param的进度+1
	if 0 ~= ScriptLib.AddQuestProgress(context, "13300491001") then
		ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : add_quest_progress")
	  return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_GADGET_CREATE_910032(context, evt)
	if 910030 ~= evt.param1 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_GADGET_CREATE_910032(context, evt)
	-- 设置操作台选项
	if 0 ~= ScriptLib.SetWorktopOptionsByGroupId(context, 133004910, 910030, {2903}) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_wok_options_by_configid")
		return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_SELECT_OPTION_910036(context, evt)
	-- 判断是gadgetid 910033 option_id 2903
	if 910033 ~= evt.param1 then
		return false	
	end
	
	if 2903 ~= evt.param2 then
		return false
	end
	
	
	return true
end

-- 触发操作
function action_EVENT_SELECT_OPTION_910036(context, evt)
	-- 通知任务系统完成条件类型"LUA通知"，复杂参数为quest_param的进度+1
	if 0 ~= ScriptLib.AddQuestProgress(context, "13300491001") then
		ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : add_quest_progress")
	  return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_SELECT_OPTION_910037(context, evt)
	-- 判断是gadgetid 910034 option_id 2903
	if 910034 ~= evt.param1 then
		return false	
	end
	
	if 2903 ~= evt.param2 then
		return false
	end
	
	
	return true
end

-- 触发操作
function action_EVENT_SELECT_OPTION_910037(context, evt)
	-- 通知任务系统完成条件类型"LUA通知"，复杂参数为quest_param的进度+1
	if 0 ~= ScriptLib.AddQuestProgress(context, "13300491001") then
		ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : add_quest_progress")
	  return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_SELECT_OPTION_910038(context, evt)
	-- 判断是gadgetid 910035 option_id 2903
	if 910035 ~= evt.param1 then
		return false	
	end
	
	if 2903 ~= evt.param2 then
		return false
	end
	
	
	return true
end

-- 触发操作
function action_EVENT_SELECT_OPTION_910038(context, evt)
	-- 通知任务系统完成条件类型"LUA通知"，复杂参数为quest_param的进度+1
	if 0 ~= ScriptLib.AddQuestProgress(context, "13300491001") then
		ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : add_quest_progress")
	  return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_GADGET_CREATE_910039(context, evt)
	if 910033 ~= evt.param1 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_GADGET_CREATE_910039(context, evt)
	-- 设置操作台选项
	if 0 ~= ScriptLib.SetWorktopOptionsByGroupId(context, 133004910, 910033, {2903}) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_wok_options_by_configid")
		return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_GADGET_CREATE_910040(context, evt)
	if 910034 ~= evt.param1 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_GADGET_CREATE_910040(context, evt)
	-- 设置操作台选项
	if 0 ~= ScriptLib.SetWorktopOptionsByGroupId(context, 133004910, 910034, {2903}) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_wok_options_by_configid")
		return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_GADGET_CREATE_910041(context, evt)
	if 910035 ~= evt.param1 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_GADGET_CREATE_910041(context, evt)
	-- 设置操作台选项
	if 0 ~= ScriptLib.SetWorktopOptionsByGroupId(context, 133004910, 910035, {2903}) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : set_wok_options_by_configid")
		return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_ENTER_REGION_910043(context, evt)
	if ScriptLib.GetEntityType(evt.target_eid) == EntityType.AVATAR and ScriptLib.GetQuestState(context, evt.target_eid, 48704) == QuestState.UNFINISHED and evt.param1 == 910043 then
	 return true
	end
	return false
end