-- Atlas (Spawn Menu) Mod 1.1
-- By: Helios (helios-50@hotmail.com)

class "atlas" (CUIScriptWnd)

function atlas:__init(owner,action) super()

	self.action = action
	self.owner = owner
	self:InitControls()
	self:InitCallBacks()
	end

function atlas:__finalize() end

function atlas:InitControls()

	self:SetWndRect		 (Frect():set(0,0,1000,1000))

	local xml = CScriptXmlInit()
	xml:ParseFile("ui_atlas2.xml")
	xml:InitStatic("background", self)

	self:Register(xml:Init3tButton("title", self),"title")
	self:Register(xml:Init3tButton("caption", self),"caption")
	self:Register(xml:Init3tButton("caption2", self),"caption2")
	self:Register(xml:InitEditBox("edit_box", self), "edit_box")
	self:Register(xml:Init3tButton("btn_0", self),"btn_0")
	self:Register(xml:Init3tButton("btn_1", self),"btn_1")
	self:Register(xml:Init3tButton("btn_2", self),"btn_2")
	self:Register(xml:Init3tButton("btn_3", self),"btn_3")
	self:Register(xml:Init3tButton("btn_4", self),"btn_4")
	self:Register(xml:Init3tButton("btn_5", self),"btn_5")
	self:Register(xml:Init3tButton("btn_6", self),"btn_6")
	self:Register(xml:Init3tButton("btn_7", self),"btn_7")
	self:Register(xml:Init3tButton("btn_8", self),"btn_8")
	self:Register(xml:Init3tButton("btn_9", self),"btn_9")
	self:Register(xml:Init3tButton("btn_10", self),"btn_10")
	self:Register(xml:Init3tButton("btn_11", self),"btn_11")
	self:Register(xml:Init3tButton("btn_12", self),"btn_12")
	self:Register(xml:Init3tButton("btn_13", self),"btn_13")
	self:Register(xml:Init3tButton("btn_14", self),"btn_14")
	self:Register(xml:Init3tButton("btn_15", self),"btn_15")
	self:Register(xml:Init3tButton("btn_16", self),"btn_16")
	self:Register(xml:Init3tButton("btn_17", self),"btn_17")
	self:Register(xml:Init3tButton("btn_18", self),"btn_18")
	self:Register(xml:Init3tButton("btn_19", self),"btn_19")

local caption = self:GetButton("caption")
local caption2 = self:GetButton("caption2")
local title = self:GetButton("title")
local btn_0 = self:GetButton("btn_0")
local btn_1 = self:GetButton("btn_1")
local btn_2 = self:GetButton("btn_2")
local btn_3 = self:GetButton("btn_3")
local btn_4 = self:GetButton("btn_4")
local btn_5 = self:GetButton("btn_5")
local btn_6 = self:GetButton("btn_6")
local btn_7 = self:GetButton("btn_7")
local btn_8 = self:GetButton("btn_8")
local btn_9 = self:GetButton("btn_9")
local btn_10 = self:GetButton("btn_10")
local btn_11 = self:GetButton("btn_11")
local btn_12 = self:GetButton("btn_12")
local btn_13 = self:GetButton("btn_13")
local btn_14 = self:GetButton("btn_14")
local btn_15 = self:GetButton("btn_15")
local btn_16 = self:GetButton("btn_16")
local btn_17 = self:GetButton("btn_17")
local btn_18 = self:GetButton("btn_18")
local btn_19 = self:GetButton("btn_19")
 
if self.action == "spawn" then

    	caption:SetText("Quantity Console:")
    	caption2:SetText("Enter the quantity of an item you want to spawn, or click a button.")
    	title:SetText("Atlas (Spawn Menu) Mod 1.1 - Item Spawner")
    	btn_0:SetText("Quit")
    	btn_1:SetText("Bandage")
    	btn_2:SetText("Energy Drink")
    	btn_3:SetText("Armour")
    	btn_4:SetText("Weapons")
    	btn_5:SetText("Regular Med-Kit")
    	btn_6:SetText("Sausage")
    	btn_7:SetText("Special Armour")
    	btn_8:SetText("Special Weapons")
    	btn_9:SetText("Army Med-Kit")
    	btn_10:SetText("Bread")
    	btn_11:SetText("Monster Items")
    	btn_12:SetText("Weapon Addons")
    	btn_13:SetText("Scientific Med-Kit")
    	btn_14:SetText("Tourist's Delight")
    	btn_15:SetText("Quest Items")
    	btn_16:SetText("Artifacts")
    	btn_17:SetText("Anti-Rad")
    	btn_18:SetText("Vodka")
    	btn_19:SetText("Misc. Items")

end

end

function atlas:InitCallBacks()

	self:AddCallback("btn_0", ui_events.BUTTON_CLICKED, self.on_quit, self)
	self:AddCallback("btn_1", ui_events.BUTTON_CLICKED, self.spawn_inventory_bandage, self)
	self:AddCallback("btn_2", ui_events.BUTTON_CLICKED, self.spawn_inventory_energy_drink, self)
	self:AddCallback("btn_3", ui_events.BUTTON_CLICKED, self.spawn_inventory_armour, self)
	self:AddCallback("btn_4", ui_events.BUTTON_CLICKED, self.spawn_inventory_weapon, self)
	self:AddCallback("btn_5", ui_events.BUTTON_CLICKED, self.spawn_inventory_medkit1, self)
	self:AddCallback("btn_6", ui_events.BUTTON_CLICKED, self.spawn_inventory_kolbasa, self)
	self:AddCallback("btn_7", ui_events.BUTTON_CLICKED, self.spawn_inventory_armour_special, self)
	self:AddCallback("btn_8", ui_events.BUTTON_CLICKED, self.spawn_inventory_weapon_special, self)
	self:AddCallback("btn_9", ui_events.BUTTON_CLICKED, self.spawn_inventory_medkit2, self)
	self:AddCallback("btn_10", ui_events.BUTTON_CLICKED, self.spawn_inventory_bread, self)
	self:AddCallback("btn_11", ui_events.BUTTON_CLICKED, self.spawn_inventory_monster, self)
	self:AddCallback("btn_12", ui_events.BUTTON_CLICKED, self.spawn_inventory_addons, self)
	self:AddCallback("btn_13", ui_events.BUTTON_CLICKED, self.spawn_inventory_medkit3, self)
	self:AddCallback("btn_14", ui_events.BUTTON_CLICKED, self.spawn_inventory_conserva, self)
	self:AddCallback("btn_15", ui_events.BUTTON_CLICKED, self.spawn_inventory_quest, self)
	self:AddCallback("btn_16", ui_events.BUTTON_CLICKED, self.spawn_inventory_artifacts, self)
	self:AddCallback("btn_17", ui_events.BUTTON_CLICKED, self.spawn_inventory_antirad, self)
	self:AddCallback("btn_18", ui_events.BUTTON_CLICKED, self.spawn_inventory_vodka, self)
	self:AddCallback("btn_19", ui_events.BUTTON_CLICKED, self.spawn_inventory_misc, self)

end

function atlas: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:on_quit()
	end	

end
	return true
end

function atlas:on_quit()
	self:GetHolder():start_stop_menu (self,true)
end

function atlas:spawn_inventory(spawn_item,npc)

	local number = self:GetEditBox("edit_box"):GetText()

  	if npc==nil then 
  	npc=db.actor 
	end

	if number ~= "" then
	for i=1, number do
  	alife():create(spawn_item, npc:position(), npc:level_vertex_id(), npc:game_vertex_id(), npc:id())
      	end
	end

	if number == "" then
  	alife():create(spawn_item, npc:position(), npc:level_vertex_id(), npc:game_vertex_id(), npc:id())
	end

end
		
function atlas:spawn_inventory_artifacts()

	self:spawn_inventory("af_medusa")
        self:spawn_inventory("af_cristall_flower")
	self:spawn_inventory("af_night_star")
        self:spawn_inventory("af_vyvert")
        self:spawn_inventory("af_gravi")
        self:spawn_inventory("af_gold_fish")
        self:spawn_inventory("af_blood")
        self:spawn_inventory("af_mincer_meat")
        self:spawn_inventory("af_soul")
        self:spawn_inventory("af_electra_sparkler")
        self:spawn_inventory("af_electra_flash")
        self:spawn_inventory("af_electra_moonlight")
        self:spawn_inventory("af_rusty_thorn")
        self:spawn_inventory("af_rusty_kristall")
        self:spawn_inventory("af_rusty_sea-urchin")
        self:spawn_inventory("af_ameba_slime")
        self:spawn_inventory("af_ameba_slug")
        self:spawn_inventory("af_ameba_mica")
        self:spawn_inventory("af_drops")
        self:spawn_inventory("af_fireball")
        self:spawn_inventory("af_cristall")
        self:spawn_inventory("af_dummy_glassbeads")
 	self:spawn_inventory("af_dummy_pellicle")
        self:spawn_inventory("af_dummy_battery")
        self:spawn_inventory("af_dummy_dummy")
        self:spawn_inventory("af_dummy_spring")
        self:spawn_inventory("af_fuzz_kolobok")
        self:spawn_inventory("af_buliz")
        self:spawn_inventory("af_spirit_1")
        self:spawn_inventory("af_spirit_2")
        self:spawn_inventory("af_spirit_3")
        self:spawn_inventory("af_spirit_4")
        self:spawn_inventory("af_cry_1")
        self:spawn_inventory("af_cry_2")
        self:spawn_inventory("af_cry_3")
        self:spawn_inventory("af_babka_1")
        self:spawn_inventory("af_babka_2")
        self:spawn_inventory("af_babka_3")
        self:spawn_inventory("af_pudd_1")
        self:spawn_inventory("af_pudd_2")
        self:spawn_inventory("af_pudd_3")
        self:spawn_inventory("af_pudd_4")
        self:spawn_inventory("af_dik_1")
        self:spawn_inventory("af_dik_2")
        self:spawn_inventory("af_dik_3")
        self:spawn_inventory("af_dik_4")
        self:spawn_inventory("af_kol_1")
        self:spawn_inventory("af_kol_2")
        self:spawn_inventory("af_kol_3")
        self:spawn_inventory("af_kol_4")
        self:spawn_inventory("af_armor_1")
        self:spawn_inventory("af_armor_2")
        self:spawn_inventory("af_armor_3")
        self:spawn_inventory("af_armor_4")
        self:spawn_inventory("af_simbion")

end

function atlas:spawn_inventory_armour()

        self:spawn_inventory("novice_outfit")
        self:spawn_inventory("bandit_outfit")
	self:spawn_inventory("killer_outfit")
        self:spawn_inventory("monolit_outfit")
        self:spawn_inventory("soldier_outfit")
        self:spawn_inventory("specops_outfit")
        self:spawn_inventory("military_outfit")
        self:spawn_inventory("stalker_outfit")
        self:spawn_inventory("scientific_outfit")
        self:spawn_inventory("exo_outfit")
        self:spawn_inventory("svoboda_light_outfit")
        self:spawn_inventory("svoboda_heavy_outfit")
        self:spawn_inventory("dolg_outfit")
        self:spawn_inventory("dolg_scientific_outfit")
        self:spawn_inventory("ecolog_outfit")
        self:spawn_inventory("protection_outfit")

end

function atlas:spawn_inventory_armour_special()

        self:spawn_inventory("outfit_novice_m1")
        self:spawn_inventory("outfit_bandit_m1")
        self:spawn_inventory("outfit_dolg_m1")
        self:spawn_inventory("outfit_killer_m1")
        self:spawn_inventory("outfit_specnaz_m1")
        self:spawn_inventory("outfit_stalker_m1")
        self:spawn_inventory("outfit_stalker_m2")
        self:spawn_inventory("outfit_svoboda_m1")
        self:spawn_inventory("outfit_exo_m1")
        self:spawn_inventory("neytral_novice_outfit_m1")
        self:spawn_inventory("neytral_novice_gaz_outfit_m1")
        self:spawn_inventory("neytral_gaz_outfit_m1")
        self:spawn_inventory("neytral_exo_gaz_outfit_m1")
        self:spawn_inventory("bandit_gaz_outfit_m1")
        self:spawn_inventory("outfit_bandit_master")
        self:spawn_inventory("bandit_veteran_outfit_m1")
        self:spawn_inventory("svoboda_gaz_outfit_m1")
        self:spawn_inventory("svoboda_heavy_gaz_outfit_m1")
        self:spawn_inventory("svoboda_yellow_exo_outfit_m1")
        self:spawn_inventory("dolg_gaz_outfit_m1")
        self:spawn_inventory("killer_gaz_outfit_m1")
        -- self:spawn_inventory("monolit_gaz_outfit_m1")

