Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name BG check
- // @namespace Violentmonkey Scripts
- // @match https://www.infamousgangsters.com/site.php?page=*
- // @grant GM_setValue
- // @grant GM_getValue
- // @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
- // ==/UserScript==
- //
- $(document).ready(function() {
- let killPage = "https://www.infamousgangsters.com/site.php?page=kill";
- let antiDupingPage = "https://www.infamousgangsters.com/site.php?page=antiduping";
- let travelPage = "https://www.infamousgangsters.com/site.php?page=travel";
- let locations = ["Amsterdam", "Brussels", "Moscow", "London", "Madrid", "Las Vegas", "Berlin"]
- let currentLocation = $(".menumain td:contains('Place:')").text();
- currentLocation = currentLocation.substring(currentLocation.indexOf("Place: ") + 7, currentLocation.length);
- if (currentLocation.indexOf("(") > -1) {
- currentLocation = currentLocation.substring(0, currentLocation.indexOf("(") - 1);
- }
- function redirectPage(page, seconds) {
- setTimeout(function() {
- $(location).attr('href', page)
- }, seconds)
- return;
- }
- function amIStillTraveling() {
- return $(".menumain td:contains('Place:')").text().indexOf("(") > -1;
- }
- if ($(location).attr('href') == antiDupingPage) {
- GM_setValue("gotUserLocations", false);
- GM_setValue("userArray", []);
- GM_setValue("started", false);
- GM_setValue("amsterdamProgress", 0);
- GM_setValue("berlinProgress", 0);
- GM_setValue("brusselsProgress", 0);
- GM_setValue("moscowProgress", 0);
- GM_setValue("londonProgress", 0);
- GM_setValue("madridProgress", 0);
- GM_setValue("lasVegasProgress", 0);
- GM_setValue("berlinUsersG", []);
- GM_setValue("amsterdamUsersG", []);
- GM_setValue("brusselsUsersG", []);
- GM_setValue("moscowUsersG", []);
- GM_setValue("londonUsersG", []);
- GM_setValue("madridUsersG", []);
- GM_setValue("lasVegasUsersG", []);
- GM_setValue("completedLocations", []);
- redirectPage(killPage, 1000);
- return;
- }
- if ($(location).attr('href') == travelPage) {
- let travelling = false
- if(amIStillTraveling){
- redirectPage(killPage, 5000);
- }
- if(GM_getValue("berlinUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Berlin") == -1){
- if(currentLocation == "Berlin") {
- redirectPage(killPage,1000);
- return false;
- }
- $(":radio[value=Berlin]").click();
- $("input[value='Travel!']").click();
- return false;
- }
- if(GM_getValue("amsterdamUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Amsterdam") == -1){
- if(currentLocation == "Amsterdam") {
- redirectPage(killPage,1000);
- return false;
- }
- $(":radio[value=Amsterdam]").click();
- $("input[value='Travel!']").click();
- return false;
- }
- if(GM_getValue("brusselsUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Brussels") == -1){
- if(currentLocation == "Brussels") {
- redirectPage(killPage,1000);
- return false;
- }
- $(":radio[value=Brussels]").click();
- $("input[value='Travel!']").click();
- return false;
- }
- if(GM_getValue("moscowUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Moscow") == -1){
- if(currentLocation == "Moscow") {
- redirectPage(killPage,1000);
- return false;
- }
- $(":radio[value=Moscow]").click();
- $("input[value='Travel!']").click();
- return false;
- }
- if(GM_getValue("londonUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("London") == -1){
- if(currentLocation == "London") {
- redirectPage(killPage,1000);
- return false;
- }
- $(":radio[value=London]").click();
- $("input[value='Travel!']").click();
- return false;
- }
- if(GM_getValue("madridUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Madrid") == -1){
- if(currentLocation == "Madrid") {
- redirectPage(killPage,1000);
- return false;
- }
- $(":radio[value=Madrid]").click();
- $("input[value='Travel!']").click();
- return false;
- }
- if(GM_getValue("lasVegasUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Las Vegas") == -1){
- if(currentLocation == "Madrid") {
- redirectPage(killPage,1000);
- return false;
- }
- $(":radio[value=Las Vegas]").click();
- $("input[value='Travel!']").click();
- return false;
- }
- if(GM_getValue("completedLocations", []).length == 6){
- alert("All locations searched");
- }
- }
- if ($(location).attr('href') == killPage) {
- let gotUserLocations = GM_getValue("gotUserLocations", 0);
- if (!gotUserLocations) {
- let userArray = GM_getValue("userArray", []);
- let started = GM_getValue("started", false);
- console.log("in kill page");
- let berlinUsers = [];
- let amsterdamUsers = [];
- let brusselsUsers = [];
- let moscowUsers = [];
- let londonUsers = [];
- let madridUsers = [];
- let lasVegasUsers = [];
- $(".bodymain td:contains(Drop)").each(function() {
- console.log("sorting user");
- let username = $(this).prev().prev().prev().text();
- if (username.length > 0) {
- if ($(this).prev().text().indexOf("Berlin!") > -1) {
- berlinUsers.push(username)
- }
- if ($(this).prev().text().indexOf("Amsterdam!") > -1) {
- amsterdamUsers.push(username)
- }
- if ($(this).prev().text().indexOf("Brussels!") > -1) {
- brusselsUsers.push(username)
- }
- if ($(this).prev().text().indexOf("Moscow!") > -1) {
- moscowUsers.push(username)
- }
- if ($(this).prev().text().indexOf("London!") > -1) {
- londonUsers.push(username)
- }
- if ($(this).prev().text().indexOf("Madrid!") > -1) {
- madridUsers.push(username)
- }
- if ($(this).prev().text().indexOf("Las Vegas!") > -1) {
- lasVegasUsers.push(username)
- }
- }
- });
- let berlinUsersG = GM_getValue("berlinUsersG", []);
- let amsterdamUsersG = GM_getValue("amsterdamUsersG", []);
- let brusselsUsersG = GM_getValue("brusselsUsersG", []);
- let moscowUsersG = GM_getValue("moscowUsersG", []);
- let londonUsersG = GM_getValue("londonUsersG", []);
- let madridUsersG = GM_getValue("madridUsersG", []);
- let lasVegasUsersG = GM_getValue("lasVegasUsersG", []);
- if (berlinUsers.length > 0) {
- let array = $.merge(berlinUsers, berlinUsersG);
- GM_setValue("berlinUsersG", array);
- }
- if (amsterdamUsers.length > 0) {
- let array = $.merge(amsterdamUsers, amsterdamUsersG);
- GM_setValue("amsterdamUsersG", array);
- }
- if (brusselsUsers.length > 0) {
- let array = $.merge(brusselsUsers, brusselsUsersG);
- GM_setValue("brusselsUsersG", array);
- }
- if (moscowUsers.length > 0) {
- let array = $.merge(moscowUsers, moscowUsersG);
- GM_setValue("moscowUsersG", array);
- }
- if (londonUsers.length > 0) {
- let array = $.merge(londonUsers, londonUsersG);
- GM_setValue("londonUsersG", array);
- }
- if (madridUsers.length > 0) {
- let array = $.merge(madridUsers, madridUsersG);
- GM_setValue("madridUsersG", array);
- }
- if (lasVegasUsers.length > 0) {
- let array = $.merge(lasVegasUsers, lasVegasUsersG);
- GM_setValue("lasVegasUsersG", array);
- }
- if ($(".bodymain td:contains(Drop)").length > 0 && !GM_getValue("started", false)) {
- $("input[value^='Next page!']").click();
- return false;
- } else {
- GM_setValue("gotUserLocations", true);
- redirectPage(killPage, 1000);
- return;
- }
- } else {
- if(amIStillTraveling || GM_getValue("completedLocations", []).indexOf(currentLocation) > -1){
- redirectPage(killPage, 5000);
- }
- //Search users in current location
- if (currentLocation == "Amsterdam") {
- let size = GM_getValue("amsterdamUsersG", []).length;
- let users = GM_getValue("amsterdamUsersG", []);
- let progress = GM_getValue("amsterdamProgress", 0);
- if ($("body:contains('The amount of bullets you are trying')").length > 0) {
- let lastUser = progress - 1
- console.log("My log: " + users[lastUser] + " no Bodyguard!");
- }
- if ($("body:contains('This user has an bodyguard named')").length > 0) {
- let lastUser = done - 1
- console.log("My log: " + users[lastUser] + " has a Bodyguard called " + $(".spacer").text().slice($(".spacer").text().indexOf("named") + 6, $(".spacer").text().indexOf("you will need") - 1));
- };
- if (progress == size) {
- let completedLocations = GM_getValue("completedLocations", []);
- completedLocations.push("Amsterdam");
- GM_setValue("completedLocations", completedLocations);
- //Checked all here, travel to new desination
- redirectPage(travelPage,1000);
- return;
- }
- let username = users[progress];
- $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
- $(this).val(username);
- });
- $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
- $(this).val(1);
- });
- GM_setValue("amsterdamProgress", progress + 1);
- $("input[value='Kill!']").click();
- }
- if (currentLocation == "Berlin") {
- let size = GM_getValue("berlinUsersG", []).length;
- let users = GM_getValue("berlinUsersG", []);
- let progress = GM_getValue("berlinProgress", 0);
- if ($("body:contains('The amount of bullets you are trying')").length > 0) {
- let lastUser = progress - 1
- console.log("My log: " + users[lastUser] + " no Bodyguard!");
- }
- if ($("body:contains('This user has an bodyguard named')").length > 0) {
- let lastUser = done - 1
- console.log("My log: " + users[lastUser] + " has a Bodyguard called " + $(".spacer").text().slice($(".spacer").text().indexOf("named") + 6, $(".spacer").text().indexOf("you will need") - 1));
- };
- if (progress == size) {
- let completedLocations = GM_getValue("completedLocations", []);
- completedLocations.push("Berlin");
- GM_setValue("completedLocations", completedLocations);
- //Checked all here, travel to new desination
- redirectPage(travelPage,1000);
- return;
- }
- let username = users[progress];
- $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
- $(this).val(username);
- });
- $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
- $(this).val(1);
- });
- GM_setValue("berlinProgress", progress + 1);
- $("input[value='Kill!']").click();
- }
- if (currentLocation == "Brussels") {
- let size = GM_getValue("brusselsUsersG", []).length;
- let users = GM_getValue("brusselsUsersG", []);
- let progress = GM_getValue("brusselsProgress", 0);
- if ($("body:contains('The amount of bullets you are trying')").length > 0) {
- let lastUser = progress - 1
- console.log("My log: " + users[lastUser] + " no Bodyguard!");
- }
- if ($("body:contains('This user has an bodyguard named')").length > 0) {
- let lastUser = done - 1
- console.log("My log: " + users[lastUser] + " has a Bodyguard called " + $(".spacer").text().slice($(".spacer").text().indexOf("named") + 6, $(".spacer").text().indexOf("you will need") - 1));
- };
- if (progress == size) {
- let completedLocations = GM_getValue("completedLocations", []);
- completedLocations.push("Brussels");
- GM_setValue("completedLocations", completedLocations);
- //Checked all here, travel to new desination
- redirectPage(travelPage,1000);
- return;
- }
- let username = users[progress];
- $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
- $(this).val(username);
- });
- $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
- $(this).val(1);
- });
- GM_setValue("brusselsProgress", progress + 1);
- $("input[value='Kill!']").click();
- }
- if (currentLocation == "Moscow") {
- let size = GM_getValue("moscowUsersG", []).length;
- let users = GM_getValue("moscowUsersG", []);
- let progress = GM_getValue("moscowProgress", 0);
- if ($("body:contains('The amount of bullets you are trying')").length > 0) {
- let lastUser = progress - 1
- console.log("My log: " + users[lastUser] + " no Bodyguard!");
- }
- if ($("body:contains('This user has an bodyguard named')").length > 0) {
- let lastUser = done - 1
- console.log("My log: " + users[lastUser] + " has a Bodyguard called " + $(".spacer").text().slice($(".spacer").text().indexOf("named") + 6, $(".spacer").text().indexOf("you will need") - 1));
- };
- if (progress == size) {
- let completedLocations = GM_getValue("completedLocations", []);
- completedLocations.push("Moscow");
- GM_setValue("completedLocations", completedLocations);
- //Checked all here, travel to new desination
- redirectPage(travelPage,1000);
- return;
- }
- let username = users[progress];
- $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
- $(this).val(username);
- });
- $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
- $(this).val(1);
- });
- GM_setValue("mosocwProgress", progress + 1);
- $("input[value='Kill!']").click();
- }
- if (currentLocation == "London") {
- let size = GM_getValue("londonUsersG", []).length;
- let users = GM_getValue("londonUsersG", []);
- let progress = GM_getValue("londonProgress", 0);
- if ($("body:contains('The amount of bullets you are trying')").length > 0) {
- let lastUser = progress - 1
- console.log("My log: " + users[lastUser] + " no Bodyguard!");
- }
- if ($("body:contains('This user has an bodyguard named')").length > 0) {
- let lastUser = done - 1
- console.log("My log: " + users[lastUser] + " has a Bodyguard called " + $(".spacer").text().slice($(".spacer").text().indexOf("named") + 6, $(".spacer").text().indexOf("you will need") - 1));
- };
- if (progress == size) {
- let completedLocations = GM_getValue("completedLocations", []);
- completedLocations.push("London");
- GM_setValue("completedLocations", completedLocations);
- //Checked all here, travel to new desination
- redirectPage(travelPage,1000);
- return;
- }
- let username = users[progress];
- $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
- $(this).val(username);
- });
- $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
- $(this).val(1);
- });
- GM_setValue("londonProgress", progress + 1);
- $("input[value='Kill!']").click();
- }
- if (currentLocation == "Madrid") {
- let size = GM_getValue("madridUsersG", []).length;
- let users = GM_getValue("madridUsersG", []);
- let progress = GM_getValue("madridProgress", 0);
- if ($("body:contains('The amount of bullets you are trying')").length > 0) {
- let lastUser = progress - 1
- console.log("My log: " + users[lastUser] + " no Bodyguard!");
- }
- if ($("body:contains('This user has an bodyguard named')").length > 0) {
- let lastUser = done - 1
- console.log("My log: " + users[lastUser] + " has a Bodyguard called " + $(".spacer").text().slice($(".spacer").text().indexOf("named") + 6, $(".spacer").text().indexOf("you will need") - 1));
- };
- if (progress == size) {
- let completedLocations = GM_getValue("completedLocations", []);
- completedLocations.push("Madrid");
- GM_setValue("completedLocations", completedLocations);
- //Checked all here, travel to new desination
- redirectPage(travelPage,1000);
- return;
- }
- let username = users[progress];
- $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
- $(this).val(username);
- });
- $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
- $(this).val(1);
- });
- GM_setValue("madridProgress", progress + 1);
- $("input[value='Kill!']").click();
- }
- if (currentLocation == "Las Vegas") {
- let size = GM_getValue("lasVegasUsersG", []).length;
- let users = GM_getValue("lasVegasUsersG", []);
- let progress = GM_getValue("lasVegasProgress", 0);
- if ($("body:contains('The amount of bullets you are trying')").length > 0) {
- let lastUser = progress - 1
- console.log("My log: " + users[lastUser] + " no Bodyguard!");
- }
- if ($("body:contains('This user has an bodyguard named')").length > 0) {
- let lastUser = done - 1
- console.log("My log: " + users[lastUser] + " has a Bodyguard called " + $(".spacer").text().slice($(".spacer").text().indexOf("named") + 6, $(".spacer").text().indexOf("you will need") - 1));
- };
- if (progress == size) {
- let completedLocations = GM_getValue("completedLocations", []);
- completedLocations.push("Las Vegas");
- GM_setValue("completedLocations", completedLocations);
- //Checked all here, travel to new desination
- redirectPage(travelPage,1000);
- return;
- }
- let username = users[progress];
- $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
- $(this).val(username);
- });
- $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
- $(this).val(1);
- });
- GM_setValue("lasVegasProgress", progress + 1);
- $("input[value='Kill!']").click();
- }
- }
- return;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement