Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.63 KB | None | 0 0
  1. // ==UserScript==
  2. // @name BG check
  3. // @namespace Violentmonkey Scripts
  4. // @match https://www.infamousgangsters.com/site.php?page=*
  5. // @grant GM_setValue
  6. // @grant GM_getValue
  7. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
  8. // ==/UserScript==
  9. //
  10. $(document).ready(function() {
  11.  
  12. let killPage = "https://www.infamousgangsters.com/site.php?page=kill";
  13. let antiDupingPage = "https://www.infamousgangsters.com/site.php?page=antiduping";
  14. let travelPage = "https://www.infamousgangsters.com/site.php?page=travel";
  15.  
  16.  
  17. let locations = ["Amsterdam", "Brussels", "Moscow", "London", "Madrid", "Las Vegas", "Berlin"]
  18. let currentLocation = $(".menumain td:contains('Place:')").text();
  19.  
  20. currentLocation = currentLocation.substring(currentLocation.indexOf("Place: ") + 7, currentLocation.length);
  21. if (currentLocation.indexOf("(") > -1) {
  22. currentLocation = currentLocation.substring(0, currentLocation.indexOf("(") - 1);
  23. }
  24.  
  25.  
  26. function redirectPage(page, seconds) {
  27. setTimeout(function() {
  28. $(location).attr('href', page)
  29. }, seconds)
  30. return;
  31. }
  32.  
  33. function amIStillTraveling() {
  34. return $(".menumain td:contains('Place:')").text().indexOf("(") > -1;
  35. }
  36.  
  37. if ($(location).attr('href') == antiDupingPage) {
  38. GM_setValue("gotUserLocations", false);
  39. GM_setValue("userArray", []);
  40. GM_setValue("started", false);
  41. GM_setValue("amsterdamProgress", 0);
  42. GM_setValue("berlinProgress", 0);
  43. GM_setValue("brusselsProgress", 0);
  44. GM_setValue("moscowProgress", 0);
  45. GM_setValue("londonProgress", 0);
  46. GM_setValue("madridProgress", 0);
  47. GM_setValue("lasVegasProgress", 0);
  48. GM_setValue("berlinUsersG", []);
  49. GM_setValue("amsterdamUsersG", []);
  50. GM_setValue("brusselsUsersG", []);
  51. GM_setValue("moscowUsersG", []);
  52. GM_setValue("londonUsersG", []);
  53. GM_setValue("madridUsersG", []);
  54. GM_setValue("lasVegasUsersG", []);
  55. GM_setValue("completedLocations", []);
  56. redirectPage(killPage, 1000);
  57. return;
  58. }
  59.  
  60. if ($(location).attr('href') == travelPage) {
  61. let travelling = false
  62. if(amIStillTraveling){
  63. redirectPage(killPage, 5000);
  64. }
  65. if(GM_getValue("berlinUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Berlin") == -1){
  66. if(currentLocation == "Berlin") {
  67. redirectPage(killPage,1000);
  68. return false;
  69. }
  70. $(":radio[value=Berlin]").click();
  71. $("input[value='Travel!']").click();
  72. return false;
  73. }
  74.  
  75. if(GM_getValue("amsterdamUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Amsterdam") == -1){
  76. if(currentLocation == "Amsterdam") {
  77. redirectPage(killPage,1000);
  78. return false;
  79. }
  80. $(":radio[value=Amsterdam]").click();
  81. $("input[value='Travel!']").click();
  82. return false;
  83. }
  84.  
  85. if(GM_getValue("brusselsUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Brussels") == -1){
  86. if(currentLocation == "Brussels") {
  87. redirectPage(killPage,1000);
  88. return false;
  89. }
  90. $(":radio[value=Brussels]").click();
  91. $("input[value='Travel!']").click();
  92. return false;
  93. }
  94.  
  95. if(GM_getValue("moscowUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Moscow") == -1){
  96. if(currentLocation == "Moscow") {
  97. redirectPage(killPage,1000);
  98. return false;
  99. }
  100. $(":radio[value=Moscow]").click();
  101. $("input[value='Travel!']").click();
  102. return false;
  103. }
  104.  
  105. if(GM_getValue("londonUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("London") == -1){
  106. if(currentLocation == "London") {
  107. redirectPage(killPage,1000);
  108. return false;
  109. }
  110. $(":radio[value=London]").click();
  111. $("input[value='Travel!']").click();
  112. return false;
  113. }
  114.  
  115. if(GM_getValue("madridUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Madrid") == -1){
  116. if(currentLocation == "Madrid") {
  117. redirectPage(killPage,1000);
  118. return false;
  119. }
  120. $(":radio[value=Madrid]").click();
  121. $("input[value='Travel!']").click();
  122. return false;
  123. }
  124.  
  125. if(GM_getValue("lasVegasUsersG", []).length > 0 && GM_getValue("completedLocations", []).indexOf("Las Vegas") == -1){
  126. if(currentLocation == "Madrid") {
  127. redirectPage(killPage,1000);
  128. return false;
  129. }
  130. $(":radio[value=Las Vegas]").click();
  131. $("input[value='Travel!']").click();
  132. return false;
  133. }
  134.  
  135. if(GM_getValue("completedLocations", []).length == 6){
  136. alert("All locations searched");
  137. }
  138. }
  139.  
  140. if ($(location).attr('href') == killPage) {
  141. let gotUserLocations = GM_getValue("gotUserLocations", 0);
  142. if (!gotUserLocations) {
  143. let userArray = GM_getValue("userArray", []);
  144. let started = GM_getValue("started", false);
  145. console.log("in kill page");
  146.  
  147. let berlinUsers = [];
  148. let amsterdamUsers = [];
  149. let brusselsUsers = [];
  150. let moscowUsers = [];
  151. let londonUsers = [];
  152. let madridUsers = [];
  153. let lasVegasUsers = [];
  154. $(".bodymain td:contains(Drop)").each(function() {
  155. console.log("sorting user");
  156. let username = $(this).prev().prev().prev().text();
  157. if (username.length > 0) {
  158. if ($(this).prev().text().indexOf("Berlin!") > -1) {
  159. berlinUsers.push(username)
  160. }
  161. if ($(this).prev().text().indexOf("Amsterdam!") > -1) {
  162. amsterdamUsers.push(username)
  163. }
  164. if ($(this).prev().text().indexOf("Brussels!") > -1) {
  165. brusselsUsers.push(username)
  166. }
  167. if ($(this).prev().text().indexOf("Moscow!") > -1) {
  168. moscowUsers.push(username)
  169. }
  170. if ($(this).prev().text().indexOf("London!") > -1) {
  171. londonUsers.push(username)
  172. }
  173. if ($(this).prev().text().indexOf("Madrid!") > -1) {
  174. madridUsers.push(username)
  175. }
  176. if ($(this).prev().text().indexOf("Las Vegas!") > -1) {
  177. lasVegasUsers.push(username)
  178. }
  179. }
  180. });
  181.  
  182. let berlinUsersG = GM_getValue("berlinUsersG", []);
  183. let amsterdamUsersG = GM_getValue("amsterdamUsersG", []);
  184. let brusselsUsersG = GM_getValue("brusselsUsersG", []);
  185. let moscowUsersG = GM_getValue("moscowUsersG", []);
  186. let londonUsersG = GM_getValue("londonUsersG", []);
  187. let madridUsersG = GM_getValue("madridUsersG", []);
  188. let lasVegasUsersG = GM_getValue("lasVegasUsersG", []);
  189.  
  190. if (berlinUsers.length > 0) {
  191. let array = $.merge(berlinUsers, berlinUsersG);
  192. GM_setValue("berlinUsersG", array);
  193. }
  194. if (amsterdamUsers.length > 0) {
  195. let array = $.merge(amsterdamUsers, amsterdamUsersG);
  196. GM_setValue("amsterdamUsersG", array);
  197. }
  198. if (brusselsUsers.length > 0) {
  199. let array = $.merge(brusselsUsers, brusselsUsersG);
  200. GM_setValue("brusselsUsersG", array);
  201. }
  202. if (moscowUsers.length > 0) {
  203. let array = $.merge(moscowUsers, moscowUsersG);
  204. GM_setValue("moscowUsersG", array);
  205. }
  206. if (londonUsers.length > 0) {
  207. let array = $.merge(londonUsers, londonUsersG);
  208. GM_setValue("londonUsersG", array);
  209. }
  210. if (madridUsers.length > 0) {
  211. let array = $.merge(madridUsers, madridUsersG);
  212. GM_setValue("madridUsersG", array);
  213. }
  214. if (lasVegasUsers.length > 0) {
  215. let array = $.merge(lasVegasUsers, lasVegasUsersG);
  216. GM_setValue("lasVegasUsersG", array);
  217. }
  218.  
  219. if ($(".bodymain td:contains(Drop)").length > 0 && !GM_getValue("started", false)) {
  220. $("input[value^='Next page!']").click();
  221. return false;
  222. } else {
  223. GM_setValue("gotUserLocations", true);
  224. redirectPage(killPage, 1000);
  225. return;
  226. }
  227. } else {
  228. if(amIStillTraveling || GM_getValue("completedLocations", []).indexOf(currentLocation) > -1){
  229. redirectPage(killPage, 5000);
  230. }
  231. //Search users in current location
  232. if (currentLocation == "Amsterdam") {
  233. let size = GM_getValue("amsterdamUsersG", []).length;
  234. let users = GM_getValue("amsterdamUsersG", []);
  235. let progress = GM_getValue("amsterdamProgress", 0);
  236. if ($("body:contains('The amount of bullets you are trying')").length > 0) {
  237. let lastUser = progress - 1
  238. console.log("My log: " + users[lastUser] + " no Bodyguard!");
  239. }
  240.  
  241. if ($("body:contains('This user has an bodyguard named')").length > 0) {
  242. let lastUser = done - 1
  243. 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));
  244. };
  245. if (progress == size) {
  246. let completedLocations = GM_getValue("completedLocations", []);
  247. completedLocations.push("Amsterdam");
  248. GM_setValue("completedLocations", completedLocations);
  249. //Checked all here, travel to new desination
  250. redirectPage(travelPage,1000);
  251. return;
  252. }
  253.  
  254. let username = users[progress];
  255. $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
  256. $(this).val(username);
  257. });
  258. $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
  259. $(this).val(1);
  260. });
  261. GM_setValue("amsterdamProgress", progress + 1);
  262. $("input[value='Kill!']").click();
  263. }
  264.  
  265.  
  266. if (currentLocation == "Berlin") {
  267. let size = GM_getValue("berlinUsersG", []).length;
  268. let users = GM_getValue("berlinUsersG", []);
  269. let progress = GM_getValue("berlinProgress", 0);
  270. if ($("body:contains('The amount of bullets you are trying')").length > 0) {
  271. let lastUser = progress - 1
  272. console.log("My log: " + users[lastUser] + " no Bodyguard!");
  273. }
  274.  
  275. if ($("body:contains('This user has an bodyguard named')").length > 0) {
  276. let lastUser = done - 1
  277. 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));
  278. };
  279. if (progress == size) {
  280. let completedLocations = GM_getValue("completedLocations", []);
  281. completedLocations.push("Berlin");
  282. GM_setValue("completedLocations", completedLocations);
  283. //Checked all here, travel to new desination
  284. redirectPage(travelPage,1000);
  285. return;
  286. }
  287.  
  288. let username = users[progress];
  289. $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
  290. $(this).val(username);
  291. });
  292. $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
  293. $(this).val(1);
  294. });
  295. GM_setValue("berlinProgress", progress + 1);
  296. $("input[value='Kill!']").click();
  297. }
  298.  
  299. if (currentLocation == "Brussels") {
  300. let size = GM_getValue("brusselsUsersG", []).length;
  301. let users = GM_getValue("brusselsUsersG", []);
  302. let progress = GM_getValue("brusselsProgress", 0);
  303. if ($("body:contains('The amount of bullets you are trying')").length > 0) {
  304. let lastUser = progress - 1
  305. console.log("My log: " + users[lastUser] + " no Bodyguard!");
  306. }
  307.  
  308. if ($("body:contains('This user has an bodyguard named')").length > 0) {
  309. let lastUser = done - 1
  310. 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));
  311. };
  312. if (progress == size) {
  313. let completedLocations = GM_getValue("completedLocations", []);
  314. completedLocations.push("Brussels");
  315. GM_setValue("completedLocations", completedLocations);
  316. //Checked all here, travel to new desination
  317. redirectPage(travelPage,1000);
  318. return;
  319. }
  320.  
  321. let username = users[progress];
  322. $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
  323. $(this).val(username);
  324. });
  325. $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
  326. $(this).val(1);
  327. });
  328. GM_setValue("brusselsProgress", progress + 1);
  329. $("input[value='Kill!']").click();
  330. }
  331.  
  332. if (currentLocation == "Moscow") {
  333. let size = GM_getValue("moscowUsersG", []).length;
  334. let users = GM_getValue("moscowUsersG", []);
  335. let progress = GM_getValue("moscowProgress", 0);
  336. if ($("body:contains('The amount of bullets you are trying')").length > 0) {
  337. let lastUser = progress - 1
  338. console.log("My log: " + users[lastUser] + " no Bodyguard!");
  339. }
  340.  
  341. if ($("body:contains('This user has an bodyguard named')").length > 0) {
  342. let lastUser = done - 1
  343. 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));
  344. };
  345. if (progress == size) {
  346. let completedLocations = GM_getValue("completedLocations", []);
  347. completedLocations.push("Moscow");
  348. GM_setValue("completedLocations", completedLocations);
  349. //Checked all here, travel to new desination
  350. redirectPage(travelPage,1000);
  351. return;
  352. }
  353.  
  354. let username = users[progress];
  355. $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
  356. $(this).val(username);
  357. });
  358. $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
  359. $(this).val(1);
  360. });
  361. GM_setValue("mosocwProgress", progress + 1);
  362. $("input[value='Kill!']").click();
  363. }
  364.  
  365. if (currentLocation == "London") {
  366. let size = GM_getValue("londonUsersG", []).length;
  367. let users = GM_getValue("londonUsersG", []);
  368. let progress = GM_getValue("londonProgress", 0);
  369. if ($("body:contains('The amount of bullets you are trying')").length > 0) {
  370. let lastUser = progress - 1
  371. console.log("My log: " + users[lastUser] + " no Bodyguard!");
  372. }
  373.  
  374. if ($("body:contains('This user has an bodyguard named')").length > 0) {
  375. let lastUser = done - 1
  376. 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));
  377. };
  378. if (progress == size) {
  379. let completedLocations = GM_getValue("completedLocations", []);
  380. completedLocations.push("London");
  381. GM_setValue("completedLocations", completedLocations);
  382. //Checked all here, travel to new desination
  383. redirectPage(travelPage,1000);
  384. return;
  385. }
  386.  
  387. let username = users[progress];
  388. $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
  389. $(this).val(username);
  390. });
  391. $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
  392. $(this).val(1);
  393. });
  394. GM_setValue("londonProgress", progress + 1);
  395. $("input[value='Kill!']").click();
  396. }
  397.  
  398. if (currentLocation == "Madrid") {
  399. let size = GM_getValue("madridUsersG", []).length;
  400. let users = GM_getValue("madridUsersG", []);
  401. let progress = GM_getValue("madridProgress", 0);
  402. if ($("body:contains('The amount of bullets you are trying')").length > 0) {
  403. let lastUser = progress - 1
  404. console.log("My log: " + users[lastUser] + " no Bodyguard!");
  405. }
  406.  
  407. if ($("body:contains('This user has an bodyguard named')").length > 0) {
  408. let lastUser = done - 1
  409. 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));
  410. };
  411. if (progress == size) {
  412. let completedLocations = GM_getValue("completedLocations", []);
  413. completedLocations.push("Madrid");
  414. GM_setValue("completedLocations", completedLocations);
  415. //Checked all here, travel to new desination
  416. redirectPage(travelPage,1000);
  417. return;
  418. }
  419.  
  420. let username = users[progress];
  421. $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
  422. $(this).val(username);
  423. });
  424. $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
  425. $(this).val(1);
  426. });
  427. GM_setValue("madridProgress", progress + 1);
  428. $("input[value='Kill!']").click();
  429. }
  430.  
  431. if (currentLocation == "Las Vegas") {
  432. let size = GM_getValue("lasVegasUsersG", []).length;
  433. let users = GM_getValue("lasVegasUsersG", []);
  434. let progress = GM_getValue("lasVegasProgress", 0);
  435. if ($("body:contains('The amount of bullets you are trying')").length > 0) {
  436. let lastUser = progress - 1
  437. console.log("My log: " + users[lastUser] + " no Bodyguard!");
  438. }
  439.  
  440. if ($("body:contains('This user has an bodyguard named')").length > 0) {
  441. let lastUser = done - 1
  442. 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));
  443. };
  444. if (progress == size) {
  445. let completedLocations = GM_getValue("completedLocations", []);
  446. completedLocations.push("Las Vegas");
  447. GM_setValue("completedLocations", completedLocations);
  448. //Checked all here, travel to new desination
  449. redirectPage(travelPage,1000);
  450. return;
  451. }
  452.  
  453. let username = users[progress];
  454. $(".bodymain tr:contains(User:)").find('input, select, textarea').each(function() {
  455. $(this).val(username);
  456. });
  457. $(".bodymain tr:contains(Bullets:)").find('input, select, textarea').each(function() {
  458. $(this).val(1);
  459. });
  460. GM_setValue("lasVegasProgress", progress + 1);
  461. $("input[value='Kill!']").click();
  462. }
  463. }
  464. return;
  465. }
  466.  
  467. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement