Loger1

Untitled

Jul 16th, 2019
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 117.89 KB | None | 0 0
  1. var Sregion = null;
  2. var Sspec = false;
  3. var rndms = Math.floor(Math.random() * (2 - 1) + 1);
  4. var blobImage = new Image();
  5. blobImage.src = '/img/gum.png';
  6. var arrow = new Image;
  7. arrow.src = "/img/arrow.png?v=1400";
  8. var arrow2 = new Image;
  9. arrow2.src = "/img/arrow.png?v=1401";
  10. this.msgpack || (function(globalScope) {
  11.  
  12. globalScope.msgpack = {
  13. pack: msgpackpack, // msgpack.pack(data:Mix,
  14. // toString:Boolean = false):ByteArray/ByteString/false
  15. // [1][mix to String] msgpack.pack({}, true) -> "..."
  16. // [2][mix to ByteArray] msgpack.pack({}) -> [...]
  17. unpack: msgpackunpack, // msgpack.unpack(data:BinaryString/ByteArray):Mix
  18. // [1][String to mix] msgpack.unpack("...") -> {}
  19. // [2][ByteArray to mix] msgpack.unpack([...]) -> {}
  20. worker: "msgpack.js", // msgpack.worker - WebWorkers script filename
  21. upload: msgpackupload, // msgpack.upload(url:String, option:Hash, callback:Function)
  22. download: msgpackdownload // msgpack.download(url:String, option:Hash, callback:Function)
  23. };
  24.  
  25. var _ie = /MSIE/.test(navigator.userAgent),
  26. _bin2num = {}, // BinaryStringToNumber { "\00": 0, ... "\ff": 255 }
  27. _num2bin = {}, // NumberToBinaryString { 0: "\00", ... 255: "\ff" }
  28. _num2b64 = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
  29. "abcdefghijklmnopqrstuvwxyz0123456789+/").split(""),
  30. _buf = [], // decode buffer
  31. _idx = 0, // decode buffer[index]
  32. _error = 0, // msgpack.pack() error code. 1 = CYCLIC_REFERENCE_ERROR
  33. _isArray = Array.isArray || (function(mix) {
  34. return Object.prototype.toString.call(mix) === "[object Array]";
  35. }),
  36. _toString = String.fromCharCode, // CharCode/ByteArray to String
  37. _MAX_DEPTH = 512;
  38.  
  39. // for WebWorkers Code Block
  40. self.importScripts && (onmessage = function(event) {
  41. if (event.data.method === "pack") {
  42. postMessage(base64encode(msgpackpack(event.data.data)));
  43. } else {
  44. postMessage(msgpackunpack(event.data.data));
  45. }
  46. });
  47.  
  48. // msgpack.pack
  49. function msgpackpack(data, // @param Mix:
  50. toString) { // @param Boolean(= false):
  51. // @return ByteArray/BinaryString/false:
  52. // false is error return
  53. // [1][mix to String] msgpack.pack({}, true) -> "..."
  54. // [2][mix to ByteArray] msgpack.pack({}) -> [...]
  55.  
  56. _error = 0;
  57.  
  58. var byteArray = encode([], data, 0);
  59.  
  60. return _error ? false :
  61. toString ? byteArrayToByteString(byteArray) :
  62. byteArray;
  63. }
  64.  
  65. // msgpack.unpack
  66. function msgpackunpack(data) { // @param BinaryString/ByteArray:
  67. // @return Mix/undefined:
  68. // undefined is error return
  69. // [1][String to mix] msgpack.unpack("...") -> {}
  70. // [2][ByteArray to mix] msgpack.unpack([...]) -> {}
  71.  
  72. _buf = typeof data === "string" ? toByteArray(data) : data;
  73. _idx = -1;
  74. return decode(); // mix or undefined
  75. }
  76.  
  77. // inner - encoder
  78. function encode(rv, // @param ByteArray: result
  79. mix, // @param Mix: source data
  80. depth) { // @param Number: depth
  81. var size, i, iz, c, pos, // for UTF8.encode, Array.encode, Hash.encode
  82. high, low, sign, exp, frac; // for IEEE754
  83.  
  84. if (mix == null) { // null or undefined -> 0xc0 ( null )
  85. rv.push(0xc0);
  86. } else if (mix === false) { // false -> 0xc2 ( false )
  87. rv.push(0xc2);
  88. } else if (mix === true) { // true -> 0xc3 ( true )
  89. rv.push(0xc3);
  90. } else {
  91. switch (typeof mix) {
  92. case "number":
  93. if (mix !== mix) { // isNaN
  94. rv.push(0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff); // quiet NaN
  95. } else if (mix === Infinity) {
  96. rv.push(0xcb, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); // positive infinity
  97. } else if (Math.floor(mix) === mix) { // int or uint
  98. if (mix < 0) {
  99. // int
  100. if (mix >= -32) { // negative fixnum
  101. rv.push(0xe0 + mix + 32);
  102. } else if (mix > -0x80) {
  103. rv.push(0xd0, mix + 0x100);
  104. } else if (mix > -0x8000) {
  105. mix += 0x10000;
  106. rv.push(0xd1, mix >> 8, mix & 0xff);
  107. } else if (mix > -0x80000000) {
  108. mix += 0x100000000;
  109. rv.push(0xd2, mix >>> 24, (mix >> 16) & 0xff,
  110. (mix >> 8) & 0xff, mix & 0xff);
  111. } else {
  112. high = Math.floor(mix / 0x100000000);
  113. low = mix & 0xffffffff;
  114. rv.push(0xd3, (high >> 24) & 0xff, (high >> 16) & 0xff,
  115. (high >> 8) & 0xff, high & 0xff,
  116. (low >> 24) & 0xff, (low >> 16) & 0xff,
  117. (low >> 8) & 0xff, low & 0xff);
  118. }
  119. } else {
  120. // uint
  121. if (mix < 0x80) {
  122. rv.push(mix); // positive fixnum
  123. } else if (mix < 0x100) { // uint 8
  124. rv.push(0xcc, mix);
  125. } else if (mix < 0x10000) { // uint 16
  126. rv.push(0xcd, mix >> 8, mix & 0xff);
  127. } else if (mix < 0x100000000) { // uint 32
  128. rv.push(0xce, mix >>> 24, (mix >> 16) & 0xff,
  129. (mix >> 8) & 0xff, mix & 0xff);
  130. } else {
  131. high = Math.floor(mix / 0x100000000);
  132. low = mix & 0xffffffff;
  133. rv.push(0xcf, (high >> 24) & 0xff, (high >> 16) & 0xff,
  134. (high >> 8) & 0xff, high & 0xff,
  135. (low >> 24) & 0xff, (low >> 16) & 0xff,
  136. (low >> 8) & 0xff, low & 0xff);
  137. }
  138. }
  139. } else { // double
  140. // THX!! @edvakf
  141. // http://javascript.g.hatena.ne.jp/edvakf/20101128/1291000731
  142. sign = mix < 0;
  143. sign && (mix *= -1);
  144.  
  145. // add offset 1023 to ensure positive
  146. // 0.6931471805599453 = Math.LN2;
  147. exp = ((Math.log(mix) / 0.6931471805599453) + 1023) | 0;
  148.  
  149. // shift 52 - (exp - 1023) bits to make integer part exactly 53 bits,
  150. // then throw away trash less than decimal point
  151. frac = mix * Math.pow(2, 52 + 1023 - exp);
  152.  
  153. // S+-Exp(11)--++-----------------Fraction(52bits)-----------------------+
  154. // || || |
  155. // v+----------++--------------------------------------------------------+
  156. // 00000000|00000000|00000000|00000000|00000000|00000000|00000000|00000000
  157. // 6 5 55 4 4 3 2 1 8 0
  158. // 3 6 21 8 0 2 4 6
  159. //
  160. // +----------high(32bits)-----------+ +----------low(32bits)------------+
  161. // | | | |
  162. // +---------------------------------+ +---------------------------------+
  163. // 3 2 21 1 8 0
  164. // 1 4 09 6
  165. low = frac & 0xffffffff;
  166. sign && (exp |= 0x800);
  167. high = ((frac / 0x100000000) & 0xfffff) | (exp << 20);
  168.  
  169. rv.push(0xcb, (high >> 24) & 0xff, (high >> 16) & 0xff,
  170. (high >> 8) & 0xff, high & 0xff,
  171. (low >> 24) & 0xff, (low >> 16) & 0xff,
  172. (low >> 8) & 0xff, low & 0xff);
  173. }
  174. break;
  175. case "string":
  176. // http://d.hatena.ne.jp/uupaa/20101128
  177. iz = mix.length;
  178. pos = rv.length; // keep rewrite position
  179.  
  180. rv.push(0); // placeholder
  181.  
  182. // utf8.encode
  183. for (i = 0; i < iz; ++i) {
  184. c = mix.charCodeAt(i);
  185. if (c < 0x80) { // ASCII(0x00 ~ 0x7f)
  186. rv.push(c & 0x7f);
  187. } else if (c < 0x0800) {
  188. rv.push(((c >>> 6) & 0x1f) | 0xc0, (c & 0x3f) | 0x80);
  189. } else if (c < 0x10000) {
  190. rv.push(((c >>> 12) & 0x0f) | 0xe0,
  191. ((c >>> 6) & 0x3f) | 0x80, (c & 0x3f) | 0x80);
  192. }
  193. }
  194. size = rv.length - pos - 1;
  195.  
  196. if (size < 32) {
  197. rv[pos] = 0xa0 + size; // rewrite
  198. } else if (size < 0x10000) { // 16
  199. rv.splice(pos, 1, 0xda, size >> 8, size & 0xff);
  200. } else if (size < 0x100000000) { // 32
  201. rv.splice(pos, 1, 0xdb,
  202. size >>> 24, (size >> 16) & 0xff,
  203. (size >> 8) & 0xff, size & 0xff);
  204. }
  205. break;
  206. default: // array or hash
  207. if (++depth >= _MAX_DEPTH) {
  208. _error = 1; // CYCLIC_REFERENCE_ERROR
  209. return rv = []; // clear
  210. }
  211. if (_isArray(mix)) {
  212. size = mix.length;
  213. if (size < 16) {
  214. rv.push(0x90 + size);
  215. } else if (size < 0x10000) { // 16
  216. rv.push(0xdc, size >> 8, size & 0xff);
  217. } else if (size < 0x100000000) { // 32
  218. rv.push(0xdd, size >>> 24, (size >> 16) & 0xff,
  219. (size >> 8) & 0xff, size & 0xff);
  220. }
  221. for (i = 0; i < size; ++i) {
  222. encode(rv, mix[i], depth);
  223. }
  224. } else { // hash
  225. // http://d.hatena.ne.jp/uupaa/20101129
  226. pos = rv.length; // keep rewrite position
  227. rv.push(0); // placeholder
  228. size = 0;
  229. for (i in mix) {
  230. ++size;
  231. encode(rv, i, depth);
  232. encode(rv, mix[i], depth);
  233. }
  234. if (size < 16) {
  235. rv[pos] = 0x80 + size; // rewrite
  236. } else if (size < 0x10000) { // 16
  237. rv.splice(pos, 1, 0xde, size >> 8, size & 0xff);
  238. } else if (size < 0x100000000) { // 32
  239. rv.splice(pos, 1, 0xdf,
  240. size >>> 24, (size >> 16) & 0xff,
  241. (size >> 8) & 0xff, size & 0xff);
  242. }
  243. }
  244. }
  245. }
  246. return rv;
  247. }
  248.  
  249. // inner - decoder
  250. function decode() { // @return Mix:
  251. var size, i, iz, c, num = 0,
  252. sign, exp, frac, ary, hash,
  253. buf = _buf,
  254. type = buf[++_idx];
  255.  
  256. if (type >= 0xe0) { // Negative FixNum (111x xxxx) (-32 ~ -1)
  257. return type - 0x100;
  258. }
  259. if (type < 0xc0) {
  260. if (type < 0x80) { // Positive FixNum (0xxx xxxx) (0 ~ 127)
  261. return type;
  262. }
  263. if (type < 0x90) { // FixMap (1000 xxxx)
  264. num = type - 0x80;
  265. type = 0x80;
  266. } else if (type < 0xa0) { // FixArray (1001 xxxx)
  267. num = type - 0x90;
  268. type = 0x90;
  269. } else { // if (type < 0xc0) { // FixRaw (101x xxxx)
  270. num = type - 0xa0;
  271. type = 0xa0;
  272. }
  273. }
  274. switch (type) {
  275. case 0xc0:
  276. return null;
  277. case 0xc2:
  278. return false;
  279. case 0xc3:
  280. return true;
  281. case 0xca: // float
  282. num = buf[++_idx] * 0x1000000 + (buf[++_idx] << 16) +
  283. (buf[++_idx] << 8) + buf[++_idx];
  284. sign = num & 0x80000000; // 1bit
  285. exp = (num >> 23) & 0xff; // 8bits
  286. frac = num & 0x7fffff; // 23bits
  287. if (!num || num === 0x80000000) { // 0.0 or -0.0
  288. return 0;
  289. }
  290. if (exp === 0xff) { // NaN or Infinity
  291. return frac ? NaN : Infinity;
  292. }
  293. return (sign ? -1 : 1) *
  294. (frac | 0x800000) * Math.pow(2, exp - 127 - 23); // 127: bias
  295. case 0xcb: // double
  296. num = buf[++_idx] * 0x1000000 + (buf[++_idx] << 16) +
  297. (buf[++_idx] << 8) + buf[++_idx];
  298. sign = num & 0x80000000; // 1bit
  299. exp = (num >> 20) & 0x7ff; // 11bits
  300. frac = num & 0xfffff; // 52bits - 32bits (high word)
  301. if (!num || num === 0x80000000) { // 0.0 or -0.0
  302. _idx += 4;
  303. return 0;
  304. }
  305. if (exp === 0x7ff) { // NaN or Infinity
  306. _idx += 4;
  307. return frac ? NaN : Infinity;
  308. }
  309. num = buf[++_idx] * 0x1000000 + (buf[++_idx] << 16) +
  310. (buf[++_idx] << 8) + buf[++_idx];
  311. return (sign ? -1 : 1) *
  312. ((frac | 0x100000) * Math.pow(2, exp - 1023 - 20) // 1023: bias
  313. +
  314. num * Math.pow(2, exp - 1023 - 52));
  315. // 0xcf: uint64, 0xce: uint32, 0xcd: uint16
  316. case 0xcf:
  317. num = buf[++_idx] * 0x1000000 + (buf[++_idx] << 16) +
  318. (buf[++_idx] << 8) + buf[++_idx];
  319. return num * 0x100000000 +
  320. buf[++_idx] * 0x1000000 + (buf[++_idx] << 16) +
  321. (buf[++_idx] << 8) + buf[++_idx];
  322. case 0xce:
  323. num += buf[++_idx] * 0x1000000 + (buf[++_idx] << 16);
  324. case 0xcd:
  325. num += buf[++_idx] << 8;
  326. case 0xcc:
  327. return num + buf[++_idx];
  328. // 0xd3: int64, 0xd2: int32, 0xd1: int16, 0xd0: int8
  329. case 0xd3:
  330. num = buf[++_idx];
  331. if (num & 0x80) { // sign -> avoid overflow
  332. return ((num ^ 0xff) * 0x100000000000000 +
  333. (buf[++_idx] ^ 0xff) * 0x1000000000000 +
  334. (buf[++_idx] ^ 0xff) * 0x10000000000 +
  335. (buf[++_idx] ^ 0xff) * 0x100000000 +
  336. (buf[++_idx] ^ 0xff) * 0x1000000 +
  337. (buf[++_idx] ^ 0xff) * 0x10000 +
  338. (buf[++_idx] ^ 0xff) * 0x100 +
  339. (buf[++_idx] ^ 0xff) + 1) * -1;
  340. }
  341. return num * 0x100000000000000 +
  342. buf[++_idx] * 0x1000000000000 +
  343. buf[++_idx] * 0x10000000000 +
  344. buf[++_idx] * 0x100000000 +
  345. buf[++_idx] * 0x1000000 +
  346. buf[++_idx] * 0x10000 +
  347. buf[++_idx] * 0x100 +
  348. buf[++_idx];
  349. case 0xd2:
  350. num = buf[++_idx] * 0x1000000 + (buf[++_idx] << 16) +
  351. (buf[++_idx] << 8) + buf[++_idx];
  352. return num < 0x80000000 ? num : num - 0x100000000; // 0x80000000 * 2
  353. case 0xd1:
  354. num = (buf[++_idx] << 8) + buf[++_idx];
  355. return num < 0x8000 ? num : num - 0x10000; // 0x8000 * 2
  356. case 0xd0:
  357. num = buf[++_idx];
  358. return num < 0x80 ? num : num - 0x100; // 0x80 * 2
  359. // 0xdb: raw32, 0xda: raw16, 0xa0: raw ( string )
  360. case 0xdb:
  361. num += buf[++_idx] * 0x1000000 + (buf[++_idx] << 16);
  362. case 0xda:
  363. num += (buf[++_idx] << 8) + buf[++_idx];
  364. case 0xa0: // utf8.decode
  365. for (ary = [], i = _idx, iz = i + num; i < iz;) {
  366. c = buf[++i]; // lead byte
  367. ary.push(c < 0x80 ? c : // ASCII(0x00 ~ 0x7f)
  368. c < 0xe0 ? ((c & 0x1f) << 6 | (buf[++i] & 0x3f)) :
  369. ((c & 0x0f) << 12 | (buf[++i] & 0x3f) << 6 |
  370. (buf[++i] & 0x3f)));
  371. }
  372. _idx = i;
  373. return ary.length < 10240 ? _toString.apply(null, ary) :
  374. byteArrayToByteString(ary);
  375. // 0xdf: map32, 0xde: map16, 0x80: map
  376. case 0xdf:
  377. num += buf[++_idx] * 0x1000000 + (buf[++_idx] << 16);
  378. case 0xde:
  379. num += (buf[++_idx] << 8) + buf[++_idx];
  380. case 0x80:
  381. hash = {};
  382. while (num--) {
  383. // make key/value pair
  384. size = buf[++_idx] - 0xa0;
  385.  
  386. for (ary = [], i = _idx, iz = i + size; i < iz;) {
  387. c = buf[++i]; // lead byte
  388. ary.push(c < 0x80 ? c : // ASCII(0x00 ~ 0x7f)
  389. c < 0xe0 ? ((c & 0x1f) << 6 | (buf[++i] & 0x3f)) :
  390. ((c & 0x0f) << 12 | (buf[++i] & 0x3f) << 6 |
  391. (buf[++i] & 0x3f)));
  392. }
  393. _idx = i;
  394. hash[_toString.apply(null, ary)] = decode();
  395. }
  396. return hash;
  397. // 0xdd: array32, 0xdc: array16, 0x90: array
  398. case 0xdd:
  399. num += buf[++_idx] * 0x1000000 + (buf[++_idx] << 16);
  400. case 0xdc:
  401. num += (buf[++_idx] << 8) + buf[++_idx];
  402. case 0x90:
  403. ary = [];
  404. while (num--) {
  405. ary.push(decode());
  406. }
  407. return ary;
  408. }
  409. return;
  410. }
  411.  
  412. // inner - byteArray To ByteString
  413. function byteArrayToByteString(byteArray) { // @param ByteArray
  414. // @return String
  415. // http://d.hatena.ne.jp/uupaa/20101128
  416. try {
  417. return _toString.apply(this, byteArray); // toString
  418. } catch (err) {
  419. ; // avoid "Maximum call stack size exceeded"
  420. }
  421. var rv = [],
  422. i = 0,
  423. iz = byteArray.length,
  424. num2bin = _num2bin;
  425.  
  426. for (; i < iz; ++i) {
  427. rv[i] = num2bin[byteArray[i]];
  428. }
  429. return rv.join("");
  430. }
  431.  
  432. // msgpack.download - load from server
  433. function msgpackdownload(url, // @param String:
  434. option, // @param Hash: { worker, timeout, before, after }
  435. // option.worker - Boolean(= false): true is use WebWorkers
  436. // option.timeout - Number(= 10): timeout sec
  437. // option.before - Function: before(xhr, option)
  438. // option.after - Function: after(xhr, option, { status, ok })
  439. callback) { // @param Function: callback(data, option, { status, ok })
  440. // data - Mix/null:
  441. // option - Hash:
  442. // status - Number: HTTP status code
  443. // ok - Boolean:
  444. option.method = "GET";
  445. option.binary = true;
  446. ajax(url, option, callback);
  447. }
  448.  
  449. // msgpack.upload - save to server
  450. function msgpackupload(url, // @param String:
  451. option, // @param Hash: { data, worker, timeout, before, after }
  452. // option.data - Mix:
  453. // option.worker - Boolean(= false): true is use WebWorkers
  454. // option.timeout - Number(= 10): timeout sec
  455. // option.before - Function: before(xhr, option)
  456. // option.after - Function: after(xhr, option, { status, ok })
  457. callback) { // @param Function: callback(data, option, { status, ok })
  458. // data - String: responseText
  459. // option - Hash:
  460. // status - Number: HTTP status code
  461. // ok - Boolean:
  462. option.method = "PUT";
  463. option.binary = true;
  464.  
  465. if (option.worker && globalScope.Worker) {
  466. var worker = new Worker(msgpack.worker);
  467.  
  468. worker.onmessage = function(event) {
  469. option.data = event.data;
  470. ajax(url, option, callback);
  471. };
  472. worker.postMessage({
  473. method: "pack",
  474. data: option.data
  475. });
  476. } else {
  477. // pack and base64 encode
  478. option.data = base64encode(msgpackpack(option.data));
  479. ajax(url, option, callback);
  480. }
  481. }
  482.  
  483. // inner -
  484. function ajax(url, // @param String:
  485. option, // @param Hash: { data, ifmod, method, timeout,
  486. // header, binary, before, after, worker }
  487. // option.data - Mix: upload data
  488. // option.ifmod - Boolean: true is "If-Modified-Since" header
  489. // option.method - String: "GET", "POST", "PUT"
  490. // option.timeout - Number(= 10): timeout sec
  491. // option.header - Hash(= {}): { key: "value", ... }
  492. // option.binary - Boolean(= false): true is binary data
  493. // option.before - Function: before(xhr, option)
  494. // option.after - Function: after(xhr, option, { status, ok })
  495. // option.worker - Boolean(= false): true is use WebWorkers
  496. callback) { // @param Function: callback(data, option, { status, ok })
  497. // data - String/Mix/null:
  498. // option - Hash:
  499. // status - Number: HTTP status code
  500. // ok - Boolean:
  501. function readyStateChange() {
  502. if (xhr.readyState === 4) {
  503. var data, status = xhr.status,
  504. worker, byteArray,
  505. rv = {
  506. status: status,
  507. ok: status >= 200 && status < 300
  508. };
  509.  
  510. if (!run++) {
  511. if (method === "PUT") {
  512. data = rv.ok ? xhr.responseText : "";
  513. } else {
  514. if (rv.ok) {
  515. if (option.worker && globalScope.Worker) {
  516. worker = new Worker(msgpack.worker);
  517. worker.onmessage = function(event) {
  518. callback(event.data, option, rv);
  519. };
  520. worker.postMessage({
  521. method: "unpack",
  522. data: xhr.responseText
  523. });
  524. gc();
  525. return;
  526. } else {
  527. byteArray = _ie ? toByteArrayIE(xhr) :
  528. toByteArray(xhr.responseText);
  529. data = msgpackunpack(byteArray);
  530. }
  531. }
  532. }
  533. after && after(xhr, option, rv);
  534. callback(data, option, rv);
  535. gc();
  536. }
  537. }
  538. }
  539.  
  540. function ng(abort, status) {
  541. if (!run++) {
  542. var rv = {
  543. status: status || 400,
  544. ok: false
  545. };
  546.  
  547. after && after(xhr, option, rv);
  548. callback(null, option, rv);
  549. gc(abort);
  550. }
  551. }
  552.  
  553. function gc(abort) {
  554. abort && xhr && xhr.abort && xhr.abort();
  555. watchdog && (clearTimeout(watchdog), watchdog = 0);
  556. xhr = null;
  557. globalScope.addEventListener &&
  558. globalScope.removeEventListener("beforeunload", ng, false);
  559. }
  560.  
  561. var watchdog = 0,
  562. method = option.method || "GET",
  563. header = option.header || {},
  564. before = option.before,
  565. after = option.after,
  566. data = option.data || null,
  567. xhr = globalScope.XMLHttpRequest ? new XMLHttpRequest() :
  568. globalScope.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") :
  569. null,
  570. run = 0,
  571. i,
  572. overrideMimeType = "overrideMimeType",
  573. setRequestHeader = "setRequestHeader",
  574. getbinary = method === "GET" && option.binary;
  575.  
  576. try {
  577. xhr.onreadystatechange = readyStateChange;
  578. xhr.open(method, url, true); // ASync
  579.  
  580. before && before(xhr, option);
  581.  
  582. getbinary && xhr[overrideMimeType] &&
  583. xhr[overrideMimeType]("text/plain; charset=x-user-defined");
  584. data &&
  585. xhr[setRequestHeader]("Content-Type",
  586. "application/x-www-form-urlencoded");
  587.  
  588. for (i in header) {
  589. xhr[setRequestHeader](i, header[i]);
  590. }
  591.  
  592. globalScope.addEventListener &&
  593. globalScope.addEventListener("beforeunload", ng, false); // 400: Bad Request
  594.  
  595. xhr.send(data);
  596. watchdog = setTimeout(function() {
  597. ng(1, 408); // 408: Request Time-out
  598. }, (option.timeout || 10) * 1000);
  599. } catch (err) {
  600. ng(0, 400); // 400: Bad Request
  601. }
  602. }
  603.  
  604. // inner - BinaryString To ByteArray
  605. function toByteArray(data) { // @param BinaryString: "\00\01"
  606. // @return ByteArray: [0x00, 0x01]
  607. var rv = [],
  608. bin2num = _bin2num,
  609. remain,
  610. ary = data.split(""),
  611. i = -1,
  612. iz;
  613.  
  614. iz = ary.length;
  615. remain = iz % 8;
  616.  
  617. while (remain--) {
  618. ++i;
  619. rv[i] = bin2num[ary[i]];
  620. }
  621. remain = iz >> 3;
  622. while (remain--) {
  623. rv.push(bin2num[ary[++i]], bin2num[ary[++i]],
  624. bin2num[ary[++i]], bin2num[ary[++i]],
  625. bin2num[ary[++i]], bin2num[ary[++i]],
  626. bin2num[ary[++i]], bin2num[ary[++i]]);
  627. }
  628. return rv;
  629. }
  630.  
  631. // inner - BinaryString to ByteArray
  632. function toByteArrayIE(xhr) {
  633. var rv = [],
  634. data, remain,
  635. charCodeAt = "charCodeAt",
  636. loop, v0, v1, v2, v3, v4, v5, v6, v7,
  637. i = -1,
  638. iz;
  639.  
  640. iz = vblen(xhr);
  641. data = vbstr(xhr);
  642. loop = Math.ceil(iz / 2);
  643. remain = loop % 8;
  644.  
  645. while (remain--) {
  646. v0 = data[charCodeAt](++i); // 0x00,0x01 -> 0x0100
  647. rv.push(v0 & 0xff, v0 >> 8);
  648. }
  649. remain = loop >> 3;
  650. while (remain--) {
  651. v0 = data[charCodeAt](++i);
  652. v1 = data[charCodeAt](++i);
  653. v2 = data[charCodeAt](++i);
  654. v3 = data[charCodeAt](++i);
  655. v4 = data[charCodeAt](++i);
  656. v5 = data[charCodeAt](++i);
  657. v6 = data[charCodeAt](++i);
  658. v7 = data[charCodeAt](++i);
  659. rv.push(v0 & 0xff, v0 >> 8, v1 & 0xff, v1 >> 8,
  660. v2 & 0xff, v2 >> 8, v3 & 0xff, v3 >> 8,
  661. v4 & 0xff, v4 >> 8, v5 & 0xff, v5 >> 8,
  662. v6 & 0xff, v6 >> 8, v7 & 0xff, v7 >> 8);
  663. }
  664. iz % 2 && rv.pop();
  665.  
  666. return rv;
  667. }
  668.  
  669. // inner - base64.encode
  670. function base64encode(data) { // @param ByteArray:
  671. // @return Base64String:
  672. var rv = [],
  673. c = 0,
  674. i = -1,
  675. iz = data.length,
  676. pad = [0, 2, 1][data.length % 3],
  677. num2bin = _num2bin,
  678. num2b64 = _num2b64;
  679.  
  680. if (globalScope.btoa) {
  681. while (i < iz) {
  682. rv.push(num2bin[data[++i]]);
  683. }
  684. return btoa(rv.join(""));
  685. }
  686. --iz;
  687. while (i < iz) {
  688. c = (data[++i] << 16) | (data[++i] << 8) | (data[++i]); // 24bit
  689. rv.push(num2b64[(c >> 18) & 0x3f],
  690. num2b64[(c >> 12) & 0x3f],
  691. num2b64[(c >> 6) & 0x3f],
  692. num2b64[c & 0x3f]);
  693. }
  694. pad > 1 && (rv[rv.length - 2] = "=");
  695. pad > 0 && (rv[rv.length - 1] = "=");
  696. return rv.join("");
  697. }
  698.  
  699. // --- init ---
  700. (function() {
  701. var i = 0,
  702. v;
  703.  
  704. for (; i < 0x100; ++i) {
  705. v = _toString(i);
  706. _bin2num[v] = i; // "\00" -> 0x00
  707. _num2bin[i] = v; // 0 -> "\00"
  708. }
  709. // http://twitter.com/edvakf/statuses/15576483807
  710. for (i = 0x80; i < 0x100; ++i) { // [Webkit][Gecko]
  711. _bin2num[_toString(0xf700 + i)] = i; // "\f780" -> 0x80
  712. }
  713. })();
  714.  
  715. _ie && document.write('<script type="text/vbscript">\
  716. Function vblen(b)vblen=LenB(b.responseBody)End Function\n\
  717. Function vbstr(b)vbstr=CStr(b.responseBody)+chr(0)End Function</' + 'script>');
  718.  
  719. })(this); // msgpac.
  720.  
  721.  
  722. window.msgpack = this.msgpack;
  723.  
  724. (function() {
  725. var _WebSocket = window['_WebSocket'] = window['WebSocket'];
  726. var $ = window.jQuery;
  727. var msgpack = window.msgpack;
  728. var options = {
  729. enableMultiCells: false,
  730. enablePosition: false,
  731. enableCross: false
  732. };
  733.  
  734. // game states
  735.  
  736. var map_server = null;
  737. var player_name = [];
  738. var players = [];
  739. var id_players = [];
  740. var cells = [];
  741. var current_cell_ids = [];
  742. var start_x = -7000,
  743. start_y = -7000,
  744. end_x = 7000,
  745. end_y = 7000,
  746. length_x = 14000,
  747. length_y = 14000;
  748. var render_timer = null;
  749.  
  750.  
  751.  
  752. function miniMapSendRawData(data) {
  753. if (map_server !== null && map_server.readyState === window._WebSocket.OPEN) {
  754. var array = new Uint8Array(data);
  755. map_server.send(array.buffer);
  756. }
  757. }
  758.  
  759. function miniMapConnectToServer(address, onOpen, onClose) {
  760. try {
  761. var ws = new window._WebSocket(address);
  762. } catch (ex) {
  763. onClose();
  764. console.error(ex);
  765. return false;
  766. }
  767. ws.binaryType = "arraybuffer";
  768.  
  769. ws.onopen = function() {
  770. onOpen();
  771. //console.log(address + ' connected');
  772. }
  773.  
  774. ws.onmessage = function(event) {
  775. var buffer = new Uint8Array(event.data);
  776. var packet = msgpack.unpack(buffer);
  777. switch (packet.type) {
  778. case 128:
  779. for (var i = 0; i < packet.data.addition.length; ++i) {
  780. var cell = packet.data.addition[i];
  781. if (!miniMapIsRegisteredToken(cell.id)) {
  782. miniMapRegisterToken(
  783. cell.id,
  784. miniMapCreateToken(cell.id, cell.color)
  785. );
  786. }
  787.  
  788. var size_n = cell.size / length_x;
  789. miniMapUpdateToken(cell.id, (cell.x - start_x) / length_x, (cell.y - start_y) / length_y, size_n);
  790. }
  791.  
  792. for (var i = 0; i < packet.data.deletion.length; ++i) {
  793. var id = packet.data.deletion[i];
  794. miniMapUnregisterToken(id);
  795. }
  796. break;
  797.  
  798. }
  799. }
  800.  
  801. ws.onerror = function() {
  802. onClose();
  803. console.error('failed to connect to map server');
  804. }
  805.  
  806. ws.onclose = function() {
  807. onClose();
  808. map_server = null;
  809. //console.log('map server disconnected');
  810. }
  811.  
  812. map_server = ws;
  813. }
  814.  
  815. function miniMapRender() {
  816. var canvas = window.mini_map;
  817. var ctx = canvas.getContext('2d');
  818. ctx.clearRect(0, 0, canvas.width, canvas.height);
  819. for (var id in window.mini_map_tokens) {
  820. var token = window.mini_map_tokens[id];
  821. var x = token.x * canvas.width;
  822. var y = token.y * canvas.height;
  823. var size = token.size * canvas.width;
  824.  
  825. ctx.beginPath();
  826. ctx.arc(
  827. x,
  828. y,
  829. size,
  830. 0,
  831. 2 * Math.PI,
  832. false
  833. );
  834. ctx.closePath();
  835. ctx.fillStyle = token.color;
  836. ctx.fill();
  837.  
  838.  
  839. if (id_players[id] !== undefined) {
  840. ctx.font = size * 2 + 'px Arial';
  841. ctx.textAlign = 'center';
  842. ctx.textBaseline = 'middle';
  843. ctx.fillStyle = 'white';
  844. ctx.fillText(id_players[id] + 1, x, y);
  845. }
  846. };
  847. }
  848.  
  849. function miniMapDrawCross(x, y) {
  850. var canvas = window.mini_map;
  851. var ctx = canvas.getContext('2d');
  852. ctx.lineWidth = 0.5;
  853. ctx.beginPath();
  854. ctx.moveTo(0, y * canvas.height);
  855. ctx.lineTo(canvas.width, y * canvas.height);
  856. ctx.moveTo(x * canvas.width, 0);
  857. ctx.lineTo(x * canvas.width, canvas.height);
  858. ctx.closePath();
  859. ctx.strokeStyle = '#FFFFFF';
  860. ctx.stroke();
  861. }
  862.  
  863. function miniMapCreateToken(id, color) {
  864. var mini_map_token = {
  865. id: id,
  866. color: color,
  867. x: 0,
  868. y: 0,
  869. size: 0
  870. };
  871. return mini_map_token;
  872. }
  873.  
  874. function miniMapRegisterToken(id, token) {
  875. if (window.mini_map_tokens[id] === undefined) {
  876. // window.mini_map.append(token);
  877. window.mini_map_tokens[id] = token;
  878. }
  879. }
  880.  
  881. function miniMapUnregisterToken(id) {
  882. if (window.mini_map_tokens[id] !== undefined) {
  883. // window.mini_map_tokens[id].detach();
  884. delete window.mini_map_tokens[id];
  885. }
  886. }
  887.  
  888. function miniMapIsRegisteredToken(id) {
  889. return window.mini_map_tokens[id] !== undefined;
  890. }
  891.  
  892. function miniMapUpdateToken(id, x, y, size) {
  893. if (window.mini_map_tokens[id] !== undefined) {
  894.  
  895. window.mini_map_tokens[id].x = x;
  896. window.mini_map_tokens[id].y = y;
  897. window.mini_map_tokens[id].size = size + 0.015;
  898.  
  899.  
  900. return true;
  901. } else {
  902. return false;
  903. }
  904. }
  905.  
  906. function miniMapUpdatePos(x, y) {
  907. window.mini_map_pos.text('x: ' + x.toFixed(0) + ', y: ' + y.toFixed(0));
  908. }
  909.  
  910. function miniMapReset() {
  911. cells = [];
  912. window.mini_map_tokens = [];
  913. }
  914.  
  915. function miniMapInit() {
  916. window.mini_map_tokens = [];
  917.  
  918. cells = [];
  919. current_cell_ids = [];
  920. start_x = -7000;
  921. start_y = -7000;
  922. end_x = 7000;
  923. end_y = 7000;
  924. length_x = 14000;
  925. length_y = 14000;
  926.  
  927. // minimap dom
  928. if ($('#mini-map-wrapper').length === 0) {
  929. var wrapper = $('<div>').attr('id', 'mini-map-wrapper').css({
  930. position: 'fixed',
  931. bottom: 10,
  932. right: 10,
  933. width: 150,
  934. height: 150,
  935. // background: 'rgba(128, 128, 128, 0.58)'
  936. background: "url('img/mini_map.png')"
  937. });
  938.  
  939. var mini_map = $('<canvas>').attr({
  940. id: 'mini-map',
  941. width: 150,
  942. height: 150
  943. }).css({
  944. width: '100%',
  945. height: '100%',
  946. position: 'relative'
  947. });
  948.  
  949. wrapper.append(mini_map).appendTo(document.body);
  950.  
  951. window.mini_map = mini_map[0];
  952. }
  953.  
  954. // minimap renderer
  955. if (render_timer === null)
  956. render_timer = setInterval(miniMapRender, 1000 / 30);
  957.  
  958. // minimap location
  959. if ($('#mini-map-pos').length === 0) {
  960. window.mini_map_pos = $('<div>').attr('id', 'mini-map-pos').css({
  961. bottom: 10,
  962. right: 10,
  963. color: 'white',
  964. fontSize: 15,
  965. fontWeight: 800,
  966. position: 'fixed'
  967. }).appendTo(document.body);
  968. }
  969.  
  970.  
  971.  
  972. // minimap party
  973. }
  974.  
  975. // cell constructor
  976. function Cell(id, x, y, size, color, name) {
  977. cells[id] = this;
  978. this.id = id;
  979. this.color = color;
  980. this.points = [];
  981. this.pointsAcc = [];
  982. this.setName(name);
  983. }
  984.  
  985. Cell.prototype = {
  986. id: 0,
  987. points: null,
  988. pointsAcc: null,
  989. name: null,
  990. nameCache: null,
  991. sizeCache: null,
  992. x: 0,
  993. y: 0,
  994. size: 0,
  995. ox: 0,
  996. oy: 0,
  997. oSize: 0,
  998. nx: 0,
  999. ny: 0,
  1000. nSize: 0,
  1001. updateTime: 0,
  1002. updateCode: 0,
  1003. drawTime: 0,
  1004. destroyed: false,
  1005. isVirus: false,
  1006. isAgitated: false,
  1007. wasSimpleDrawing: true,
  1008.  
  1009. destroy: function() {
  1010. delete cells[this.id];
  1011. id = current_cell_ids.indexOf(this.id); -
  1012. 1 != id && current_cell_ids.splice(id, 1);
  1013. this.destroyed = true;
  1014. if (map_server === null || map_server.readyState !== window._WebSocket.OPEN) {
  1015. miniMapUnregisterToken(this.id);
  1016. }
  1017. },
  1018. setName: function(name) {
  1019. this.name = name;
  1020. },
  1021. updatePos: function() {
  1022. if (map_server === null || map_server.readyState !== window._WebSocket.OPEN) {
  1023. if (options.enableMultiCells || -1 != current_cell_ids.indexOf(this.id)) {
  1024. if (!miniMapIsRegisteredToken(this.id)) {
  1025. miniMapRegisterToken(
  1026. this.id,
  1027. miniMapCreateToken(this.id, this.color)
  1028. );
  1029. }
  1030.  
  1031. var size_n = this.nSize / length_x;
  1032. miniMapUpdateToken(this.id, (this.nx - start_x) / length_x, (this.ny - start_y) / length_y, size_n);
  1033. }
  1034. }
  1035.  
  1036.  
  1037. }
  1038. };
  1039.  
  1040. String.prototype.capitalize = function() {
  1041. return this.charAt(0).toUpperCase() + this.slice(1);
  1042. };
  1043.  
  1044. function camel2cap(str) {
  1045. return str.replace(/([A-Z])/g, function(s) {
  1046. return ' ' + s.toLowerCase();
  1047. }).capitalize();
  1048. };
  1049.  
  1050. // create a linked property from slave object
  1051. // whenever master[prop] update, slave[prop] update
  1052. function refer(master, slave, prop) {
  1053. Object.defineProperty(master, prop, {
  1054. get: function() {
  1055. return slave[prop];
  1056. },
  1057. set: function(val) {
  1058. slave[prop] = val;
  1059. },
  1060. enumerable: true,
  1061. configurable: true
  1062. });
  1063. };
  1064.  
  1065. // extract a websocket packet which contains the information of cells
  1066. function extractCellPacket(data, offset) {
  1067. ////
  1068. var dataToSend = {
  1069. destroyQueue: [],
  1070. nodes: [],
  1071. nonVisibleNodes: []
  1072. };
  1073. ////
  1074.  
  1075. var I = +new Date;
  1076. var qa = false;
  1077. var b = Math.random(),
  1078. c = offset;
  1079. var size = data.getUint16(c, true);
  1080. c = c + 2;
  1081.  
  1082. // Nodes to be destroyed (killed)
  1083. for (var e = 0; e < size; ++e) {
  1084. var p = cells[data.getUint32(c, true)],
  1085. f = cells[data.getUint32(c + 4, true)],
  1086. c = c + 8;
  1087. p && f && (
  1088. f.destroy(),
  1089. f.ox = f.x,
  1090. f.oy = f.y,
  1091. f.oSize = f.size,
  1092. f.nx = p.x,
  1093. f.ny = p.y,
  1094. f.nSize = f.size,
  1095. f.updateTime = I,
  1096. dataToSend.destroyQueue.push(f.id));
  1097. }
  1098.  
  1099. // Nodes to be updated
  1100. for (e = 0;;) {
  1101. var d = data.getUint32(c, true);
  1102. c += 4;
  1103. if (0 == d) {
  1104. break;
  1105. }
  1106. ++e;
  1107. var p = data.getInt32(c, true),
  1108. c = c + 4,
  1109. f = data.getInt32(c, true),
  1110. c = c + 4;
  1111. g = data.getInt16(c, true);
  1112. c = c + 2;
  1113. for (var h = data.getUint8(c++), m = data.getUint8(c++), q = data.getUint8(c++), h = (h << 16 | m << 8 | q).toString(16); 6 > h.length;)
  1114. h = "0" + h;
  1115.  
  1116. var h = "#" + h,
  1117. k = data.getUint8(c++),
  1118. m = !!(k & 1),
  1119. q = !!(k & 16);
  1120.  
  1121. k & 2 && (c += 4);
  1122. k & 4 && (c += 8);
  1123. k & 8 && (c += 16);
  1124.  
  1125. for (var n, k = "";;) {
  1126. n = data.getUint16(c, true);
  1127. c += 2;
  1128. if (0 == n)
  1129. break;
  1130. k += String.fromCharCode(n)
  1131. }
  1132.  
  1133. n = k;
  1134. k = null;
  1135.  
  1136. var updated = false;
  1137. // if d in cells then modify it, otherwise create a new cell
  1138. cells.hasOwnProperty(d) ?
  1139. (k = cells[d],
  1140. k.updatePos(),
  1141. k.ox = k.x,
  1142. k.oy = k.y,
  1143. k.oSize = k.size,
  1144. k.color = h,
  1145. updated = true) :
  1146. (k = new Cell(d, p, f, g, h, n),
  1147. k.pX = p,
  1148. k.pY = f);
  1149.  
  1150. k.isVirus = m;
  1151. k.isAgitated = q;
  1152. k.nx = p;
  1153. k.ny = f;
  1154. k.nSize = g;
  1155. k.updateCode = b;
  1156. k.updateTime = I;
  1157. n && k.setName(n);
  1158.  
  1159. // ignore food creation
  1160.  
  1161. }
  1162.  
  1163. // Destroy queue + nonvisible nodes
  1164. b = data.getUint32(c, true);
  1165. c += 4;
  1166. for (e = 0; e < b; e++) {
  1167. d = data.getUint32(c, true);
  1168. c += 4, k = cells[d];
  1169. null != k && k.destroy();
  1170. dataToSend.nonVisibleNodes.push(d);
  1171. }
  1172.  
  1173. var packet = {
  1174. type: 16,
  1175. data: dataToSend
  1176. }
  1177.  
  1178. miniMapSendRawData(msgpack.pack(packet));
  1179. }
  1180.  
  1181. // extract the type of packet and dispatch it to a corresponding extractor
  1182. function extractPacket(event) {
  1183. var c = 0;
  1184. var data = new DataView(event.data);
  1185. 240 == data.getUint8(c) && (c += 5);
  1186. var opcode = data.getUint8(c);
  1187. c++;
  1188. switch (opcode) {
  1189. case 16: // cells data
  1190. extractCellPacket(data, c);
  1191. break;
  1192. case 20: // cleanup ids
  1193. current_cell_ids = [];
  1194. break;
  1195. case 32: // cell id belongs me
  1196. var id = data.getUint32(c, true);
  1197.  
  1198. if (current_cell_ids.indexOf(id) === -1)
  1199. current_cell_ids.push(id);
  1200.  
  1201. miniMapSendRawData(msgpack.pack({
  1202. type: 32,
  1203. data: id
  1204. }));
  1205. break;
  1206. case 64: // get borders
  1207. start_x = data.getFloat64(c, !0), c += 8,
  1208. start_y = data.getFloat64(c, !0), c += 8,
  1209. end_x = data.getFloat64(c, !0), c += 8,
  1210. end_y = data.getFloat64(c, !0), c += 8,
  1211. center_x = (start_x + end_x) / 2,
  1212. center_y = (start_y + end_y) / 2,
  1213. length_x = Math.abs(start_x - end_x),
  1214. length_y = Math.abs(start_y - end_y);
  1215. }
  1216. };
  1217.  
  1218. function extractSendPacket(data) {
  1219. if (data != undefined) {
  1220. var view = new DataView(data);
  1221. switch (view.getUint8(0, true)) {
  1222. case 0:
  1223. player_name = [];
  1224. for (var i = 1; i < data.byteLength; i += 2) {
  1225. player_name.push(view.getUint16(i, true));
  1226. }
  1227.  
  1228. miniMapSendRawData(msgpack.pack({
  1229. type: 0,
  1230. data: player_name
  1231. }));
  1232. break;
  1233. }
  1234. }
  1235. }
  1236.  
  1237. // the injected point, overwriting the WebSocket constructor
  1238. window.WebSocket = function(url, protocols) {
  1239. //console.log('Listen');
  1240.  
  1241. if (protocols === undefined) {
  1242. protocols = [];
  1243. }
  1244.  
  1245. var ws = new _WebSocket(url, protocols);
  1246.  
  1247. refer(this, ws, 'binaryType');
  1248. refer(this, ws, 'bufferedAmount');
  1249. refer(this, ws, 'extensions');
  1250. refer(this, ws, 'protocol');
  1251. refer(this, ws, 'readyState');
  1252. refer(this, ws, 'url');
  1253.  
  1254. this.send = function(data) {
  1255. extractSendPacket(data);
  1256. return ws.send.call(ws, data);
  1257. };
  1258.  
  1259. this.close = function() {
  1260. return ws.close.call(ws);
  1261. };
  1262.  
  1263. this.onopen = function(event) {};
  1264. this.onclose = function(event) {};
  1265. this.onerror = function(event) {};
  1266. this.onmessage = function(event) {};
  1267.  
  1268. ws.onopen = function(event) {
  1269. miniMapInit();
  1270. agar_server = url;
  1271. miniMapSendRawData(msgpack.pack({
  1272. type: 100,
  1273. data: {
  1274. url: url,
  1275. region: $('#region').val(),
  1276. gamemode: $('#gamemode').val(),
  1277. party: location.hash
  1278. }
  1279. }));
  1280. if (this.onopen)
  1281. return this.onopen.call(ws, event);
  1282. }.bind(this);
  1283.  
  1284. ws.onmessage = function(event) {
  1285. extractPacket(event);
  1286. if (this.onmessage)
  1287. return this.onmessage.call(ws, event);
  1288. }.bind(this);
  1289.  
  1290. ws.onclose = function(event) {
  1291. if (this.onclose)
  1292. return this.onclose.call(ws, event);
  1293. }.bind(this);
  1294.  
  1295. ws.onerror = function(event) {
  1296. if (this.onerror)
  1297. return this.onerror.call(ws, event);
  1298. }.bind(this);
  1299. };
  1300.  
  1301. window.WebSocket.prototype = _WebSocket;
  1302.  
  1303. $(window.document).ready(function() {
  1304. miniMapInit();
  1305. });
  1306.  
  1307. $(window).load(function() {
  1308. var main_canvas = document.getElementById('canvas');
  1309. if (main_canvas && main_canvas.onmousemove) {
  1310. document.onmousemove = main_canvas.onmousemove;
  1311. main_canvas.onmousemove = null;
  1312. }
  1313. });
  1314. })();
  1315.  
  1316.  
  1317.  
  1318. var totalBotCount = 0;
  1319. var playerPos;
  1320. var botLink = new Array();
  1321. var splitBot = false;
  1322. var pauseSend = false;
  1323. var botSplitJob = new Array();
  1324.  
  1325. function game(d, e, bot, botUrl, botName) {
  1326. //
  1327. //alert();
  1328. var botsUrl;
  1329. var botsCount = 25;
  1330. var botsCreated = false;
  1331. var intervalPos;
  1332. if (bot) {
  1333. totalBotCount++;
  1334. }
  1335. var isTyping = false;
  1336. var chattxt;
  1337.  
  1338. function Ib() {
  1339.  
  1340. var botControl = function(playerPos) {
  1341. sendPosition(playerPos);
  1342. if (splitBot) {
  1343. spltt();
  1344.  
  1345. }
  1346. };
  1347. if (bot) {
  1348. console.log("bot - " + botName);
  1349. Ha(botUrl); //connect
  1350. intervalPos = setInterval(function() {
  1351. botControl(playerPos);
  1352.  
  1353. }, 1000);
  1354. return;
  1355. }
  1356.  
  1357.  
  1358. Ca = !0;
  1359. ab();
  1360. e("#mini-map-wrapper").hide();
  1361. setInterval(ab, 18E4);
  1362. J = Da = document.getElementById("canvas");
  1363. f = J.getContext("2d");
  1364. J.onmousedown = function(a) {
  1365. if (bb) {
  1366. var b = a.clientX - (5 + m / 5 / 2),
  1367. c = a.clientY - (5 + m / 5 / 2);
  1368. if (Math.sqrt(b * b + c * c) <= m / 5 / 2) {
  1369. aa();
  1370. K(17);
  1371. return
  1372. }
  1373. }
  1374. ja = a.clientX;
  1375. ka = a.clientY;
  1376. Ea();
  1377. aa()
  1378. };
  1379. J.onmousemove = function(a) {
  1380. ja = a.clientX;
  1381. ka = a.clientY;
  1382. Ea()
  1383. };
  1384. J.onmouseup = function() {};
  1385. /firefox/i.test(navigator.userAgent) ? document.addEventListener("DOMMouseScroll", cb, !1) : document.body.onmousewheel = cb;
  1386.  
  1387.  
  1388.  
  1389. J.onfocus = function() {
  1390. isTyping = false;
  1391. };
  1392.  
  1393. document.getElementById("chat_textbox").onblur = function() {
  1394. isTyping = false;
  1395. };
  1396.  
  1397.  
  1398. document.getElementById("chat_textbox").onfocus = function() {
  1399. isTyping = true;
  1400. };
  1401.  
  1402. var spacePressed = false,
  1403. qPressed = false,
  1404. wPressed = false;
  1405.  
  1406.  
  1407. function spltt() {
  1408. //alert(isTyping);
  1409. if (isTyping != true) {
  1410. (aa(), K(17), a = !0);
  1411. }
  1412. }
  1413.  
  1414. function fedvir() {
  1415. if (isTyping != true) {
  1416. (aa(), K(21), c = !0);
  1417. }
  1418. }
  1419.  
  1420. var a = !0,
  1421. b = !1,
  1422. c = !1;
  1423.  
  1424. function splitAllBots() {
  1425. if (!splitBot) {
  1426. splitBot = true;
  1427. } else {
  1428. splitBot = false;
  1429. }
  1430. }
  1431.  
  1432. function pauseMove() {
  1433. if (!pauseSend) {
  1434. pauseSend = true;
  1435. } else {
  1436. pauseSend = false;
  1437. }
  1438.  
  1439. }
  1440. d.onkeydown = function(k) {
  1441. 70 === k.keyCode && pauseMove();
  1442. 50 === k.keyCode && d.setNick("test", 0);
  1443.  
  1444. 52 === k.keyCode && splitAllBots();
  1445. 51 === k.keyCode && fedvir();
  1446.  
  1447. 32 != k.keyCode || a || spltt();
  1448. 81 != k.keyCode || b || (K(18), b = !0);
  1449. 87 != k.keyCode || c || fedvir();
  1450. 27 == k.keyCode && showOverlay(300)
  1451. 13 == k.keyCode && cht();
  1452. };
  1453.  
  1454. var lastChatCount = 0;
  1455. var son;
  1456. var son2;
  1457.  
  1458. function cht() {
  1459.  
  1460. if (!hasOverlay) {
  1461. document.getElementById("chat_textbox").focus();
  1462. isTyping = true;
  1463. }
  1464.  
  1465.  
  1466. lastChatCount++;
  1467. }
  1468.  
  1469. setInterval(function() {
  1470. lastChatCount = 0;
  1471. }, 40000);
  1472.  
  1473. d.onkeyup = function(k) {
  1474. 32 == k.keyCode && (a = !1);
  1475. 87 == k.keyCode && (c = !1);
  1476. 81 == k.keyCode && b && (K(19), b = !1)
  1477. };
  1478. d.onblur = function() {
  1479. K(19);
  1480. c = b = a = !1
  1481. };
  1482. d.onresize = db;
  1483. d.requestAnimationFrame(eb);
  1484. setInterval(aa, 40);
  1485. t && e("#region").val(t);
  1486. fb();
  1487. la(e("#region").val());
  1488. 0 == Ga && t && L();
  1489. eatenS = true;
  1490. e("#overlays").show();
  1491. db();
  1492. d.location.hash && 6 <= d.location.hash.length && gb(d.location.hash);
  1493.  
  1494.  
  1495.  
  1496. }
  1497.  
  1498.  
  1499. function sendChat(str) {
  1500. if (Y() && (str.length < 200) && (str.length > 0)) {
  1501. var msg = P(2 + 2 * str.length);
  1502. var offset = 0;
  1503. msg.setUint8(offset++, 99);
  1504. msg.setUint8(offset++, 0); // flags (0 for now)
  1505. for (var i = 0; i < str.length; ++i) {
  1506. msg.setUint16(offset, str.charCodeAt(i), !0);
  1507. offset += 2;
  1508. }
  1509. sendPosition(msg);
  1510.  
  1511. }
  1512. }
  1513.  
  1514.  
  1515. function cb(a) {
  1516. M *= Math.pow(.9, a.wheelDelta / -120 || a.detail || 0);
  1517. if (.9 > M) {
  1518. M < .05 / g && (M = .05 / g)
  1519. } else {
  1520. M > .9 / g && (M = .9 / g)
  1521. }
  1522. }
  1523.  
  1524. function Jb() {
  1525. if (.4 > g) ba = null;
  1526. else {
  1527. for (var a = Number.POSITIVE_INFINITY, b = Number.POSITIVE_INFINITY, c = Number.NEGATIVE_INFINITY, k = Number.NEGATIVE_INFINITY, d = 0, n = 0; n < y.length; n++) {
  1528. var e = y[n];
  1529. !e.N() || e.R || 20 >= e.size * g || (d = Math.max(e.size, d), a = Math.min(e.x, a), b = Math.min(e.y, b), c = Math.max(e.x, c), k = Math.max(e.y, k))
  1530. }
  1531. ba = Kb.la({
  1532. ca: a - (d + 100),
  1533. da: b - (d + 100),
  1534. oa: c + (d + 100),
  1535. pa: k + (d + 100),
  1536. ma: 2,
  1537. na: 4
  1538. });
  1539. for (n = 0; n < y.length; n++)
  1540. if (e = y[n],
  1541. e.N() && !(20 >= e.size * g))
  1542. for (a = 0; a < e.a.length; ++a) b = e.a[a].x, c = e.a[a].y, b < u - m / 2 / g || c < v - q / 2 / g || b > u + m / 2 / g || c > v + q / 2 / g || ba.m(e.a[a])
  1543. }
  1544. }
  1545.  
  1546. function Ea() {
  1547. ma = (ja - m / 2) / g + u;
  1548. na = (ka - q / 2) / g + v
  1549. }
  1550.  
  1551. function ab() {
  1552. null == oa && (oa = {}, e("#region").children().each(function() {
  1553. var a = e(this),
  1554. b = a.val();
  1555. b && (oa[b] = a.text())
  1556. }));
  1557. e.get("info.php", function(a) {
  1558. var b = {},
  1559. c;
  1560. for (c in a.regions) {
  1561. var k = c.split(":")[0];
  1562. b[k] = b[k] || 0;
  1563. b[k] += a.regions[c].numPlayers
  1564. }
  1565. for (c in b) e('#region option[value="' + c + '"]').text(oa[c] + " (" + b[c] + " players)")
  1566. },
  1567. "json")
  1568. }
  1569.  
  1570. function hb() {
  1571. hasOverlay = false;
  1572. e("#adsBottom").hide();
  1573. e("#overlays").hide();
  1574. e("#stats").hide();
  1575.  
  1576. e("#skor").hide();
  1577. e("#sagtik").hide();
  1578. e("#fan2").hide();
  1579. e("#mainPanel").hide();
  1580.  
  1581.  
  1582. e("#mini-map-wrapper").show();
  1583. inTMenu = eatenS = false;
  1584. fb();
  1585. /*d.googletag && d.googletag.pubads && d.googletag.pubads().clear && d.googletag.pubads().clear(d.aa.concat(d.ab))*/
  1586. }
  1587.  
  1588. function la(a) {
  1589. a && a != t && (Sregion != a && e("#region").val(a), t = d.localStorage.location = a, e(".region-message").hide(), e(".region-message." + a).show(), e(".btn-needs-server").prop("disabled", !1), Ca && L())
  1590. }
  1591.  
  1592. function showOverlay(a) {
  1593. console.log("OVERLAY");
  1594. if (!bot) {
  1595. console.log('test', eatenS, inTMenu);
  1596. eatenS || inTMenu || (ib(d.aa), 1E3 > a && (x = 1),
  1597. eatenS = true,
  1598. e("#mainPanel").show(), e("#fan2").show(), e("#sagtik").show(), e("#skor").show(),
  1599. e("#overlays").show())
  1600. } else {
  1601. restartGame();
  1602. }
  1603. }
  1604.  
  1605. function restartGame() {
  1606. sendPosition(playerPos);
  1607. }
  1608.  
  1609. function ca(a) {
  1610.  
  1611.  
  1612. e("#helloContainer").attr("data-gamemode", a);
  1613. U = a;
  1614. e("#gamemode").val(a)
  1615. }
  1616.  
  1617. function fb() {
  1618. Sregion ? d.localStorage.location = Sregion : d.localStorage.location && e("#region").val(d.localStorage.location);
  1619. Sregion ? e("#locationKnown").append(e("#region")) : e("#locationUnknown").append(e("#region"))
  1620. }
  1621.  
  1622. function ib(a) {
  1623. pa && (pa = !1, setTimeout(function() {
  1624. pa = !0
  1625. }, 6E4 * jb), d.googletag && d.googletag.pubads && d.googletag.pubads().refresh && d.googletag.pubads().refresh(a))
  1626. }
  1627.  
  1628. function da(a) {
  1629. return d.i18n[a] || d.i18n_dict.en[a] || a
  1630. }
  1631.  
  1632.  
  1633. //uretec
  1634. function RasgSayi(min, max) {
  1635. return Math.floor(Math.random() * (max - min + 1)) + min;
  1636. }
  1637.  
  1638. //hashSektor
  1639. function hashSektor() {
  1640. var today = new Date();
  1641. var mm = today.getMinutes() + 1;
  1642. return 'K' + RasgSayi(11, 59) + '38Y' + RasgSayi(11, 59) + '37X' + mm + 'A' + Math.floor((Math.random() * 59) + 10) + 'C' + Math.floor((Math.random() * 59) + 10);
  1643. }
  1644.  
  1645.  
  1646.  
  1647. function kb1(a) {
  1648. if (!SCodes) return alert("Hata !");
  1649. Ha("ws://" + a + "?SCode=" + SCodes);
  1650. }
  1651.  
  1652.  
  1653. function kb() {
  1654. if (!SCodes) return alert("Hata !");;
  1655. Ha("ws://" + host + "?SCode=" + SCodes);
  1656. }
  1657.  
  1658. function L() { //disconnect
  1659. if (Ca && t) {
  1660. console.log("SHOW");
  1661. (e("#overlays").show());
  1662. kb();
  1663. }
  1664. }
  1665.  
  1666. function Ha(a, b) {
  1667. if (s) {
  1668. s.onopen = null;
  1669. s.onmessage = null;
  1670. s.onclose = null;
  1671. try {
  1672. s.close()
  1673. } catch (c) {}
  1674. s = null
  1675. }
  1676. var c = a;
  1677. a = c;
  1678. A = [];
  1679. h = [];
  1680. I = {};
  1681. y = [];
  1682. V = [];
  1683. w = [];
  1684. B = C = null;
  1685. O = 0;
  1686. ea = !1;
  1687. //console.log("Connecting to " + a);
  1688. s = new WebSocket(a);
  1689. botsUrl = a;
  1690. s.binaryType = "arraybuffer";
  1691. s.onopen = function() {
  1692. //if(!bot){
  1693. var a;
  1694. //console.log("socket open");
  1695. a = P(5);
  1696. a.setUint8(0, 254);
  1697. a.setUint32(1, 5, !0);
  1698. sendPosition(a);
  1699. a = P(5);
  1700. a.setUint8(0, 255);
  1701. a.setUint32(1, 154669603, !0);
  1702. sendPosition(a);
  1703. mb()
  1704. //}
  1705. };
  1706. s.onmessage = Lb;
  1707. s.onclose = Mb;
  1708. s.onerror = function() {
  1709. //console.log("socket error")
  1710. }
  1711. }
  1712.  
  1713. function P(a) {
  1714. return new DataView(new ArrayBuffer(a))
  1715. }
  1716.  
  1717. function sendPosition(a) {
  1718. if (null != s && s.readyState == s.OPEN) {
  1719. if (!bot) {
  1720. if (!pauseSend) {
  1721. s.send(a.buffer);
  1722. }
  1723. } else {
  1724. s.send(a.buffer);
  1725. }
  1726. }
  1727. }
  1728.  
  1729. function Mb() {
  1730. ea && (qa = 500);
  1731. //console.log("socket close");
  1732. setTimeout(L, qa);
  1733. qa *= 2
  1734. }
  1735.  
  1736. function Lb(a) {
  1737. Nb(new DataView(a.data))
  1738. }
  1739.  
  1740. function Nb(a) {
  1741. function b() {
  1742. for (var b = "";;) {
  1743. var d = a.getUint16(c, !0);
  1744. c += 2;
  1745. if (0 == d) break;
  1746. b += String.fromCharCode(d)
  1747. }
  1748. return b
  1749. }
  1750. var c = 0;
  1751. 240 == a.getUint8(c) && (c += 5);
  1752. switch (a.getUint8(c++)) {
  1753. case 16:
  1754. Ob(a, c);
  1755. break;
  1756. case 17:
  1757. fa = a.getFloat32(c, !0);
  1758. c += 4;
  1759. ga = a.getFloat32(c, !0);
  1760. c += 4;
  1761. ha = a.getFloat32(c, !0);
  1762. c += 4;
  1763. break;
  1764. case 20:
  1765. h = [];
  1766. A = [];
  1767. break;
  1768. case 21:
  1769. Ka = a.getInt16(c, !0);
  1770. c += 2;
  1771. La = a.getInt16(c, !0);
  1772. c += 2;
  1773. Ma || (Ma = !0, ra = Ka, sa = La);
  1774. break;
  1775. case 32:
  1776. A.push(a.getUint32(c, !0));
  1777. c += 4;
  1778. break;
  1779. case 49:
  1780. if (null != C) break;
  1781. var k = a.getUint32(c, !0),
  1782. c = c + 4;
  1783. w = [];
  1784. for (var d = 0; d < k; ++d) {
  1785. var e = a.getUint32(c, !0),
  1786. c = c + 4;
  1787. w.push({
  1788. id: e,
  1789. name: b()
  1790. })
  1791. }
  1792. nb();
  1793. break;
  1794. case 50:
  1795. C = [];
  1796. k = a.getUint32(c, !0);
  1797. c += 4;
  1798. for (d = 0; d < k; ++d) C.push(a.getFloat32(c, !0)), c += 4;
  1799. nb();
  1800. break;
  1801. case 64:
  1802. ta = a.getFloat64(c, !0);
  1803. c += 8;
  1804. ua = a.getFloat64(c, !0);
  1805. c += 8;
  1806. va = a.getFloat64(c, !0);
  1807. c += 8;
  1808. wa = a.getFloat64(c, !0);
  1809. c += 8;
  1810. fa = (va + ta) / 2;
  1811. ga = (wa + ua) / 2;
  1812. ha = 1;
  1813. 0 == h.length && (u = fa, v = ga, g = ha);
  1814. break;
  1815. case 81:
  1816. var r = a.getUint32(c, !0),
  1817. c = c + 4,
  1818. p = a.getUint32(c, !0),
  1819. c = c + 4,
  1820. f = a.getUint32(c, !0),
  1821. c = c + 4;
  1822. setTimeout(function() {
  1823. W({
  1824. e: r,
  1825. f: p,
  1826. d: f
  1827. })
  1828. }, 1200)
  1829. break;
  1830. case 90:
  1831. if (!bot) {
  1832. // Server Info / ping
  1833. var Uping = (new Date) - latency;
  1834. jQuery('#latency').html('Latency ' + Uping + ' ms;');
  1835.  
  1836. var Uuptime = a.getFloat64(c, !0);
  1837. c += 8;
  1838. jQuery('#uptime').html('Uptime ' + Uuptime + ' sec;');
  1839. // Do something with the info
  1840.  
  1841. var Uplayers = a.getFloat64(c, !0);
  1842. c += 8;
  1843. jQuery('#onlineplayers').html('Players ' + Uplayers + ';');
  1844. // Do something with the info, example >> jQuery('#onlineplayers').html('Players ' + Uplayers );
  1845.  
  1846. var Umapsize = a.getFloat64(c, !0);
  1847. c += 8;
  1848. jQuery('#mapsize').html('Mapsize ' + Umapsize + ';');
  1849. // Do something with the info, example >> jQuery('#mapsize').html('Mapsize ' + Umapsize );
  1850.  
  1851. var Umapfood = a.getFloat64(c, !0);
  1852. c += 8;
  1853. jQuery('#mapfood').html('Mapfood ' + Umapfood);
  1854. // Do something with the info, example >> jQuery('#mapsize').html('Mapfood ' + Umapfood );
  1855.  
  1856. if (a.byteLength > 36) {
  1857. var Ugamemode = a.getFloat64(c, !0);
  1858. // Game mode is the number, so 0 for FFA etc...
  1859. }
  1860. }
  1861. break;
  1862. case 99:
  1863. addChat(a, c);
  1864. break;
  1865. }
  1866. }
  1867.  
  1868. function addChat(view, offset) {
  1869. function getString() {
  1870. var text = '',
  1871. char;
  1872. while ((char = view.getUint16(offset, true)) != 0) {
  1873. offset += 2;
  1874. text += String.fromCharCode(char);
  1875. }
  1876. offset += 2;
  1877. return text;
  1878. }
  1879.  
  1880. var flags = view.getUint8(offset++);
  1881. // for future expansions
  1882. if (flags & 2) {
  1883. offset += 4;
  1884. }
  1885. if (flags & 4) {
  1886. offset += 8;
  1887. }
  1888. if (flags & 8) {
  1889. offset += 16;
  1890. }
  1891.  
  1892. var r = view.getUint8(offset++),
  1893. g = view.getUint8(offset++),
  1894. b = view.getUint8(offset++),
  1895. color = (r << 16 | g << 8 | b).toString(16);
  1896. while (color.length > 6) {
  1897. color = '0' + color;
  1898. }
  1899. color = '#' + color;
  1900. chatBoard.push({
  1901. "name": getString(),
  1902. "color": color,
  1903. "message": getString(),
  1904. "time": Date.now()
  1905. });
  1906.  
  1907. drawChatBoard();
  1908.  
  1909. }
  1910.  
  1911.  
  1912.  
  1913. function drawChatBoard() {
  1914. chatCanvas = null;
  1915. chatCanvas = document.createElement("canvas");
  1916.  
  1917. var ctx = chatCanvas.getContext("2d");
  1918. var scaleFactor = Math.min(Math.max(m / 1200, 0.75), 1); //scale factor = 0.75 to 1
  1919. chatCanvas.width = 1000 * scaleFactor;
  1920. chatCanvas.height = 550 * scaleFactor;
  1921. ctx.scale(scaleFactor, scaleFactor);
  1922. var nowtime = Date.now();
  1923. var lasttime = 0;
  1924. if (chatBoard.length >= 1)
  1925. lasttime = chatBoard[chatBoard.length - 1].time;
  1926. else return;
  1927. var deltat = nowtime - lasttime;
  1928.  
  1929. ctx.globalAlpha = 0.8 * Math.exp(-deltat / 25000);
  1930.  
  1931.  
  1932.  
  1933. var len = chatBoard.length;
  1934. var from = len - 15;
  1935. if (from < 0) from = 0;
  1936. for (var i = 0; i < (len - from); i++) {
  1937. var chatName = new za(18, chatBoard[i + from].color);
  1938. chatName.C(chatBoard[i + from].name.split("*")[0]);
  1939. var a = ctx.measureText(chatBoard[i + from].name.split("*")[0]);
  1940. var width = chatName.getWidth();
  1941. var a = chatName.L();
  1942.  
  1943. ctx.drawImage(a, 18, chatCanvas.height / scaleFactor - 24 * (len - i - from));
  1944. var chatText = new za(18, '#666666');
  1945. chatText.C(': ' + chatBoard[i + from].message);
  1946. a = chatText.L();
  1947. ctx.drawImage(a, 20 + width * 1.8, chatCanvas.height / scaleFactor - 24 * (len - from - i));
  1948. }
  1949. //ctx.restore();
  1950. }
  1951.  
  1952.  
  1953.  
  1954.  
  1955. function Ob(a, b) {
  1956. function c() {
  1957. for (var c = "";;) {
  1958. var d = a.getUint16(b, !0);
  1959. b += 2;
  1960. if (0 == d) break;
  1961. c += String.fromCharCode(d)
  1962. }
  1963. return c
  1964. }
  1965.  
  1966. function k() {
  1967. for (var c = "";;) {
  1968. var d = a.getUint8(b++);
  1969. if (0 == d) break;
  1970. c += String.fromCharCode(d)
  1971. }
  1972. return c
  1973. }
  1974. ob = E = Date.now();
  1975. ea || (ea = !0, Pb());
  1976. var G = Math.random();
  1977. Na = false;
  1978. var n = a.getUint16(b, !0);
  1979. b += 2;
  1980. for (var r = 0; r < n; ++r) {
  1981. var p = I[a.getUint32(b, !0)],
  1982. f = I[a.getUint32(b + 4, !0)];
  1983. b += 8;
  1984. p && f && (f.X(), f.s = f.x, f.t = f.y, f.r = f.size, f.J = p.x, f.K = p.y, f.q = f.size, f.Q = E, Qb(p, f))
  1985. }
  1986. for (r = 0;;) {
  1987. n = a.getUint32(b, !0);
  1988. b += 4;
  1989. if (0 == n) break;
  1990. ++r;
  1991. var g, p = a.getInt32(b, !0);
  1992. b += 4;
  1993. f = a.getInt32(b, !0);
  1994. b += 4;
  1995. g = a.getInt16(b, !0);
  1996. b += 2;
  1997. var l = a.getUint8(b++),
  1998. m = a.getUint8(b++),
  1999. q = a.getUint8(b++),
  2000. m = Rb(l << 16 | m << 8 | q),
  2001. q = a.getUint8(b++),
  2002. s = !!(q & 1),
  2003. x = !!(q & 16),
  2004. w = null;
  2005. q & 2 && (b += 4 + a.getUint32(b, !0));
  2006. q & 4 && (w = k());
  2007. var t = c(),
  2008. l = null;
  2009. I.hasOwnProperty(n) ? (l = I[n], l.P(), l.s = l.x, l.t = l.y, l.r = l.size, l.color = m) : (l = new X(n, p, f, g, m, t), y.push(l), I[n] = l, l.ua = p, l.va = f);
  2010. l.h = s;
  2011. l.n = x;
  2012. l.J = p;
  2013. l.K = f;
  2014. l.q = g;
  2015. l.sa = G;
  2016. l.Q = E;
  2017. l.ba = q;
  2018. l.fa = w;
  2019. t && l.B(t); - 1 != A.indexOf(n) && -1 == h.indexOf(l) && (h.push(l), 1 == h.length && (u = l.x, v = l.y, pb(),
  2020. //document.getElementById("overlays").style.display = "none",
  2021. z = [], Oa = 0, Pa = h[0].color, Qa = !0, qb = Date.now(), R = Ra = Sa = 0))
  2022. }
  2023. G = a.getUint32(b, !0);
  2024. b += 4;
  2025.  
  2026. for (r = 0; r < G; r++) n = a.getUint32(b, !0), b += 4, l = I[n], null != l && l.X();
  2027. if (eatenS && bot) {
  2028. restartGame();
  2029. }
  2030. Na && 0 == h.length && (
  2031. rb = Date.now(),
  2032. Qa = !1,
  2033. console.log(eatenS),
  2034. eatenS //живой или нет true = труп
  2035. ||
  2036. inTMenu || (
  2037. sb ? (
  2038. console.log('test'),
  2039. ib(d.ab),
  2040. Sb(),
  2041. inTMenu = true,
  2042. e("#overlays").fadeIn(3E3),
  2043. e("#mini-map-wrapper").hide(),
  2044. e("#stats").show()
  2045. ) :
  2046. showOverlay(3E3)
  2047. )
  2048. )
  2049. }
  2050.  
  2051. function Pb() {
  2052. e("#connecting").hide();
  2053. tb();
  2054. N && (N(), N = null);
  2055. null != Ta && clearTimeout(Ta);
  2056. Ta = setTimeout(function() {
  2057. d.ga && (++ub, d.ga("set", "dimension2", ub))
  2058. }, 1E4)
  2059. }
  2060.  
  2061. function aa() { //похоже что отрисовка
  2062. if (Y()) {
  2063. var a = ja - m / 2,
  2064. b = ka - q / 2;
  2065. 64 > a * a + b * b || .01 > Math.abs(vb - ma) && .01 > Math.abs(wb - na) || (vb = ma, wb = na, a = P(21), a.setUint8(0, 16), a.setFloat64(1,
  2066. ma, !0), a.setFloat64(9, na, !0), a.setUint32(17, 0, !0));
  2067. playerPos = a
  2068. sendPosition(a);
  2069. }
  2070. }
  2071.  
  2072. function tb() {
  2073. if (Y() && ea && null != H) {
  2074. console.log(H);
  2075. var a = P(1 + 2 * H.length);
  2076. a.setUint8(0, 0);
  2077. for (var b = 0; b < H.length; ++b) a.setUint16(1 + 2 * b, H.charCodeAt(b), !0);
  2078. sendPosition(a);
  2079. }
  2080. }
  2081.  
  2082. function Y() {
  2083. return null != s && s.readyState == s.OPEN
  2084. }
  2085.  
  2086. function K(a) {
  2087. if (Y()) {
  2088. var b = P(1);
  2089. b.setUint8(0, a);
  2090. sendPosition(b)
  2091. }
  2092. }
  2093.  
  2094. function mb() {
  2095. if (Y() && null != D) {
  2096. if (!bot) {
  2097. var a = P(1 + D.length);
  2098. a.setUint8(0, 81);
  2099. for (var b = 0; b < D.length; ++b) a.setUint8(b + 1, D.charCodeAt(b));
  2100. sendPosition(a)
  2101. }
  2102. }
  2103. if (Sspec == true) {
  2104. K(1);
  2105. }
  2106. }
  2107.  
  2108. function db() {
  2109. m = d.innerWidth;
  2110. q = d.innerHeight;
  2111. Da.width = J.width = m;
  2112. Da.height = J.height = q;
  2113. var a = e("#helloContainer");
  2114. a.css("transform", "none");
  2115. var b = a.height(),
  2116. c = d.innerHeight;
  2117. b > c / 1.1 ? a.css("transform", "translate(-50%, -50%) scale(" + c / b / 1.1 + ")") : a.css("transform", "translate(-50%, -50%)");
  2118. xb()
  2119. }
  2120.  
  2121. function yb() {
  2122. var a;
  2123. a = 1 * Math.max(q / 1080, m / 1920);
  2124. return a *= M
  2125. }
  2126.  
  2127. function Tb() {
  2128. if (0 != h.length) {
  2129. for (var a = 0, b = 0; b < h.length; b++) a += h[b].size;
  2130. a = Math.pow(Math.min(64 / a, 1), .4) * yb();
  2131. g = (9 * g + a) / 10
  2132. }
  2133. }
  2134.  
  2135. function xb() {
  2136. var a, b = Date.now();
  2137. ++Ub;
  2138. E = b;
  2139. if (0 < h.length) {
  2140. Tb();
  2141. for (var c = a = 0, d = 0; d < h.length; d++) h[d].P(),
  2142. a += h[d].x / h.length, c += h[d].y / h.length;
  2143. fa = a;
  2144. ga = c;
  2145. ha = g;
  2146. u = (u + a) / 2;
  2147. v = (v + c) / 2
  2148. } else u = (29 * u + fa) / 30, v = (29 * v + ga) / 30, g = (9 * g + ha * yb()) / 10;
  2149. Jb();
  2150. Ea();
  2151. Ua ? (f.fillStyle = xa ? "#111111" : "#F2FBFF", f.globalAlpha = .05, f.fillRect(0, 0, m, q), f.globalAlpha = 1) : Vb();
  2152. y.sort(function(a, b) {
  2153. return a.size == b.size ? a.id - b.id : a.size - b.size
  2154. });
  2155. f.save();
  2156. f.translate(m / 2, q / 2);
  2157. f.scale(g, g);
  2158. f.translate(-u, -v);
  2159. for (d = 0; d < y.length; d++) y[d].w(f);
  2160. if (Ma) {
  2161. ra = (3 * ra + Ka) / 4;
  2162. sa = (3 * sa + La) / 4;
  2163. f.save();
  2164. f.strokeStyle = "#FFAAAA";
  2165. f.lineWidth = 10;
  2166. f.lineCap = "round";
  2167. f.lineJoin = "round";
  2168. f.globalAlpha = .5;
  2169. f.beginPath();
  2170. for (d = 0; d < h.length; d++) f.moveTo(h[d].x, h[d].y), f.lineTo(ra, sa);
  2171. f.stroke();
  2172. f.restore()
  2173. }
  2174. f.restore();
  2175. B && B.width && f.drawImage(B, m - B.width - 10, 10);
  2176. if (!hideChat) {
  2177. if ((chatCanvas != null) && (chatCanvas.width > 0)) f.drawImage(chatCanvas, 0, q - chatCanvas.height - 50); // draw Chat Board
  2178. }
  2179. O = Math.max(O, zb());
  2180. 0 != O && (null == ya && (ya = new za(24, "#FFFFFF")), ya.C(da("score") + ": " + ~~(O / 100)), c = ya.L(), a = c.width, f.globalAlpha = .2, f.fillStyle = "#000000", f.fillRect(10, 10, a + 10, 34), f.globalAlpha = 1, f.drawImage(c, 15, 15));
  2181. Wb();
  2182. b = Date.now() - b;
  2183. b > 1E3 / 60 ? F -= .01 : b < 1E3 / 65 && (F += .01);
  2184. .4 > F && (F = .4);
  2185. 1 < F && (F = 1);
  2186. b = E - Ab;
  2187. !Y() || eatenS || inTMenu ? (x += b / 2E3, 1 < x && (x = 1)) : (x -= b / 300, 0 > x && (x = 0));
  2188. 0 < x && (f.fillStyle = "#000000", f.globalAlpha = .5 * x, f.fillRect(0, 0, m, q), f.globalAlpha = 1);
  2189. Ab = E
  2190. }
  2191.  
  2192. function skorkaydet() {
  2193.  
  2194. var skor = "skor=" + ~~(O / 100) + "&c=1&oyuncuadi=" + oyuncu_adi;
  2195. e.ajax({
  2196. type: 'POST',
  2197. url: 'skor.php',
  2198. data: skor,
  2199. success: function(cevap) {
  2200. //console.log("Add:" + ~~(O / 100) + cevap);
  2201. }
  2202. });
  2203. }
  2204.  
  2205. function Vb() {
  2206. f.fillStyle = xa ? "#111111" : "#F2FBFF";
  2207. f.fillRect(0, 0, m, q);
  2208. f.save();
  2209. f.strokeStyle = xa ? "#AAAAAA" : "#000000";
  2210. f.globalAlpha = .2 * g;
  2211. for (var a = m / g, b = q / g, c = (-u + a / 2) % 50; c < a; c += 50) f.beginPath(), f.moveTo(c * g - .5, 0), f.lineTo(c * g - .5, b * g), f.stroke();
  2212. for (c = (-v + b / 2) % 50; c < b; c += 50) f.beginPath(), f.moveTo(0,
  2213. c * g - .5), f.lineTo(a * g, c * g - .5), f.stroke();
  2214. f.restore()
  2215. }
  2216.  
  2217. function Wb() {
  2218. if (bb && Va.width) {
  2219. var a = m / 5;
  2220. f.drawImage(Va, 5, 5, a, a)
  2221. }
  2222. }
  2223.  
  2224. function zb() {
  2225. for (var a = 0, b = 0; b < h.length; b++) a += h[b].q * h[b].q;
  2226. return a
  2227. }
  2228.  
  2229. function nb() {
  2230. B = null;
  2231. if (null != C || 0 != w.length)
  2232. if (null != C || Aa) {
  2233. B = document.createElement("canvas");
  2234. var a = B.getContext("2d"),
  2235. b = 60,
  2236. b = null == C ? b + 24 * w.length : b + 180,
  2237. c = Math.min(200, .3 * m) / 300;
  2238. B.width = 200 * c;
  2239. B.height = b * c;
  2240. a.scale(c, c);
  2241. a.globalAlpha = .4;
  2242. a.fillStyle = "#000000";
  2243. a.fillRect(0, 0, 200, b);
  2244. a.globalAlpha = 1;
  2245. a.fillStyle = "#FFFFFF";
  2246. c = null;
  2247. c = da("leaderboard");
  2248. a.font = "30px Ubuntu";
  2249. a.fillText(c, 100 - a.measureText(c).width / 2, 40);
  2250.  
  2251. var leaderColors = ["#E6339B", "#FFD700", "#33E660", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF"];
  2252.  
  2253. if (null == C)
  2254. for (a.font = "20px Ubuntu", b = 0; b < w.length; ++b) c = w[b].name.split("*")[0] || da("unnamed_cell"),
  2255. Aa || (c = da("unnamed_cell")),
  2256. -1 != A.indexOf(w[b].id) ? (h[0].name.split("*")[0] && (c = h[0].name.split("*")[0]),
  2257. a.fillStyle = "#FFAAAA") :
  2258. a.fillStyle = leaderColors[b],
  2259. c = b + 1 + ". " + c, a.fillText(c, 100 - a.measureText(c).width / 2, 70 + 24 * b);
  2260. else
  2261. for (b = c = 0; b < C.length; ++b) {
  2262. var d = c + C[b] * Math.PI * 2;
  2263. a.fillStyle = Xb[b + 1];
  2264. a.beginPath();
  2265. a.moveTo(100, 140);
  2266. a.arc(100, 140, 80, c, d, !1);
  2267. a.fill();
  2268. c = d
  2269. }
  2270. }
  2271. }
  2272.  
  2273. function Wa(a, b, c, d, e) {
  2274. this.V = a;
  2275. this.x = b;
  2276. this.y = c;
  2277. this.i = d;
  2278. this.b = e
  2279. }
  2280.  
  2281. function X(a, b, c, d, e, n) {
  2282. this.id = a;
  2283. this.s = this.x = b;
  2284. this.t = this.y = c;
  2285. this.r = this.size = d;
  2286. this.color = e;
  2287. this.a = [];
  2288. this.W();
  2289. this.B(n)
  2290. }
  2291.  
  2292. function Rb(a) {
  2293. for (a = a.toString(16); 6 > a.length;) a = "0" + a;
  2294. return "#" + a
  2295. }
  2296.  
  2297. function za(a, b, c, d) { //отрисовка кружка
  2298. a && (this.u = a);
  2299. b && (this.S = b);
  2300. this.U = !!c;
  2301. d && (this.v = d)
  2302. }
  2303.  
  2304. function Yb(a) {
  2305. for (var b = a.length, c, d; 0 < b;) d = Math.floor(Math.random() * b), b--, c = a[b], a[b] = a[d], a[d] = c
  2306. }
  2307.  
  2308. function W(a, b) {
  2309. var c = "1" == e("#helloContainer").attr("data-has-account-data");
  2310. e("#helloContainer").attr("data-has-account-data", "1");
  2311. if (null == b && d.localStorage.loginCache) {
  2312. var k = JSON.parse(d.localStorage.loginCache);
  2313. k.f = a.f;
  2314. k.d = a.d;
  2315. k.e = a.e;
  2316. d.localStorage.loginCache = JSON.stringify(k)
  2317. }
  2318. if (c) {
  2319. var G = +e(".warball-exp-bar .progress-bar-text").first().text().split("/")[0],
  2320. c = +e(".warball-exp-bar .progress-bar-text").first().text().split("/")[1].split(" ")[0],
  2321. k = e(".warball-profile-panel .progress-bar-star").first().text();
  2322. if (k != a.e) W({
  2323. f: c,
  2324. d: c,
  2325. e: k
  2326. }, function() {
  2327. e(".warball-profile-panel .progress-bar-star").text(a.e);
  2328. e(".warball-exp-bar .progress-bar").css("width", "100%");
  2329. e(".progress-bar-star").addClass("animated tada").one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function() {
  2330. e(".progress-bar-star").removeClass("animated tada")
  2331. });
  2332. setTimeout(function() {
  2333. e(".warball-exp-bar .progress-bar-text").text(a.d + "/" + a.d + " XP");
  2334. W({
  2335. f: 0,
  2336. d: a.d,
  2337. e: a.e
  2338. }, function() {
  2339. W(a, b)
  2340. })
  2341. }, 1E3)
  2342. });
  2343. else {
  2344. var n = Date.now(),
  2345. f = function() {
  2346. var c;
  2347. c = (Date.now() - n) / 1E3;
  2348. c = 0 > c ? 0 : 1 < c ? 1 : c;
  2349. c = c * c * (3 - 2 * c);
  2350. e(".warball-exp-bar .progress-bar-text").text(~~(G + (a.f - G) * c) + "/" + a.d + " XP");
  2351. e(".warball-exp-bar .progress-bar").css("width", (88 * (G + (a.f - G) * c) / a.d).toFixed(2) + "%");
  2352. 1 > c ? d.requestAnimationFrame(f) : b && b()
  2353. };
  2354. d.requestAnimationFrame(f)
  2355. }
  2356. } else e(".warball-profile-panel .progress-bar-star").text(a.e), e(".warball-exp-bar .progress-bar-text").text(a.f + "/" + a.d + " XP"), e(".warball-exp-bar .progress-bar").css("width", (88 * a.f / a.d).toFixed(2) + "%"), b && b()
  2357. }
  2358.  
  2359. function Bb(a) {
  2360. "string" == typeof a && (a = JSON.parse(a));
  2361. Date.now() + 18E5 > a.ka ? e("#helloContainer").attr("data-logged-in",
  2362. "0") : (d.localStorage.loginCache = JSON.stringify(a), D = a.ha, e(".warball-profile-name").text(a.name), mb(), W({
  2363. f: a.f,
  2364. d: a.d,
  2365. e: a.e
  2366. }), e("#helloContainer").attr("data-logged-in", "1"))
  2367. }
  2368.  
  2369. function Zb(a) {
  2370. a = a.split("\n");
  2371. Bb({
  2372. name: a[0],
  2373. ta: a[1],
  2374. ha: a[2],
  2375. ka: 1E3 * +a[3],
  2376. e: +a[4],
  2377. f: +a[5],
  2378. d: +a[6]
  2379. })
  2380. }
  2381.  
  2382. function Xa(a) {
  2383. if ("connected" == a.status) {
  2384. var b = a.authResponse.accessToken;
  2385. d.FB.api("/me/picture?width=180&height=180", function(a) {
  2386. d.localStorage.fbPictureCache = a.data.url;
  2387. e(".warball-profile-picture").attr("src", a.data.url)
  2388. });
  2389. e("#helloContainer").attr("data-logged-in",
  2390. "1");
  2391. null != D ? e.ajax("http://" + L_Domain, {
  2392. error: function() {
  2393. D = null;
  2394. Xa(a)
  2395. },
  2396. success: function(a) {
  2397. a = a.split("\n");
  2398. W({
  2399. e: +a[0],
  2400. f: +a[1],
  2401. d: +a[2]
  2402. })
  2403. },
  2404. dataType: "text",
  2405. method: "POST",
  2406. cache: !1,
  2407. crossDomain: !0,
  2408. data: D
  2409. }) : e.ajax("http://" + L_Domain + "/", {
  2410. error: function() {
  2411. D = null;
  2412. e("#helloContainer").attr("data-logged-in", "0")
  2413. },
  2414. success: Zb,
  2415. dataType: "text",
  2416. method: "POST",
  2417. cache: !1,
  2418. crossDomain: !0,
  2419. data: b
  2420. })
  2421. }
  2422. }
  2423.  
  2424. function gb(a) {
  2425. ca(":party");
  2426. e("#helloContainer").attr("data-party-state", "4");
  2427. a = decodeURIComponent(a).replace(/.*#/gim,
  2428. "");
  2429. Ya("#" + d.encodeURIComponent(a));
  2430. e.ajax(Za + "//" + L_Domain + "", {
  2431. error: function() {
  2432. e("#helloContainer").attr("data-party-state", "6")
  2433. },
  2434. success: function(b) {
  2435. b = b.split("\n");
  2436. e(".partyToken").val(L_Domain + "/#" + d.encodeURIComponent(a));
  2437. e("#helloContainer").attr("data-party-state", "5");
  2438. ca(":party");
  2439. Ha("ws://" + b[0], a)
  2440. },
  2441. dataType: "text",
  2442. method: "POST",
  2443. cache: !1,
  2444. crossDomain: !0,
  2445. data: a
  2446. })
  2447. }
  2448.  
  2449. function Ya(a) {
  2450. d.history && d.history.replaceState && d.history.replaceState({}, d.document.title, a)
  2451. }
  2452.  
  2453. function Qb(a, b) {
  2454. var c = -1 != A.indexOf(a.id),
  2455. d = -1 != A.indexOf(b.id),
  2456. e = 30 > b.size;
  2457. c && e && ++Oa;
  2458. e || !c || d || ++Ra
  2459. }
  2460.  
  2461. function Cb(a) {
  2462. a = ~~a;
  2463. var b = (a % 60).toString();
  2464. a = (~~(a / 60)).toString();
  2465. 2 > b.length && (b = "0" + b);
  2466. return a + ":" + b
  2467. }
  2468.  
  2469. function $b() {
  2470. if (null == w) return 0;
  2471. for (var a = 0; a < w.length; ++a)
  2472. if (-1 != A.indexOf(w[a].id)) return a + 1;
  2473. return 0
  2474. }
  2475.  
  2476. function Sb() {
  2477. Sregion = null;
  2478. t = null;
  2479.  
  2480. e("#skor").show();
  2481. //console.log(intervalPos);
  2482. //clearInterval(intervalPos);
  2483. //skorkaydet();
  2484. e(".stats-food-eaten").text(Oa);
  2485. e(".stats-time-alive").text(Cb((rb - qb) / 1E3));
  2486. e(".stats-leaderboard-time").text(Cb(Sa));
  2487. e(".stats-highest-mass").text(~~(O / 100));
  2488. e(".stats-cells-eaten").text(Ra);
  2489. e(".stats-top-position").text(0 == R ? ":(" : R);
  2490. var a = document.getElementById("statsGraph");
  2491. if (a) {
  2492. var b = a.getContext("2d"),
  2493. c = a.width,
  2494. a = a.height;
  2495. b.clearRect(0, 0, c, a);
  2496. if (2 < z.length) {
  2497. for (var d = 200, f = 0; f < z.length; f++) d = Math.max(z[f], d);
  2498. b.lineWidth = 3;
  2499. b.lineCap = "round";
  2500. b.lineJoin = "round";
  2501. b.strokeStyle = Pa;
  2502. b.fillStyle = Pa;
  2503. b.beginPath();
  2504. b.moveTo(0, a - z[0] / d * (a - 10) + 10);
  2505. for (f = 1; f < z.length; f += Math.max(~~(z.length / c), 1)) {
  2506. for (var n = f / (z.length - 1) * c, r = [], p = -20; 20 >= p; ++p) 0 > f + p || f + p >= z.length || r.push(z[f + p]);
  2507. r = r.reduce(function(a, b) {
  2508. return a + b
  2509. }) / r.length / d;
  2510. b.lineTo(n, a - r * (a - 10) + 10)
  2511. }
  2512. b.stroke();
  2513. b.globalAlpha = .5;
  2514. b.lineTo(c, a);
  2515. b.lineTo(0, a);
  2516. b.fill();
  2517. b.globalAlpha = 1
  2518. }
  2519. }
  2520. }
  2521. if (!d.agarioNoInit) {
  2522.  
  2523. var Za = d.location.protocol,
  2524. lb = "https:" == Za;
  2525. var Da, f, J, m, q, ba, chatCanvas = null,
  2526. s = null,
  2527. chatBoard = [],
  2528. u = 0,
  2529. v = 0,
  2530. A = [],
  2531. h = [],
  2532. I = {},
  2533. y = [],
  2534. V = [],
  2535. w = [],
  2536. ja = 0,
  2537. ka = 0,
  2538. ma = -1,
  2539. na = -1,
  2540. Ub = 0,
  2541. E = 0,
  2542. Ab = 0,
  2543. ta = 0,
  2544. ua = 0,
  2545. va = 1E4,
  2546. wa = 1E4,
  2547. hideChat = false,
  2548. g = 1,
  2549.  
  2550. t = null,
  2551. Db = !0,
  2552. Aa = !0,
  2553. $a = !1,
  2554. Na = !1,
  2555. O = 0,
  2556. xa = !1,
  2557. hasOverlay = true,
  2558. Eb = !1,
  2559. fa = u = ~~((ta + va) / 2),
  2560. ga = v = ~~((ua + wa) / 2),
  2561. ha = 1,
  2562. U = "",
  2563. C = null,
  2564. Ca = !1,
  2565. Ma = !1,
  2566. Ka = 0,
  2567. La = 0,
  2568. ra = 0,
  2569. sa = 0,
  2570. Fb = 0,
  2571. Xb = ["#333333",
  2572. "#FF3333", "#33FF33", "#3333FF"
  2573. ],
  2574. Ua = !1,
  2575. ea = !1,
  2576. ob = 0,
  2577. D = null,
  2578. M = 1,
  2579. x = 1,
  2580. eatenS = true,
  2581. Ga = 0,
  2582. Ia = {};
  2583.  
  2584. (function() {
  2585. var a = d.location.search;
  2586. "?" == a.charAt(0) && (a = a.slice(1));
  2587. for (var a = a.split("&"), b = 0; b < a.length; b++) {
  2588. var c = a[b].split("=");
  2589. Ia[c[0]] = c[1]
  2590. }
  2591. })();
  2592. var bb = "ontouchstart" in d && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(d.navigator.userAgent),
  2593. Va = new Image;
  2594. Va.src = "img/split.png";
  2595. var Gb = document.createElement("canvas");
  2596. if ("undefined" == typeof console || "undefined" == typeof DataView || "undefined" == typeof WebSocket || null == Gb || null == Gb.getContext || null == d.localStorage) alert("You browser does not support this game, we recommend you to use Firefox to play this");
  2597. else {
  2598. var oa = null;
  2599. if (!bot) d.setNick = function(a, mySkin) {
  2600. Sspec = true;
  2601. if (mySkin == "") {
  2602. mySkin = "0";
  2603. }
  2604.  
  2605. a = a + "*" + mySkin;
  2606. H = a;
  2607. console.log("START GAME");
  2608. hb();
  2609. oyuncu_adi = H.split("*")[0];
  2610. //tb();
  2611. if (!bot) setRegion(host);
  2612.  
  2613. O = 0
  2614.  
  2615. if (!bot && !botsCreated) {
  2616.  
  2617. console.log("create bots...");
  2618. botsCreated = true;
  2619. for (i = 0; i < botsCount; i++) {
  2620. //нужно делать паузу перед новым ботом,
  2621. //чтобы сервер не отклонил слишком частые соединения
  2622. setTimeout(function() {
  2623. this.game(window, window.jQuery, true, botsUrl, "not_bot_" + i + "*1");
  2624. }, 500);
  2625. }
  2626.  
  2627. }
  2628.  
  2629. };
  2630. else {
  2631. H = botName;
  2632. }
  2633.  
  2634. d.savescreenshoot = function(arg) {
  2635.  
  2636. // if(~~(O / 100) > 10000) {
  2637.  
  2638.  
  2639.  
  2640. //var oyuncukim = $.cookie("nick");
  2641. var veri = {
  2642. 'ss': arg,
  2643. 'oyuncuadi': oyuncu_adi,
  2644. 'puan': ~~(O / 100)
  2645. }
  2646. e.ajax({
  2647. type: 'POST',
  2648. url: '/saveSS.jsp',
  2649. data: veri,
  2650. success: function(cevap) {
  2651. console.log(cevap);
  2652. }
  2653.  
  2654.  
  2655.  
  2656.  
  2657. });
  2658.  
  2659. //}
  2660.  
  2661. }
  2662. if (!bot) d.setHideChat = function(arg) {
  2663. hideChat = arg;
  2664. if (arg) {
  2665. e("#chat_textbox").hide();
  2666. } else {
  2667. e("#chat_textbox").show();
  2668. }
  2669. };
  2670. if (!bot) d.setHideMap = function(arg) {
  2671. hideMap = arg;
  2672. if (arg) {
  2673. e("#mini-map-wrapper").hide();
  2674. } else {
  2675. e("#mini-map-wrapper").show();
  2676. }
  2677. };
  2678. if (!bot) d.setRegion = la;
  2679. if (!bot) d.setSkins = function(a) {
  2680. Db = a
  2681. };
  2682. if (!bot) d.setSkins(false);
  2683. if (!bot) d.setNames = function(a) {
  2684. Aa = a
  2685. };
  2686. if (!bot) d.setDarkTheme = function(a) {
  2687. xa = a
  2688. };
  2689. if (!bot) d.setColors = function(a) {
  2690. $a = a
  2691. };
  2692. if (!bot) d.setShowMass = function(a) {
  2693. Eb = a
  2694. };
  2695. if (!bot) d.spectate = function(a) {
  2696. kb1(host);
  2697. Sspec = true;
  2698. hb()
  2699. e("#mini-map-wrapper").hide();
  2700. };
  2701.  
  2702. if (!bot) d.newConnection = function(a) {
  2703. host = a;
  2704. }
  2705.  
  2706.  
  2707. /*
  2708. d.setGameMode = function (a) {
  2709.  
  2710. a != U && (":party" == U && e("#helloContainer").attr("data-party-state","0"), ca(a), ":party" != a && L())
  2711. };
  2712. */
  2713. if (!bot) d.setAcid = function(a) {
  2714. Ua = a
  2715. };
  2716. null != d.localStorage && (null == d.localStorage.AB9 && (d.localStorage.AB9 = 0 + ~~(100 * Math.random())), Fb = +d.localStorage.AB9, d.ABGroup = Fb);
  2717. e.get(Za + "//" + L_Domain + "", function(a) {
  2718. var b = a.split(" ");
  2719. a = b[0];
  2720. b = b[1] || ""; - 1 == ["UA"].indexOf(a) && Hb.push("ussr");
  2721. ia.hasOwnProperty(a) && ("string" == typeof ia[a] ? t || la(ia[a]) : ia[a].hasOwnProperty(b) && (t || la(ia[a][b])))
  2722. }, "text");
  2723. if (!bot) d.ga && d.ga("send", "event", "User-Agent", d.navigator.userAgent, {
  2724. nonInteraction: 1
  2725. });
  2726. var pa = false,
  2727. jb = 0;
  2728. setTimeout(function() {
  2729. pa = true
  2730. }, Math.max(6E4 * jb, 3E3));
  2731. var ia = {
  2732. AF: "JP-Tokyo",
  2733.  
  2734. ZW: "EU-London"
  2735. },
  2736. N = null;
  2737. if (!bot) d.connect = Ha;
  2738. var qa = 500,
  2739. Ta = null,
  2740. ub = 0,
  2741. vb = -1,
  2742. wb = -1,
  2743. B = null,
  2744. F = 1,
  2745. ya = null,
  2746. eb = function() {
  2747. var a = Date.now(),
  2748. b = 1E3 / 60;
  2749. return function() {
  2750. d.requestAnimationFrame(eb);
  2751. var c = Date.now(),
  2752. e = c - a;
  2753. e > b && (a = c - e % b, !Y() || 290 > Date.now() - ob ? xb() : console.warn("Skipping draw"), ac())
  2754. }
  2755. }(),
  2756. Z = {},
  2757. Hb = "".split(";"),
  2758. bc = "".split(";"),
  2759. $ = {};
  2760. Wa.prototype = {
  2761. V: null,
  2762. x: 0,
  2763. y: 0,
  2764. i: 0,
  2765. b: 0
  2766. };
  2767. X.prototype = {
  2768. id: 0,
  2769. a: null,
  2770. name: null,
  2771. o: null,
  2772. O: null,
  2773. x: 0,
  2774. y: 0,
  2775. size: 0,
  2776. s: 0,
  2777. t: 0,
  2778. r: 0,
  2779. J: 0,
  2780. K: 0,
  2781. q: 0,
  2782. ba: 0,
  2783. Q: 0,
  2784. sa: 0,
  2785. ja: 0,
  2786. G: !1,
  2787. h: !1,
  2788. n: !1,
  2789. R: !0,
  2790. Y: 0,
  2791. fa: null,
  2792. X: function() {
  2793. var a;
  2794. for (a = 0; a < y.length; a++)
  2795. if (y[a] == this) {
  2796. y.splice(a, 1);
  2797. break
  2798. }
  2799. delete I[this.id];
  2800. a = h.indexOf(this); - 1 != a && (Na = !0, h.splice(a, 1));
  2801. a = A.indexOf(this.id); - 1 != a && A.splice(a, 1);
  2802. this.G = !0;
  2803. 0 < this.Y && V.push(this)
  2804. },
  2805. l: function() {
  2806. return Math.max(~~(.3 * this.size), 24)
  2807. },
  2808. B: function(a) {
  2809. if (this.name = a) null == this.o ? this.o = new za(this.l(), "#FFFFFF", !0, "#000000") : this.o.M(this.l()), this.o.C(this.name)
  2810. },
  2811. W: function() {
  2812. for (var a = this.I(); this.a.length > a;) {
  2813. var b = ~~(Math.random() * this.a.length);
  2814. this.a.splice(b, 1)
  2815. }
  2816. for (0 == this.a.length && 0 < a && this.a.push(new Wa(this, this.x, this.y, this.size, Math.random() - .5)); this.a.length < a;) b = ~~(Math.random() * this.a.length), b = this.a[b], this.a.push(new Wa(this, b.x, b.y, b.i, b.b))
  2817. },
  2818. I: function() {
  2819. var a = 10;
  2820. 20 > this.size && (a = 0);
  2821. this.h && (a = 30);
  2822. var b = this.size;
  2823. this.h || (b *= g);
  2824. b *= F;
  2825. this.ba & 32 && (b *= .25);
  2826. return ~~Math.max(b, a)
  2827. },
  2828. qa: function() {
  2829. this.W();
  2830. for (var a = this.a, b = a.length, c = 0; c < b; ++c) {
  2831. var d = a[(c - 1 + b) % b].b,
  2832. e = a[(c + 1) % b].b;
  2833. a[c].b += (Math.random() - .5) * (this.n ? 3 : 1);
  2834. a[c].b *= .7;
  2835. 10 < a[c].b && (a[c].b = 10); - 10 > a[c].b && (a[c].b = -10);
  2836. a[c].b = (d + e + 8 * a[c].b) / 10
  2837. }
  2838. for (var n = this, f = this.h ? 0 : (this.id / 1E3 + E / 1E4) % (2 * Math.PI), c = 0; c < b; ++c) {
  2839. var p = a[c].i,
  2840. d = a[(c - 1 + b) % b].i,
  2841. e = a[(c + 1) % b].i;
  2842. if (15 < this.size && null != ba && 20 < this.size * g && 0 < this.id) {
  2843. var h = !1,
  2844. Ja = a[c].x,
  2845. l = a[c].y;
  2846. ba.ra(Ja - 5, l - 5, 10, 10, function(a) {
  2847. a.V != n && 25 > (Ja - a.x) * (Ja - a.x) + (l - a.y) * (l - a.y) && (h = !0)
  2848. });
  2849. !h && (a[c].x < ta || a[c].y < ua || a[c].x > va || a[c].y > wa) && (h = !0);
  2850. h && (0 < a[c].b && (a[c].b = 0), a[c].b -= 1)
  2851. }
  2852. p += a[c].b;
  2853. 0 > p && (p = 0);
  2854. p = this.n ? (19 * p + this.size) / 20 : (12 * p + this.size) / 13;
  2855. a[c].i = (d + e + 8 * p) / 10;
  2856. d = 2 * Math.PI / b;
  2857. e = this.a[c].i;
  2858. this.h && 0 == c % 2 && (e += 5);
  2859. a[c].x = this.x + Math.cos(d * c + f) * e;
  2860. a[c].y = this.y + Math.sin(d * c + f) * e
  2861. }
  2862. },
  2863. P: function() {
  2864. if (0 >= this.id) return 1;
  2865. var a;
  2866. a = (E - this.Q) / 120;
  2867. a = 0 > a ? 0 : 1 < a ? 1 : a;
  2868. var b = 0 > a ? 0 : 1 < a ? 1 : a;
  2869. this.l();
  2870. if (this.G && 1 <= b) {
  2871. var c = V.indexOf(this); - 1 != c && V.splice(c, 1)
  2872. }
  2873. this.x = a * (this.J - this.s) + this.s;
  2874. this.y = a * (this.K - this.t) + this.t;
  2875. this.size = b * (this.q - this.r) + this.r;
  2876. return b
  2877. },
  2878. N: function() {
  2879. return 0 >= this.id ? !0 : this.x + this.size + 40 < u - m / 2 / g || this.y + this.size + 40 < v - q / 2 / g || this.x - this.size - 40 > u + m / 2 / g || this.y - this.size - 40 > v + q / 2 / g ? !1 : !0
  2880. },
  2881. w: function(a) {
  2882. if (this.N()) {
  2883. ++this.Y;
  2884. var b = 0 < this.id && !this.h && !this.n && .4 > g;
  2885. 5 > this.I() && 0 < this.id && (b = !0);
  2886. if (this.R && !b)
  2887. for (var c = 0; c < this.a.length; c++) this.a[c].i = this.size;
  2888. this.R = b;
  2889. a.save();
  2890. this.ja = E;
  2891. c = this.P();
  2892. this.G && (a.globalAlpha *= 1 - c);
  2893. a.lineWidth = 10;
  2894. a.lineCap = "round";
  2895. a.lineJoin = this.h ? "miter" : "round";
  2896. $a ? (a.fillStyle = "#FFFFFF", a.strokeStyle = "#AAAAAA") : (a.fillStyle = this.color, a.strokeStyle = this.color);
  2897. if (b) a.beginPath(), a.arc(this.x, this.y, this.size + 5, 0, 2 * Math.PI, !1);
  2898. else {
  2899. this.qa();
  2900. a.beginPath();
  2901. var d = this.I();
  2902. a.moveTo(this.a[0].x, this.a[0].y);
  2903. for (c = 1; c <= d; ++c) {
  2904. var e = c % d;
  2905. a.lineTo(this.a[e].x, this.a[e].y)
  2906. }
  2907. }
  2908. a.closePath();
  2909.  
  2910. c = this.name.toLowerCase().split("*");
  2911.  
  2912. if (c[1] == "") {
  2913. c = "";
  2914. } else {
  2915. c = c[1];
  2916. }
  2917.  
  2918. var rsyr = Math.floor(Math.random() * (100000000000 - 1) + 1);
  2919. //alert(c);
  2920. !this.n && Db && ":team" != U ? (d = this.fa, null == d ? d = null : ":" == d[0] ? ($.hasOwnProperty(d) || ($[d] = new Image,
  2921. $[d].src = d.slice(1)),
  2922. d = 0 != $[d].width && $[d].complete ? $[d] : null) : d = null,
  2923. d || (1 != Hb.indexOf(c) ? (Z.hasOwnProperty(c) ||
  2924. (Z[c] = new Image,
  2925. Z[c].src = "http://" + L_Domain + "/skins/orig/" + c + ".png?" + rsyr),
  2926.  
  2927. d = 0 != Z[c].width && Z[c].complete ? Z[c] : null) : d = null)) : d = null;
  2928. e = d;
  2929. b || a.stroke();
  2930. a.fill();
  2931. null != e && (a.save(), a.clip(), a.drawImage(e, this.x - this.size, this.y - this.size, 2 * this.size, 2 * this.size), a.restore());
  2932. ($a || 15 < this.size) && !b && (a.strokeStyle = "#000000", a.globalAlpha *= .1, a.stroke());
  2933. a.globalAlpha = 1;
  2934. d = -1 != h.indexOf(this);
  2935. b = ~~this.y;
  2936. if (0 != this.id && (Aa || d) && this.name && this.o && (null == e || -1 == bc.indexOf(c))) {
  2937.  
  2938. e = this.o;
  2939. e.C(this.name.split("*")[0]);
  2940. e.M(this.l());
  2941. c = 0 >= this.id ? 1 : Math.ceil(10 * g) / 10;
  2942. e.ea(c);
  2943. var e = e.L(),
  2944. n = ~~(e.width / c),
  2945. f = ~~(e.height / c);
  2946. a.drawImage(e, ~~this.x - ~~(n / 2), b - ~~(f / 2), n, f);
  2947. b += e.height / 2 / c + 4
  2948. }
  2949. 0 < this.id && Eb && (d || 0 == h.length && (!this.h || this.n) && 20 < this.size) && (null == this.O && (this.O = new za(this.l() / 2, "#FFFFFF", !0, "#000000")), d = this.O, d.M(this.l() / 2), d.C(~~(this.size * this.size / 100)), c = Math.ceil(10 * g) / 10, d.ea(c), e = d.L(), n = ~~(e.width / c), f = ~~(e.height / c), a.drawImage(e, ~~this.x - ~~(n / 2), b - ~~(f / 2), n, f));
  2950. a.drawImage(blobImage, this.x - this.size, this.y - this.size, 2 * this.size, 2 * this.size);
  2951.  
  2952. a.restore()
  2953. }
  2954. }
  2955. };
  2956. za.prototype = {
  2957. F: "",
  2958. S: "#000000",
  2959. U: !1,
  2960. v: "#000000",
  2961. u: 16,
  2962. p: null,
  2963. T: null,
  2964. k: !1,
  2965. D: 1,
  2966. _value: "",
  2967. _dirty: false,
  2968. M: function(a) {
  2969. this.u != a && (this.u = a, this.k = !0)
  2970. },
  2971. ea: function(a) {
  2972. this.D != a && (this.D = a, this.k = !0)
  2973. },
  2974. setStrokeColor: function(a) {
  2975. this.v != a && (this.v = a, this.k = !0)
  2976. },
  2977. C: function(a) {
  2978. a != this.F && (this.F = a, this.k = !0)
  2979. },
  2980. getWidth: function() {
  2981. if (!bot) {
  2982. return (f.measureText(this.F).width + 6);
  2983. }
  2984. },
  2985. L: function() {
  2986. null == this.p && (this.p = document.createElement("canvas"), this.T = this.p.getContext("2d"));
  2987. if (this.k) {
  2988. this.k = !1;
  2989. var a = this.p,
  2990. b = this.T,
  2991. c = this.F,
  2992. d = this.D,
  2993. e = this.u,
  2994. f = e + "px Ubuntu";
  2995. b.font = f;
  2996. var r = ~~(.2 * e);
  2997. a.width = (b.measureText(c).width + 6) * d;
  2998. a.height = (e + r) * d;
  2999. b.font = f;
  3000. b.scale(d, d); //увеличение
  3001. b.globalAlpha = 1;
  3002. b.lineWidth = 3;
  3003. b.strokeStyle = this.v;
  3004. b.fillStyle = this.S;
  3005. this.U && b.strokeText(c, 3, e - r / 2);
  3006. b.fillText(c, 3, e - r / 2)
  3007. }
  3008.  
  3009. return this.p
  3010. }
  3011. };
  3012. Date.now || (Date.now = function() {
  3013. return (new Date).getTime()
  3014. });
  3015. (function() {
  3016. for (var a = ["ms", "moz", "webkit", "o"], b = 0; b < a.length && !d.requestAnimationFrame; ++b) d.requestAnimationFrame = d[a[b] + "RequestAnimationFrame"],
  3017. d.cancelAnimationFrame = d[a[b] + "CancelAnimationFrame"] || d[a[b] + "CancelRequestAnimationFrame"];
  3018. d.requestAnimationFrame || (d.requestAnimationFrame = function(a) {
  3019. return setTimeout(a, 1E3 / 60)
  3020. }, d.cancelAnimationFrame = function(a) {
  3021. clearTimeout(a)
  3022. })
  3023. })();
  3024. var Kb = {
  3025. la: function(a) {
  3026. function b(a, b, c, d, e) {
  3027. this.x = a;
  3028. this.y = b;
  3029. this.j = c;
  3030. this.g = d;
  3031. this.depth = e;
  3032. this.items = [];
  3033. this.c = []
  3034. }
  3035. var c = a.ma || 2,
  3036. d = a.na || 4;
  3037. b.prototype = {
  3038. x: 0,
  3039. y: 0,
  3040. j: 0,
  3041. g: 0,
  3042. depth: 0,
  3043. items: null,
  3044. c: null,
  3045. H: function(a) {
  3046. for (var b = 0; b < this.items.length; ++b) {
  3047. var c = this.items[b];
  3048. if (c.x >= a.x && c.y >= a.y && c.x < a.x + a.j && c.y < a.y + a.g) return !0
  3049. }
  3050. if (0 != this.c.length) {
  3051. var d = this;
  3052. return this.$(a, function(b) {
  3053. return d.c[b].H(a)
  3054. })
  3055. }
  3056. return !1
  3057. },
  3058. A: function(a, b) {
  3059. for (var c = 0; c < this.items.length; ++c) b(this.items[c]);
  3060. if (0 != this.c.length) {
  3061. var d = this;
  3062. this.$(a, function(c) {
  3063. d.c[c].A(a, b)
  3064. })
  3065. }
  3066. },
  3067. m: function(a) {
  3068. 0 != this.c.length ? this.c[this.Z(a)].m(a) : this.items.length >= c && this.depth < d ? (this.ia(), this.c[this.Z(a)].m(a)) : this.items.push(a)
  3069. },
  3070. Z: function(a) {
  3071. return a.x < this.x + this.j / 2 ? a.y < this.y + this.g / 2 ? 0 : 2 : a.y < this.y + this.g / 2 ? 1 : 3
  3072. },
  3073. $: function(a, b) {
  3074. return a.x < this.x + this.j / 2 && (a.y < this.y + this.g / 2 && b(0) || a.y >= this.y + this.g / 2 && b(2)) || a.x >= this.x + this.j / 2 && (a.y < this.y + this.g / 2 && b(1) || a.y >= this.y + this.g / 2 && b(3)) ? !0 : !1
  3075. },
  3076. ia: function() {
  3077. var a = this.depth + 1,
  3078. c = this.j / 2,
  3079. d = this.g / 2;
  3080. this.c.push(new b(this.x, this.y, c, d, a));
  3081. this.c.push(new b(this.x + c, this.y, c, d, a));
  3082. this.c.push(new b(this.x, this.y + d, c, d, a));
  3083. this.c.push(new b(this.x + c, this.y + d, c, d, a));
  3084. a = this.items;
  3085. this.items = [];
  3086. for (c = 0; c < a.length; c++) this.m(a[c])
  3087. },
  3088. clear: function() {
  3089. for (var a = 0; a < this.c.length; a++) this.c[a].clear();
  3090. this.items.length = 0;
  3091. this.c.length = 0
  3092. }
  3093. };
  3094. var e = {
  3095. x: 0,
  3096. y: 0,
  3097. j: 0,
  3098. g: 0
  3099. };
  3100. return {
  3101. root: new b(a.ca, a.da, a.oa - a.ca, a.pa - a.da, 0),
  3102. m: function(a) {
  3103. this.root.m(a)
  3104. },
  3105. A: function(a, b) {
  3106. this.root.A(a, b)
  3107. },
  3108. ra: function(a, b, c, d, f) {
  3109. e.x = a;
  3110. e.y = b;
  3111. e.j = c;
  3112. e.g = d;
  3113. this.root.A(e, f)
  3114. },
  3115. H: function(a) {
  3116. return this.root.H(a)
  3117. },
  3118. clear: function() {
  3119. this.root.clear()
  3120. }
  3121. }
  3122. }
  3123. },
  3124. pb = function() {
  3125. var a = new X(0, 0, 0, 32, "#ED1C24", ""),
  3126. b = document.createElement("canvas");
  3127. b.width = 32;
  3128. b.height = 32;
  3129. var c = b.getContext("2d");
  3130. return function() {
  3131. 0 < h.length && (a.color = h[0].color, a.B(h[0].name));
  3132. c.clearRect(0, 0, 32, 32);
  3133. c.save();
  3134. c.translate(16, 16);
  3135. c.scale(.4, .4);
  3136. a.w(c);
  3137. c.restore();
  3138. var d = document.getElementById("favicon"),
  3139. e = d.cloneNode(!0);
  3140. e.setAttribute("href", b.toDataURL("image/png"));
  3141. d.parentNode.replaceChild(e, d)
  3142. }
  3143. }();
  3144. e(function() {
  3145. pb()
  3146. });
  3147. e(function() {
  3148. +d.localStorage.wannaLogin && (d.localStorage.loginCache && Bb(d.localStorage.loginCache), d.localStorage.fbPictureCache && e(".warball-profile-picture").attr("src", d.localStorage.fbPictureCache))
  3149. });
  3150. if (!bot) d.facebookLogin = function() {
  3151. d.localStorage.wannaLogin = 1
  3152. };
  3153. if (!bot) d.fbAsyncInit = function() {
  3154. function a() {
  3155. d.localStorage.wannaLogin = 1;
  3156. null == d.FB ? alert("You seem to have something blocking Facebook on your browser, please check for any extensions") : d.FB.login(function(a) {
  3157. Xa(a)
  3158. }, {
  3159. scope: "public_profile, email"
  3160. })
  3161. }
  3162. d.FB.init({
  3163. appId: "125735547767875",
  3164. cookie: !0,
  3165. xfbml: !0,
  3166. status: !0,
  3167. version: "v2.4"
  3168. });
  3169. d.FB.Event.subscribe("auth.statusChange", function(b) {
  3170. +d.localStorage.wannaLogin && ("connected" == b.status ? Xa(b) : a())
  3171. });
  3172. d.facebookLogin = a
  3173. };
  3174. if (!bot) d.logout = function() {
  3175. D = null;
  3176. e("#helloContainer").attr("data-logged-in", "0");
  3177. e("#helloContainer").attr("data-has-account-data", "0");
  3178. delete d.localStorage.wannaLogin;
  3179. delete d.localStorage.loginCache;
  3180. delete d.localStorage.fbPictureCache;
  3181. L()
  3182. };
  3183. var ac = function() {
  3184. function a(a, b, c, d, e) {
  3185. var f = b.getContext("2d"),
  3186. g = b.width;
  3187. b = b.height;
  3188. a.color = e;
  3189. a.B(c);
  3190. a.size = d;
  3191. f.save();
  3192. f.translate(g / 2, b / 2);
  3193. a.w(f);
  3194. f.restore()
  3195. }
  3196. for (var b = new X(-1, 0, 0, 32, "#5bc0de", ""), c = new X(-1, 0, 0, 32, "#5bc0de", ""), d = "#0791ff #5a07ff #ff07fe #ffa507 #ff0774 #077fff #3aff07 #ff07ed #07a8ff #ff076e #3fff07 #ff0734 #07ff20 #ff07a2 #ff8207 #07ff0e".split(" "),
  3197. f = [], g = 0; g < d.length; ++g) {
  3198. var h = g / d.length * 12,
  3199. p = 30 * Math.sqrt(g / d.length);
  3200. f.push(new X(-1, Math.cos(h) * p, Math.sin(h) * p, 10, d[g], ""))
  3201. }
  3202. Yb(f);
  3203. var m = document.createElement("canvas");
  3204. m.getContext("2d");
  3205. m.width = m.height = 70;
  3206. a(c, m, "", 26, "#ebc0de");
  3207. return function() {
  3208. e(".cell-spinner").filter(":visible").each(function() {
  3209. var c = e(this),
  3210. d = Date.now(),
  3211. f = this.width,
  3212. g = this.height,
  3213. h = this.getContext("2d");
  3214. h.clearRect(0, 0, f, g);
  3215. h.save();
  3216. h.translate(f / 2, g / 2);
  3217. for (var k = 0; 10 > k; ++k) h.drawImage(m, (.1 * d + 80 * k) % (f + 140) - f / 2 - 70 - 35,
  3218. g / 2 * Math.sin((.001 * d + k) % Math.PI * 2) - 35, 70, 70);
  3219. h.restore();
  3220. (c = c.attr("data-itr")) && (c = da(c));
  3221. a(b, this, c || "", +e(this).attr("data-size"), "#5bc0de")
  3222. });
  3223. e("#statsPellets").filter(":visible").each(function() {
  3224. e(this);
  3225. var b = this.width,
  3226. c = this.height;
  3227. this.getContext("2d").clearRect(0, 0, b, c);
  3228. for (b = 0; b < f.length; b++) a(f[b], this, "", f[b].size, f[b].color)
  3229. })
  3230. }
  3231. }();
  3232. if (!bot) d.createParty = function() {
  3233. ca(":party");
  3234. N = function(a) {
  3235. Ya("/#" + d.encodeURIComponent(a));
  3236. e(".partyToken").val(L_Domain + "/#" + d.encodeURIComponent(a));
  3237. e("#helloContainer").attr("data-party-state",
  3238. "1")
  3239. };
  3240. L()
  3241. };
  3242. if (!bot) d.joinParty = gb;
  3243. if (!bot) d.cancelParty = function() {
  3244. Ya("/");
  3245. e("#helloContainer").attr("data-party-state", "0");
  3246. ca("");
  3247. L()
  3248. };
  3249. var z = [],
  3250. Oa = 0,
  3251. Pa = "#000000",
  3252. T = false,
  3253. Qa = false,
  3254. qb = 0,
  3255. rb = 0,
  3256. Sa = 0,
  3257. Ra = 0,
  3258. R = 0,
  3259. sb = !0;
  3260. setInterval(function() {
  3261. Qa && z.push(zb() / 100)
  3262. }, 1E3 / 60);
  3263. setInterval(function() {
  3264. if (Y()) {
  3265. //if(!bot){
  3266. var a = P(5);
  3267. a.setUint8(0, 90);
  3268. a.setUint32(1, 1441210800, !0);
  3269. latency = new Date;
  3270. sendPosition(a);
  3271. //}
  3272. }
  3273. }, 1000);
  3274. setInterval(function() {
  3275. var a = $b();
  3276. 0 != a && (++Sa, 0 == R && (R = a), R = Math.min(R, a))
  3277. }, 1E3);
  3278. if (!bot) d.closeStats = function() {
  3279. inTMenu = false;
  3280. e("#stats").hide();
  3281. showOverlay(0)
  3282. };
  3283. if (!bot) d.setSkipStats = function(a) {
  3284. sb = !a
  3285. };
  3286.  
  3287. e(function() {
  3288. e(Ib)
  3289. })
  3290. }
  3291. }
  3292.  
  3293. };
  3294.  
  3295. var playerX = 0;
  3296. var playerY = 0;
  3297.  
  3298. game(window, window.jQuery);
  3299.  
  3300. $(document).ready(function() {
  3301. $('#chat_textbox').bind("cut copy paste", function(e) {
  3302. e.preventDefault();
  3303. });
  3304.  
  3305. });
  3306.  
  3307.  
  3308. function clickIE4() {
  3309. if (event.button == 2) {
  3310.  
  3311. return false;
  3312. }
  3313. }
  3314.  
  3315. function clickNS4(e) {
  3316. if (document.layers || document.getElementById && !document.all) {
  3317. if (e.which == 2 || e.which == 3) {
  3318. //alert(message);
  3319. return false;
  3320. }
  3321. }
  3322. }
  3323.  
  3324. if (document.layers) {
  3325. document.captureEvents(Event.MOUSEDOWN);
  3326. document.onmousedown = clickNS4;
  3327. } else if (document.all && !document.getElementById) {
  3328. document.onmousedown = clickIE4;
  3329. }
  3330.  
  3331. document.oncontextmenu = new Function("return false")
Add Comment
Please, Sign In to add comment