-------------------- Записная книжка сталкера от OGSM CS ----------------------
------------------------- Copyright 2007-2009 DEXXX ---------------------------
------------------------ Copyright 2009-2010 ARS Team -------------------------


local private_array={
	{name="zat_b12_documents_1", info="zat_b12_documents_1"},
	{name="zat_b12_documents_2", info="zat_b12_documents_2"},
	{name="jup_a9_power_info", info="jup_a9_power_info"},
	{name="jup_a9_way_info", info="jup_a9_way_info"},
	{name="jup_a9_meeting_info", info="jup_a9_meeting_info"},
	{name="jup_a9_losses_info", info="jup_a9_losses_info"},
	{name="jup_a9_delivery_info", info="jup_a9_delivery_info"},
	{name="jup_b10_notes_01", info="jup_b10_notes_01"},
	{name="jup_b10_notes_02", info="jup_b10_notes_02"},
	{name="jup_b10_notes_03", info="jup_b10_notes_03"},
	{name="jup_b205_sokolov_note", info="jup_b205_sokolov_note"},
	{name="pri_a19_american_experiment_info", info="pri_a19_american_experiment_info"},
	{name="mutanter_training_pseudogigant_0", info="ars_mutanter_pseudogigant_rank"},
	{name="mutanter_training_pseudogigant_1", info="ars_mutanter_pseudogigant_rank"},
	{name="mutanter_training_pseudogigant_2", info="ars_mutanter_pseudogigant_rank"},
	{name="mutanter_training_pseudogigant_3", info="ars_mutanter_pseudogigant_rank"},
	{name="mutanter_training_burer_controller_0", info="ars_mutanter_controller_rank"},
	{name="mutanter_training_burer_controller_1", info="ars_mutanter_burer_rank"},
	{name="mutanter_training_chimera_0", info="ars_mutanter_chimera_rank"},
	{name="mutanter_training_chimera_1", info="ars_mutanter_chimera_rank"},
	{name="mutanter_training_bloodsucker_0", info="ars_mutanter_bloodsucker_rank"},
	{name="mutanter_training_bloodsucker_1", info="ars_mutanter_bloodsucker_rank"},
	{name="mutanter_training_snork_0", info="ars_mutanter_snork_rank"},
	{name="mutanter_training_snork_1", info="ars_mutanter_snork_rank"},
	{name="mutanter_training_boar_0", info="ars_mutanter_boar_rank"},
	{name="mutanter_training_boar_1", info="ars_mutanter_boar_rank"},
	{name="mutanter_training_flesh_0", info="ars_mutanter_flesh_rank"},
	{name="mutanter_training_flesh_1", info="ars_mutanter_flesh_rank"},
	{name="mutanter_training_dogs_0", info="ars_mutanter_dogs_rank"},
	{name="mutanter_training_dogs_1", info="ars_mutanter_dogs_rank"},
	{name="mutanter_training_tushkano", info="ars_mutanter_tushkano_rank"},
--[[
	{name="mutanter_training_base_0", info="ars_mutanter_base_rank"},
	{name="mutanter_training_base_1", info="ars_mutanter_base_rank"},
	{name="zat_b39_joker_pda", info="zat_b39_joker_pda_info"},
	{name="device_pda_zat_b5_dealer", info="device_pda_zat_b5_dealer_info"},
	{name="zat_b20_noah_pda", info="zat_b20_noah_pda_info"},
	{name="zat_b44_barge_pda", info="zat_b44_barge_pda_info"}
--]]
}

local monsters_array={
	"tushkano",
	"boar",
	"flesh",
	"pseudodog",
	"psydog",
	"dog",
	"chimera",
	"bloodsucker_marsh",
	"bloodsucker",
	"pseudogiant",
	"snork",
	"burer",
	"poltergeist_fire",
	"poltergeist",
	"controller"
}

local locations_array={
	"zaton",
	"jupiter",
	"underpass",
	"pripyat",
	"labx8"
}

local factions_array={
	"bandit",
	"dolg",
	"freedom",
	"killer",
	"army",
	"monolith",
	"stalker",
	"zombied"
}

local anomaly_array={
	"jarka",
	"gazirovka",
	"electra",
	"tramplin",
	"voronka",
	"karusel",
	"kameta",
	"tesla",
	"surge"
}

local current_mode=1

class "load_item" (CUIListBoxItem)
function load_item:__init() super()
	self:SetTextColor(GetARGB(255, 216, 186, 140))
	self.fn=self:GetTextItem()
	self.fn:SetFont(GetFontLetterica18Russian())
	self.fn:SetEllipsis(true)
end
function load_item:__finalize() end

class "load_item2" (CUIListBoxItem)
function load_item2:__init() super()
	self:SetTextColor(GetARGB(255, 216, 186, 140))
	self.fn=self:GetTextItem()
	self.fn:SetFont(GetFontLetterica16Russian())
	self.fn:SetEllipsis(true)
end
function load_item2:__finalize() end

class "notepad" (CUIScriptWnd)
function notepad:__init() super()
	self:InitControls()
	self:InitCallBacks()
	self:FillList(private_array)
	current_mode=1
end
function notepad:__finalize() end

function notepad:InitControls()
	self:SetWndRect(Frect():set(0,0,1024,768))
	local xml=CScriptXmlInit()
	local ctrl
	xml:ParseFile("ui_notes_wnd.xml")
	xml:InitStatic("background", self)
	xml:InitStatic("caption_static", self)
	xml:InitStatic("noice_static", self)
    self.clock_wnd=xml:InitStatic("clock_wnd",self)
	ctrl=CUIWindow()
	xml:InitWindow("list_item:main", 0, ctrl)
	self.list_item_main_sz=vector2():set(ctrl:GetWidth(), ctrl:GetHeight())
	xml:InitWindow("list_item:fn", 0, ctrl)
	self.list_item_fn_sz=vector2():set(ctrl:GetWidth(), ctrl:GetHeight())
	xml:InitWindow("list_item:fa", 0, ctrl)
	self.list_item_fa_sz=vector2():set(ctrl:GetWidth(), ctrl:GetHeight())
	xml:InitWindow("description_item:main", 0, ctrl)
	self.desc_item_main_sz=vector2():set(ctrl:GetWidth(), ctrl:GetHeight())
	xml:InitWindow("description_item:fn", 0, ctrl)
	self.desc_item_fn_sz=vector2():set(ctrl:GetWidth(), ctrl:GetHeight())
	self.btn1=xml:Init3tButton("btn_private", self)
	self.btn1:Enable(false)
	self:Register(self.btn1, "btn_private")
	self.btn2=xml:Init3tButton("btn_monsters", self)
	self:Register(self.btn2, "btn_monsters")
	self.btn3=xml:Init3tButton("btn_locations", self)
	self:Register(self.btn3, "btn_locations")
	self.btn4=xml:Init3tButton("btn_factions", self)
	self:Register(self.btn4, "btn_factions")
	self.btn5=xml:Init3tButton("btn_legends", self)
	self:Register(self.btn5, "btn_legends")
	self.btn6=xml:Init3tButton("btn_quit", self)
	self:Register(self.btn6, "btn_quit")
	xml:InitFrame("list_frame", self)
	xml:InitFrame("descr_frame", self)
	self.list = xml:InitListBox("list",self)
	self.list:ShowSelectedItem(true)
	self:Register(self.list, "list_window")
	self.picture=xml:InitStatic("picture", self)
	self.description_list = xml:InitListBox("description_list",self)
	self:Register(self.description_list, "description_list")
end

function notepad:InitCallBacks()
	self:AddCallback("btn_private", ui_events.BUTTON_CLICKED, self.click_private, self)
	self:AddCallback("btn_monsters", ui_events.BUTTON_CLICKED, self.click_monsters, self)
	self:AddCallback("btn_locations", ui_events.BUTTON_CLICKED, self.click_locations, self)
	self:AddCallback("btn_factions", ui_events.BUTTON_CLICKED, self.click_factions, self)
	self:AddCallback("btn_legends", ui_events.BUTTON_CLICKED, self.click_stories, self)
	self:AddCallback("btn_quit", ui_events.BUTTON_CLICKED, self.click_quit, self)
	self:AddCallback("list_window", ui_events.LIST_ITEM_CLICKED, self.OnListItemClicked, self)
end

function notepad:Update()
	CUIScriptWnd.Update(self)
	self.clock_wnd:TextControl():SetText(getTime())
end

function notepad:OnKeyboard(dik, keyboard_action)
	CUIScriptWnd.OnKeyboard(self, dik, keyboard_action)
	if keyboard_action==ui_events.WINDOW_KEY_PRESSED then
		if dik==DIK_keys.DIK_ESCAPE then self:click_quit() end
		if dik==DIK_keys.DIK_1 then self:click_private() end
		if dik==DIK_keys.DIK_2 then self:click_monsters() end
		if dik==DIK_keys.DIK_3 then self:click_locations() end
		if dik==DIK_keys.DIK_4 then self:click_factions() end
		if dik==DIK_keys.DIK_5 then self:click_stories() end
	end
	return true
end

function notepad:click_quit()
	self:HideDialog()
end
function notepad:click_private()
	current_mode=1
	self.btn1:Enable(false)
	self.btn2:Enable(true)
	self.btn3:Enable(true)
	self.btn4:Enable(true)
	self.btn5:Enable(true)
	self:FillList(private_array)
end
function notepad:click_monsters()
	current_mode=2
	self.btn1:Enable(true)
	self.btn2:Enable(false)
	self.btn3:Enable(true)
	self.btn4:Enable(true)
	self.btn5:Enable(true)
	self:FillList(monsters_array)
end
function notepad:click_locations()
	current_mode=3
	self.btn1:Enable(true)
	self.btn2:Enable(true)
	self.btn3:Enable(false)
	self.btn4:Enable(true)
	self.btn5:Enable(true)
	self:FillList(locations_array)
end
function notepad:click_factions()
	current_mode=4
	self.btn1:Enable(true)
	self.btn2:Enable(true)
	self.btn3:Enable(true)
	self.btn4:Enable(false)
	self.btn5:Enable(true)
	self:FillList(factions_array)
end
function notepad:click_stories()
	current_mode=5
	self.btn1:Enable(true)
	self.btn2:Enable(true)
	self.btn3:Enable(true)
	self.btn4:Enable(true)
	self.btn5:Enable(false)
	self:FillList(anomaly_array)
end

function notepad:OnListItemClicked()
	if self.list:GetSize()==0 then return end
	item=self.list:GetSelectedItem()
	if item==nil then return end
	local item_text=item.fn:GetText()
	local item_alias=item.fa:GetText()
	if item_alias=="null" then return end
	self.description_list:Clear()
	self.description_list:ScrollToBegin()
	self.picture:TextControl():SetText("")
	if current_mode==1 then
		self:FillDescription(GetString("ars_"..item_alias))
		self.picture:InitTexture("ui_noise")
	elseif current_mode==2 then
		self:FillDescription(GetString("enc_mutant_"..item_alias))
		self.picture:InitTexture("ui_notepad_monster_"..item_alias)
	elseif current_mode==3 then
		self:FillDescription(GetString("enc_location_"..item_alias))
		self.picture:InitTexture("ui_notepad_location_"..item_alias)
	elseif current_mode==4 then
		self:FillDescription(GetString("enc_faction_"..item_alias))
		self.picture:InitTexture("ui_notepad_faction_"..item_alias)
	elseif current_mode==5 then
		self:FillDescription(GetString("enc_anomaly_"..item_alias))
		self.picture:InitTexture("ui_notepad_anomaly_"..item_alias)
	else
		self.picture:InitTexture("ui_disk_io")
		self.picture:TextControl():SetText(GetString("notepad_list_none"))
	end
	local r=self.picture:GetTextureRect()
	self.picture:SetTextureRect(Frect():set(r.x1,r.y1,r.x2,r.y2))
	self.list:ShowSelectedItem(true)
end

function notepad:FillList(array)
	self.list:Clear()
	self.list:ScrollToBegin()
	self.description_list:Clear()
	self.description_list:ScrollToBegin()
	local r=self.picture:GetTextureRect()
	self.picture:InitTexture("ui\\ui_disk_io")
	self.picture:SetTextureRect(Frect():set(r.x1,r.y1,r.x2,r.y2))
	self.picture:TextControl():SetText(GetString("notepad_list_none"))
	for k,v in pairs(array) do
		if array==private_array and db.actor:has_info(v.info) then
			self:AddItemToList(GetString(v.name),v.name)
		elseif array==monsters_array and db.actor:has_info(v.."_dead") then
			self:AddItemToList(GetString(v),v)
		elseif array==locations_array and db.actor:has_info(v.."_visited") then
			self:AddItemToList(GetString(v),v)
		elseif array==factions_array and db.actor:has_info(v.."_info") then
			self:AddItemToList(GetString(v),v)
		elseif array==anomaly_array and db.actor:has_info("anomaly_"..v) then
			self:AddItemToList(GetString(v),v)
		end
	end
	if self.list:GetSize()==0 then
		self:AddItemToList(GetString("notepad_list_empty"),"null") 
	end
end

function notepad:AddItemToList(item_name,item_alias)
	local itm=load_item()
	itm:SetWndSize(self.list_item_main_sz)
	itm.fn:SetWndPos(vector2():set(0,0))
	itm.fn:SetWndSize(self.list_item_fn_sz)
	itm.fn:SetText(item_name)
	itm.fa = itm:AddTextField(item_alias, self.list_item_fa_sz.x)
	itm.fa:SetFont(GetFontLetterica16Russian())
	itm.fa:SetWndPos(vector2():set(self.list_item_fn_sz.x-40, 1200))
	itm.fa:SetWndSize(self.list_item_fa_sz)
	self.list:AddExistingItem(itm)
end

function notepad:FillDescription(item_name)
	local arr=str_explode(" ",item_name,60,65)
	for k,v in pairs(arr) do
		local itm=load_item2()
		itm:SetWndSize(self.desc_item_main_sz)
		itm.fn:SetWndPos(vector2():set(0,0))
		itm.fn:SetWndSize(self.desc_item_fn_sz)
		itm.fn:SetText(v)
		self.description_list:AddExistingItem(itm)
	end
end

-----------------------------------------------------------------
function trim(s)
	return(string.gsub(s, "^%s*(.-)%s*$", "%1"))
end

function str_explode(div,str,pos1,pos2,clear)
	local t={}
	local cpt,pos
	if pos1==nil then pos1=1 end
	if pos2==nil then pos2=pos1 end
	local cpt1=string.find(str,div,pos1,true)
	local cpt2=string.find(str,div,pos2,true)
	if cpt1 and cpt2 then
		if cpt2-cpt1>5 then
			cpt=cpt1
			pos=pos1
		else
			cpt=cpt2
			pos=pos2
		end
		repeat
			if clear then
				table.insert(t,trim(string.sub(str,1,cpt-1)))
			else
				table.insert(t,string.sub(str,1,cpt-1))
			end
			str=string.sub(str,cpt+string.len(div))
			cpt=string.find(str,div,pos,true)
		until cpt==nil
	end
	if clear then
		table.insert(t,trim(str))
	else
		table.insert(t,str)
	end
	return t
end

function getTime()
	local time
	local time_m=level.get_time_minutes()
	local time_h=level.get_time_hours()
	if level.get_time_minutes()>=0 and level.get_time_minutes()<=9 then
		time=time_h..":".."0"..time_m
	end
	if level.get_time_minutes()>=10 and level.get_time_minutes()<=59 then
		time=time_h..":"..time_m
	end
	if level.get_time_minutes()>=0 and level.get_time_minutes()<=9 and level.get_time_hours()>=0 and level.get_time_hours()<10 then
		time="0"..time_h..":".."0"..time_m
	end
	if level.get_time_minutes()>=10 and level.get_time_minutes()<=59 and level.get_time_hours()>=0 and level.get_time_hours()<10 then
		time="0"..time_h..":"..time_m
	end
	return time
end

--'-------------------------------------------------
--' Функции для работы с записной книжкой
--'-------------------------------------------------
-- выдача инфопоршенов на поднятие предмета
function take_note_item(s_obj)
    if not s_obj then return end
	if not db.actor:object("notepad") then return end
	local t_flag=false
	local actor=db.actor
	local sect=s_obj:section_name()
    if s_obj and s_obj.section_name then
		if sect=="zat_b12_documents_1" then
			if not actor:has_info("zat_b12_documents_1") then
				actor:give_info_portion("zat_b12_documents_1")
				t_flag=true
			end
		elseif sect=="zat_b12_documents_2" then
			if not actor:has_info("zat_b12_documents_2") then
				actor:give_info_portion("zat_b12_documents_2")
				t_flag=true
			end
		elseif sect=="jup_a9_power_info" then
			if not actor:has_info("jup_a9_power_info") then
				actor:give_info_portion("jup_a9_power_info")
				t_flag=true
			end
		elseif sect=="jup_a9_way_info" then
			if not actor:has_info("jup_a9_way_info") then
				actor:give_info_portion("jup_a9_way_info")
				t_flag=true
			end
		elseif sect=="jup_a9_meeting_info" then
			if not actor:has_info("jup_a9_meeting_info") then
				actor:give_info_portion("jup_a9_meeting_info")
				t_flag=true
			end
		elseif sect=="jup_a9_losses_info" then
			if not actor:has_info("jup_a9_losses_info") then
				actor:give_info_portion("jup_a9_losses_info")
				t_flag=true
			end
		elseif sect=="jup_a9_losses_info" then
			if not actor:has_info("jup_a9_delivery_info") then
				actor:give_info_portion("jup_a9_delivery_info")
				t_flag=true
			end
		elseif sect=="jup_b10_notes_01" then
			if not actor:has_info("jup_b10_notes_01") then
				actor:give_info_portion("jup_b10_notes_01")
				t_flag=true
			end
		elseif sect=="jup_b10_notes_02" then
			if not actor:has_info("jup_b10_notes_02") then
				actor:give_info_portion("jup_b10_notes_02")
				t_flag=true
			end
		elseif sect=="jup_b10_notes_03" then
			if not actor:has_info("jup_b10_notes_03") then
				actor:give_info_portion("jup_b10_notes_03")
				t_flag=true
			end
		elseif sect=="jup_b205_sokolov_note" then
			if not actor:has_info("jup_b205_sokolov_note") then 
				actor:give_info_portion("jup_b205_sokolov_note")
				t_flag=true
			end
		elseif sect=="pri_a19_american_experiment_info" then
			if not actor:has_info("pri_a19_american_experiment_info") then
				actor:give_info_portion("pri_a19_american_experiment_info")
				t_flag=true
			end
--[[
		elseif sect=="zat_b39_joker_pda" then
			if not actor:has_info("zat_b39_joker_pda_info") then
				actor:give_info_portion("zat_b39_joker_pda_info")
				t_flag=true
			end
		elseif sect=="device_pda_zat_b5_dealer" then
			if not actor:has_info("device_pda_zat_b5_dealer_info") then
				actor:give_info_portion("device_pda_zat_b5_dealer_info")
				t_flag=true
			end
		elseif sect=="zat_b20_noah_pda" then
			if not actor:has_info("zat_b20_noah_pda_info") then
				actor:give_info_portion("zat_b20_noah_pda_info")
				t_flag=true
			end
		elseif sect=="zat_b44_barge_pda" then
			if not actor:has_info("zat_b44_barge_pda_info") then
				actor:give_info_portion("zat_b44_barge_pda_info")
				t_flag=true
			end
--]]
		end
		if t_flag==true then
			ars_cop.send_tip(GetString(GetItemName(sect)),GetString("notepad_tip_private"),3,10,"pda")
		end
	end
end

-- выдача информации о локации
function note_location_info()
	if not db.actor:object("notepad") then return end
	if not xr_conditions.black_screen() and level.name() then
		if(level.name()=="zaton" and not has_alife_info("zaton_visited"))then
			if has_alife_info("ars_zat_b55_visit_info") and has_alife_info("ars_zat_b100_visit_info") and
				has_alife_info("ars_zat_b104_visit_info") and has_alife_info("ars_zat_b38_visit_info") and
				has_alife_info("ars_zat_b40_visit_info") and has_alife_info("ars_zat_b56_visit_info") and
				has_alife_info("ars_zat_b5_visit_info") and has_alife_info("ars_zat_a2_visit_info") and
				has_alife_info("ars_zat_b20_visit_info") and has_alife_info("ars_zat_b53_visit_info") and
				has_alife_info("ars_zat_b101_visit_info") and has_alife_info("ars_zat_b106_visit_info") and
				has_alife_info("ars_zat_b7_visit_info") and has_alife_info("ars_zat_b14_visit_info") and
				has_alife_info("ars_zat_b52_visit_info") and has_alife_info("ars_zat_b39_visit_info") and
				has_alife_info("ars_zat_b33_visit_info") and has_alife_info("ars_zat_b18_visit_info") and
				has_alife_info("ars_zat_b54_visit_info") and has_alife_info("ars_zat_b12_visit_info") and
				has_alife_info("ars_zat_b28_visit_info") and has_alife_info("ars_zat_b103_visit_info")
			then
				db.actor:give_info_portion("zaton_visited")
				ars_cop.send_tip(GetString(level.name()),GetString("notepad_tip_location"),3,10,"loc_info")
			end
		elseif(level.name()=="jupiter" and not has_alife_info("jupiter_visited"))then
			if has_alife_info("ars_jup_b1_visit_info") and has_alife_info("ars_jup_b46_visit_info") and
				has_alife_info("ars_jup_b202_visit_info") and has_alife_info("ars_jup_b211_visit_info") and
				has_alife_info("ars_jup_b200_visit_info") and has_alife_info("ars_jup_b19_visit_info") and
				has_alife_info("ars_jup_a6_visit_info") and has_alife_info("ars_jup_b25_visit_info") and
				has_alife_info("ars_jup_b6_visit_info") and has_alife_info("ars_jup_b205_visit_info") and
				has_alife_info("ars_jup_b206_visit_info") and has_alife_info("ars_jup_b32_visit_info") and
				has_alife_info("ars_jup_a10_visit_info") and has_alife_info("ars_jup_b209_visit_info") and
				has_alife_info("ars_jup_b208_visit_info") and has_alife_info("ars_jup_a12_visit_info") and
				has_alife_info("ars_jup_b212_visit_info") and has_alife_info("ars_jup_b9_visit_info") and
				has_alife_info("ars_jup_b201_visit_info") and has_alife_info("ars_jup_a9_visit_info")
			then
				db.actor:give_info_portion("jupiter_visited")
				ars_cop.send_tip(GetString(level.name()),GetString("notepad_tip_location"),3,10,"loc_info")
			end
		elseif(level.name()=="pripyat" and not has_alife_info("pripyat_visited"))then
			if has_alife_info("ars_pri_a28_visit_info") and has_alife_info("ars_pri_b36_visit_info") and
				has_alife_info("ars_pri_b303_visit_info") and has_alife_info("ars_pri_b301_visit_info") and
				has_alife_info("ars_pri_a17_visit_info") and has_alife_info("ars_pri_b306_visit_info") and
				has_alife_info("ars_pri_a16_visit_info") and has_alife_info("ars_pri_a25_visit_info") and
				has_alife_info("ars_pri_b35_visit_info") and has_alife_info("ars_pri_a21_visit_info") and
				has_alife_info("ars_pri_b304_visit_info") and has_alife_info("ars_pri_a18_visit_info")
			then
				db.actor:give_info_portion("pripyat_visited")
				ars_cop.send_tip(GetString(level.name()),GetString("notepad_tip_location"),3,10,"loc_info")
			end
		end
		if has_alife_info("zaton_visited") and has_alife_info("jupiter_visited") and
		   not (has_alife_info("ars_lc_zaton_to_jupiter") and has_alife_info("ars_lc_jupiter_to_zaton"))
		then
			db.actor:give_info_portion("ars_lc_zaton_to_jupiter")
			db.actor:give_info_portion("ars_lc_jupiter_to_zaton")
			ars_level_changer.check_new_lc()
			ars_cop.send_tip(GetString("level_changer_ztj_open"),nil,nil,nil,"loc_info")
		end
	end
end

-- выдача информации о подземных локаций
local u_loc={
	jupiter_underground="underpass_visited",
	labx8="labx8_visited"
}
function note_location_info_update()
	if not db.actor:object("notepad") then return end
	if not xr_conditions.black_screen() then
		local level_n=level.name()
		if level_n and (level_n~="jupiter_underground" and level_n~="labx8")then return end
		for key,value in pairs(u_loc) do
			if key==level_n and not has_alife_info(value) then
				db.actor:give_info_portion(value)
				ars_cop.send_tip(GetString(level_n),GetString("notepad_tip_location"),3,10,"loc_info")
				--остатки старой версии
				ars.del_variable("prev_level")
			end
		end
	end
end

-- выдача информации о группировке
function note_use_npc(npc)
	if not db.actor:object("notepad") then return end
	if npc==nil then return end
	local name
	if math.random(100)<60 then
		if npc:character_community()=="stalker" then
			if not has_alife_info("stalker_info") then db.actor:give_info_portion("stalker_info") name="stalker" end
		elseif npc:character_community()=="bandit" then
			if not has_alife_info("bandit_info") then db.actor:give_info_portion("bandit_info") name="bandit" end
		elseif npc:character_community()=="army" then
			if not has_alife_info("army_info") then db.actor:give_info_portion("army_info") name="army" end
		elseif npc:character_community()=="killer" then
			if not has_alife_info("killer_info") then db.actor:give_info_portion("killer_info") name="killer" end
		elseif npc:character_community()=="dolg" then
			if not has_alife_info("dolg_info") then db.actor:give_info_portion("dolg_info") name="dolg" end
		elseif npc:character_community()=="freedom" then
			if not has_alife_info("freedom_info") then db.actor:give_info_portion("freedom_info") name="freedom" end
		elseif npc:character_community()=="ecolog" then
			if not has_alife_info("ecolog_info") then db.actor:give_info_portion("ecolog_info") name="ecolog" end
		elseif npc:character_community()=="monolith" then
			if not has_alife_info("monolith_info") then db.actor:give_info_portion("monolith_info") name="monolit" end
		elseif npc:character_community()=="zombied" then
			if not has_alife_info("zombied_info") then db.actor:give_info_portion("zombied_info") name="zombied" end
		end
		if name~=nil then
            ars_cop.send_tip(GetString(name),GetString("notepad_tip_community"),3,10)
		end
	end
end


-------------------- Записная книжка сталкера от OGSM CS ----------------------
------------------------- Copyright 2007-2009 DEXXX ---------------------------
------------------------ Copyright 2009-2010 ARS Team -------------------------

--[[

If you're going to use the whole of this script or its parts in your own creative 
developments for the S.T.A.L.K.E.R. game, please don't become such a goddamn 
motherfucker like the notorious author of the ABC Mod - Carbrobro. Leave the 
copyrights, note the real author(s) and don't claim others' ideas and their 
realization to be your own ones. It's just simple Modmakers' Ethics. Thank you!

Если вы собираетесь использовать данный скрипт целиком или частично в своих 
разработках по игре S.T.A.L.K.E.R., пожалуйста не опускайтесь до уровня печально 
известного автора ABC мода - Carbrobro. Не удаляйте копирайты, указывайте настоящего 
автора(ов) и не выдавайте чужие идеи и их реализацию за свои. Ведь это элементарная 
этика модостроителей! Спасибо за понимание.

]]--