--                          ------------------------------------------------------------------------------------------------------
--                                  ******************************************************************
--                                  **                       functions For Dialogs                  **
--                                  **                               R.Z.T.                         **
--                                  ******************************************************************
--                          ------------------------------------------------------------------------------------------------------
--
--=============================================================== ESCAPE ================================================================
--Сидрыч:trader_story
function give_weapon_to_actor_1 (trader, actor)
    dialogs.relocate_item_section(trader, "energy_drink", "in")
end
----------------------------------------------------------------------------------------------------------------------------------------
--Волк:lager_volk_torg
function give_weapon_to_actor_2 (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_ak74u", "in")
end

function give_volk_bribe(actor, npc)
	dialogs.relocate_money(npc, 1000, "out")
end

function give_volk_bribe_2(actor, npc)
	dialogs.relocate_money(npc, 2000, "out")
end

--Проверка_1...1000
function has_volk_bribe(actor, npc)
	return actor:money() >= 1000
end

--Проверка_2...2000
function has_volk_bribe_1(actor, npc)
	return actor:money() >= 2000
end

----------------------------------------------------------------------------------------------------------------------------------------
--' neytral on bridge
--Проверка Водки,Консервы.
function have_vodka_conserva_test(first_speaker, second_speaker)
  	return first_speaker:object("vodka") ~= nil
end

function have_vodka_conserva_test1(first_speaker, second_speaker)
  	return first_speaker:object("conserva") ~= nil
end

--Даём Водку,Консерву
function give_stalker_vodka_conserva(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "vodka", "out")
	dialogs.relocate_item_section(second_speaker, "conserva", "out")
end

--Даём Батон,Колбасу.
function give_stalker_eats(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "bread", "out")
	dialogs.relocate_item_section(second_speaker, "kolbasa", "out")
end

--Проверка-Батон.
function have_bread_kolbasa_test_1(first_speaker, second_speaker)
  	return first_speaker:object("bread") ~= nil
end

--Проверяем Колбасу.
function have_bread_kolbasa_test_2(first_speaker, second_speaker)
  	return first_speaker:object("kolbasa") ~= nil
end

----------------------------------------------------------------------------------------------------------------------------------------

--Сидор:trader_story_obmen
function give_trader_vodka(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "vodka", "out")
end

function give_eat_to_actor (trader, actor)
    dialogs.relocate_item_section(trader, "kolbasa", "in")
end

function have_vodka_test(first_speaker, second_speaker)
  	return first_speaker:object("vodka") ~= nil
end
function dont_have_vodka_test(first_speaker, second_speaker)
  	return not have_vodka_test(first_speaker, second_speaker)
end

----------------------------------------------------------------------------------------------------------------------------------------

-- Волк - Спавн:Патроны на АК74у
function ak74u_create()
	local a = vector() -- db.actor:position()
	a.x = -217.99154663086
	a.y = -22.143560409546
	a.z = -158.23907470703
	alife():create("ammo_5.45x39_fmj",a,33447,47,65535)
	alife():create("ammo_5.45x39_fmj",a,33447,47,65535)
end

----------------------------------------------------------------------------------------------------------------------------------------
--
--Спавн Васяныча
--function vasyanych_stalker_spawn() 
--   local obj 
--    local a = vector() -- Задаем тип переменной 
--    local dir = db.actor:direction() 
--         a.x = -189.41870117188 -- координата X 
--        a.y = -16.795209884644 -- высота Y 
--         a.z = -134.22506713867 -- координата Z 
--         obj = alife():create("petrovich_trader_spawn",a,13193,8,65535) 
--             alife():create_ammo("ammo_9x18_fmj", 
--             obj.position, 
--             obj.m_level_vertex_id, 
--             obj.m_game_vertex_id, 
--             obj.id, 
--             20) -- число патронов, которые будут спавнится при убиистве Васяныча
--end
--
----------------------------------------------------------------------------------------------------------------------------------------
-- Волк-обмен...
-- Проверка денег,Аптечки,Консервы
function has_volk_money(actor, npc)
	return actor:money() >= 570
end

function have_medkit(first_speaker, second_speaker)
  	return first_speaker:object("medkit") ~= nil
end

function have_conserva(first_speaker, second_speaker)
  	return first_speaker:object("conserva") ~= nil
end

-- Даём аптечку,консерву
function give_volk_moneys(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "medkit", "out")
	dialogs.relocate_item_section(second_speaker, "conserva", "out")
end


function give_weapon_to_actor_3 (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_desert_eagle", "in")
	dialogs.relocate_item_section(trader, "ammo_11.43x23_fmj", "in")
end

--Даём деньги
function give_volk_bribe1(actor, npc)
	dialogs.relocate_money(npc, 570, "out")
end

------------------------------------------------------------------------------------------------------------------------------------------------

-- Нейтрал
-- Проверка Арта
function have_medusa(first_speaker, second_speaker)
  	return first_speaker:object("af_medusa") ~= nil
end

-- Проверка Антирада
function have_antirad(first_speaker, second_speaker)
  	return first_speaker:object("antirad") ~= nil
end

-- Даём Арт и Антирад
function give_ney_medusa(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_medusa", "out")
	dialogs.relocate_item_section(second_speaker, "antirad", "out")
end

-- Даём 100р
function give_ney_money(actor, npc)
	dialogs.relocate_money(npc, 100, "out")
end

function give_weapon_to_actor_4 (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_mp5", "in")
	dialogs.relocate_item_section(trader, "ammo_9x19_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_9x19_fmj", "in")
end

-------------------------------------------------------------------------------------------------------------------------------------------------
--ch
--Проверка 2 Аптечки,Батон
function have_medkit1(first_speaker, second_speaker)
  	return first_speaker:object("medkit") ~= nil
end

function have_bread1(first_speaker, second_speaker)
  	return first_speaker:object("bread") ~= nil
end

--Даём 2 Аптечки,Батон
function give_ney_ch(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "medkit", "out")
	dialogs.relocate_item_section(second_speaker, "bread", "out")
end

--Принемаем Патроны
function give_ptr_to_actor_7 (trader, actor)
	dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
end

--Проверка Консерва,Батон
function have_conserva1(first_speaker, second_speaker)
  	return first_speaker:object("conserva") ~= nil
end

function have_bread2(first_speaker, second_speaker)
  	return first_speaker:object("bread") ~= nil
end

function give_ney_ch1(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "bread", "out")
	dialogs.relocate_item_section(second_speaker, "conserva", "out")
end

--Принемаем Энерджи
function give_dr_to_actor (trader, actor)
    dialogs.relocate_item_section(trader, "energy_drink", "in")
	dialogs.relocate_item_section(trader, "energy_drink", "in")
	dialogs.relocate_item_section(trader, "energy_drink", "in")
end

--Проверка Колбаса,Водка
function have_kolbasa2(first_speaker, second_speaker)
  	return first_speaker:object("kolbasa") ~= nil
end

function have_vodka2(first_speaker, second_speaker)
  	return first_speaker:object("vodka") ~= nil
end

function give_ney_ch3(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "kolbasa", "out")
	dialogs.relocate_item_section(second_speaker, "vodka", "out")
end

function give_art_to_actor (trader, actor)
    dialogs.relocate_item_section(trader, "af_cristall_flower", "in")
end

----------------------------------------------------------------------------------------------------------------------------------------------
--Проверка Артов
function have_medusa1(first_speaker, second_speaker)
  	return first_speaker:object("af_medusa") ~= nil
end

function have_flower(first_speaker, second_speaker)
  	return first_speaker:object("af_cristall_flower") ~= nil
end

function have_meat(first_speaker, second_speaker)
  	return first_speaker:object("af_mincer_meat") ~= nil
end

--Даём Арты...
function give_ney1_medusa(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_medusa", "out")
end

function give_ney_flower(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_cristall_flower", "out")
end

function give_ney_meat(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_mincer_meat", "out")
end

--Принемаем
function give_to_actor (trader, actor)
    dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
end

function give_to_actor0 (trader, actor)
    dialogs.relocate_item_section(trader, "vodka", "in")
	dialogs.relocate_item_section(trader, "vodka", "in")
	dialogs.relocate_item_section(trader, "antirad", "in")
	dialogs.relocate_item_section(trader, "antirad", "in")
	dialogs.relocate_item_section(trader, "medkit", "in")
end

function give_to_actor1 (trader, actor)
    dialogs.relocate_item_section(trader, "ammo_9x19_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_9x19_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_9x19_fmj", "in")
end
--
--------------------------------------------------------------------------------------------------------------------------------------------
--Проверка
function have_pm(first_speaker, second_speaker)
  	return first_speaker:object("wpn_pm") ~= nil
end

--Даём
function give_ney_it(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "wpn_pm", "out")
	dialogs.relocate_item_section(second_speaker, "medkit", "out")
	dialogs.relocate_item_section(second_speaker, "vodka", "out")
end

function has_ney_money2(actor, npc)
	return actor:money() >= 200
end

function give_ney_money4(actor, npc)
	dialogs.relocate_money(npc, 200, "out")
end

function give_ney_money5(actor, npc)
	dialogs.relocate_item_section(second_speaker, "vodka", "out")
end

function give_to_actor9 (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_usp", "in")
	dialogs.relocate_item_section(trader, "ammo_11.43x23_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_11.43x23_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_11.43x23_fmj", "in")
end

function give1_to_actor1 (trader, actor)
    dialogs.relocate_item_section(trader, "af_mincer_meat", "in")
end

function give2_to_actor1 (trader, actor)
    dialogs.relocate_item_section(trader, "medkit_army", "in")
	dialogs.relocate_item_section(trader, "medkit_army", "in")
	dialogs.relocate_item_section(trader, "medkit_army", "in")
	dialogs.relocate_item_section(trader, "medkit_army", "in")
end

function has_neytr_money(actor, npc)
	return actor:money() >= 300
end

function give_neytr_money(actor, npc)
	dialogs.relocate_money(npc, 300, "out")
end

function give_to_actor10 (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_usp", "in")
end

function have_blood1(first_speaker, second_speaker)
  	return first_speaker:object("af_blood") ~= nil
end

function give_ney_blood12(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_blood", "out")
end

function has_neytr_money22(actor, npc)
	return actor:money() >= 500
end

function give_neytr_money31(actor, npc)
	dialogs.relocate_money(npc, 500, "out")
end

function give2_to_walther (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_walther", "in")
end
-------
function give_ney_v_a(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "vodka", "out")
	dialogs.relocate_item_section(second_speaker, "antirad", "out")
end

function give2_to_silencer (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_addon_silencer", "in")
end

function give_ney_am(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "medkit", "out")
	dialogs.relocate_item_section(second_speaker, "antirad", "out")
end

function give2_to_grenade (trader, actor)
    dialogs.relocate_item_section(trader, "grenade_f1", "in")
	dialogs.relocate_item_section(trader, "grenade_rgd5", "in")
end

function have_ammo(first_speaker, second_speaker)
  	return first_speaker:object("ammo_12x76_zhekan") ~= nil
end

function give_ney_zhekan(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "ammo_12x76_zhekan", "out")
	dialogs.relocate_item_section(second_speaker, "kolbasa", "out")
end
---------------------------------------------------------------------------------------------------------------------------------------------
--=======================================================================GARBAGE==============================================================
function have_mp5(first_speaker, second_speaker)
  	return first_speaker:object("af_ameba_slime") ~= nil
end

function give_bes_items(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_ameba_slime", "out")
end

function has_bes_money(actor, npc)
	return actor:money() >= 200
end

function has_bes_money1(actor, npc)
	return actor:money() >= 70
end

function give_bes_money(actor, npc)
	dialogs.relocate_money(npc, 200, "out")
end

function give_bes_money1(actor, npc)
	dialogs.relocate_money(npc, 70, "out")
end

function ak74_create()
	local a = vector() -- db.actor:position()
	a.x = -65.010116577148
	a.y = -1.0223264694214
	a.z = -218.47003173828
	alife():create("ammo_5.45x39_fmj",a,133486,268,65535)
	alife():create("ammo_5.45x39_fmj",a,133486,268,65535)
	alife():create("ammo_5.45x39_fmj",a,133486,268,65535)
end

function give_bes_to_actor (trader, actor)
    dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
end

function ak74_create1()
	local a = vector() -- db.actor:position()
	a.x = -89.438148498535
	a.y = 2.0365705490112
	a.z = -188.10800170898
	alife():create("wpn_ak74",a,118899,270,65535)
end
---------------------------------------------------------------------------------------------------------------------------------------------
function give_bes_start(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "bread", "out")
	dialogs.relocate_item_section(second_speaker, "medkit", "out")
end

function give_bes1_to_actor (trader, actor)
    dialogs.relocate_item_section(trader, "af_fireball", "in")
end

function have_mp51(first_speaker, second_speaker)
  	return first_speaker:object("wpn_mp5") ~= nil
end

function give_bes1_to_actor1 (trader, actor)
    dialogs.relocate_item_section(trader, "af_ameba_slime", "in")
end

function give_bes2_start(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "wpn_mp5", "out")
end
------------------------------------------------------------------------------------------------------------------------------------------------
function give_ney2_medusa(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_medusa", "out")
end

function give_ney2_to_actor1 (trader, actor)
    dialogs.relocate_item_section(trader, "af_blood", "in")
end

function have1_flower(first_speaker, second_speaker)
  	return first_speaker:object("af_cristall_flower") ~= nil
end

function give_ney23(trader, actor)
    dialogs.relocate_item_section(trader, "af_cristall_flower", "in")
end

function give_ney2_to_actor5 (trader, actor)
    dialogs.relocate_item_section(trader, "af_rusty_kristall", "in")
end
----------------------------------------------------------------------------------------------------------------------------------------------
function have_vyvert(first_speaker, second_speaker)
    return first_speaker:object("af_vyvert") ~= nil
end

function give_ney_vyvert(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_vyvert", "out")
	dialogs.relocate_item_section(second_speaker, "medkit", "out")
	dialogs.relocate_item_section(second_speaker, "kolbasa", "out")
end

function give_ney2_to_actor9 (trader, actor)
    dialogs.relocate_item_section(trader, "stalker_outfit", "in")
end
------------------------------------------------------------------------------------------------------------------------------------------------
function have_energy_drink(first_speaker, second_speaker)
    return first_speaker:object("energy_drink") ~= nil
end

function give_ney2_gar(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "energy_drink", "out")
end

function vyvert_create()
	local a = vector() -- db.actor:position()
	a.x = -83.475128173828
	a.y = -1.9768909215927
	a.z = -203.12335205078
	alife():create("af_vyvert",a,124046,268,65535)
end
--------------------------------------------------------------------------------------------------------------------------------------------------
function have_monolit_out(first_speaker, second_speaker)
    return first_speaker:object("monolit_outfit") ~= nil
end

function give_com_out(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "monolit_outfit", "out")
end

function monolit_create()
	local a = vector() -- db.actor:position()
	a.x = 43.183700561523
	a.y = 4.9455461502075
	a.z = 238.98518371582
	alife():create("monolit_outfit",a,216645,359,65535)
	alife():create("ammo_5.45x39_fmj",a,216645,359,65535)
	alife():create("ammo_5.45x39_fmj",a,216645,359,65535)
	alife():create("ammo_5.45x39_fmj",a,216645,359,65535)
end
---------------------------------------------------------------------------------------------------------------------------------------------------------
--==============================================================BAR================================================================================
function give_barman_to_actor1 (trader, actor)
    dialogs.relocate_item_section(trader, "dynamite", "in")
--	dialogs.relocate_item_section(trader, "guitar_a", "in")
end

function give_sid_din(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "dynamite", "out")
end

function give_barman_money(actor, npc)
	dialogs.relocate_money(npc, 500, "out")
end

function give_barman_to_actor (first_speaker, second_speaker)
	dialogs.relocate_money(first_speaker, 500, "in")
end
--------------------------------------------------------------------------------------------------------------------------------------------------------
function bar_barman(first_speaker, second_speaker)
    second_speaker:set_relation(game_object.friend, first_speaker)
end

function bar_osv(first_speaker, second_speaker)
    second_speaker:set_relation(game_object.friend, first_speaker)
end

function bar_nps_enemy(first_speaker, second_speaker)
    second_speaker:set_relation(game_object.enemy, first_speaker)
end
--------------------------------------------------------------------------------------------------------------------------------------------------------
-->>>bar_bar_osv_ob<<<
function give_bar_bribe(actor, npc)
	dialogs.relocate_money(npc, 7000, "out")
end

function has_bar_bribe(actor, npc)
	return actor:money() >= 7000
end

function have_fireball(first_speaker, second_speaker)
  	return first_speaker:object("af_fireball") ~= nil
end

function have_rusty_kristall(first_speaker, second_speaker)
  	return first_speaker:object("af_rusty_kristall") ~= nil
end

function have_night_star(first_speaker, second_speaker)
  	return first_speaker:object("af_night_star") ~= nil
end
-------
function give_osv_vyvert(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_vyvert", "out")
end

function give_osv_fireball(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_fireball", "out")
end

function give_osv_rusty_kristall(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_rusty_kristall", "out")
end

function give_osv_night_star(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_night_star", "out")
end
-------
function give_af_osv_to_actor (trader, actor)
    dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
	dialogs.relocate_item_section(trader, "ammo_5.45x39_fmj", "in")
end

function give_af_osv_to_actor1 (trader, actor)
    dialogs.relocate_item_section(trader, "ammo_5.45x39_ap", "in")
	dialogs.relocate_item_section(trader, "ammo_5.45x39_ap", "in")
	dialogs.relocate_item_section(trader, "ammo_5.45x39_ap", "in")
end

function give_af_osv_to_actor2 (trader, actor)
    dialogs.relocate_item_section(trader, "ammo_5.56x45_ss190", "in")
	dialogs.relocate_item_section(trader, "ammo_5.56x45_ss190", "in")
	dialogs.relocate_item_section(trader, "ammo_5.56x45_ss190", "in")
end

function give_af_osv_to_actor3 (trader, actor)
    dialogs.relocate_item_section(trader, "ammo_9x39_sp5", "in")
	dialogs.relocate_item_section(trader, "ammo_9x39_sp5", "in")
	dialogs.relocate_item_section(trader, "ammo_9x39_sp5", "in")
end
-------
function has_ney_money400(actor, npc)
	return actor:money() >= 400
end

function give_osv_money400(actor, npc)
	dialogs.relocate_money(npc, 400, "out")
end

function give_ney_antirad1(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "antirad", "out")
end

function give_addons_osv_to_actor (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_addon_scope", "in")
	dialogs.relocate_item_section(trader, "wpn_addon_silencer", "in")
end
-------
function have1_ak74(first_speaker, second_speaker)
  	return first_speaker:object("wpn_ak74") ~= nil
end

function give_osv_ak74(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "wpn_ak74", "out")
end

function il86_create()
	local a = vector() -- db.actor:position()
	a.x = 156.42692565918
	a.y = 0.17925795912743
	a.z = 71.667411804199
	alife():create("wpn_l85",a,41158,1180,65535)
	alife():create("ammo_5.56x45_ss190",a,41158,1180,65535)
	alife():create("ammo_5.56x45_ss190",a,41158,1180,65535)
	alife():create("ammo_5.56x45_ss190",a,41158,1180,65535)
	alife():create("ammo_5.56x45_ss190",a,41158,1180,65535)
end

function searh_il86_have(actor, npc)
if db.actor ~= nil then
return db.actor:object("wpn_l85")~=nil
end
return false
end

function give_weapon_to2_actor (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_abakan", "in")
end
--------------------
function vodka5_have()
return rtz.have_n_items("vodka",5)
end

function have_n_items(section,number)
local actor = db.actor
if actor then
local cnt = 0
actor:iterate_inventory( function (dummy, item)
if item:section() == section then cnt = cnt + 1 end
end, nil)
return cnt >= number
end
return false
end

function vodka_out (actor, npc)
    dialogs.relocate_item_section(npc, "vodka", "out")
    dialogs.relocate_item_section(npc, "vodka", "out")
    dialogs.relocate_item_section(npc, "vodka", "out")
	dialogs.relocate_item_section(npc, "vodka", "out")
	dialogs.relocate_item_section(npc, "vodka", "out")
end

function give_act_en (trader, actor)
    dialogs.relocate_item_section(trader, "energy_drink", "in")
	dialogs.relocate_item_section(trader, "energy_drink", "in")
	dialogs.relocate_item_section(trader, "energy_drink", "in")
	dialogs.relocate_item_section(trader, "energy_drink", "in")
	dialogs.relocate_item_section(trader, "energy_drink", "in")
end
-------------
function medkit3_have()
return rtz.have_n_medkit("medkit",3)
end

function have_n_medkit(section,number)
local actor = db.actor
if actor then
local cnt = 0
actor:iterate_inventory( function (dummy, item)
if item:section() == section then cnt = cnt + 1 end
end, nil)
return cnt >= number
end
return false
end
---
function antirad2_have()
return rtz.have_n_antirad("antirad",2)
end

function have_n_antirad(section,number)
local actor = db.actor
if actor then
local cnt = 0
actor:iterate_inventory( function (dummy, item)
if item:section() == section then cnt = cnt + 1 end
end, nil)
return cnt >= number
end
return false
end

function give_osv_items(first_speaker, second_speaker)
	dialogs.relocate_item_section(first_speaker, "medkit", "out")
	dialogs.relocate_item_section(first_speaker, "medkit", "out")
	dialogs.relocate_item_section(first_speaker, "medkit", "out")
	dialogs.relocate_item_section(first_speaker, "antirad", "out")
	dialogs.relocate_item_section(first_speaker, "antirad", "out")
end

function give_it_to2_actor3 (trader, actor)
    dialogs.relocate_item_section(trader, "conserva", "in")
	dialogs.relocate_item_section(trader, "conserva", "in")
	dialogs.relocate_item_section(trader, "kolbasa", "in")
	dialogs.relocate_item_section(trader, "kolbasa", "in")
	dialogs.relocate_item_section(trader, "bread", "in")
	dialogs.relocate_item_section(trader, "bread", "in")
end
--
--------------------------------------
function have_n_m1()
return rtz.have_n_m("bread",2,"kolbasa",2,"conserva")
end

function have_n_m(section,number)
local actor = db.actor
if actor then
local cnt = 0
actor:iterate_inventory( function (dummy, item)
if item:section() == section then cnt = cnt + 1 end
end, nil)
return cnt >= number
end
return false
end

function bread2_have()
return rtz.have_n_antirad("bread",2)
end

function kolbasa2_have()
return rtz.have_n_antirad("kolbasa",2)
end

function have_nabor()
return (bread2_have() and kolbasa2_have()) 
end
-----------------------------------
function give_it_to0_actor (first_speaker, second_speaker)
--	dialogs.relocate_item_section(second_speaker, "conserva", "out")
	dialogs.relocate_item_section(second_speaker, "kolbasa", "out")
--	dialogs.relocate_item_section(second_speaker, "kolbasa", "out")
--	dialogs.relocate_item_section(second_speaker, "bread", "out")
	dialogs.relocate_item_section(second_speaker, "bread", "out")
end

function give_it_to0_actor1 (trader, actor)
    dialogs.relocate_item_section(trader, "medkit", "in")
	dialogs.relocate_item_section(trader, "medkit", "in")
	dialogs.relocate_item_section(trader, "antirad", "in")
	dialogs.relocate_item_section(trader, "antirad", "in")
	dialogs.relocate_item_section(trader, "bandage", "in")
	dialogs.relocate_item_section(trader, "bandage", "in")
end
------------------------------
--
--
--
--
--
--
--
--
--
--
function give_afs_to_osv (first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "af_drops", "out")
	dialogs.relocate_item_section(second_speaker, "af_mincer_meat", "out")
	dialogs.relocate_item_section(second_speaker, "af_rusty_thorn", "out")
end

function give_af1_to_actor (trader, actor)
    dialogs.relocate_item_section(trader, "af_fuzz_kolobok", "in")
end

--function have_drops(first_speaker, second_speaker)
--  	return first_speaker:object("af_drops") ~= nil
--end

function drops_have()
return rtz.have_n_antirad("af_drops")
end

function thorn_have()
return rtz.have_n_antirad("af_rusty_thorn")
end

function have_nabor1()
return (drops_have() and thorn_have()) 
end
-----------------------------------------------------------------------------
function give_osv_bribe(actor, npc)
	dialogs.relocate_money(npc, 2500, "out")
end

function has_osv_bribe(actor, npc)
	return actor:money() >= 2500
end

function aba_create()
	local a = vector() -- db.actor:position()
	a.x = 153.88034057617
	a.y = 5.756293296814
	a.z = 70.762245178223
	alife():create("wpn_abakan",a,40669,1180,65535)
end

function soul_create()
	local a = vector() -- db.actor:position()
	a.x = 123.31442260742
	a.y = 2.4640736579895
	a.z = 45.46524810791
	alife():create("af_soul",a,35111,1233,65535)
end

function gr_create()
	local a = vector() -- db.actor:position()
	a.x = 123.31442260742
	a.y = 2.4640736579895
	a.z = 45.46524810791
	alife():create("grenade_f1",a,35111,1233,65535)
	alife():create("grenade_f1",a,35111,1233,65535)
	alife():create("grenade_f1",a,35111,1233,65535)
	alife():create("grenade_f1",a,35111,1233,65535)
	alife():create("grenade_f1",a,35111,1233,65535)
	alife():create("grenade_f1",a,35111,1233,65535)
	alife():create("grenade_f1",a,35111,1233,65535)
	alife():create("grenade_f1",a,35111,1233,65535)
	alife():create("grenade_f1",a,35111,1233,65535)
	alife():create("grenade_f1",a,35111,1233,65535)
end
-----------------------------------------------------------------------------
--=====================================================================MILITARY=====================================================================================
function give_it_to0_actor1_lukash (trader, actor)
    dialogs.relocate_item_section(trader, "medkit", "in")
	dialogs.relocate_item_section(trader, "medkit", "in")
	dialogs.relocate_item_section(trader, "antirad", "in")
	dialogs.relocate_item_section(trader, "antirad", "in")
	dialogs.relocate_item_section(trader, "ammo_5.56x45_ss190", "in")
	dialogs.relocate_item_section(trader, "ammo_5.56x45_ss190", "in")
end

function give_it_to0_actor1_pov (trader, actor)
    dialogs.relocate_item_section(trader, "conserva", "in")
	dialogs.relocate_item_section(trader, "kolbasa", "in")
	dialogs.relocate_item_section(trader, "bread", "in")
	dialogs.relocate_item_section(trader, "bread", "in")
	dialogs.relocate_item_section(trader, "vodka", "in")
	dialogs.relocate_item_section(trader, "vodka", "in")
end

function have_wpn_l85(first_speaker, second_speaker)
  	return first_speaker:object("wpn_l85") ~= nil
end

function give_wp_to_sk (first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "wpn_l85", "out")
end

function give_skr_to_actor_vintorez (trader, actor)
    dialogs.relocate_item_section(trader, "wpn_vintorez", "in")
end

--function have_n_its()
--return rtz.have_n_m2("medkit_army",2,"antirad",2,"conserva")
--end
--
--function have_n_m2(section,number)
--local actor = db.actor
--if actor then
--local cnt = 0
--actor:iterate_inventory( function (dummy, item)
--if item:section() == section then cnt = cnt + 1 end
--end, nil)
--return cnt >= number
--end
--return false
--end

function medkit_army22_have()
return rtz.have_n_antirad("medkit_army",2)
end

function have_nabor23()
return (medkit_army22_have()) 
end

function have_medkit_army(first_speaker, second_speaker)
  	return first_speaker:object("medkit_army") ~= nil
end

--function give_skr_items(first_speaker, second_speaker)
--	dialogs.relocate_item_section(second_speaker, "medkit_army", "out")
--	dialogs.relocate_item_section(second_speaker, "medkit_army", "out")
--	dialogs.relocate_item_section(second_speaker, "antirad", "out")
--end
 -- 
function give_skr_items (first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "medkit_army", "out")
end  
  
function give_skr_to_actor_am (trader, actor)
    dialogs.relocate_item_section(trader, "ammo_5.56x45_ss190", "in")
--	dialogs.relocate_item_section(trader, "ammo_5.56x45_ss190", "in")
--	dialogs.relocate_item_section(trader, "ammo_5.56x45_ss190", "in")
end

function give_skr_to_actor_am2 (trader, actor)
    dialogs.relocate_item_section(trader, "ammo_9x39_sp5", "in")
	dialogs.relocate_item_section(trader, "ammo_9x39_sp5", "in")
	dialogs.relocate_item_section(trader, "ammo_9x39_sp5", "in")
end

function give_skr_it7(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "wpn_pm", "out")
	dialogs.relocate_item_section(second_speaker, "antirad", "out")
end
---------------
function have_pm41(first_speaker, second_speaker)
  	return first_speaker:object("wpn_pm") ~= nil
end
---------------
function have_skr_bribe(actor, npc)
	return actor:money() >= 7000
end

function give_skr_bribe(actor, npc)
	dialogs.relocate_money(npc, 7000, "out")
end

function give_skr_it2pm(first_speaker, second_speaker)
	dialogs.relocate_item_section(second_speaker, "wpn_pm", "out")
--	dialogs.relocate_item_section(second_speaker, "wpn_pm", "out")
end

function rg7_create()
	local a = vector() -- db.actor:position()
	a.x = -15.225868225098
	a.y = -6.0034046173096
	a.z = 32.550754547119
	alife():create("wpn_rpg7",a,289629,1584,65535)
	alife():create("ammo_og-7b",a,289629,1584,65535)
	alife():create("ammo_og-7b",a,289629,1584,65535)
	alife():create("ammo_og-7b",a,289629,1584,65535)
	alife():create("ammo_og-7b",a,289629,1584,65535)
	alife():create("ammo_og-7b",a,289629,1584,65535)
end