Advertisement
Guest User

Untitled

a guest
May 9th, 2015
5,654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.53 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Agar.io cheatycodes / hacks
  3. // @namespace http://agar.io/
  4. // @version 0.1
  5. // @description Random cheats to increase your cells survival rates!
  6. // @author Asexual
  7. // @match http://agar.io/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11.  
  12.  
  13. (function(g, v) {
  14. function ua() {
  15. ea();
  16. setInterval(ea, 18E4);
  17. B = S = document.getElementById("canvas");
  18. d = B.getContext("2d");
  19. B.onmousedown = function(a) {
  20. if (fa) {
  21. var b = a.clientX - (5 + m / 5 / 2), c = a.clientY - (5 + m / 5 / 2);
  22. if (Math.sqrt(b * b + c * c) <= m / 5 / 2) {
  23. G();
  24. C(17);
  25. return
  26. }
  27. }
  28. J = a.clientX;
  29. K = a.clientY;
  30. T();
  31. G()
  32. };
  33. B.onmousemove = function(a) {
  34. J = a.clientX;
  35. K = a.clientY;
  36. T()
  37. };
  38. B.onmouseup = function(a) {
  39. };
  40. var a = !1, b = !1, c = !1;
  41. g.onkeydown = function(f) {
  42. 32 != f.keyCode || a || (G(), C(17), a = !0);
  43. 81 != f.keyCode || b || (C(18), b = !0);
  44. 87 != f.keyCode || c || (G(), C(21), c = !0)
  45. };
  46. g.onkeyup = function(f) {
  47. 32 == f.keyCode && (a = !1);
  48. 87 == f.keyCode && (c = !1);
  49. 81 == f.keyCode && b && (C(19), b = !1)
  50. };
  51. g.onblur = function() {
  52. C(19);
  53. c = b = a = !1
  54. };
  55. g.onresize = ga;
  56. ga();
  57. g.requestAnimationFrame ? g.requestAnimationFrame(ha) : setInterval(U, 1E3 / 60);
  58. setInterval(G, 100);
  59. ia(v("#region").val())
  60. }
  61. function va() {
  62. for (var a = Number.POSITIVE_INFINITY, b = Number.POSITIVE_INFINITY, c = Number.NEGATIVE_INFINITY, f = Number.NEGATIVE_INFINITY, d = 0, e = 0; e < r.length; e++)
  63. d = Math.max(r[e].size, d), a = Math.min(r[e].x, a), b = Math.min(r[e].y, b), c = Math.max(r[e].x, c), f = Math.max(r[e].y, f);
  64. V = QUAD.init({minX: a - (d + 100),minY: b - (d + 100),maxX: c + (d + 100),maxY: f + (d + 100)});
  65. for (e = 0; e < r.length; e++)
  66. if (a = r[e], a.shouldRender())
  67. for (b = 0; b < a.points.length; ++b)
  68. V.insert(a.points[b])
  69. }
  70. function T() {
  71. L = (J - m / 2) / s + x;
  72. M = (K - p / 2) / s + y
  73. }
  74. function ea() {
  75. null == N && (N = {}, v("#region").children().each(function() {
  76. var a = v(this), b = a.val();
  77. b && (N[b] = a.text())
  78. }));
  79. v.get("http://m.agar.io/info", function(a) {
  80. for (var b in a.regions)
  81. v('#region option[value="' + b + '"]').text(N[b] + " (" + a.regions[b].numPlayers + " players)")
  82. },
  83. "json")
  84. }
  85. function ia(a) {
  86. a && a != W && (W = a, ja())
  87. }
  88. function ka() {
  89. v.ajax("http://m.agar.io/", {error: function() {
  90. setTimeout(ka, 1E3)
  91. },success: function(a) {
  92. a = a.split("\n");
  93. la("ws://" + a[0])
  94. },dataType: "text",method: "POST",cache: !1,crossDomain: !0,data: W || "?"})
  95. }
  96. function ja() {
  97. v("#connecting").show();
  98. ka()
  99. }
  100. function la(a) {
  101. h && (h.onopen = null, h.onmessage = null, h.onclose = null, h.close(), h = null);
  102. D = [];
  103. n = [];
  104. z = {};
  105. r = [];
  106. E = [];
  107. q = [];
  108. console.log("Connecting to " + a);
  109. h = new WebSocket(a);
  110. h.binaryType = "arraybuffer";
  111. h.onopen = wa;
  112. h.onmessage = xa;
  113. h.onclose = ya;
  114. h.onerror = function() {
  115. console.log("socket error")
  116. }
  117. }
  118. function wa(a) {
  119. v("#connecting").hide();
  120. console.log("socket open");
  121. a = new ArrayBuffer(5);
  122. var b = new DataView(a);
  123. b.setUint8(0, 255);
  124. b.setUint32(1, 1, !0);
  125. h.send(a);
  126. ma()
  127. }
  128. function ya(a) {
  129. console.log("socket close");
  130. setTimeout(ja, 500)
  131. }
  132. function xa(a) {
  133. function b() {
  134. for (var a = ""; ; ) {
  135. var b = f.getUint16(c, !0);
  136. c += 2;
  137. if (0 == b)
  138. break;
  139. a += String.fromCharCode(b)
  140. }
  141. return a
  142. }
  143. var c = 1, f = new DataView(a.data);
  144. switch (f.getUint8(0)) {
  145. case 16:
  146. za(f);
  147. break;
  148. case 20:
  149. n = [];
  150. D = [];
  151. break;
  152. case 32:
  153. D.push(f.getUint32(1, !0));
  154. break;
  155. case 48:
  156. for (q = []; c < f.byteLength; )
  157. q.push({id: 0,name: b()});
  158. na();
  159. break;
  160. case 49:
  161. a = f.getUint32(c, !0);
  162. c += 4;
  163. q = [];
  164. for (var d = 0; d < a; ++d) {
  165. var e = f.getUint32(c, !0), c = c + 4;
  166. q.push({id: e,name: b()})
  167. }
  168. na();
  169. break;
  170. case 64:
  171. X = f.getFloat64(1, !0), Y = f.getFloat64(9, !0), Z = f.getFloat64(17, !0), $ = f.getFloat64(25, !0), 0 == n.length && (x = (Z + X) / 2, y = ($ + Y) / 2)
  172. }
  173. }
  174. function za(a) {
  175. F = +new Date;
  176. var b = Math.random(), c = 1;
  177. aa = !1;
  178. for (var f = a.getUint16(c, !0), c = c + 2, d = 0; d < f; ++d) {
  179. var e = z[a.getUint32(c, !0)], t =
  180. z[a.getUint32(c + 4, !0)], c = c + 8;
  181. e && t && (t.destroy(), t.ox = t.x, t.oy = t.y, t.oSize = t.size, t.nx = e.x, t.ny = e.y, t.nSize = t.size, t.updateTime = F)
  182. }
  183. for (; ; ) {
  184. f = a.getUint32(c, !0);
  185. c += 4;
  186. if (0 == f)
  187. break;
  188. var d = a.getFloat64(c, !0), c = c + 8, e = a.getFloat64(c, !0), c = c + 8, t = a.getFloat64(c, !0), c = c + 8, l = a.getUint8(c++), h = !1;
  189. if (0 == l)
  190. h = !0, l = "#33FF33";
  191. else if (255 == l) {
  192. var h = a.getUint8(c++), l = a.getUint8(c++), g = a.getUint8(c++), l = oa(h << 16 | l << 8 | g), g = a.getUint8(c++), h = !!(g & 1);
  193. g & 2 && (c += 4);
  194. g & 4 && (c += 8);
  195. g & 8 && (c += 16)
  196. } else {
  197. var l = 63487 | l << 16, k = (l >> 16 & 255) /
  198. 255 * 360, m = (l >> 8 & 255) / 255, l = (l >> 0 & 255) / 255;
  199. if (0 == m)
  200. l = l << 16 | l << 8 | l << 0;
  201. else {
  202. var k = k / 60, g = ~~k, u = k - g, k = l * (1 - m), s = l * (1 - m * u), m = l * (1 - m * (1 - u)), p = u = 0, q = 0;
  203. switch (g % 6) {
  204. case 0:
  205. u = l;
  206. p = m;
  207. q = k;
  208. break;
  209. case 1:
  210. u = s;
  211. p = l;
  212. q = k;
  213. break;
  214. case 2:
  215. u = k;
  216. p = l;
  217. q = m;
  218. break;
  219. case 3:
  220. u = k;
  221. p = s;
  222. q = l;
  223. break;
  224. case 4:
  225. u = m;
  226. p = k;
  227. q = l;
  228. break;
  229. case 5:
  230. u = l, p = k, q = s
  231. }
  232. u = ~~(255 * u) & 255;
  233. p = ~~(255 * p) & 255;
  234. q = ~~(255 * q) & 255;
  235. l = u << 16 | p << 8 | q
  236. }
  237. l = oa(l)
  238. }
  239. for (g = ""; ; ) {
  240. k = a.getUint16(c, !0);
  241. c += 2;
  242. if (0 == k)
  243. break;
  244. g += String.fromCharCode(k)
  245. }
  246. k = null;
  247. z.hasOwnProperty(f) ? (k = z[f], k.updatePos(), k.ox =
  248. k.x, k.oy = k.y, k.oSize = k.size, k.color = l) : (k = new pa(f, d, e, t, l, h, g), k.pX = d, k.pY = e);
  249. k.nx = d;
  250. k.ny = e;
  251. k.nSize = t;
  252. k.updateCode = b;
  253. k.updateTime = F;
  254. -1 != D.indexOf(f) && -1 == n.indexOf(k) && (document.getElementById("overlays").style.display = "none", n.push(k), 1 == n.length && (x = k.x, y = k.y))
  255. }
  256. a.getUint16(c, !0);
  257. c += 2;
  258. e = a.getUint32(c, !0);
  259. c += 4;
  260. for (d = 0; d < e; d++)
  261. f = a.getUint32(c, !0), c += 4, z[f] && (z[f].updateCode = b);
  262. for (d = 0; d < r.length; d++)
  263. r[d].updateCode != b && r[d--].destroy();
  264. aa && 0 == n.length && v("#overlays").fadeIn(3E3)
  265. }
  266. function G() {
  267. if (null != h && h.readyState == h.OPEN) {
  268. var a = J - m / 2, b = K - p / 2;
  269. 64 > a * a + b * b || qa == L && ra == M || (qa = L, ra = M, a = new ArrayBuffer(21), b = new DataView(a), b.setUint8(0, 16), b.setFloat64(1, L, !0), b.setFloat64(9, M, !0), b.setUint32(17, 0, !0), h.send(a))
  270. }
  271. }
  272. function ma() {
  273. if (null != h && h.readyState == h.OPEN && null != H) {
  274. var a = new ArrayBuffer(1 + 2 * H.length), b = new DataView(a);
  275. b.setUint8(0, 0);
  276. for (var c = 0; c < H.length; ++c)
  277. b.setUint16(1 + 2 * c, H.charCodeAt(c), !0);
  278. h.send(a)
  279. }
  280. }
  281. function C(a) {
  282. if (null != h && h.readyState == h.OPEN) {
  283. var b = new ArrayBuffer(1);
  284. (new DataView(b)).setUint8(0, a);
  285. h.send(b)
  286. }
  287. }
  288. function ha() {
  289. U();
  290. g.requestAnimationFrame(ha)
  291. }
  292. function ga() {
  293. m = g.innerWidth;
  294. p = g.innerHeight;
  295. S.width = B.width = m;
  296. S.height = B.height = p;
  297. U()
  298. }
  299. function Aa() {
  300. if (0 != n.length) {
  301. for (var a = 0, b = 0; b < n.length; b++)
  302. a += n[b].size;
  303. a = Math.pow(Math.min(64 / a, 1), .4) * Math.max(p / 965, m / 1920);
  304. s = (9 * s + a) / 10
  305. }
  306. }
  307. function U() {
  308. var a = +new Date;
  309. ++Ba;
  310. Aa();
  311. F = +new Date;
  312. if (0 < n.length) {
  313. for (var b = 0, c = 0, f = 0; f < n.length; f++)
  314. n[f].updatePos(), b += n[f].x / n.length, c += n[f].y / n.length;
  315. x = (x + b) / 2;
  316. y = (y + c) / 2
  317. }
  318. va();
  319. T();
  320. d.clearRect(0, 0, m, p);
  321. d.fillStyle =
  322. ba ? "#111111" : "#F2FBFF";
  323. d.fillRect(0, 0, m, p);
  324. d.save();
  325. d.strokeStyle = ba ? "#AAAAAA" : "#000000";
  326. d.globalAlpha = .2;
  327.  
  328. s = 0.2;
  329.  
  330. d.scale(s, s);
  331. b = m / s;
  332. c = p / s;
  333. for (f = -.5 + (-x + b / 2) % 50; f < b; f += 50)
  334. d.beginPath(), d.moveTo(f, 0), d.lineTo(f, c), d.stroke();
  335. for (f = -.5 + (-y + c / 2) % 50; f < c; f += 50)
  336. d.beginPath(), d.moveTo(0, f), d.lineTo(b, f), d.stroke();
  337. d.restore();
  338. r.sort(function(a, b) {
  339. return a.size == b.size ? a.id - b.id : a.size - b.size
  340. });
  341. d.save();
  342. d.translate(m / 2, p / 2);
  343. d.scale(s, s);
  344. d.translate(-x, -y);
  345. for (f = 0; f < E.length; f++)
  346. E[f].draw();
  347. for (f = 0; f < r.length; f++)
  348. r[f].draw();
  349. d.restore();
  350. A && 0 != q.length && d.drawImage(A, m - A.width - 10, 10);
  351. I = Math.max(I, Ca());
  352. 0 != I && (null == O && (O = new P(24, "#FFFFFF")), O.setValue("Score: " + ~~(I / 100)), c = O.render(), b = c.width, d.globalAlpha = .2, d.fillStyle = "#000000", d.fillRect(10, p - 10 - 24 - 10, b + 10, 34), d.globalAlpha = 1, d.drawImage(c, 15, p - 10 - 24 - 5));
  353. Da();
  354. a = +new Date - a;
  355. a > 1E3 / 60 ? w -= .01 : a < 1E3 / 65 && (w += .01);
  356. .4 > w && (w = .4);
  357. 1 < w && (w = 1)
  358. }
  359. function Da() {
  360. if (fa && ca.width) {
  361. var a = m / 5;
  362. d.drawImage(ca, 5, 5, a, a)
  363. }
  364. }
  365. function Ca() {
  366. for (var a = 0, b = 0; b < n.length; b++)
  367. a += n[b].nSize * n[b].nSize;
  368. return a
  369. }
  370. function na() {
  371. if (0 != q.length)
  372. if (Q) {
  373. A = document.createElement("canvas");
  374. var a = A.getContext("2d"), b = 60 + 24 * q.length, c = Math.min(200, .3 * m) / 200;
  375. A.width = 200 * c;
  376. A.height = b * c;
  377. a.scale(c, c);
  378. a.globalAlpha = .4;
  379. a.fillStyle = "#000000";
  380. a.fillRect(0, 0, 200, b);
  381. a.globalAlpha = 1;
  382. a.fillStyle = "#FFFFFF";
  383. c = null;
  384. c = "Asexual Cheats";
  385. a.font = "20px Ubuntu";
  386. a.fillText(c, 100 - a.measureText(c).width / 2, 40);
  387. a.font = "20px Ubuntu";
  388. for (b = 0; b < q.length; ++b)
  389. c = q[b].name || "An unnamed cell", -1 != n.indexOf(q[b].id) && (c = n[0].name), Q || 0 != n.length &&
  390. n[0].name == c || (c = "An unnamed cell"), c = b + 1 + ". " + c, a.fillText(c, 100 - a.measureText(c).width / 2, 70 + 24 * b)
  391. } else
  392. A = null
  393. }
  394. function pa(a, b, c, d, g, e, h) {
  395. r.push(this);
  396. z[a] = this;
  397. this.id = a;
  398. this.ox = this.x = b;
  399. this.oy = this.y = c;
  400. this.oSize = this.size = d;
  401. this.color = g;
  402. this.isVirus = e;
  403. this.points = [];
  404. this.pointsAcc = [];
  405. this.createPoints();
  406. this.setName(h)
  407. }
  408. function oa(a) {
  409. for (a = a.toString(16); 6 > a.length; )
  410. a = "0" + a;
  411. return "#" + a
  412. }
  413. function P(a, b, c, d) {
  414. a && (this._size = a);
  415. b && (this._color = b);
  416. this._stroke = !!c;
  417. d && (this._strokeColor = d)
  418. }
  419. if ("agar.io" != g.location.hostname && "localhost" != g.location.hostname && "10.10.2.13" != g.location.hostname)
  420. g.location = "http://agar.io/";
  421. else {
  422. var S, d, B, m, p, V = null, h = null, x = 0, y = 0, D = [], n = [], z = {}, r = [], E = [], q = [], J = 0, K = 0, L = -1, M = -1, Ba = 0, F = 0, H = null, X = 0, Y = 0, Z = 1E4, $ = 1E4, s = 1, W = null, sa = !0, Q = !0, da = !1, aa = !1, I = 0, ba = !1, ta = !1, fa = "ontouchstart" in g && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), ca = new Image;
  423. ca.src = "img/split.png";
  424. var N = null;
  425. g.setNick = function(a) {
  426. v("#adsBottom").hide();
  427. H = a;
  428. ma();
  429. v("#overlays").hide();
  430. I = 0
  431. };
  432. g.setRegion = ia;
  433. g.setSkins = function(a) {
  434. sa = a
  435. };
  436. g.setNames = function(a) {
  437. Q = a
  438. };
  439. g.setDarkTheme = function(a) {
  440. ba = a
  441. };
  442. g.setColors = function(a) {
  443. da = a
  444. };
  445. g.setShowMass = function(a) {
  446. ta = a
  447. };
  448. g.connect = la;
  449. var qa = -1, ra = -1, A = null, w = 1, O = null, R = {}, Ea = "poland;usa;china;russia;canada;australia;spain;brazil;germany;ukraine;france;sweden;hitler;north korea;south korea;japan;united kingdom;earth;greece;latvia;lithuania;estonia;finland;norway;cia;maldivas;austria;nigeria;reddit;yaranaika;confederate;9gag;indiana;4chan;italy;ussr;pewdiepie;bulgaria;tumblr;2ch.hk;hong kong;portugal;jamaica;german empire;mexico;sanik;switzerland;croatia;chile;indonesia;bangladesh;thailand;iran;iraq;peru;moon;botswana;bosnia;netherlands;european union;taiwan;pakistan;hungary;satanist;qing dynasty;nazi;matriarchy;patriarchy;feminism;ireland;texas;facepunch;prodota;cambodia;steam;piccolo;ea;india;kc;denmark;quebec;ayy lmao;sealand;bait;tsarist russia;origin;vinesauce;stalin;belgium;luxembourg;stussy;prussia;8ch;argentina;scotland;sir;romania;belarus;wojak;isis;doge".split(";"), Fa = ["m'blob"];
  450. pa.prototype = {id: 0,points: null,pointsAcc: null,name: null,nameCache: null,sizeCache: null,x: 0,y: 0,size: 0,ox: 0,oy: 0,oSize: 0,nx: 0,ny: 0,nSize: 0,updateTime: 0,updateCode: 0,drawTime: 0,destroyed: !1,isVirus: !1,destroy: function() {
  451. var a;
  452. for (a = 0; a < r.length; a++)
  453. if (r[a] == this) {
  454. r.splice(a, 1);
  455. break
  456. }
  457. delete z[this.id];
  458. a = n.indexOf(this);
  459. -1 != a && (aa = !0, n.splice(a, 1));
  460. a = D.indexOf(this.id);
  461. -1 != a && D.splice(a, 1);
  462. this.destroyed = !0;
  463. E.push(this)
  464. },getNameSize: function() {
  465. return Math.max(~~(.3 * this.size), 24)
  466. },setName: function(a) {
  467. if (this.name = a)
  468. null == this.nameCache ? this.nameCache = new P(this.getNameSize(), "#FFFFFF", !0, "#000000") : this.nameCache.setSize(this.getNameSize()), this.nameCache.setValue(this.name)
  469. },createPoints: function() {
  470. for (var a = this.getNumPoints(); this.points.length > a; ) {
  471. var b = ~~(Math.random() * this.points.length);
  472. this.points.splice(b, 1);
  473. this.pointsAcc.splice(b, 1)
  474. }
  475. 0 == this.points.length && 0 < a && (this.points.push({c: this,v: this.size,x: this.x,y: this.y}), this.pointsAcc.push(Math.random() - .5));
  476. for (; this.points.length < a; ) {
  477. var b = ~~(Math.random() * this.points.length), c = this.points[b];
  478. this.points.splice(b, 0, {c: this,v: c.v,x: c.x,y: c.y});
  479. this.pointsAcc.splice(b, 0, this.pointsAcc[b])
  480. }
  481. },getNumPoints: function() {
  482. return ~~Math.max(this.size * s * (this.isVirus ? Math.min(2 * w, 1) : w), this.isVirus ? 10 : 5)
  483. },movePoints: function() {
  484. this.createPoints();
  485. for (var a = this.points, b = this.pointsAcc, c = b.concat(), d = a.concat(), g = d.length, e = 0; e < g; ++e) {
  486. var h = c[(e - 1 + g) % g], l = c[(e + 1) % g];
  487. b[e] += Math.random() - .5;
  488. b[e] *= .7;
  489. 10 < b[e] && (b[e] = 10);
  490. -10 > b[e] && (b[e] = -10);
  491. b[e] = (h + l + 8 * b[e]) / 10
  492. }
  493. for (var n =
  494. this, e = 0; e < g; ++e) {
  495. c = d[e].v;
  496. h = d[(e - 1 + g) % g].v;
  497. l = d[(e + 1) % g].v;
  498. if (15 < this.size) {
  499. var m = !1, k = a[e].x, p = a[e].y;
  500. V.retrieve2(k - 5, p - 5, 10, 10, function(a) {
  501. a.c != n && 25 > (k - a.x) * (k - a.x) + (p - a.y) * (p - a.y) && (m = !0)
  502. });
  503. !m && (a[e].x < X || a[e].y < Y || a[e].x > Z || a[e].y > $) && (m = !0);
  504. m && (0 < b[e] && (b[e] = 0), b[e] -= 1)
  505. }
  506. c += b[e];
  507. 0 > c && (c = 0);
  508. c = (12 * c + this.size) / 13;
  509. a[e].v = (h + l + 8 * c) / 10;
  510. h = 2 * Math.PI / g;
  511. l = this.points[e].v;
  512. this.isVirus && 0 == e % 2 && (l += 5);
  513. a[e].x = this.x + Math.cos(h * e) * l;
  514. a[e].y = this.y + Math.sin(h * e) * l
  515. }
  516. },updatePos: function() {
  517. var a;
  518. a = (F - this.updateTime) /
  519. 120;
  520. a = 0 > a ? 0 : 1 < a ? 1 : a;
  521. a = a * a * (3 - 2 * a);
  522. var b = this.getNameSize();
  523. if (this.destroyed && 1 <= a) {
  524. var c = E.indexOf(this);
  525. -1 != c && E.splice(c, 1)
  526. }
  527. this.x = a * (this.nx - this.ox) + this.ox;
  528. this.y = a * (this.ny - this.oy) + this.oy;
  529. this.size = a * (this.nSize - this.oSize) + this.oSize;
  530. this.destroyed || b == this.getNameSize() || this.setName(this.name);
  531. return a
  532. },shouldRender: function() {
  533. return this.x + this.size + 40 < x - m / 2 / s || this.y + this.size + 40 < y - p / 2 / s || this.x - this.size - 40 > x + m / 2 / s || this.y - this.size - 40 > y + p / 2 / s ? !1 : !0
  534. },draw: function() {
  535. if (this.shouldRender()) {
  536. d.save();
  537. this.drawTime = F;
  538. var a = this.updatePos();
  539. this.destroyed && (d.globalAlpha *= 1 - a);
  540. this.movePoints();
  541. da ? (d.fillStyle = "#FFFFFF", d.strokeStyle = "#AAAAAA") : (d.fillStyle = this.color, d.strokeStyle = this.color);
  542. d.beginPath();
  543. d.lineWidth = 10;
  544. d.lineCap = "round";
  545. d.lineJoin = this.isVirus ? "mitter" : "round";
  546. a = this.getNumPoints();
  547. d.moveTo(this.points[0].x, this.points[0].y);
  548. for (var b = 1; b <= a; ++b) {
  549. var c = b % a;
  550. d.lineTo(this.points[c].x, this.points[c].y)
  551. }
  552. d.closePath();
  553. a = this.name.toLowerCase();
  554. sa ? -1 != Ea.indexOf(a) ? (R.hasOwnProperty(a) || (R[a] = new Image, R[a].src = "skins/" + a + ".png"), b = R[a]) : b = null : b = null;
  555. a = b ? -1 != Fa.indexOf(a) : !1;
  556. d.stroke();
  557. d.fill();
  558. null != b && 0 < b.width && !a && (d.save(), d.clip(), d.drawImage(b, this.x - this.size, this.y - this.size, 2 * this.size, 2 * this.size), d.restore());
  559. if (da || 15 < this.size)
  560. d.strokeStyle = "#000000", d.globalAlpha *= .1, d.stroke();
  561. d.globalAlpha = 1;
  562. null != b && 0 < b.width && a && d.drawImage(b, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size);
  563. a = -1 != n.indexOf(this);
  564. b = ~~this.y;
  565. (Q || a) && this.name && this.nameCache && (c = this.nameCache.render(), d.drawImage(c, ~~this.x - ~~(c.width / 2), b - ~~(c.height / 2)), b += c.height / 2 + 4);
  566. ta && a && (null == this.sizeCache && (this.sizeCache = new P(this.getNameSize() / 2, "#FFFFFF", !0, "#000000")), this.sizeCache.setSize(this.getNameSize() / 2), this.sizeCache.setValue(~~(this.size * this.size / 100)), c = this.sizeCache.render(), d.drawImage(c, ~~this.x - ~~(c.width / 2), b - ~~(c.height / 2)));
  567. d.restore()
  568. }
  569. }};
  570. P.prototype = {_value: "",_color: "#000000",_stroke: !1,_strokeColor: "#000000",_size: 16,_canvas: null,_ctx: null,_dirty: !1,setSize: function(a) {
  571. this._size !=
  572. a && (this._size = a, this._dirty = !0)
  573. },setColor: function(a) {
  574. this._color != a && (this._color = a, this._dirty = !0)
  575. },setStroke: function(a) {
  576. this._stroke != a && (this._stroke = a, this._dirty = !0)
  577. },setStrokeColor: function(a) {
  578. this._strokeColor != a && (this._strokeColor = a, this._dirty = !0)
  579. },setValue: function(a) {
  580. a != this._value && (this._value = a, this._dirty = !0)
  581. },render: function() {
  582. null == this._canvas && (this._canvas = document.createElement("canvas"), this._ctx = this._canvas.getContext("2d"));
  583. if (this._dirty) {
  584. var a = this._canvas, b = this._ctx, c = this._value, d = this._size, g = d + "px Ubuntu";
  585. b.font = g;
  586. var e = b.measureText(c).width, h = ~~(.2 * d);
  587. a.width = e + 6;
  588. a.height = d + h;
  589. b.font = g;
  590. b.globalAlpha = 1;
  591. b.lineWidth = 3;
  592. b.strokeStyle = this._strokeColor;
  593. b.fillStyle = this._color;
  594. this._stroke && b.strokeText(c, 3, d - h / 2);
  595. b.fillText(c, 3, d - h / 2)
  596. }
  597. return this._canvas
  598. }};
  599. g.onload = ua
  600. }
  601. })(window, jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement