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

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

------------------------------------------------Hermit Fairie------------------------------------------------

function F_hermit_fairie_dropping_end()
	SetVisible( "LD_hermit_fairie", false );
	SetVisible( "LD_hermit_seed_dropped", true );
	SetVisible( "LD_nature_training", true );
	SetVisible( "HermitFaery", true);
	
	PlayFX(Air, "fx/fx_boutique_4.lua", "HermitFaery", 0, 0);
	
	CreateTimer( "T_fx_hermit_end", 20, "F_hermit_fairie_fx_end" );
	
	StartTalking( "HermitFaery", 10 );
	
	DisplayInformation( "hermit_fairie_end_text", "backgrounds/dialog/vignette_fee_ermite", "", 0, "F_hermit_fairie_continue_tutorial", true )
	
	SetRecoltingQuestElementName( G_nature_training );
	DisplayQuestElementInTome( "Q_hermit_seed_dropped_going", true )
	return true
end

function F_hermit_fairie_fx_end()
	if IsFXPlaying(Air, "fx/fx_boutique_4.lua", "HermitFaery") then
		KillFX(Air, "fx/fx_boutique_4.lua", "HermitFaery");
		DeferDelete("T_fx_hermit_end");
	end
	return true
end

function F_hermit_fairie_continue_tutorial()
	DisplayTutorialCallback("TUTO_fruits_basket_end");
end

function F_hermit_fairie_collecting_begin( sOwnerName )
	PlayGatherSound( sOwnerName )
	return true
end

function F_hermit_fairie_collecting_retrieve( sOwnerName )
	PlayGatherFX( sOwnerName );
	return true
end

function F_hermit_fairie_collecting_stop( sOwnerName)
	KillGatherSound( sOwnerName );
	KillGatherFX( sOwnerName );
	return true
end


function F_hermit_fairie_dropping_begin( sOwnerName )
	PlayDropAppleSound( sOwnerName )
	return true
end

function F_hermit_fairie_dropping_stop( sOwnerName )
	KillDropAppleSound( sOwnerName )
	return true
end

function F_hermit_fairie_condition_begin()
	return not IsQuestElementCompleted( G_hermit_faery );
end

Quest
{
  name = "Q_hermit_fairie",   -- en interne pour débugger mais aussi comme lien de pré-requis
  description = "Q_hermit_fairie_desc",
  
  callback_end = "F_hermit_fairie_dropping_end",
  callback_bestiary = {"bestiary_page3", "bestiary_page2"},
	
  -- gain_feerie = G_faerie_standard_gain_per_quest,
  
  Quest_Element
  {
  
    Check
    {
      value_type = "nature",
      level = 0 * G_check_factor,
    },
	
	gain_feerie = G_free_hermit_faerie_gain,
	
    name = G_hermit_faery,	-- en interne pour débugger seulement. Pas de pré-requis si ce n'est les autres éléments situés avant lui.
    interaction = "LD_hermit_fairie",     -- name of the source or character that launches this quest
    stock = "LD_reservoir",
	zone = "Z_fruit_basket",
	
	max_users = 4,
    loop = true,      -- continuer la liste des actions à faire jusqu'à la condition de fin. Si false, dès qu'il n'y a plus de choses à faire, on valide la quête.
    
	condition_begin = "F_hermit_fairie_condition_begin",
	
    Gather
    {
      label = "collecting",
      collectTime = 5,
      gather_factor = 10,
      source = "LD_hermit_fairie",
      XpImproved = Nature,
      XpValue = 3 * G_xp_standard_gain_per_action,
      -- ratio_bonus_feerie = 3 * G_faerie_standard_gain_per_action,
      ratio_bonus_feerie = 0 * G_faerie_standard_gain_per_action,
	  callback_inprogress = "F_hermit_fairie_collecting_begin",
	  callback_done = "F_hermit_fairie_collecting_stop",
	  callback_cancel = "F_hermit_fairie_collecting_stop",
	  callback_retrieve_inprogress = "F_hermit_fairie_collecting_retrieve",
    },
    
    Deposite
    {
      label = "dropping",
      stock = "id_stock_nourriture_drop",
	  callback_inprogress = "F_hermit_fairie_dropping_begin",
	  callback_done = "F_hermit_fairie_dropping_stop",
	  callback_cancel = "F_hermit_fairie_dropping_stop",
    },
  },
}


