
local txt = volazar_tbl_text["text"]() -- массив со всеми юзаемыми текстами
local vt = volazar_tbl_text.tips

-- Спавним НПС
function spawn_volazar()        
local obj = volazar_spawn_other.spawn_other(20)
	ai:assign_story_id(obj.id,19934)
    if obj then
      vt(txt.c.vol_1, "unknown", 30000, "vol_1")
	end
end

-- Удаляем и спавним нового
function spawn_volazar_new()
	local obj = snp.object_by_section_offline("volazar")
    if obj then
	  release(obj, true)
	end
	
	obj = volazar_spawn_other.spawn_other(21)
	ai:assign_story_id(obj.id,19935)
end

-- Подсказки

-- Военная Лаборатория
function pod_war_1()
    vt(txt.b.war_1, "vol", 30000, "war_1")
end

function pod_war_2()
    vt(txt.b.war_2, "vol", 30000, "war_2")
end

function pod_war_3()
    vt(txt.b.war_3, "vol", 30000, "war_3")
end

function pod_war_4()
    vt(txt.b.war_4, "vol", 30000, "war_4")
end

function pod_war_5()
    vt(txt.b.war_5, "vol", 30000, "war_5")
end

function pod_war_6()
    vt(txt.b.war_6, "vol", 30000, "war_6")
end

function pod_war_7()
    vt(txt.b.war_7, "vol", 30000, "war_7")
end

function pod_war_8()
    vt(txt.b.war_8, "vol", 30000, "war_8")
end

function pod_war_9()
    vt(txt.b.war_9, "vol", 30000, "war_9")
end

function pod_war_10()
    vt(txt.b.war_10, "vol", 30000, "war_10")
end

function pod_war_11()
    vt(txt.b.war_11, "vol", 30000, "war_11")
end

function pod_war_12()
    vt(txt.b.war_12, "vol", 30000, "war_12")
end

function pod_war_13()
    vt(txt.b.war_13, "vol", 30000, "war_13")
end

function pod_war_14()
    vt(txt.b.war_14, "vol", 30000, "war_14")
end

function pod_war_15()
    vt(txt.b.war_15, "vol", 30000, "war_15")
end

-- Х-16
function pod_x16_1()
    vt(txt.e.x16_1, "vol", 30000, "x16_1")
end

function pod_x16_2()
    vt(txt.e.x16_2, "vol", 30000, "x16_2")
end

function pod_x16_3()
    vt(txt.e.x16_3, "vol", 30000, "x16_3")
end

function pod_x16_4()
    vt(txt.e.x16_4, "vol", 30000, "x16_4")
end

function pod_x16_5()
    vt(txt.e.x16_5, "vol", 30000, "x16_5")
end

function pod_x16_6()
    vt(txt.e.x16_6, "vol", 30000, "x16_6")
end

function pod_x16_7()
    vt(txt.e.x16_7, "vol", 30000, "x16_7")
end

-- ЧАЭС 2
function pod_chs_1()
    vt(txt.f.chs_1, nil, 30000, "chs_1")
end

function pod_chs_2()
    vt(txt.f.chs_2, nil, 30000, "chs_2")
end

function pod_chs_3()
    vt(txt.f.chs_3, nil, 30000, "chs_3")
end

function pod_chs_4()
    vt(txt.f.chs_4, nil, 30000, "chs_4")
end

function pod_chs_5()
    vt(txt.f.chs_5, nil, 30000, "chs_5")
end

function pod_chs_6()
    vt(txt.f.chs_6, nil, 30000, "chs_6")
end

function pod_chs_7()
    vt(txt.f.chs_7, nil, 30000, "chs_7")
end

function pod_chs_8()
    vt(txt.f.chs_8, nil, 30000, "chs_8")
end

function pod_chs_9()
    vt(txt.f.chs_9, nil, 30000, "chs_9")
end

function pod_chs_10()
    vt(txt.f.chs_10, nil, 30000, "chs_10")
end

