Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Checks
- -- SIMPLE MENU
- if not SimpleMenu then
- SimpleMenu = class()
- function SimpleMenu:init(title, message, options)
- self.dialog_data = { title = title, text = message, button_list = {},
- id = tostring(math.random(0,0xFFFFFFFF)) }
- self.visible = false
- for _,opt in ipairs(options) do
- local elem = {}
- elem.text = opt.text
- opt.data = opt.data or nil
- opt.callback = opt.callback or nil
- elem.callback_func = callback(self, self, "_do_callback",
- { data = opt.data,
- callback = opt.callback})
- elem.cancel_button = opt.is_cancel_button or false
- if opt.is_focused_button then
- self.dialog_data.focus_button = #self.dialog_data.button_list+1
- end
- table.insert(self.dialog_data.button_list, elem)
- end
- return self
- end
- function SimpleMenu:_do_callback(info)
- if info.callback then
- if info.data then
- info.callback(info.data)
- else
- info.callback()
- end
- end
- self.visible = false
- end
- function SimpleMenu:show()
- if self.visible then
- return
- end
- self.visible = true
- managers.system_menu:show(self.dialog_data)
- end
- function SimpleMenu:hide()
- if self.visible then
- managers.system_menu:close(self.dialog_data.id)
- self.visible = false
- return
- end
- end
- end
- patched_update_input = patched_update_input or function (self, t, dt )
- if self._data.no_buttons then
- return
- end
- local dir, move_time
- local move = self._controller:get_input_axis( "menu_move" )
- if( self._controller:get_input_bool( "menu_down" )) then
- dir = 1
- elseif( self._controller:get_input_bool( "menu_up" )) then
- dir = -1
- end
- if dir == nil then
- if move.y > self.MOVE_AXIS_LIMIT then
- dir = 1
- elseif move.y < -self.MOVE_AXIS_LIMIT then
- dir = -1
- end
- end
- if dir ~= nil then
- if( ( self._move_button_dir == dir ) and self._move_button_time and ( t < self._move_button_time + self.MOVE_AXIS_DELAY ) ) then
- move_time = self._move_button_time or t
- else
- self._panel_script:change_focus_button( dir )
- move_time = t
- end
- end
- self._move_button_dir = dir
- self._move_button_time = move_time
- local scroll = self._controller:get_input_axis( "menu_scroll" )
- -- local sdir
- if( scroll.y > self.MOVE_AXIS_LIMIT ) then
- self._panel_script:scroll_up()
- -- sdir = 1
- elseif( scroll.y < -self.MOVE_AXIS_LIMIT ) then
- self._panel_script:scroll_down()
- -- sdir = -1
- end
- end
- managers.system_menu.DIALOG_CLASS.update_input = patched_update_input
- managers.system_menu.GENERIC_DIALOG_CLASS.update_input = patched_update_input
- -- FUNCTIONS ----------------------------------------------------------------------------------------------------------
- -- IS PLAYING CHECK
- function isPlaying()
- if not BaseNetworkHandler then return false end
- return BaseNetworkHandler._gamestate_filter.any_ingame_playing[ game_state_machine:last_queued_state_name() ]
- end
- -- INGAME CHECK
- function inGame()
- if not game_state_machine then return false end
- return string.find(game_state_machine:current_state_name(), "game")
- end
- -- SHOW MENU FUNCTION
- show_menu = show_menu or function(menu)
- menu:show()
- end
- -- BACK FUNCTION
- root_menu = root_menu or function()
- rootmenu:show()
- end
- -- INGAME FUNCTIONS ------
- -- SPAWN RANDOM GAGE PACKAGE
- SpawnGagePackage = SpawnGagePackage or function(id) --Don't pass any argument for random package
- if isHost() then
- function tweak_data.gage_assignment:get_num_assignment_units() --Patches limit on spawning units. World:spawn_unit somehow obey this value.
- return 9999
- end
- local id_table = {
- Idstring("units/pd2_dlc_gage_jobs/pickups/gen_pku_gage_green/gen_pku_gage_green"),
- Idstring("units/pd2_dlc_gage_jobs/pickups/gen_pku_gage_yellow/gen_pku_gage_yellow"),
- Idstring("units/pd2_dlc_gage_jobs/pickups/gen_pku_gage_red/gen_pku_gage_red"),
- Idstring("units/pd2_dlc_gage_jobs/pickups/gen_pku_gage_blue/gen_pku_gage_blue"),
- Idstring("units/pd2_dlc_gage_jobs/pickups/gen_pku_gage_purple/gen_pku_gage_purple"),
- }
- local pos = get_crosshair_pos()
- local rot = Rotation(managers.player:local_player():movement():m_head_rot():yaw(),0,0)
- if not pos or not rot then
- return
- end
- World:spawn_unit(id_table[id or math.random(1,5)], pos, rot )
- else
- show_mid_text("...dummy :\)", "This is a host only", 1.0 )
- end
- end
- --SPAWN BAG
- function ServerSpawnBag(name, zipline_unit)
- if not alive (managers.player:player_unit()) then return end
- local camera_ext = managers.player:player_unit():camera()
- local carry_data = tweak_data.carry[ name ]
- local dye_initiated = carry_data.dye_initiated
- local has_dye_pack = carry_data.has_dye_pack
- local dye_value_multiplier = carry_data.dye_value_multiplier
- if Network:is_client() then
- managers.network:session():send_to_host("server_drop_carry", name, carry_data.multiplier, carry_data.dye_initiated, carry_data.has_dye_pack, carry_data.dye_value_multiplier, camera_ext:position(), camera_ext:rotation(), camera_ext:forward(), Vector3(0, 0, 0), zipline_unit)
- else
- managers.player:server_drop_carry(name, carry_data.multiplier, carry_data.dye_initiated, carry_data.has_dye_pack, carry_data.dye_value_multiplier, camera_ext:position(), camera_ext:rotation(), camera_ext:forward(), Vector3(0, 0, 0), zipline_unit, managers.network:session():local_peer():id())
- end
- end
- --GIVE SELF BAG
- function GiveBag(name, zipline_unit)
- if not alive (managers.player:player_unit()) then return end
- local carry_data = tweak_data.carry[ name ]
- local dye_initiated = carry_data.dye_initiated
- local has_dye_pack = carry_data.has_dye_pack
- local dye_value_multiplier = carry_data.dye_value_multiplier
- if Network:is_client() then
- managers.network:session():send_to_host("set_carry", name, carry_data.multiplier, carry_data.dye_initiated, carry_data.has_dye_pack, carry_data.dye_value_multiplier, zipline_unit)
- else
- managers.player:set_carry(name, carry_data.multiplier, carry_data.dye_initiated, carry_data.has_dye_pack, carry_data.dye_value_multiplier, zipline_unit, managers.network:session():local_peer():id())
- end
- end
- -- SET SPAWN
- setspawn0 = function()
- _spawn_type = 0
- end
- setspawn1 = function(menu)
- _spawn_type = 1
- menu:show()
- end
- setspawn2 = function(menu)
- _spawn_type = 2
- menu:show()
- end
- setspawn3 = function(menu)
- _spawn_type = 3
- menu:show()
- end
- setspawn4 = function()
- _spawn_type = 4
- end
- setspawn = function(item)
- _spawn_item = item
- end
- chemset = function()
- managers.player:add_special( { name = "hydrogen_chloride", silent = true, amount = 1 } )
- managers.player:add_special( { name = "caustic_soda", silent = true, amount = 1 } )
- managers.player:add_special( { name = "acid", silent = true, amount = 1 } )
- end
- -- OUTGAME FUNCTIONS ------
- -- GIVE ITEMS
- function giveitems( argumentTable )
- local itype = argumentTable["type"]
- local times = argumentTable["times"]
- local types = {"weapon_mods", "masks", "materials", "textures", "colors"}
- local skip = { masks = {"character_locked"}, materials = {"plastic"}, colors = {"nothing"}, textures = {"no_color_full_material","no_color_no_material"} }
- if not times then times = 1 end
- if type(itype) == "table" then types = itype end
- if itype == "all" or type(itype) == "table" then
- for i = 1, #types do giveitems({ ["type"] = types[i], ["times"] = times }) end
- return
- end
- for i=1, times do
- for mat_id,_ in pairs(tweak_data.blackmarket[itype]) do
- if not in_table(skip[itype], mat_id) then
- local global_value = "normal"
- if _.global_value then
- global_value = _.global_value
- elseif _.infamous then
- global_value = "infamous"
- elseif _.dlcs or _.dlc then
- local dlcs = _.dlcs or {}
- if _.dlc then table.insert( dlcs, _.dlc ) end
- global_value = dlcs[ math.random( #dlcs ) ]
- end
- if _.unlocked == false then _.unlocked = true end
- managers.blackmarket:add_to_inventory(global_value, itype, mat_id, false)
- end
- end
- end
- end
- -- CLEAR ITEMS
- function clearitems( argumentTable )
- local itype = argumentTable["type"]
- local globalval = argumentTable["globalval"]
- local types = {"weapon_mods", "masks", "materials", "textures", "colors"}
- if not globalval then globalval = "all" end
- if type(itype) == "table" then types = itype end
- if itype == "all" or type(itype) == "table" then
- --for i = 1, #types do clearitems(types[i], globalval) end return
- for i = 1, #types do clearitems({ ["type"] = types[i], ["globalval"] = globalval }) end
- end
- for global_value, categories in pairs( Global.blackmarket_manager.inventory ) do
- if (globalval == "all" or globalval == global_value) and categories[itype] then
- for id,amount in pairs( categories[itype] ) do
- -- Global.blackmarket_manager.inventory[global_value][itype][id] = 0
- Global.blackmarket_manager.inventory[global_value][itype][id] = nil
- end
- end
- end
- end
- -- UNLOCK ITEMS
- function unlockitems( itype )
- local types = {"weapon_mods", "masks", "materials", "textures", "colors", "weapons"}
- if type(itype) == "table" then types = itype end
- if itype == "all" or type(itype) == "table" then
- --for i = 1, #types do unlockitems(types[i]) end
- for i = 1, #types do unlockitems({ ["type"] = types[i] }) end
- return
- end
- if itype == "weapons" then
- for wep_id,_ in pairs(tweak_data.upgrades.definitions) do
- if _.category == "weapon" and not string.find(wep_id, "_primary") and not string.find(wep_id, "_secondary") then
- if not managers.upgrades:aquired(wep_id) then managers.upgrades:aquire(wep_id) end
- end
- end
- else
- for mat_id,_ in pairs(tweak_data.blackmarket[itype]) do
- if _.unlocked == false then _.unlocked = true end
- end
- end
- end
- -- UNLOCK MASK SLOTS
- unlockmaskslots = unlockmaskslots or function()
- for i = 1, 300 do Global.blackmarket_manager.unlocked_mask_slots[i] = true
- end
- end
- -- UNLOCK PRIMARY WEAPON SLOTS
- unlockprimslot = unlockprimslot or function()
- for i = 1, 300 do
- Global.blackmarket_manager.unlocked_weapon_slots.primaries[i] = true
- end
- end
- -- UNLOCK SECONDARY WEAPON SLOTS
- unlocksecslot = unlocksecslot or function()
- for i = 1, 300 do
- Global.blackmarket_manager.unlocked_weapon_slots.secondaries[i] = true
- end
- end
- -- UNLOCK ALL WEAPON SLOTS
- unlockweaponslot = unlockweaponslot or function()
- for i = 1, 300 do
- Global.blackmarket_manager.unlocked_weapon_slots.primaries[i] = true
- Global.blackmarket_manager.unlocked_weapon_slots.secondaries[i] = true
- end
- end
- -- UNLOCK ALL
- unlockallstuff = unlockallstuff or function()
- unlockweaponslot() -- ALL WEAPONS SLOTS UNLOCKED (36)
- unlockmaskslots() -- ALL MASK SLOTS UNLOCKED (36)
- unlockitems("weapons") -- ALL WEAPONS UNLOCKED
- end
- -- CLEAR "!"
- remexclmark = remexclmark or function()
- Global.blackmarket_manager.new_drops = {}
- end
- -- MENUS ---------------------------------------------------------------------------------------------------------------
- -- OUTGAME MENUS ------
- -- ADD ITEMS
- items = {
- { text = "Add 1 of all weapon mods", callback = giveitems, data = { ["type"] = "weapon_mods", ["times"] = nil}},
- { text = "Add 5 of all weapon mods", callback = giveitems, data = { ["type"] = "weapon_mods", ["times"] = 5}},
- {},
- { text = "Add 1 of all materials", callback = giveitems, data = { ["type"] = "materials", ["times"] = nil}},
- { text = "Add 5 of all materials", callback = giveitems, data = { ["type"] = "materials", ["times"] = 5}},
- {},
- { text = "Add 1 of all patterns", callback = giveitems, data = { ["type"] = "textures", ["times"] = nil}},
- { text = "Add 5 of all patterns", callback = giveitems, data = { ["type"] = "textures", ["times"] = 5}},
- {},
- { text = "Add 1 of all colors", callback = giveitems, data = { ["type"] = "colors", ["times"] = nil}},
- { text = "Add 5 of all colors", callback = giveitems, data = { ["type"] = "colors", ["times"] = 5}},
- {},
- { text = "Add 1 of all masks", callback = giveitems, data = { ["type"] = "masks", ["times"] = nil}},
- { text = "Add 5 of all masks", callback = giveitems, data = { ["type"] = "masks", ["times"] = 5}},
- {},
- { text = "Add 1 of everything", callback = giveitems, data = { ["type"] = "all", ["times"] = nil}},
- { text = "Add 5 of everything", callback = giveitems, data = { ["type"] = "all", ["times"] = 5}},
- {},
- { text = "Back", callback = root_menu },
- { text = "Exit", is_cancel_button = true},
- }
- invitems = SimpleMenu:new("INVENTORY TOOLS: ADD ITEMS", "PICK A CARD!",items)
- -- REMOVE ITEMS
- remove = {
- { text = "--!! CLEAR INVENTORY !!--", callback = clearitems, data = { ["type"] = "all", ["globalval"] = "all"}},
- {},
- { text = "Remove all weapon mods", callback = clearitems, data = { ["type"] = "weapon_mods", ["globalval"] = "all"}},
- { text = "Remove all materials", callback = clearitems, data = { ["type"] = "materials", ["globalval"] = "all"}},
- { text = "Remove all patterns", callback = clearitems, data = { ["type"] = "textures", ["globalval"] = "all"}},
- { text = "Remove all colors", callback = clearitems, data = { ["type"] = "colors", ["globalval"] = "all"}},
- { text = "Remove all masks", callback = clearitems, data = { ["type"] = "masks", ["globalval"] = "all"}},
- {},
- { text = "Back", callback = root_menu },
- { text = "Exit", is_cancel_button = true},
- }
- invremove = SimpleMenu:new("INVENTORY TOOLS: REMOVE ITEMS", "DUMPSTERS: NOT JUST FOR BODIES!",remove)
- -- UNLOCK ITEMS
- unlock = {
- { text = "Unlock everything", callback = unlockallstuff },
- {},
- { text = "Unlock all primary weapon slots", callback = unlockprimslot },
- { text = "Unlock all secondary weapon slots", callback = unlocksecslot },
- { text = "Unlock all weapon slots", callback = unlockweaponslot },
- { text = "Unlock all mask slots", callback = unlockmaskslots },
- { text = "Unlock all weapons", callback = unlockitems, data = "weapons" },
- {},
- { text = "Back", callback = root_menu },
- { text = "Exit", is_cancel_button = true},
- }
- invunlock = SimpleMenu:new("INVENTORY TOOLS: UNLOCK STUFF", "YOU EARNED IT!",unlock)
- -- INGAME MENUS ------
- -- SELF ITEM MENU
- getitem = {
- { text = "Get a keycard", callback = setspawn, data = "bank_manager_key" },
- { text = "Get a key", callback = setspawn, data = "chavez_key" },
- { text = "Get a crowbar", callback = setspawn, data = "crowbar" },
- {},
- { text = "Get a plank", callback = setspawn, data = "planks" },
- { text = "Get a thermal paste", callback = setspawn, data = "thermite_paste" },
- { text = "Get a thermite", callback = setspawn, data = "thermite" },
- { text = "Get a gas can", callback = setspawn, data = "gas" },
- {},
- { text = "Get a Rats chem set", callback = chemset },
- { text = "Get a hydrogen chloride", callback = setspawn, data = "hydrogen_chloride" },
- { text = "Get a caustic soda", callback = setspawn, data = "caustic_soda" },
- { text = "Get a muriatic acid", callback = setspawn, data = "acid" },
- {},
- { text = "Exit", is_cancel_button = true, callback = setspawn0 },
- }
- selfitemmenu = SimpleMenu:new("GET AN ITEM MENU", "IT'S JUST WHAT I NEEDED!", getitem)
- -- BAG MENU
- baglist = {
- { text = "Get a thermal drill", callback = setspawn, data = "lance_bag" },
- {},
- { text = "Get a turret weapon part", callback = setspawn, data = "turret" },
- { text = "Get a turret shell bag", callback = setspawn, data = "ammo" },
- { text = "Get a gold bag", callback = setspawn, data = "gold" },
- { text = "Get a money bag", callback = setspawn, data = "money" },
- { text = "Get a weapon bag", callback = setspawn, data = "weapon" },
- { text = "Get a coke bag", callback = setspawn, data = "coke" },
- { text = "Get a meth bag", callback = setspawn, data = "meth" },
- { text = "Get a jewelry bag", callback = setspawn, data = "diamonds" },
- { text = "Get a painting", callback = setspawn, data = "painting" },
- { text = "Get a server", callback = setspawn, data = "circuit" },
- { text = "Get an artifact", callback = setspawn, data = "artifact_statue" },
- { text = "Get a samurai suit", callback = setspawn, data = "samurai_suit" },
- {},
- { text = "Exit", is_cancel_button = true, callback = setspawn0 },
- }
- getbagmenu = SimpleMenu:new("GET A BAG MENU", "THIS IS MINE!", baglist)
- spawnbagmenu = SimpleMenu:new("SPAWN A BAG MENU", "IT WAS PROBABLY THERE THE WHOLE TIME.", baglist)
- --ROOT MENU OUTGAME --
- rootinv = {
- {},
- { text = "--!! Remove new item exclamation mark !!--", callback = remexclmark },
- {},
- { text = "Add inventory items", callback = show_menu, data = invitems },
- { text = "Remove inventory items", callback = show_menu, data = invremove },
- { text = "Unlock inventory items", callback = show_menu, data = invunlock },
- {},
- { text = "Exit", is_cancel_button = true},
- }
- rootmenu = SimpleMenu:new("INVENTORY TOOLS", "THE RIGHT TOOL FOR THE JOB.", rootinv)
- --ROOT MENU INGAME --
- rootinvg = {
- {},
- { text = "Get an item", callback = setspawn1, data = selfitemmenu },
- { text = "Get a bag", callback = setspawn2, data = getbagmenu },
- { text = "Spawn a bag", callback = setspawn3, data = spawnbagmenu },
- { text = "Spawn a Gage Package", callback = setspawn4 },
- {},
- { text = "Exit", is_cancel_button = true, callback = setspawn0 },
- }
- rootmenug = SimpleMenu:new("INVENTORY TOOLS", "MAKE YOUR CHOICE! PRESS INSERT TO GET IT!", rootinvg)
- -- InGame/isPlaying Check for Menu
- if not inGame() and not isPlaying() then
- rootmenu:show()
- else
- rootmenug:show()
- if not _invrunning then
- _spawn_type = 0
- _spawn_item = 0
- _invrunning = true end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement