-- b208

function jup_b208_give_reward(first_speaker, second_speaker)
	local amount = 5000
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, amount)
	treasure_manager.get_treasure_manager():give_treasure("jup_hiding_place_18")
	treasure_manager.get_treasure_manager():give_treasure("jup_hiding_place_35")
	treasure_manager.get_treasure_manager():give_treasure("jup_hiding_place_45")
end

-- a9

function jupiter_a9_actor_hasnt_all_mail_items(first_speaker, second_speaker)
	return not jupiter_a9_actor_has_all_mail_items(first_speaker, second_speaker)
end

function jupiter_a9_actor_has_all_mail_items(first_speaker, second_speaker)
	return ((db.actor:object("jup_a9_conservation_info") ~= nil) and (db.actor:object("jup_a9_power_info") ~= nil) and (db.actor:object("jup_a9_way_info") ~= nil))
end

function jupiter_a9_actor_has_any_items(first_speaker, second_speaker)
	return db.actor:object("jup_a9_delivery_info") ~= nil or
	db.actor:object("jup_a9_evacuation_info") ~= nil or
	db.actor:object("jup_a9_losses_info") ~= nil or
	db.actor:object("jup_a9_power_info") ~= nil or
	db.actor:object("jup_a9_conservation_info") ~= nil or
	db.actor:object("jup_a9_way_info") ~= nil or
	db.actor:object("jup_a9_meeting_info") ~= nil
end


function jupiter_a9_actor_has_any_mail_items(first_speaker, second_speaker)
	return db.actor:object("jup_a9_conservation_info") ~= nil or
	db.actor:object("jup_a9_power_info") ~= nil or
	db.actor:object("jup_a9_way_info") ~= nil
end

function jupiter_a9_actor_has_any_secondary_items(first_speaker, second_speaker)
	return db.actor:object("jup_a9_delivery_info") ~= nil or
	db.actor:object("jup_a9_evacuation_info") ~= nil or
	db.actor:object("jup_a9_losses_info") ~= nil or
	db.actor:object("jup_a9_meeting_info") ~= nil
end

function jupiter_a9_actor_hasnt_any_mail_items(first_speaker, second_speaker)
	return db.actor:object("jup_a9_conservation_info") == nil or
	db.actor:object("jup_a9_power_info") == nil or
	db.actor:object("jup_a9_way_info") == nil
end


function jupiter_a9_freedom_leader_jupiter_delivery(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 500)
end

function jupiter_a9_freedom_leader_jupiter_evacuation(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 500)
end

function jupiter_a9_freedom_leader_jupiter_losses(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 500)
end

function jupiter_a9_freedom_leader_jupiter_meeting(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 500)
end

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

function jupiter_a9_dolg_leader_jupiter_delivery(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 500)
end

function jupiter_a9_dolg_leader_jupiter_evacuation(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 500)
end

function jupiter_a9_dolg_leader_jupiter_losses(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 500)
end

function jupiter_a9_dolg_leader_jupiter_meeting(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 500)
end


function jup_a9_owl_stalker_trader_sell_jup_a9_evacuation_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_evacuation_info")
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 750)
	db.actor:give_info_portion("jup_a9_evacuation_info_sold")
end

function jup_a9_owl_stalker_trader_sell_jup_a9_meeting_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_meeting_info")
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 750)
	db.actor:give_info_portion("jup_a9_meeting_info_sold")
end

function jup_a9_owl_stalker_trader_sell_jup_a9_losses_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_losses_info")
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 750)
	db.actor:give_info_portion("jup_a9_losses_info_sold")
end

function jup_a9_owl_stalker_trader_sell_jup_a9_delivery_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_delivery_info")
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 750)
 	db.actor:give_info_portion("jup_a9_delivery_info_sold")
end

function jupiter_a9_dolg_leader_jupiter_sell_all_secondary_items(first_speaker, second_speaker)
	if jup_a9_actor_has_evacuation_info(first_speaker, second_speaker) then
		actor_relocate_evacuation_info(first_speaker, second_speaker)
		jupiter_a9_dolg_leader_jupiter_evacuation(first_speaker, second_speaker)
	end
	if jup_a9_actor_has_meeting_info(first_speaker, second_speaker) then
		actor_relocate_meeting_info(first_speaker, second_speaker)
		jupiter_a9_dolg_leader_jupiter_meeting(first_speaker, second_speaker)
	end
	if jup_a9_actor_has_losses_info(first_speaker, second_speaker) then
		actor_relocate_losses_info(first_speaker, second_speaker)
		jupiter_a9_dolg_leader_jupiter_losses(first_speaker, second_speaker)
	end
	if jup_a9_actor_has_delivery_info(first_speaker, second_speaker) then
		actor_relocate_delivery_info(first_speaker, second_speaker)
		jupiter_a9_dolg_leader_jupiter_delivery(first_speaker, second_speaker)
	end
end

function jupiter_a9_freedom_leader_jupiter_sell_all_secondary_items(first_speaker, second_speaker)
	if jup_a9_actor_has_evacuation_info(first_speaker, second_speaker) then
		actor_relocate_evacuation_info(first_speaker, second_speaker)
		jupiter_a9_freedom_leader_jupiter_evacuation(first_speaker, second_speaker)
	end
	if jup_a9_actor_has_meeting_info(first_speaker, second_speaker) then
		actor_relocate_meeting_info(first_speaker, second_speaker)
		jupiter_a9_freedom_leader_jupiter_meeting(first_speaker, second_speaker)
	end
	if jup_a9_actor_has_losses_info(first_speaker, second_speaker) then
		actor_relocate_losses_info(first_speaker, second_speaker)
		jupiter_a9_freedom_leader_jupiter_losses(first_speaker, second_speaker)
	end
	if jup_a9_actor_has_delivery_info(first_speaker, second_speaker) then
		actor_relocate_delivery_info(first_speaker, second_speaker)
		jupiter_a9_freedom_leader_jupiter_delivery(first_speaker, second_speaker)
	end
end

function jup_a9_actor_has_conservation_info(first_speaker, second_speaker)
	return db.actor:object("jup_a9_conservation_info") ~= nil
end

function jup_a9_actor_hasnt_conservation_info(first_speaker, second_speaker)
	return not jup_a9_actor_has_conservation_info(first_speaker, second_speaker)
end

function actor_relocate_conservation_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_conservation_info")
end


function jup_a9_actor_has_power_info(first_speaker, second_speaker)
	return db.actor:object("jup_a9_power_info") ~= nil
end

function jup_a9_actor_hasnt_power_info(first_speaker, second_speaker)
	return not jup_a9_actor_has_power_info(first_speaker, second_speaker)
end

function actor_relocate_power_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_power_info")
end


function jup_a9_actor_has_way_info(first_speaker, second_speaker)
	return db.actor:object("jup_a9_way_info") ~= nil
end

function jup_a9_actor_hasnt_way_info(first_speaker, second_speaker)
	return not jup_a9_actor_has_way_info(first_speaker, second_speaker)
end

function actor_relocate_way_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_way_info")
end

--------------------------------------------------
function jup_a9_actor_has_evacuation_info(first_speaker, second_speaker)
	return db.actor:object("jup_a9_evacuation_info") ~= nil
end

function jup_a9_actor_hasnt_evacuation_info(first_speaker, second_speaker)
	return not jup_a9_actor_has_evacuation_info(first_speaker, second_speaker)
end

function actor_relocate_evacuation_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_evacuation_info")
	db.actor:give_info_portion("jup_a9_evacuation_info_sold")
end



function jup_a9_actor_has_meeting_info(first_speaker, second_speaker)
	return db.actor:object("jup_a9_meeting_info") ~= nil
end

function jup_a9_actor_hasnt_meeting_info(first_speaker, second_speaker)
	return not jup_a9_actor_has_meeting_info(first_speaker, second_speaker)
end

function actor_relocate_meeting_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_meeting_info")
	db.actor:give_info_portion("jup_a9_meeting_info_sold")
end


function jup_a9_actor_has_delivery_info(first_speaker, second_speaker)
	return db.actor:object("jup_a9_delivery_info") ~= nil
end

function jup_a9_actor_hasnt_delivery_info(first_speaker, second_speaker)
	return not jup_a9_actor_has_delivery_info(first_speaker, second_speaker)
end

function actor_relocate_delivery_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_delivery_info")
	db.actor:give_info_portion("jup_a9_delivery_info_sold")
end


function jup_a9_actor_has_losses_info(first_speaker, second_speaker)
	return db.actor:object("jup_a9_losses_info") ~= nil
end

function jup_a9_actor_hasnt_losses_info(first_speaker, second_speaker)
	return not jup_a9_actor_has_losses_info(first_speaker, second_speaker)
end

function actor_relocate_losses_info(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_a9_losses_info")
	db.actor:give_info_portion("jup_a9_losses_info_sold")
end

-- b206

function actor_has_plant(first_speaker, second_speaker)
	return db.actor:object("jup_b206_plant") ~= nil
end

function actor_relocate_plant(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b206_plant")
end

-- b212

function actor_relocate_trapper_reward(first_speaker, second_speaker)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "wpn_wincheaster1300_trapper")
end

function zat_b106_trapper_reward(first_speaker, second_speaker)
	if has_alife_info("zat_b106_one_hit") then
		dialogs.relocate_money_to_actor(first_speaker, second_speaker, 3000)
	else
		dialogs.relocate_money_to_actor(first_speaker, second_speaker, 2000)
	end
end

-- Jupiter a10, by alex

function jup_a10_proverka_wpn(first_speaker, second_speaker)
	local table = {
					"wpn_desert_eagle",
					"wpn_desert_eagle_nimble",
					"wpn_sig550",
					"wpn_g36",
					"wpn_g36_nimble",
					"wpn_fn2000",
					"wpn_fn2000_nimble",
					"wpn_groza",
					"wpn_groza_nimble",
					"wpn_val",
					"wpn_vintorez",
					"wpn_vintorez_nimble",
					"wpn_svd",
					"wpn_svu",
					"wpn_pkm",
					"wpn_spas12",
					"wpn_spas12_nimble",
					"wpn_protecta",
					"wpn_protecta_nimble",
					"wpn_gauss",
					"wpn_rpg7",
					"wpn_rg-6",
					"wpn_pkm_zulus",

					}

	for k,v in pairs(table) do
		if db.actor:item_in_slot(2)~= nil and db.actor:item_in_slot(2):section() == v then
			return true
		elseif db.actor:item_in_slot(3)~= nil and db.actor:item_in_slot(3):section() == v then
			return true
		end
	end

	return false
end

function jup_a10_proverka_wpn_false(first_speaker, second_speaker)
	return not jup_a10_proverka_wpn(first_speaker, second_speaker)
end

function jup_a10_actor_has_money(first_speaker, second_speaker)
	if has_alife_info("jup_a10_debt_wo_percent") then
		return db.actor:money() >= 5000
	else
		return db.actor:money() >= 7000
	end
end

function jup_a10_actor_has_not_money(first_speaker, second_speaker)
	return not jup_a10_actor_has_money(first_speaker, second_speaker)
end

function jup_a10_actor_give_money(first_speaker, second_speaker)
	if has_alife_info("jup_a10_debt_wo_percent") then
		dialogs.relocate_money_from_actor(first_speaker, second_speaker, 5000)
		db.actor:give_info_portion("jup_a10_bandit_take_money")
	else
		dialogs.relocate_money_from_actor(first_speaker, second_speaker, 7000)
		db.actor:give_info_portion("jup_a10_bandit_take_all_money")
	end
end

function jup_a10_vano_give_money(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 5000)
end

function jup_a10_actor_give_outfit_money(first_speaker, second_speaker)
	dialogs.relocate_money_from_actor(first_speaker, second_speaker, 5000)
end

function jup_a10_actor_has_outfit_money(first_speaker, second_speaker)
	return db.actor:money() >= 5000
end

function jup_a10_actor_has_not_outfit_money(first_speaker, second_speaker)
	return not jup_a10_actor_has_outfit_money(first_speaker, second_speaker)
end

-- Jupiter b16, by alex
function if_actor_has_jup_b16_oasis_artifact(first_speaker, second_speaker)
	return first_speaker:object("af_oasis_heart") ~= nil
end

function if_actor_hasnt_jup_b16_oasis_artifact(first_speaker, second_speaker)
	return not if_actor_has_jup_b16_oasis_artifact(first_speaker, second_speaker)
end

function jupiter_b16_reward(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 7000)
end

function give_jup_b16_oasis_artifact(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "af_oasis_heart")
end

-- Jupiter A12, by yojig


function jup_a12_actor_has_15000_money(first_speaker, second_speaker)
	return db.actor:money() >= 15000
end

function jup_a12_actor_do_not_has_15000_money(first_speaker, second_speaker)
	return db.actor:money() < 15000
end

local jup_a12_af_table = {
							[1] = "af_fire",
							[2] = "af_gold_fish",
							[3] = "af_glass",
							[4] = "af_ice",
							}

function jup_a12_actor_has_artefacts(first_speaker, second_speaker)
	for k,v in pairs(jup_a12_af_table) do
		if db.actor:object(v) ~= nil then
			return true
		end
	end

	return false
end

function jup_a12_actor_do_not_has_artefacts(first_speaker, second_speaker)
	for k,v in pairs(jup_a12_af_table) do
		if db.actor:object(v) ~= nil then
			return false
		end
	end

	return true
end

function jup_a12_actor_has_artefact_1(first_speaker, second_speaker)
	return db.actor:object(jup_a12_af_table[1]) ~= nil
end

function jup_a12_actor_has_artefact_2(first_speaker, second_speaker)
	return db.actor:object(jup_a12_af_table[2]) ~= nil
end

function jup_a12_actor_has_artefact_3(first_speaker, second_speaker)
	return db.actor:object(jup_a12_af_table[3]) ~= nil
end

function jup_a12_actor_has_artefact_4(first_speaker, second_speaker)
	return db.actor:object(jup_a12_af_table[4]) ~= nil
end

function jup_a12_transfer_ransom_from_actor(first_speaker, second_speaker)
	if has_alife_info("jup_a12_ransom_by_money") then
		dialogs.relocate_money_from_actor(first_speaker, second_speaker, 15000)
		return
	end

	local jup_a12_info_table = {
								[1] = "jup_a12_af_fire",
								[2] = "jup_a12_af_gold_fish",
								[3] = "jup_a12_af_glass",
								[4] = "jup_a12_af_ice",
								}

	for i = 1,4 do
		if has_alife_info(jup_a12_info_table[i]) then
			dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, jup_a12_af_table[i])
			return
		end
	end
end

function jup_a12_transfer_5000_money_to_actor(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 5000)
	treasure_manager.get_treasure_manager():give_treasure("jup_hiding_place_40")
	treasure_manager.get_treasure_manager():give_treasure("jup_hiding_place_34")
end

function jup_a12_transfer_artefact_to_actor(first_speaker, second_speaker)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "af_gold_fish")
	if has_alife_info("jup_a12_stalker_prisoner_free_dialog_done") then
		treasure_manager.get_treasure_manager():give_treasure("jup_hiding_place_40")
		treasure_manager.get_treasure_manager():give_treasure("jup_hiding_place_34")
	end
end

function jup_a12_transfer_cashier_money_from_actor(first_speaker, second_speaker)
	local amount = math.random(20, 50)*100
	if db.actor:money() < amount then
		amount = db.actor:money()
	end
	dialogs.relocate_money_from_actor(first_speaker, second_speaker, amount)
end

function who_is_actor(first_speaker, second_speaker)
	local npc = second_speaker
	if db.actor:id() ~= npc:id() then
		npc	= first_speaker
	end
	return npc
end

-- Zaton B30 on Jupiter part

function zat_b30_transfer_detectors(first_speaker, second_speaker)
	local amount = 3

	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "detector_elite", amount)
end

function zat_b30_actor_has_transfer_items(first_speaker, second_speaker)
	local cnt = 0
	local function zat_b30_count(npc, item)
		if item:section() == "detector_elite" then
			cnt = cnt + 1
		end
	end

	db.actor:iterate_inventory(zat_b30_count, nil)
	if cnt > 2 then
		return true
	end

	return false
end

function zat_b30_actor_do_not_has_transfer_items(first_speaker, second_speaker)
	return not zat_b30_actor_has_transfer_items(first_speaker, second_speaker)
end

--- Jupiter B32

function jup_b6_scientist_nuclear_physicist_scan_anomaly_precond(first_speaker, second_speaker)
	if not has_alife_info("jup_b6_b32_quest_active") then
		return false
	elseif has_alife_info("jup_b6_give_task") and has_alife_info("jup_b32_task_addon_start") then
		return false
	elseif has_alife_info("jup_b6_task_fail") and has_alife_info("jup_b32_task_addon_start") then
		return false
	end
	
	return true
end

function jup_b32_task_give_dialog_precond(first_speaker, second_speaker)
	if has_alife_info("jup_b32_task_start") and not has_alife_info("jup_b32_task_end") then
		return false
	end

	return true
end


function jup_b32_transfer_scanners(first_speaker, second_speaker)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "jup_b32_scanner_device", 3)
end

function jup_b32_transfer_scanners_2(first_speaker, second_speaker)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "jup_b32_scanner_device", 2)
end

function jup_b32_give_reward_to_actor(first_speaker, second_speaker)
	local amount = 5000
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, amount)
end

function jup_b32_anomaly_has_af(first_speaker, second_speaker)
	local az_table = {
						[1] = "jup_b32_anomal_zone",
						[2] = "jup_b201_anomal_zone",
						[3] = "jup_b209_anomal_zone",
						[4] = "jup_b211_anomal_zone",
						[5] = "jup_b10_anomal_zone",
						}
	local infop_table = {
						[1] = "jup_b32_anomaly_1",
						[2] = "jup_b32_anomaly_2",
						[3] = "jup_b32_anomaly_3",
						[4] = "jup_b32_anomaly_4",
						[5] = "jup_b32_anomaly_5",
						}
	local index = 0

	for i = 1, #infop_table do
		if has_alife_info(infop_table[i]) then
			index = i
			break
		end
	end

	if index == 0 then
		return false
	end

	local anomal_zone = db.anomaly_by_name[az_table[index]]
	if anomal_zone == nil then
		return false
	end

	if anomal_zone.spawned_count > 0 then
		disable_info(infop_table[index])
		give_info("jup_b32_anomaly_true")
		return true
	end

	return false
end

function jup_b32_anomaly_do_not_has_af(first_speaker, second_speaker)
	if has_alife_info("jup_b32_anomaly_true") then
		disable_info("jup_b32_anomaly_true")
		return false
	end

	local az_table = {
						[1] = "jup_b32_anomal_zone",
						[2] = "jup_b201_anomal_zone",
						[3] = "jup_b209_anomal_zone",
						[4] = "jup_b211_anomal_zone",
						[5] = "jup_b10_anomal_zone",
						}
	local infop_table = {
						[1] = "jup_b32_anomaly_1",
						[2] = "jup_b32_anomaly_2",
						[3] = "jup_b32_anomaly_3",
						[4] = "jup_b32_anomaly_4",
						[5] = "jup_b32_anomaly_5",
						}
	local index = 0

	for i = 1, #infop_table do
		if has_alife_info(infop_table[i]) then
			index = i
			break
		end
	end

	if index == 0 then
		return true
	end

	local anomal_zone = db.anomaly_by_name[az_table[index]]
	if anomal_zone == nil then
		disable_info(infop_table[index])
		return true
	end

	if anomal_zone.spawned_count > 0 then
		return false
	end

	disable_info(infop_table[index])
	return true
end

--- Jupiter 209

function jup_b209_get_monster_scanner (first_speaker, second_speaker)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "jup_b209_monster_scanner", 1)
end

function jup_b209_return_monster_scanner (first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b209_monster_scanner", 1)
end
--- Jupiter 207

function jup_b207_generic_decrypt_need_dialog_precond(first_speaker, second_speaker)
	if db.actor:object("jup_b9_blackbox") ~= nil then
		 return true
	end

	if xr_conditions.check_npc_name(first_speaker, second_speaker, {"mechanic"})
		or xr_conditions.check_npc_name(first_speaker, second_speaker, {"tech"}) then
		return false
	end

	return false
end

function jup_b207_actor_has_dealers_pda(first_speaker, second_speaker)
	return db.actor:object("device_pda_zat_b5_dealer") ~= nil
end

function jup_b207_sell_dealers_pda(first_speaker, second_speaker)
	local amount = 4000
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "device_pda_zat_b5_dealer")
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, amount)
	db.actor:give_info_portion("jup_b207_dealers_pda_sold")
end

function jup_b207_give_dealers_pda(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "device_pda_zat_b5_dealer")
end

function jup_b207_actor_has_merc_pda_with_contract(first_speaker, second_speaker)
	return db.actor:object("jup_b207_merc_pda_with_contract") ~= nil
end

function jup_b207_sell_merc_pda_with_contract(first_speaker, second_speaker)
	local amount = 1000
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b207_merc_pda_with_contract")
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, amount)
	db.actor:give_info_portion("jup_b207_merc_pda_with_contract_sold")
end