function pod_chs_11()
    vt(txt.f.chs_11, nil, 30000, "chs_11")
end

function pod_chs_12()
    vt(txt.f.chs_12, nil, 30000, "chs_12")
end

function pod_chs_13()
    vt(txt.f.chs_13, nil, 30000, "chs_13")
end

function pod_chs_14()
    vt(txt.f.chs_14, nil, 30000, "chs_14")
end

function pod_chs_15()
    vt(txt.f.chs_15, nil, 30000, "chs_15")
end

function pod_chs_16()
    vt(txt.f.chs_16, nil, 30000, "chs_16")
end

function pod_chs_17()
    vt(txt.f.chs_17, nil, 30000, "chs_17")
end

function pod_chs_18()
    vt(txt.f.chs_18, nil, 30000, "chs_18")
end

function pod_chs_19()
    vt(txt.f.chs_19, nil, 30000, "chs_19")
end

function pod_chs_20()
    vt(txt.f.chs_20, nil, 30000, "chs_20")
end

function pod_chs_21()
    vt(txt.f.chs_21, nil, 30000, "chs_21")
end

function pod_chs_22()
    vt(txt.f.chs_22, nil, 30000, "chs_22")
end

function pod_chs_23()
    vt(txt.f.chs_23, nil, 30000, "chs_23")
end

function pod_chs_24()
    vt(txt.f.chs_24, nil, 30000, "chs_24")
end

function pod_chs_25()
    vt(txt.f.chs_25, nil, 30000, "chs_25")
end

function pod_chs_26()
    vt(txt.f.chs_26, nil, 30000, "chs_26")
end

-- ЧАЭС
function pod_chs1_1()
    vt(txt.g.chs1_1, nil, 30000, "chs1_1")
end

function pod_chs1_2()
    vt(txt.g.chs1_2, nil, 30000, "chs1_2")
end

function pod_chs1_3()
    vt(txt.g.chs1_3, nil, 30000, "chs1_3")
end

function pod_chs1_4()
    vt(txt.g.chs1_4, nil, 30000, "chs1_4")
end

function pod_chs1_5()
    vt(txt.g.chs1_5, nil, 30000, "chs1_5")
end

function pod_chs1_6()
    vt(txt.g.chs1_6, nil, 30000, "chs1_6")
end

function pod_chs1_7()
    vt(txt.g.chs1_7, nil, 30000, "chs1_7")
end

function pod_chs1_8()
    vt(txt.g.chs1_8, nil, 30000, "chs1_8")
end

function pod_chs1_9()
    vt(txt.g.chs1_9, nil, 30000, "chs1_9")
end

function pod_chs1_10()
    vt(txt.g.chs1_10, nil, 30000, "chs1_10")
end

function pod_chs1_11()
    vt(txt.g.chs1_11, nil, 30000, "chs1_11")
end

function pod_chs1_12()
    vt(txt.g.chs1_12, nil, 30000, "chs1_12")
end

-- Лиманск
function pod_lim_1()
    vt(txt.h.lim_1, nil, 30000, "lim_1")
end

function pod_lim_2()
    vt(txt.h.lim_2, nil, 30000, "lim_2")
end

function pod_lim_3()
    vt(txt.h.lim_3, nil, 30000, "lim_3")
end

function pod_lim_4()
    vt(txt.h.lim_4, nil, 30000, "lim_4")
end

function pod_lim_5()
    vt(txt.h.lim_5, nil, 30000, "lim_5")
end

function pod_lim_6()
    vt(txt.h.lim_6, nil, 30000, "lim_6")
end

function pod_lim_7()
    vt(txt.h.lim_7, nil, 30000, "lim_7")
end

function pod_lim_8()
    vt(txt.h.lim_8, nil, 30000, "lim_8")
end

function pod_lim_9()
    vt(txt.h.lim_9, nil, 30000, "lim_9")
end

function pod_lim_10()
    vt(txt.h.lim_10, nil, 30000, "lim_10")
end

function pod_lim_11()
    vt(txt.h.lim_11, nil, 30000, "lim_11")
end

function pod_lim_12()
    vt(txt.h.lim_12, nil, 30000, "lim_12")
end

function pod_lim_13()
    vt(txt.h.lim_13, nil, 30000, "lim_13")
end

function pod_lim_14()
    vt(txt.h.lim_14, nil, 30000, "lim_14")
end

function pod_lim_15()
    vt(txt.h.lim_15, nil, 30000, "lim_15")
end

function pod_lim_16()
    vt(txt.h.lim_16, nil, 30000, "lim_16")
end

function pod_lim_17()
    vt(txt.h.lim_17, nil, 30000, "lim_17")
end

function pod_lim_18()
    vt(txt.h.lim_18, nil, 30000, "lim_18")
end

function pod_lim_19()
    vt(txt.h.lim_19, nil, 30000, "lim_19")
end

function pod_lim_20()
    vt(txt.h.lim_20, nil, 30000, "lim_20")
end

function pod_lim_21()
    vt(txt.h.lim_21, nil, 30000, "lim_21")
end

function pod_lim_22()
    vt(txt.h.lim_22, nil, 30000, "lim_22")
end

function pod_lim_23()
    vt(txt.h.lim_23, nil, 30000, "lim_23")
end

function pod_lim_24()
    vt(txt.h.lim_24, nil, 30000, "lim_24")
end

function pod_lim_25()
    vt(txt.h.lim_25, nil, 30000, "lim_25")
end

function pod_lim_26()
    vt(txt.h.lim_26, nil, 30000, "lim_26")
end

function pod_lim_27()
    vt(txt.h.lim_27, nil, 30000, "lim_27")
end

-- Путепровод
function pod_put_1()
    vt(txt.i.put_1, nil, 30000, "put_1")
end

function pod_put_2()
    vt(txt.i.put_2, nil, 30000, "put_2")
end

function pod_put_3()
    vt(txt.i.put_3, nil, 30000, "put_3")
end

function pod_put_4()
    vt(txt.i.put_4, nil, 30000, "put_4")
end

function pod_put_5()
    vt(txt.i.put_5, nil, 30000, "put_5")
end

function pod_put_6()
    vt(txt.i.put_6, nil, 30000, "put_6")
end

function pod_put_7()
    vt(txt.i.put_7, nil, 30000, "put_7")
end

function pod_put_8()
    vt(txt.i.put_8, nil, 30000, "put_8")
end

function pod_put_9()
    vt(txt.i.put_9, nil, 30000, "put_9")
end

function pod_put_10()
    vt(txt.i.put_10, nil, 30000, "put_10")
end

function pod_put_11()
    vt(txt.i.put_11, nil, 30000, "put_11")
end

function pod_put_12()
    vt(txt.i.put_12, nil, 30000, "put_12")
end

function pod_put_13()
    vt(txt.i.put_13, nil, 30000, "put_13")
end

function pod_put_14()
    vt(txt.i.put_14, nil, 30000, "put_14")
end

function pod_put_15()
    vt(txt.i.put_15, nil, 30000, "put_15")
end

function pod_put_16()
    vt(txt.i.put_16, nil, 30000, "put_16")
end

function pod_put_17()
    vt(txt.i.put_17, nil, 30000, "put_17")
end

function pod_put_18()
    vt(txt.i.put_18, nil, 30000, "put_18")
end

-- Вост. Припять
function pod_pri_1()
    vt(txt.j.pri_1, nil, 30000, "pri_1")
end

function pod_pri_2()
    vt(txt.j.pri_2, nil, 30000, "pri_2")
end

function pod_pri_3()
    vt(txt.j.pri_3, nil, 30000, "pri_3")
end

function pod_pri_4()
    vt(txt.j.pri_4, nil, 30000, "pri_4")
end

function pod_pri_5()
    vt(txt.j.pri_5, nil, 30000, "pri_5")
end

function pod_pri_6()
    vt(txt.j.pri_6, nil, 30000, "pri_6")
end

function pod_pri_7()
    vt(txt.j.pri_7, nil, 30000, "pri_7")
end

function pod_pri_8()
    vt(txt.j.pri_8, nil, 30000, "pri_8")
end

function pod_pri_9()
    vt(txt.j.pri_9, nil, 30000, "pri_9")
end

function pod_pri_10()
    vt(txt.j.pri_10, nil, 30000, "pri_10")
end

function pod_pri_11()
    vt(txt.j.pri_11, nil, 30000, "pri_11")
end

function pod_pri_12()
    vt(txt.j.pri_12, nil, 30000, "pri_12")
end

function pod_pri_13()
    vt(txt.j.pri_13, nil, 30000, "pri_13")
end

-- Х-8
function pod_x8_1()
    vt(txt.k.x8_1, nil, 30000, "x8_1")
end

function pod_x8_2()
    vt(txt.k.x8_2, nil, 30000, "x8_2")
end

function pod_x8_3()
    vt(txt.k.x8_3, nil, 30000, "x8_3")
end

function pod_x8_4()
    vt(txt.k.x8_4, nil, 30000, "x8_4")
end

function pod_x8_5()
    vt(txt.k.x8_5, nil, 30000, "x8_5")
end

-- МГ
function pod_mg_1()
    vt(txt.l.mg_1, nil, 30000, "mg_1")
end

function pod_mg_2()
    vt(txt.l.mg_2, nil, 30000, "mg_2")
end

function pod_mg_3()
    vt(txt.l.mg_3, nil, 30000, "mg_3")
end

function pod_mg_4()
    vt(txt.l.mg_4, nil, 30000, "mg_4")
end

function pod_mg_5()
    vt(txt.l.mg_5, nil, 30000, "mg_5")
end

-- Затон
function pod_zat_1()
    vt(txt.m.zat_1, nil, 30000, "zat_1")
end

function pod_zat_2()
    vt(txt.m.zat_2, nil, 30000, "zat_2")
end

function pod_zat_3()
    vt(txt.m.zat_3, nil, 30000, "zat_3")
end

function pod_zat_4()
    vt(txt.m.zat_4, nil, 30000, "zat_4")
end

function pod_zat_5()
    vt(txt.m.zat_5, nil, 30000, "zat_5")
end

function pod_zat_6()
    vt(txt.m.zat_6, nil, 30000, "zat_6")
end

function pod_zat_7()
    vt(txt.m.zat_7, nil, 30000, "zat_7")
end

function pod_zat_8()
    vt(txt.m.zat_8, nil, 30000, "zat_8")
end

function pod_zat_9()
    vt(txt.m.zat_9, nil, 30000, "zat_9")
end

-- Юпитер
function pod_jup_1()
    vt(txt.o.jup_1, nil, 30000, "jup_1")
end

function pod_jup_2()
    vt(txt.o.jup_2, nil, 30000, "jup_2")
end

function pod_jup_3()
    vt(txt.o.jup_3, nil, 30000, "jup_3")
end

function pod_jup_4()
    vt(txt.o.jup_4, nil, 30000, "jup_4")
end

function pod_jup_5()
    vt(txt.o.jup_5, nil, 30000, "jup_5")
end

function pod_jup_6()
    vt(txt.o.jup_6, nil, 30000, "jup_6")
end

function pod_jup_7()
    vt(txt.o.jup_7, nil, 30000, "jup_7")
end

function pod_jup_8()
    vt(txt.o.jup_8, nil, 30000, "jup_8")
end

function pod_jup_9()
    vt(txt.o.jup_9, nil, 30000, "jup_9")
end

function pod_jup_10()
    vt(txt.o.jup_10, nil, 30000, "jup_10")
end

function pod_jup_11()
    vt(txt.o.jup_11, nil, 30000, "jup_11")
end

function pod_jup_12()
    vt(txt.o.jup_12, nil, 30000, "jup_12")
end

function pod_jup_13()
    vt(txt.o.jup_13, nil, 30000, "jup_13")
end

function pod_jup_14()
    vt(txt.o.jup_14, nil, 30000, "jup_14")
end

function pod_jup_15()
    vt(txt.o.jup_15, nil, 30000, "jup_15")
end

function pod_jup_16()
    vt(txt.o.jup_16, nil, 30000, "jup_16")
end

function pod_jup_17()
    vt(txt.o.jup_17, nil, 30000, "jup_17")
end

function pod_jup_18()
    vt(txt.o.jup_18, nil, 30000, "jup_18")
end

--[[ Квест с Сидором ]]
local txt_str = { txt.n.esc_3, txt.n.esc_24, txt.n.esc_25, txt.n.esc_26 }
local txt_str_snd = { "esc_3", "esc_24", "esc_25", "esc_26" }
local txt_sid = { txt.n.esc_2, txt.n.esc_22, txt.n.esc_23, txt.n.esc_27 }
local txt_sid_snd = { "esc_2", "esc_22", "esc_23", "esc_27" }

function sidor_ammo()
    if has_info("actor_fly") 
		and has_info("sidor_delo_start") 
		and not has_info("sidor_delo_have") 
		and not has_info("sidor_delo_fail")
	then
		if not db.actor:object("ammo_vog-25_fly") then
			local istr = math.random(#txt_str)
			local isid = math.random(#txt_sid)
			local timeout = 0
			sms(txt_str[istr], timeout, "strelok", 15000, nil, [[sms\strelok\]]..txt_str_snd[istr])
			timeout = timeout+math.random(6,8)
			sms(txt_sid[isid], timeout, "sidor", 15000, nil, [[sms\sidor\]]..txt_sid_snd[isid])
		
			local gg = db.actor
			for i=1, 18 do
			  create("ammo_vog-25_fly", gg:position(), gg:level_vertex_id (),gg:game_vertex_id (), gg:id())
			end
		end
	end
end

function sidor_sms()
    vt(txt.n.esc_1, "sidor", 20000, "esc_1")
end

function sidor_start()
	voice([[characters_voice\volazar\vse_vyshe_vyshe]]):play(db.actor, 15, sound_object.s2d)
	sms("%c[sender]"..translate("name_sidorovich")..":\\n%c[sms_red]"..translate("sidor_start_0_0"), 5, nil, 20000)
	snp.invul_on()
	give_info("no_landing")
	give_info("vol_info_temp")
end

function sidor_stop()
	voice([[characters_voice\volazar\vse_vyshe_vyshe]]):stop()
	snp.invul_off()
	invul_4_seconds()
	disable_info("save_prohibited")
	disable_info("no_landing")
	disable_info("vol_info_temp")
end

function item_from_sidor() 
	got("anom_egg",1)
	got("wpn_rg-6",1)
	got("ammo_vog-25_fly",12)
	give_info("save_prohibited")
end

function sidor_reward() 
	lost("wpn_rg-6",1)
	lost_all("ammo_vog-25_fly")
	got_money(300000)	
end

--[[ Other ]]

function disable_tel()
    disable_info("vol_info")
end

function vol_pridurok()
    vt(txt.c.vol_2, "vol", 30000, "vol_2")
end

function vol_eeeehhaa()
    vt(txt.c.vol_3, "vol", 15000, "vol_3")
end

function vol_sms()
    vt(txt.c.vol_4, "unknown", 30000, "vol_4")
end

function vol_sms_2()
	for id,obj in pairs(db.creatures) do
		if  iAmStalker[obj:clsid()] and obj:alive() and distance_between(obj,db.actor)<30 and obj:character_community()=="zombied" then
			release(obj)
		end
	end
    vt(txt.c.vol_5, nil, 10000, "vol_5")
end

function vol_sms_3()
    vt(txt.c.vol_6, "strelok", 10000, "vol_6")
end

function vol_sms_4()
    vt(txt.c.vol_7, "strelok", 10000, "vol_7")
end

function vol_sms_5()
    vt(txt.c.vol_8, nil, 15000, "vol_8")
end

function vol_sms_6()
    vt(txt.c.vol_9, "strelok", 15000, "vol_9")
end

function vol_sms_7()
    vt(txt.c.vol_10, nil, 20000, "vol_10")
end

function vol_sms_8()
    vt(txt.c.vol_11, "strelok", 15000, "vol_11")
end

function vol_sms_9()
    vt(txt.c.vol_12, nil, 20000, "vol_12")
end

function vol_sms_10()
    vt(txt.c.vol_13, "strelok", 15000, "vol_13")
end

function vol_sms_11()
    vt(txt.c.vol_14, "ozersky", 20000, "vol_14")
end

function vol_sms_12()
    vt(txt.c.vol_15, "ozersky", 20000, "vol_15")
end

function vol_sms_13()
    vt(txt.c.vol_16, "ozersky", 20000, "vol_16")
end

function vol_sms_14()
    vt(txt.c.vol_17, "ozersky", 20000, "vol_17")
end

function vol_sms_15()
    vt(txt.c.vol_18, "strelok", 20000, "vol_18")
end

function vol_sms_16()
    vt(txt.c.vol_19, "ozersky", 30000, "vol_19")
end

function vol_sms_17()
    vt(txt.c.vol_20, "strelok", 20000, "vol_20")
end

function vol_sms_18()
    vt(txt.c.vol_21, "ozersky", 20000, "vol_21")
end

function vol_sms_19()
    vt(txt.c.vol_22, "ozersky", 30000, "vol_22")
end

function vol_sms_20()
    vt(txt.c.vol_23, "strelok", 30000, "vol_23")
end

function vol_sms_21()
    vt(txt.c.vol_24, "ozersky", 30000, "vol_24")
end

-- Спавним уродцев
function spawn_bloodsucker()
	create("vol_bloodsucker_1",xyz(-91.472,-0.390,-154.582),567519,3722)
	create("vol_bloodsucker_2",xyz(-95.983,-0.389,-152.531),560799,3715)
	create("vol_bloodsucker_3",xyz(-97.633,-0.389,-147.813),558483,3722)
	create("vol_bloodsucker_4",xyz(-96.003,-0.389,-143.610),560812,3722)
	create("vol_bloodsucker_5",xyz(-91.893,-0.389,-141.447),567538,3722)
	create("vol_bloodsucker_6",xyz(-86.648,-0.390,-143.053),575907,3722)
	create("vol_bloodsucker_7",xyz(-84.511,-0.390,-148.139),579365,3722)
	create("vol_bloodsucker_8",xyz(-86.612,-0.390,-152.751),575893,3722)
end

function spawn_snork()
	local se_obj = create("vol_snork_1",xyz(-173.388,0.251,-148.941),422788,3715)
	netpacket:modify(se_obj, "object_flags", -5)	-- 0xfffffffb
end

function oz_music_good()
	say([[characters_voice\volazar\ostanovite_ego]])
end

function oz_music_bad()
	say([[characters_voice\volazar\unichtozhte_ego]])
end

function invul_4_seconds()
	snp.invul_on()
	timer("run",4,"snp.invul_off()")
end

function remove_ozersky()
	disable_info("ozersky_spawn")
	remove_obj("vol_snork_1")
end

function vol0()
	if has_info("snp_vesker1_done") and has_info("acv_shax") then
		sms("%c[sender]"..translate("name_volazar")..":\\n%c[sms_red]"..user_name()..translate("sms_volazar_vol0_0"), 7, nil, 60000, nil, [[sms\volazar\vol0]])
		local obj = create("v_inventory_box0",xyz(157.90061950684,36.504898071289,107.2147064209),59831,2566)
		map_spot(obj.id, "treasure", "Cache")
		sms("Received a tip on the cache", nil, nil, 10000)
	end
end

-- Удаление любого онлайнового/оффлайнового обьекта
function remove_obj(name)
	local obj
    for a=1,65535 do
	  obj = server_object(a)
		if obj and string.find(obj:name(),name) then
          release(obj, true)
		  return
	  	end
    end
end
