function dialog_tremor_3()
	local htime = level.get_time_hours()
	if htime>=2 and htime<=3 then
		return true
	end
	return false
end

function glaz_drakona_quest_have()
	if db.actor:object("glaz_drakona") then
		return true
	end
	return false
end

function spawn_glaz_drakona()
	alife():create("glaz_drakona",vector():set(617.725,10.807,-277.182),1849374, 3699)
end

function start_timer_glaz_drakona()
    amk.g_start_timer("glaz_drakona",0,1,0)
end

----------------------------------------------------------
function remove_obj(name) 
local obj 
       for a=1,65535 do 
          obj = alife():object(a) 
            if obj and string.find(obj:name(),name) then 
               alife():release(obj, true) 
            end 
       end 
end
--------------------------------------------------------------


function noy_quest_have()
	if db.actor:object("wpn_twinbow") then
		return true
	end
	return false
end

function noy_quest_have_twinbow(gg, npc)
	if db.actor:object("wpn_twinbow") and has_alife_info("noy_quest_start") and not has_alife_info("noy_quest_end") then
		return true
	end
	return false
end

function noy_quest_reward(gg, npc)
	dialogs.relocate_item_section(npc,"wpn_twinbow","out")
	dialogs.relocate_item_section(npc,"af_12","in")
	db.actor:give_info_portion("info_af_12")
end

function arbalet_money_have()
	if db.actor:money() >= 150000 then
		return true
	end
	return false
end

function noy_arbalet_reward(gg, npc)
	dialogs.relocate_money(npc,150000,"out")
	dialogs.relocate_item_section(npc,"wpn_twinbow","in")
end

function kardan_gauss_have()
	if db.actor:object("wpn_gauss_prip") then
		return true
	end
	return false
end

function gauss_quest_reward(gg, npc)
	dialogs.relocate_item_section(npc,"wpn_gauss_prip","out")
end

function gauss_quest_reward_2(gg, npc)	
	dialogs.relocate_item_section(npc,"wpn_abakan_m1","in")
end

function tremor_quest_have_tail()
	local k = 0
	db.actor:iterate_inventory(function (dummy, item) 
		if item:section() == "mutant_psevdodog_tail" then 
			k = k + 1 
		end 
	end, nil)
	if k >= 5 then
		return true
	end
	return false
end	

function tremor_quest(gg,npc)
	items.relocate_n_items_section(npc, "mutant_psevdodog_tail", "out", 5)
end

function tremor_quest_reward(gg,npc)
	dialogs.relocate_item_section(gg,"wpn_pb","in")
end

function boroda_quest_have(gg, npc)
	if db.actor:object("zat_boroda_chemodan") and has_alife_info("problema_sultan_start") and not has_alife_info("dialog_sultan_2_end") then
		return true
	end
	return false
end

function sultan_chemodan_have()
	if db.actor:object("zat_boroda_chemodan") then
		return true
	end
	return false
end

function sultan_chemodan_have_2()
	if db.actor:object("zat_boroda_chemodan") then
		return false
	end
	return true
end

function spawn_chemodan_boroda()
	alife():create("zat_boroda_chemodan",vector():set(0.757,0.292,40.805),944005,3677)
end

function spawn_chemodan()
alife():create("zat_boroda_chemodan",vector():set(0.757,0.292,40.805),944005,3677)
end

function sultan_chemodan_transfer(gg,npc)
	dialogs.relocate_item_section(npc,"zat_boroda_chemodan","in")
end

-- Удаляем объект из игры
function remove_item(remove_item)
	if remove_item~=nil then
   alife():release(alife():object(remove_item:id()), true)
		return true
	end
	return false
end

function boroda_quest_reward(gg,npc)
	dialogs.relocate_item_section(npc,"zat_boroda_chemodan","out")
end

function boroda_quest_money(gg,npc)
	dialogs.relocate_money(npc,35000,"in")
end

function boroda_quest_money_2(gg,npc)
	dialogs.relocate_money(npc,25000,"in")
end

function boroda_quest_money_2_1(gg,npc)
	dialogs.relocate_money(npc,15000,"in")
end

function boroda_quest_money_3(gg,npc)
	dialogs.relocate_money(npc,20000,"in")
end

function boroda_quest_money_4(gg,npc)
	dialogs.relocate_money(npc,10000,"in")
end

function boroda_quest_money_5(gg,npc)
	dialogs.relocate_money(npc,40000,"in")
end

function relocate_money_to_actor(first_speaker, second_speaker)
    dialogs.relocate_money(second_speaker, 50000, "in")
end

function relocate_money_to_sultan(first_speaker, second_speaker)
    dialogs.relocate_money(second_speaker, 50000, "out")   
end

function start_timer_sultan()
    amk.g_start_timer("sultan",0,0,2)
end

function start_timer_boroda()
    amk.g_start_timer("boroda",0,3,0)
end

function zat_boroda_reid(npc, gg)
    	dialogs.relocate_item_section(npc, "ammo_5.45x39_ap", "in", 3)
    	dialogs.relocate_item_section(npc, "medkit_army", "in", 2)
    	dialogs.relocate_item_section(npc, "antirad", "in", 3)
end

function zat_quest_sych(gg, npc)
    	dialogs.relocate_item_section(npc, "grenade_f1", "in", 5)
    	dialogs.relocate_item_section(npc, "ammo_5.45x39_ap", "in", 3)
    	dialogs.relocate_item_section(npc, "ammo_12x70_buck", "in", 3)
end

function door_code_quest_complete()
	if db.actor:object("doc_code_door") then
	db.actor:give_info_portion("quest_weapons")
		return true
	end
	return false
end

function quest_weapons_have()
	if db.actor:object("wpn_ppsh") and
		db.actor:object("wpn_mosin") and
		db.actor:object("wpn_pb") and
		db.actor:object("ammo_7.62x54_7h1") and
		db.actor:object("ammo_7.62x25") and
		db.actor:object("grenade_f1") then
		return true
	end
	return false
end

function quest_weapons_have2()
	if db.actor:object("wpn_ppsh") and
		db.actor:object("wpn_mosin") and
		db.actor:object("wpn_pb") then
		return true
	end
	return false
end	

function relocate_weapons_sych(npc,gg)
	dialogs.relocate_item_section(gg,"wpn_ppsh","out")
	dialogs.relocate_item_section(gg,"wpn_mosin","out")
	dialogs.relocate_item_section(gg,"wpn_pb","out")
end	
	
function relocate_weapons_sych2(npc,gg)
	dialogs.relocate_item_section(gg,"wpn_ppsh","out")
	dialogs.relocate_item_section(gg,"wpn_mosin","out")
	dialogs.relocate_item_section(gg,"doc_code_door","out")	
end

function relocate_quest_killer_controller(gg,npc)
	dialogs.relocate_money(npc,10000,"in")
end

function relocate_quest_killer_vertushka(gg,npc)
	dialogs.relocate_money(npc,30000,"in")
end

function quest_vertushka_pribor_have()
	if db.actor:object("zat_vertushka_pribor") then
		return true
	end
	return false
end

function relocate_vertushka_pribor(npc,gg)
	dialogs.relocate_item_section(gg,"zat_vertushka_pribor","out")	
end

function relocate_arhiv(npc,gg)
	dialogs.relocate_item_section(gg,"doc_koltsov","out")	
end
