csmit195

LobbyFucker-Aimware

Jun 6th, 2020
2,206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.36 KB | None | 0 0
  1. local errorMessagePrefix = "#SFUI_QMM_ERROR_"
  2.  
  3. local Lobby = {
  4.     DefaultChatMessage = "im jackin off",
  5.     TrustFactorData = {
  6.         [0] = "-",
  7.         [1] = "-",
  8.         [2] = "-",
  9.         [3] = "-",
  10.         [4] = "-"
  11.     },
  12.     BadTypes = {
  13.         "Ear Rape [1]",
  14.         "Ear Rape [2]",
  15.         "Mass Popup"
  16.     },
  17.     MessageTypes = {
  18.         "Chat",
  19.         "Error",
  20.         "Invite",
  21.         "Start/Stop Queue",
  22.         "Popup Window",
  23.         "Ear Rape [1]",
  24.         "Ear Rape [2]",
  25.         "Mass Popup"
  26.     },
  27.     MessageColours = {
  28.         "Red",
  29.         "Green",
  30.         "Yellow"
  31.     },
  32.     AutoStopMessages = {
  33.         "X_VacBanned",
  34.         "X_PenaltySeconds",
  35.         "X_InsecureBlocked",
  36.         "SkillGroupLargeDelta"
  37.     },
  38.     ErrorMessages = {
  39.         "1_FailPingServer",
  40.         "1_FailReadyUp",
  41.         "1_FailReadyUp_Title",
  42.         "1_FailVerifyClan",
  43.         "1_FailVerifyClan_Title",
  44.         "1_InsufficientLevel",
  45.         "1_InsufficientLevel02",
  46.         "1_InsufficientLevel03",
  47.         "1_InsufficientLevel04",
  48.         "1_InsufficientLevel05",
  49.         "1_NotLoggedIn",
  50.         "1_NotVacVerified",
  51.         "1_OngoingMatch",
  52.         "1_PenaltySeconds",
  53.         "1_PenaltySecondsGreen",
  54.         "1_VacBanned",
  55.         "1_VacBanned_Title",
  56.         "ClientBetaVersionMismatch",
  57.         "ClientUpdateRequired",
  58.         "FailedToPingServers",
  59.         "FailedToReadyUp",
  60.         "FailedToSetupSearchData",
  61.         "FailedToVerifyClan",
  62.         "InvalidGameMode",
  63.         "NoOngoingMatch",
  64.         "NotLoggedIn",
  65.         "NotVacVerified",
  66.         "OperationPassInvalid",
  67.         "OperationQuestIdInactive",
  68.         "PartyRequired1",
  69.         "PartyRequired2",
  70.         "PartyRequired3",
  71.         "PartyRequired4",
  72.         "PartyRequired5",
  73.         "PartyTooLarge",
  74.         "SkillGroupLargeDelta",
  75.         "SkillGroupMissing",
  76.         "TournamentMatchInvalidEvent",
  77.         "TournamentMatchNoEvent",
  78.         "TournamentMatchRequired",
  79.         "TournamentMatchSetupNoTeam",
  80.         "TournamentMatchSetupSameTeam",
  81.         "TournamentMatchSetupYourTeam",
  82.         "TournamentTeamAccounts",
  83.         "TournamentTeamSize",
  84.         "UnavailMapSelect",
  85.         "VacBanned",
  86.         "X_AccountWarningNonPrime",
  87.         "X_AccountWarningTrustMajor",
  88.         "X_AccountWarningTrustMajor_Summary",
  89.         "X_AccountWarningTrustMinor",
  90.         "X_FailPingServer",
  91.         "X_FailReadyUp",
  92.         "X_FailVerifyClan",
  93.         "X_InsecureBlocked",
  94.         "X_InsufficientLevel",
  95.         "X_InsufficientLevel02",
  96.         "X_InsufficientLevel03",
  97.         "X_InsufficientLevel04",
  98.         "X_InsufficientLevel05",
  99.         "X_NotLoggedIn",
  100.         "X_NotVacVerified",
  101.         "X_OngoingMatch",
  102.         "X_PenaltySeconds",
  103.         "X_PenaltySecondsGreen",
  104.         "X_PerfectWorldDenied",
  105.         "X_PerfectWorldRequired",
  106.         "X_VacBanned"
  107.     }
  108. }
  109.  
  110. panorama.RunScript([[
  111.     function call_x_times(times, callback) {
  112.         for (var i = 1; i <= times; i++){
  113.             callback();
  114.         }
  115.     }
  116.  
  117.     if (!LobbyAPI.IsSessionActive()) {
  118.         LobbyAPI.CreateSession();
  119.     }
  120.  
  121.     function stopCustomEvents() {
  122.         if (waitForSearchingEventHandler) {
  123.             $.UnregisterForUnhandledEvent( 'PanoramaComponent_Lobby_MatchmakingSessionUpdate', waitForSearchingEventHandler);
  124.         }
  125.     }
  126. ]])
  127.  
  128. local MainRef = gui.Reference("Misc")
  129. local LFTab = gui.Tab(MainRef, "LF.tab", "LobbyFucker")
  130. local LFGroupbox1 = gui.Groupbox(LFTab, "Queue Manipulation", 16, 16, 296)
  131. local LFGroupbox2 = gui.Groupbox(LFTab, "Lobby Chat", 328, 16, 296)
  132.  
  133. local targetSlider = gui.Slider(LFGroupbox1, "LF.targetSlider", "Select Target", 1, 1, 5)
  134.  
  135. local trustMessageOnSearch = gui.Checkbox(LFGroupbox1, "LF.trustMessageOnSearch", "Trust Message on Search", false);
  136. local trustNotification = gui.Combobox(LFGroupbox1, "LF.trustNotification", "Trust Message", "-", "Yellow", "Red")
  137.  
  138. local autoStopQueue = gui.Checkbox(LFGroupbox1, "LF.autoStopQueue", "Auto Stop Queue", false)
  139. local autoStopQueueSilent = gui.Checkbox(LFGroupbox1, "LF.autoStopQueueSilent", "Silent", false)
  140. local autoStopQueueMessage = gui.Combobox(LFGroupbox1, "LF.autoStopQueueMessage", "Queue Error", unpack(Lobby.AutoStopMessages))
  141.  
  142. local loopMessages = gui.Checkbox(LFGroupbox2, "LF.loopMessages", "Loop Messages", false)
  143. local loopMsgDelay = gui.Slider(LFGroupbox2, "LF.loopMsgDelay", "Spam Delay", 250, 1, 1000)
  144. local loopMsgAmt = gui.Slider(LFGroupbox2, "LF.loopMsgAmt", "Spam Per Loop", 1, 1, 200)
  145.  
  146. local messageType = gui.Combobox(LFGroupbox2, "LF.messageType", "Message Type", unpack(Lobby.MessageTypes))
  147. local errorList = gui.Listbox(LFGroupbox2, "LF.errorList", 200, unpack(Lobby.ErrorMessages))
  148. local messageText = gui.Editbox(LFGroupbox2, "LF.messageText", "Message Text")
  149. local messageColour = gui.Combobox(LFGroupbox2, "LF.messageColour", "Message Colour", unpack(Lobby.MessageColours))
  150.  
  151. local randomError = gui.Checkbox(LFGroupbox2, "LF.randomError", "Random Error Message", false)
  152.  
  153. -- jank but blow me :^)
  154. local function trustFactorArrayToString()
  155.     local str = "["
  156.     for _, v in pairs(Lobby.TrustFactorData) do
  157.         str = str .. "'" .. v .. "',"
  158.     end
  159.     return str .. "];"
  160. end
  161.  
  162. -- ik this is horrible practise but I can't think of any other way to do it
  163. local function buildJSFuncs()
  164.     panorama.RunScript([[
  165.         stopCustomEvents();
  166.  
  167.         var doSearchMessages = function(msg) {
  168.             if (LobbyAPI.GetMatchmakingStatusString() == "#SFUI_QMM_State_find_searching") {
  169.                 if (]] .. tostring(trustMessageOnSearch:GetValue()) .. [[ == true) {
  170.                     let trustFactorData = ]] .. trustFactorArrayToString() .. [[
  171.                     let sendTrustMsg = false;
  172.                     $.Msg("Searching called for trust msg")
  173.        
  174.                     for (let i = 0; i < trustFactorData.length; i++) {
  175.                         let trustOption = trustFactorData[i];
  176.        
  177.                         if (trustOption != "-") {
  178.                             let userXUID = PartyListAPI.GetXuidByIndex(i);
  179.                            
  180.                             if (trustOption == "Red") {sendTrustMsg = true;}
  181.            
  182.                             let msgType = (trustOption == "Red") ? "ChatReportError" : "ChatReportYellow";
  183.                             let msgCol = (trustOption == "Red") ? "error" : "yellow";
  184.                             let trustMessage = (trustOption == "Red") ? "X_AccountWarningTrustMajor" : "X_AccountWarningTrustMinor";
  185.            
  186.                             PartyListAPI.SessionCommand(`Game::${msgType}`, `run all xuid ${userXUID} ${msgCol} ]] .. errorMessagePrefix .. [[${trustMessage}`);
  187.                         }
  188.                     }
  189.            
  190.                     if (sendTrustMsg) {
  191.                         PartyListAPI.SessionCommand('Game::ChatReportError', `run all xuid ${MyPersonaAPI.GetXuid()} error ]] .. errorMessagePrefix .. [[X_AccountWarningTrustMajor_Summary `);
  192.                     }
  193.                 }
  194.  
  195.                 if (]] .. tostring(autoStopQueue:GetValue()) .. [[ == true) {
  196.                     let target = (LobbyAPI.BIsHost()) ? PartyListAPI.GetXuidByIndex(]] .. (targetSlider:GetValue() - 1) .. [[) : MyPersonaAPI.GetXuid();
  197.  
  198.                     if (]] .. tostring(autoStopQueueSilent:GetValue()) .. [[ == false) {
  199.                         PartyListAPI.SessionCommand('Game::ChatReportError', `run all xuid ${target} error ]] .. errorMessagePrefix .. Lobby.AutoStopMessages[autoStopQueueMessage:GetValue()+1] .. [[`);
  200.                     }
  201.  
  202.                     LobbyAPI.StopMatchmaking();
  203.                 }
  204.             }
  205.         }
  206.  
  207.         var waitForSearchingEventHandler = $.RegisterForUnhandledEvent( 'PanoramaComponent_Lobby_MatchmakingSessionUpdate', doSearchMessages);
  208.     ]])
  209. end
  210.  
  211. errorList:SetInvisible(true)
  212. messageColour:SetInvisible(true)
  213. randomError:SetInvisible(true)
  214.  
  215. loopMsgAmt:SetInvisible(true)
  216. loopMsgDelay:SetInvisible(true)
  217. trustNotification:SetInvisible(true)
  218.  
  219. messageText:SetValue(Lobby.DefaultChatMessage)
  220.  
  221. autoStopQueueSilent:SetValue(true)
  222. autoStopQueueSilent:SetInvisible(true)
  223. autoStopQueueMessage:SetInvisible(true)
  224.  
  225. local originalValue = {}
  226. originalValue[autoStopQueueMessage] = autoStopQueueMessage:GetValue()
  227. originalValue[autoStopQueueSilent] = autoStopQueueSilent:GetValue()
  228. originalValue[autoStopQueue] = autoStopQueue:GetValue()
  229. originalValue[targetSlider] = targetSlider:GetValue()
  230. originalValue[trustMessageOnSearch] = trustMessageOnSearch:GetValue()
  231. originalValue[trustNotification] = trustNotification:GetValue()
  232. originalValue[loopMessages] = loopMessages:GetValue()
  233. originalValue[randomError] = randomError:GetValue()
  234. originalValue[messageType] = messageType:GetValue()
  235. callbacks.Register("Draw", "LF.Draw", function()
  236.     if ( autoStopQueueMessage:GetValue() ~= ( originalValue[autoStopQueueMessage] == nil and '' or originalValue[autoStopQueueMessage] ) ) then
  237.         buildJSFuncs()
  238.         originalValue[autoStopQueueMessage] = autoStopQueueMessage:GetValue()
  239.     end
  240.    
  241.     if ( autoStopQueueSilent:GetValue() ~= ( (originalValue[autoStopQueueSilent] == nil and '' or originalValue[autoStopQueueSilent]) ) ) then -- True to false
  242.         autoStopQueueMessage:SetInvisible(autoStopQueueSilent:GetValue()) -- false (Visible)
  243.         buildJSFuncs()
  244.         originalValue[autoStopQueueSilent] = autoStopQueueSilent:GetValue()
  245.     end
  246.    
  247.     if ( autoStopQueue:GetValue() ~= ( originalValue[autoStopQueue] == nil and '' or originalValue[autoStopQueue] ) ) then
  248.         autoStopQueueSilent:SetInvisible(not autoStopQueue:GetValue())
  249.         autoStopQueueMessage:SetInvisible(not (autoStopQueue:GetValue() and not autoStopQueueSilent:GetValue()))
  250.         buildJSFuncs()
  251.         originalValue[autoStopQueue] = autoStopQueue:GetValue()
  252.     end
  253.    
  254.     if ( targetSlider:GetValue() ~= ( originalValue[targetSlider] == nil and '' or originalValue[targetSlider] ) ) then
  255.         trustNotification:SetValue(Lobby.TrustFactorData[targetSlider:GetValue() - 1])
  256.         buildJSFuncs()
  257.         originalValue[targetSlider] = targetSlider:GetValue()
  258.     end
  259.    
  260.     if ( trustMessageOnSearch:GetValue() ~= ( originalValue[trustMessageOnSearch] == nil and '' or originalValue[trustMessageOnSearch] ) ) then
  261.         trustNotification:SetInvisible(not trustMessageOnSearch:GetValue())
  262.        
  263.         buildJSFuncs()
  264.         originalValue[trustMessageOnSearch] = trustMessageOnSearch:GetValue()
  265.     end
  266.    
  267.     if ( trustNotification:GetValue() ~= ( originalValue[trustNotification] == nil and '' or originalValue[trustNotification] ) ) then
  268.         if (Lobby.TrustFactorData[targetSlider:GetValue() - 1] ~= trustNotification:GetValue()) then
  269.             Lobby.TrustFactorData[targetSlider:GetValue() - 1] = trustNotification:GetValue()
  270.             buildJSFuncs()
  271.         end
  272.        
  273.         originalValue[trustNotification] = trustNotification:GetValue()
  274.     end
  275.    
  276.     if ( loopMessages:GetValue() ~= ( originalValue[loopMessages] == nil and '' or originalValue[loopMessages] ) ) then
  277.         local bool = not loopMessages:GetValue()
  278.         loopMsgDelay:SetInvisible(bool)
  279.         loopMsgAmt:SetInvisible(bool)
  280.         originalValue[loopMessages] = loopMessages:GetValue()
  281.     end
  282.    
  283.     if ( randomError:GetValue() ~= ( originalValue[randomError] == nil and '' or originalValue[randomError] ) ) then
  284.         errorList:SetInvisible(randomError:GetValue())
  285.         originalValue[randomError] = randomError:GetValue()
  286.     end
  287.    
  288.     if ( messageType:GetValue() ~= ( originalValue[messageType] == nil and '' or originalValue[messageType] ) ) then
  289.         local MessageValue = Lobby.MessageTypes[messageType:GetValue()+1]
  290.         local showErrorStuff = (MessageValue ~= 'Error')
  291.        
  292.         messageColour:SetInvisible(showErrorStuff)
  293.         randomError:SetInvisible(showErrorStuff)
  294.        
  295.         messageText:SetInvisible(MessageValue ~= 'Chat')
  296.        
  297.         if (randomError:GetValue()) then
  298.             errorList:SetInvisible(randomError:GetValue())
  299.         else
  300.             errorList:SetInvisible(showErrorStuff)
  301.         end
  302.        
  303.         originalValue[messageType] = messageType:GetValue()
  304.     end
  305. end)
  306.  
  307.  
  308. local function randomErrorMessage()
  309.     return Lobby.ErrorMessages[ math.random(1, #Lobby.ErrorMessages) ]
  310. end
  311.  
  312. local function getMessageToSend()
  313.     local messageType, col = Lobby.MessageTypes[messageType:GetValue()+1], Lobby.MessageColours[messageColour:GetValue()+1]
  314.     local message = "PartyListAPI.SessionCommand('Game::"
  315.     local target = '(LobbyAPI.BIsHost()) ? PartyListAPI.GetXuidByIndex(' .. (targetSlider:GetValue() - 1) .. ') : MyPersonaAPI.GetXuid()'
  316.     local extraMessage = ""
  317.  
  318.     if (messageType == "Chat") then
  319.         message = message .."Chat"
  320.         extraMessage = string.gsub(messageText:GetValue(), " ", " ") -- if we dont replace regular space with invisible character we cant have spaces in msg :^(
  321.         col = "chat"
  322.     elseif (messageType == "Error") then
  323.         if (col == "Red") then
  324.             message = message .. "ChatReportError"
  325.             col = "error"
  326.         elseif (col == "Green") then
  327.             message = message .. "ChatReportGreen"
  328.         else -- must be yellow
  329.             message = message .. "ChatReportYellow"
  330.         end
  331.  
  332.         if (randomError:GetValue()) then
  333.             extraMessage = errorMessagePrefix .. randomErrorMessage()
  334.         else
  335.             extraMessage = errorMessagePrefix .. Lobby.ErrorMessages[errorList:GetValue() + 1]
  336.         end
  337.     elseif (messageType == "Invite") then
  338.         message = message .. "ChatInviteMessage"
  339.         target = "MyPersonaAPI.GetXuid()"
  340.         col = "friend"
  341.         extraMessage = "${FriendsListAPI.GetXuidByIndex((Math.random() * (FriendsListAPI.GetCount() - 1) + 1))}"
  342.     elseif (messageType == "Start/Stop Queue") then
  343.         return "LobbyAPI.StartMatchmaking( '', '', '', '' );LobbyAPI.StopMatchmaking();", messageType
  344.     elseif (messageType == "Popup Window") then
  345.         message = message .. "HostEndGamePlayAgain"
  346.         col = "error"
  347.     elseif (messageType == "Ear Rape [1]") then
  348.         return 'call_x_times(' .. loopMsgAmt:GetValue() .. ', ()=>{ LobbyAPI.StartMatchmaking( "", "", "", "" );LobbyAPI.StopMatchmaking(); });', messageType
  349.     elseif (messageType == "Ear Rape [2]") then
  350.         return 'call_x_times(' .. loopMsgAmt:GetValue() .. ', ()=>{ PartyListAPI.SessionCommand("Game::Chat", `run all xuid ${MyPersonaAPI.GetXuid()} name ${MyPersonaAPI.GetName()} chat `); });', messageType
  351.     else -- must be Mass Popup
  352.         timerCreate("CloseAllVisiblePopups", 0.5, 1, function() panorama.RunScript([[UiToolkitAPI.CloseAllVisiblePopups();]]) end)
  353.         return 'call_x_times(' .. loopMsgAmt:GetValue() .. ', ()=>{ PartyListAPI.SessionCommand("Game::HostEndGamePlayAgain", `run all xuid ${MyPersonaAPI.GetXuid()}`); });', messageType
  354.     end
  355.  
  356.     message = message .. "', `run all xuid ${" .. target.. "} " .. col .. " " .. extraMessage .. "`);"
  357.  
  358.     return message, messageType
  359. end
  360.  
  361.  
  362. local timers = {}
  363. local function timerCreate(name, delay, times, func)
  364.     table.insert(timers, {["name"] = name, ["delay"] = delay, ["times"] = times, ["func"] = func, ["lastTime"] = globals.RealTime()})
  365. end
  366.  
  367. local function timerRemove(name)
  368.     for k,v in pairs(timers or {}) do
  369.         if (name == v["name"]) then table.remove(timers, k) end
  370.     end
  371. end
  372.  
  373. local function timerTick()
  374.     for k,v in pairs(timers or {}) do
  375.         if (v["times"] <= 0) then table.remove(timers, k) end
  376.         if (v["lastTime"] + v["delay"] <= globals.RealTime()) then
  377.             timers[k]["lastTime"] = globals.RealTime()
  378.             timers[k]["times"] = timers[k]["times"] - 1
  379.             v["func"]()
  380.         end
  381.     end
  382. end
  383.  
  384. callbacks.Register( "Draw", "timerTick", timerTick);
  385.  
  386. local function isGoodType(type)
  387.     for _, v in ipairs(Lobby.BadTypes) do
  388.         if (v == type) then
  389.             return false
  390.         end
  391.     end
  392.  
  393.     return true
  394. end
  395.  
  396. function sendJSMessage()
  397.     local msg, type = getMessageToSend()
  398.    
  399.     if (loopMessages:GetValue() and isGoodType(type)) then
  400.         panorama.RunScript([[
  401.             call_x_times(]] .. loopMsgAmt:GetValue() .. [[, ()=>{
  402.                 ]] .. msg .. [[
  403.             });
  404.         ]])
  405.        
  406.         print('pre-timer')
  407.         timerCreate("loopMsgDelay", loopMsgDelay:GetValue() / 1000, 1, sendJSMessage)
  408.     else
  409.         panorama.RunScript([[
  410.             ]] .. msg .. [[
  411.         ]])
  412.     end
  413.  
  414.     if (type == "Popup Window") then
  415.         panorama.RunScript([[UiToolkitAPI.CloseAllVisiblePopups();]])
  416.     end
  417. end
  418.  
  419. buildJSFuncs()
  420.  
  421. gui.Button(LFGroupbox2, 'Force Clear Popups', function()
  422.     panorama.RunScript([[UiToolkitAPI.CloseAllVisiblePopups();]])
  423. end)
  424.  
  425. gui.Button(LFGroupbox2, 'Execute Message', function()
  426.     sendJSMessage() -- Tried to do this inline, but didnt work, so wrapping it.
  427. end)
Add Comment
Please, Sign In to add comment