Guest User

F9 - Skill menu infamy upgrade

a guest
Jan 24th, 2014
2,683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.32 KB | None | 0 0
  1. -- SKILL MENU SCRIPT
  2. -- MENU SETUP
  3. if not SimpleMenu then
  4.     SimpleMenu = class()
  5.  
  6.     function SimpleMenu:init(title, message, options)
  7.         self.dialog_data = { title = title, text = message, button_list = {},
  8.             id = tostring(math.random(0,0xFFFFFFFF)) }
  9.         self.visible = false
  10.         for _,opt in ipairs(options) do
  11.             local elem = {}
  12.             elem.text = opt.text
  13.             opt.data = opt.data or nil
  14.             opt.callback = opt.callback or nil
  15.             elem.callback_func = callback(self, self, "_do_callback",
  16.                 { data = opt.data,
  17.                 callback = opt.callback})
  18.             elem.cancel_button = opt.is_cancel_button or false
  19.             if opt.is_focused_button then
  20.                 self.dialog_data.focus_button = #self.dialog_data.button_list+1
  21.             end
  22.             table.insert(self.dialog_data.button_list, elem)
  23.         end
  24.         return self
  25.     end
  26.  
  27.     function SimpleMenu:_do_callback(info)
  28.         if info.callback then
  29.             if info.data then
  30.                 info.callback(info.data)
  31.             else
  32.                 info.callback()
  33.             end
  34.         end
  35.         self.visible = false
  36.     end
  37.  
  38.     function SimpleMenu:show()
  39.         if self.visible then
  40.             return
  41.         end
  42.         self.visible = true
  43.         managers.system_menu:show(self.dialog_data)
  44.     end
  45.  
  46.     function SimpleMenu:hide()
  47.         if self.visible then
  48.             managers.system_menu:close(self.dialog_data.id)
  49.             self.visible = false
  50.             return
  51.         end
  52.     end
  53. end
  54. patched_update_input = patched_update_input or function (self, t, dt )
  55.     if self._data.no_buttons then
  56.         return
  57.     end
  58.    
  59.     local dir, move_time
  60.     local move = self._controller:get_input_axis( "menu_move" )
  61.  
  62.     if( self._controller:get_input_bool( "menu_down" )) then
  63.         dir = 1
  64.     elseif( self._controller:get_input_bool( "menu_up" )) then
  65.         dir = -1
  66.     end
  67.    
  68.     if dir == nil then
  69.         if move.y > self.MOVE_AXIS_LIMIT then
  70.             dir = 1
  71.         elseif move.y < -self.MOVE_AXIS_LIMIT then
  72.             dir = -1
  73.         end
  74.     end
  75.  
  76.     if dir ~= nil then
  77.         if( ( self._move_button_dir == dir ) and self._move_button_time and ( t < self._move_button_time + self.MOVE_AXIS_DELAY ) ) then
  78.             move_time = self._move_button_time or t
  79.         else
  80.             self._panel_script:change_focus_button( dir )
  81.             move_time = t
  82.         end
  83.     end
  84.  
  85.     self._move_button_dir = dir
  86.     self._move_button_time = move_time
  87.    
  88.     local scroll = self._controller:get_input_axis( "menu_scroll" )
  89.     -- local sdir
  90.     if( scroll.y > self.MOVE_AXIS_LIMIT ) then
  91.         self._panel_script:scroll_up()
  92.         -- sdir = 1
  93.     elseif( scroll.y < -self.MOVE_AXIS_LIMIT ) then
  94.         self._panel_script:scroll_down()
  95.         -- sdir = -1
  96.     end
  97. end
  98. managers.system_menu.DIALOG_CLASS.update_input = patched_update_input
  99. managers.system_menu.GENERIC_DIALOG_CLASS.update_input = patched_update_input
  100. -- CALL MENU
  101. function openmenu(menu)
  102.     menu:show()
  103. end
  104. function inGame()
  105.   if not game_state_machine then return false end
  106.   return string.find(game_state_machine:current_state_name(), "game")
  107. end
  108. if not inGame() then
  109. -- SET SKILLPOINTS TO 1
  110. setskill1 = setskill1 or function()
  111.     managers.skilltree:_set_points(1)
  112. end
  113. -- SET SKILLPOINTS TO 3
  114. setskill3 = setskill3 or function()
  115.     managers.skilltree:_set_points(3)
  116. end
  117. -- SET SKILLPOINTS TO 8
  118. setskill8 = setskill8 or function()
  119.     managers.skilltree:_set_points(8)
  120. end
  121. -- SET SKILLPOINTS TO 50
  122. setskill50 = setskill50 or function()
  123.     managers.skilltree:_set_points(50)
  124. end
  125. -- SET SKILLPOINTS TO 120 (LEGIT MAX AT LVL100)
  126. setskill120 = setskill120 or function()
  127.     managers.skilltree:_set_points(120)
  128. end
  129. -- SET SKILLPOINTS TO 580 (MAX NEEDED FOR ALL SKILLS)
  130. setskill580 = setskill580 or function()
  131.     managers.skilltree:_set_points(580)
  132. end
  133. -- RESET SKILLPOINTS
  134. resetskill = resetskill or function()
  135.     managers.skilltree:_set_points(0)
  136. end
  137. -- SET INFAMY
  138. setinf1 = setinf1 or function()
  139.     managers.infamy:_set_points(1)
  140. end
  141. setinf2 = setinf2 or function()
  142.     managers.infamy:_set_points(2)
  143. end
  144. setinf3 = setinf3 or function()
  145.     managers.infamy:_set_points(3)
  146. end
  147. setinf4 = setinf4 or function()
  148.     managers.infamy:_set_points(4)
  149. end
  150. setinf5 = setinf5 or function()
  151.     managers.infamy:_set_points(5)
  152. end
  153. resetinfy = resetinfy or function()
  154.     managers.infamy:_set_points(0)
  155. end
  156. end
  157. -- UNLOCK MESSIAH CHARGES SKILL ((SELF-REVIVE) normalizable)
  158. unlmessiah = unlmessiah or function()
  159.     function PlayerDamage:got_messiah_charges() return true
  160.     end
  161. end
  162. callinmaster = callinmaster or function()
  163.     openmenu(mastermenu)
  164.     io.stdout:write("PLAY trainer/wav/effects/damn.wav\n")
  165. end
  166. callinmaster2 = callinmaster2 or function()
  167.     openmenu(mastermenu2)
  168.     io.stdout:write("PLAY trainer/wav/effects/damn.wav\n")
  169. end
  170. callinenforcer = callinenforcer or function()
  171.     openmenu(enforcermenu)
  172.     io.stdout:write("PLAY trainer/wav/effects/damn.wav\n")
  173. end
  174. callinenforcer = callinenforcer or function()
  175.     openmenu(enforcermenu2)
  176.     io.stdout:write("PLAY trainer/wav/effects/damn.wav\n")
  177. end
  178. callintechnician = callintechnician or function()
  179.     openmenu(technicianmenu)
  180.     io.stdout:write("PLAY trainer/wav/effects/damn.wav\n")
  181. end
  182. callintechnician2 = callintechnician2 or function()
  183.     openmenu(technicianmenu2)
  184.     io.stdout:write("PLAY trainer/wav/effects/damn.wav\n")
  185. end
  186. endcallinghost = callinghost or function()
  187.     openmenu(ghostmenu)
  188.     io.stdout:write("PLAY trainer/wav/effects/damn.wav\n")
  189. end
  190. endcallinghost2 = callinghost2 or function()
  191.     openmenu(ghostmenu2)
  192.     io.stdout:write("PLAY trainer/wav/effects/damn.wav\n")
  193. end
  194. callinroot = callinroot or function()
  195.     openmenu(skillsmenu)
  196. end
  197.  
  198. -- GHOST ACED MENU
  199. ghostoptions2 = ghostoptions2 or {
  200.     { text = "Under construction", callback = endcall },
  201.     {},
  202.     { text = "Cancel", is_cancel_button = true},
  203.     { text = "Back", callback = callinroot },
  204.     }
  205. ghostmenu2 = ghostmenu2 or SimpleMenu:new("GHOST MENU ACED", "..! = not working atm", ghostoptions2)
  206. -- GHOST BASIC MENU
  207. ghostoptions = ghostoptions or {
  208.     { text = "Under construction", callback = endcall },
  209.     {},
  210.     { text = "Cancel", is_cancel_button = true},
  211.     { text = "Back", callback = callinroot },
  212.     }
  213. ghostmenu = ghostmenu or SimpleMenu:new("GHOST MENU BASIC", "..! = not working atm", ghostoptions)
  214. -- TECHNICIAN ACED MENU
  215. technicianoptions2 = technicianoptions2 or {
  216.     { text = "Under construction", callback = endcall },
  217.     {},
  218.     { text = "Cancel", is_cancel_button = true},
  219.     { text = "Back", callback = callinroot },
  220.     }
  221. technicianmenu2 = technicianmenu2 or SimpleMenu:new("TECHNICIAN MENU BASIC", "..! = not working atm", technicianoptions2)
  222. -- TECHNICIAN BASIC MENU
  223. technicianoptions = technicianoptions or {
  224.     { text = "Under construction", callback = endcall },
  225.     {},
  226.     { text = "Cancel", is_cancel_button = true},
  227.     { text = "Back", callback = callinroot },
  228.     }
  229. technicianmenu = technicianmenu or SimpleMenu:new("TECHNICIAN MENU ACED", "..! = not working atm", technicianoptions)
  230. -- ENFORCER ACED MENU
  231. enforceroptions2 = enforceroptions2 or {
  232.     { text = "Under construction", callback = endcall },
  233.     {},
  234.     { text = "Cancel", is_cancel_button = true},
  235.     { text = "Back", callback = callinroot },
  236.     }
  237. enforcermenu2 = enforcermenu2 or SimpleMenu:new("ENFORCER MENU ACED", "..! = not working atm", enforceroptions2)
  238. -- ENFORCER BASIC MENU
  239. enforceroptions = enforceroptions or {
  240.     { text = "Under construction", callback = endcall },
  241.     {},
  242.     { text = "Cancel", is_cancel_button = true},
  243.     { text = "Back", callback = callinroot },
  244.     }
  245. enforcermenu = enforcermenu or SimpleMenu:new("ENFORCER MENU BASIC", "..! = not working atm", enforceroptions)
  246. -- MASTERMIND ACED MENU
  247. masteroptions2 = masteroptions2 or {
  248.     { text = "!Cable guy", callback = endcall },
  249.     { text = "!Combat medic", callback = endcall },
  250.     { text = "!Endurance", callback = endcall },
  251.     { text = "!Inside man", callback = endcall },
  252.     { text = "!Fast learner", callback = endcall },
  253.     { text = "!Leadership", callback = endcall },
  254.     { text = "!Smooth talker", callback = endcall },
  255.     { text = "!Equilibrium", callback = endcall },
  256.     { text = "!Dominator", callback = endcall },
  257.     { text = "!Stockholm syndrome", callback = endcall },
  258.     { text = "!Combat doctor", callback = endcall },
  259.     { text = "!Joker", callback = endcall },
  260.     { text = "!Black marketeer", callback = endcall },
  261.     { text = "!Gunslinger", callback = endcall },
  262.     { text = "!Kilmer", callback = endcall },
  263.     { text = "!Control Freak", callback = endcall },
  264.     { text = "!Pistol messiah", callback = unlmessiah },
  265.     { text = "!Inspire", callback = endcall },
  266.     {},
  267.     { text = "Cancel", is_cancel_button = true},
  268.     { text = "Back", callback = callinroot },
  269.     }
  270. mastermenu2 = mastermenu2 or SimpleMenu:new("MASTERMIND MENU ACED", "..! = not working atm", masteroptions2)
  271. --MASTERMIND BASIC MENU
  272. masteroptions = masteroptions or {
  273.     { text = "!Unlock messiah charges", callback = mssiahmenu },
  274.     { text = "!Cable guy", callback = enforcermenu },
  275.     { text = "!Combat medic", callback = ghostmenu },
  276.     { text = "!Endurance", callback = endcall },
  277.     { text = "!Inside man", callback = endcall },
  278.     { text = "!Fast learner", callback = endcall },
  279.     { text = "!Leadership", callback = endcall },
  280.     { text = "!Smooth talker", callback = endcall },
  281.     { text = "!Equilibrium", callback = endcall },
  282.     { text = "!Dominator", callback = endcall },
  283.     { text = "!Stockholm syndrome", callback = endcall },
  284.     { text = "!Combat doctor", callback = endcall },
  285.     { text = "!Joker", callback = endcall },
  286.     { text = "!Black marketeer", callback = endcall },
  287.     { text = "!Gunslinger", callback = endcall },
  288.     { text = "!Kilmer", callback = endcall },
  289.     { text = "!Control Freak", callback = endcall },
  290.     { text = "Pistol messiah", callback = endcall },
  291.     { text = "!Inspire", callback = endcall },
  292.     {},
  293.     { text = "Exit", is_cancel_button = true},
  294.     { text = "Back", callback = callinroot },
  295.     }
  296. mastermenu = mastermenu or SimpleMenu:new("MASTERMIND MENU BASIC", "..! = not working atm", masteroptions)
  297. if inGame() then
  298.     skilloptions = skilloptions or {
  299.     { text = "Exit", is_cancel_button = true},
  300.     {},
  301.     { text = "Under construction", callback = endcall },
  302.     }
  303.     io.stdout:write("PLAY trainer/wav/effects/damn.wav\n")
  304.     else
  305.     skilloptions = skilloptions or {
  306.     { text = "Exit", is_cancel_button = true},
  307.     -- {},
  308.     -- { text = "Mastermind basic skills", callback = callinmaster },
  309.     -- { text = "Mastermind aced skills", callback = callinmaster2 },
  310.     -- { text = "Enforcer basic skills", callback = callinenforcer },
  311.     -- { text = "Enforcer aced skills", callback = callinenforcer2 },
  312.     -- { text = "Technician basic skills", callback = callintechnician },
  313.     -- { text = "Technician aced skills", callback = callintechnician2 },
  314.     -- { text = "Ghost basic skills", callback = callinghost },
  315.     -- { text = "Ghost aced skills", callback = callinghost2 },
  316.     {},
  317.     { text = "Reset infamy point(s)", callback = resetinfy },
  318.     {},
  319.     { text = "Add 5 infamy points", callback = setinf5 },
  320.     { text = "Add 4 infamy points", callback = setinf4 },
  321.     { text = "Add 3 infamy points", callback = setinf3 },
  322.     { text = "Add 2 infamy points", callback = setinf2 },
  323.     { text = "Add 1 infamy point", callback = setinf1 },
  324.     {},
  325.     { text = "Reset skillpoint(s)", callback = resetskill },
  326.     {},
  327.     { text = "Add 580 skillpoints (all skills)", callback = setskill580 },
  328.     { text = "Add 120 skillpoints (legit max)", callback = setskill120 },
  329.     { text = "Add 50 skillpoints", callback = setskill50 },
  330.     { text = "Add 8 skillpoints", callback = setskill8 },
  331.     { text = "Add 3 skillpoints", callback = setskill3 },
  332.     { text = "Add 1 skillpoint", callback = setskill1 },
  333.     }
  334. end
  335. -- ROOT MENU HEADER
  336. if not skillsmenu then
  337.     skillsmenu = skillsmenu or SimpleMenu:new("SKILL MENU", "..what skills do you have?", skilloptions)
  338. end
  339. skillsmenu:show()
Advertisement
Add Comment
Please, Sign In to add comment