Bloble.io NoobScript V3 InstaFind Fragment

A fragment of code from NoobScript V3 - The instant player find feature. Click on a name on the leaderboard or click on a name in the chat to instantly find them. Use the < and > keys to navigate as well.

  1. // ==UserScript==
  2. // @name Bloble.io NoobScript V3 InstaFind Fragment
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description A fragment of code from NoobScript V3 - The instant player find feature. Click on a name on the leaderboard or click on a name in the chat to instantly find them. Use the < and > keys to navigate as well.
  6. // @author NoobishHacker
  7. // @match http://bloble.io/*
  8. // @grant none
  9. // ==/UserScript==
  10. var gotoUsers = [];
  11. var gotoIndex = 0;
  12. window.overrideSocketEvents = window.overrideSocketEvents || [];
  13. window.chatCommands = window.chatCommands || {};
  14.  
  15. window.chatCommands.find = function(split) {
  16. var name = split.slice(1).join(' ');
  17. if (name == '') {
  18. addChat('Please specify a username', 'Client')
  19. return;
  20. }
  21. window.goto(name)
  22. }
  23. window.overrideSocketEvents.push({
  24. name: "l",
  25. description: "Leaderboard Insta Find override",
  26. func: function(a) {
  27. var d = "",
  28. c = 1,
  29. b = 0;
  30. for (; b < a.length;) {
  31. d += "<div class='leaderboardItem' onclick=goto2(" + a[b] + ");><div style='display:inline-block;float:left;' class='whiteText'>" + c + ".</div> <div class='" + (player && a[b] == player.sid ? "leaderYou" : "leader") + "'>" + a[b + 1] + "</div><div class='scoreText'>" + a[b + 2] + "</div></div>", c++, b += 3;
  32. }
  33. leaderboardList.innerHTML = d;
  34. }
  35. })
  36. leaderboardList.style.pointerEvents = 'auto';
  37. chatListWrapper.style.pointerEvents = 'auto';
  38.  
  39. window.goto = function(username) {
  40. gotoUsers = users.filter((user) => {
  41. return user.name === username
  42. });
  43. gotoIndex = 0;
  44. if (gotoUsers[0]) {
  45. camX = gotoUsers[0].x - player.x;
  46. camY = gotoUsers[0].y - player.y;
  47. }
  48. addChat(gotoUsers.length + ' users found with the name ' + username, 'Client');
  49. return gotoUsers.length;
  50. }
  51. window.goto2 = function(id, go) {
  52. gotoUsers = users.filter((user) => {
  53. return user.sid === id;
  54. });
  55. gotoIndex = 0;
  56. if (!go && gotoUsers[0]) {
  57. camX = gotoUsers[0].x - player.x;
  58. camY = gotoUsers[0].y - player.y;
  59. }
  60. return gotoUsers.length;
  61. }
  62.  
  63. window.gotoLeft = function() {
  64. if (!gotoUsers.length) return;
  65.  
  66. if (camX == gotoUsers[gotoIndex].x - player.x && camY == gotoUsers[gotoIndex].y - player.y) {
  67. if (gotoIndex <= 0) gotoIndex = gotoUsers.length;
  68. gotoIndex--;
  69. }
  70. camX = gotoUsers[gotoIndex].x - player.x;
  71. camY = gotoUsers[gotoIndex].y - player.y;
  72. }
  73.  
  74. window.gotoRight = function() {
  75. if (!gotoUsers.length) return;
  76.  
  77. if (camX == gotoUsers[gotoIndex].x - player.x && camY == gotoUsers[gotoIndex].y - player.y) {
  78. if (gotoIndex >= gotoUsers.length - 1) gotoIndex = -1;
  79. gotoIndex++;
  80. }
  81. camX = gotoUsers[gotoIndex].x - player.x;
  82. camY = gotoUsers[gotoIndex].y - player.y;
  83. }
  84.  
  85. window.addChat = function(msg, from, color) {
  86. color = color || "#fff";
  87. var b = document.createElement("li");
  88. b.className = "chatother";
  89. b.innerHTML = '<span style="color:' + color + '">[' + from + ']</span> <span class="chatText">' + msg + "</span>";
  90. 10 < chatList.childNodes.length && chatList.removeChild(chatList.childNodes[0]);
  91. chatList.appendChild(b)
  92. }
  93.  
  94. window.resetCamera = function() { // Override
  95. camX = camXS = camY = camYS = 0;
  96. cameraKeys = {
  97. l: 0,
  98. r: 0,
  99. u: 0,
  100. d: 0
  101. }
  102.  
  103. if (socket && window.overrideSocketEvents && window.overrideSocketEvents.length) {
  104. window.overrideSocketEvents.forEach((item) => {
  105. socket.removeAllListeners(item.name)
  106. socket.on(item.name, item.func);
  107.  
  108. });
  109.  
  110. }
  111. }
  112.  
  113.  
  114.  
  115. window.addChatLine = function(a, d, c) {
  116. if (player) {
  117. var b = getUserBySID(a);
  118. if (c || 0 <= b) {
  119. var g = c ? "SERVER" : users[b].name;
  120. c = c ? "#fff" : playerColors[users[b].color] ? playerColors[users[b].color] : playerColors[0];
  121. player.sid == a && (c = "#fff");
  122. b = document.createElement("li");
  123. b.className = player.sid == a ? "chatme" : "chatother";
  124.  
  125. b.innerHTML = '<span style="color:' + c + '" onclick=goto2(' + a + ');>[' + g + ']</span> <span class="chatText">' + d + "</span>";
  126. 10 < chatList.childNodes.length && chatList.removeChild(chatList.childNodes[0]);
  127. chatList.appendChild(b)
  128. }
  129. }
  130. }
  131.  
  132. window.addEventListener("keyup", function(a) {
  133. a = a.keyCode ? a.keyCode : a.which;
  134. if (a === 190) {
  135. window.gotoRight()
  136. } else if (a === 188) {
  137. window.gotoLeft();
  138. }
  139.  
  140. });