Toradorable Agar-Networks.com

A Toradorable skin changer supporting multiple animations and variable image display times. Includes a UI. To use, press "C" in game to cycle between different animations.

当前为 2016-11-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Toradorable Agar-Networks.com
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2.8
  5. // @description A Toradorable skin changer supporting multiple animations and variable image display times. Includes a UI. To use, press "C" in game to cycle between different animations.
  6.  
  7. // @author Toradorable
  8. // @match http://agar-network.com/*
  9. // @grant none
  10. // @require https://greasyfork.org/scripts/24894-toradorable-animator/code/Toradorable%20Animator.js?version=158240
  11. // @require https://greasyfork.org/scripts/24844-toradorable-animation-for-toradorable-skin-changer/code/Toradorable%20Animation%20for%20Toradorable%20Skin%20Changer.js
  12. // @require https://greasyfork.org/scripts/24901-iwubbz-s-candy-animation-for-toradorable-skin-changer/code/iWubbz's%20Candy%20Animation%20for%20Toradorable%20Skin%20Changer.js
  13. // @require https://greasyfork.org/scripts/24858-dancing-cat-animation-for-toradorable-skin-changer/code/Dancing%20Cat%20Animation%20for%20Toradorable%20Skin%20Changer.js
  14. // ==/UserScript==
  15. setTimeout(function(){
  16. animator.site.elements.cssElement=document.getElementById('lb_detail');
  17. animator.site.elements.skinurl=document.getElementById('skin_url');
  18. animator.site.updateFrame= function(nick=animator.currentFrameNick(), skin=animator.currentFrameSkin(), time=animator.currentFrameDisplayTime(), displaylocal=true) {
  19. //this.elements.skinurl.value = skin;
  20. setNick(nick,document.getElementById('team_name').value,skin,$('.partyToken').val());
  21. };
  22. animator.init();
  23. animator.site.initilaizeUI();
  24. /*
  25. * Setup Custome Web Elements
  26. */
  27.  
  28.  
  29.  
  30. /*
  31. var overlays2=document.getElementById("overlays2");
  32. var mipmapNode = document.getElementById("mipmapNode");
  33. var chatboxInput=document.getElementById("input_box2");
  34. var StealSkinBox = chatboxInput.cloneNode(true);
  35. StealSkinBox.name="Steal Skin From:";
  36. StealSkinBox.id="StealSkinElm";
  37. StealSkinBox.value="";
  38. StealSkinBox.placeholder="Steal Skin From:";
  39. StealSkinBox.style.cssText = document.defaultView.getComputedStyle(chatboxInput, "").cssText;
  40. StealSkinBox.style.width="200px";
  41. StealSkinBox.style.right="9px";
  42. StealSkinBox.style.bottom="218px";
  43. StealSkinBox.style.position="absolute";
  44. var SkinTargetType = StealSkinBox.cloneNode(true);
  45. SkinTargetType.name="Skin Target Type:";
  46. SkinTargetType.id="SkinTargetType";
  47. SkinTargetType.value="Theft"; // Theft, Swap, Push
  48. SkinTargetType.placeholder="Skin Target Type:";
  49. SkinTargetType.style.cssText = document.defaultView.getComputedStyle(chatboxInput, "").cssText;
  50. SkinTargetType.style.width="200px";
  51. SkinTargetType.style.right="9px";
  52. SkinTargetType.style.bottom="258px";
  53. SkinTargetType.style.position="absolute";
  54. overlays2.insertBefore(SkinTargetType, overlays2.lastChild);
  55. overlays2.insertBefore(StealSkinBox, overlays2.lastChild);
  56. var LieAs = chatboxInput.cloneNode(true);
  57. LieAs.name="LieAs";
  58. LieAs.id="LieAsElm";
  59. LieAs.value="";
  60. LieAs.placeholder="Not Lying";
  61. LieAs.style.cssText = document.defaultView.getComputedStyle(chatboxInput, "").cssText;
  62. //LieAs.
  63. var chatAreaElem=document.getElementById("chatboxArea2");
  64. chatAreaElem.insertBefore(LieAs, chatAreaElem.firstChild);
  65.  
  66. */
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. /*
  74. * Setup Hotkeys
  75. */
  76. /*
  77. var hotKeyTable = document.getElementById("hotkey_table");
  78. var hotkeyMappingREV={};
  79. var tmphotkeyMapping=JSON.parse(getLocalStorage("hotkeyMapping"));
  80. for (var prop in tmphotkeyMapping) {
  81. hotkeyMappingREV[tmphotkeyMapping[prop]]=prop;
  82. }
  83.  
  84.  
  85.  
  86.  
  87. function AddHotKey(hk) {
  88. var hkdefault = {
  89. id: "hk_change_my_hotkey_id",
  90. defaultHotkey: "",
  91. key: null,
  92. description: "Change My Description",
  93. keyDown: null,
  94. keyUp: null,
  95. type: "NORMAL"
  96. };
  97. hk = Object.assign(hkdefault,hk);
  98. if (! hk.key || hk.key === null) hk.key = hotkeyMappingREV[hk.id];
  99. if (! hk.key || hk.key === null) hk.key = hk.defaultHotkey;
  100. var hk_element = hotKeyTable.lastChild.cloneNode(true);
  101. hk_element.children[0].dataset.hotkeyid = hk.id;
  102. hk_element.children[0].innerHTML=hk.key;
  103. hk_element.children[1].innerHTML=hk.description;
  104. hk_element.children[2].innerHTML="/";
  105. console.log("Adding Hotkey: " + hk);
  106. hotKeyTable.appendChild(hk_element);
  107. hotkeyConfig[hk.id]= {
  108. defaultHotkey: hk.defaultHotkey,
  109. name: hk.description,
  110. keyDown: hk.keyDown,
  111. type: hk.type
  112. };
  113. hotkeyMapping[hk.key] = hk.id;
  114. return hk_element;
  115. }
  116. chatRoom.doTellLie=false;
  117. var hk_TellLie = AddHotKey({
  118. id: "hk_TellLie",
  119. defaultHotkey: "CTRL_ENTER",
  120. description: "Open Chatbox and send message as another player",
  121. keyDown: function() {
  122. if (chatRoom["isFocus"]()) {
  123. TellLie($("#input_box2")["val"]());
  124. $("#input_box2")["val"]("");
  125. $("#input_box2")["blur"]();
  126. $("#chatboxArea2")["hide"]();
  127. } else {
  128. chatRoom["focus"]();
  129. }
  130. }
  131. });
  132.  
  133.  
  134.  
  135.  
  136. var hk_StealNearbySkin = AddHotKey({
  137. id: "hk_StealNearbySkin",
  138. defaultHotkey: "N",
  139. description: "Grab Skin of Nearby Player",
  140. keyDown: function() {
  141. var playerId = GetNearestSkinnedCellId();
  142. if (playerId) StealSkinBox.value="#" + GetNearestSkinnedCellId();
  143. else StealSkinBox.value="";
  144. }
  145. });
  146.  
  147.  
  148.  
  149.  
  150. var hk_StealNearbyName = AddHotKey({
  151. id: "hk_StealNearbyName",
  152. defaultHotkey: "",
  153. description: "Grab Name of Nearby Player",
  154. keyDown: function() {
  155. LieAs.value=GetNearestCell()[1];
  156. }
  157. });
  158.  
  159.  
  160.  
  161.  
  162. var hk_ToggleStolenSkin = AddHotKey({
  163. id: "hk_ToggleStolenSkin",
  164. defaultHotkey: "M",
  165. description: "Use/Stop Using Stolen Skin",
  166. keyDown: function() {
  167. //skinChanger=false;
  168. Print("Will Steal Skin");
  169. if (FakeSkinWanted && !DoStealSkin) {
  170. Print("FakeSkinWanted && !DoStealSkin");
  171. RefreshSkin(0,true);
  172. //LagOnce();
  173. } else if(FakeSkinWanted) {
  174. Print("FakeSkinWanted");
  175. FakeSkinWanted=false;
  176. DoStealSkin=false;
  177. } else {
  178. Print("STARTING FAKE SKIN CALL");
  179. FakeSkinWanted=true;
  180. DoStealSkin=true;
  181. FakeSkin();
  182. }
  183. }
  184. });
  185. var hk_ToggleShareSkin = AddHotKey({
  186. id: "hk_ToggleShareSkin",
  187. defaultHotkey: "S",
  188. description: "Share/Stop Sharing Skin",
  189. keyDown: function() {
  190. DoShareSkin = !DoShareSkin;
  191. //ShareSkin();
  192. }
  193. });
  194.  
  195.  
  196. var hk_ReconnectToServer = AddHotKey({
  197. id: "hk_ReconnectToServer",
  198. defaultHotkey: "L",
  199. description: "Reconnect to Server",
  200. keyDown: function() {
  201. connect(myApp.getCurrentPartyCode());
  202. }
  203. });
  204.  
  205.  
  206.  
  207.  
  208. var hk_CycleSkinRotator = AddHotKey({
  209. id: "hk_CycleSkinRotator",
  210. defaultHotkey: "C",
  211. description: "Cycle Skin Rotator",
  212. keyDown: function() {
  213. if (skinChangerWanted && !skinChanger) {
  214. RefreshSkin(0,true);
  215. //LagOnce();
  216. } else if(skinChangerWanted) {
  217. skinChangerWanted=false;
  218. skinChanger=false;
  219. } else {
  220. skinChangerWanted=true;
  221. skinChanger=true;
  222. skinidx++;
  223. if(skinidx >= skinList.length) {skinidx = 0;}
  224. AutoChangeSkin();
  225. }
  226. }
  227. });
  228. //myApp.refreshHotkeySettingPage();
  229.  
  230.  
  231.  
  232.  
  233. //myApp.restoreSetting();
  234.  
  235.  
  236.  
  237.  
  238. myApp.setUpHotKeyConfigPage();
  239.  
  240.  
  241. */
  242. /*********************
  243. * Generic Functions *
  244. *********************/
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253. function isNumeric(n) {
  254. return !isNaN(parseFloat(n)) && isFinite(n);
  255. }
  256.  
  257.  
  258.  
  259.  
  260. function Print(msg) {
  261. console.log(msg);
  262. }
  263.  
  264.  
  265.  
  266. /*****************
  267. ** Custom Hot Keys
  268. ******************/
  269.  
  270.  
  271.  
  272.  
  273. const keycodes={
  274. backspace:8, tab:9, enter:13,
  275. shift:16, ctrl:17, alt:18,
  276. pause_break:19, capslock:20, escape:27,
  277. space:32, pageup:33, pagedown:34,
  278. end:35, home:36, leftarrow:37,
  279. uparrow:38, rightarrow:39, downarrow:40,
  280. insert:45, delete:46,
  281. 0:48, 1:49, 2:50, 3:51,
  282. 4:52, 5:53, 6:54, 7:55,
  283. 8:56, 9:57, a:65, b:66,
  284. c:67, d:68, e:69, f:70,
  285. g:71, h:72, i:73, j:74,
  286. k:75, l:76, m:77, n:78,
  287. o:79, p:80, q:81, r:82,
  288. s:83, t:84, u:85, v:86,
  289. w:87, x:88, y:89, z:90,
  290. multiply: 106, add: 107, subtract: 109,
  291. decimalpoint: 110, divide: 111,
  292. f1: 112, f2: 113, f3: 114,
  293. f4: 115, f5: 116, f6: 117,
  294. f7: 118, f8: 119, f9: 120,
  295. f10: 121, f11: 122, f12: 123,
  296. numlock: 144, scrolllock: 145,
  297. semicolon: 186, equalsign: 187,
  298. comma: 188, dash: 189, period: 190,
  299. forwardslash: 191, graveaccent: 192,
  300. openbracket: 219, backslash: 220,
  301. closebraket: 221, singlequote: 222
  302. };
  303.  
  304.  
  305.  
  306.  
  307. window.addEventListener('keydown', keydown);
  308. function keydown(e) {
  309. var chatArea=$("#chatboxArea2");
  310. var chatIsFocused=$("#input_box2").is(':focus') || $("#LieAsElm").is(':focus') || $("#StealSkinElm").is(':focus');
  311. if(e.keyCode === keycodes.c && !(chatIsFocused)) {
  312. if (animator.isPlaying) {
  313. animator.pauseAnimation();
  314. animator.nextAnimation();
  315. } else {
  316. animator.playAnimation();
  317. }
  318. }
  319. else if(e.keyCode === 27) {
  320. animator.pauseAnimation();
  321. //temporary workaround
  322. $("#overlays")["show"]();
  323. }
  324. else if(e.keyCode === keycodes.add && !(chatIsFocused)) {
  325. //naservers();
  326. animator.incrementSpeedMultiplier();
  327. } else if(e.keyCode === keycodes.subtract && !(chatIsFocused)) {
  328. //naservers();
  329. animator.decrementSpeedMultiplier();
  330. } else if(e.keyCode === keycodes[0] && !(chatIsFocused)) {
  331. //naservers();
  332. animator.setSpeedMultiplier(1);
  333. }
  334. /*else if(e.keyCode === keycodes.l && !(chatIsFocused)) {
  335. //naservers();
  336. connect(myApp.getCurrentPartyCode());
  337. }*/
  338. /*else if((e.keyCode === keycodes.space || e.keyCode === keycodes.t) && !IsDoingFireork && !($("#chatboxArea2").is(":focus"))) {
  339. fireworkidx=0;
  340. Firework();
  341. }*/
  342. }
  343.  
  344.  
  345.  
  346.  
  347. //$('.content').append('<input style="border:1px solid grey;" placeholder="Time between skin change (milliseconds)" id="skin_change_inputSpeed" value="500" type="number" min="300"/>');
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359. function HasRestarted() {
  360. if (testHasRestarted >=5) {
  361. testHasRestarted=0;
  362. } else {
  363. testHasRestarted++;
  364. return false;
  365. }
  366. var myCell;
  367. try {
  368. if(typeof getCell != 'function') throw "GetCell is NotAFunc";
  369. myCell=getCell();
  370. if(myCell === undefined) throw "GetCell Returned null";
  371. if(myCell[0] === undefined) throw "CellDataEmpty";
  372. if(myCell[0].x === undefined) throw "Cell has no X";
  373. FailCount=0;
  374. }
  375. catch(err) {
  376. console.log(err," ",FailCount);
  377. myCell=null;
  378. FailCount++;
  379. }
  380. finally {
  381. if (FailCount >= 5) return true;
  382. else if (FailCount !== 0) return false;
  383. myCell=myCell[0];
  384. }
  385. if (LastXY[0] != myCell.x || LastXY[1] != myCell.y) {
  386. LastXY=[myCell.x,myCell.y];
  387. return false;
  388. }
  389. var LB = getLB();
  390. if (LB.length != 9) return false;
  391. for (var i=0; i < 8; i++) { // Leaderboard 1-8 should be named RESTART
  392. if (LB[i].name != "RESTART") return false;
  393. }
  394. // Leaderboard 9 should be named ALIS.IO
  395. if (LB[8].name != "ALIS.IO") return false;
  396. return true;
  397. }
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406. /*************************
  407. * Skin Changing Functions
  408. *************************/
  409.  
  410.  
  411.  
  412.  
  413. /*
  414. * Change Your Skin
  415. */
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423. // Method for overloading global functions directly (functions in objects dont need this)
  424. function addJS_Node (text, s_URL, funcToRun, runOnLoad) {
  425. var D = document;
  426. var scriptNode = D.createElement ('script');
  427. if (runOnLoad) {
  428. scriptNode.addEventListener ("load", runOnLoad, false);
  429. }
  430. scriptNode.type = "text/javascript";
  431. if (text) scriptNode.textContent = text;
  432. if (s_URL) scriptNode.src = s_URL;
  433. if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';
  434. var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
  435. targ.appendChild (scriptNode);
  436. }
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445. //$('#overlays2').append('<h6 style="margin-left:500px">Agarlist Skin Changer by Torodorable</h6>')
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458. //To turn it on press c, add skins by "skin url", enjoy
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467. }, 10000);
  468.  
  469.  
  470.  
  471.  
  472.  
  473.