local npcs_requiring_task_dialog = {
	character_desc_pripyat = {"trader_pri_a15_mlr"},
	character_desc_jupiter = {"jup_a6_stalker_barmen"},
	character_desc_bar = {"bar_informator_mlr"},
}
local custom_dialogs = {
	character_desc_garbage = {
		baraholka_trader = [[
			baraholka_trader_the_living_fire_1
			baraholka_trader_the_living_fire_2
		]]
	},
	character_desc_bar = {
		bar_informator_mlr = [[
			bar_informator_mlr_the_living_fire_2
			bar_informator_mlr_the_living_fire_3
			bar_informator_mlr_the_living_fire_4
			bar_informator_mlr_the_living_fire_5
		]]
	},
	character_desc_yantar = {
		yan_stalker_sakharov = [[
			yan_stalker_sakharov_the_living_fire_1
			yan_stalker_sakharov_the_living_fire_2
			yan_stalker_sakharov_the_living_fire_3
			yan_stalker_sakharov_the_living_fire_4
			yan_stalker_sakharov_the_living_fire_5
		]]
	},
	character_desc_escape = {
		esc_2_12_stalker_trader = [[
			esc_2_12_stalker_trader_the_living_fire_1
		]]
	}
}
function on_xml_read()
	RegisterScriptCallback("on_xml_read", function(xml_file_name, xml_obj)
		for file_name, npcs in pairs(npcs_requiring_task_dialog) do
			if xml_file_name:find(file_name .. ".xml") then
				for _, npc in ipairs(npcs) do
					local query_res = xml_obj:query("specific_character[id=" .. npc .. "]")
					if not (type(query_res) == "table" and size_table(query_res) == 1) then return end
					local el = query_res[1]
					local task_dialog = [[
						dm_ordered_task_dialog
						dm_ordered_task_completed_dialog
					]]
					xml_obj:insertFromXMLString(task_dialog, el, #el.kids)
				end
			end
		end
		for file_name, npcs in pairs(custom_dialogs) do
			if xml_file_name:find(file_name .. ".xml") then
				for npc, dial in pairs(npcs) do
					local query_res = xml_obj:query("specific_character[id=" .. npc .. "]")
					if not (type(query_res) == "table" and size_table(query_res) == 1) then return end
					local el = query_res[1]
					xml_obj:insertFromXMLString(dial, el, #el.kids)
				end
			end
		end
	end)
end