function jup_b207_transfer_blackmail_reward(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b207_merc_pda_with_contract")
end

function jup_b207_transfer_blackmail_reward_for_pda(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b207_merc_pda_with_contract")
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "wpn_abakan")
end

---B1----

function give_jup_b1_art(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b1_half_artifact")
end

function if_actor_has_jup_b1_art(first_speaker, second_speaker)
	return db.actor:object("jup_b1_half_artifact") ~= nil
end

function jup_b1_actor_have_good_suit(first_speaker, second_speaker)
	local actor_true = false
	local suits_tbl = {
						["scientific_outfit"] = true,
						["military_outfit"] = true,
						["dolg_heavy_outfit"] = true,
						["exo_outfit"] = true,
						--["svoboda_light_outfit"] = true,
						["svoboda_heavy_outfit"] = true,
						["cs_heavy_outfit"] = true,
						["neutral_assault_outfit"] = true,
						["svoboda_exo_outfit"] = true,
						["dolg_scientific_outfit"] = true,
						["svoboda_scientific_outfit"] = true,
						["dolg_exo_outfit"] = true,
						["merc_exo_outfit"] = true,
						["monolith_scientific_outfit"] = true,
						["monolith_assault_outfit"] = true,
						["monolith_exo_outfit"] = true,
						["ecolog_outfit"] = true,						
						}

	local helmets_tbl = {
						["helm_battle"] = true,
						["helm_battle_dolg"] = true,
						["helm_tactic"] = true,
						["helm_protective"] = true,
						}

	if db.actor:item_in_slot(7) ~= nil and suits_tbl[db.actor:item_in_slot(7):section()] then
		actor_true = true
	end

	if db.actor:item_in_slot(12) ~= nil and helmets_tbl[db.actor:item_in_slot(12):section()] then
		actor_true = true
	end

	return actor_true
end

function jup_b1_actor_do_not_have_good_suit(first_speaker, second_speaker)
	return not jup_b1_actor_have_good_suit(first_speaker, second_speaker)
end

function jup_b1_reward_actor(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 6000)
end

---B6----

function jup_b6_actor_outfit_cs(first_speaker, second_speaker)
	if db.actor:item_in_slot(7) ~= nil and db.actor:item_in_slot(7):section() == "cs_heavy_outfit" then
		return true
	end
	return false
end

function jup_b6_first_reward_for_actor(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 2500)
end

function jup_b6_second_reward_for_actor(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 2500)
end

function jup_b6_all_reward_for_actor(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 5000)
end

function jup_b6_first_reward_for_actor_extra(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 3500)
end

function jup_b6_second_reward_for_actor_extra(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 3500)
end

function jup_b6_all_reward_for_actor_extra(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 7000)
end

function jup_b6_reward_actor_by_detector(first_speaker, second_speaker)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "detector_elite")
end

function jup_b6_actor_can_start(first_speaker, second_speaker)
	if has_alife_info("jup_b1_squad_is_dead") and
		not (has_alife_info("jup_b6_freedom_employed") or
		has_alife_info("jup_b6_duty_employed") or
		has_alife_info("jup_b6_gonta_employed") or
		has_alife_info("jup_b6_exprisoner_work_on_sci")) then
		return false
	end

	return true
end

function jup_b6_actor_can_not_start(first_speaker, second_speaker)
	return not jup_b6_actor_can_start(first_speaker, second_speaker)
end

function jup_b6_stalker_dialog_precond(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)

	npc = alife():object(npc:id())

	if not(npc) then
		return false
	end
	if alife():object(npc.group_id) == nil then
		return false
	end

	local squad_name = alife():object(npc.group_id):section_name()

	if squad_name ~= nil and squad_name ~= "" then
		if not has_alife_info("jup_b1_squad_is_dead") and squad_name == "jup_b1_stalker_squad" then
			return true
		elseif has_alife_info("jup_b6_freedom_employed") and squad_name == "jup_b6_stalker_freedom_squad" then
			return true
		elseif has_alife_info("jup_b6_duty_employed") and squad_name == "jup_b6_stalker_duty_squad" then
			return true
		elseif has_alife_info("jup_b6_gonta_employed") and squad_name == "jup_b6_stalker_gonta_squad" then
			return true
		elseif has_alife_info("jup_b6_exprisoner_work_on_sci") and squad_name == "jup_b6_stalker_exprisoner_squad" then
			return true
		end
	end

	return false
end

function jup_b1_stalker_squad_thanks(first_speaker, second_speaker)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "medkit_scientic", 3)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "antirad", 5)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "drug_psy_blockade", 2)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "drug_antidot", 2)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "drug_radioprotector", 2)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "drug_anabiotic")
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "helm_protective")
end

-- Jupiter B217 functions -------------------------------------------------
function jup_b217_actor_got_toolkit(first_speaker, second_speaker)
	local function is_toolkit(npc, item)
		local section = item:section()
		if(section=="toolkit_1" and not has_alife_info("jup_b217_tech_instrument_1_brought"))
		or(section=="toolkit_2" and not has_alife_info("jup_b217_tech_instrument_2_brought"))
		or(section=="toolkit_3" and not has_alife_info("jup_b217_tech_instrument_3_brought")) then
			db.actor.toolkit = section
			return
		end
	end

	db.actor:iterate_inventory(is_toolkit, nil)
	if (db.actor.toolkit ~= nil) then
		return true
	end

	return false
end


----------------------	b200
function jupiter_b200_tech_materials_relocate(first_speaker, second_speaker)
	local need_items = {
		["jup_b200_tech_materials_wire"] 		= true,
		["jup_b200_tech_materials_acetone"] 	= true,
		["jup_b200_tech_materials_textolite"] 	= true,
		["jup_b200_tech_materials_transistor"] 	= true,
		["jup_b200_tech_materials_capacitor"] 	= true}
	local count = 0
	local items_to_relocate = {}

	local function relocate_and_inc_count(npc, item)
		if need_items[item:section()] == true  then
			count = count + 1
			if items_to_relocate[item:section()] == nil then
				items_to_relocate[item:section()] = 1
			else
				items_to_relocate[item:section()] = items_to_relocate[item:section()] + 1
			end
		end
	end

	db.actor:iterate_inventory(relocate_and_inc_count, nil)
	xr_effects.inc_counter(db.actor, nil, {"jup_b200_tech_materials_brought_counter",tostring(count)})
	for k,v in pairs (items_to_relocate) do
		dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, k, v)
	end
end

----------------------	b4 ----------------------

function npc_in_b4_smart(first_speaker, second_speaker)
	return dialogs.is_npc_in_current_smart(first_speaker, second_speaker, "jup_b4")
end

----------------------	b202 ----------------------

function jup_b202_transfer_medkit(first_speaker, second_speaker)
--	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
--	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
--	if db.actor:object("medkit") ~= nil then
--		dialogs.relocate_item_section(npc,"medkit","out")
--	elseif db.actor:object("medkit_army") ~= nil then
--		dialogs.relocate_item_section(npc,"medkit_army","out")
--	elseif db.actor:object("medkit_scientic") ~= nil then
--		dialogs.relocate_item_section(npc,"medkit_scientic","out")
--	end
	if db.actor:object("medkit") ~= nil then
		dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "medkit")
	elseif db.actor:object("medkit_army") ~= nil then
		dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "medkit_army")
	elseif db.actor:object("medkit_scientic") ~= nil then
		dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "medkit_scientic")
	end
end

function jup_b202_actor_has_medkit(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	return (actor:object("medkit") ~= nil) or (actor:object("medkit_army") ~= nil) or (actor:object("medkit_scientic") ~= nil)
end

function jup_b202_hit_bandit_from_actor(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	db.actor:give_info_portion("jup_b202_bandit_hited")
	db.actor:give_info_portion("jup_b202_bandit_hited_by_actor")
	xr_effects.set_squad_goodwill(actor, npc, {"jup_b202_bandit_squad", "enemy"})
	--xr_effects.hit_npc_from_actor(actor,npc,{"jup_b202_bandit"})
end

function jup_b202_medic_dialog_precondition(first_speaker, second_speaker)
	if has_alife_info("jup_b218_gather_squad_complete") then
		return not has_alife_info("jup_b202_polustanok")
	else
		return not has_alife_info("jup_b52_medic_testimony")
	end
end
----------------------	b220 ----------------------


function jupiter_b220_all_hunted(first_speaker, second_speaker)
	if has_alife_info("jup_b220_trapper_bloodsucker_lair_hunted_told")
		and has_alife_info("jup_b220_trapper_zaton_chimera_hunted_told")
		and has_alife_info("jup_b211_swamp_bloodsuckers_hunt_done")
		and has_alife_info("jup_b208_burers_hunt_done")
		and has_alife_info("jup_b212_jupiter_chimera_hunt_done")
		then
		return false
	end

	return true
end

function jupiter_b220_no_one_hunted(first_speaker, second_speaker)
	if has_alife_info("jup_b220_trapper_about_himself_told")
			and has_alife_info("zat_b57_den_of_the_bloodsucker_tell_stalkers_about_destroy_lair_give")
			and not has_alife_info("jup_b220_trapper_bloodsucker_lair_hunted_told") then
		return false
	elseif has_alife_info("zat_b106_chimera_dead")
			and not has_alife_info("jup_b220_trapper_zaton_chimera_hunted_told") then
		return false
	elseif has_alife_info("jup_b6_all_hunters_are_dead")
			and not has_alife_info("jup_b211_swamp_bloodsuckers_hunt_done") then
		return false
	elseif has_alife_info("jup_b208_burers_dead")
			and not has_alife_info("jup_b208_burers_hunt_done") then
		return false
	elseif has_alife_info("jup_b212_jupiter_chimera_dead")
			and not has_alife_info("jup_b212_jupiter_chimera_hunt_done") then
		return false
	end

	return true
end

----------------------	b9 ----------------------
local money_count_table = {	[0] = 3000,
							[1] = 2850,
							[2] = 2700,
							[3] = 2550,
							[4] = 2400,
							[5] = 2250,
							[6] = 2100,
							[7] = 1950,
							[8] = 1800,
							[9] = 1650
						}

function jup_b9_actor_has_money(first_speaker, second_speaker)
	local money_count = money_count_table[0]
	for i=1,9 do
		if has_alife_info("jup_b200_tech_materials_brought_counter_"..i) then
			money_count = money_count_table[i]
		end
	end
	return db.actor:money() >= money_count
end

function give_jup_b9_blackbox(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b9_blackbox")

end

function jup_b9_actor_has_not_money(first_speaker, second_speaker)
	return not jup_b9_actor_has_money(first_speaker, second_speaker)
end

function jupiter_b9_relocate_money(first_speaker, second_speaker)
	local money_count = money_count_table[0]
	for i=1,9 do
		if has_alife_info("jup_b200_tech_materials_brought_counter_"..i) then
			money_count = money_count_table[i]
		end
	end
	dialogs.relocate_money_from_actor(first_speaker, second_speaker, money_count)
end



function if_actor_has_jup_b9_blackbox(first_speaker, second_speaker)
	return db.actor:object("jup_b9_blackbox") ~= nil
end

--  запрос есть ли у актёра jup_b9_blackbox

----------------------	b43 ----------------------

-- проверка артефактов

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

function if_actor_has_af_fuzz_kolobok(first_speaker, second_speaker)
	return first_speaker:object("af_fuzz_kolobok") ~= nil
end

function actor_has_first_or_second_artefact(first_speaker, second_speaker)
	return first_speaker:object("af_mincer_meat") ~= nil or first_speaker:object("af_fuzz_kolobok") ~= nil
end

-- передача артефактов на Юпитере по заданию

function transfer_af_mincer_meat(first_speaker, second_speaker)
		dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "af_mincer_meat")
end

function transfer_af_fuzz_kolobok(first_speaker, second_speaker)
		dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "af_fuzz_kolobok")
end

-- плата за телепорт игрока на Припять

function pay_cost_to_guide_to_pripyat(first_speaker, second_speaker)
	dialogs.relocate_money_from_actor(first_speaker, second_speaker, 5000)
end

-- проверка, платежеспособности игрока за телепорт на Припять

function jup_b43_actor_has_5000_money(first_speaker, second_speaker)
	return db.actor:money() >= 5000
end

function jup_b43_actor_do_not_has_5000_money(first_speaker, second_speaker)
	return db.actor:money() < 5000
end

-- награда за артефакты

function jup_b43_reward_for_first_artefact(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 2500)
end

function jup_b43_reward_for_second_artefact(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 3500)
end

function jup_b43_reward_for_both_artefacts(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 6000)
end

-- Jupiter B15 functions -------------------------------------------------

function jup_b15_dec_counter(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	return xr_effects.dec_counter(actor, npc, {"jup_b15_full_drunk_count", 1})
end

-- Jupiter B46 ------------------------------------------------------------

function jup_b46_transfer_duty_founder_pda(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	if db.actor:object("jup_b46_duty_founder_pda") ~= nil then
		dialogs.relocate_item_section(npc,"jup_b46_duty_founder_pda","out")
	end
end

function jup_b46_sell_duty_founder_pda_to_owl(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b46_duty_founder_pda")
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 2500)
	db.actor:give_info_portion("jup_b46_duty_founder_pda_sold")
	db.actor:give_info_portion("jup_b46_duty_founder_pda_to_stalkers")
end

function jup_b46_actor_has_founder_pda(first_speaker, second_speaker)
	return db.actor:object("jup_b46_duty_founder_pda") ~= nil
end

function jup_b46_sell_duty_founder_pda(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	if has_alife_info("jup_b46_duty_founder_pda_to_freedom") then
		dialogs.relocate_money_to_actor(first_speaker, second_speaker, 4000)
		dialogs.relocate_item_section(actor,"wpn_sig550","in",1)
		dialogs.relocate_item_section(actor,"ammo_5.56x45_ss190","in",5)
	elseif has_alife_info("jup_b46_duty_founder_pda_to_duty") then
		dialogs.relocate_money_to_actor(first_speaker, second_speaker, 4000)
		dialogs.relocate_item_section(actor,"wpn_groza","in",1)
		dialogs.relocate_item_section(actor,"ammo_9x39_ap","in",2)
		dialogs.relocate_item_section(actor,"ammo_vog-25","in",2)
	end
end

-- Jupiter B218 functions ---------------------------------------------------

function jup_b218_counter_not_3(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	return not xr_conditions.counter_equal(actor, npc, {"jup_b218_squad_members_count",3})
end

function jup_b218_counter_equal_3(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	return xr_conditions.counter_equal(actor, npc, {"jup_b218_squad_members_count",3})
end

function jup_b218_counter_not_0(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	return not xr_conditions.counter_equal(actor, npc, {"jup_b218_squad_members_count",0})
end

--function jup_b218_actor_outfit_check_not(first_speaker, second_speaker)
--	if db.actor:item_in_slot(7) ~= nil and db.actor:item_in_slot(7):section() == "scientific_outfit" then
--		return false
--	end
--	return true
--end

--function jup_b218_actor_outfit_check(first_speaker, second_speaker)
--	if db.actor:item_in_slot(7) ~= nil and db.actor:item_in_slot(7):section() == "scientific_outfit" then
--		return true
--	end
--	return false
--end

-- Jupiter B4 -------------------------------------------------------------

function jup_b4_is_actor_not_enemies_to_freedom(first_speaker, second_speaker)
	return not jup_b4_is_actor_enemies_to_freedom(first_speaker, second_speaker)
end

function jup_b4_is_actor_enemies_to_freedom(first_speaker, second_speaker)
	return game_relations.get_npcs_relation(first_speaker, second_speaker) == game_object.enemy
end

function jup_b4_is_actor_friend_to_freedom(first_speaker, second_speaker)
	return game_relations.get_npcs_relation(first_speaker, second_speaker) == game_object.friend
end

function jup_b4_is_actor_neutral_to_freedom(first_speaker, second_speaker)
	return game_relations.get_npcs_relation(first_speaker, second_speaker) == game_object.neutral
end


function jup_b4_is_actor_not_enemies_to_dolg(first_speaker, second_speaker)
	return not jup_b4_is_actor_enemies_to_dolg(first_speaker, second_speaker)
end

function jup_b4_is_actor_enemies_to_dolg(first_speaker, second_speaker)
	return game_relations.get_npcs_relation(first_speaker, second_speaker) == game_object.enemy
end

function jup_b4_is_actor_friend_to_dolg(first_speaker, second_speaker)
	return game_relations.get_npcs_relation(first_speaker, second_speaker) == game_object.friend
end

function jup_b4_is_actor_neutral_to_dolg(first_speaker, second_speaker)
	return game_relations.get_npcs_relation(first_speaker, second_speaker) == game_object.neutral
end
--------------------------- Jupiter b25 -------------------------------------
function jup_b25_frase_count_inc(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	return xr_effects.inc_counter(actor, npc,{"jup_b25_frase",1})
end

-------------------------- Jupiter b47 --------------------------------------
function jup_b47_jupiter_docs_enabled(first_speaker, second_speaker)
	local a = false
	local b = false
	local c = false
	local items_table = {
						"jup_a9_conservation_info",
						"jup_a9_power_info",
						"jup_a9_way_info",
						"jup_a9_evacuation_info",
						"jup_a9_meeting_info",
						"jup_a9_losses_info",
						"jup_a9_delivery_info"
--						"jup_b47_jupiter_products_info"
						}
	for k,v in pairs(items_table) do
		if db.actor:object(v) ~= nil then
			a = true
			break
		end
	end
	b = ((not has_alife_info("jup_b47_jupiter_products_start")) and (db.actor:object("jup_b47_jupiter_products_info") ~= nil))
	c = (has_alife_info("jup_b6_scientist_nuclear_physicist_jupiter_docs_talked"))
	return (a or b) and (not c)
end

function jup_b47_jupiter_products_info_enabled(first_speaker, second_speaker)
	return db.actor:object("jup_b47_jupiter_products_info") ~= nil
end

function jup_b47_jupiter_products_info_disabled(first_speaker, second_speaker)
	return db.actor:object("jup_b47_jupiter_products_info") == nil
end

function jup_b47_jupiter_products_info_revard(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	dialogs.relocate_item_section(npc,"jup_b47_jupiter_products_info","out")
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 7000)
	dialogs.relocate_item_section(actor,"medkit_scientic","in",3)
	dialogs.relocate_item_section(actor,"antirad","in",5)
	dialogs.relocate_item_section(actor,"drug_psy_blockade","in",2)
	dialogs.relocate_item_section(actor,"drug_antidot","in",2)
	dialogs.relocate_item_section(actor,"drug_radioprotector","in",2)
end

function jup_b47_actor_has_merc_pda(first_speaker, second_speaker)
	return db.actor:object("jup_b47_merc_pda") ~= nil
end

function jup_b47_actor_has_not_merc_pda(first_speaker, second_speaker)
	return not jup_b47_actor_has_merc_pda(first_speaker, second_speaker)
end

function jup_b47_merc_pda_revard(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	dialogs.relocate_item_section(npc,"jup_b47_merc_pda","out")
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 2500)
end

function jup_b47_actor_can_take_task(first_speaker, second_speaker)
	local a = has_alife_info("jup_b6_task_done") and (not has_alife_info("jup_b6_task_fail"))
	local b = has_alife_info("jup_b6_task_fail") and (not has_alife_info("jup_b6_task_done"))
	return a or b
end

function jup_b47_employ_squad(first_speaker, second_speaker)
	local a = has_alife_info("jup_b47_bunker_guards_started") and (not has_alife_info("jup_b47_bunker_guards_done"))-- or has_alife_info("jup_b6_employ_stalker")
	local b = has_alife_info("jup_b6_employ_stalker") and (not has_alife_info("jup_b6_employed_stalker"))--not (has_alife_info("jup_b47_bunker_guards_done") and has_alife_info("jup_b6_employed_stalker"))
	return a or b
end

function jup_b47_bunker_guard_revard(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 4000)
	dialogs.relocate_item_section(actor,"drug_psy_blockade","in",2)
	dialogs.relocate_item_section(actor,"drug_antidot","in",3)
	dialogs.relocate_item_section(actor,"drug_radioprotector","in",3)
end

function jup_b47_gauss_rifle_revard(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 12000)
end

function jup_b47_actor_has_hauss_rifle_docs(first_speaker, second_speaker)
	return db.actor:object("zat_a23_gauss_rifle_docs") ~= nil
end

-- Jupiter B10 --------------------------------------------------------------

function jup_b10_ufo_memory_give_to_npc(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b10_ufo_memory")
end

function jup_b10_ufo_memory_give_to_actor(first_speaker, second_speaker)
	return first_speaker:object("jup_b10_ufo_memory") ~= nil
end

function jup_b10_ufo_memory_2_give_to_actor(first_speaker, second_speaker)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "jup_b10_ufo_memory_2")
end

function jup_b10_ufo_has_money_1000(first_speaker, second_speaker)
	return db.actor:money() >= 1000
end

function jup_b10_ufo_has_money_3000(first_speaker, second_speaker)
	return db.actor:money() >= 2000
end

function jup_b10_ufo_hasnt_money_1000(first_speaker, second_speaker)
	return not jup_b10_ufo_has_money_1000(first_speaker, second_speaker)
end

function jup_b10_ufo_hasnt_money_3000(first_speaker, second_speaker)
	return not jup_b10_ufo_has_money_3000(first_speaker, second_speaker)
end

function jup_b10_ufo_relocate_money_1000(first_speaker, second_speaker)
	dialogs.relocate_money_from_actor(first_speaker, second_speaker, 1000)
end

function jup_b10_ufo_relocate_money_3000(first_speaker, second_speaker)
	dialogs.relocate_money_from_actor(first_speaker, second_speaker, 2000)
end

function jup_b10_actor_has_ufo_memory(first_speaker, second_speaker)
	return db.actor:object("jup_b10_ufo_memory") ~= nil
end

-------------- jup_b211 ---------------------

function jup_b211_kill_bludsuckers_reward(first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(second_speaker, first_speaker, 3000)
end

function jup_b19_transfer_conserva_to_actor(first_speaker, second_speaker)
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "conserva")
end
----------------------------------
function jupiter_b6_sell_halfartefact (first_speaker, second_speaker)
	dialogs.relocate_money_to_actor(first_speaker, second_speaker, 2000)
end
-----------------------------------

function pri_a15_sokolov_actor_has_note(first_speaker, second_speaker)
	return db.actor:object("jup_b205_sokolov_note") ~= nil
end

function pri_a15_sokolov_actor_has_not_note(first_speaker, second_speaker)
	return not pri_a15_sokolov_actor_has_note(first_speaker, second_speaker)
end

function pri_a15_sokolov_actor_give_note(first_speaker, second_speaker)
	dialogs.relocate_item_section_from_actor(first_speaker, second_speaker, "jup_b205_sokolov_note")
	dialogs.relocate_item_section_to_actor(first_speaker, second_speaker, "medkit_army")
end

function jup_b47_actor_not_enemy_to_freedom(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	return not xr_conditions.is_faction_enemy_to_actor(actor, npc, {"freedom"})
end

function jup_b47_actor_not_enemy_to_dolg(first_speaker, second_speaker)
	local npc = dialogs.who_is_npc(first_speaker, second_speaker)
	local actor = dialogs.who_is_actor(first_speaker, second_speaker)
	return not xr_conditions.is_faction_enemy_to_actor(actor, npc, {"dolg"})
end

function jup_b15_actor_sci_outfit(first_speaker, second_speaker)
	return (db.actor:object("scientific_outfit") ~= nil)
end

function jup_b15_no_actor_sci_outfit(first_speaker, second_speaker)
	return (db.actor:object("scientific_outfit") == nil)
end

function jup_b19_reward(first_speaker, second_speaker)
	treasure_manager.get_treasure_manager():give_treasure("jup_hiding_place_38")
end