--[[
Copyright: © Ирбиs , Real Wolf
]]

local worder,have_ord,allowed,cost

function is_ordered_now()
	if have_ord == nil or not have_ord == true then
		return true
	end
	return false
end

function order_plash()
	worder = "leather_raincoat"
	cost = system_ini():r_float(worder,"cost") + 3000
end

function order_exo()
	worder = "mercenary_exo"
	cost = system_ini():r_float(worder,"cost") + 3000
end

function order_val()
	worder = "wpn_val"
	cost = system_ini():r_float(worder,"cost") + 3000
end

function order_vss()
	worder = "wpn_vintorez"
	cost = system_ini():r_float(worder,"cost") + 3000
end

function order_svu()
	worder = "wpn_svu"
	cost = system_ini():r_float(worder,"cost") + 3000
end

function precond_money()
	if db.actor:money() >= cost then
		return true
	end
	return false
end

function precond_money_1()
	if db.actor:money() >= cost then
		return false
	end
	return true
end

function start_order(gg,npc)
	dialogs.relocate_money(npc, cost, "out")
	amk.g_start_timer("order_kruger",0,20,0)
	have_ord = true
end

function allowed_to_get()
	allowed = true
	amk.send_tip("Заказ выполнен, можешь забирать.", "Крюгер", nil, 5) 
end

function precond_getting(gg,npc)
	if (have_ord ~= nil and have_ord == true) then
		return true
	end
	return false
end

function precond_getting_1()
	if allowed == true then
		return false
	end
	return true
end

function precond_getting_2()
	if allowed == true then
		return true
	end
	return false
end

function getting(gg,npc)
	have_ord = false
	dialogs.relocate_item_section(gg, tostring(worder), "in")
	worder = "nil"
	allowed = false
end

function Save()
	amk.save_variable("ord_kruger_have_ord", have_ord)
	amk.save_variable("ord_kruger_allowed", allowed)
	amk.save_variable("ord_kruger_worder", worder)
end

function Load()
	have_ord = amk.load_variable("ord_kruger_have_ord")
	amk.del_variable("ord_kruger_have_ord")
	allowed = amk.load_variable("ord_kruger_allowed")
	amk.del_variable("ord_kruger_allowed")
	worder = amk.load_variable("ord_kruger_worder")
	amk.del_variable("ord_kruger_worder")
end	