Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.59 KB | None | 0 0
  1. ! function() {
  2. function i(i, t) {
  3. var n = u("<div>").attr("id", "mini-map-token-" + i).css({
  4. position: "absolute",
  5. width: "5%",
  6. height: "5%",
  7. background: t,
  8. top: "0%",
  9. left: "0%"
  10. });
  11. return n
  12. }
  13.  
  14. function t(i, t) {
  15. void 0 === window.mini_map_tokens[i] && (window.mini_map.append(t), window.mini_map_tokens[i] = t)
  16. }
  17.  
  18. function n(i) {
  19. void 0 !== window.mini_map_tokens[i] && (window.mini_map_tokens[i].detach(), delete window.mini_map_tokens[i])
  20. }
  21.  
  22. function e(i) {
  23. return void 0 !== window.mini_map_tokens[i]
  24. }
  25.  
  26. function o(i, t, n) {
  27. return void 0 !== window.mini_map_tokens[i] ? (window.mini_map_tokens[i].css("left", t / 11e3 * 90 + "%").css("top", n / 11e3 * 90 + "%"), !0) : !1
  28. }
  29.  
  30. function s(i, t) {
  31. window.mini_map_pos.text("x: " + i.toFixed(0) + ", y: " + t.toFixed(0))
  32. }
  33.  
  34. function a() {
  35. var i = window.jQuery;
  36. if (window.mini_map_tokens = {}, 0 === i("#mini-map-pos").length && (window.mini_map_pos = i("<div>").attr("id", "mini-map-pos").css({
  37. top: 10,
  38. left: 160,
  39. color: "white",
  40. background: "rgba(155, 155, 155, 0.6)",
  41. fontSize: 24,
  42. fontWeight: 800,
  43. position: "fixed",
  44. padding: "0px 10px"
  45. }).appendTo(document.body)), 0 === i("#mini-map-wrapper").length) {
  46. var t = i("<div>").attr("id", "mini-map-wrapper").css({
  47. position: "fixed",
  48. bottom: "110px",
  49. right: "10px",
  50. width: "150px",
  51. height: "150px",
  52. background: ""
  53. }),
  54. n = i("<div>").attr("id", "mini-map").css({
  55. width: "67%",
  56. height: "67%",
  57. position: "relative"
  58. });
  59. t.append(n).appendTo(document.body), window.mini_map = n
  60. }
  61. }
  62.  
  63. function r(i, t, n, e, o, s) {
  64. m[i] = this, this.id = i, this.ox = this.x = t, this.oy = this.y = n, this.oSize = this.size = e, this.color = o, this.points = [], this.pointsAcc = [], this.setName(s)
  65. }
  66.  
  67. function d(i, t, n) {
  68. Object.defineProperty(i, n, {
  69. get: function() {
  70. return t[n]
  71. },
  72. set: function(i) {
  73. t[n] = i
  74. },
  75. enumerable: !0,
  76. configurable: !0
  77. })
  78. }
  79.  
  80. function p(i, t) {
  81. var n = +new Date,
  82. e = Math.random(),
  83. o = t,
  84. s = i.getUint16(o, !0);
  85. o += 2;
  86. for (var a = 0; s > a; ++a) {
  87. var d = m[i.getUint32(o, !0)],
  88. p = m[i.getUint32(o + 4, !0)],
  89. o = o + 8;
  90. d && p && (p.destroy(), p.ox = p.x, p.oy = p.y, p.oSize = p.size, p.nx = d.x, p.ny = d.y, p.nSize = p.size, p.updateTime = n)
  91. }
  92. for (a = 0;;) {
  93. var c = i.getUint32(o, !0);
  94. if (o += 4, 0 == c) break;
  95. ++a;
  96. var d = i.getInt16(o, !0),
  97. o = o + 2,
  98. p = i.getInt16(o, !0),
  99. o = o + 2;
  100. g = i.getInt16(o, !0), o += 2;
  101. for (var h = i.getUint8(o++), u = i.getUint8(o++), l = i.getUint8(o++), h = (h << 16 | u << 8 | l).toString(16); 6 > h.length;) h = "0" + h;
  102. var h = "#" + h,
  103. w = i.getUint8(o++),
  104. u = !!(1 & w),
  105. l = !!(16 & w);
  106. 2 & w && (o += 4), 4 & w && (o += 8), 8 & w && (o += 16);
  107. for (var f, w = ""; f = i.getUint16(o, !0), o += 2, 0 != f;) w += String.fromCharCode(f);
  108. f = w, w = null, m.hasOwnProperty(c) ? (w = m[c], w.updatePos(), w.ox = w.x, w.oy = w.y, w.oSize = w.size, w.color = h) : (w = new r(c, d, p, g, h, f), w.pX = d, w.pY = p), w.isVirus = u, w.isAgitated = l, w.nx = d, w.ny = p, w.nSize = g, w.updateCode = e, w.updateTime = n, f && w.setName(f)
  109. }
  110. for (e = i.getUint32(o, !0), o += 4, a = 0; e > a; a++) c = i.getUint32(o, !0), o += 4, w = m[c], null != w && w.destroy()
  111. }
  112.  
  113. function c(i) {
  114. var t = 0,
  115. n = new DataView(i.data);
  116. switch (240 == n.getUint8(t) && (t += 5), n.getUint8(t++)) {
  117. case 16:
  118. p(n, t);
  119. break;
  120. case 20:
  121. l = [];
  122. break;
  123. case 32:
  124. var e = n.getUint32(t, !0);
  125. l.push(e)
  126. }
  127. }
  128. var h = window.WebSocket,
  129. u = window.jQuery,
  130. m = [],
  131. l = [];
  132. r.prototype = {
  133. id: 0,
  134. points: null,
  135. pointsAcc: null,
  136. name: null,
  137. nameCache: null,
  138. sizeCache: null,
  139. x: 0,
  140. y: 0,
  141. size: 0,
  142. ox: 0,
  143. oy: 0,
  144. oSize: 0,
  145. nx: 0,
  146. ny: 0,
  147. nSize: 0,
  148. updateTime: 0,
  149. updateCode: 0,
  150. drawTime: 0,
  151. destroyed: !1,
  152. isVirus: !1,
  153. isAgitated: !1,
  154. wasSimpleDrawing: !0,
  155. destroy: function() {
  156. delete m[this.id], id = l.indexOf(this.id), -1 != id && l.splice(id, 1), this.destroyed = !0, n(this.id)
  157. },
  158. setName: function(i) {
  159. this.name = i
  160. },
  161. updatePos: function() {
  162. -1 != l.indexOf(this.id) && (e(this.id) || t(this.id, i(this.id, this.color)), o(this.id, this.nx, this.ny), s(this.nx, this.ny))
  163. }
  164. }, window.WebSocket = function(i, t) {
  165. console.log("Listen"), void 0 === t && (t = []);
  166. var n = new h(i, t);
  167. d(this, n, "binaryType"), d(this, n, "bufferedAmount"), d(this, n, "extensions"), d(this, n, "protocol"), d(this, n, "readyState"), d(this, n, "url"), this.send = function(i) {
  168. return n.send.call(n, i)
  169. }, this.close = function(i, t) {
  170. return n.close.call(n, i, t)
  171. }, this.onopen = function() {}, this.onclose = function() {}, this.onerror = function() {}, this.onmessage = function() {}, n.onopen = function(i) {
  172. return this.onopen.call(n, i)
  173. }.bind(this), n.onmessage = function(i) {
  174. return c(i), this.onmessage.call(n, i)
  175. }.bind(this), n.onclose = function(i) {
  176. return this.onclose.call(n, i)
  177. }.bind(this), n.onerror = function(i) {
  178. return this.onerror.call(n, i)
  179. }.bind(this)
  180. }, window.WebSocket.prototype = h, a()
  181. }();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement