------------------------------------------------Variables------------------------------------------------

require( "package/quests/q_variables_define.lua" );
DebugOut( "generate main quests (file : package/quests/q_golden_syrup.lua)" );

--####################################################################################################
--########################### QUETE 5 : LES MIROIRS DU MONDE FEERIQUE ################################
--####################################################################################################

function F_mirrors_end()
	PopElementTask("TASK_clean_mirrors")
	if not IsQuestCompleted("Q_Stone_Faery") then
		PushTask("TASK_faery_circle","TASK_faery_circle",21)
	end
	SetCleanable("SD_mirroir", true)
	EndGame()
end

------------------------------------------------------------------------------------------------------
---------------------Functions Part 1 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_a_cleaning_end( sOwnerName )
	SetVisible("LD_mirror_A_cleaning",false);
	SetVisible("LD_mirror_A_fixing",true);
	DisplayQuestElementInTome( "Q_mirror_a_fixing", true )
	return true;
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 2 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_a_fixing_end( sOwnerName )
	SetVisible( "LD_mirror_A_fixing", false )
	if not IsQuestCompleted("Q_firefly_kingdom") then
		SetVisible( "LD_mirror_A_repaired", true )
	end
	return true
end

------------------------------------------------------------------------------------------------------
---------------------Functions Part 3 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_b_cleaning_end( sOwnerName )
	SetVisible("LD_mirror_B_cleaning",false)
	SetVisible("LD_mirror_B_fixing",true)
	DisplayQuestElementInTome( "Q_mirror_b_fixing", true )
	return true;
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 4 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_b_fixing_end( sOwnerName )
	SetVisible( "LD_mirror_B_fixing", false )
	if not IsQuestCompleted("Q_firefly_kingdom") then
		SetVisible( "LD_mirror_B_repaired", true )
	end
	return true
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 5 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_c_cleaning_end( sOwnerName )
	SetVisible("LD_mirror_C_cleaning",false)
	SetVisible("LD_mirror_C_fixing",true)
	DisplayQuestElementInTome( "Q_mirror_c_fixing", true )
	return true;
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 6 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_c_fixing_end( sOwnerName )
	SetVisible( "LD_mirror_C_fixing", false )
	if not IsQuestCompleted("Q_firefly_kingdom") then
		SetVisible( "LD_mirror_C_repaired", true )
	end
	return true
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 7 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_d_cleaning_end( sOwnerName )
	SetVisible("LD_mirror_D_cleaning",false)
	SetVisible("LD_mirror_D_fixing",true)
	DisplayQuestElementInTome( "Q_mirror_d_fixing", true )
	return true;
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 8 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_d_fixing_end( sOwnerName )
	SetVisible( "LD_mirror_D_fixing", false )
	if not IsQuestCompleted("Q_firefly_kingdom") then
		SetVisible( "LD_mirror_D_repaired", true )
	end
	return true
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 9 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_e_cleaning_end( sOwnerName )
	SetVisible("LD_mirror_E_cleaning",false)
	SetVisible("LD_mirror_E_fixing",true)
	DisplayQuestElementInTome( "Q_mirror_e_fixing", true )
	return true;
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 10 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_e_fixing_end( sOwnerName )
	SetVisible( "LD_mirror_E_fixing", false )
	if not IsQuestCompleted("Q_firefly_kingdom") then
		SetVisible( "LD_mirror_E_repaired", true )
	end
	return true
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 11 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_f_cleaning_end( sOwnerName )
	SetVisible("LD_mirror_F_cleaning",false)
	SetVisible("LD_mirror_F_fixing",true)
	DisplayQuestElementInTome( "Q_mirror_f_fixing", true )
	return true;
end
------------------------------------------------------------------------------------------------------
---------------------Functions Part 12 : Libérer la reine des abeilles --------------------------------
------------------------------------------------------------------------------------------------------
function F_mirror_f_fixing_end( sOwnerName )
	SetVisible( "LD_mirror_F_fixing", false )
	if not IsQuestCompleted("Q_firefly_kingdom") then
		SetVisible( "LD_mirror_F_repaired", true )
	end
	return true
end
--======================================================================================================
--=========================================Quest Description============================================
--======================================================================================================
Quest
{
	name = "Q_mirrors",
	description = "Q_mirrors_desc",
	
	callback_end = "F_mirrors_end",
---------------------Functions Part 1 : Nettoyer le mirroir du Cercle des Fées --------------------------------
	Quest_Element
	{
		Check
		{
			value_type = "exploration",
			level = 2 * G_check_factor,
		},
	
		Check
		{
			is_for_knowledge_tree = true,
			value_type = "exploration",
			level = 1 * G_check_factor,
		},
		
		gain_feerie = G_mirror_cleaning_faerie_gain,
	
		name = "Q_mirror_a_cleaning",
		interaction = "LD_mirror_A_cleaning",

		max_users = 2,
		loop = true,

		callback_end = "F_mirror_a_cleaning_end",

		Clean
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_A_cleaning",
			label = "exploring",
			XpImproved = Exploration,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 2 : Réparer le mirroir du Cercle des Fées --------------------------------
	Quest_Element
	{
		prerequisites  = {"Q_mirror_a_cleaning"},

		Check
		{
			value_type = "knowledge",
			level = 2 * G_check_factor,
		},
	
		Check
		{
			is_for_knowledge_tree = true,
			value_type = "knowledge",
			level = 1 * G_check_factor,
		},
		
		gain_feerie = G_mirror_fixing_faerie_gain,

		name = "Q_mirror_a_fixing",
		interaction = "LD_mirror_A_fixing",

		max_users = 2,
		loop = true,
	

	
		callback_end = "F_mirror_a_fixing_end",
	

		Fix
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_A_fixing",
			label = "fixing",
			XpImproved = Knowledge,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 3 : Nettoyer le mirroir du téléscope --------------------------------
	Quest_Element
	{  
		name = "Q_mirror_b_cleaning",
		
		Check
		{
			value_type = "exploration",
			level = 1 * G_check_factor,
		},

		gain_feerie = G_mirror_cleaning_faerie_gain,

		
		interaction = "LD_mirror_B_cleaning",

		max_users = 1,
		loop = true,

		callback_end = "F_mirror_b_cleaning_end",

		Clean
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_B_cleaning",
			label = "exploring",
			XpImproved = Exploration,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 4 : Réparer le mirroir du téléscope --------------------------------
	Quest_Element
	{
		name = "Q_mirror_b_fixing",
		
		prerequisites  = {"Q_mirror_b_cleaning"},

		Check
		{
			value_type = "knowledge",
			level = 1 * G_check_factor,
		},

		
		interaction = "LD_mirror_B_fixing",

		max_users = 1,
		loop = true,
		
		gain_feerie = G_mirror_fixing_faerie_gain,
		
		callback_end = "F_mirror_b_fixing_end",

		Fix
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_B_fixing",
			label = "fixing",
			XpImproved = Knowledge,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 5 : Nettoyer le mirroir de la plaine des fleurs --------------------------------
	Quest_Element
	{
		name = "Q_mirror_c_cleaning",
		
		Check
		{
			value_type = "exploration",
			level = 3 * G_check_factor,
		},


		gain_feerie = G_mirror_cleaning_faerie_gain,
		
		interaction = "LD_mirror_C_cleaning",
		  
		max_users = 1,
		loop = true,



		callback_end = "F_mirror_c_cleaning_end",

		Clean
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_C_cleaning",
			label = "exploring",
			XpImproved = Exploration,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 6 : Réparer le mirroir de la plaine des fleurs --------------------------------
	Quest_Element
	{
		prerequisites  = {"Q_mirror_c_cleaning"},

		Check
		{
			value_type = "knowledge",
			level = 3 * G_check_factor,
		},

		gain_feerie = G_mirror_fixing_faerie_gain,

		name = "Q_mirror_c_fixing",
		interaction = "LD_mirror_C_fixing",

		max_users = 1,
		loop = true,



		callback_end = "F_mirror_c_fixing_end",

		Fix
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_C_fixing",
			label = "fixing",
			XpImproved = Knowledge,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 7 : Nettoyer le mirroir des Lucioles --------------------------------
	Quest_Element
	{

		Check
		{
			value_type = "exploration",
			level = 2 * G_check_factor,
		},

		gain_feerie = G_mirror_cleaning_faerie_gain,

		name = "Q_mirror_d_cleaning",
		interaction = "LD_mirror_D_cleaning",
		  
		max_users = 1,
		loop = true,

		callback_end = "F_mirror_d_cleaning_end",

		Clean
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_D_cleaning",
			label = "exploring",
			XpImproved = Exploration,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 8 : Réparer le mirroir des Lucioles --------------------------------
	Quest_Element
	{
		prerequisites  = {"Q_mirror_d_cleaning"},

		Check
		{
			value_type = "knowledge",
			level = 2 * G_check_factor,
		},

		gain_feerie = G_mirror_fixing_faerie_gain,

		name = "Q_mirror_d_fixing",
		interaction = "LD_mirror_D_fixing",
		  
		max_users = 1,
		loop = true,

		callback_end = "F_mirror_d_fixing_end",

		Fix
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_D_fixing",
			label = "fixing",
			XpImproved = Knowledge,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 9 : Nettoyer le mirroir --------------------------------
	Quest_Element
	{

		Check
		{
			value_type = "exploration",
			level = 1 * G_check_factor,
		},

		gain_feerie = G_mirror_cleaning_faerie_gain,

		name = "Q_mirror_e_cleaning",
		interaction = "LD_mirror_E_cleaning",
		  
		max_users = 1,
		loop = true,

		callback_end = "F_mirror_e_cleaning_end",

		see_x = 1752,
		see_y = 932,

		Clean
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_E_cleaning",
			label = "exploring",
			XpImproved = Exploration,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 10 : Réparer le mirroir --------------------------------
	Quest_Element
	{
		prerequisites  = {"Q_mirror_e_cleaning"},

		Check
		{
			value_type = "knowledge",
			level = 1 * G_check_factor,
		},

		gain_feerie = G_mirror_fixing_faerie_gain,

		name = "Q_mirror_e_fixing",
		interaction = "LD_mirror_E_fixing",
		  
		max_users = 1,
		loop = true,



		callback_end = "F_mirror_e_fixing_end",

		see_x = 1752,
		see_y = 932,

		--callback_end = "F_mirror_a_cleaning_end",

		Fix
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_E_fixing",
			label = "fixing",
			XpImproved = Knowledge,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 11 : Nettoyer le mirroir --------------------------------
	Quest_Element
	{

		Check
		{
			value_type = "exploration",
			level = 1 * G_check_factor,
		},

		gain_feerie = G_mirror_cleaning_faerie_gain,

		name = "Q_mirror_f_cleaning",
		interaction = "LD_mirror_F_cleaning",
		  
		max_users = 1,
		loop = true,

		callback_end = "F_mirror_f_cleaning_end";

		Clean
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_F_cleaning",
			label = "exploring",
			XpImproved = Exploration,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
---------------------Functions Part 12 : Réparer le mirroir --------------------------------
	Quest_Element
	{
		prerequisites  = {"Q_mirror_f_cleaning"},

		Check
		{
			value_type = "knowledge",
			level = 1 * G_check_factor,
		},

		gain_feerie = G_mirror_fixing_faerie_gain,

		name = "Q_mirror_f_fixing",
		interaction = "LD_mirror_F_fixing",
		  
		max_users = 1,
		loop = true,

		callback_end = "F_mirror_f_fixing_end",

		Fix
		{
			stay_where_dropped = false,
			interaction = "LD_mirror_F_fixing",
			label = "fixing",
			XpImproved = Knowledge,
			XpValue = G_xp_standard_gain_per_action,
			fixTime = 5,
			fix_factor = 10,
			ratio_bonus_feerie = G_faerie_standard_gain_per_action,
		},
	},
}