end

function atlas:spawn_inventory_weapon()

        self:spawn_inventory("wpn_pm")
        self:spawn_inventory("wpn_pb")
	self:spawn_inventory("wpn_fort")
        self:spawn_inventory("wpn_hpsa")
        self:spawn_inventory("wpn_beretta")
        self:spawn_inventory("wpn_walther")
        self:spawn_inventory("wpn_sig220")
        self:spawn_inventory("wpn_colt1911")
        self:spawn_inventory("wpn_usp")
        self:spawn_inventory("wpn_desert_eagle")
        self:spawn_inventory("wpn_bm16")
        self:spawn_inventory("wpn_toz34")
        self:spawn_inventory("wpn_wincheaster1300")
        self:spawn_inventory("wpn_spas12")
        self:spawn_inventory("wpn_ak74u")
        self:spawn_inventory("wpn_mp5")
        self:spawn_inventory("wpn_ak74")
        self:spawn_inventory("wpn_abakan")
        self:spawn_inventory("wpn_l85")
        self:spawn_inventory("wpn_lr300")
        self:spawn_inventory("wpn_sig550")
        self:spawn_inventory("wpn_groza")
 	self:spawn_inventory("wpn_val")
        self:spawn_inventory("wpn_vintorez")
        self:spawn_inventory("wpn_svu")
        self:spawn_inventory("wpn_svd")
        self:spawn_inventory("wpn_rg-6")
        self:spawn_inventory("wpn_rpg7")
        self:spawn_inventory("wpn_g36")
        self:spawn_inventory("wpn_fn2000")
        self:spawn_inventory("wpn_gauss")

end

function atlas:spawn_inventory_weapon_special()

        self:spawn_inventory("wpn_ak74_m1")
        self:spawn_inventory("wpn_abakan_m1")
        self:spawn_inventory("wpn_fort_m1")
        self:spawn_inventory("wpn_ak74u_m1")
        self:spawn_inventory("wpn_mp5_m1")
        self:spawn_inventory("wpn_groza_m1")
        self:spawn_inventory("wpn_spas12_m1")
        self:spawn_inventory("wpn_winchester_m1")
        self:spawn_inventory("wpn_l85_m1")
        self:spawn_inventory("wpn_lr300_m1")
        self:spawn_inventory("wpn_svd_m1")
        self:spawn_inventory("wpn_sig_m1")
        self:spawn_inventory("wpn_eagle_m1")
 	self:spawn_inventory("wpn_colt_m1")
        self:spawn_inventory("wpn_val_m1")
        self:spawn_inventory("wpn_mp5_m2")
        self:spawn_inventory("wpn_abakan_m2")
        self:spawn_inventory("wpn_l85_m2")
        self:spawn_inventory("wpn_sig_m2")
        self:spawn_inventory("wpn_rg6_m1")
        self:spawn_inventory("wpn_walther_m1")
        self:spawn_inventory("wpn_ak47")
        self:spawn_inventory("wpn_saiga12c")
        self:spawn_inventory("wpn_ppsh_mp41")
        self:spawn_inventory("wpn_pkm")
        self:spawn_inventory("wpn_mg3")
        self:spawn_inventory("wpn_fn_p90")
        self:spawn_inventory("wpn_kriss_super_v")
        self:spawn_inventory("wpn_mp7a3")
        self:spawn_inventory("wpn_bizon")
        self:spawn_inventory("wpn_smg_tmp")
        self:spawn_inventory("wpn_mac10")
        self:spawn_inventory("wpn_tec9")
        self:spawn_inventory("wpn_ots33")
        self:spawn_inventory("wpn_benelli_short")
        self:spawn_inventory("wpn_wulcano")
        self:spawn_inventory("wpn_bm16_full")

end

function atlas:spawn_inventory_addons()

        self:spawn_inventory("wpn_addon_scope")
        self:spawn_inventory("wpn_addon_scope_susat")
        self:spawn_inventory("wpn_addon_silencer")
        self:spawn_inventory("wpn_addon_grenade_launcher")
        self:spawn_inventory("wpn_addon_grenade_launcher_m203")
        self:spawn_inventory("wpn_9mm_nato_silencer")
        self:spawn_inventory("wpn_addon_p90_silencer")

end

function atlas:spawn_inventory_medkit1()
        self:spawn_inventory("medkit")
	end

function atlas:spawn_inventory_medkit2()
        self:spawn_inventory("medkit_army")
	end

function atlas:spawn_inventory_medkit3()
        self:spawn_inventory("medkit_scientic")
	end

function atlas:spawn_inventory_bandage()
        self:spawn_inventory("bandage")
	end

function atlas:spawn_inventory_antirad()
        self:spawn_inventory("antirad")
	end

function atlas:spawn_inventory_bread()
        self:spawn_inventory("bread")
	end

function atlas:spawn_inventory_kolbasa()
        self:spawn_inventory("kolbasa")
	end

function atlas:spawn_inventory_conserva()
        self:spawn_inventory("conserva")
	end

function atlas:spawn_inventory_vodka()
        self:spawn_inventory("vodka")
	end

function atlas:spawn_inventory_energy_drink()
        self:spawn_inventory("energy_drink")
	end

function atlas:spawn_inventory_monster()

        self:spawn_inventory("mutant_flesh_eye")
        self:spawn_inventory("mutant_boar_leg")
	self:spawn_inventory("mutant_dog_tail")
        self:spawn_inventory("mutant_psevdodog_tail")
        self:spawn_inventory("mutant_krovosos_jaw")
        self:spawn_inventory("mutant_snork_leg")

end

function atlas:spawn_inventory_quest()

        self:spawn_inventory("gunslinger_flash")
        self:spawn_inventory("af_blood_tutorial")
	self:spawn_inventory("esc_wounded_flash")
        self:spawn_inventory("quest_case_02")
        self:spawn_inventory("dar_document1")
        self:spawn_inventory("dar_document2")
        self:spawn_inventory("dar_document3")
        self:spawn_inventory("dar_document4")
        self:spawn_inventory("dar_document5")
        self:spawn_inventory("kruglov_flash")
        self:spawn_inventory("lab_x16_documents")
        self:spawn_inventory("good_psy_helmet")
	self:spawn_inventory("bad_psy_helmet")
        self:spawn_inventory("decoder")
        self:spawn_inventory("dynamite")
        self:spawn_inventory("quest_case_01")
        self:spawn_inventory("hunters_toz")
        self:spawn_inventory("bar_ecolog_flash")
        self:spawn_inventory("pri_decoder_documents")
        self:spawn_inventory("val_key_to_underground")
        self:spawn_inventory("crazy_flash")

end

function atlas:spawn_inventory_misc()

        self:spawn_inventory("mutant_burer_hand")
        self:spawn_inventory("mutant_zombie_hand")
        self:spawn_inventory("device_torch")
        self:spawn_inventory("detector_simple")
        self:spawn_inventory("detector_advances")
        self:spawn_inventory("detector_elite")
        self:spawn_inventory("detector_anomaly")
        self:spawn_inventory("device_pda")
        self:spawn_inventory("hand_radio")
        self:spawn_inventory("guitar_a")
        self:spawn_inventory("harmonica_a")
        self:spawn_inventory("bar_tiran_pda")
        self:spawn_inventory("bar_lucky_pda")
        self:spawn_inventory("binocular_a")
        self:spawn_inventory("cit_doctors_key")
        self:spawn_inventory("dar_pass_document")
        self:spawn_inventory("dar_pass_flash")
        self:spawn_inventory("military_stalker_outfit")
        self:spawn_inventory("military_commander_outfit")
        self:spawn_inventory("bar_document1")

end