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

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

-- 怪物
monsters = {
}

-- NPC
npcs = {
}

-- 装置
gadgets = {
	{ config_id = 5001, gadget_id = 70220109, pos = { x = -238.613, y = 180.548, z = 2269.976 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5008, gadget_id = 70220109, pos = { x = -240.479, y = 180.542, z = 2270.676 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5009, gadget_id = 70220109, pos = { x = -241.961, y = 180.709, z = 2269.365 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5010, gadget_id = 70220109, pos = { x = -241.698, y = 180.991, z = 2267.451 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5011, gadget_id = 70220109, pos = { x = -268.434, y = 164.775, z = 2284.318 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5012, gadget_id = 70220109, pos = { x = -264.196, y = 165.723, z = 2284.110 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5013, gadget_id = 70220109, pos = { x = -258.231, y = 167.840, z = 2281.904 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5018, gadget_id = 70220005, pos = { x = -235.286, y = 179.709, z = 2271.651 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5021, gadget_id = 70220005, pos = { x = -250.446, y = 195.779, z = 2247.039 }, rot = { x = 12.080, y = 70.095, z = 102.674 }, level = 27, area_id = 24 },
	{ config_id = 5022, gadget_id = 70220005, pos = { x = -250.466, y = 195.435, z = 2246.557 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5023, gadget_id = 70220005, pos = { x = -240.985, y = 179.749, z = 2273.820 }, rot = { x = 287.494, y = -0.001, z = 96.279 }, level = 27, area_id = 24 },
	{ config_id = 5024, gadget_id = 70220005, pos = { x = -241.080, y = 179.722, z = 2273.145 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5030, gadget_id = 70220109, pos = { x = -238.629, y = 180.696, z = 2268.173 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5031, gadget_id = 70220109, pos = { x = -239.921, y = 181.111, z = 2267.036 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5034, gadget_id = 70220005, pos = { x = -272.401, y = 164.159, z = 2287.089 }, rot = { x = 0.000, y = 125.308, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5035, gadget_id = 70220005, pos = { x = -262.227, y = 166.321, z = 2277.015 }, rot = { x = 0.000, y = 194.899, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5036, gadget_id = 70220005, pos = { x = -191.440, y = 219.828, z = 2262.712 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5037, gadget_id = 70220005, pos = { x = -216.412, y = 215.759, z = 2264.518 }, rot = { x = 0.000, y = 345.682, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5038, gadget_id = 70220005, pos = { x = -200.829, y = 217.368, z = 2260.158 }, rot = { x = 274.167, y = 161.212, z = 221.637 }, level = 27, area_id = 24 },
	{ config_id = 5039, gadget_id = 70220024, pos = { x = -209.570, y = 214.706, z = 2261.430 }, rot = { x = 344.255, y = 73.228, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5040, gadget_id = 70220005, pos = { x = -201.511, y = 217.175, z = 2260.428 }, rot = { x = 0.000, y = 133.387, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5041, gadget_id = 70220005, pos = { x = -224.247, y = 210.980, z = 2260.587 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5042, gadget_id = 70220005, pos = { x = -213.947, y = 214.418, z = 2259.376 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5043, gadget_id = 70220005, pos = { x = -213.568, y = 213.309, z = 2256.250 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5044, gadget_id = 70220005, pos = { x = -262.465, y = 165.976, z = 2279.179 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5045, gadget_id = 70330220, pos = { x = -304.994, y = 150.754, z = 2273.672 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5046, gadget_id = 70330220, pos = { x = -289.787, y = 157.316, z = 2279.673 }, rot = { x = 0.000, y = 296.954, z = 0.000 }, level = 27, area_id = 24 },
	{ config_id = 5047, gadget_id = 70330220, pos = { x = -267.360, y = 164.949, z = 2278.835 }, rot = { x = 0.000, y = 21.534, z = 0.000 }, level = 27, area_id = 24 }
}

-- 区域
regions = {
	{ config_id = 5003, shape = RegionShape.SPHERE, radius = 10, pos = { x = -260.519, y = 168.303, z = 2282.364 }, area_id = 24 },
	{ config_id = 5004, shape = RegionShape.SPHERE, radius = 10, pos = { x = -306.086, y = 152.055, z = 2276.680 }, area_id = 24 },
	{ config_id = 5005, shape = RegionShape.SPHERE, radius = 10, pos = { x = -240.673, y = 181.066, z = 2264.561 }, area_id = 24 },
	{ config_id = 5007, shape = RegionShape.SPHERE, radius = 10, pos = { x = -214.528, y = 212.110, z = 2262.178 }, area_id = 24 }
}

-- 触发器
triggers = {
	{ config_id = 1005002, name = "QUEST_START_5002", event = EventType.EVENT_QUEST_START, source = "7306118", condition = "", action = "action_EVENT_QUEST_START_5002", trigger_count = 0 },
	{ config_id = 1005003, name = "ENTER_REGION_5003", event = EventType.EVENT_ENTER_REGION, source = "", condition = "condition_EVENT_ENTER_REGION_5003", action = "action_EVENT_ENTER_REGION_5003" },
	{ config_id = 1005004, name = "ENTER_REGION_5004", event = EventType.EVENT_ENTER_REGION, source = "", condition = "condition_EVENT_ENTER_REGION_5004", action = "action_EVENT_ENTER_REGION_5004" },
	{ config_id = 1005005, name = "ENTER_REGION_5005", event = EventType.EVENT_ENTER_REGION, source = "", condition = "condition_EVENT_ENTER_REGION_5005", action = "action_EVENT_ENTER_REGION_5005" },
	{ config_id = 1005006, name = "VARIABLE_CHANGE_5006", event = EventType.EVENT_VARIABLE_CHANGE, source = "", condition = "condition_EVENT_VARIABLE_CHANGE_5006", action = "action_EVENT_VARIABLE_CHANGE_5006" },
	{ config_id = 1005007, name = "ENTER_REGION_5007", event = EventType.EVENT_ENTER_REGION, source = "", condition = "condition_EVENT_ENTER_REGION_5007", action = "action_EVENT_ENTER_REGION_5007" },
	{ config_id = 1005016, name = "QUEST_START_5016", event = EventType.EVENT_QUEST_START, source = "7306119", condition = "", action = "action_EVENT_QUEST_START_5016", trigger_count = 0 },
	{ config_id = 1005025, name = "ANY_GADGET_DIE_5025", event = EventType.EVENT_ANY_GADGET_DIE, source = "", condition = "condition_EVENT_ANY_GADGET_DIE_5025", action = "action_EVENT_ANY_GADGET_DIE_5025" }
}

-- 变量
variables = {
	{ config_id = 1, name = "boom", value = 1, no_refresh = true }
}

-- 废弃数据
garbages = {
	gadgets = {
		{ config_id = 5014, gadget_id = 70220109, pos = { x = -249.482, y = 194.654, z = 2248.017 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
		{ config_id = 5015, gadget_id = 70220109, pos = { x = -249.754, y = 194.237, z = 2250.789 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 },
		{ config_id = 5027, gadget_id = 70220109, pos = { x = -251.770, y = 194.850, z = 2251.135 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 27, area_id = 24 }
	}
}

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

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

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

suites = {
	{
		-- suite_id = 1,
		-- description = ,
		monsters = { },
		gadgets = { 5045, 5046, 5047 },
		regions = { },
		triggers = { "QUEST_START_5002", "QUEST_START_5016" },
		rand_weight = 100
	},
	{
		-- suite_id = 2,
		-- description = ,
		monsters = { },
		gadgets = { },
		regions = { },
		triggers = { },
		rand_weight = 100
	},
	{
		-- suite_id = 3,
		-- description = ,
		monsters = { },
		gadgets = { 5001, 5008, 5009, 5010, 5011, 5012, 5013, 5018, 5021, 5022, 5023, 5024, 5030, 5031, 5034, 5035, 5036, 5037, 5038, 5039, 5040, 5041, 5042, 5043, 5044 },
		regions = { 5003, 5004, 5005, 5007 },
		triggers = { "ENTER_REGION_5003", "ENTER_REGION_5004", "ENTER_REGION_5005", "VARIABLE_CHANGE_5006", "ENTER_REGION_5007", "ANY_GADGET_DIE_5025" },
		rand_weight = 100
	}
}

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

-- 触发操作
function action_EVENT_QUEST_START_5002(context, evt)
	-- 触发镜头注目，注目位置为坐标{x=-273.525, y=103.6328, z=2212.746}，持续时间为2秒，并且为强制注目形式，不广播其他玩家
		local pos = {x=-273.525, y=103.6328, z=2212.746}
	  local pos_follow = {x=0, y=0, z=0}
	    if 0 ~= ScriptLib.BeginCameraSceneLook(context, { look_pos = pos, is_allow_input = false, duration = 2, is_force = true, is_broadcast = false, is_recover_keep_current = true, delay = 0,
	                                                      is_set_follow_pos = false, follow_pos = pos_follow, is_force_walk = false, is_change_play_mode = false,
	                                                      is_set_screen_XY = false, screen_x = 0, screen_y = 0 }) then
					ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : active_cameraLook_Begin")
	        return -1
				end 
	
	return 0
end

-- 触发条件
function condition_EVENT_ENTER_REGION_5003(context, evt)
	if evt.param1 ~= 5003 then return false end
	
	-- 判断是区域5003
	if ScriptLib.GetRegionConfigId(context, { region_eid = evt.source_eid }) ~= 5003 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_ENTER_REGION_5003(context, evt)
	-- 调用提示id为 60010413 的提示UI，会显示在屏幕中央偏下位置，id索引自 ReminderData表格
	if 0 ~= ScriptLib.ShowReminder(context, 60010413) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : active_reminder_ui")
		return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_ENTER_REGION_5004(context, evt)
	if evt.param1 ~= 5004 then return false end
	
	-- 判断是区域5004
	if ScriptLib.GetRegionConfigId(context, { region_eid = evt.source_eid }) ~= 5004 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_ENTER_REGION_5004(context, evt)
	-- 调用提示id为 60010412 的提示UI，会显示在屏幕中央偏下位置，id索引自 ReminderData表格
	if 0 ~= ScriptLib.ShowReminder(context, 60010412) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : active_reminder_ui")
		return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_ENTER_REGION_5005(context, evt)
	if evt.param1 ~= 5005 then return false end
	
	-- 判断是区域5005
	if ScriptLib.GetRegionConfigId(context, { region_eid = evt.source_eid }) ~= 5005 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_ENTER_REGION_5005(context, evt)
	-- 针对当前group内变量名为 "boom" 的变量，进行修改，变化值为 1
	if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "boom", 1) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
	  return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_VARIABLE_CHANGE_5006(context, evt)
	if evt.param1 == evt.param2 then return false end
	
	-- 判断变量"boom"为1
	if ScriptLib.GetGroupVariableValue(context, "boom") ~= 1 then
			return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_VARIABLE_CHANGE_5006(context, evt)
	-- 调用提示id为 60010414 的提示UI，会显示在屏幕中央偏下位置，id索引自 ReminderData表格
	if 0 ~= ScriptLib.ShowReminder(context, 60010414) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : active_reminder_ui")
		return -1
	end
	
	return 0
end

-- 触发条件
function condition_EVENT_ENTER_REGION_5007(context, evt)
	if evt.param1 ~= 5007 then return false end
	
	-- 判断是区域5007
	if ScriptLib.GetRegionConfigId(context, { region_eid = evt.source_eid }) ~= 5007 then
		return false
	end
	
	return true
end

-- 触发操作
function action_EVENT_ENTER_REGION_5007(context, evt)
	-- 调用提示id为 60010415 的提示UI，会显示在屏幕中央偏下位置，id索引自 ReminderData表格
	if 0 ~= ScriptLib.ShowReminder(context, 60010415) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : active_reminder_ui")
		return -1
	end
	
	return 0
end

-- 触发操作
function action_EVENT_QUEST_START_5016(context, evt)
	-- 添加suite3的新内容
	    ScriptLib.AddExtraGroupSuite(context, 133302005, 3)
	
	return 0
end

-- 触发条件
function condition_EVENT_ANY_GADGET_DIE_5025(context, evt)
	if 5018 == evt.param1 then
		return true
	
	
	elseif 5020 == evt.param1 then
		return true
	
	elseif 5021 == evt.param1 then
		return true
	
	elseif 5022 == evt.param1 then
		return true
	
	elseif 5023 == evt.param1 then
		return true
	
	elseif 5024 == evt.param1 then
		return true
	
	
	elseif 5034 == evt.param1 then
		return true
	
	elseif 5035 == evt.param1 then
		return true
	
	elseif 5036 == evt.param1 then
		return true
	
	elseif 5037 == evt.param1 then
		return true
	
	elseif 5038 == evt.param1 then
		return true
	
	elseif 5040 == evt.param1 then
		return true
	
	elseif 5041 == evt.param1 then
		return true
	
	elseif 5042 == evt.param1 then
		return true
	
	elseif 5043 == evt.param1 then
		return true
	
	
	elseif 5044 == evt.param1 then
		return true
	end
	return false
end

-- 触发操作
function action_EVENT_ANY_GADGET_DIE_5025(context, evt)
	-- 针对当前group内变量名为 "boom" 的变量，进行修改，变化值为 1
	if 0 ~= ScriptLib.ChangeGroupVariableValue(context, "boom", 1) then
	  ScriptLib.PrintContextLog(context, "@@ LUA_WARNING : change_GroupVariable")
	  return -1
	end
	
	return 0
end

require "V3_0/DeathFieldStandard"