Pathfinder

A pathfinder made by WYND C:

  1. // ==UserScript==
  2. // @name Pathfinder
  3. // @namespace http://tampermonkey.net/
  4. // @version -
  5. // @match *://moomoo.io/*
  6. // @description A pathfinder made by WYND C:
  7. // @match *://dev.moomoo.io/*
  8. // @match *://sandbox.moomoo.io/*
  9. // @author Wynd
  10. // @grant none
  11. // ==/UserScript==
  12. const WorkerCode = `
  13. self.onmessage = (msg) => {
  14. let bitmap = msg.data;
  15. let canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
  16. let ctx = canvas.getContext("2d");
  17. ctx.drawImage(bitmap, 0, 0);
  18. ctx.clearRect(Math.floor(bitmap.width/2), Math.floor(bitmap.height/2), 1, 1);
  19.  
  20.  
  21. let endpoints = [];
  22. let data = ctx.getImageData(0,0,bitmap.width, bitmap.height).data;
  23.  
  24. let map = new Map(canvas);
  25.  
  26.  
  27. for(let i = 0;i < data.length;i += 4){
  28. let l = i / 4;
  29. map.graph[l % bitmap.width][Math.floor(l / bitmap.width)].cost = data[i];
  30. if(data[i + 2]){
  31. endpoints.push({
  32. x: l % bitmap.width,
  33. y: Math.floor(l / bitmap.width),
  34. });
  35. }
  36. }
  37. bitmap.close();
  38.  
  39. if(!endpoints.length){
  40. endpoints.push(map.getCentreNode());
  41. }
  42.  
  43. //begin the pathfinding
  44.  
  45. let openSet = new BinHeap();
  46. openSet.setCompare = (a, b) => a.f > b.f;
  47. openSet.push(map.getCentreNode());
  48.  
  49. let currentNode;
  50.  
  51.  
  52. while(openSet.length){
  53. currentNode = openSet.remove(0)
  54. if(endpoints.some((goal) => goal.x == currentNode.x && goal.y == currentNode.y)){
  55. break;
  56. }
  57.  
  58. let neighbors = map.getNeighbor(currentNode.x, currentNode.y);
  59. for(let i = 0;i < neighbors.length;i++){
  60. let neighbor = neighbors[i];
  61. if(neighbor && neighbor.cost == 0){//may make it weighted later
  62. let tempG = currentNode.g + Map[i % 2 == 0 ? "DiagonalCost" : "TraversalCost"];
  63. if(tempG < neighbor.g){
  64. neighbor.parent = currentNode;
  65. neighbor.g = tempG;
  66. neighbor.h = Math.min.apply(Math, endpoints.map((goal) => fastHypot(neighbor.x - goal.x, neighbor.y - goal.y)));
  67. if(!neighbor.inset){
  68. openSet.insert(neighbor);
  69. }
  70. }
  71. }
  72. }
  73. }
  74.  
  75.  
  76. //recontruct path
  77. if(!endpoints.some((goal) => goal.x == currentNode.x && goal.y == currentNode.y)){
  78. currentNode = map.getLowest('h');
  79. }
  80. let output = [];
  81. while(currentNode.parent){
  82. let nextNode = currentNode.parent;
  83. let d = Math.round(Math.atan2(nextNode.y - currentNode.y, nextNode.x - currentNode.x) / Math.PI * 4);
  84. if(d < 0){d+=8};
  85. output.push(d);
  86. currentNode = nextNode;
  87. }
  88. output = new Uint8Array(output.reverse()).buffer;
  89.  
  90. self.postMessage(output, [output]);
  91. }
  92.  
  93. //approximate hypot
  94. function fastHypot(a, b){
  95. const c = Math.SQRT2-1;
  96. a = Math.abs(a);
  97. b = Math.abs(b);
  98. if(a > b){
  99. let temp = a;
  100. a = b;
  101. b = temp;
  102. }
  103. return (c * a) + b
  104. }
  105.  
  106. //Map Constructor for object
  107. class Map{
  108. static TraversalCost = 1;
  109. static DiagonalCost = Math.sqrt(2) * 1;
  110. constructor(canvas){
  111. //init variables
  112. this.width = canvas.width;
  113. this.height = canvas.height;
  114.  
  115. this.middleWidth = Math.floor(this.width / 2);
  116. this.middleHeight = Math.floor(this.height / 2);
  117.  
  118. this.graph = new Array(canvas.width);
  119. for(let x = 0;x < this.width;x++){
  120. this.graph[x] = new Array(this.height);
  121. for(let y = 0;y < this.height; y++){
  122. this.graph[x][y] = new Node(x, y);
  123. }
  124. }
  125. this.getCentreNode().g = 0;
  126. this.getCentreNode().pending = false;
  127. }
  128. getLowest(type){
  129. let lowestNode = this.graph[0][0];
  130. for(let x = 0;x < this.width;x++){
  131. for(let y = 0;y < this.height; y++){
  132. if(lowestNode[type] > this.getNode(x, y)[type]){
  133. lowestNode = this.getNode(x, y);
  134. }
  135. }
  136. }
  137. return lowestNode;
  138. }
  139. getNode(x, y){
  140. if(this.graph[x]){
  141. return this.graph[x][y];
  142. }
  143. }
  144. getCentreNode(){
  145. return this.graph[this.middleWidth][this.middleHeight];
  146. }
  147. getNeighbor(x, y){
  148. return [
  149. this.getNode(x - 1, y - 1),
  150. this.getNode(x + 0, y - 1),
  151. this.getNode(x + 1, y - 1),
  152. this.getNode(x + 1, y + 0),
  153. this.getNode(x + 1, y + 1),
  154. this.getNode(x + 0, y + 1),
  155. this.getNode(x - 1, y + 1),
  156. this.getNode(x - 1, y + 0),
  157. ]
  158. }
  159. }
  160.  
  161. //Node for Map
  162. class Node{
  163. constructor(x, y){
  164. this.x = x;
  165. this.y = y;
  166. this.g = Number.POSITIVE_INFINITY;//distance to start
  167. this.h = Number.POSITIVE_INFINITY;//estimated distance to end
  168. this.parent;//where it came from
  169. }
  170. get f(){
  171. return this.h + this.g;
  172. }
  173. }
  174.  
  175. //binary heap object constructor
  176. class BinHeap extends Array {
  177. //private variable declaration
  178. #compare = (a, b) => a < b;
  179. //constuctor
  180. constructor(len = 0) {
  181. super(len);
  182. }
  183. //change compare function
  184. set setCompare(func) {
  185. if (typeof func == "function") {
  186. this.#compare = func;
  187. } else {
  188. throw new Error("Needs a function for comparing")
  189. }
  190. }
  191. //sort into a binary heap
  192. sort() {
  193. for (let i = Math.trunc(this.length / 2); i >= 0; i--) {
  194. this.siftDown(i)
  195. }
  196. }
  197. //old array sort
  198. arraySort(compare) {
  199. super.sort(compare)
  200. }
  201. //sift down
  202. siftDown(index) {
  203. let left = index * 2 + 1;
  204. let right = index * 2 + 2;
  205. let max = index;
  206. if (left < this.length && this.#compare(this[max], this[left])){
  207. max = left;
  208. }
  209. if (right < this.length && this.#compare(this[max], this[right])){
  210. max = right;
  211. }
  212. if (max != index) {
  213. this.swap(index, max);
  214. this.siftDown(max);
  215. }
  216. }
  217. //sift up
  218. siftUp(index) {
  219. let parent = (index - (index % 2 || 2)) / 2;
  220. if (parent >= 0 && this.#compare(this[parent], this[index])) {
  221. this.swap(index, parent);
  222. this.siftUp(parent);
  223. }
  224. }
  225. //inserts element into the binary heap
  226. insert(elem) {
  227. this.push(elem);
  228. this.siftUp(this.length - 1);
  229. }
  230. //removes elem at index from binary heap
  231. remove(index) {
  232. if (index < this.length) {
  233. this.swap(index, this.length - 1);
  234. let elem = super.pop();
  235. this.siftUp(index);
  236. this.siftDown(index);
  237. return elem;
  238. } else {
  239. throw new Error("Index Out Of Bounds")
  240. }
  241. }
  242. //changes elem at index
  243. update(index, elem) {
  244. if (index < this.length) {
  245. this[index] = elem;
  246. this.siftUp(index);
  247. this.siftDown(index);
  248. } else {
  249. throw new Error("Index Out Of Bounds")
  250. }
  251. }
  252. //swap two elem at indexes
  253. swap(i1, i2) {
  254. let temp = this[i1];
  255. this[i1] = this[i2];
  256. this[i2] = temp;
  257. }
  258. }
  259. `;
  260. let sz =750;
  261. let rs = 5;
  262.  
  263. //pathfinding instance
  264. class WorkerAStar{
  265. constructor(size = 750, resolution = 5){
  266. //setup essential variables
  267. this.size = size;
  268. this.res = resolution;
  269. this.prevPos = {};
  270. this.prevPath = [];//might change
  271.  
  272. //setup worker
  273. this.blob = new Blob([
  274. WorkerCode
  275. ], {
  276. type: "application/javascript"
  277. })
  278. this.url = URL.createObjectURL(this.blob);
  279. this.worker = new Worker(this.url);
  280. this.worker.url = this.url;
  281.  
  282. //message receiving
  283. this.worker.onmessage = (msg) => {
  284. this.attemptFulfil(new Uint8Array(msg.data));
  285. }
  286.  
  287. //error handling
  288. this.worker.onerror = (err) => {
  289. throw err;
  290. }
  291.  
  292. this.initiateCanvas();
  293.  
  294. //test canvas
  295. var canvasMap = document.createElement("CANVAS");
  296. canvasMap.id = 'canvasMap';
  297. document.body.append(canvasMap);
  298. canvasMap.style.zIndex = "-1";
  299. canvasMap.style = "position:absolute; left: 50%; top: 60px;margin-left:-100px; pointer-events: none; border-style:solid;";
  300. this.mapWriter = canvasMap.getContext("2d");
  301. canvasMap.width = Math.ceil(this.size * 2 / this.res) + 1;
  302. canvasMap.height = Math.ceil(this.size * 2 / this.res) + 1;
  303. }
  304. //attempts to recieve a message
  305. attemptFulfil(msg, depth = 0){
  306. if(this.resolve){
  307. //relay message onward
  308. this.resolve(msg);
  309. this.resolve = null;
  310. }else{
  311. //allow 5 attempts to recieve
  312. if(depth < 5){
  313. setTimeout(() => {
  314. //could have just passed function as param, but this is more "consistent"
  315. this.attemptFulfil(msg, depth + 1);
  316. }, 0);
  317. }else{
  318. console.error("Unexpected Message from Worker at ", this);
  319. }
  320. }
  321. }
  322.  
  323. //gets new canvas
  324. initiateCanvas(){
  325. this.width = Math.ceil(this.size * 2 / this.res) + 1;
  326. if(this.canvas){
  327. this.canvas.width = this.width;
  328. this.canvas.height = this.width;
  329. }else{
  330. this.canvas = new OffscreenCanvas(this.width, this.width);
  331. this.ctx = this.canvas.getContext("2d");
  332. }
  333. }
  334.  
  335. //setter for buildings
  336. setBuildings(buildings){
  337. this.buildings = buildings;
  338. }
  339.  
  340. //set estimates speed
  341. setSpeed(spd){
  342. this.estimatedSpeed = spd;
  343. }
  344.  
  345. //set pos in real time
  346. setPos(x, y){
  347. this.x = x;
  348. this.y = y;
  349. }
  350.  
  351. //clear the previous path to force a recalculation
  352. clearPath(){
  353. this.prevPath = [];
  354. }
  355.  
  356. drawPath(ctx, pathColor = "#0000FF", myPos = this, dirColor = "#00FF00"){
  357. if(this.prevPath.length){
  358. //draw path
  359. ctx.strokeStyle = pathColor;
  360. ctx.lineWidth = 3;
  361. ctx.beginPath();
  362. for(let i = 0;i < this.prevPath.length;i++){
  363. ctx.lineTo(this.prevPath[i].x, this.prevPath[i].y);
  364. ctx.moveTo(this.prevPath[i].x, this.prevPath[i].y);
  365. }
  366. ctx.stroke();
  367.  
  368. //draw movement dir
  369. if(myPos.x && myPos.y && false){
  370. ctx.lineWidth = 5;
  371. ctx.strokeStyle = dirColor;
  372. ctx.beginPath();
  373. for(let point of this.prevPath){
  374. let dist = Math.hypot(myPos.x - point.x, myPos.y - point.y);
  375. if(dist < this.estimatedSpeed + this.res * 2){
  376. if(dist > this.estimatedSpeed){
  377. ctx.moveTo(myPos.x, myPos.y);
  378. ctx.lineTo(point.x, point.y);
  379. }
  380. break;
  381. }
  382. }
  383. ctx.stroke();
  384. }
  385. }
  386. }
  387.  
  388. //async function for recieving response
  389. async response(){
  390. return await new Promise((resolve) => {
  391. this.resolve = resolve;
  392. });
  393. }
  394. //attempt to get a path
  395. getPath(){
  396. window.pf = this;
  397. for(let i in this.prevPath){
  398. let point = this.prevPath[i];
  399. let dist = Math.hypot(this.x - point.x, this.y - point.y);
  400. if(dist < this.estimatedSpeed + this.res * 2){
  401. if(dist > this.estimatedSpeed){
  402. return {
  403. ang: Math.atan2(point.y - this.y, point.x - this.x),
  404. dist: parseInt(i),
  405. };
  406. }else{
  407. break;
  408. }
  409. }
  410. }
  411. }
  412.  
  413. //makes position on the canvas(may improve, repl.it/@pyrwynd, project:test map)
  414. norm(value){
  415. return Math.max(0, Math.min(this.width - 1, value));
  416. }
  417.  
  418. async initCalc(positions, append = false){
  419. //prevents multiple instances of calculation
  420. if(this.resolve){
  421. return;
  422. }
  423.  
  424. //sets last position
  425. this.prevGoal = positions.map((elem) => {
  426. return {
  427. x: elem.x,
  428. y: elem.y,
  429. }
  430. })
  431.  
  432. //modify position values
  433. if(append){
  434. this.prevPos = this.prevPath[0];
  435. }else{
  436. this.prevPos = {
  437. x: this.x,
  438. y: this.y,
  439. }
  440. }
  441. positions = positions.map((elem) => {
  442. return {
  443. x: this.norm((elem.x - this.prevPos.x + this.size) / this.res),
  444. y: this.norm((elem.y - this.prevPos.y + this.size) / this.res),
  445. }
  446. })
  447.  
  448. //put buildings on canvas here
  449. const Circle = Math.PI * 2;
  450. this.ctx.fillStyle = "#FF0000";
  451. for(let obj of this.buildings){
  452. if(obj.active){
  453. let x = (obj.x - this.prevPos.x + this.size) / this.res;
  454. let y = (obj.y - this.prevPos.y + this.size) / this.res;
  455. let r = obj.scale;
  456.  
  457. //modify radius of natural objects
  458. if(obj.owner == null){
  459. if(obj.type == 0){
  460. //reduce tree hitbox by 40%(may be changed later)
  461. r *= 0.6;
  462. }else if(obj.type == 1){
  463. //reduce bush hitbox by 25%(may be changed later)
  464. r *= 0.75;
  465. if(obj.x > 12000){
  466. //cactus
  467. r += 25;
  468. }
  469. }
  470. }
  471.  
  472. //increase avoidance of spikes
  473. if(obj.dmg){
  474. r += 30;//number may vary
  475. }
  476.  
  477. //account for player size
  478. r += 18;
  479.  
  480. this.ctx.beginPath();
  481. this.ctx.arc(x, y, r / this.res, 0, Circle);
  482. this.ctx.fill();
  483. }
  484. }
  485.  
  486. //draw destination on canvas
  487. this.ctx.fillStyle = "#0000FF";
  488. for(let goal of positions){
  489. this.ctx.fillRect(Math.round(goal.x), Math.round(goal.y), 1, 1);
  490. }
  491.  
  492. //test canvas draw
  493. this.mapWriter.clearRect(0, 0, this.width, this.width);
  494. this.mapWriter.drawImage(this.canvas, 0, 0);
  495.  
  496. //instant data transfer(saves 10ms)
  497. let bitmap = await createImageBitmap(this.canvas, 0, 0, this.width, this.width);
  498. this.worker.postMessage(bitmap, [bitmap]);
  499.  
  500. //meanwhile get a new canvas
  501. this.initiateCanvas();
  502.  
  503. //wait until recieve data
  504. let data = await this.response();
  505.  
  506. //turn into list of points
  507. const xTable = [-1, -1, 0, 1, 1, 1, 0, -1];
  508. const yTable = [0, -1, -1, -1, 0, 1, 1, 1];
  509. if(!append){
  510. this.prevPath = [];
  511. }
  512. let currPos = {
  513. x: this.prevPos.x,
  514. y: this.prevPos.y,
  515. };
  516. let displayPos = {
  517. x: Math.floor(this.width/2),
  518. y: Math.floor(this.width/2),
  519. }
  520. for(let i = 0;i < data.length;i++){
  521. this.mapWriter
  522. currPos = {
  523. x: currPos.x + xTable[data[i]] * this.res,
  524. y: currPos.y + yTable[data[i]] * this.res,
  525. }
  526. displayPos = {
  527. x: displayPos.x + xTable[data[i]],
  528. y: displayPos.y + yTable[data[i]],
  529. }
  530. this.mapWriter.fillRect(displayPos.x, displayPos.y, 1, 1);
  531.  
  532. this.prevPath.unshift(currPos);
  533. }
  534. return;
  535. }
  536.  
  537. //requests a path/calculation
  538. async pathTo(positions){
  539. //fix positions
  540. if(!(positions instanceof Array)){
  541. positions = [positions];
  542. }
  543.  
  544. //remove path if not matching
  545. if(this.prevGoal?.length == positions.length && this.prevGoal.every((elem, i) => elem.x == positions[i].x && elem.y == positions[i].y)){
  546.  
  547. //reuse previous path if nearby
  548. let path = this.getPath();
  549. if(path){
  550. if(path.dist < this.estimatedSpeed / this.res * 5){
  551. this.initCalc(positions, true);
  552. }
  553. return path;
  554. }
  555. }
  556.  
  557. await this.initCalc(positions);
  558. return this.getPath();
  559. }
  560. }
  561.  
  562.  
  563. var Pathfinder = new WorkerAStar();
  564. Pathfinder.setSpeed(500 / 9);
  565.  
  566.  
  567. //an interface to interact with the pathfinder
  568. class Tachyon{
  569. constructor(pathfinder){
  570. this.pathfinder = pathfinder;
  571. this.goal = {
  572. pathing: false,
  573. type: null,
  574. entity: null,
  575. pos: {
  576. x: null,
  577. y: null,
  578. },
  579. }
  580. this.waypoints = {
  581. death: {
  582. x: null,
  583. y: null,
  584. },
  585. quick: {
  586. x: null,
  587. y: null,
  588. },
  589. }
  590. }
  591. setWaypoint(name, pos){
  592. if(pos.x && pos.y){
  593. this.waypoints[name] = {
  594. x: pos.x,
  595. y: pos.y,
  596. }
  597. }
  598. }
  599. drawWaypointMap(mapCtx, canvas){
  600. mapCtx.font = "34px Hammersmith One";
  601. mapCtx.textBaseline = "middle";
  602. mapCtx.textAlign = "center";
  603. for(let tag in this.waypoints){
  604. if(tag == "death"){
  605. mapCtx.fillStyle = "#E44";
  606. }else if(tag == "quick"){
  607. mapCtx.fillStyle = "#44E";
  608. }else{
  609. mapCtx.fillStyle = "#fff";
  610. }
  611. if(this.waypoints[tag].x && this.waypoints[tag].y){
  612. mapCtx.fillText("x", this.waypoints[tag].x / 14400 * canvas.width, this.waypoints[tag].y / 14400 * canvas.height);
  613. }
  614. }
  615. mapCtx.strokeStyle = "#4E4";
  616. if(this.goal.type == "xpos"){
  617. mapCtx.beginPath();
  618. mapCtx.moveTo(this.goal.pos.x / 14400 * canvas.width, 0);
  619. mapCtx.lineTo(this.goal.pos.x / 14400 * canvas.width, canvas.height);
  620. mapCtx.stroke();
  621. }else if(this.goal.type == "ypos"){
  622. mapCtx.beginPath();
  623. mapCtx.moveTo(0, this.goal.pos.y / 14400 * canvas.height);
  624. mapCtx.lineTo(canvas.width, this.goal.pos.y / 14400 * canvas.height);
  625. mapCtx.stroke();
  626. }else if(this.goal.pos.x && this.goal.pos.y){
  627. mapCtx.fillStyle = "#4E4";
  628. mapCtx.fillText("x", this.goal.pos.x / 14400 * canvas.width, this.goal.pos.y / 14400 * canvas.height);
  629. }
  630. }
  631. drawWaypoints(ctx, theta){
  632. //waypoints
  633. for(let tag in this.waypoints){
  634. if(tag == "death"){
  635. ctx.strokeStyle = "#E44";
  636. }else if(tag == "quick"){
  637. ctx.strokeStyle = "#44E";
  638. }else{
  639. ctx.strokeStyle = "#fff";
  640. }
  641. if(this.waypoints[tag].x && this.waypoints[tag].y){
  642. ctx.save();
  643. ctx.translate(this.waypoints[tag].x, this.waypoints[tag].y);
  644. ctx.rotate(theta);
  645. ctx.globalAlpha = 0.6;
  646. ctx.lineWidth = 8;
  647. for(let i = 0;i < 4;i++){
  648. //spinning thing
  649. ctx.rotate(i * Math.PI / 2);
  650. ctx.beginPath();
  651. ctx.arc(0, 0, 50, 0, Math.PI / 4);
  652. ctx.stroke();
  653. }
  654. //pulsing thing
  655. ctx.lineWidth = 6;
  656. ctx.globalAlpha = Math.min(0.4, 1 - Math.pow(Math.sin(theta / 2), 2) / 1.2);
  657. ctx.beginPath();
  658. ctx.arc(0, 0, 50 + Math.max(0, Math.tan(theta / 2)), 0, Math.PI * 2);
  659. ctx.stroke();
  660. ctx.restore();
  661. }
  662. }
  663. //goal
  664. ctx.strokeStyle = "#4F4";
  665. ctx.lineWidth = 10;
  666. ctx.globalAlpha = 0.8;
  667. if(this.goal.type == "xpos"){
  668. ctx.beginPath();
  669. ctx.moveTo(this.goal.pos.x, 0);
  670. ctx.lineTo(this.goal.pos.x, 14400);
  671. ctx.stroke();
  672. }else if(this.goal.type == "ypos"){
  673. ctx.beginPath();
  674. ctx.moveTo(0, this.goal.pos.y);
  675. ctx.lineTo(14400, this.goal.pos.y);
  676. ctx.stroke();
  677. }else if(this.goal.pos.x && this.goal.pos.y){
  678. ctx.save();
  679. ctx.translate(this.goal.pos.x, this.goal.pos.y);
  680. ctx.beginPath();
  681. ctx.arc(0, 0, 10, 0, Math.PI * 2)
  682. ctx.stroke();
  683. ctx.beginPath();
  684. ctx.rotate(theta / 3);
  685. let r = Math.cos(theta) * 10;
  686. for(let i = 0;i < 3;i++){
  687. ctx.rotate(Math.PI * 2 / 3);
  688. ctx.moveTo(60 + r, 0);
  689. ctx.lineTo(120 + r, -20);
  690. ctx.lineTo(100 + r, 0);
  691. ctx.lineTo(120 + r, 20);
  692. ctx.closePath();
  693. }
  694. ctx.stroke();
  695. ctx.restore();
  696. }
  697. }
  698. setSelf(self){
  699. this.self = self;
  700. }
  701. setSend(sender){
  702. this.send = sender;
  703. }
  704. //ideas: https://github.com/cabaletta/baritone/blob/master/USAGE.md
  705. /**Current Commands
  706. * path
  707. * stop
  708. * goal
  709. * <goal/goto> x [Number: x position]
  710. * <goal/goto> y [Number: y position]
  711. * <goal/goto> [x: Number] [y: Number]
  712. * waypoint set [name: String]
  713. * waypoint del [name: String]
  714. * waypoint goto [name: String]
  715. * follow player <[ID/Name: Any]/all(default)>
  716. * follow animal <[ID/Name: Any]/all(default)>
  717. * wander
  718. **Planned Commands
  719. * multigoal [wp1: String] ...
  720. * find [id: Number]
  721. * find [name: String] [owner(optional): Number]
  722. */
  723. abort(){
  724. this.goal.pathing = false;
  725. }
  726. updateChat(txt, ownerID){
  727. //handle commands here
  728. if(ownerID != this.self.sid){
  729. return;
  730. }
  731.  
  732. let args = txt.trimEnd().split(" ");
  733.  
  734. if(args[0] == "path"){
  735. //start pathfinding(assuming there is a goal)
  736. if(this.goal.type){
  737. this.goal.pathing = true;
  738. this.pathfinder.clearPath();
  739. console.log('ez')
  740. }
  741. }else if(args[0] == "stop"){
  742. if(this.goal.pathing){
  743. this.goal.pathing = false;
  744. this.pathfinder.clearPath();
  745. this.send("33", null);
  746. }
  747. }else if(args[0] == "goal" || args[0] == "goto"){
  748. //goal sets goal
  749. //goto sets a path and starts walking towards it
  750. if(isNaN(parseInt(args[1]))){
  751. if(args[1] == "x"){
  752. //get to a x position
  753. //<goal/goto> x [Number: x position]
  754. let pos = parseInt(args[2]);
  755. if(pos >= 0 && pos <= 14400){
  756. this.goal.pathing = args[0] == "goto";
  757. this.goal.type = "xpos";
  758. this.goal.pos.x = pos;
  759. }
  760. }else if(args[1] == "y"){
  761. //get to a y position
  762. //<goal/goto> y [Number: y position]
  763. let pos = parseInt(args[2]);
  764. if(pos >= 0 && pos <= 14400){
  765. this.goal.pathing = args[0] == "goto";
  766. this.goal.type = "ypos";
  767. this.goal.pos.y = pos;
  768. }
  769. }else if(args[0] == "goal" && !args[1]){
  770. this.goal.type = "pos";
  771. this.goal.pos.x = this.self.x;
  772. this.goal.pos.y = this.self.y;
  773. }
  774. }else{
  775. //get to a x and y position
  776. //<goal/goto> [x: Number] [y: Number]
  777. let xPos = parseInt(args[1]);
  778. let yPos = parseInt(args[2]);
  779. if(xPos >= 0 && xPos <= 14400 && yPos >= 0 && yPos <= 14400){
  780. this.goal.pathing = args[0] == "goto";
  781. this.goal.type = "pos";
  782. this.goal.pos.x = xPos;
  783. this.goal.pos.y = yPos;
  784. }
  785. }
  786. }else if(args[0] == "thisway" || args[0] == "project"){
  787. //project my position x distance from my position
  788. //thisway [distance: Number] [angle(optional): Number]
  789. let amt = parseInt(args[1]);
  790. let dir = parseFloat(args[2]) || this.self.dir;
  791. if(!isNaN(amt) && this.self.x && this.self.y && this.self.dir){
  792. this.goal.type = "pos";
  793. this.goal.pos.x = Math.max(0, Math.min(14400, this.self.x + Math.cos(dir) * amt));
  794. this.goal.pos.y = Math.max(0, Math.min(14400, this.self.y + Math.sin(dir) * amt));
  795. }
  796. }else if(args[0] == "follow" || args[0] == "flw"){
  797. if(args[1] == "player" || args[1] == "ply"){
  798. //follow player <[ID: Number]/all(default)>
  799. this.goal.pathing = true;
  800. this.goal.type = "player";
  801. if(args[2]){
  802. this.goal.entity = args.slice(2).join(" ");
  803. }else{
  804. this.goal.entity = -1;
  805. }
  806. }else if(args[1] == "team"){
  807. //follow team
  808. this.goal.pathing = true;
  809. this.goal.type = "team";
  810. }else if(args[1] == "animal"){
  811. this.goal.pathing = true;
  812. this.goal.type = "animal";
  813. if(args[2]){
  814. this.goal.entity = args[2];
  815. }else{
  816. this.goal.entity = -1;
  817. }
  818. }
  819. }else if(args[0] == "find" || args[0] == "fnd"){
  820. //finds a object: natural or placed
  821. //find [id: Number]
  822. //find [name: String] [owner(optional): Number]
  823. }else if(args[0] == "waypoint" || args[0] == "wp"){
  824. if(args[1] == "set"){
  825. //waypoint set [name: String]
  826. if(Boolean(args[2]) && !this.waypoints[args[2]]){
  827. this.waypoints[args[2]] = {
  828. x: this.self.x,
  829. y: this.self.y,
  830. }
  831. }
  832. }else if(args[1] == "del"){
  833. //waypoint del [name: String]
  834. delete this.waypoints[args[2]];
  835. }else if(args[1] == "goto"){
  836. //waypoint goto [name: String]
  837. if(this.waypoints[args[2]]?.x && this.waypoints[args[2]]?.y){
  838. this.goal.pathing = true;
  839. this.goal.type = "pos";
  840. this.goal.pos.x = this.waypoints[args[2]].x;
  841. this.goal.pos.y = this.waypoints[args[2]].y;
  842. }
  843. }
  844. }else if(args[0] == "wander" || args[0] == "wnd"){
  845. this.goal.pathing = true;
  846. this.goal.type = "wander";
  847. this.goal.pos.x = Math.random() * 14400;
  848. this.goal.pos.y = Math.random() * 14400;
  849. }
  850. }
  851. //determines if we are nearing goal
  852. reachedGoal(){
  853. if(this.goal.type == "xpos"){
  854. return Math.abs(this.self.x - this.goal.pos.x) < this.pathfinder.estimatedSpeed;
  855. }else if(this.goal.type == "ypos"){
  856. return Math.abs(this.self.y - this.goal.pos.y) < this.pathfinder.estimatedSpeed;
  857. }else if(this.goal.type == "pos" || this.goal.type == "wander"){
  858. return Math.hypot(this.self.x - this.goal.pos.x, this.self.y - this.goal.pos.y) < this.pathfinder.estimatedSpeed;
  859. }
  860. }
  861. async updatePlayers(players){
  862. if(this.goal.pathing){
  863. let finalGoal;
  864. if(this.goal.type == "xpos"){
  865. //go towards x position
  866. finalGoal = [];
  867. for(let i = -this.pathfinder.size; i <= this.pathfinder.size; i++){
  868. finalGoal.push({
  869. x: this.goal.pos.x,
  870. y: this.self.y + i * this.pathfinder.res,
  871. })
  872. }
  873. }else if(this.goal.type == "ypos"){
  874. //go towards y position
  875. finalGoal = [];
  876. for(let i = -this.pathfinder.size; i <= this.pathfinder.size;i += 3){
  877. finalGoal.push({
  878. x: this.self.x + i * this.pathfinder.res,
  879. y: this.goal.pos.y,
  880. })
  881. }
  882. }else if(this.goal.type == "pos" || this.goal.type == "wander"){
  883. //simple go towards position
  884. finalGoal = {
  885. x: this.goal.pos.x,
  886. y: this.goal.pos.y,
  887. };
  888. }else if(this.goal.type == "player"){
  889. //do pathfinding for following player
  890. if(this.goal.entity === -1){
  891. finalGoal = [];
  892. for(let player of players){
  893. if(player.visible && player.sid != this.self.sid){
  894. finalGoal.push(player)
  895. }
  896. }
  897. if(!finalGoal.length){
  898. finalGoal = null;
  899. }
  900. }else{
  901. for(let player of players){
  902. if(player.visible && player.sid != this.self.sid && (player.sid == this.goal.entity || player.name == this.goal.entity)){
  903. finalGoal = player;
  904. break;
  905. }
  906. }
  907. }
  908. }else if(this.goal.type == "team"){
  909. //follow teammates
  910. finalGoal = [];
  911. for(let player of players){
  912. if(player.team == this.self.team && player.sid != this.self.sid){
  913. finalGoal.push(player)
  914. }
  915. }
  916. if(!finalGoal.length || !this.self.team){
  917. finalGoal = null;
  918. }
  919. }
  920. if(finalGoal){
  921. if(this.reachedGoal()){
  922. if(this.goal.type == "wander"){
  923. this.goal.pos.x = Math.random() * 14400;
  924. this.goal.pos.y = Math.random() * 14400;
  925. }else{
  926. this.goal.pathing = false;
  927. }
  928. this.pathfinder.clearPath();
  929. this.send("33", null);
  930. }else{
  931. let path = await Pathfinder.pathTo(finalGoal);
  932. if(path){
  933. this.send("33", path.ang);
  934. }else{
  935. this.send("33", null);
  936. }
  937. }
  938. }
  939. }
  940. }
  941. async updateAnimals(animals){
  942. if(this.goal.type == "animal" && this.goal.pathing){
  943. let finalGoal;
  944. if(this.goal.entity === -1){
  945. finalGoal = [];
  946. for(let animal of animals){
  947. if(animal.visible && animal.sid != this.self.sid){
  948. finalGoal.push(animal)
  949. }
  950. }
  951. if(!finalGoal.length){
  952. finalGoal = null;
  953. }
  954. }else{
  955. for(let animal of animals){
  956. if(animal.visible && (animal.sid == this.goal.entity || animal.name == this.goal.entity)){
  957. finalGoal = animal;
  958. break;
  959. }
  960. }
  961. }
  962. if(this.reachedGoal()){
  963. this.pathfinder.clearPath();
  964. this.goal.pathing = false;
  965. this.send("33", null);
  966. }else if(finalGoal){
  967. let path = await this.pathfinder.pathTo(finalGoal);
  968. if(path){
  969. this.send("33", path.ang);
  970. }else{
  971. this.send("33", null);
  972. }
  973. }
  974. }
  975. }
  976. async addBuilding(obj){
  977. await new Promise((resolve) => {
  978. let id = setInterval(() => {
  979. if(!this.pathfinder.resolve){
  980. resolve();
  981. clearInterval(id);
  982. }
  983. })
  984. })
  985. let path = this.pathfinder.getPath();
  986. let dist = path?.dist + this.pathfinder.estimatedSpeed / this.pathfinder.res + 3;
  987. dist = Math.min(this.pathfinder.prevPath.length - 1, Math.trunc(dist));
  988. if(dist){
  989. for(let i = dist; i >= 0; i--){
  990. let point = this.pathfinder.prevPath[i];
  991. if(Math.hypot(point.x - obj.x, point.y - obj.y) < obj.scale + 30){
  992. this.pathfinder.prevPath = this.pathfinder.prevPath.slice(i);
  993. break;
  994. }
  995. }
  996. }
  997. }
  998. }
  999.  
  1000. var Tach = new Tachyon(Pathfinder);
  1001.  
  1002.  
  1003.  
  1004. !function(e) {
  1005. var t = {};
  1006. function n(i) {
  1007. if (t[i])
  1008. return t[i].exports;
  1009. var r = t[i] = {
  1010. i: i,
  1011. l: !1,
  1012. exports: {}
  1013. };
  1014. return e[i].call(r.exports, r, r.exports, n),
  1015. r.l = !0,
  1016. r.exports
  1017. }
  1018. n.m = e,
  1019. n.c = t,
  1020. n.d = function(e, t, i) {
  1021. n.o(e, t) || Object.defineProperty(e, t, {
  1022. enumerable: !0,
  1023. get: i
  1024. })
  1025. }
  1026. ,
  1027. n.r = function(e) {
  1028. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
  1029. value: "Module"
  1030. }),
  1031. Object.defineProperty(e, "__esModule", {
  1032. value: !0
  1033. })
  1034. }
  1035. ,
  1036. n.t = function(e, t) {
  1037. if (1 & t && (e = n(e)),
  1038. 8 & t)
  1039. return e;
  1040. if (4 & t && "object" == typeof e && e && e.__esModule)
  1041. return e;
  1042. var i = Object.create(null);
  1043. if (n.r(i),
  1044. Object.defineProperty(i, "default", {
  1045. enumerable: !0,
  1046. value: e
  1047. }),
  1048. 2 & t && "string" != typeof e)
  1049. for (var r in e)
  1050. n.d(i, r, function(t) {
  1051. return e[t]
  1052. }
  1053. .bind(null, r));
  1054. return i
  1055. }
  1056. ,
  1057. n.n = function(e) {
  1058. var t = e && e.__esModule ? function() {
  1059. return e.default
  1060. }
  1061. : function() {
  1062. return e
  1063. }
  1064. ;
  1065. return n.d(t, "a", t),
  1066. t
  1067. }
  1068. ,
  1069. n.o = function(e, t) {
  1070. return Object.prototype.hasOwnProperty.call(e, t)
  1071. }
  1072. ,
  1073. n.p = "",
  1074. n(n.s = 21)
  1075. }([function(e, t, n) {
  1076. var i = t.global = n(25)
  1077. , r = t.hasBuffer = i && !!i.isBuffer
  1078. , s = t.hasArrayBuffer = "undefined" != typeof ArrayBuffer
  1079. , a = t.isArray = n(5);
  1080. t.isArrayBuffer = s ? function(e) {
  1081. return e instanceof ArrayBuffer || p(e)
  1082. }
  1083. : m;
  1084. var o = t.isBuffer = r ? i.isBuffer : m
  1085. , c = t.isView = s ? ArrayBuffer.isView || y("ArrayBuffer", "buffer") : m;
  1086. t.alloc = d,
  1087. t.concat = function(e, n) {
  1088. n || (n = 0,
  1089. Array.prototype.forEach.call(e, (function(e) {
  1090. n += e.length
  1091. }
  1092. )));
  1093. var i = this !== t && this || e[0]
  1094. , r = d.call(i, n)
  1095. , s = 0;
  1096. return Array.prototype.forEach.call(e, (function(e) {
  1097. s += f.copy.call(e, r, s)
  1098. }
  1099. )),
  1100. r
  1101. }
  1102. ,
  1103. t.from = function(e) {
  1104. return "string" == typeof e ? function(e) {
  1105. var t = 3 * e.length
  1106. , n = d.call(this, t)
  1107. , i = f.write.call(n, e);
  1108. return t !== i && (n = f.slice.call(n, 0, i)),
  1109. n
  1110. }
  1111. .call(this, e) : g(this).from(e)
  1112. }
  1113. ;
  1114. var l = t.Array = n(28)
  1115. , h = t.Buffer = n(29)
  1116. , u = t.Uint8Array = n(30)
  1117. , f = t.prototype = n(6);
  1118. function d(e) {
  1119. return g(this).alloc(e)
  1120. }
  1121. var p = y("ArrayBuffer");
  1122. function g(e) {
  1123. return o(e) ? h : c(e) ? u : a(e) ? l : r ? h : s ? u : l
  1124. }
  1125. function m() {
  1126. return !1
  1127. }
  1128. function y(e, t) {
  1129. return e = "[object " + e + "]",
  1130. function(n) {
  1131. return null != n && {}.toString.call(t ? n[t] : n) === e
  1132. }
  1133. }
  1134. }
  1135. , function(e, t, n) {
  1136. var i = n(5);
  1137. t.createCodec = o,
  1138. t.install = function(e) {
  1139. for (var t in e)
  1140. s.prototype[t] = a(s.prototype[t], e[t])
  1141. }
  1142. ,
  1143. t.filter = function(e) {
  1144. return i(e) ? function(e) {
  1145. return e = e.slice(),
  1146. function(n) {
  1147. return e.reduce(t, n)
  1148. }
  1149. ;
  1150. function t(e, t) {
  1151. return t(e)
  1152. }
  1153. }(e) : e
  1154. }
  1155. ;
  1156. var r = n(0);
  1157. function s(e) {
  1158. if (!(this instanceof s))
  1159. return new s(e);
  1160. this.options = e,
  1161. this.init()
  1162. }
  1163. function a(e, t) {
  1164. return e && t ? function() {
  1165. return e.apply(this, arguments),
  1166. t.apply(this, arguments)
  1167. }
  1168. : e || t
  1169. }
  1170. function o(e) {
  1171. return new s(e)
  1172. }
  1173. s.prototype.init = function() {
  1174. var e = this.options;
  1175. return e && e.uint8array && (this.bufferish = r.Uint8Array),
  1176. this
  1177. }
  1178. ,
  1179. t.preset = o({
  1180. preset: !0
  1181. })
  1182. }
  1183. , function(e, t, n) {
  1184. var i = n(3).ExtBuffer
  1185. , r = n(32)
  1186. , s = n(33)
  1187. , a = n(1);
  1188. function o() {
  1189. var e = this.options;
  1190. return this.encode = function(e) {
  1191. var t = s.getWriteType(e);
  1192. return function(e, n) {
  1193. var i = t[typeof n];
  1194. if (!i)
  1195. throw new Error('Unsupported type "' + typeof n + '": ' + n);
  1196. i(e, n)
  1197. }
  1198. }(e),
  1199. e && e.preset && r.setExtPackers(this),
  1200. this
  1201. }
  1202. a.install({
  1203. addExtPacker: function(e, t, n) {
  1204. n = a.filter(n);
  1205. var r = t.name;
  1206. r && "Object" !== r ? (this.extPackers || (this.extPackers = {}))[r] = s : (this.extEncoderList || (this.extEncoderList = [])).unshift([t, s]);
  1207. function s(t) {
  1208. return n && (t = n(t)),
  1209. new i(t,e)
  1210. }
  1211. },
  1212. getExtPacker: function(e) {
  1213. var t = this.extPackers || (this.extPackers = {})
  1214. , n = e.constructor
  1215. , i = n && n.name && t[n.name];
  1216. if (i)
  1217. return i;
  1218. for (var r = this.extEncoderList || (this.extEncoderList = []), s = r.length, a = 0; a < s; a++) {
  1219. var o = r[a];
  1220. if (n === o[0])
  1221. return o[1]
  1222. }
  1223. },
  1224. init: o
  1225. }),
  1226. t.preset = o.call(a.preset)
  1227. }
  1228. , function(e, t, n) {
  1229. t.ExtBuffer = function e(t, n) {
  1230. if (!(this instanceof e))
  1231. return new e(t,n);
  1232. this.buffer = i.from(t),
  1233. this.type = n
  1234. }
  1235. ;
  1236. var i = n(0)
  1237. }
  1238. , function(e, t) {
  1239. t.read = function(e, t, n, i, r) {
  1240. var s, a, o = 8 * r - i - 1, c = (1 << o) - 1, l = c >> 1, h = -7, u = n ? r - 1 : 0, f = n ? -1 : 1, d = e[t + u];
  1241. for (u += f,
  1242. s = d & (1 << -h) - 1,
  1243. d >>= -h,
  1244. h += o; h > 0; s = 256 * s + e[t + u],
  1245. u += f,
  1246. h -= 8)
  1247. ;
  1248. for (a = s & (1 << -h) - 1,
  1249. s >>= -h,
  1250. h += i; h > 0; a = 256 * a + e[t + u],
  1251. u += f,
  1252. h -= 8)
  1253. ;
  1254. if (0 === s)
  1255. s = 1 - l;
  1256. else {
  1257. if (s === c)
  1258. return a ? NaN : 1 / 0 * (d ? -1 : 1);
  1259. a += Math.pow(2, i),
  1260. s -= l
  1261. }
  1262. return (d ? -1 : 1) * a * Math.pow(2, s - i)
  1263. }
  1264. ,
  1265. t.write = function(e, t, n, i, r, s) {
  1266. var a, o, c, l = 8 * s - r - 1, h = (1 << l) - 1, u = h >> 1, f = 23 === r ? Math.pow(2, -24) - Math.pow(2, -77) : 0, d = i ? 0 : s - 1, p = i ? 1 : -1, g = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
  1267. for (t = Math.abs(t),
  1268. isNaN(t) || t === 1 / 0 ? (o = isNaN(t) ? 1 : 0,
  1269. a = h) : (a = Math.floor(Math.log(t) / Math.LN2),
  1270. t * (c = Math.pow(2, -a)) < 1 && (a--,
  1271. c *= 2),
  1272. (t += a + u >= 1 ? f / c : f * Math.pow(2, 1 - u)) * c >= 2 && (a++,
  1273. c /= 2),
  1274. a + u >= h ? (o = 0,
  1275. a = h) : a + u >= 1 ? (o = (t * c - 1) * Math.pow(2, r),
  1276. a += u) : (o = t * Math.pow(2, u - 1) * Math.pow(2, r),
  1277. a = 0)); r >= 8; e[n + d] = 255 & o,
  1278. d += p,
  1279. o /= 256,
  1280. r -= 8)
  1281. ;
  1282. for (a = a << r | o,
  1283. l += r; l > 0; e[n + d] = 255 & a,
  1284. d += p,
  1285. a /= 256,
  1286. l -= 8)
  1287. ;
  1288. e[n + d - p] |= 128 * g
  1289. }
  1290. }
  1291. , function(e, t) {
  1292. var n = {}.toString;
  1293. e.exports = Array.isArray || function(e) {
  1294. return "[object Array]" == n.call(e)
  1295. }
  1296. }
  1297. , function(e, t, n) {
  1298. var i = n(31);
  1299. t.copy = c,
  1300. t.slice = l,
  1301. t.toString = function(e, t, n) {
  1302. return (!a && r.isBuffer(this) ? this.toString : i.toString).apply(this, arguments)
  1303. }
  1304. ,
  1305. t.write = function(e) {
  1306. return function() {
  1307. return (this[e] || i[e]).apply(this, arguments)
  1308. }
  1309. }("write");
  1310. var r = n(0)
  1311. , s = r.global
  1312. , a = r.hasBuffer && "TYPED_ARRAY_SUPPORT"in s
  1313. , o = a && !s.TYPED_ARRAY_SUPPORT;
  1314. function c(e, t, n, s) {
  1315. var a = r.isBuffer(this)
  1316. , c = r.isBuffer(e);
  1317. if (a && c)
  1318. return this.copy(e, t, n, s);
  1319. if (o || a || c || !r.isView(this) || !r.isView(e))
  1320. return i.copy.call(this, e, t, n, s);
  1321. var h = n || null != s ? l.call(this, n, s) : this;
  1322. return e.set(h, t),
  1323. h.length
  1324. }
  1325. function l(e, t) {
  1326. var n = this.slice || !o && this.subarray;
  1327. if (n)
  1328. return n.call(this, e, t);
  1329. var i = r.alloc.call(this, t - e);
  1330. return c.call(this, i, 0, e, t),
  1331. i
  1332. }
  1333. }
  1334. , function(e, t, n) {
  1335. (function(e) {
  1336. !function(t) {
  1337. var n, i = "undefined", r = i !== typeof e && e, s = i !== typeof Uint8Array && Uint8Array, a = i !== typeof ArrayBuffer && ArrayBuffer, o = [0, 0, 0, 0, 0, 0, 0, 0], c = Array.isArray || function(e) {
  1338. return !!e && "[object Array]" == Object.prototype.toString.call(e)
  1339. }
  1340. , l = 4294967296;
  1341. function h(e, c, h) {
  1342. var b = c ? 0 : 4
  1343. , x = c ? 4 : 0
  1344. , S = c ? 0 : 3
  1345. , T = c ? 1 : 2
  1346. , I = c ? 2 : 1
  1347. , E = c ? 3 : 0
  1348. , M = c ? y : v
  1349. , A = c ? k : w
  1350. , P = O.prototype
  1351. , B = "is" + e
  1352. , C = "_" + B;
  1353. return P.buffer = void 0,
  1354. P.offset = 0,
  1355. P[C] = !0,
  1356. P.toNumber = R,
  1357. P.toString = function(e) {
  1358. var t = this.buffer
  1359. , n = this.offset
  1360. , i = _(t, n + b)
  1361. , r = _(t, n + x)
  1362. , s = ""
  1363. , a = !h && 2147483648 & i;
  1364. for (a && (i = ~i,
  1365. r = l - r),
  1366. e = e || 10; ; ) {
  1367. var o = i % e * l + r;
  1368. if (i = Math.floor(i / e),
  1369. r = Math.floor(o / e),
  1370. s = (o % e).toString(e) + s,
  1371. !i && !r)
  1372. break
  1373. }
  1374. return a && (s = "-" + s),
  1375. s
  1376. }
  1377. ,
  1378. P.toJSON = R,
  1379. P.toArray = u,
  1380. r && (P.toBuffer = f),
  1381. s && (P.toArrayBuffer = d),
  1382. O[B] = function(e) {
  1383. return !(!e || !e[C])
  1384. }
  1385. ,
  1386. t[e] = O,
  1387. O;
  1388. function O(e, t, r, c) {
  1389. return this instanceof O ? function(e, t, r, c, h) {
  1390. if (s && a && (t instanceof a && (t = new s(t)),
  1391. c instanceof a && (c = new s(c))),
  1392. t || r || c || n) {
  1393. if (!p(t, r))
  1394. h = r,
  1395. c = t,
  1396. r = 0,
  1397. t = new (n || Array)(8);
  1398. e.buffer = t,
  1399. e.offset = r |= 0,
  1400. i !== typeof c && ("string" == typeof c ? function(e, t, n, i) {
  1401. var r = 0
  1402. , s = n.length
  1403. , a = 0
  1404. , o = 0;
  1405. "-" === n[0] && r++;
  1406. for (var c = r; r < s; ) {
  1407. var h = parseInt(n[r++], i);
  1408. if (!(h >= 0))
  1409. break;
  1410. o = o * i + h,
  1411. a = a * i + Math.floor(o / l),
  1412. o %= l
  1413. }
  1414. c && (a = ~a,
  1415. o ? o = l - o : a++),
  1416. j(e, t + b, a),
  1417. j(e, t + x, o)
  1418. }(t, r, c, h || 10) : p(c, h) ? g(t, r, c, h) : "number" == typeof h ? (j(t, r + b, c),
  1419. j(t, r + x, h)) : c > 0 ? M(t, r, c) : c < 0 ? A(t, r, c) : g(t, r, o, 0))
  1420. } else
  1421. e.buffer = m(o, 0)
  1422. }(this, e, t, r, c) : new O(e,t,r,c)
  1423. }
  1424. function R() {
  1425. var e = this.buffer
  1426. , t = this.offset
  1427. , n = _(e, t + b)
  1428. , i = _(e, t + x);
  1429. return h || (n |= 0),
  1430. n ? n * l + i : i
  1431. }
  1432. function j(e, t, n) {
  1433. e[t + E] = 255 & n,
  1434. n >>= 8,
  1435. e[t + I] = 255 & n,
  1436. n >>= 8,
  1437. e[t + T] = 255 & n,
  1438. n >>= 8,
  1439. e[t + S] = 255 & n
  1440. }
  1441. function _(e, t) {
  1442. return 16777216 * e[t + S] + (e[t + T] << 16) + (e[t + I] << 8) + e[t + E]
  1443. }
  1444. }
  1445. function u(e) {
  1446. var t = this.buffer
  1447. , i = this.offset;
  1448. return n = null,
  1449. !1 !== e && 0 === i && 8 === t.length && c(t) ? t : m(t, i)
  1450. }
  1451. function f(t) {
  1452. var i = this.buffer
  1453. , s = this.offset;
  1454. if (n = r,
  1455. !1 !== t && 0 === s && 8 === i.length && e.isBuffer(i))
  1456. return i;
  1457. var a = new r(8);
  1458. return g(a, 0, i, s),
  1459. a
  1460. }
  1461. function d(e) {
  1462. var t = this.buffer
  1463. , i = this.offset
  1464. , r = t.buffer;
  1465. if (n = s,
  1466. !1 !== e && 0 === i && r instanceof a && 8 === r.byteLength)
  1467. return r;
  1468. var o = new s(8);
  1469. return g(o, 0, t, i),
  1470. o.buffer
  1471. }
  1472. function p(e, t) {
  1473. var n = e && e.length;
  1474. return t |= 0,
  1475. n && t + 8 <= n && "string" != typeof e[t]
  1476. }
  1477. function g(e, t, n, i) {
  1478. t |= 0,
  1479. i |= 0;
  1480. for (var r = 0; r < 8; r++)
  1481. e[t++] = 255 & n[i++]
  1482. }
  1483. function m(e, t) {
  1484. return Array.prototype.slice.call(e, t, t + 8)
  1485. }
  1486. function y(e, t, n) {
  1487. for (var i = t + 8; i > t; )
  1488. e[--i] = 255 & n,
  1489. n /= 256
  1490. }
  1491. function k(e, t, n) {
  1492. var i = t + 8;
  1493. for (n++; i > t; )
  1494. e[--i] = 255 & -n ^ 255,
  1495. n /= 256
  1496. }
  1497. function v(e, t, n) {
  1498. for (var i = t + 8; t < i; )
  1499. e[t++] = 255 & n,
  1500. n /= 256
  1501. }
  1502. function w(e, t, n) {
  1503. var i = t + 8;
  1504. for (n++; t < i; )
  1505. e[t++] = 255 & -n ^ 255,
  1506. n /= 256
  1507. }
  1508. h("Uint64BE", !0, !0),
  1509. h("Int64BE", !0, !1),
  1510. h("Uint64LE", !1, !0),
  1511. h("Int64LE", !1, !1)
  1512. }("string" != typeof t.nodeName ? t : this || {})
  1513. }
  1514. ).call(this, n(11).Buffer)
  1515. }
  1516. , function(e, t, n) {
  1517. var i = n(3).ExtBuffer
  1518. , r = n(35)
  1519. , s = n(17).readUint8
  1520. , a = n(36)
  1521. , o = n(1);
  1522. function c() {
  1523. var e = this.options;
  1524. return this.decode = function(e) {
  1525. var t = a.getReadToken(e);
  1526. return function(e) {
  1527. var n = s(e)
  1528. , i = t[n];
  1529. if (!i)
  1530. throw new Error("Invalid type: " + (n ? "0x" + n.toString(16) : n));
  1531. return i(e)
  1532. }
  1533. }(e),
  1534. e && e.preset && r.setExtUnpackers(this),
  1535. this
  1536. }
  1537. o.install({
  1538. addExtUnpacker: function(e, t) {
  1539. (this.extUnpackers || (this.extUnpackers = []))[e] = o.filter(t)
  1540. },
  1541. getExtUnpacker: function(e) {
  1542. return (this.extUnpackers || (this.extUnpackers = []))[e] || function(t) {
  1543. return new i(t,e)
  1544. }
  1545. },
  1546. init: c
  1547. }),
  1548. t.preset = c.call(o.preset)
  1549. }
  1550. , function(e, t, n) {
  1551. t.encode = function(e, t) {
  1552. var n = new i(t);
  1553. return n.write(e),
  1554. n.read()
  1555. }
  1556. ;
  1557. var i = n(10).EncodeBuffer
  1558. }
  1559. , function(e, t, n) {
  1560. t.EncodeBuffer = r;
  1561. var i = n(2).preset;
  1562. function r(e) {
  1563. if (!(this instanceof r))
  1564. return new r(e);
  1565. if (e && (this.options = e,
  1566. e.codec)) {
  1567. var t = this.codec = e.codec;
  1568. t.bufferish && (this.bufferish = t.bufferish)
  1569. }
  1570. }
  1571. n(14).FlexEncoder.mixin(r.prototype),
  1572. r.prototype.codec = i,
  1573. r.prototype.write = function(e) {
  1574. this.codec.encode(this, e)
  1575. }
  1576. }
  1577. , function(e, t, n) {
  1578. "use strict";
  1579. (function(e) {
  1580. var i = n(26)
  1581. , r = n(4)
  1582. , s = n(27);
  1583. function a() {
  1584. return c.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823
  1585. }
  1586. function o(e, t) {
  1587. if (a() < t)
  1588. throw new RangeError("Invalid typed array length");
  1589. return c.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t)).__proto__ = c.prototype : (null === e && (e = new c(t)),
  1590. e.length = t),
  1591. e
  1592. }
  1593. function c(e, t, n) {
  1594. if (!(c.TYPED_ARRAY_SUPPORT || this instanceof c))
  1595. return new c(e,t,n);
  1596. if ("number" == typeof e) {
  1597. if ("string" == typeof t)
  1598. throw new Error("If encoding is specified then the first argument must be a string");
  1599. return u(this, e)
  1600. }
  1601. return l(this, e, t, n)
  1602. }
  1603. function l(e, t, n, i) {
  1604. if ("number" == typeof t)
  1605. throw new TypeError('"value" argument must not be a number');
  1606. return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? function(e, t, n, i) {
  1607. if (t.byteLength,
  1608. n < 0 || t.byteLength < n)
  1609. throw new RangeError("'offset' is out of bounds");
  1610. if (t.byteLength < n + (i || 0))
  1611. throw new RangeError("'length' is out of bounds");
  1612. return t = void 0 === n && void 0 === i ? new Uint8Array(t) : void 0 === i ? new Uint8Array(t,n) : new Uint8Array(t,n,i),
  1613. c.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = c.prototype : e = f(e, t),
  1614. e
  1615. }(e, t, n, i) : "string" == typeof t ? function(e, t, n) {
  1616. if ("string" == typeof n && "" !== n || (n = "utf8"),
  1617. !c.isEncoding(n))
  1618. throw new TypeError('"encoding" must be a valid string encoding');
  1619. var i = 0 | p(t, n)
  1620. , r = (e = o(e, i)).write(t, n);
  1621. return r !== i && (e = e.slice(0, r)),
  1622. e
  1623. }(e, t, n) : function(e, t) {
  1624. if (c.isBuffer(t)) {
  1625. var n = 0 | d(t.length);
  1626. return 0 === (e = o(e, n)).length || t.copy(e, 0, 0, n),
  1627. e
  1628. }
  1629. if (t) {
  1630. if ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer || "length"in t)
  1631. return "number" != typeof t.length || function(e) {
  1632. return e != e
  1633. }(t.length) ? o(e, 0) : f(e, t);
  1634. if ("Buffer" === t.type && s(t.data))
  1635. return f(e, t.data)
  1636. }
  1637. throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")
  1638. }(e, t)
  1639. }
  1640. function h(e) {
  1641. if ("number" != typeof e)
  1642. throw new TypeError('"size" argument must be a number');
  1643. if (e < 0)
  1644. throw new RangeError('"size" argument must not be negative')
  1645. }
  1646. function u(e, t) {
  1647. if (h(t),
  1648. e = o(e, t < 0 ? 0 : 0 | d(t)),
  1649. !c.TYPED_ARRAY_SUPPORT)
  1650. for (var n = 0; n < t; ++n)
  1651. e[n] = 0;
  1652. return e
  1653. }
  1654. function f(e, t) {
  1655. var n = t.length < 0 ? 0 : 0 | d(t.length);
  1656. e = o(e, n);
  1657. for (var i = 0; i < n; i += 1)
  1658. e[i] = 255 & t[i];
  1659. return e
  1660. }
  1661. function d(e) {
  1662. if (e >= a())
  1663. throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + a().toString(16) + " bytes");
  1664. return 0 | e
  1665. }
  1666. function p(e, t) {
  1667. if (c.isBuffer(e))
  1668. return e.length;
  1669. if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(e) || e instanceof ArrayBuffer))
  1670. return e.byteLength;
  1671. "string" != typeof e && (e = "" + e);
  1672. var n = e.length;
  1673. if (0 === n)
  1674. return 0;
  1675. for (var i = !1; ; )
  1676. switch (t) {
  1677. case "ascii":
  1678. case "latin1":
  1679. case "binary":
  1680. return n;
  1681. case "utf8":
  1682. case "utf-8":
  1683. case void 0:
  1684. return z(e).length;
  1685. case "ucs2":
  1686. case "ucs-2":
  1687. case "utf16le":
  1688. case "utf-16le":
  1689. return 2 * n;
  1690. case "hex":
  1691. return n >>> 1;
  1692. case "base64":
  1693. return H(e).length;
  1694. default:
  1695. if (i)
  1696. return z(e).length;
  1697. t = ("" + t).toLowerCase(),
  1698. i = !0
  1699. }
  1700. }
  1701. function g(e, t, n) {
  1702. var i = e[t];
  1703. e[t] = e[n],
  1704. e[n] = i
  1705. }
  1706. function m(e, t, n, i, r) {
  1707. if (0 === e.length)
  1708. return -1;
  1709. if ("string" == typeof n ? (i = n,
  1710. n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648),
  1711. n = +n,
  1712. isNaN(n) && (n = r ? 0 : e.length - 1),
  1713. n < 0 && (n = e.length + n),
  1714. n >= e.length) {
  1715. if (r)
  1716. return -1;
  1717. n = e.length - 1
  1718. } else if (n < 0) {
  1719. if (!r)
  1720. return -1;
  1721. n = 0
  1722. }
  1723. if ("string" == typeof t && (t = c.from(t, i)),
  1724. c.isBuffer(t))
  1725. return 0 === t.length ? -1 : y(e, t, n, i, r);
  1726. if ("number" == typeof t)
  1727. return t &= 255,
  1728. c.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? r ? Uint8Array.prototype.indexOf.call(e, t, n) : Uint8Array.prototype.lastIndexOf.call(e, t, n) : y(e, [t], n, i, r);
  1729. throw new TypeError("val must be string, number or Buffer")
  1730. }
  1731. function y(e, t, n, i, r) {
  1732. var s, a = 1, o = e.length, c = t.length;
  1733. if (void 0 !== i && ("ucs2" === (i = String(i).toLowerCase()) || "ucs-2" === i || "utf16le" === i || "utf-16le" === i)) {
  1734. if (e.length < 2 || t.length < 2)
  1735. return -1;
  1736. a = 2,
  1737. o /= 2,
  1738. c /= 2,
  1739. n /= 2
  1740. }
  1741. function l(e, t) {
  1742. return 1 === a ? e[t] : e.readUInt16BE(t * a)
  1743. }
  1744. if (r) {
  1745. var h = -1;
  1746. for (s = n; s < o; s++)
  1747. if (l(e, s) === l(t, -1 === h ? 0 : s - h)) {
  1748. if (-1 === h && (h = s),
  1749. s - h + 1 === c)
  1750. return h * a
  1751. } else
  1752. -1 !== h && (s -= s - h),
  1753. h = -1
  1754. } else
  1755. for (n + c > o && (n = o - c),
  1756. s = n; s >= 0; s--) {
  1757. for (var u = !0, f = 0; f < c; f++)
  1758. if (l(e, s + f) !== l(t, f)) {
  1759. u = !1;
  1760. break
  1761. }
  1762. if (u)
  1763. return s
  1764. }
  1765. return -1
  1766. }
  1767. function k(e, t, n, i) {
  1768. n = Number(n) || 0;
  1769. var r = e.length - n;
  1770. i ? (i = Number(i)) > r && (i = r) : i = r;
  1771. var s = t.length;
  1772. if (s % 2 != 0)
  1773. throw new TypeError("Invalid hex string");
  1774. i > s / 2 && (i = s / 2);
  1775. for (var a = 0; a < i; ++a) {
  1776. var o = parseInt(t.substr(2 * a, 2), 16);
  1777. if (isNaN(o))
  1778. return a;
  1779. e[n + a] = o
  1780. }
  1781. return a
  1782. }
  1783. function v(e, t, n, i) {
  1784. return V(z(t, e.length - n), e, n, i)
  1785. }
  1786. function w(e, t, n, i) {
  1787. return V(function(e) {
  1788. for (var t = [], n = 0; n < e.length; ++n)
  1789. t.push(255 & e.charCodeAt(n));
  1790. return t
  1791. }(t), e, n, i)
  1792. }
  1793. function b(e, t, n, i) {
  1794. return w(e, t, n, i)
  1795. }
  1796. function x(e, t, n, i) {
  1797. return V(H(t), e, n, i)
  1798. }
  1799. function S(e, t, n, i) {
  1800. return V(function(e, t) {
  1801. for (var n, i, r, s = [], a = 0; a < e.length && !((t -= 2) < 0); ++a)
  1802. i = (n = e.charCodeAt(a)) >> 8,
  1803. r = n % 256,
  1804. s.push(r),
  1805. s.push(i);
  1806. return s
  1807. }(t, e.length - n), e, n, i)
  1808. }
  1809. function T(e, t, n) {
  1810. return 0 === t && n === e.length ? i.fromByteArray(e) : i.fromByteArray(e.slice(t, n))
  1811. }
  1812. function I(e, t, n) {
  1813. n = Math.min(e.length, n);
  1814. for (var i = [], r = t; r < n; ) {
  1815. var s, a, o, c, l = e[r], h = null, u = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
  1816. if (r + u <= n)
  1817. switch (u) {
  1818. case 1:
  1819. l < 128 && (h = l);
  1820. break;
  1821. case 2:
  1822. 128 == (192 & (s = e[r + 1])) && (c = (31 & l) << 6 | 63 & s) > 127 && (h = c);
  1823. break;
  1824. case 3:
  1825. s = e[r + 1],
  1826. a = e[r + 2],
  1827. 128 == (192 & s) && 128 == (192 & a) && (c = (15 & l) << 12 | (63 & s) << 6 | 63 & a) > 2047 && (c < 55296 || c > 57343) && (h = c);
  1828. break;
  1829. case 4:
  1830. s = e[r + 1],
  1831. a = e[r + 2],
  1832. o = e[r + 3],
  1833. 128 == (192 & s) && 128 == (192 & a) && 128 == (192 & o) && (c = (15 & l) << 18 | (63 & s) << 12 | (63 & a) << 6 | 63 & o) > 65535 && c < 1114112 && (h = c)
  1834. }
  1835. null === h ? (h = 65533,
  1836. u = 1) : h > 65535 && (h -= 65536,
  1837. i.push(h >>> 10 & 1023 | 55296),
  1838. h = 56320 | 1023 & h),
  1839. i.push(h),
  1840. r += u
  1841. }
  1842. return function(e) {
  1843. var t = e.length;
  1844. if (t <= E)
  1845. return String.fromCharCode.apply(String, e);
  1846. for (var n = "", i = 0; i < t; )
  1847. n += String.fromCharCode.apply(String, e.slice(i, i += E));
  1848. return n
  1849. }(i)
  1850. }
  1851. t.Buffer = c,
  1852. t.SlowBuffer = function(e) {
  1853. return +e != e && (e = 0),
  1854. c.alloc(+e)
  1855. }
  1856. ,
  1857. t.INSPECT_MAX_BYTES = 50,
  1858. c.TYPED_ARRAY_SUPPORT = void 0 !== e.TYPED_ARRAY_SUPPORT ? e.TYPED_ARRAY_SUPPORT : function() {
  1859. try {
  1860. var e = new Uint8Array(1);
  1861. return e.__proto__ = {
  1862. __proto__: Uint8Array.prototype,
  1863. foo: function() {
  1864. return 42
  1865. }
  1866. },
  1867. 42 === e.foo() && "function" == typeof e.subarray && 0 === e.subarray(1, 1).byteLength
  1868. } catch (e) {
  1869. return !1
  1870. }
  1871. }(),
  1872. t.kMaxLength = a(),
  1873. c.poolSize = 8192,
  1874. c._augment = function(e) {
  1875. return e.__proto__ = c.prototype,
  1876. e
  1877. }
  1878. ,
  1879. c.from = function(e, t, n) {
  1880. return l(null, e, t, n)
  1881. }
  1882. ,
  1883. c.TYPED_ARRAY_SUPPORT && (c.prototype.__proto__ = Uint8Array.prototype,
  1884. c.__proto__ = Uint8Array,
  1885. "undefined" != typeof Symbol && Symbol.species && c[Symbol.species] === c && Object.defineProperty(c, Symbol.species, {
  1886. value: null,
  1887. configurable: !0
  1888. })),
  1889. c.alloc = function(e, t, n) {
  1890. return function(e, t, n, i) {
  1891. return h(t),
  1892. t <= 0 ? o(e, t) : void 0 !== n ? "string" == typeof i ? o(e, t).fill(n, i) : o(e, t).fill(n) : o(e, t)
  1893. }(null, e, t, n)
  1894. }
  1895. ,
  1896. c.allocUnsafe = function(e) {
  1897. return u(null, e)
  1898. }
  1899. ,
  1900. c.allocUnsafeSlow = function(e) {
  1901. return u(null, e)
  1902. }
  1903. ,
  1904. c.isBuffer = function(e) {
  1905. return !(null == e || !e._isBuffer)
  1906. }
  1907. ,
  1908. c.compare = function(e, t) {
  1909. if (!c.isBuffer(e) || !c.isBuffer(t))
  1910. throw new TypeError("Arguments must be Buffers");
  1911. if (e === t)
  1912. return 0;
  1913. for (var n = e.length, i = t.length, r = 0, s = Math.min(n, i); r < s; ++r)
  1914. if (e[r] !== t[r]) {
  1915. n = e[r],
  1916. i = t[r];
  1917. break
  1918. }
  1919. return n < i ? -1 : i < n ? 1 : 0
  1920. }
  1921. ,
  1922. c.isEncoding = function(e) {
  1923. switch (String(e).toLowerCase()) {
  1924. case "hex":
  1925. case "utf8":
  1926. case "utf-8":
  1927. case "ascii":
  1928. case "latin1":
  1929. case "binary":
  1930. case "base64":
  1931. case "ucs2":
  1932. case "ucs-2":
  1933. case "utf16le":
  1934. case "utf-16le":
  1935. return !0;
  1936. default:
  1937. return !1
  1938. }
  1939. }
  1940. ,
  1941. c.concat = function(e, t) {
  1942. if (!s(e))
  1943. throw new TypeError('"list" argument must be an Array of Buffers');
  1944. if (0 === e.length)
  1945. return c.alloc(0);
  1946. var n;
  1947. if (void 0 === t)
  1948. for (t = 0,
  1949. n = 0; n < e.length; ++n)
  1950. t += e[n].length;
  1951. var i = c.allocUnsafe(t)
  1952. , r = 0;
  1953. for (n = 0; n < e.length; ++n) {
  1954. var a = e[n];
  1955. if (!c.isBuffer(a))
  1956. throw new TypeError('"list" argument must be an Array of Buffers');
  1957. a.copy(i, r),
  1958. r += a.length
  1959. }
  1960. return i
  1961. }
  1962. ,
  1963. c.byteLength = p,
  1964. c.prototype._isBuffer = !0,
  1965. c.prototype.swap16 = function() {
  1966. var e = this.length;
  1967. if (e % 2 != 0)
  1968. throw new RangeError("Buffer size must be a multiple of 16-bits");
  1969. for (var t = 0; t < e; t += 2)
  1970. g(this, t, t + 1);
  1971. return this
  1972. }
  1973. ,
  1974. c.prototype.swap32 = function() {
  1975. var e = this.length;
  1976. if (e % 4 != 0)
  1977. throw new RangeError("Buffer size must be a multiple of 32-bits");
  1978. for (var t = 0; t < e; t += 4)
  1979. g(this, t, t + 3),
  1980. g(this, t + 1, t + 2);
  1981. return this
  1982. }
  1983. ,
  1984. c.prototype.swap64 = function() {
  1985. var e = this.length;
  1986. if (e % 8 != 0)
  1987. throw new RangeError("Buffer size must be a multiple of 64-bits");
  1988. for (var t = 0; t < e; t += 8)
  1989. g(this, t, t + 7),
  1990. g(this, t + 1, t + 6),
  1991. g(this, t + 2, t + 5),
  1992. g(this, t + 3, t + 4);
  1993. return this
  1994. }
  1995. ,
  1996. c.prototype.toString = function() {
  1997. var e = 0 | this.length;
  1998. return 0 === e ? "" : 0 === arguments.length ? I(this, 0, e) : function(e, t, n) {
  1999. var i = !1;
  2000. if ((void 0 === t || t < 0) && (t = 0),
  2001. t > this.length)
  2002. return "";
  2003. if ((void 0 === n || n > this.length) && (n = this.length),
  2004. n <= 0)
  2005. return "";
  2006. if ((n >>>= 0) <= (t >>>= 0))
  2007. return "";
  2008. for (e || (e = "utf8"); ; )
  2009. switch (e) {
  2010. case "hex":
  2011. return P(this, t, n);
  2012. case "utf8":
  2013. case "utf-8":
  2014. return I(this, t, n);
  2015. case "ascii":
  2016. return M(this, t, n);
  2017. case "latin1":
  2018. case "binary":
  2019. return A(this, t, n);
  2020. case "base64":
  2021. return T(this, t, n);
  2022. case "ucs2":
  2023. case "ucs-2":
  2024. case "utf16le":
  2025. case "utf-16le":
  2026. return B(this, t, n);
  2027. default:
  2028. if (i)
  2029. throw new TypeError("Unknown encoding: " + e);
  2030. e = (e + "").toLowerCase(),
  2031. i = !0
  2032. }
  2033. }
  2034. .apply(this, arguments)
  2035. }
  2036. ,
  2037. c.prototype.equals = function(e) {
  2038. if (!c.isBuffer(e))
  2039. throw new TypeError("Argument must be a Buffer");
  2040. return this === e || 0 === c.compare(this, e)
  2041. }
  2042. ,
  2043. c.prototype.inspect = function() {
  2044. var e = ""
  2045. , n = t.INSPECT_MAX_BYTES;
  2046. return this.length > 0 && (e = this.toString("hex", 0, n).match(/.{2}/g).join(" "),
  2047. this.length > n && (e += " ... ")),
  2048. "<Buffer " + e + ">"
  2049. }
  2050. ,
  2051. c.prototype.compare = function(e, t, n, i, r) {
  2052. if (!c.isBuffer(e))
  2053. throw new TypeError("Argument must be a Buffer");
  2054. if (void 0 === t && (t = 0),
  2055. void 0 === n && (n = e ? e.length : 0),
  2056. void 0 === i && (i = 0),
  2057. void 0 === r && (r = this.length),
  2058. t < 0 || n > e.length || i < 0 || r > this.length)
  2059. throw new RangeError("out of range index");
  2060. if (i >= r && t >= n)
  2061. return 0;
  2062. if (i >= r)
  2063. return -1;
  2064. if (t >= n)
  2065. return 1;
  2066. if (this === e)
  2067. return 0;
  2068. for (var s = (r >>>= 0) - (i >>>= 0), a = (n >>>= 0) - (t >>>= 0), o = Math.min(s, a), l = this.slice(i, r), h = e.slice(t, n), u = 0; u < o; ++u)
  2069. if (l[u] !== h[u]) {
  2070. s = l[u],
  2071. a = h[u];
  2072. break
  2073. }
  2074. return s < a ? -1 : a < s ? 1 : 0
  2075. }
  2076. ,
  2077. c.prototype.includes = function(e, t, n) {
  2078. return -1 !== this.indexOf(e, t, n)
  2079. }
  2080. ,
  2081. c.prototype.indexOf = function(e, t, n) {
  2082. return m(this, e, t, n, !0)
  2083. }
  2084. ,
  2085. c.prototype.lastIndexOf = function(e, t, n) {
  2086. return m(this, e, t, n, !1)
  2087. }
  2088. ,
  2089. c.prototype.write = function(e, t, n, i) {
  2090. if (void 0 === t)
  2091. i = "utf8",
  2092. n = this.length,
  2093. t = 0;
  2094. else if (void 0 === n && "string" == typeof t)
  2095. i = t,
  2096. n = this.length,
  2097. t = 0;
  2098. else {
  2099. if (!isFinite(t))
  2100. throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
  2101. t |= 0,
  2102. isFinite(n) ? (n |= 0,
  2103. void 0 === i && (i = "utf8")) : (i = n,
  2104. n = void 0)
  2105. }
  2106. var r = this.length - t;
  2107. if ((void 0 === n || n > r) && (n = r),
  2108. e.length > 0 && (n < 0 || t < 0) || t > this.length)
  2109. throw new RangeError("Attempt to write outside buffer bounds");
  2110. i || (i = "utf8");
  2111. for (var s = !1; ; )
  2112. switch (i) {
  2113. case "hex":
  2114. return k(this, e, t, n);
  2115. case "utf8":
  2116. case "utf-8":
  2117. return v(this, e, t, n);
  2118. case "ascii":
  2119. return w(this, e, t, n);
  2120. case "latin1":
  2121. case "binary":
  2122. return b(this, e, t, n);
  2123. case "base64":
  2124. return x(this, e, t, n);
  2125. case "ucs2":
  2126. case "ucs-2":
  2127. case "utf16le":
  2128. case "utf-16le":
  2129. return S(this, e, t, n);
  2130. default:
  2131. if (s)
  2132. throw new TypeError("Unknown encoding: " + i);
  2133. i = ("" + i).toLowerCase(),
  2134. s = !0
  2135. }
  2136. }
  2137. ,
  2138. c.prototype.toJSON = function() {
  2139. return {
  2140. type: "Buffer",
  2141. data: Array.prototype.slice.call(this._arr || this, 0)
  2142. }
  2143. }
  2144. ;
  2145. var E = 4096;
  2146. function M(e, t, n) {
  2147. var i = "";
  2148. n = Math.min(e.length, n);
  2149. for (var r = t; r < n; ++r)
  2150. i += String.fromCharCode(127 & e[r]);
  2151. return i
  2152. }
  2153. function A(e, t, n) {
  2154. var i = "";
  2155. n = Math.min(e.length, n);
  2156. for (var r = t; r < n; ++r)
  2157. i += String.fromCharCode(e[r]);
  2158. return i
  2159. }
  2160. function P(e, t, n) {
  2161. var i = e.length;
  2162. (!t || t < 0) && (t = 0),
  2163. (!n || n < 0 || n > i) && (n = i);
  2164. for (var r = "", s = t; s < n; ++s)
  2165. r += F(e[s]);
  2166. return r
  2167. }
  2168. function B(e, t, n) {
  2169. for (var i = e.slice(t, n), r = "", s = 0; s < i.length; s += 2)
  2170. r += String.fromCharCode(i[s] + 256 * i[s + 1]);
  2171. return r
  2172. }
  2173. function C(e, t, n) {
  2174. if (e % 1 != 0 || e < 0)
  2175. throw new RangeError("offset is not uint");
  2176. if (e + t > n)
  2177. throw new RangeError("Trying to access beyond buffer length")
  2178. }
  2179. function O(e, t, n, i, r, s) {
  2180. if (!c.isBuffer(e))
  2181. throw new TypeError('"buffer" argument must be a Buffer instance');
  2182. if (t > r || t < s)
  2183. throw new RangeError('"value" argument is out of bounds');
  2184. if (n + i > e.length)
  2185. throw new RangeError("Index out of range")
  2186. }
  2187. function R(e, t, n, i) {
  2188. t < 0 && (t = 65535 + t + 1);
  2189. for (var r = 0, s = Math.min(e.length - n, 2); r < s; ++r)
  2190. e[n + r] = (t & 255 << 8 * (i ? r : 1 - r)) >>> 8 * (i ? r : 1 - r)
  2191. }
  2192. function j(e, t, n, i) {
  2193. t < 0 && (t = 4294967295 + t + 1);
  2194. for (var r = 0, s = Math.min(e.length - n, 4); r < s; ++r)
  2195. e[n + r] = t >>> 8 * (i ? r : 3 - r) & 255
  2196. }
  2197. function _(e, t, n, i, r, s) {
  2198. if (n + i > e.length)
  2199. throw new RangeError("Index out of range");
  2200. if (n < 0)
  2201. throw new RangeError("Index out of range")
  2202. }
  2203. function U(e, t, n, i, s) {
  2204. return s || _(e, 0, n, 4),
  2205. r.write(e, t, n, i, 23, 4),
  2206. n + 4
  2207. }
  2208. function D(e, t, n, i, s) {
  2209. return s || _(e, 0, n, 8),
  2210. r.write(e, t, n, i, 52, 8),
  2211. n + 8
  2212. }
  2213. c.prototype.slice = function(e, t) {
  2214. var n, i = this.length;
  2215. if ((e = ~~e) < 0 ? (e += i) < 0 && (e = 0) : e > i && (e = i),
  2216. (t = void 0 === t ? i : ~~t) < 0 ? (t += i) < 0 && (t = 0) : t > i && (t = i),
  2217. t < e && (t = e),
  2218. c.TYPED_ARRAY_SUPPORT)
  2219. (n = this.subarray(e, t)).__proto__ = c.prototype;
  2220. else {
  2221. var r = t - e;
  2222. n = new c(r,void 0);
  2223. for (var s = 0; s < r; ++s)
  2224. n[s] = this[s + e]
  2225. }
  2226. return n
  2227. }
  2228. ,
  2229. c.prototype.readUIntLE = function(e, t, n) {
  2230. e |= 0,
  2231. t |= 0,
  2232. n || C(e, t, this.length);
  2233. for (var i = this[e], r = 1, s = 0; ++s < t && (r *= 256); )
  2234. i += this[e + s] * r;
  2235. return i
  2236. }
  2237. ,
  2238. c.prototype.readUIntBE = function(e, t, n) {
  2239. e |= 0,
  2240. t |= 0,
  2241. n || C(e, t, this.length);
  2242. for (var i = this[e + --t], r = 1; t > 0 && (r *= 256); )
  2243. i += this[e + --t] * r;
  2244. return i
  2245. }
  2246. ,
  2247. c.prototype.readUInt8 = function(e, t) {
  2248. return t || C(e, 1, this.length),
  2249. this[e]
  2250. }
  2251. ,
  2252. c.prototype.readUInt16LE = function(e, t) {
  2253. return t || C(e, 2, this.length),
  2254. this[e] | this[e + 1] << 8
  2255. }
  2256. ,
  2257. c.prototype.readUInt16BE = function(e, t) {
  2258. return t || C(e, 2, this.length),
  2259. this[e] << 8 | this[e + 1]
  2260. }
  2261. ,
  2262. c.prototype.readUInt32LE = function(e, t) {
  2263. return t || C(e, 4, this.length),
  2264. (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3]
  2265. }
  2266. ,
  2267. c.prototype.readUInt32BE = function(e, t) {
  2268. return t || C(e, 4, this.length),
  2269. 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3])
  2270. }
  2271. ,
  2272. c.prototype.readIntLE = function(e, t, n) {
  2273. e |= 0,
  2274. t |= 0,
  2275. n || C(e, t, this.length);
  2276. for (var i = this[e], r = 1, s = 0; ++s < t && (r *= 256); )
  2277. i += this[e + s] * r;
  2278. return i >= (r *= 128) && (i -= Math.pow(2, 8 * t)),
  2279. i
  2280. }
  2281. ,
  2282. c.prototype.readIntBE = function(e, t, n) {
  2283. e |= 0,
  2284. t |= 0,
  2285. n || C(e, t, this.length);
  2286. for (var i = t, r = 1, s = this[e + --i]; i > 0 && (r *= 256); )
  2287. s += this[e + --i] * r;
  2288. return s >= (r *= 128) && (s -= Math.pow(2, 8 * t)),
  2289. s
  2290. }
  2291. ,
  2292. c.prototype.readInt8 = function(e, t) {
  2293. return t || C(e, 1, this.length),
  2294. 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e]
  2295. }
  2296. ,
  2297. c.prototype.readInt16LE = function(e, t) {
  2298. t || C(e, 2, this.length);
  2299. var n = this[e] | this[e + 1] << 8;
  2300. return 32768 & n ? 4294901760 | n : n
  2301. }
  2302. ,
  2303. c.prototype.readInt16BE = function(e, t) {
  2304. t || C(e, 2, this.length);
  2305. var n = this[e + 1] | this[e] << 8;
  2306. return 32768 & n ? 4294901760 | n : n
  2307. }
  2308. ,
  2309. c.prototype.readInt32LE = function(e, t) {
  2310. return t || C(e, 4, this.length),
  2311. this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24
  2312. }
  2313. ,
  2314. c.prototype.readInt32BE = function(e, t) {
  2315. return t || C(e, 4, this.length),
  2316. this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]
  2317. }
  2318. ,
  2319. c.prototype.readFloatLE = function(e, t) {
  2320. return t || C(e, 4, this.length),
  2321. r.read(this, e, !0, 23, 4)
  2322. }
  2323. ,
  2324. c.prototype.readFloatBE = function(e, t) {
  2325. return t || C(e, 4, this.length),
  2326. r.read(this, e, !1, 23, 4)
  2327. }
  2328. ,
  2329. c.prototype.readDoubleLE = function(e, t) {
  2330. return t || C(e, 8, this.length),
  2331. r.read(this, e, !0, 52, 8)
  2332. }
  2333. ,
  2334. c.prototype.readDoubleBE = function(e, t) {
  2335. return t || C(e, 8, this.length),
  2336. r.read(this, e, !1, 52, 8)
  2337. }
  2338. ,
  2339. c.prototype.writeUIntLE = function(e, t, n, i) {
  2340. e = +e,
  2341. t |= 0,
  2342. n |= 0,
  2343. i || O(this, e, t, n, Math.pow(2, 8 * n) - 1, 0);
  2344. var r = 1
  2345. , s = 0;
  2346. for (this[t] = 255 & e; ++s < n && (r *= 256); )
  2347. this[t + s] = e / r & 255;
  2348. return t + n
  2349. }
  2350. ,
  2351. c.prototype.writeUIntBE = function(e, t, n, i) {
  2352. e = +e,
  2353. t |= 0,
  2354. n |= 0,
  2355. i || O(this, e, t, n, Math.pow(2, 8 * n) - 1, 0);
  2356. var r = n - 1
  2357. , s = 1;
  2358. for (this[t + r] = 255 & e; --r >= 0 && (s *= 256); )
  2359. this[t + r] = e / s & 255;
  2360. return t + n
  2361. }
  2362. ,
  2363. c.prototype.writeUInt8 = function(e, t, n) {
  2364. return e = +e,
  2365. t |= 0,
  2366. n || O(this, e, t, 1, 255, 0),
  2367. c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)),
  2368. this[t] = 255 & e,
  2369. t + 1
  2370. }
  2371. ,
  2372. c.prototype.writeUInt16LE = function(e, t, n) {
  2373. return e = +e,
  2374. t |= 0,
  2375. n || O(this, e, t, 2, 65535, 0),
  2376. c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
  2377. this[t + 1] = e >>> 8) : R(this, e, t, !0),
  2378. t + 2
  2379. }
  2380. ,
  2381. c.prototype.writeUInt16BE = function(e, t, n) {
  2382. return e = +e,
  2383. t |= 0,
  2384. n || O(this, e, t, 2, 65535, 0),
  2385. c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8,
  2386. this[t + 1] = 255 & e) : R(this, e, t, !1),
  2387. t + 2
  2388. }
  2389. ,
  2390. c.prototype.writeUInt32LE = function(e, t, n) {
  2391. return e = +e,
  2392. t |= 0,
  2393. n || O(this, e, t, 4, 4294967295, 0),
  2394. c.TYPED_ARRAY_SUPPORT ? (this[t + 3] = e >>> 24,
  2395. this[t + 2] = e >>> 16,
  2396. this[t + 1] = e >>> 8,
  2397. this[t] = 255 & e) : j(this, e, t, !0),
  2398. t + 4
  2399. }
  2400. ,
  2401. c.prototype.writeUInt32BE = function(e, t, n) {
  2402. return e = +e,
  2403. t |= 0,
  2404. n || O(this, e, t, 4, 4294967295, 0),
  2405. c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24,
  2406. this[t + 1] = e >>> 16,
  2407. this[t + 2] = e >>> 8,
  2408. this[t + 3] = 255 & e) : j(this, e, t, !1),
  2409. t + 4
  2410. }
  2411. ,
  2412. c.prototype.writeIntLE = function(e, t, n, i) {
  2413. if (e = +e,
  2414. t |= 0,
  2415. !i) {
  2416. var r = Math.pow(2, 8 * n - 1);
  2417. O(this, e, t, n, r - 1, -r)
  2418. }
  2419. var s = 0
  2420. , a = 1
  2421. , o = 0;
  2422. for (this[t] = 255 & e; ++s < n && (a *= 256); )
  2423. e < 0 && 0 === o && 0 !== this[t + s - 1] && (o = 1),
  2424. this[t + s] = (e / a >> 0) - o & 255;
  2425. return t + n
  2426. }
  2427. ,
  2428. c.prototype.writeIntBE = function(e, t, n, i) {
  2429. if (e = +e,
  2430. t |= 0,
  2431. !i) {
  2432. var r = Math.pow(2, 8 * n - 1);
  2433. O(this, e, t, n, r - 1, -r)
  2434. }
  2435. var s = n - 1
  2436. , a = 1
  2437. , o = 0;
  2438. for (this[t + s] = 255 & e; --s >= 0 && (a *= 256); )
  2439. e < 0 && 0 === o && 0 !== this[t + s + 1] && (o = 1),
  2440. this[t + s] = (e / a >> 0) - o & 255;
  2441. return t + n
  2442. }
  2443. ,
  2444. c.prototype.writeInt8 = function(e, t, n) {
  2445. return e = +e,
  2446. t |= 0,
  2447. n || O(this, e, t, 1, 127, -128),
  2448. c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)),
  2449. e < 0 && (e = 255 + e + 1),
  2450. this[t] = 255 & e,
  2451. t + 1
  2452. }
  2453. ,
  2454. c.prototype.writeInt16LE = function(e, t, n) {
  2455. return e = +e,
  2456. t |= 0,
  2457. n || O(this, e, t, 2, 32767, -32768),
  2458. c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
  2459. this[t + 1] = e >>> 8) : R(this, e, t, !0),
  2460. t + 2
  2461. }
  2462. ,
  2463. c.prototype.writeInt16BE = function(e, t, n) {
  2464. return e = +e,
  2465. t |= 0,
  2466. n || O(this, e, t, 2, 32767, -32768),
  2467. c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8,
  2468. this[t + 1] = 255 & e) : R(this, e, t, !1),
  2469. t + 2
  2470. }
  2471. ,
  2472. c.prototype.writeInt32LE = function(e, t, n) {
  2473. return e = +e,
  2474. t |= 0,
  2475. n || O(this, e, t, 4, 2147483647, -2147483648),
  2476. c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
  2477. this[t + 1] = e >>> 8,
  2478. this[t + 2] = e >>> 16,
  2479. this[t + 3] = e >>> 24) : j(this, e, t, !0),
  2480. t + 4
  2481. }
  2482. ,
  2483. c.prototype.writeInt32BE = function(e, t, n) {
  2484. return e = +e,
  2485. t |= 0,
  2486. n || O(this, e, t, 4, 2147483647, -2147483648),
  2487. e < 0 && (e = 4294967295 + e + 1),
  2488. c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24,
  2489. this[t + 1] = e >>> 16,
  2490. this[t + 2] = e >>> 8,
  2491. this[t + 3] = 255 & e) : j(this, e, t, !1),
  2492. t + 4
  2493. }
  2494. ,
  2495. c.prototype.writeFloatLE = function(e, t, n) {
  2496. return U(this, e, t, !0, n)
  2497. }
  2498. ,
  2499. c.prototype.writeFloatBE = function(e, t, n) {
  2500. return U(this, e, t, !1, n)
  2501. }
  2502. ,
  2503. c.prototype.writeDoubleLE = function(e, t, n) {
  2504. return D(this, e, t, !0, n)
  2505. }
  2506. ,
  2507. c.prototype.writeDoubleBE = function(e, t, n) {
  2508. return D(this, e, t, !1, n)
  2509. }
  2510. ,
  2511. c.prototype.copy = function(e, t, n, i) {
  2512. if (n || (n = 0),
  2513. i || 0 === i || (i = this.length),
  2514. t >= e.length && (t = e.length),
  2515. t || (t = 0),
  2516. i > 0 && i < n && (i = n),
  2517. i === n)
  2518. return 0;
  2519. if (0 === e.length || 0 === this.length)
  2520. return 0;
  2521. if (t < 0)
  2522. throw new RangeError("targetStart out of bounds");
  2523. if (n < 0 || n >= this.length)
  2524. throw new RangeError("sourceStart out of bounds");
  2525. if (i < 0)
  2526. throw new RangeError("sourceEnd out of bounds");
  2527. i > this.length && (i = this.length),
  2528. e.length - t < i - n && (i = e.length - t + n);
  2529. var r, s = i - n;
  2530. if (this === e && n < t && t < i)
  2531. for (r = s - 1; r >= 0; --r)
  2532. e[r + t] = this[r + n];
  2533. else if (s < 1e3 || !c.TYPED_ARRAY_SUPPORT)
  2534. for (r = 0; r < s; ++r)
  2535. e[r + t] = this[r + n];
  2536. else
  2537. Uint8Array.prototype.set.call(e, this.subarray(n, n + s), t);
  2538. return s
  2539. }
  2540. ,
  2541. c.prototype.fill = function(e, t, n, i) {
  2542. if ("string" == typeof e) {
  2543. if ("string" == typeof t ? (i = t,
  2544. t = 0,
  2545. n = this.length) : "string" == typeof n && (i = n,
  2546. n = this.length),
  2547. 1 === e.length) {
  2548. var r = e.charCodeAt(0);
  2549. r < 256 && (e = r)
  2550. }
  2551. if (void 0 !== i && "string" != typeof i)
  2552. throw new TypeError("encoding must be a string");
  2553. if ("string" == typeof i && !c.isEncoding(i))
  2554. throw new TypeError("Unknown encoding: " + i)
  2555. } else
  2556. "number" == typeof e && (e &= 255);
  2557. if (t < 0 || this.length < t || this.length < n)
  2558. throw new RangeError("Out of range index");
  2559. if (n <= t)
  2560. return this;
  2561. var s;
  2562. if (t >>>= 0,
  2563. n = void 0 === n ? this.length : n >>> 0,
  2564. e || (e = 0),
  2565. "number" == typeof e)
  2566. for (s = t; s < n; ++s)
  2567. this[s] = e;
  2568. else {
  2569. var a = c.isBuffer(e) ? e : z(new c(e,i).toString())
  2570. , o = a.length;
  2571. for (s = 0; s < n - t; ++s)
  2572. this[s + t] = a[s % o]
  2573. }
  2574. return this
  2575. }
  2576. ;
  2577. var L = /[^+\/0-9A-Za-z-_]/g;
  2578. function F(e) {
  2579. return e < 16 ? "0" + e.toString(16) : e.toString(16)
  2580. }
  2581. function z(e, t) {
  2582. var n;
  2583. t = t || 1 / 0;
  2584. for (var i = e.length, r = null, s = [], a = 0; a < i; ++a) {
  2585. if ((n = e.charCodeAt(a)) > 55295 && n < 57344) {
  2586. if (!r) {
  2587. if (n > 56319) {
  2588. (t -= 3) > -1 && s.push(239, 191, 189);
  2589. continue
  2590. }
  2591. if (a + 1 === i) {
  2592. (t -= 3) > -1 && s.push(239, 191, 189);
  2593. continue
  2594. }
  2595. r = n;
  2596. continue
  2597. }
  2598. if (n < 56320) {
  2599. (t -= 3) > -1 && s.push(239, 191, 189),
  2600. r = n;
  2601. continue
  2602. }
  2603. n = 65536 + (r - 55296 << 10 | n - 56320)
  2604. } else
  2605. r && (t -= 3) > -1 && s.push(239, 191, 189);
  2606. if (r = null,
  2607. n < 128) {
  2608. if ((t -= 1) < 0)
  2609. break;
  2610. s.push(n)
  2611. } else if (n < 2048) {
  2612. if ((t -= 2) < 0)
  2613. break;
  2614. s.push(n >> 6 | 192, 63 & n | 128)
  2615. } else if (n < 65536) {
  2616. if ((t -= 3) < 0)
  2617. break;
  2618. s.push(n >> 12 | 224, n >> 6 & 63 | 128, 63 & n | 128)
  2619. } else {
  2620. if (!(n < 1114112))
  2621. throw new Error("Invalid code point");
  2622. if ((t -= 4) < 0)
  2623. break;
  2624. s.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, 63 & n | 128)
  2625. }
  2626. }
  2627. return s
  2628. }
  2629. function H(e) {
  2630. return i.toByteArray(function(e) {
  2631. if ((e = function(e) {
  2632. return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "")
  2633. }(e).replace(L, "")).length < 2)
  2634. return "";
  2635. for (; e.length % 4 != 0; )
  2636. e += "=";
  2637. return e
  2638. }(e))
  2639. }
  2640. function V(e, t, n, i) {
  2641. for (var r = 0; r < i && !(r + n >= t.length || r >= e.length); ++r)
  2642. t[r + n] = e[r];
  2643. return r
  2644. }
  2645. }
  2646. ).call(this, n(12))
  2647. }
  2648. , function(e, t) {
  2649. var n;
  2650. n = function() {
  2651. return this
  2652. }();
  2653. try {
  2654. n = n || new Function("return this")()
  2655. } catch (e) {
  2656. "object" == typeof window && (n = window)
  2657. }
  2658. e.exports = n
  2659. }
  2660. , function(e, t) {
  2661. for (var n = t.uint8 = new Array(256), i = 0; i <= 255; i++)
  2662. n[i] = r(i);
  2663. function r(e) {
  2664. return function(t) {
  2665. var n = t.reserve(1);
  2666. t.buffer[n] = e
  2667. }
  2668. }
  2669. }
  2670. , function(e, t, n) {
  2671. t.FlexDecoder = s,
  2672. t.FlexEncoder = a;
  2673. var i = n(0)
  2674. , r = "BUFFER_SHORTAGE";
  2675. function s() {
  2676. if (!(this instanceof s))
  2677. return new s
  2678. }
  2679. function a() {
  2680. if (!(this instanceof a))
  2681. return new a
  2682. }
  2683. function o() {
  2684. throw new Error("method not implemented: write()")
  2685. }
  2686. function c() {
  2687. throw new Error("method not implemented: fetch()")
  2688. }
  2689. function l() {
  2690. return this.buffers && this.buffers.length ? (this.flush(),
  2691. this.pull()) : this.fetch()
  2692. }
  2693. function h(e) {
  2694. (this.buffers || (this.buffers = [])).push(e)
  2695. }
  2696. function u() {
  2697. return (this.buffers || (this.buffers = [])).shift()
  2698. }
  2699. function f(e) {
  2700. return function(t) {
  2701. for (var n in e)
  2702. t[n] = e[n];
  2703. return t
  2704. }
  2705. }
  2706. s.mixin = f({
  2707. bufferish: i,
  2708. write: function(e) {
  2709. var t = this.offset ? i.prototype.slice.call(this.buffer, this.offset) : this.buffer;
  2710. this.buffer = t ? e ? this.bufferish.concat([t, e]) : t : e,
  2711. this.offset = 0
  2712. },
  2713. fetch: c,
  2714. flush: function() {
  2715. for (; this.offset < this.buffer.length; ) {
  2716. var e, t = this.offset;
  2717. try {
  2718. e = this.fetch()
  2719. } catch (e) {
  2720. if (e && e.message != r)
  2721. throw e;
  2722. this.offset = t;
  2723. break
  2724. }
  2725. this.push(e)
  2726. }
  2727. },
  2728. push: h,
  2729. pull: u,
  2730. read: l,
  2731. reserve: function(e) {
  2732. var t = this.offset
  2733. , n = t + e;
  2734. if (n > this.buffer.length)
  2735. throw new Error(r);
  2736. return this.offset = n,
  2737. t
  2738. },
  2739. offset: 0
  2740. }),
  2741. s.mixin(s.prototype),
  2742. a.mixin = f({
  2743. bufferish: i,
  2744. write: o,
  2745. fetch: function() {
  2746. var e = this.start;
  2747. if (e < this.offset) {
  2748. var t = this.start = this.offset;
  2749. return i.prototype.slice.call(this.buffer, e, t)
  2750. }
  2751. },
  2752. flush: function() {
  2753. for (; this.start < this.offset; ) {
  2754. var e = this.fetch();
  2755. e && this.push(e)
  2756. }
  2757. },
  2758. push: h,
  2759. pull: function() {
  2760. var e = this.buffers || (this.buffers = [])
  2761. , t = e.length > 1 ? this.bufferish.concat(e) : e[0];
  2762. return e.length = 0,
  2763. t
  2764. },
  2765. read: l,
  2766. reserve: function(e) {
  2767. var t = 0 | e;
  2768. if (this.buffer) {
  2769. var n = this.buffer.length
  2770. , i = 0 | this.offset
  2771. , r = i + t;
  2772. if (r < n)
  2773. return this.offset = r,
  2774. i;
  2775. this.flush(),
  2776. e = Math.max(e, Math.min(2 * n, this.maxBufferSize))
  2777. }
  2778. return e = Math.max(e, this.minBufferSize),
  2779. this.buffer = this.bufferish.alloc(e),
  2780. this.start = 0,
  2781. this.offset = t,
  2782. 0
  2783. },
  2784. send: function(e) {
  2785. var t = e.length;
  2786. if (t > this.minBufferSize)
  2787. this.flush(),
  2788. this.push(e);
  2789. else {
  2790. var n = this.reserve(t);
  2791. i.prototype.copy.call(e, this.buffer, n)
  2792. }
  2793. },
  2794. maxBufferSize: 65536,
  2795. minBufferSize: 2048,
  2796. offset: 0,
  2797. start: 0
  2798. }),
  2799. a.mixin(a.prototype)
  2800. }
  2801. , function(e, t, n) {
  2802. t.decode = function(e, t) {
  2803. var n = new i(t);
  2804. return n.write(e),
  2805. n.read()
  2806. }
  2807. ;
  2808. var i = n(16).DecodeBuffer
  2809. }
  2810. , function(e, t, n) {
  2811. t.DecodeBuffer = r;
  2812. var i = n(8).preset;
  2813. function r(e) {
  2814. if (!(this instanceof r))
  2815. return new r(e);
  2816. if (e && (this.options = e,
  2817. e.codec)) {
  2818. var t = this.codec = e.codec;
  2819. t.bufferish && (this.bufferish = t.bufferish)
  2820. }
  2821. }
  2822. n(14).FlexDecoder.mixin(r.prototype),
  2823. r.prototype.codec = i,
  2824. r.prototype.fetch = function() {
  2825. return this.codec.decode(this)
  2826. }
  2827. }
  2828. , function(e, t, n) {
  2829. var i = n(4)
  2830. , r = n(7)
  2831. , s = r.Uint64BE
  2832. , a = r.Int64BE;
  2833. t.getReadFormat = function(e) {
  2834. var t = o.hasArrayBuffer && e && e.binarraybuffer
  2835. , n = e && e.int64;
  2836. return {
  2837. map: l && e && e.usemap ? u : h,
  2838. array: f,
  2839. str: d,
  2840. bin: t ? g : p,
  2841. ext: m,
  2842. uint8: y,
  2843. uint16: v,
  2844. uint32: b,
  2845. uint64: S(8, n ? E : T),
  2846. int8: k,
  2847. int16: w,
  2848. int32: x,
  2849. int64: S(8, n ? M : I),
  2850. float32: S(4, A),
  2851. float64: S(8, P)
  2852. }
  2853. }
  2854. ,
  2855. t.readUint8 = y;
  2856. var o = n(0)
  2857. , c = n(6)
  2858. , l = "undefined" != typeof Map;
  2859. function h(e, t) {
  2860. var n, i = {}, r = new Array(t), s = new Array(t), a = e.codec.decode;
  2861. for (n = 0; n < t; n++)
  2862. r[n] = a(e),
  2863. s[n] = a(e);
  2864. for (n = 0; n < t; n++)
  2865. i[r[n]] = s[n];
  2866. return i
  2867. }
  2868. function u(e, t) {
  2869. var n, i = new Map, r = new Array(t), s = new Array(t), a = e.codec.decode;
  2870. for (n = 0; n < t; n++)
  2871. r[n] = a(e),
  2872. s[n] = a(e);
  2873. for (n = 0; n < t; n++)
  2874. i.set(r[n], s[n]);
  2875. return i
  2876. }
  2877. function f(e, t) {
  2878. for (var n = new Array(t), i = e.codec.decode, r = 0; r < t; r++)
  2879. n[r] = i(e);
  2880. return n
  2881. }
  2882. function d(e, t) {
  2883. var n = e.reserve(t)
  2884. , i = n + t;
  2885. return c.toString.call(e.buffer, "utf-8", n, i)
  2886. }
  2887. function p(e, t) {
  2888. var n = e.reserve(t)
  2889. , i = n + t
  2890. , r = c.slice.call(e.buffer, n, i);
  2891. return o.from(r)
  2892. }
  2893. function g(e, t) {
  2894. var n = e.reserve(t)
  2895. , i = n + t
  2896. , r = c.slice.call(e.buffer, n, i);
  2897. return o.Uint8Array.from(r).buffer
  2898. }
  2899. function m(e, t) {
  2900. var n = e.reserve(t + 1)
  2901. , i = e.buffer[n++]
  2902. , r = n + t
  2903. , s = e.codec.getExtUnpacker(i);
  2904. if (!s)
  2905. throw new Error("Invalid ext type: " + (i ? "0x" + i.toString(16) : i));
  2906. return s(c.slice.call(e.buffer, n, r))
  2907. }
  2908. function y(e) {
  2909. var t = e.reserve(1);
  2910. return e.buffer[t]
  2911. }
  2912. function k(e) {
  2913. var t = e.reserve(1)
  2914. , n = e.buffer[t];
  2915. return 128 & n ? n - 256 : n
  2916. }
  2917. function v(e) {
  2918. var t = e.reserve(2)
  2919. , n = e.buffer;
  2920. return n[t++] << 8 | n[t]
  2921. }
  2922. function w(e) {
  2923. var t = e.reserve(2)
  2924. , n = e.buffer
  2925. , i = n[t++] << 8 | n[t];
  2926. return 32768 & i ? i - 65536 : i
  2927. }
  2928. function b(e) {
  2929. var t = e.reserve(4)
  2930. , n = e.buffer;
  2931. return 16777216 * n[t++] + (n[t++] << 16) + (n[t++] << 8) + n[t]
  2932. }
  2933. function x(e) {
  2934. var t = e.reserve(4)
  2935. , n = e.buffer;
  2936. return n[t++] << 24 | n[t++] << 16 | n[t++] << 8 | n[t]
  2937. }
  2938. function S(e, t) {
  2939. return function(n) {
  2940. var i = n.reserve(e);
  2941. return t.call(n.buffer, i, !0)
  2942. }
  2943. }
  2944. function T(e) {
  2945. return new s(this,e).toNumber()
  2946. }
  2947. function I(e) {
  2948. return new a(this,e).toNumber()
  2949. }
  2950. function E(e) {
  2951. return new s(this,e)
  2952. }
  2953. function M(e) {
  2954. return new a(this,e)
  2955. }
  2956. function A(e) {
  2957. return i.read(this, e, !1, 23, 4)
  2958. }
  2959. function P(e) {
  2960. return i.read(this, e, !1, 52, 8)
  2961. }
  2962. }
  2963. , function(e, t, n) {
  2964. !function(t) {
  2965. e.exports = t;
  2966. var n = "listeners"
  2967. , i = {
  2968. on: function(e, t) {
  2969. return a(this, e).push(t),
  2970. this
  2971. },
  2972. once: function(e, t) {
  2973. var n = this;
  2974. return i.originalListener = t,
  2975. a(n, e).push(i),
  2976. n;
  2977. function i() {
  2978. s.call(n, e, i),
  2979. t.apply(this, arguments)
  2980. }
  2981. },
  2982. off: s,
  2983. emit: function(e, t) {
  2984. var n = this
  2985. , i = a(n, e, !0);
  2986. if (!i)
  2987. return !1;
  2988. var r = arguments.length;
  2989. if (1 === r)
  2990. i.forEach((function(e) {
  2991. e.call(n)
  2992. }
  2993. ));
  2994. else if (2 === r)
  2995. i.forEach((function(e) {
  2996. e.call(n, t)
  2997. }
  2998. ));
  2999. else {
  3000. var s = Array.prototype.slice.call(arguments, 1);
  3001. i.forEach((function(e) {
  3002. e.apply(n, s)
  3003. }
  3004. ))
  3005. }
  3006. return !!i.length
  3007. }
  3008. };
  3009. function r(e) {
  3010. for (var t in i)
  3011. e[t] = i[t];
  3012. return e
  3013. }
  3014. function s(e, t) {
  3015. var i;
  3016. if (arguments.length) {
  3017. if (t) {
  3018. if (i = a(this, e, !0)) {
  3019. if (!(i = i.filter((function(e) {
  3020. return e !== t && e.originalListener !== t
  3021. }
  3022. ))).length)
  3023. return s.call(this, e);
  3024. this[n][e] = i
  3025. }
  3026. } else if ((i = this[n]) && (delete i[e],
  3027. !Object.keys(i).length))
  3028. return s.call(this)
  3029. } else
  3030. delete this[n];
  3031. return this
  3032. }
  3033. function a(e, t, i) {
  3034. if (!i || e[n]) {
  3035. var r = e[n] || (e[n] = {});
  3036. return r[t] || (r[t] = [])
  3037. }
  3038. }
  3039. r(t.prototype),
  3040. t.mixin = r
  3041. }((
  3042. function e() {
  3043. if (!(this instanceof e))
  3044. return new e
  3045. }
  3046. ))
  3047. }
  3048. , function(e, t, n) {
  3049. (function(t) {
  3050. e.exports.maxScreenWidth = 1920,
  3051. e.exports.maxScreenHeight = 1080,
  3052. e.exports.serverUpdateRate = 9,
  3053. e.exports.maxPlayers = t && -1 != t.argv.indexOf("--largeserver") ? 80 : 40,
  3054. e.exports.maxPlayersHard = e.exports.maxPlayers + 10,
  3055. e.exports.collisionDepth = 6,
  3056. e.exports.minimapRate = 3e3,
  3057. e.exports.colGrid = 10,
  3058. e.exports.clientSendRate = 5,
  3059. e.exports.healthBarWidth = 50,
  3060. e.exports.healthBarPad = 4.5,
  3061. e.exports.iconPadding = 15,
  3062. e.exports.iconPad = .9,
  3063. e.exports.deathFadeout = 3e3,
  3064. e.exports.crownIconScale = 60,
  3065. e.exports.crownPad = 35,
  3066. e.exports.chatCountdown = 3e3,
  3067. e.exports.chatCooldown = 500,
  3068. e.exports.inSandbox = t && "mm_exp" === t.env.VULTR_SCHEME,
  3069. e.exports.maxAge = 100,
  3070. e.exports.gatherAngle = Math.PI / 2.6,
  3071. e.exports.gatherWiggle = 10,
  3072. e.exports.hitReturnRatio = .25,
  3073. e.exports.hitAngle = Math.PI / 2,
  3074. e.exports.playerScale = 35,
  3075. e.exports.playerSpeed = .0016,
  3076. e.exports.playerDecel = .993,
  3077. e.exports.nameY = 34,
  3078. e.exports.skinColors = ["#bf8f54", "#cbb091", "#896c4b", "#fadadc", "#ececec", "#c37373", "#4c4c4c", "#ecaff7", "#738cc3", "#8bc373"],
  3079. e.exports.animalCount = 7,
  3080. e.exports.aiTurnRandom = .06,
  3081. e.exports.cowNames = ["Sid", "Steph", "Bmoe", "Romn", "Jononthecool", "Fiona", "Vince", "Nathan", "Nick", "Flappy", "Ronald", "Otis", "Pepe", "Mc Donald", "Theo", "Fabz", "Oliver", "Jeff", "Jimmy", "Helena", "Reaper", "Ben", "Alan", "Naomi", "XYZ", "Clever", "Jeremy", "Mike", "Destined", "Stallion", "Allison", "Meaty", "Sophia", "Vaja", "Joey", "Pendy", "Murdoch", "Theo", "Jared", "July", "Sonia", "Mel", "Dexter", "Quinn", "Milky"],
  3082. e.exports.shieldAngle = Math.PI / 3,
  3083. e.exports.weaponVariants = [{
  3084. id: 0,
  3085. src: "",
  3086. xp: 0,
  3087. val: 1
  3088. }, {
  3089. id: 1,
  3090. src: "_g",
  3091. xp: 3e3,
  3092. val: 1.1
  3093. }, {
  3094. id: 2,
  3095. src: "_d",
  3096. xp: 7e3,
  3097. val: 1.18
  3098. }, {
  3099. id: 3,
  3100. src: "_r",
  3101. poison: !0,
  3102. xp: 12e3,
  3103. val: 1.18
  3104. }],
  3105. e.exports.fetchVariant = function(t) {
  3106. for (var n = t.weaponXP[t.weaponIndex] || 0, i = e.exports.weaponVariants.length - 1; i >= 0; --i)
  3107. if (n >= e.exports.weaponVariants[i].xp)
  3108. return e.exports.weaponVariants[i]
  3109. }
  3110. ,
  3111. e.exports.resourceTypes = ["wood", "food", "stone", "points"],
  3112. e.exports.areaCount = 7,
  3113. e.exports.treesPerArea = 9,
  3114. e.exports.bushesPerArea = 3,
  3115. e.exports.totalRocks = 32,
  3116. e.exports.goldOres = 7,
  3117. e.exports.riverWidth = 724,
  3118. e.exports.riverPadding = 114,
  3119. e.exports.waterCurrent = .0011,
  3120. e.exports.waveSpeed = 1e-4,
  3121. e.exports.waveMax = 1.3,
  3122. e.exports.treeScales = [150, 160, 165, 175],
  3123. e.exports.bushScales = [80, 85, 95],
  3124. e.exports.rockScales = [80, 85, 90],
  3125. e.exports.snowBiomeTop = 2400,
  3126. e.exports.snowSpeed = .75,
  3127. e.exports.maxNameLength = 15,
  3128. e.exports.mapScale = 14400,
  3129. e.exports.mapPingScale = 40,
  3130. e.exports.mapPingTime = 2200
  3131. }
  3132. ).call(this, n(41))
  3133. }
  3134. , function(e, t) {
  3135. var n = {
  3136. utf8: {
  3137. stringToBytes: function(e) {
  3138. return n.bin.stringToBytes(unescape(encodeURIComponent(e)))
  3139. },
  3140. bytesToString: function(e) {
  3141. return decodeURIComponent(escape(n.bin.bytesToString(e)))
  3142. }
  3143. },
  3144. bin: {
  3145. stringToBytes: function(e) {
  3146. for (var t = [], n = 0; n < e.length; n++)
  3147. t.push(255 & e.charCodeAt(n));
  3148. return t
  3149. },
  3150. bytesToString: function(e) {
  3151. for (var t = [], n = 0; n < e.length; n++)
  3152. t.push(String.fromCharCode(e[n]));
  3153. return t.join("")
  3154. }
  3155. }
  3156. };
  3157. e.exports = n
  3158. }
  3159. , function(e, t, n) {
  3160. "use strict";
  3161. window.loadedScript = !0;
  3162. var i = "127.0.0.1" !== location.hostname && !location.hostname.startsWith("192.168.");
  3163. n(22);
  3164. var r = n(23)
  3165. , s = n(42)
  3166. , a = n(43)
  3167. , o = n(19)
  3168. , c = n(44)
  3169. , l = n(45)
  3170. , h = (n(46),
  3171. n(47))
  3172. , u = n(48)
  3173. , f = n(55)
  3174. , d = n(56)
  3175. , p = n(57)
  3176. , g = n(58).obj
  3177. , m = new a.TextManager
  3178. , y = new (n(59))("moomoo.io",3e3,o.maxPlayers,5,!1);
  3179. y.debugLog = !1;
  3180. var k = !1;
  3181. function v() {
  3182. ht && ut && (k = !0,
  3183. i ? window.grecaptcha.execute("6LevKusUAAAAAAFknhlV8sPtXAk5Z5dGP5T2FYIZ", {
  3184. action: "homepage"
  3185. }).then((function(e) {
  3186. w(e)
  3187. }
  3188. )) : w(null))
  3189. }
  3190. function w(e) {
  3191. y.start((function(t, n, a) {
  3192. var c = (i ? "wss" : "ws") + "://" + t + ":8008/?gameIndex=" + a;
  3193. e && (c += "&token=" + encodeURIComponent(e)),
  3194. r.connect(c, (function(e) {
  3195. Bi(),
  3196. setInterval(()=>Bi(), 2500),
  3197. e ? ft(e) : (ue.onclick = s.checkTrusted((function() {
  3198. !function() {
  3199. var e = ++bt > 1
  3200. , t = Date.now() - wt > vt;
  3201. e && t ? (wt = Date.now(),
  3202. xt()) : Tn()
  3203. }()
  3204. }
  3205. )),
  3206. s.hookTouchEvents(ue),
  3207. fe.onclick = s.checkTrusted((function() {
  3208. Oi("https://krunker.io/?play=SquidGame_KB")
  3209. }
  3210. )),
  3211. s.hookTouchEvents(fe),
  3212. pe.onclick = s.checkTrusted((function() {
  3213. setTimeout((function() {
  3214. !function() {
  3215. var e = xe.value
  3216. , t = prompt("party key", e);
  3217. t && (window.onbeforeunload = void 0,
  3218. window.location.href = "/?server=" + t)
  3219. }()
  3220. }
  3221. ), 10)
  3222. }
  3223. )),
  3224. s.hookTouchEvents(pe),
  3225. ge.onclick = s.checkTrusted((function() {
  3226. Ae.classList.contains("showing") ? (Ae.classList.remove("showing"),
  3227. me.innerText = "Settings") : (Ae.classList.add("showing"),
  3228. me.innerText = "Close")
  3229. }
  3230. )),
  3231. s.hookTouchEvents(ge),
  3232. ye.onclick = s.checkTrusted((function() {
  3233. yn(),
  3234. "block" != Ye.style.display ? Ut() : Ye.style.display = "none"
  3235. }
  3236. )),
  3237. s.hookTouchEvents(ye),
  3238. ke.onclick = s.checkTrusted((function() {
  3239. "block" != Qe.style.display ? (Qe.style.display = "block",
  3240. Ye.style.display = "none",
  3241. an(),
  3242. Gt()) : Qe.style.display = "none"
  3243. }
  3244. )),
  3245. s.hookTouchEvents(ke),
  3246. ve.onclick = s.checkTrusted((function() {
  3247. rn()
  3248. }
  3249. )),
  3250. s.hookTouchEvents(ve),
  3251. Ne.onclick = s.checkTrusted((function() {
  3252. xn()
  3253. }
  3254. )),
  3255. s.hookTouchEvents(Ne),
  3256. function() {
  3257. for (var e = 0; e < jn.length; ++e) {
  3258. var t = new Image;
  3259. t.onload = function() {
  3260. this.isLoaded = !0
  3261. }
  3262. ,
  3263. t.src = ".././img/icons/" + jn[e] + ".png",
  3264. Rn[jn[e]] = t
  3265. }
  3266. }(),
  3267. Pe.style.display = "none",
  3268. Me.style.display = "block",
  3269. Le.value = E("moo_name") || "",
  3270. function() {
  3271. var e = E("native_resolution");
  3272. Zt(e ? "true" == e : "undefined" != typeof cordova),
  3273. A = "true" == E("show_ping"),
  3274. Ie.hidden = !A,
  3275. E("moo_moosic"),
  3276. setInterval((function() {
  3277. window.cordova && (document.getElementById("downloadButtonContainer").classList.add("cordova"),
  3278. document.getElementById("mobileDownloadButtonContainer").classList.add("cordova"))
  3279. }
  3280. ), 1e3),
  3281. en(),
  3282. s.removeAllChildren(Ce);
  3283. for (var t = 0; t < l.weapons.length + l.list.length; ++t)
  3284. !function(e) {
  3285. s.generateElement({
  3286. id: "actionBarItem" + e,
  3287. class: "actionBarItem",
  3288. style: "display:none",
  3289. onmouseout: function() {
  3290. Tt()
  3291. },
  3292. parent: Ce
  3293. })
  3294. }(t);
  3295. for (t = 0; t < l.list.length + l.weapons.length; ++t)
  3296. !function(e) {
  3297. var t = document.createElement("canvas");
  3298. t.width = t.height = 66;
  3299. var n = t.getContext("2d");
  3300. if (n.translate(t.width / 2, t.height / 2),
  3301. n.imageSmoothingEnabled = !1,
  3302. n.webkitImageSmoothingEnabled = !1,
  3303. n.mozImageSmoothingEnabled = !1,
  3304. l.weapons[e]) {
  3305. n.rotate(Math.PI / 4 + Math.PI);
  3306. var i = new Image;
  3307. Zn[l.weapons[e].src] = i,
  3308. i.onload = function() {
  3309. this.isLoaded = !0;
  3310. var i = 1 / (this.height / this.width)
  3311. , r = l.weapons[e].iPad || 1;
  3312. n.drawImage(this, -t.width * r * o.iconPad * i / 2, -t.height * r * o.iconPad / 2, t.width * r * i * o.iconPad, t.height * r * o.iconPad),
  3313. n.fillStyle = "rgba(0, 0, 70, 0.1)",
  3314. n.globalCompositeOperation = "source-atop",
  3315. n.fillRect(-t.width / 2, -t.height / 2, t.width, t.height),
  3316. document.getElementById("actionBarItem" + e).style.backgroundImage = "url(" + t.toDataURL() + ")"
  3317. }
  3318. ,
  3319. i.src = ".././img/weapons/" + l.weapons[e].src + ".png",
  3320. (r = document.getElementById("actionBarItem" + e)).onmouseover = s.checkTrusted((function() {
  3321. Tt(l.weapons[e], !0)
  3322. }
  3323. )),
  3324. r.onclick = s.checkTrusted((function() {
  3325. Sn(e, !0)
  3326. }
  3327. )),
  3328. s.hookTouchEvents(r)
  3329. } else {
  3330. i = ri(l.list[e - l.weapons.length], !0);
  3331. var r, a = Math.min(t.width - o.iconPadding, i.width);
  3332. n.globalAlpha = 1,
  3333. n.drawImage(i, -a / 2, -a / 2, a, a),
  3334. n.fillStyle = "rgba(0, 0, 70, 0.1)",
  3335. n.globalCompositeOperation = "source-atop",
  3336. n.fillRect(-a / 2, -a / 2, a, a),
  3337. document.getElementById("actionBarItem" + e).style.backgroundImage = "url(" + t.toDataURL() + ")",
  3338. (r = document.getElementById("actionBarItem" + e)).onmouseover = s.checkTrusted((function() {
  3339. Tt(l.list[e - l.weapons.length])
  3340. }
  3341. )),
  3342. r.onclick = s.checkTrusted((function() {
  3343. Sn(e - l.weapons.length)
  3344. }
  3345. )),
  3346. s.hookTouchEvents(r)
  3347. }
  3348. }(t);
  3349. Le.ontouchstart = s.checkTrusted((function(e) {
  3350. e.preventDefault();
  3351. var t = prompt("enter name", e.currentTarget.value);
  3352. e.currentTarget.value = t.slice(0, 15)
  3353. }
  3354. )),
  3355. Se.checked = M,
  3356. Se.onchange = s.checkTrusted((function(e) {
  3357. Zt(e.target.checked)
  3358. }
  3359. )),
  3360. Te.checked = A,
  3361. Te.onchange = s.checkTrusted((function(e) {
  3362. A = Te.checked,
  3363. Ie.hidden = !A,
  3364. I("show_ping", A ? "true" : "false")
  3365. }
  3366. ))
  3367. }())
  3368. }
  3369. ), {
  3370. id: st,
  3371. d: ft,
  3372. 1: En,
  3373. 2: vi,
  3374. 4: wi,
  3375. 33: Ti,
  3376. 5: Ln,
  3377. 6: li,
  3378. a: gi,
  3379. aa: pi,
  3380. 7: Wn,
  3381. 8: hi,
  3382. sp: ui,
  3383. 9: xi,
  3384. h: Si,
  3385. 11: Pn,
  3386. 12: Cn,
  3387. 13: Bn,
  3388. 14: bi,
  3389. 15: Dn,
  3390. 16: Un,
  3391. 17: $t,
  3392. 18: fi,
  3393. 19: di,
  3394. 20: Ci,
  3395. ac: Ot,
  3396. ad: _t,
  3397. an: Bt,
  3398. st: Rt,
  3399. sa: jt,
  3400. us: Nt,
  3401. ch: hn,
  3402. mm: Wt,
  3403. t: Mn,
  3404. p: Yt,
  3405. pp: Pi
  3406. }),
  3407. pt(),
  3408. setTimeout(()=>gt(), 3e3)
  3409. }
  3410. ), (function(e) {
  3411. console.error("Vultr error:", e),
  3412. alert("Error:\n" + e),
  3413. ft("disconnected")
  3414. }
  3415. ))
  3416. }
  3417. var b, x = new g(o,s), S = Math.PI, T = 2 * S;
  3418. function I(e, t) {
  3419. b && localStorage.setItem(e, t)
  3420. }
  3421. function E(e) {
  3422. return b ? localStorage.getItem(e) : null
  3423. }
  3424. Math.lerpAngle = function(e, t, n) {
  3425. Math.abs(t - e) > S && (e > t ? t += T : e += T);
  3426. var i = t + (e - t) * n;
  3427. return i >= 0 && i <= T ? i : i % T
  3428. }
  3429. ,
  3430. CanvasRenderingContext2D.prototype.roundRect = function(e, t, n, i, r) {
  3431. return n < 2 * r && (r = n / 2),
  3432. i < 2 * r && (r = i / 2),
  3433. r < 0 && (r = 0),
  3434. this.beginPath(),
  3435. this.moveTo(e + r, t),
  3436. this.arcTo(e + n, t, e + n, t + i, r),
  3437. this.arcTo(e + n, t + i, e, t + i, r),
  3438. this.arcTo(e, t + i, e, t, r),
  3439. this.arcTo(e, t, e + n, t, r),
  3440. this.closePath(),
  3441. this
  3442. };
  3443. var M, A, P, B, C, O, R, j, _, U, D, L, F, z, H = E("moofoll"), V = 1, q = Date.now(), Y = [], W = [], X = [], N = [], G = [], J = new p(d,G,W,Y,nt,l,o,s), K = n(70), Q = n(71), Z = new K(Y,Q,W,l,null,o,s), ee = 1, te = 0, ne = 0, ie = 0, re = {
  3444. id: -1,
  3445. startX: 0,
  3446. startY: 0,
  3447. currentX: 0,
  3448. currentY: 0
  3449. }, se = {
  3450. id: -1,
  3451. startX: 0,
  3452. startY: 0,
  3453. currentX: 0,
  3454. currentY: 0
  3455. }, ae = 0, oe = o.maxScreenWidth, ce = o.maxScreenHeight, le = !1, he = (document.getElementById("ad-container"),
  3456. document.getElementById("mainMenu")), ue = document.getElementById("enterGame"), fe = document.getElementById("promoImg"), de = document.getElementById("partyButton"), pe = document.getElementById("joinPartyButton"), ge = document.getElementById("settingsButton"), me = ge.getElementsByTagName("span")[0], ye = document.getElementById("allianceButton"), ke = document.getElementById("storeButton"), ve = document.getElementById("chatButton"), we = document.getElementById("gameCanvas"), be = we.getContext("2d"), xe = document.getElementById("serverBrowser"), Se = document.getElementById("nativeResolution"), Te = document.getElementById("showPing"), Ie = (document.getElementById("playMusic"),
  3457. document.getElementById("pingDisplay")), Ee = document.getElementById("shutdownDisplay"), Me = document.getElementById("menuCardHolder"), Ae = document.getElementById("guideCard"), Pe = document.getElementById("loadingText"), Be = document.getElementById("gameUI"), Ce = document.getElementById("actionBar"), Oe = document.getElementById("scoreDisplay"), Re = document.getElementById("foodDisplay"), je = document.getElementById("woodDisplay"), _e = document.getElementById("stoneDisplay"), Ue = document.getElementById("killCounter"), De = document.getElementById("leaderboardData"), Le = document.getElementById("nameInput"), Fe = document.getElementById("itemInfoHolder"), ze = document.getElementById("ageText"), He = document.getElementById("ageBarBody"), Ve = document.getElementById("upgradeHolder"), qe = document.getElementById("upgradeCounter"), Ye = document.getElementById("allianceMenu"), We = document.getElementById("allianceHolder"), Xe = document.getElementById("allianceManager"), Ne = document.getElementById("mapDisplay"), Ge = document.getElementById("diedText"), Je = document.getElementById("skinColorHolder"), Ke = Ne.getContext("2d");
  3458. Ne.width = 300,
  3459. Ne.height = 300;
  3460. var Qe = document.getElementById("storeMenu")
  3461. , $e = document.getElementById("storeHolder")
  3462. , Ze = document.getElementById("noticationDisplay")
  3463. , et = f.hats
  3464. , tt = f.accessories
  3465. , nt = new h(c,N,s,o)
  3466. , it = "#525252"
  3467. , rt = "#3d3f42";
  3468. function st(e) {
  3469. X = e.teams
  3470. }
  3471. var at = document.getElementById("featuredYoutube")
  3472. , ot = [{
  3473. name: "Corrupt X",
  3474. link: "https://www.youtube.com/channel/UC0UH2LfQvBSeH24bmtbmITw"
  3475. }, {
  3476. name: "Tweak Big",
  3477. link: "https://www.youtube.com/channel/UCbwvzJ38AndDTkoX8sD9YOw"
  3478. }, {
  3479. name: "Arena Closer",
  3480. link: "https://www.youtube.com/channel/UCazucVSJqW-kiHMIhQhD-QQ"
  3481. }, {
  3482. name: "Godenot",
  3483. link: "https://www.youtube.com/user/SirGodenot"
  3484. }, {
  3485. name: "RajNoobTV",
  3486. link: "https://www.youtube.com/channel/UCVLo9brXBWrCttMaGzvm0-Q"
  3487. }, {
  3488. name: "TomNotTom",
  3489. link: "https://www.youtube.com/channel/UC7z97RgHFJRcv2niXgArBDw"
  3490. }, {
  3491. name: "Nation",
  3492. link: "https://www.youtube.com/channel/UCSl-MBn3qzjrIvLNESQRk-g"
  3493. }, {
  3494. name: "Pidyohago",
  3495. link: "https://www.youtube.com/channel/UC04p8Mg8nDaDx04A9is2B8Q"
  3496. }, {
  3497. name: "Enigma",
  3498. link: "https://www.youtube.com/channel/UC5HhLbs3sReHo8Bb9NDdFrg"
  3499. }, {
  3500. name: "Bauer",
  3501. link: "https://www.youtube.com/channel/UCwU2TbJx3xTSlPqg-Ix3R1g"
  3502. }, {
  3503. name: "iStealth",
  3504. link: "https://www.youtube.com/channel/UCGrvlEOsQFViZbyFDE6t69A"
  3505. }, {
  3506. name: "SICKmania",
  3507. link: "https://www.youtube.com/channel/UCvVI98ezn4TpX5wDMZjMa3g"
  3508. }, {
  3509. name: "LightThief",
  3510. link: "https://www.youtube.com/channel/UCj6C_tiDeATiKd3GX127XoQ"
  3511. }, {
  3512. name: "Fortish",
  3513. link: "https://www.youtube.com/channel/UCou6CLU-szZA3Tb340TB9_Q"
  3514. }, {
  3515. name: "巧克力",
  3516. link: "https://www.youtube.com/channel/UCgL6J6oL8F69vm-GcPScmwg"
  3517. }, {
  3518. name: "i Febag",
  3519. link: "https://www.youtube.com/channel/UCiU6WZwiKbsnt5xmwr0OFbg"
  3520. }, {
  3521. name: "GoneGaming",
  3522. link: "https://www.youtube.com/channel/UCOcQthRanYcwYY0XVyVeK0g"
  3523. }]
  3524. , ct = ot[s.randInt(0, ot.length - 1)];
  3525. at.innerHTML = "<a target='_blank' class='ytLink' href='" + ct.link + "'><i class='material-icons' style='vertical-align: top;'>&#xE064;</i> " + ct.name + "</a>";
  3526. var lt = !0
  3527. , ht = !1
  3528. , ut = !1;
  3529. function ft(e) {
  3530. r.close(),
  3531. dt(e)
  3532. }
  3533. function dt(e) {
  3534. he.style.display = "block",
  3535. Be.style.display = "none",
  3536. Me.style.display = "none",
  3537. Ge.style.display = "none",
  3538. Pe.style.display = "block",
  3539. Pe.innerHTML = e + "<a href='javascript:window.location.href=window.location.href' class='ytLink'>reload</a>"
  3540. }
  3541. window.onblur = function() {
  3542. lt = !1
  3543. }
  3544. ,
  3545. window.onfocus = function() {
  3546. lt = !0,
  3547. R && R.alive && yn()
  3548. }
  3549. ,
  3550. window.onload = function() {
  3551. ht = !0,
  3552. v(),
  3553. setTimeout((function() {
  3554. k || (alert("Captcha failed to load"),
  3555. window.location.reload())
  3556. }
  3557. ), 2e4)
  3558. }
  3559. ,
  3560. window.captchaCallback = function() {
  3561. ut = !0,
  3562. v()
  3563. }
  3564. ,
  3565. we.oncontextmenu = function() {
  3566. return !1
  3567. }
  3568. ;
  3569. function pt() {
  3570. var e, t, n = "", i = 0;
  3571. for (var r in y.servers) {
  3572. for (var s = y.servers[r], a = 0, c = 0; c < s.length; c++)
  3573. for (var l = 0; l < s[c].games.length; l++)
  3574. a += s[c].games[l].playerCount;
  3575. i += a;
  3576. var h = y.regionInfo[r].name;
  3577. n += "<option disabled>" + h + " - " + a + " players</option>";
  3578. for (var u = 0; u < s.length; u++)
  3579. for (var f = s[u], d = 0; d < f.games.length; d++) {
  3580. var p = f.games[d]
  3581. , g = 1 * f.index + d + 1
  3582. , m = y.server && y.server.region === f.region && y.server.index === f.index && y.gameIndex == d
  3583. , k = h + " " + g + " [" + Math.min(p.playerCount, o.maxPlayers) + "/" + o.maxPlayers + "]";
  3584. let e = y.stripRegion(r) + ":" + u + ":" + d;
  3585. m && (de.getElementsByTagName("span")[0].innerText = e),
  3586. n += "<option value='" + e + "' " + (m ? "selected" : "") + ">" + k + "</option>"
  3587. }
  3588. n += "<option disabled></option>"
  3589. }
  3590. n += "<option disabled>All Servers - " + i + " players</option>",
  3591. xe.innerHTML = n,
  3592. "sandbox.moomoo.io" == location.hostname ? (e = "Back to MooMoo",
  3593. t = "//moomoo.io/") : (e = "Try the sandbox",
  3594. t = "//sandbox.moomoo.io/"),
  3595. document.getElementById("altServer").innerHTML = "<a href='" + t + "'>" + e + "<i class='material-icons' style='font-size:10px;vertical-align:middle'>arrow_forward_ios</i></a>"
  3596. }
  3597. function gt() {
  3598. var e = new XMLHttpRequest;
  3599. e.onreadystatechange = function() {
  3600. 4 == this.readyState && (200 == this.status ? (window.vultr = JSON.parse(this.responseText),
  3601. y.processServers(vultr.servers),
  3602. pt()) : console.error("Failed to load server data with status code:", this.status))
  3603. }
  3604. ,
  3605. e.open("GET", "/serverData", !0),
  3606. e.send()
  3607. }
  3608. xe.addEventListener("change", s.checkTrusted((function() {
  3609. let e = xe.value.split(":");
  3610. y.switchServer(e[0], e[1], e[2])
  3611. }
  3612. )));
  3613. var mt = document.getElementById("pre-content-container")
  3614. , yt = null
  3615. , kt = null;
  3616. window.cpmstarAPI = function(e) {
  3617. e.game.setTarget(mt),
  3618. kt = e
  3619. }
  3620. var vt = 3e5
  3621. , wt = 0
  3622. , bt = 0;
  3623. function xt() {
  3624. void Tn();
  3625. }
  3626. function St() {
  3627. mt.style.display = "none",
  3628. Tn()
  3629. }
  3630. function Tt(e, t, n) {
  3631. if (R && e)
  3632. if (s.removeAllChildren(Fe),
  3633. Fe.classList.add("visible"),
  3634. s.generateElement({
  3635. id: "itemInfoName",
  3636. text: s.capitalizeFirst(e.name),
  3637. parent: Fe
  3638. }),
  3639. s.generateElement({
  3640. id: "itemInfoDesc",
  3641. text: e.desc,
  3642. parent: Fe
  3643. }),
  3644. n)
  3645. ;
  3646. else if (t)
  3647. s.generateElement({
  3648. class: "itemInfoReq",
  3649. text: e.type ? "secondary" : "primary",
  3650. parent: Fe
  3651. });
  3652. else {
  3653. for (var i = 0; i < e.req.length; i += 2)
  3654. s.generateElement({
  3655. class: "itemInfoReq",
  3656. html: e.req[i] + "<span class='itemInfoReqVal'> x" + e.req[i + 1] + "</span>",
  3657. parent: Fe
  3658. });
  3659. e.group.limit && s.generateElement({
  3660. class: "itemInfoLmt",
  3661. text: (R.itemCounts[e.group.id] || 0) + "/" + e.group.limit,
  3662. parent: Fe
  3663. })
  3664. }
  3665. else
  3666. Fe.classList.remove("visible")
  3667. }
  3668. window.showPreAd = xt;
  3669. var It, Et, Mt, At = [], Pt = [];
  3670. function Bt(e, t) {
  3671. At.push({
  3672. sid: e,
  3673. name: t
  3674. }),
  3675. Ct()
  3676. }
  3677. function Ct() {
  3678. if (At[0]) {
  3679. var e = At[0];
  3680. s.removeAllChildren(Ze),
  3681. Ze.style.display = "block",
  3682. s.generateElement({
  3683. class: "notificationText",
  3684. text: e.name,
  3685. parent: Ze
  3686. }),
  3687. s.generateElement({
  3688. class: "notifButton",
  3689. html: "<i class='material-icons' style='font-size:28px;color:#cc5151;'>&#xE14C;</i>",
  3690. parent: Ze,
  3691. onclick: function() {
  3692. Dt(0)
  3693. },
  3694. hookTouch: !0
  3695. }),
  3696. s.generateElement({
  3697. class: "notifButton",
  3698. html: "<i class='material-icons' style='font-size:28px;color:#8ecc51;'>&#xE876;</i>",
  3699. parent: Ze,
  3700. onclick: function() {
  3701. Dt(1)
  3702. },
  3703. hookTouch: !0
  3704. })
  3705. } else
  3706. Ze.style.display = "none"
  3707. }
  3708. function Ot(e) {
  3709. X.push(e),
  3710. "block" == Ye.style.display && Ut()
  3711. }
  3712. function Rt(e, t) {
  3713. R && (R.team = e,
  3714. R.isOwner = t,
  3715. "block" == Ye.style.display && Ut())
  3716. }
  3717. function jt(e) {
  3718. Pt = e,
  3719. "block" == Ye.style.display && Ut()
  3720. }
  3721. function _t(e) {
  3722. for (var t = X.length - 1; t >= 0; t--)
  3723. X[t].sid == e && X.splice(t, 1);
  3724. "block" == Ye.style.display && Ut()
  3725. }
  3726. function Ut() {
  3727. if (R && R.alive) {
  3728. if (an(),
  3729. Qe.style.display = "none",
  3730. Ye.style.display = "block",
  3731. s.removeAllChildren(We),
  3732. R.team)
  3733. for (var e = 0; e < Pt.length; e += 2)
  3734. !function(e) {
  3735. var t = s.generateElement({
  3736. class: "allianceItem",
  3737. style: "color:" + (Pt[e] == R.sid ? "#fff" : "rgba(255,255,255,0.6)"),
  3738. text: Pt[e + 1],
  3739. parent: We
  3740. });
  3741. R.isOwner && Pt[e] != R.sid && s.generateElement({
  3742. class: "joinAlBtn",
  3743. text: "Kick",
  3744. onclick: function() {
  3745. Lt(Pt[e])
  3746. },
  3747. hookTouch: !0,
  3748. parent: t
  3749. })
  3750. }(e);
  3751. else if (X.length)
  3752. for (e = 0; e < X.length; ++e)
  3753. !function(e) {
  3754. var t = s.generateElement({
  3755. class: "allianceItem",
  3756. style: "color:" + (X[e].sid == R.team ? "#fff" : "rgba(255,255,255,0.6)"),
  3757. text: X[e].sid,
  3758. parent: We
  3759. });
  3760. s.generateElement({
  3761. class: "joinAlBtn",
  3762. text: "Join",
  3763. onclick: function() {
  3764. Ft(e)
  3765. },
  3766. hookTouch: !0,
  3767. parent: t
  3768. })
  3769. }(e);
  3770. else
  3771. s.generateElement({
  3772. class: "allianceItem",
  3773. text: "No Tribes Yet",
  3774. parent: We
  3775. });
  3776. s.removeAllChildren(Xe),
  3777. R.team ? s.generateElement({
  3778. class: "allianceButtonM",
  3779. style: "width: 360px",
  3780. text: R.isOwner ? "Delete Tribe" : "Leave Tribe",
  3781. onclick: function() {
  3782. Ht()
  3783. },
  3784. hookTouch: !0,
  3785. parent: Xe
  3786. }) : (s.generateElement({
  3787. tag: "input",
  3788. type: "text",
  3789. id: "allianceInput",
  3790. maxLength: 7,
  3791. placeholder: "unique name",
  3792. ontouchstart: function(e) {
  3793. e.preventDefault();
  3794. var t = prompt("unique name", e.currentTarget.value);
  3795. e.currentTarget.value = t.slice(0, 7)
  3796. },
  3797. parent: Xe
  3798. }),
  3799. s.generateElement({
  3800. tag: "div",
  3801. class: "allianceButtonM",
  3802. style: "width: 140px;",
  3803. text: "Create",
  3804. onclick: function() {
  3805. zt()
  3806. },
  3807. hookTouch: !0,
  3808. parent: Xe
  3809. }))
  3810. }
  3811. }
  3812. function Dt(e) {
  3813. r.send("11", At[0].sid, e),
  3814. At.splice(0, 1),
  3815. Ct()
  3816. }
  3817. function Lt(e) {
  3818. r.send("12", e)
  3819. }
  3820. function Ft(e) {
  3821. r.send("10", X[e].sid)
  3822. }
  3823. function zt() {
  3824. r.send("8", document.getElementById("allianceInput").value)
  3825. }
  3826. function Ht() {
  3827. At = [],
  3828. Ct(),
  3829. r.send("9")
  3830. }
  3831. var Vt, qt = [];
  3832. function Yt(e, t) {
  3833. for (var n = 0; n < qt.length; ++n)
  3834. if (!qt[n].active) {
  3835. Vt = qt[n];
  3836. break
  3837. }
  3838. Vt || (Vt = new function() {
  3839. this.init = function(e, t) {
  3840. this.scale = 0,
  3841. this.x = e,
  3842. this.y = t,
  3843. this.active = !0
  3844. }
  3845. ,
  3846. this.update = function(e, t) {
  3847. this.active && (this.scale += .05 * t,
  3848. this.scale >= o.mapPingScale ? this.active = !1 : (e.globalAlpha = 1 - Math.max(0, this.scale / o.mapPingScale),
  3849. e.beginPath(),
  3850. e.arc(this.x / o.mapScale * Ne.width, this.y / o.mapScale * Ne.width, this.scale, 0, 2 * Math.PI),
  3851. e.stroke()))
  3852. }
  3853. }
  3854. ,
  3855. qt.push(Vt)),
  3856. Vt.init(e, t)
  3857. }
  3858. function Wt(e) {
  3859. Et = e
  3860. }
  3861. var Xt = 0;
  3862. function Nt(e, t, n) {
  3863. n ? e ? R.tailIndex = t : R.tails[t] = 1 : e ? R.skinIndex = t : R.skins[t] = 1,
  3864. "block" == Qe.style.display && Gt()
  3865. }
  3866. function Gt() {
  3867. if (R) {
  3868. s.removeAllChildren($e);
  3869. for (var e = Xt, t = e ? tt : et, n = 0; n < t.length; ++n)
  3870. t[n].dontSell || function(n) {
  3871. var i = s.generateElement({
  3872. id: "storeDisplay" + n,
  3873. class: "storeItem",
  3874. onmouseout: function() {
  3875. Tt()
  3876. },
  3877. onmouseover: function() {
  3878. Tt(t[n], !1, !0)
  3879. },
  3880. parent: $e
  3881. });
  3882. s.hookTouchEvents(i, !0),
  3883. s.generateElement({
  3884. tag: "img",
  3885. class: "hatPreview",
  3886. src: "../img/" + (e ? "accessories/access_" : "hats/hat_") + t[n].id + (t[n].topSprite ? "_p" : "") + ".png",
  3887. parent: i
  3888. }),
  3889. s.generateElement({
  3890. tag: "span",
  3891. text: t[n].name,
  3892. parent: i
  3893. }),
  3894. (e ? R.tails[t[n].id] : R.skins[t[n].id]) ? (e ? R.tailIndex : R.skinIndex) == t[n].id ? s.generateElement({
  3895. class: "joinAlBtn",
  3896. style: "margin-top: 5px",
  3897. text: "Unequip",
  3898. onclick: function() {
  3899. Jt(0, e)
  3900. },
  3901. hookTouch: !0,
  3902. parent: i
  3903. }) : s.generateElement({
  3904. class: "joinAlBtn",
  3905. style: "margin-top: 5px",
  3906. text: "Equip",
  3907. onclick: function() {
  3908. Jt(t[n].id, e)
  3909. },
  3910. hookTouch: !0,
  3911. parent: i
  3912. }) : (s.generateElement({
  3913. class: "joinAlBtn",
  3914. style: "margin-top: 5px",
  3915. text: "Buy",
  3916. onclick: function() {
  3917. Kt(t[n].id, e)
  3918. },
  3919. hookTouch: !0,
  3920. parent: i
  3921. }),
  3922. s.generateElement({
  3923. tag: "span",
  3924. class: "itemPrice",
  3925. text: t[n].price,
  3926. parent: i
  3927. }))
  3928. }(n)
  3929. }
  3930. }
  3931. function Jt(e, t) {
  3932. r.send("13c", 0, e, t)
  3933. }
  3934. function Kt(e, t) {
  3935. r.send("13c", 1, e, t)
  3936. }
  3937. function Qt() {
  3938. Qe.style.display = "none",
  3939. Ye.style.display = "none",
  3940. an()
  3941. }
  3942. function $t(e, t) {
  3943. e && (t ? R.weapons = e : R.items = e);
  3944. for (var n = 0; n < l.list.length; ++n) {
  3945. var i = l.weapons.length + n;
  3946. document.getElementById("actionBarItem" + i).style.display = R.items.indexOf(l.list[n].id) >= 0 ? "inline-block" : "none"
  3947. }
  3948. for (n = 0; n < l.weapons.length; ++n)
  3949. document.getElementById("actionBarItem" + n).style.display = R.weapons[l.weapons[n].type] == l.weapons[n].id ? "inline-block" : "none"
  3950. }
  3951. function Zt(e) {
  3952. M = e,
  3953. V = e && window.devicePixelRatio || 1,
  3954. Se.checked = e,
  3955. I("native_resolution", e.toString()),
  3956. un()
  3957. }
  3958. function en() {
  3959. for (var e = "", t = 0; t < o.skinColors.length; ++t)
  3960. e += t == ae ? "<div class='skinColorItem activeSkin' style='background-color:" + o.skinColors[t] + "' onclick='selectSkinColor(" + t + ")'></div>" : "<div class='skinColorItem' style='background-color:" + o.skinColors[t] + "' onclick='selectSkinColor(" + t + ")'></div>";
  3961. Je.innerHTML = e
  3962. }
  3963. var tn = document.getElementById("chatBox")
  3964. , nn = document.getElementById("chatHolder");
  3965. function rn() {
  3966. on ? setTimeout((function() {
  3967. var e = prompt("chat message");
  3968. e && sn(e)
  3969. }
  3970. ), 1) : "block" == nn.style.display ? (tn.value && sn(tn.value),
  3971. an()) : (Qe.style.display = "none",
  3972. Ye.style.display = "none",
  3973. nn.style.display = "block",
  3974. tn.focus(),
  3975. yn()),
  3976. tn.value = ""
  3977. }
  3978. function sn(e) {
  3979. r.send("ch", e.slice(0, 30))
  3980. }
  3981. function an() {
  3982. tn.value = "",
  3983. nn.style.display = "none"
  3984. }
  3985. var on, cn, ln = ["cunt", "whore", "fuck", "shit", "faggot", "nigger", "nigga", "dick", "vagina", "minge", "cock", "rape", "cum", "sex", "tits", "penis", "clit", "pussy", "meatcurtain", "jizz", "prune", "douche", "wanker", "damn", "bitch", "dick", "fag", "bastard"];
  3986. function hn(e, t) {
  3987. var n = Ii(e);
  3988. Tach.updateChat(t, e);
  3989. n && (n.chatMessage = function(e) {
  3990. for (var t, n = 0; n < ln.length; ++n)
  3991. if (e.indexOf(ln[n]) > -1) {
  3992. t = "";
  3993. for (var i = 0; i < ln[n].length; ++i)
  3994. t += t.length ? "o" : "M";
  3995. var r = new RegExp(ln[n],"g");
  3996. e = e.replace(r, t)
  3997. }
  3998. return e
  3999. }(t),
  4000. n.chatCountdown = o.chatCountdown)
  4001. }
  4002. function un() {
  4003. F = window.innerWidth,
  4004. z = window.innerHeight;
  4005. var e = Math.max(F / oe, z / ce) * V;
  4006. we.width = F * V,
  4007. we.height = z * V,
  4008. we.style.width = F + "px",
  4009. we.style.height = z + "px",
  4010. be.setTransform(e, 0, 0, e, (F * V - oe * e) / 2, (z * V - ce * e) / 2)
  4011. }
  4012. function fn(e) {
  4013. (on = e) ? Ae.classList.add("touch") : Ae.classList.remove("touch")
  4014. }
  4015. function dn(e) {
  4016. e.preventDefault(),
  4017. e.stopPropagation(),
  4018. fn(!0);
  4019. for (var t = 0; t < e.changedTouches.length; t++) {
  4020. var n = e.changedTouches[t];
  4021. n.identifier == re.id ? (re.id = -1,
  4022. bn()) : n.identifier == se.id && (se.id = -1,
  4023. R.buildIndex >= 0 && (O = 1,
  4024. vn()),
  4025. O = 0,
  4026. vn())
  4027. }
  4028. }
  4029. function pn() {
  4030. return R ? (-1 != se.id ? cn = Math.atan2(se.currentY - se.startY, se.currentX - se.startX) : R.lockDir || on || (cn = Math.atan2(ie - z / 2, ne - F / 2)),
  4031. s.fixTo(cn || 0, 2)) : 0
  4032. }
  4033. window.addEventListener("resize", s.checkTrusted(un)),
  4034. un(),
  4035. fn(!1),
  4036. window.setUsingTouch = fn,
  4037. we.addEventListener("touchmove", s.checkTrusted((function(e) {
  4038. e.preventDefault(),
  4039. e.stopPropagation(),
  4040. fn(!0);
  4041. for (var t = 0; t < e.changedTouches.length; t++) {
  4042. var n = e.changedTouches[t];
  4043. n.identifier == re.id ? (re.currentX = n.pageX,
  4044. re.currentY = n.pageY,
  4045. bn()) : n.identifier == se.id && (se.currentX = n.pageX,
  4046. se.currentY = n.pageY,
  4047. O = 1)
  4048. }
  4049. }
  4050. )), !1),
  4051. we.addEventListener("touchstart", s.checkTrusted((function(e) {
  4052. e.preventDefault(),
  4053. e.stopPropagation(),
  4054. fn(!0);
  4055. for (var t = 0; t < e.changedTouches.length; t++) {
  4056. var n = e.changedTouches[t];
  4057. n.pageX < document.body.scrollWidth / 2 && -1 == re.id ? (re.id = n.identifier,
  4058. re.startX = re.currentX = n.pageX,
  4059. re.startY = re.currentY = n.pageY,
  4060. bn()) : n.pageX > document.body.scrollWidth / 2 && -1 == se.id && (se.id = n.identifier,
  4061. se.startX = se.currentX = n.pageX,
  4062. se.startY = se.currentY = n.pageY,
  4063. R.buildIndex < 0 && (O = 1,
  4064. vn()))
  4065. }
  4066. }
  4067. )), !1),
  4068. we.addEventListener("touchend", s.checkTrusted(dn), !1),
  4069. we.addEventListener("touchcancel", s.checkTrusted(dn), !1),
  4070. we.addEventListener("touchleave", s.checkTrusted(dn), !1),
  4071. we.addEventListener("mousemove", (function(e) {
  4072. e.preventDefault(),
  4073. e.stopPropagation(),
  4074. fn(!1),
  4075. ne = e.clientX,
  4076. ie = e.clientY
  4077. }
  4078. ), !1),
  4079. we.addEventListener("mousedown", (function(e) {
  4080. fn(!1),
  4081. 1 != O && (O = 1,
  4082. vn())
  4083. }
  4084. ), !1),
  4085. we.addEventListener("mouseup", (function(e) {
  4086. fn(!1),
  4087. 0 != O && (O = 0,
  4088. vn())
  4089. }
  4090. ), !1);
  4091. var gn = {}
  4092. , mn = {
  4093. 87: [0, -1],
  4094. 38: [0, -1],
  4095. 83: [0, 1],
  4096. 40: [0, 1],
  4097. 65: [-1, 0],
  4098. 37: [-1, 0],
  4099. 68: [1, 0],
  4100. 39: [1, 0]
  4101. };
  4102. function yn() {
  4103. gn = {},
  4104. r.send("rmd")
  4105. }
  4106. function kn() {
  4107. return "block" != Ye.style.display && "block" != nn.style.display
  4108. }
  4109. function vn() {
  4110. R && R.alive && r.send("c", O, R.buildIndex >= 0 ? pn() : null)
  4111. }
  4112. window.addEventListener("keydown", s.checkTrusted((function(e) {
  4113. var t = e.which || e.keyCode || 0;
  4114. 27 == t ? Qt() : R && R.alive && kn() && (gn[t] || (gn[t] = 1,
  4115. 69 == t ? r.send("7", 1) : 67 == t ? Tach.setWaypoint("quick", R) : 88 == t ? (R.lockDir = R.lockDir ? 0 : 1,
  4116. r.send("7", 0)) : null != R.weapons[t - 49] ? Sn(R.weapons[t - 49], !0) : null != R.items[t - 49 - R.weapons.length] ? Sn(R.items[t - 49 - R.weapons.length]) : 81 == t ? Sn(R.items[0]) : 82 == t ? xn() : mn[t] ? bn() : 32 == t && (O = 1,
  4117. vn())))
  4118. }
  4119. ))),
  4120. window.addEventListener("keyup", s.checkTrusted((function(e) {
  4121. if (R && R.alive) {
  4122. var t = e.which || e.keyCode || 0;
  4123. 13 == t ? rn() : kn() && gn[t] && (gn[t] = 0,
  4124. mn[t] ? bn() : 32 == t && (O = 0,
  4125. vn()))
  4126. }
  4127. }
  4128. )));
  4129. var wn = void 0;
  4130. function bn() {
  4131. var e = function() {
  4132. var e = 0
  4133. , t = 0;
  4134. if (-1 != re.id)
  4135. e += re.currentX - re.startX,
  4136. t += re.currentY - re.startY;
  4137. else
  4138. for (var n in mn) {
  4139. var i = mn[n];
  4140. e += !!gn[n] * i[0],
  4141. t += !!gn[n] * i[1]
  4142. }
  4143. return 0 == e && 0 == t ? void 0 : s.fixTo(Math.atan2(t, e), 2)
  4144. }();
  4145. (null == wn || null == e || Math.abs(e - wn) > .3) && (r.send("33", e),
  4146. wn = e)
  4147. }
  4148. function xn() {
  4149. r.send("14", 1)
  4150. }
  4151. function Sn(e, t) {
  4152. r.send("5", e, t)
  4153. }
  4154. function Tn() {
  4155. I("moo_name", Le.value),
  4156. !le && r.connected && (le = !0,
  4157. x.stop("menu"),
  4158. dt("Loading..."),
  4159. r.send("sp", {
  4160. name: Le.value,
  4161. moofoll: H,
  4162. skin: ae
  4163. }))
  4164. try{
  4165. document.getElementById("ot-sdk-btn-floating").style.display = "none";
  4166. Tach.abort();
  4167. }catch(e){}
  4168. }
  4169. var In = !0;
  4170. function En(e) {
  4171. Pe.style.display = "none",
  4172. Me.style.display = "block",
  4173. he.style.display = "none",
  4174. gn = {},
  4175. j = e,
  4176. O = 0,
  4177. le = !0,
  4178. In && (In = !1,
  4179. N.length = 0)
  4180. }
  4181. function Mn(e, t, n, i) {
  4182. m.showText(e, t, 50, .18, 500, Math.abs(n), n >= 0 ? "#fff" : "#8ecc51")
  4183. }
  4184. var An = 99999;
  4185. function Pn() {
  4186. try{
  4187. document.getElementById("ot-sdk-btn-floating").style.display = "block";
  4188. }catch(e){}
  4189. le = !1;
  4190. Be.style.display = "none",
  4191. Qt(),
  4192. Tach.setWaypoint("death", R),
  4193. Pe.style.display = "none",
  4194. Ge.style.display = "block",
  4195. Ge.style.fontSize = "0px",
  4196. An = 0,
  4197. setTimeout((function() {
  4198. Me.style.display = "block",
  4199. he.style.display = "block",
  4200. Ge.style.display = "none"
  4201. }
  4202. ), o.deathFadeout),
  4203. gt()
  4204. }
  4205. function Bn(e) {
  4206. R && nt.removeAllItems(e)
  4207. }
  4208. function Cn(e) {
  4209. nt.disableBySid(e)
  4210. }
  4211. function On() {
  4212. Oe.innerText = R.points,
  4213. Re.innerText = R.food,
  4214. je.innerText = R.wood,
  4215. _e.innerText = R.stone,
  4216. Ue.innerText = R.kills
  4217. }
  4218. var Rn = {}
  4219. , jn = ["crown", "skull"]
  4220. , _n = [];
  4221. function Un(e, t) {
  4222. if (R.upgradePoints = e,
  4223. R.upgrAge = t,
  4224. e > 0) {
  4225. _n.length = 0,
  4226. s.removeAllChildren(Ve);
  4227. for (var n = 0; n < l.weapons.length; ++n)
  4228. l.weapons[n].age == t && (null == l.weapons[n].pre || R.weapons.indexOf(l.weapons[n].pre) >= 0) && (s.generateElement({
  4229. id: "upgradeItem" + n,
  4230. class: "actionBarItem",
  4231. onmouseout: function() {
  4232. Tt()
  4233. },
  4234. parent: Ve
  4235. }).style.backgroundImage = document.getElementById("actionBarItem" + n).style.backgroundImage,
  4236. _n.push(n));
  4237. for (n = 0; n < l.list.length; ++n)
  4238. if (l.list[n].age == t && (null == l.list[n].pre || R.items.indexOf(l.list[n].pre) >= 0)) {
  4239. var i = l.weapons.length + n;
  4240. s.generateElement({
  4241. id: "upgradeItem" + i,
  4242. class: "actionBarItem",
  4243. onmouseout: function() {
  4244. Tt()
  4245. },
  4246. parent: Ve
  4247. }).style.backgroundImage = document.getElementById("actionBarItem" + i).style.backgroundImage,
  4248. _n.push(i)
  4249. }
  4250. for (n = 0; n < _n.length; n++)
  4251. !function(e) {
  4252. var t = document.getElementById("upgradeItem" + e);
  4253. t.onmouseover = function() {
  4254. l.weapons[e] ? Tt(l.weapons[e], !0) : Tt(l.list[e - l.weapons.length])
  4255. }
  4256. ,
  4257. t.onclick = s.checkTrusted((function() {
  4258. r.send("6", e)
  4259. }
  4260. )),
  4261. s.hookTouchEvents(t)
  4262. }(_n[n]);
  4263. _n.length ? (Ve.style.display = "block",
  4264. qe.style.display = "block",
  4265. qe.innerHTML = "SELECT ITEMS (" + e + ")") : (Ve.style.display = "none",
  4266. qe.style.display = "none",
  4267. Tt())
  4268. } else
  4269. Ve.style.display = "none",
  4270. qe.style.display = "none",
  4271. Tt()
  4272. }
  4273. function Dn(e, t, n) {
  4274. null != e && (R.XP = e),
  4275. null != t && (R.maxXP = t),
  4276. null != n && (R.age = n),
  4277. n == o.maxAge ? (ze.innerHTML = "MAX AGE",
  4278. He.style.width = "100%") : (ze.innerHTML = "AGE " + R.age,
  4279. He.style.width = R.XP / R.maxXP * 100 + "%")
  4280. }
  4281. function Ln(e) {
  4282. s.removeAllChildren(De);
  4283. for (var t = 1, n = 0; n < e.length; n += 3)
  4284. !function(n) {
  4285. s.generateElement({
  4286. class: "leaderHolder",
  4287. parent: De,
  4288. children: [s.generateElement({
  4289. class: "leaderboardItem",
  4290. style: "color:" + (e[n] == j ? "#fff" : "rgba(255,255,255,0.6)"),
  4291. text: t + ". " + ("" != e[n + 1] ? e[n + 1] : "unknown")
  4292. }), s.generateElement({
  4293. class: "leaderScore",
  4294. text: s.kFormat(e[n + 2]) || "0"
  4295. })]
  4296. })
  4297. }(n),
  4298. t++
  4299. }
  4300. function Fn(e, t, n, i) {
  4301. be.save(),
  4302. be.setTransform(1, 0, 0, 1, 0, 0),
  4303. be.scale(V, V);
  4304. var r = 50;
  4305. be.beginPath(),
  4306. be.arc(e, t, r, 0, 2 * Math.PI, !1),
  4307. be.closePath(),
  4308. be.fillStyle = "rgba(255, 255, 255, 0.3)",
  4309. be.fill(),
  4310. r = 50;
  4311. var s = n - e
  4312. , a = i - t
  4313. , o = Math.sqrt(Math.pow(s, 2) + Math.pow(a, 2))
  4314. , c = o > r ? o / r : 1;
  4315. s /= c,
  4316. a /= c,
  4317. be.beginPath(),
  4318. be.arc(e + s, t + a, .5 * r, 0, 2 * Math.PI, !1),
  4319. be.closePath(),
  4320. be.fillStyle = "white",
  4321. be.fill(),
  4322. be.restore()
  4323. }
  4324. function zn(e, t, n) {
  4325. for (var i = 0; i < G.length; ++i)
  4326. (_ = G[i]).active && _.layer == e && (_.update(P),
  4327. _.active && ki(_.x - t, _.y - n, _.scale) && (be.save(),
  4328. be.translate(_.x - t, _.y - n),
  4329. be.rotate(_.dir),
  4330. Vn(0, 0, _, be, 1),
  4331. be.restore()))
  4332. }
  4333. var Hn = {};
  4334. function Vn(e, t, n, i, r) {
  4335. if (n.src) {
  4336. var s = l.projectiles[n.indx].src
  4337. , a = Hn[s];
  4338. a || ((a = new Image).onload = function() {
  4339. this.isLoaded = !0
  4340. }
  4341. ,
  4342. a.src = ".././img/weapons/" + s + ".png",
  4343. Hn[s] = a),
  4344. a.isLoaded && i.drawImage(a, e - n.scale / 2, t - n.scale / 2, n.scale, n.scale)
  4345. } else
  4346. 1 == n.indx && (i.fillStyle = "#939393",
  4347. si(e, t, n.scale, i))
  4348. }
  4349. function qn(e, t, n, i) {
  4350. var r = o.riverWidth + i
  4351. , s = o.mapScale / 2 - t - r / 2;
  4352. s < ce && s + r > 0 && n.fillRect(0, s, oe, r)
  4353. }
  4354. function Yn(e, t, n) {
  4355. for (var i, r, s, a = 0; a < N.length; ++a)
  4356. (_ = N[a]).active && (r = _.x + _.xWiggle - t,
  4357. s = _.y + _.yWiggle - n,
  4358. 0 == e && _.update(P),
  4359. _.layer == e && ki(r, s, _.scale + (_.blocker || 0)) && (be.globalAlpha = _.hideFromEnemy ? .6 : 1,
  4360. _.isItem ? (i = ri(_),
  4361. be.save(),
  4362. be.translate(r, s),
  4363. be.rotate(_.dir),
  4364. be.drawImage(i, -i.width / 2, -i.height / 2),
  4365. _.blocker && (be.strokeStyle = "#db6e6e",
  4366. be.globalAlpha = .3,
  4367. be.lineWidth = 6,
  4368. si(0, 0, _.blocker, be, !1, !0)),
  4369. be.restore()) : (i = ni(_),
  4370. be.drawImage(i, r - i.width / 2, s - i.height / 2))))
  4371. }
  4372. function Wn(e, t, n) {
  4373. (_ = Ii(e)) && _.startAnim(t, n)
  4374. }
  4375. function Xn(e, t, n) {
  4376. be.globalAlpha = 1;
  4377. for (var i = 0; i < W.length; ++i)
  4378. (_ = W[i]).zIndex == n && (_.animate(P),
  4379. _.visible && (_.skinRot += .002 * P,
  4380. L = (_ == R ? pn() : _.dir) + _.dirPlus,
  4381. be.save(),
  4382. be.translate(_.x - e, _.y - t),
  4383. be.rotate(L),
  4384. Nn(_, be),
  4385. be.restore()))
  4386. }
  4387. function Nn(e, t) {
  4388. (t = t || be).lineWidth = 5.5,
  4389. t.lineJoin = "miter";
  4390. var n = Math.PI / 4 * (l.weapons[e.weaponIndex].armS || 1)
  4391. , i = e.buildIndex < 0 && l.weapons[e.weaponIndex].hndS || 1
  4392. , r = e.buildIndex < 0 && l.weapons[e.weaponIndex].hndD || 1;
  4393. if (e.tailIndex > 0 && function(e, t, n) {
  4394. if (!(Gn = Qn[e])) {
  4395. var i = new Image;
  4396. i.onload = function() {
  4397. this.isLoaded = !0,
  4398. this.onload = null
  4399. }
  4400. ,
  4401. i.src = ".././img/accessories/access_" + e + ".png",
  4402. Qn[e] = i,
  4403. Gn = i
  4404. }
  4405. var r = $n[e];
  4406. if (!r) {
  4407. for (var s = 0; s < tt.length; ++s)
  4408. if (tt[s].id == e) {
  4409. r = tt[s];
  4410. break
  4411. }
  4412. $n[e] = r
  4413. }
  4414. Gn.isLoaded && (t.save(),
  4415. t.translate(-20 - (r.xOff || 0), 0),
  4416. r.spin && t.rotate(n.skinRot),
  4417. t.drawImage(Gn, -r.scale / 2, -r.scale / 2, r.scale, r.scale),
  4418. t.restore())
  4419. }(e.tailIndex, t, e),
  4420. e.buildIndex < 0 && !l.weapons[e.weaponIndex].aboveHand && (ei(l.weapons[e.weaponIndex], o.weaponVariants[e.weaponVariant].src, e.scale, 0, t),
  4421. null == l.weapons[e.weaponIndex].projectile || l.weapons[e.weaponIndex].hideProjectile || Vn(e.scale, 0, l.projectiles[l.weapons[e.weaponIndex].projectile], be)),
  4422. t.fillStyle = o.skinColors[e.skinColor],
  4423. si(e.scale * Math.cos(n), e.scale * Math.sin(n), 14),
  4424. si(e.scale * r * Math.cos(-n * i), e.scale * r * Math.sin(-n * i), 14),
  4425. e.buildIndex < 0 && l.weapons[e.weaponIndex].aboveHand && (ei(l.weapons[e.weaponIndex], o.weaponVariants[e.weaponVariant].src, e.scale, 0, t),
  4426. null == l.weapons[e.weaponIndex].projectile || l.weapons[e.weaponIndex].hideProjectile || Vn(e.scale, 0, l.projectiles[l.weapons[e.weaponIndex].projectile], be)),
  4427. e.buildIndex >= 0) {
  4428. var s = ri(l.list[e.buildIndex]);
  4429. t.drawImage(s, e.scale - l.list[e.buildIndex].holdOffset, -s.width / 2)
  4430. }
  4431. si(0, 0, e.scale, t),
  4432. e.skinIndex > 0 && (t.rotate(Math.PI / 2),
  4433. function e(t, n, i, r) {
  4434. if (!(Gn = Jn[t])) {
  4435. var s = new Image;
  4436. s.onload = function() {
  4437. this.isLoaded = !0,
  4438. this.onload = null
  4439. }
  4440. ,
  4441. s.src = ".././img/hats/hat_" + t + ".png",
  4442. Jn[t] = s,
  4443. Gn = s
  4444. }
  4445. var a = i || Kn[t];
  4446. if (!a) {
  4447. for (var o = 0; o < et.length; ++o)
  4448. if (et[o].id == t) {
  4449. a = et[o];
  4450. break
  4451. }
  4452. Kn[t] = a
  4453. }
  4454. Gn.isLoaded && n.drawImage(Gn, -a.scale / 2, -a.scale / 2, a.scale, a.scale),
  4455. !i && a.topSprite && (n.save(),
  4456. n.rotate(r.skinRot),
  4457. e(t + "_top", n, a, r),
  4458. n.restore())
  4459. }(e.skinIndex, t, null, e))
  4460. }
  4461. var Gn, Jn = {}, Kn = {}, Qn = {}, $n = {}, Zn = {};
  4462. function ei(e, t, n, i, r) {
  4463. var s = e.src + (t || "")
  4464. , a = Zn[s];
  4465. a || ((a = new Image).onload = function() {
  4466. this.isLoaded = !0
  4467. }
  4468. ,
  4469. a.src = ".././img/weapons/" + s + ".png",
  4470. Zn[s] = a),
  4471. a.isLoaded && r.drawImage(a, n + e.xOff - e.length / 2, i + e.yOff - e.width / 2, e.length, e.width)
  4472. }
  4473. var ti = {};
  4474. function ni(e) {
  4475. var t = e.y >= o.mapScale - o.snowBiomeTop ? 2 : e.y <= o.snowBiomeTop ? 1 : 0
  4476. , n = e.type + "_" + e.scale + "_" + t
  4477. , i = ti[n];
  4478. if (!i) {
  4479. var r = document.createElement("canvas");
  4480. r.width = r.height = 2.1 * e.scale + 5.5;
  4481. var a = r.getContext("2d");
  4482. if (a.translate(r.width / 2, r.height / 2),
  4483. a.rotate(s.randFloat(0, Math.PI)),
  4484. a.strokeStyle = it,
  4485. a.lineWidth = 5.5,
  4486. 0 == e.type)
  4487. for (var c, l = 0; l < 2; ++l)
  4488. ai(a, 7, c = _.scale * (l ? .5 : 1), .7 * c),
  4489. a.fillStyle = t ? l ? "#fff" : "#e3f1f4" : l ? "#b4db62" : "#9ebf57",
  4490. a.fill(),
  4491. l || a.stroke();
  4492. else if (1 == e.type)
  4493. if (2 == t)
  4494. a.fillStyle = "#606060",
  4495. ai(a, 6, .3 * e.scale, .71 * e.scale),
  4496. a.fill(),
  4497. a.stroke(),
  4498. a.fillStyle = "#89a54c",
  4499. si(0, 0, .55 * e.scale, a),
  4500. a.fillStyle = "#a5c65b",
  4501. si(0, 0, .3 * e.scale, a, !0);
  4502. else {
  4503. var h;
  4504. !function(e, t, n, i) {
  4505. var r, a = Math.PI / 2 * 3, o = Math.PI / 6;
  4506. e.beginPath(),
  4507. e.moveTo(0, -i);
  4508. for (var c = 0; c < 6; c++)
  4509. r = s.randInt(n + .9, 1.2 * n),
  4510. e.quadraticCurveTo(Math.cos(a + o) * r, Math.sin(a + o) * r, Math.cos(a + 2 * o) * i, Math.sin(a + 2 * o) * i),
  4511. a += 2 * o;
  4512. e.lineTo(0, -i),
  4513. e.closePath()
  4514. }(a, 0, _.scale, .7 * _.scale),
  4515. a.fillStyle = t ? "#e3f1f4" : "#89a54c",
  4516. a.fill(),
  4517. a.stroke(),
  4518. a.fillStyle = t ? "#6a64af" : "#c15555";
  4519. var u = T / 4;
  4520. for (l = 0; l < 4; ++l)
  4521. si((h = s.randInt(_.scale / 3.5, _.scale / 2.3)) * Math.cos(u * l), h * Math.sin(u * l), s.randInt(10, 12), a)
  4522. }
  4523. else
  4524. 2 != e.type && 3 != e.type || (a.fillStyle = 2 == e.type ? 2 == t ? "#938d77" : "#939393" : "#e0c655",
  4525. ai(a, 3, e.scale, e.scale),
  4526. a.fill(),
  4527. a.stroke(),
  4528. a.fillStyle = 2 == e.type ? 2 == t ? "#b2ab90" : "#bcbcbc" : "#ebdca3",
  4529. ai(a, 3, .55 * e.scale, .65 * e.scale),
  4530. a.fill());
  4531. i = r,
  4532. ti[n] = i
  4533. }
  4534. return i
  4535. }
  4536. var ii = [];
  4537. function ri(e, t) {
  4538. var n = ii[e.id];
  4539. if (!n || t) {
  4540. var i = document.createElement("canvas");
  4541. i.width = i.height = 2.5 * e.scale + 5.5 + (l.list[e.id].spritePadding || 0);
  4542. var r = i.getContext("2d");
  4543. if (r.translate(i.width / 2, i.height / 2),
  4544. r.rotate(t ? 0 : Math.PI / 2),
  4545. r.strokeStyle = it,
  4546. r.lineWidth = 5.5 * (t ? i.width / 81 : 1),
  4547. "apple" == e.name) {
  4548. r.fillStyle = "#c15555",
  4549. si(0, 0, e.scale, r),
  4550. r.fillStyle = "#89a54c";
  4551. var a = -Math.PI / 2;
  4552. !function(e, t, n, i, r) {
  4553. var s = e + 25 * Math.cos(i)
  4554. , a = t + 25 * Math.sin(i);
  4555. r.moveTo(e, t),
  4556. r.beginPath(),
  4557. r.quadraticCurveTo((e + s) / 2 + 10 * Math.cos(i + Math.PI / 2), (t + a) / 2 + 10 * Math.sin(i + Math.PI / 2), s, a),
  4558. r.quadraticCurveTo((e + s) / 2 - 10 * Math.cos(i + Math.PI / 2), (t + a) / 2 - 10 * Math.sin(i + Math.PI / 2), e, t),
  4559. r.closePath(),
  4560. r.fill(),
  4561. r.stroke()
  4562. }(e.scale * Math.cos(a), e.scale * Math.sin(a), 0, a + Math.PI / 2, r)
  4563. } else if ("cookie" == e.name) {
  4564. r.fillStyle = "#cca861",
  4565. si(0, 0, e.scale, r),
  4566. r.fillStyle = "#937c4b";
  4567. for (var o = T / (h = 4), c = 0; c < h; ++c)
  4568. si((u = s.randInt(e.scale / 2.5, e.scale / 1.7)) * Math.cos(o * c), u * Math.sin(o * c), s.randInt(4, 5), r, !0)
  4569. } else if ("cheese" == e.name) {
  4570. var h, u;
  4571. for (r.fillStyle = "#f4f3ac",
  4572. si(0, 0, e.scale, r),
  4573. r.fillStyle = "#c3c28b",
  4574. o = T / (h = 4),
  4575. c = 0; c < h; ++c)
  4576. si((u = s.randInt(e.scale / 2.5, e.scale / 1.7)) * Math.cos(o * c), u * Math.sin(o * c), s.randInt(4, 5), r, !0)
  4577. } else if ("wood wall" == e.name || "stone wall" == e.name || "castle wall" == e.name) {
  4578. r.fillStyle = "castle wall" == e.name ? "#83898e" : "wood wall" == e.name ? "#a5974c" : "#939393";
  4579. var f = "castle wall" == e.name ? 4 : 3;
  4580. ai(r, f, 1.1 * e.scale, 1.1 * e.scale),
  4581. r.fill(),
  4582. r.stroke(),
  4583. r.fillStyle = "castle wall" == e.name ? "#9da4aa" : "wood wall" == e.name ? "#c9b758" : "#bcbcbc",
  4584. ai(r, f, .65 * e.scale, .65 * e.scale),
  4585. r.fill()
  4586. } else if ("spikes" == e.name || "greater spikes" == e.name || "poison spikes" == e.name || "spinning spikes" == e.name) {
  4587. r.fillStyle = "poison spikes" == e.name ? "#7b935d" : "#939393";
  4588. var d = .6 * e.scale;
  4589. ai(r, "spikes" == e.name ? 5 : 6, e.scale, d),
  4590. r.fill(),
  4591. r.stroke(),
  4592. r.fillStyle = "#a5974c",
  4593. si(0, 0, d, r),
  4594. r.fillStyle = "#c9b758",
  4595. si(0, 0, d / 2, r, !0)
  4596. } else if ("windmill" == e.name || "faster windmill" == e.name || "power mill" == e.name)
  4597. r.fillStyle = "#a5974c",
  4598. si(0, 0, e.scale, r),
  4599. r.fillStyle = "#c9b758",
  4600. ci(0, 0, 1.5 * e.scale, 29, 4, r),
  4601. r.fillStyle = "#a5974c",
  4602. si(0, 0, .5 * e.scale, r);
  4603. else if ("mine" == e.name)
  4604. r.fillStyle = "#939393",
  4605. ai(r, 3, e.scale, e.scale),
  4606. r.fill(),
  4607. r.stroke(),
  4608. r.fillStyle = "#bcbcbc",
  4609. ai(r, 3, .55 * e.scale, .65 * e.scale),
  4610. r.fill();
  4611. else if ("sapling" == e.name)
  4612. for (c = 0; c < 2; ++c)
  4613. ai(r, 7, d = e.scale * (c ? .5 : 1), .7 * d),
  4614. r.fillStyle = c ? "#b4db62" : "#9ebf57",
  4615. r.fill(),
  4616. c || r.stroke();
  4617. else if ("pit trap" == e.name)
  4618. r.fillStyle = "#a5974c",
  4619. ai(r, 3, 1.1 * e.scale, 1.1 * e.scale),
  4620. r.fill(),
  4621. r.stroke(),
  4622. r.fillStyle = it,
  4623. ai(r, 3, .65 * e.scale, .65 * e.scale),
  4624. r.fill();
  4625. else if ("boost pad" == e.name)
  4626. r.fillStyle = "#7e7f82",
  4627. oi(0, 0, 2 * e.scale, 2 * e.scale, r),
  4628. r.fill(),
  4629. r.stroke(),
  4630. r.fillStyle = "#dbd97d",
  4631. function(e, t) {
  4632. t = t || be;
  4633. var n = e * (Math.sqrt(3) / 2);
  4634. t.beginPath(),
  4635. t.moveTo(0, -n / 2),
  4636. t.lineTo(-e / 2, n / 2),
  4637. t.lineTo(e / 2, n / 2),
  4638. t.lineTo(0, -n / 2),
  4639. t.fill(),
  4640. t.closePath()
  4641. }(1 * e.scale, r);
  4642. else if ("turret" == e.name)
  4643. r.fillStyle = "#a5974c",
  4644. si(0, 0, e.scale, r),
  4645. r.fill(),
  4646. r.stroke(),
  4647. r.fillStyle = "#939393",
  4648. oi(0, -25, .9 * e.scale, 50, r),
  4649. si(0, 0, .6 * e.scale, r),
  4650. r.fill(),
  4651. r.stroke();
  4652. else if ("platform" == e.name) {
  4653. r.fillStyle = "#cebd5f";
  4654. var p = 2 * e.scale
  4655. , g = p / 4
  4656. , m = -e.scale / 2;
  4657. for (c = 0; c < 4; ++c)
  4658. oi(m - g / 2, 0, g, 2 * e.scale, r),
  4659. r.fill(),
  4660. r.stroke(),
  4661. m += p / 4
  4662. } else
  4663. "healing pad" == e.name ? (r.fillStyle = "#7e7f82",
  4664. oi(0, 0, 2 * e.scale, 2 * e.scale, r),
  4665. r.fill(),
  4666. r.stroke(),
  4667. r.fillStyle = "#db6e6e",
  4668. ci(0, 0, .65 * e.scale, 20, 4, r, !0)) : "spawn pad" == e.name ? (r.fillStyle = "#7e7f82",
  4669. oi(0, 0, 2 * e.scale, 2 * e.scale, r),
  4670. r.fill(),
  4671. r.stroke(),
  4672. r.fillStyle = "#71aad6",
  4673. si(0, 0, .6 * e.scale, r)) : "blocker" == e.name ? (r.fillStyle = "#7e7f82",
  4674. si(0, 0, e.scale, r),
  4675. r.fill(),
  4676. r.stroke(),
  4677. r.rotate(Math.PI / 4),
  4678. r.fillStyle = "#db6e6e",
  4679. ci(0, 0, .65 * e.scale, 20, 4, r, !0)) : "teleporter" == e.name && (r.fillStyle = "#7e7f82",
  4680. si(0, 0, e.scale, r),
  4681. r.fill(),
  4682. r.stroke(),
  4683. r.rotate(Math.PI / 4),
  4684. r.fillStyle = "#d76edb",
  4685. si(0, 0, .5 * e.scale, r, !0));
  4686. n = i,
  4687. t || (ii[e.id] = n)
  4688. }
  4689. return n
  4690. }
  4691. function si(e, t, n, i, r, s) {
  4692. (i = i || be).beginPath(),
  4693. i.arc(e, t, n, 0, 2 * Math.PI),
  4694. s || i.fill(),
  4695. r || i.stroke()
  4696. }
  4697. function ai(e, t, n, i) {
  4698. var r, s, a = Math.PI / 2 * 3, o = Math.PI / t;
  4699. e.beginPath(),
  4700. e.moveTo(0, -n);
  4701. for (var c = 0; c < t; c++)
  4702. r = Math.cos(a) * n,
  4703. s = Math.sin(a) * n,
  4704. e.lineTo(r, s),
  4705. a += o,
  4706. r = Math.cos(a) * i,
  4707. s = Math.sin(a) * i,
  4708. e.lineTo(r, s),
  4709. a += o;
  4710. e.lineTo(0, -n),
  4711. e.closePath()
  4712. }
  4713. function oi(e, t, n, i, r, s) {
  4714. r.fillRect(e - n / 2, t - i / 2, n, i),
  4715. s || r.strokeRect(e - n / 2, t - i / 2, n, i)
  4716. }
  4717. function ci(e, t, n, i, r, s, a) {
  4718. s.save(),
  4719. s.translate(e, t),
  4720. r = Math.ceil(r / 2);
  4721. for (var o = 0; o < r; o++)
  4722. oi(0, 0, 2 * n, i, s, a),
  4723. s.rotate(Math.PI / r);
  4724. s.restore()
  4725. }
  4726. function li(e) {
  4727. for (var t = 0; t < e.length; )
  4728. nt.add(e[t], e[t + 1], e[t + 2], e[t + 3], e[t + 4], e[t + 5], l.list[e[t + 6]], !0, e[t + 7] >= 0 ? {
  4729. sid: e[t + 7]
  4730. } : null),
  4731. t += 8
  4732. }
  4733. function hi(e, t) {
  4734. (_ = Mi(t)) && (_.xWiggle += o.gatherWiggle * Math.cos(e),
  4735. _.yWiggle += o.gatherWiggle * Math.sin(e))
  4736. }
  4737. function ui(e, t) {
  4738. (_ = Mi(e)) && (_.dir = t,
  4739. _.xWiggle += o.gatherWiggle * Math.cos(t + Math.PI),
  4740. _.yWiggle += o.gatherWiggle * Math.sin(t + Math.PI))
  4741. }
  4742. function fi(e, t, n, i, r, s, a, o) {
  4743. lt && (J.addProjectile(e, t, n, i, r, s, null, null, a).sid = o)
  4744. }
  4745. function di(e, t) {
  4746. for (var n = 0; n < G.length; ++n)
  4747. G[n].sid == e && (G[n].range = t)
  4748. }
  4749. function pi(e) {
  4750. (_ = Ei(e)) && _.startAnim()
  4751. }
  4752. function gi(e) {
  4753. for (var t = 0; t < Y.length; ++t)
  4754. Y[t].forcePos = !Y[t].visible,
  4755. Y[t].visible = !1;
  4756. if (e) {
  4757. var n = Date.now();
  4758. for (t = 0; t < e.length; )
  4759. (_ = Ei(e[t])) ? (_.index = e[t + 1],
  4760. _.t1 = void 0 === _.t2 ? n : _.t2,
  4761. _.t2 = n,
  4762. _.x1 = _.x,
  4763. _.y1 = _.y,
  4764. _.x2 = e[t + 2],
  4765. _.y2 = e[t + 3],
  4766. _.d1 = void 0 === _.d2 ? e[t + 4] : _.d2,
  4767. _.d2 = e[t + 4],
  4768. _.health = e[t + 5],
  4769. _.dt = 0,
  4770. _.visible = !0) : ((_ = Z.spawn(e[t + 2], e[t + 3], e[t + 4], e[t + 1])).x2 = _.x,
  4771. _.y2 = _.y,
  4772. _.d2 = _.dir,
  4773. _.health = e[t + 5],
  4774. Z.aiTypes[e[t + 1]].name || (_.name = o.cowNames[e[t + 6]]),
  4775. _.forcePos = !0,
  4776. _.sid = e[t],
  4777. _.visible = !0),
  4778. t += 7
  4779. }
  4780. Tach.updateAnimals(Y);
  4781. }
  4782. var mi = {};
  4783. function yi(e, t) {
  4784. var n = e.index
  4785. , i = mi[n];
  4786. if (!i) {
  4787. var r = new Image;
  4788. r.onload = function() {
  4789. this.isLoaded = !0,
  4790. this.onload = null
  4791. }
  4792. ,
  4793. r.src = ".././img/animals/" + e.src + ".png",
  4794. i = r,
  4795. mi[n] = i
  4796. }
  4797. if (i.isLoaded) {
  4798. var s = 1.2 * e.scale * (e.spriteMlt || 1);
  4799. t.drawImage(i, -s, -s, 2 * s, 2 * s)
  4800. }
  4801. }
  4802. function ki(e, t, n) {
  4803. return e + n >= 0 && e - n <= oe && t + n >= 0 && t - n <= ce
  4804. }
  4805. function vi(e, t) {
  4806. var n = function(e) {
  4807. for (var t = 0; t < W.length; ++t)
  4808. if (W[t].id == e)
  4809. return W[t];
  4810. return null
  4811. }(e[0]);
  4812. n || (n = new u(e[0],e[1],o,s,J,nt,W,Y,l,et,tt),
  4813. W.push(n)),
  4814. n.spawn(t ? H : null),
  4815. n.visible = !1,
  4816. n.x2 = void 0,
  4817. n.y2 = void 0,
  4818. n.setData(e),
  4819. t && (U = (R = n).x,
  4820. D = R.y,
  4821. $t(),
  4822. On(),
  4823. Dn(),
  4824. Un(0),
  4825. Be.style.display = "block")
  4826. }
  4827. function wi(e) {
  4828. for (var t = 0; t < W.length; t++)
  4829. if (W[t].id == e) {
  4830. W.splice(t, 1);
  4831. break
  4832. }
  4833. }
  4834. function bi(e, t) {
  4835. R && (R.itemCounts[e] = t)
  4836. }
  4837. function xi(e, t, n) {
  4838. R && (R[e] = t,
  4839. n && On())
  4840. }
  4841. function Si(e, t) {
  4842. (_ = Ii(e)) && (_.health = t)
  4843. }
  4844. Pathfinder.setBuildings(N);
  4845. function Ti(e) {
  4846. for (var t = Date.now(), n = 0; n < W.length; ++n)
  4847. W[n].forcePos = !W[n].visible,
  4848. W[n].visible = !1;
  4849. for (n = 0; n < e.length; )
  4850. (_ = Ii(e[n])) && (_.t1 = void 0 === _.t2 ? t : _.t2,
  4851. _.t2 = t,
  4852. _.x1 = _.x,
  4853. _.y1 = _.y,
  4854. _.x2 = e[n + 1],
  4855. _.y2 = e[n + 2],
  4856. _.d1 = void 0 === _.d2 ? e[n + 3] : _.d2,
  4857. _.d2 = e[n + 3],
  4858. _.dt = 0,
  4859. _.buildIndex = e[n + 4],
  4860. _.weaponIndex = e[n + 5],
  4861. _.weaponVariant = e[n + 6],
  4862. _.team = e[n + 7],
  4863. _.isLeader = e[n + 8],
  4864. _.skinIndex = e[n + 9],
  4865. _.tailIndex = e[n + 10],
  4866. _.iconIndex = e[n + 11],
  4867. _.zIndex = e[n + 12],
  4868. _.visible = !0),
  4869. n += 13;
  4870. Pathfinder.setPos(R.x2, R.y2);
  4871. Tach.setSend(r.send.bind(r));
  4872. Tach.setSelf(R);
  4873. Tach.updatePlayers(W);
  4874. }
  4875. function Ii(e) {
  4876. for (var t = 0; t < W.length; ++t)
  4877. if (W[t].sid == e)
  4878. return W[t];
  4879. return null
  4880. }
  4881. function Ei(e) {
  4882. for (var t = 0; t < Y.length; ++t)
  4883. if (Y[t].sid == e)
  4884. return Y[t];
  4885. return null
  4886. }
  4887. function Mi(e) {
  4888. for (var t = 0; t < N.length; ++t)
  4889. if (N[t].sid == e)
  4890. return N[t];
  4891. return null
  4892. }
  4893. var Ai = -1;
  4894. function Pi() {
  4895. var e = Date.now() - Ai;
  4896. window.pingTime = e,
  4897. Ie.innerText = "Ping: " + e + " ms"
  4898. }
  4899. function Bi() {
  4900. Ai = Date.now(),
  4901. r.send("pp")
  4902. }
  4903. function Ci(e) {
  4904. if (!(e < 0)) {
  4905. var t = Math.floor(e / 60)
  4906. , n = e % 60;
  4907. n = ("0" + n).slice(-2),
  4908. Ee.innerText = "Server restarting in " + t + ":" + n,
  4909. Ee.hidden = !1
  4910. }
  4911. }
  4912. function Oi(e) {
  4913. window.open(e, "_blank")
  4914. }
  4915. window.requestAnimFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(e) {
  4916. window.setTimeout(e, 1e3 / 60)
  4917. }
  4918. ,
  4919. function() {
  4920. var e = o.mapScale / 2;
  4921. nt.add(0, e, e + 200, 0, o.treeScales[3], 0),
  4922. nt.add(1, e, e - 480, 0, o.treeScales[3], 0),
  4923. nt.add(2, e + 300, e + 450, 0, o.treeScales[3], 0),
  4924. nt.add(3, e - 950, e - 130, 0, o.treeScales[2], 0),
  4925. nt.add(4, e - 750, e - 400, 0, o.treeScales[3], 0),
  4926. nt.add(5, e - 700, e + 400, 0, o.treeScales[2], 0),
  4927. nt.add(6, e + 800, e - 200, 0, o.treeScales[3], 0),
  4928. nt.add(7, e - 260, e + 340, 0, o.bushScales[3], 1),
  4929. nt.add(8, e + 760, e + 310, 0, o.bushScales[3], 1),
  4930. nt.add(9, e - 800, e + 100, 0, o.bushScales[3], 1),
  4931. nt.add(10, e - 800, e + 300, 0, l.list[4].scale, l.list[4].id, l.list[10]),
  4932. nt.add(11, e + 650, e - 390, 0, l.list[4].scale, l.list[4].id, l.list[10]),
  4933. nt.add(12, e - 400, e - 450, 0, o.rockScales[2], 2)
  4934. }(),
  4935. function e() {
  4936. B = Date.now(),
  4937. P = B - q,
  4938. q = B,
  4939. function() {
  4940. if (R && (!C || B - C >= 1e3 / o.clientSendRate) && (C = B,
  4941. r.send("2", pn())),
  4942. An < 120 && (An += .1 * P,
  4943. Ge.style.fontSize = Math.min(Math.round(An), 120) + "px"),
  4944. R) {
  4945. var e = s.getDistance(U, D, R.x, R.y)
  4946. , t = s.getDirection(R.x, R.y, U, D)
  4947. , n = Math.min(.01 * e * P, e);
  4948. e > .05 ? (U += n * Math.cos(t),
  4949. D += n * Math.sin(t)) : (U = R.x,
  4950. D = R.y)
  4951. } else
  4952. U = o.mapScale / 2,
  4953. D = o.mapScale / 2;
  4954. for (var i = B - 1e3 / o.serverUpdateRate, a = 0; a < W.length + Y.length; ++a)
  4955. if ((_ = W[a] || Y[a - W.length]) && _.visible)
  4956. if (_.forcePos)
  4957. _.x = _.x2,
  4958. _.y = _.y2,
  4959. _.dir = _.d2;
  4960. else {
  4961. var c = _.t2 - _.t1
  4962. , l = (i - _.t1) / c;
  4963. _.dt += P;
  4964. var h = Math.min(1.7, _.dt / 170)
  4965. , u = _.x2 - _.x1;
  4966. _.x = _.x1 + u * h,
  4967. u = _.y2 - _.y1,
  4968. _.y = _.y1 + u * h,
  4969. _.dir = Math.lerpAngle(_.d2, _.d1, Math.min(1.2, l))
  4970. }
  4971. var f = U - oe / 2
  4972. , d = D - ce / 2;
  4973. o.snowBiomeTop - d <= 0 && o.mapScale - o.snowBiomeTop - d >= ce ? (be.fillStyle = "#b6db66",
  4974. be.fillRect(0, 0, oe, ce)) : o.mapScale - o.snowBiomeTop - d <= 0 ? (be.fillStyle = "#dbc666",
  4975. be.fillRect(0, 0, oe, ce)) : o.snowBiomeTop - d >= ce ? (be.fillStyle = "#fff",
  4976. be.fillRect(0, 0, oe, ce)) : o.snowBiomeTop - d >= 0 ? (be.fillStyle = "#fff",
  4977. be.fillRect(0, 0, oe, o.snowBiomeTop - d),
  4978. be.fillStyle = "#b6db66",
  4979. be.fillRect(0, o.snowBiomeTop - d, oe, ce - (o.snowBiomeTop - d))) : (be.fillStyle = "#b6db66",
  4980. be.fillRect(0, 0, oe, o.mapScale - o.snowBiomeTop - d),
  4981. be.fillStyle = "#dbc666",
  4982. be.fillRect(0, o.mapScale - o.snowBiomeTop - d, oe, ce - (o.mapScale - o.snowBiomeTop - d))),
  4983. In || ((ee += te * o.waveSpeed * P) >= o.waveMax ? (ee = o.waveMax,
  4984. te = -1) : ee <= 1 && (ee = te = 1),
  4985. be.globalAlpha = 1,
  4986. be.fillStyle = "#dbc666",
  4987. qn(f, d, be, o.riverPadding),
  4988. be.fillStyle = "#91b2db",
  4989. qn(f, d, be, 250 * (ee - 1))),
  4990. be.lineWidth = 4,
  4991. be.strokeStyle = "#000",
  4992. be.globalAlpha = .06,
  4993. be.beginPath();
  4994. for (var p = (14400-f) % 1440; p < oe; p += 1440){
  4995. p > 0 && (be.moveTo(p, 0),
  4996. be.lineTo(p, ce));
  4997. }
  4998. for (var g = (14400-d) % 1440; g < ce; g += 1440){
  4999. g > 0 && (be.moveTo(0, g),
  5000. be.lineTo(oe, g));
  5001. }
  5002. be.stroke();
  5003. for (be.globalAlpha = 1,
  5004. be.strokeStyle = it,
  5005. Yn(-1, f, d),
  5006. be.globalAlpha = 1,
  5007. be.lineWidth = 5.5,
  5008. zn(0, f, d),
  5009. Xn(f, d, 0),
  5010. be.globalAlpha = 1,
  5011. a = 0; a < Y.length; ++a)
  5012. (_ = Y[a]).active && _.visible && (_.animate(P),
  5013. be.save(),
  5014. be.translate(_.x - f, _.y - d),
  5015. be.rotate(_.dir + _.dirPlus - Math.PI / 2),
  5016. yi(_, be),
  5017. be.restore());
  5018. if (Yn(0, f, d),
  5019. zn(1, f, d),
  5020. Yn(1, f, d),
  5021. Xn(f, d, 1),
  5022. Yn(2, f, d),
  5023. Yn(3, f, d),
  5024. be.fillStyle = "#000",
  5025. be.globalAlpha = .09,
  5026. f <= 0 && be.fillRect(0, 0, -f, ce),
  5027. o.mapScale - f <= oe) {
  5028. var y = Math.max(0, -d);
  5029. be.fillRect(o.mapScale - f, y, oe - (o.mapScale - f), ce - y)
  5030. }
  5031. if (d <= 0 && be.fillRect(-f, 0, oe + f, -d),
  5032. o.mapScale - d <= ce) {
  5033. var k = Math.max(0, -f)
  5034. , v = 0;
  5035. o.mapScale - f <= oe && (v = oe - (o.mapScale - f)),
  5036. be.fillRect(k, o.mapScale - d, oe - k - v, ce - (o.mapScale - d))
  5037. }
  5038. if(R){
  5039. be.globalAlpha = 0.6;
  5040. be.save();
  5041. be.translate(-f, -d);
  5042. Pathfinder.drawPath(be, "#0000FF", R, "#00FF00");
  5043. Tach.drawWaypoints(be, R.skinRot);
  5044. be.restore();
  5045. }
  5046. for (be.globalAlpha = 1,
  5047. be.fillStyle = "rgba(0, 0, 70, 0.35)",
  5048. be.fillRect(0, 0, oe, ce),
  5049. be.strokeStyle = rt,
  5050. a = 0; a < W.length + Y.length; ++a)
  5051. if ((_ = W[a] || Y[a - W.length]).visible && (10 != _.skinIndex || _ == R || _.team && _.team == R.team)) {
  5052. var w = (_.team ? "[" + _.team + "] " : "") + (_.name || "");
  5053. if ("" != w) {
  5054. if (be.font = (_.nameScale || 30) + "px Hammersmith One",
  5055. be.fillStyle = "#fff",
  5056. be.textBaseline = "middle",
  5057. be.textAlign = "center",
  5058. be.lineWidth = _.nameScale ? 11 : 8,
  5059. be.lineJoin = "round",
  5060. be.strokeText(w, _.x - f, _.y - d - _.scale - o.nameY),
  5061. be.fillText(w, _.x - f, _.y - d - _.scale - o.nameY),
  5062. _.isLeader && Rn.crown.isLoaded) {
  5063. var b = o.crownIconScale;
  5064. k = _.x - f - b / 2 - be.measureText(w).width / 2 - o.crownPad,
  5065. be.drawImage(Rn.crown, k, _.y - d - _.scale - o.nameY - b / 2 - 5, b, b)
  5066. }
  5067. 1 == _.iconIndex && Rn.skull.isLoaded && (b = o.crownIconScale,
  5068. k = _.x - f - b / 2 + be.measureText(w).width / 2 + o.crownPad,
  5069. be.drawImage(Rn.skull, k, _.y - d - _.scale - o.nameY - b / 2 - 5, b, b))
  5070. }
  5071. _.health > 0 && (o.healthBarWidth,
  5072. be.fillStyle = rt,
  5073. be.roundRect(_.x - f - o.healthBarWidth - o.healthBarPad, _.y - d + _.scale + o.nameY, 2 * o.healthBarWidth + 2 * o.healthBarPad, 17, 8),
  5074. be.fill(),
  5075. be.fillStyle = _ == R || _.team && _.team == R.team ? "#8ecc51" : "#cc5151",
  5076. be.roundRect(_.x - f - o.healthBarWidth, _.y - d + _.scale + o.nameY + o.healthBarPad, 2 * o.healthBarWidth * (_.health / _.maxHealth), 17 - 2 * o.healthBarPad, 7),
  5077. be.fill())
  5078. }
  5079. for (m.update(P, be, f, d),
  5080. a = 0; a < W.length; ++a)
  5081. if ((_ = W[a]).visible && _.chatCountdown > 0) {
  5082. _.chatCountdown -= P,
  5083. _.chatCountdown <= 0 && (_.chatCountdown = 0),
  5084. be.font = "32px Hammersmith One";
  5085. var x = be.measureText(_.chatMessage);
  5086. be.textBaseline = "middle",
  5087. be.textAlign = "center",
  5088. k = _.x - f,
  5089. y = _.y - _.scale - d - 90;
  5090. var S = x.width + 17;
  5091. be.fillStyle = "rgba(0,0,0,0.2)",
  5092. be.roundRect(k - S / 2, y - 23.5, S, 47, 6),
  5093. be.fill(),
  5094. be.fillStyle = "#fff",
  5095. be.fillText(_.chatMessage, k, y)
  5096. }
  5097. !function(e) {
  5098. if (R && R.alive) {
  5099. Ke.clearRect(0, 0, Ne.width, Ne.height),
  5100. Ke.strokeStyle = "#fff",
  5101. Ke.lineWidth = 4;
  5102. for (var t = 0; t < qt.length; ++t)
  5103. (Vt = qt[t]).update(Ke, e);
  5104. if (Ke.globalAlpha = 1,
  5105. Ke.fillStyle = "#fff",
  5106. si(R.x / o.mapScale * Ne.width, R.y / o.mapScale * Ne.height, 7, Ke, !0),
  5107. Ke.fillStyle = "rgba(255,255,255,0.35)",
  5108. R.team && Et)
  5109. for (t = 0; t < Et.length; )
  5110. si(Et[t] / o.mapScale * Ne.width, Et[t + 1] / o.mapScale * Ne.height, 7, Ke, !0),
  5111. t += 2;
  5112. Tach.drawWaypointMap(Ke, Ne);
  5113. /*It && (Ke.fillStyle = "#fc5553",
  5114. Ke.font = "34px Hammersmith One",
  5115. Ke.textBaseline = "middle",
  5116. Ke.textAlign = "center",
  5117. Ke.fillText("x", It.x / o.mapScale * Ne.width, It.y / o.mapScale * Ne.height)),
  5118. Mt && (Ke.fillStyle = "#fff",
  5119. Ke.font = "34px Hammersmith One",
  5120. Ke.textBaseline = "middle",
  5121. Ke.textAlign = "center",
  5122. Ke.fillText("x", Mt.x / o.mapScale * Ne.width, Mt.y / o.mapScale * Ne.height))*/
  5123. }
  5124. }(P),
  5125. -1 !== re.id && Fn(re.startX, re.startY, re.currentX, re.currentY),
  5126. -1 !== se.id && Fn(se.startX, se.startY, se.currentX, se.currentY)
  5127. }(),
  5128. requestAnimFrame(e)
  5129. }(),
  5130. window.openLink = Oi,
  5131. window.aJoinReq = Dt,
  5132. window.follmoo = function() {
  5133. H || (H = !0,
  5134. I("moofoll", 1))
  5135. }
  5136. ,
  5137. window.kickFromClan = Lt,
  5138. window.sendJoin = Ft,
  5139. window.leaveAlliance = Ht,
  5140. window.createAlliance = zt,
  5141. window.storeBuy = Kt,
  5142. window.storeEquip = Jt,
  5143. window.showItemInfo = Tt,
  5144. window.selectSkinColor = function(e) {
  5145. ae = e,
  5146. en()
  5147. }
  5148. ,
  5149. window.changeStoreIndex = function(e) {
  5150. Xt != e && (Xt = e,
  5151. Gt())
  5152. }
  5153. ,
  5154. window.config = o
  5155. }
  5156. , function(e, t) {
  5157. !function(e, t, n) {
  5158. function i(e, t) {
  5159. return typeof e === t
  5160. }
  5161. var r = []
  5162. , s = []
  5163. , a = {
  5164. _version: "3.5.0",
  5165. _config: {
  5166. classPrefix: "",
  5167. enableClasses: !0,
  5168. enableJSClass: !0,
  5169. usePrefixes: !0
  5170. },
  5171. _q: [],
  5172. on: function(e, t) {
  5173. var n = this;
  5174. setTimeout((function() {
  5175. t(n[e])
  5176. }
  5177. ), 0)
  5178. },
  5179. addTest: function(e, t, n) {
  5180. s.push({
  5181. name: e,
  5182. fn: t,
  5183. options: n
  5184. })
  5185. },
  5186. addAsyncTest: function(e) {
  5187. s.push({
  5188. name: null,
  5189. fn: e
  5190. })
  5191. }
  5192. }
  5193. , o = function() {};
  5194. o.prototype = a,
  5195. o = new o;
  5196. var c = t.documentElement
  5197. , l = "svg" === c.nodeName.toLowerCase();
  5198. o.addTest("passiveeventlisteners", (function() {
  5199. var t = !1;
  5200. try {
  5201. var n = Object.defineProperty({}, "passive", {
  5202. get: function() {
  5203. t = !0
  5204. }
  5205. });
  5206. e.addEventListener("test", null, n)
  5207. } catch (e) {}
  5208. return t
  5209. }
  5210. )),
  5211. function() {
  5212. var e, t, n, a, c, l;
  5213. for (var h in s)
  5214. if (s.hasOwnProperty(h)) {
  5215. if (e = [],
  5216. (t = s[h]).name && (e.push(t.name.toLowerCase()),
  5217. t.options && t.options.aliases && t.options.aliases.length))
  5218. for (n = 0; n < t.options.aliases.length; n++)
  5219. e.push(t.options.aliases[n].toLowerCase());
  5220. for (a = i(t.fn, "function") ? t.fn() : t.fn,
  5221. c = 0; c < e.length; c++)
  5222. 1 === (l = e[c].split(".")).length ? o[l[0]] = a : (!o[l[0]] || o[l[0]]instanceof Boolean || (o[l[0]] = new Boolean(o[l[0]])),
  5223. o[l[0]][l[1]] = a),
  5224. r.push((a ? "" : "no-") + l.join("-"))
  5225. }
  5226. }(),
  5227. function(e) {
  5228. var t = c.className
  5229. , n = o._config.classPrefix || "";
  5230. if (l && (t = t.baseVal),
  5231. o._config.enableJSClass) {
  5232. var i = new RegExp("(^|\\s)" + n + "no-js(\\s|$)");
  5233. t = t.replace(i, "$1" + n + "js$2")
  5234. }
  5235. o._config.enableClasses && (t += " " + n + e.join(" " + n),
  5236. l ? c.className.baseVal = t : c.className = t)
  5237. }(r),
  5238. delete a.addTest,
  5239. delete a.addAsyncTest;
  5240. for (var h = 0; h < o._q.length; h++)
  5241. o._q[h]();
  5242. e.Modernizr = o
  5243. }(window, document)
  5244. }
  5245. , function(e, t, n) {
  5246. var i = n(24);
  5247. n(19),
  5248. e.exports = {
  5249. socket: null,
  5250. connected: !1,
  5251. socketId: -1,
  5252. connect: function(e, t, n) {
  5253. if (!this.socket) {
  5254. var r = this;
  5255. try {
  5256. var s = !1
  5257. , a = e;
  5258. this.socket = new WebSocket(a),
  5259. this.socket.binaryType = "arraybuffer",
  5260. this.socket.onmessage = function(e) {
  5261. var t = new Uint8Array(e.data)
  5262. , s = i.decode(t)
  5263. , a = s[0];
  5264. t = s[1],
  5265. "io-init" == a ? r.socketId = t[0] : n[a].apply(void 0, t)
  5266. }
  5267. ,
  5268. this.socket.onopen = function() {
  5269. r.connected = !0,
  5270. t()
  5271. }
  5272. ,
  5273. this.socket.onclose = function(e) {
  5274. r.connected = !1,
  5275. 4001 == e.code ? t("Invalid Connection") : s || t("disconnected")
  5276. }
  5277. ,
  5278. this.socket.onerror = function(e) {
  5279. this.socket && this.socket.readyState != WebSocket.OPEN && (s = !0,
  5280. console.error("Socket error", arguments),
  5281. t("Socket error"))
  5282. }
  5283. } catch (e) {
  5284. console.warn("Socket connection error:", e),
  5285. t(e)
  5286. }
  5287. }
  5288. },
  5289. send: function(e) {
  5290. var t = Array.prototype.slice.call(arguments, 1)
  5291. , n = i.encode([e, t]);
  5292. this.socket.send(n)
  5293. },
  5294. socketReady: function() {
  5295. return this.socket && this.connected
  5296. },
  5297. close: function() {
  5298. this.socket && this.socket.close()
  5299. }
  5300. }
  5301. }
  5302. , function(e, t, n) {
  5303. t.encode = n(9).encode,
  5304. t.decode = n(15).decode,
  5305. t.Encoder = n(37).Encoder,
  5306. t.Decoder = n(38).Decoder,
  5307. t.createCodec = n(39).createCodec,
  5308. t.codec = n(40).codec
  5309. }
  5310. , function(e, t, n) {
  5311. (function(t) {
  5312. function n(e) {
  5313. return e && e.isBuffer && e
  5314. }
  5315. e.exports = n(void 0 !== t && t) || n(this.Buffer) || n("undefined" != typeof window && window.Buffer) || this.Buffer
  5316. }
  5317. ).call(this, n(11).Buffer)
  5318. }
  5319. , function(e, t, n) {
  5320. "use strict";
  5321. t.byteLength = function(e) {
  5322. var t = l(e)
  5323. , n = t[0]
  5324. , i = t[1];
  5325. return 3 * (n + i) / 4 - i
  5326. }
  5327. ,
  5328. t.toByteArray = function(e) {
  5329. var t, n, i = l(e), a = i[0], o = i[1], c = new s(function(e, t, n) {
  5330. return 3 * (t + n) / 4 - n
  5331. }(0, a, o)), h = 0, u = o > 0 ? a - 4 : a;
  5332. for (n = 0; n < u; n += 4)
  5333. t = r[e.charCodeAt(n)] << 18 | r[e.charCodeAt(n + 1)] << 12 | r[e.charCodeAt(n + 2)] << 6 | r[e.charCodeAt(n + 3)],
  5334. c[h++] = t >> 16 & 255,
  5335. c[h++] = t >> 8 & 255,
  5336. c[h++] = 255 & t;
  5337. return 2 === o && (t = r[e.charCodeAt(n)] << 2 | r[e.charCodeAt(n + 1)] >> 4,
  5338. c[h++] = 255 & t),
  5339. 1 === o && (t = r[e.charCodeAt(n)] << 10 | r[e.charCodeAt(n + 1)] << 4 | r[e.charCodeAt(n + 2)] >> 2,
  5340. c[h++] = t >> 8 & 255,
  5341. c[h++] = 255 & t),
  5342. c
  5343. }
  5344. ,
  5345. t.fromByteArray = function(e) {
  5346. for (var t, n = e.length, r = n % 3, s = [], a = 0, o = n - r; a < o; a += 16383)
  5347. s.push(u(e, a, a + 16383 > o ? o : a + 16383));
  5348. return 1 === r ? (t = e[n - 1],
  5349. s.push(i[t >> 2] + i[t << 4 & 63] + "==")) : 2 === r && (t = (e[n - 2] << 8) + e[n - 1],
  5350. s.push(i[t >> 10] + i[t >> 4 & 63] + i[t << 2 & 63] + "=")),
  5351. s.join("")
  5352. }
  5353. ;
  5354. for (var i = [], r = [], s = "undefined" != typeof Uint8Array ? Uint8Array : Array, a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", o = 0, c = a.length; o < c; ++o)
  5355. i[o] = a[o],
  5356. r[a.charCodeAt(o)] = o;
  5357. function l(e) {
  5358. var t = e.length;
  5359. if (t % 4 > 0)
  5360. throw new Error("Invalid string. Length must be a multiple of 4");
  5361. var n = e.indexOf("=");
  5362. return -1 === n && (n = t),
  5363. [n, n === t ? 0 : 4 - n % 4]
  5364. }
  5365. function h(e) {
  5366. return i[e >> 18 & 63] + i[e >> 12 & 63] + i[e >> 6 & 63] + i[63 & e]
  5367. }
  5368. function u(e, t, n) {
  5369. for (var i, r = [], s = t; s < n; s += 3)
  5370. i = (e[s] << 16 & 16711680) + (e[s + 1] << 8 & 65280) + (255 & e[s + 2]),
  5371. r.push(h(i));
  5372. return r.join("")
  5373. }
  5374. r["-".charCodeAt(0)] = 62,
  5375. r["_".charCodeAt(0)] = 63
  5376. }
  5377. , function(e, t) {
  5378. var n = {}.toString;
  5379. e.exports = Array.isArray || function(e) {
  5380. return "[object Array]" == n.call(e)
  5381. }
  5382. }
  5383. , function(e, t, n) {
  5384. var i = n(0);
  5385. function r(e) {
  5386. return new Array(e)
  5387. }
  5388. (t = e.exports = r(0)).alloc = r,
  5389. t.concat = i.concat,
  5390. t.from = function(e) {
  5391. if (!i.isBuffer(e) && i.isView(e))
  5392. e = i.Uint8Array.from(e);
  5393. else if (i.isArrayBuffer(e))
  5394. e = new Uint8Array(e);
  5395. else {
  5396. if ("string" == typeof e)
  5397. return i.from.call(t, e);
  5398. if ("number" == typeof e)
  5399. throw new TypeError('"value" argument must not be a number')
  5400. }
  5401. return Array.prototype.slice.call(e)
  5402. }
  5403. }
  5404. , function(e, t, n) {
  5405. var i = n(0)
  5406. , r = i.global;
  5407. function s(e) {
  5408. return new r(e)
  5409. }
  5410. (t = e.exports = i.hasBuffer ? s(0) : []).alloc = i.hasBuffer && r.alloc || s,
  5411. t.concat = i.concat,
  5412. t.from = function(e) {
  5413. if (!i.isBuffer(e) && i.isView(e))
  5414. e = i.Uint8Array.from(e);
  5415. else if (i.isArrayBuffer(e))
  5416. e = new Uint8Array(e);
  5417. else {
  5418. if ("string" == typeof e)
  5419. return i.from.call(t, e);
  5420. if ("number" == typeof e)
  5421. throw new TypeError('"value" argument must not be a number')
  5422. }
  5423. return r.from && 1 !== r.from.length ? r.from(e) : new r(e)
  5424. }
  5425. }
  5426. , function(e, t, n) {
  5427. var i = n(0);
  5428. function r(e) {
  5429. return new Uint8Array(e)
  5430. }
  5431. (t = e.exports = i.hasArrayBuffer ? r(0) : []).alloc = r,
  5432. t.concat = i.concat,
  5433. t.from = function(e) {
  5434. if (i.isView(e)) {
  5435. var n = e.byteOffset
  5436. , r = e.byteLength;
  5437. (e = e.buffer).byteLength !== r && (e.slice ? e = e.slice(n, n + r) : (e = new Uint8Array(e)).byteLength !== r && (e = Array.prototype.slice.call(e, n, n + r)))
  5438. } else {
  5439. if ("string" == typeof e)
  5440. return i.from.call(t, e);
  5441. if ("number" == typeof e)
  5442. throw new TypeError('"value" argument must not be a number')
  5443. }
  5444. return new Uint8Array(e)
  5445. }
  5446. }
  5447. , function(e, t) {
  5448. t.copy = function(e, t, n, i) {
  5449. var r;
  5450. n || (n = 0),
  5451. i || 0 === i || (i = this.length),
  5452. t || (t = 0);
  5453. var s = i - n;
  5454. if (e === this && n < t && t < i)
  5455. for (r = s - 1; r >= 0; r--)
  5456. e[r + t] = this[r + n];
  5457. else
  5458. for (r = 0; r < s; r++)
  5459. e[r + t] = this[r + n];
  5460. return s
  5461. }
  5462. ,
  5463. t.toString = function(e, t, n) {
  5464. var i = 0 | t;
  5465. n || (n = this.length);
  5466. for (var r = "", s = 0; i < n; )
  5467. (s = this[i++]) < 128 ? r += String.fromCharCode(s) : (192 == (224 & s) ? s = (31 & s) << 6 | 63 & this[i++] : 224 == (240 & s) ? s = (15 & s) << 12 | (63 & this[i++]) << 6 | 63 & this[i++] : 240 == (248 & s) && (s = (7 & s) << 18 | (63 & this[i++]) << 12 | (63 & this[i++]) << 6 | 63 & this[i++]),
  5468. s >= 65536 ? (s -= 65536,
  5469. r += String.fromCharCode(55296 + (s >>> 10), 56320 + (1023 & s))) : r += String.fromCharCode(s));
  5470. return r
  5471. }
  5472. ,
  5473. t.write = function(e, t) {
  5474. for (var n = t || (t |= 0), i = e.length, r = 0, s = 0; s < i; )
  5475. (r = e.charCodeAt(s++)) < 128 ? this[n++] = r : r < 2048 ? (this[n++] = 192 | r >>> 6,
  5476. this[n++] = 128 | 63 & r) : r < 55296 || r > 57343 ? (this[n++] = 224 | r >>> 12,
  5477. this[n++] = 128 | r >>> 6 & 63,
  5478. this[n++] = 128 | 63 & r) : (r = 65536 + (r - 55296 << 10 | e.charCodeAt(s++) - 56320),
  5479. this[n++] = 240 | r >>> 18,
  5480. this[n++] = 128 | r >>> 12 & 63,
  5481. this[n++] = 128 | r >>> 6 & 63,
  5482. this[n++] = 128 | 63 & r);
  5483. return n - t
  5484. }
  5485. }
  5486. , function(e, t, n) {
  5487. t.setExtPackers = function(e) {
  5488. e.addExtPacker(14, Error, [u, c]),
  5489. e.addExtPacker(1, EvalError, [u, c]),
  5490. e.addExtPacker(2, RangeError, [u, c]),
  5491. e.addExtPacker(3, ReferenceError, [u, c]),
  5492. e.addExtPacker(4, SyntaxError, [u, c]),
  5493. e.addExtPacker(5, TypeError, [u, c]),
  5494. e.addExtPacker(6, URIError, [u, c]),
  5495. e.addExtPacker(10, RegExp, [h, c]),
  5496. e.addExtPacker(11, Boolean, [l, c]),
  5497. e.addExtPacker(12, String, [l, c]),
  5498. e.addExtPacker(13, Date, [Number, c]),
  5499. e.addExtPacker(15, Number, [l, c]),
  5500. "undefined" != typeof Uint8Array && (e.addExtPacker(17, Int8Array, a),
  5501. e.addExtPacker(18, Uint8Array, a),
  5502. e.addExtPacker(19, Int16Array, a),
  5503. e.addExtPacker(20, Uint16Array, a),
  5504. e.addExtPacker(21, Int32Array, a),
  5505. e.addExtPacker(22, Uint32Array, a),
  5506. e.addExtPacker(23, Float32Array, a),
  5507. "undefined" != typeof Float64Array && e.addExtPacker(24, Float64Array, a),
  5508. "undefined" != typeof Uint8ClampedArray && e.addExtPacker(25, Uint8ClampedArray, a),
  5509. e.addExtPacker(26, ArrayBuffer, a),
  5510. e.addExtPacker(29, DataView, a)),
  5511. r.hasBuffer && e.addExtPacker(27, s, r.from)
  5512. }
  5513. ;
  5514. var i, r = n(0), s = r.global, a = r.Uint8Array.from, o = {
  5515. name: 1,
  5516. message: 1,
  5517. stack: 1,
  5518. columnNumber: 1,
  5519. fileName: 1,
  5520. lineNumber: 1
  5521. };
  5522. function c(e) {
  5523. return i || (i = n(9).encode),
  5524. i(e)
  5525. }
  5526. function l(e) {
  5527. return e.valueOf()
  5528. }
  5529. function h(e) {
  5530. (e = RegExp.prototype.toString.call(e).split("/")).shift();
  5531. var t = [e.pop()];
  5532. return t.unshift(e.join("/")),
  5533. t
  5534. }
  5535. function u(e) {
  5536. var t = {};
  5537. for (var n in o)
  5538. t[n] = e[n];
  5539. return t
  5540. }
  5541. }
  5542. , function(e, t, n) {
  5543. var i = n(5)
  5544. , r = n(7)
  5545. , s = r.Uint64BE
  5546. , a = r.Int64BE
  5547. , o = n(0)
  5548. , c = n(6)
  5549. , l = n(34)
  5550. , h = n(13).uint8
  5551. , u = n(3).ExtBuffer
  5552. , f = "undefined" != typeof Uint8Array
  5553. , d = "undefined" != typeof Map
  5554. , p = [];
  5555. p[1] = 212,
  5556. p[2] = 213,
  5557. p[4] = 214,
  5558. p[8] = 215,
  5559. p[16] = 216,
  5560. t.getWriteType = function(e) {
  5561. var t = l.getWriteToken(e)
  5562. , n = e && e.useraw
  5563. , r = f && e && e.binarraybuffer
  5564. , g = r ? o.isArrayBuffer : o.isBuffer
  5565. , m = r ? function(e, t) {
  5566. w(e, new Uint8Array(t))
  5567. }
  5568. : w
  5569. , y = d && e && e.usemap ? function(e, n) {
  5570. if (!(n instanceof Map))
  5571. return b(e, n);
  5572. var i = n.size;
  5573. t[i < 16 ? 128 + i : i <= 65535 ? 222 : 223](e, i);
  5574. var r = e.codec.encode;
  5575. n.forEach((function(t, n, i) {
  5576. r(e, n),
  5577. r(e, t)
  5578. }
  5579. ))
  5580. }
  5581. : b;
  5582. return {
  5583. boolean: function(e, n) {
  5584. t[n ? 195 : 194](e, n)
  5585. },
  5586. function: v,
  5587. number: function(e, n) {
  5588. var i = 0 | n;
  5589. n === i ? t[-32 <= i && i <= 127 ? 255 & i : 0 <= i ? i <= 255 ? 204 : i <= 65535 ? 205 : 206 : -128 <= i ? 208 : -32768 <= i ? 209 : 210](e, i) : t[203](e, n)
  5590. },
  5591. object: n ? function(e, n) {
  5592. if (g(n))
  5593. return function(e, n) {
  5594. var i = n.length;
  5595. t[i < 32 ? 160 + i : i <= 65535 ? 218 : 219](e, i),
  5596. e.send(n)
  5597. }(e, n);
  5598. k(e, n)
  5599. }
  5600. : k,
  5601. string: function(e) {
  5602. return function(n, i) {
  5603. var r = i.length
  5604. , s = 5 + 3 * r;
  5605. n.offset = n.reserve(s);
  5606. var a = n.buffer
  5607. , o = e(r)
  5608. , l = n.offset + o;
  5609. r = c.write.call(a, i, l);
  5610. var h = e(r);
  5611. if (o !== h) {
  5612. var u = l + h - o
  5613. , f = l + r;
  5614. c.copy.call(a, a, u, l, f)
  5615. }
  5616. t[1 === h ? 160 + r : h <= 3 ? 215 + h : 219](n, r),
  5617. n.offset += r
  5618. }
  5619. }(n ? function(e) {
  5620. return e < 32 ? 1 : e <= 65535 ? 3 : 5
  5621. }
  5622. : function(e) {
  5623. return e < 32 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : 5
  5624. }
  5625. ),
  5626. symbol: v,
  5627. undefined: v
  5628. };
  5629. function k(e, n) {
  5630. if (null === n)
  5631. return v(e, n);
  5632. if (g(n))
  5633. return m(e, n);
  5634. if (i(n))
  5635. return function(e, n) {
  5636. var i = n.length;
  5637. t[i < 16 ? 144 + i : i <= 65535 ? 220 : 221](e, i);
  5638. for (var r = e.codec.encode, s = 0; s < i; s++)
  5639. r(e, n[s])
  5640. }(e, n);
  5641. if (s.isUint64BE(n))
  5642. return function(e, n) {
  5643. t[207](e, n.toArray())
  5644. }(e, n);
  5645. if (a.isInt64BE(n))
  5646. return function(e, n) {
  5647. t[211](e, n.toArray())
  5648. }(e, n);
  5649. var r = e.codec.getExtPacker(n);
  5650. if (r && (n = r(n)),
  5651. n instanceof u)
  5652. return function(e, n) {
  5653. var i = n.buffer
  5654. , r = i.length
  5655. , s = p[r] || (r < 255 ? 199 : r <= 65535 ? 200 : 201);
  5656. t[s](e, r),
  5657. h[n.type](e),
  5658. e.send(i)
  5659. }(e, n);
  5660. y(e, n)
  5661. }
  5662. function v(e, n) {
  5663. t[192](e, n)
  5664. }
  5665. function w(e, n) {
  5666. var i = n.length;
  5667. t[i < 255 ? 196 : i <= 65535 ? 197 : 198](e, i),
  5668. e.send(n)
  5669. }
  5670. function b(e, n) {
  5671. var i = Object.keys(n)
  5672. , r = i.length;
  5673. t[r < 16 ? 128 + r : r <= 65535 ? 222 : 223](e, r);
  5674. var s = e.codec.encode;
  5675. i.forEach((function(t) {
  5676. s(e, t),
  5677. s(e, n[t])
  5678. }
  5679. ))
  5680. }
  5681. }
  5682. }
  5683. , function(e, t, n) {
  5684. var i = n(4)
  5685. , r = n(7)
  5686. , s = r.Uint64BE
  5687. , a = r.Int64BE
  5688. , o = n(13).uint8
  5689. , c = n(0)
  5690. , l = c.global
  5691. , h = c.hasBuffer && "TYPED_ARRAY_SUPPORT"in l && !l.TYPED_ARRAY_SUPPORT
  5692. , u = c.hasBuffer && l.prototype || {};
  5693. function f() {
  5694. var e = o.slice();
  5695. return e[196] = d(196),
  5696. e[197] = p(197),
  5697. e[198] = g(198),
  5698. e[199] = d(199),
  5699. e[200] = p(200),
  5700. e[201] = g(201),
  5701. e[202] = m(202, 4, u.writeFloatBE || v, !0),
  5702. e[203] = m(203, 8, u.writeDoubleBE || w, !0),
  5703. e[204] = d(204),
  5704. e[205] = p(205),
  5705. e[206] = g(206),
  5706. e[207] = m(207, 8, y),
  5707. e[208] = d(208),
  5708. e[209] = p(209),
  5709. e[210] = g(210),
  5710. e[211] = m(211, 8, k),
  5711. e[217] = d(217),
  5712. e[218] = p(218),
  5713. e[219] = g(219),
  5714. e[220] = p(220),
  5715. e[221] = g(221),
  5716. e[222] = p(222),
  5717. e[223] = g(223),
  5718. e
  5719. }
  5720. function d(e) {
  5721. return function(t, n) {
  5722. var i = t.reserve(2)
  5723. , r = t.buffer;
  5724. r[i++] = e,
  5725. r[i] = n
  5726. }
  5727. }
  5728. function p(e) {
  5729. return function(t, n) {
  5730. var i = t.reserve(3)
  5731. , r = t.buffer;
  5732. r[i++] = e,
  5733. r[i++] = n >>> 8,
  5734. r[i] = n
  5735. }
  5736. }
  5737. function g(e) {
  5738. return function(t, n) {
  5739. var i = t.reserve(5)
  5740. , r = t.buffer;
  5741. r[i++] = e,
  5742. r[i++] = n >>> 24,
  5743. r[i++] = n >>> 16,
  5744. r[i++] = n >>> 8,
  5745. r[i] = n
  5746. }
  5747. }
  5748. function m(e, t, n, i) {
  5749. return function(r, s) {
  5750. var a = r.reserve(t + 1);
  5751. r.buffer[a++] = e,
  5752. n.call(r.buffer, s, a, i)
  5753. }
  5754. }
  5755. function y(e, t) {
  5756. new s(this,t,e)
  5757. }
  5758. function k(e, t) {
  5759. new a(this,t,e)
  5760. }
  5761. function v(e, t) {
  5762. i.write(this, e, t, !1, 23, 4)
  5763. }
  5764. function w(e, t) {
  5765. i.write(this, e, t, !1, 52, 8)
  5766. }
  5767. t.getWriteToken = function(e) {
  5768. return e && e.uint8array ? function() {
  5769. var e = f();
  5770. return e[202] = m(202, 4, v),
  5771. e[203] = m(203, 8, w),
  5772. e
  5773. }() : h || c.hasBuffer && e && e.safe ? function() {
  5774. var e = o.slice();
  5775. return e[196] = m(196, 1, l.prototype.writeUInt8),
  5776. e[197] = m(197, 2, l.prototype.writeUInt16BE),
  5777. e[198] = m(198, 4, l.prototype.writeUInt32BE),
  5778. e[199] = m(199, 1, l.prototype.writeUInt8),
  5779. e[200] = m(200, 2, l.prototype.writeUInt16BE),
  5780. e[201] = m(201, 4, l.prototype.writeUInt32BE),
  5781. e[202] = m(202, 4, l.prototype.writeFloatBE),
  5782. e[203] = m(203, 8, l.prototype.writeDoubleBE),
  5783. e[204] = m(204, 1, l.prototype.writeUInt8),
  5784. e[205] = m(205, 2, l.prototype.writeUInt16BE),
  5785. e[206] = m(206, 4, l.prototype.writeUInt32BE),
  5786. e[207] = m(207, 8, y),
  5787. e[208] = m(208, 1, l.prototype.writeInt8),
  5788. e[209] = m(209, 2, l.prototype.writeInt16BE),
  5789. e[210] = m(210, 4, l.prototype.writeInt32BE),
  5790. e[211] = m(211, 8, k),
  5791. e[217] = m(217, 1, l.prototype.writeUInt8),
  5792. e[218] = m(218, 2, l.prototype.writeUInt16BE),
  5793. e[219] = m(219, 4, l.prototype.writeUInt32BE),
  5794. e[220] = m(220, 2, l.prototype.writeUInt16BE),
  5795. e[221] = m(221, 4, l.prototype.writeUInt32BE),
  5796. e[222] = m(222, 2, l.prototype.writeUInt16BE),
  5797. e[223] = m(223, 4, l.prototype.writeUInt32BE),
  5798. e
  5799. }() : f()
  5800. }
  5801. }
  5802. , function(e, t, n) {
  5803. t.setExtUnpackers = function(e) {
  5804. e.addExtUnpacker(14, [o, l(Error)]),
  5805. e.addExtUnpacker(1, [o, l(EvalError)]),
  5806. e.addExtUnpacker(2, [o, l(RangeError)]),
  5807. e.addExtUnpacker(3, [o, l(ReferenceError)]),
  5808. e.addExtUnpacker(4, [o, l(SyntaxError)]),
  5809. e.addExtUnpacker(5, [o, l(TypeError)]),
  5810. e.addExtUnpacker(6, [o, l(URIError)]),
  5811. e.addExtUnpacker(10, [o, c]),
  5812. e.addExtUnpacker(11, [o, h(Boolean)]),
  5813. e.addExtUnpacker(12, [o, h(String)]),
  5814. e.addExtUnpacker(13, [o, h(Date)]),
  5815. e.addExtUnpacker(15, [o, h(Number)]),
  5816. "undefined" != typeof Uint8Array && (e.addExtUnpacker(17, h(Int8Array)),
  5817. e.addExtUnpacker(18, h(Uint8Array)),
  5818. e.addExtUnpacker(19, [u, h(Int16Array)]),
  5819. e.addExtUnpacker(20, [u, h(Uint16Array)]),
  5820. e.addExtUnpacker(21, [u, h(Int32Array)]),
  5821. e.addExtUnpacker(22, [u, h(Uint32Array)]),
  5822. e.addExtUnpacker(23, [u, h(Float32Array)]),
  5823. "undefined" != typeof Float64Array && e.addExtUnpacker(24, [u, h(Float64Array)]),
  5824. "undefined" != typeof Uint8ClampedArray && e.addExtUnpacker(25, h(Uint8ClampedArray)),
  5825. e.addExtUnpacker(26, u),
  5826. e.addExtUnpacker(29, [u, h(DataView)])),
  5827. r.hasBuffer && e.addExtUnpacker(27, h(s))
  5828. }
  5829. ;
  5830. var i, r = n(0), s = r.global, a = {
  5831. name: 1,
  5832. message: 1,
  5833. stack: 1,
  5834. columnNumber: 1,
  5835. fileName: 1,
  5836. lineNumber: 1
  5837. };
  5838. function o(e) {
  5839. return i || (i = n(15).decode),
  5840. i(e)
  5841. }
  5842. function c(e) {
  5843. return RegExp.apply(null, e)
  5844. }
  5845. function l(e) {
  5846. return function(t) {
  5847. var n = new e;
  5848. for (var i in a)
  5849. n[i] = t[i];
  5850. return n
  5851. }
  5852. }
  5853. function h(e) {
  5854. return function(t) {
  5855. return new e(t)
  5856. }
  5857. }
  5858. function u(e) {
  5859. return new Uint8Array(e).buffer
  5860. }
  5861. }
  5862. , function(e, t, n) {
  5863. var i = n(17);
  5864. function r(e) {
  5865. var t, n = new Array(256);
  5866. for (t = 0; t <= 127; t++)
  5867. n[t] = s(t);
  5868. for (t = 128; t <= 143; t++)
  5869. n[t] = o(t - 128, e.map);
  5870. for (t = 144; t <= 159; t++)
  5871. n[t] = o(t - 144, e.array);
  5872. for (t = 160; t <= 191; t++)
  5873. n[t] = o(t - 160, e.str);
  5874. for (n[192] = s(null),
  5875. n[193] = null,
  5876. n[194] = s(!1),
  5877. n[195] = s(!0),
  5878. n[196] = a(e.uint8, e.bin),
  5879. n[197] = a(e.uint16, e.bin),
  5880. n[198] = a(e.uint32, e.bin),
  5881. n[199] = a(e.uint8, e.ext),
  5882. n[200] = a(e.uint16, e.ext),
  5883. n[201] = a(e.uint32, e.ext),
  5884. n[202] = e.float32,
  5885. n[203] = e.float64,
  5886. n[204] = e.uint8,
  5887. n[205] = e.uint16,
  5888. n[206] = e.uint32,
  5889. n[207] = e.uint64,
  5890. n[208] = e.int8,
  5891. n[209] = e.int16,
  5892. n[210] = e.int32,
  5893. n[211] = e.int64,
  5894. n[212] = o(1, e.ext),
  5895. n[213] = o(2, e.ext),
  5896. n[214] = o(4, e.ext),
  5897. n[215] = o(8, e.ext),
  5898. n[216] = o(16, e.ext),
  5899. n[217] = a(e.uint8, e.str),
  5900. n[218] = a(e.uint16, e.str),
  5901. n[219] = a(e.uint32, e.str),
  5902. n[220] = a(e.uint16, e.array),
  5903. n[221] = a(e.uint32, e.array),
  5904. n[222] = a(e.uint16, e.map),
  5905. n[223] = a(e.uint32, e.map),
  5906. t = 224; t <= 255; t++)
  5907. n[t] = s(t - 256);
  5908. return n
  5909. }
  5910. function s(e) {
  5911. return function() {
  5912. return e
  5913. }
  5914. }
  5915. function a(e, t) {
  5916. return function(n) {
  5917. var i = e(n);
  5918. return t(n, i)
  5919. }
  5920. }
  5921. function o(e, t) {
  5922. return function(n) {
  5923. return t(n, e)
  5924. }
  5925. }
  5926. t.getReadToken = function(e) {
  5927. var t = i.getReadFormat(e);
  5928. return e && e.useraw ? function(e) {
  5929. var t, n = r(e).slice();
  5930. for (n[217] = n[196],
  5931. n[218] = n[197],
  5932. n[219] = n[198],
  5933. t = 160; t <= 191; t++)
  5934. n[t] = o(t - 160, e.bin);
  5935. return n
  5936. }(t) : r(t)
  5937. }
  5938. }
  5939. , function(e, t, n) {
  5940. t.Encoder = s;
  5941. var i = n(18)
  5942. , r = n(10).EncodeBuffer;
  5943. function s(e) {
  5944. if (!(this instanceof s))
  5945. return new s(e);
  5946. r.call(this, e)
  5947. }
  5948. s.prototype = new r,
  5949. i.mixin(s.prototype),
  5950. s.prototype.encode = function(e) {
  5951. this.write(e),
  5952. this.emit("data", this.read())
  5953. }
  5954. ,
  5955. s.prototype.end = function(e) {
  5956. arguments.length && this.encode(e),
  5957. this.flush(),
  5958. this.emit("end")
  5959. }
  5960. }
  5961. , function(e, t, n) {
  5962. t.Decoder = s;
  5963. var i = n(18)
  5964. , r = n(16).DecodeBuffer;
  5965. function s(e) {
  5966. if (!(this instanceof s))
  5967. return new s(e);
  5968. r.call(this, e)
  5969. }
  5970. s.prototype = new r,
  5971. i.mixin(s.prototype),
  5972. s.prototype.decode = function(e) {
  5973. arguments.length && this.write(e),
  5974. this.flush()
  5975. }
  5976. ,
  5977. s.prototype.push = function(e) {
  5978. this.emit("data", e)
  5979. }
  5980. ,
  5981. s.prototype.end = function(e) {
  5982. this.decode(e),
  5983. this.emit("end")
  5984. }
  5985. }
  5986. , function(e, t, n) {
  5987. n(8),
  5988. n(2),
  5989. t.createCodec = n(1).createCodec
  5990. }
  5991. , function(e, t, n) {
  5992. n(8),
  5993. n(2),
  5994. t.codec = {
  5995. preset: n(1).preset
  5996. }
  5997. }
  5998. , function(e, t) {
  5999. var n, i, r = e.exports = {};
  6000. function s() {
  6001. throw new Error("setTimeout has not been defined")
  6002. }
  6003. function a() {
  6004. throw new Error("clearTimeout has not been defined")
  6005. }
  6006. function o(e) {
  6007. if (n === setTimeout)
  6008. return setTimeout(e, 0);
  6009. if ((n === s || !n) && setTimeout)
  6010. return n = setTimeout,
  6011. setTimeout(e, 0);
  6012. try {
  6013. return n(e, 0)
  6014. } catch (t) {
  6015. try {
  6016. return n.call(null, e, 0)
  6017. } catch (t) {
  6018. return n.call(this, e, 0)
  6019. }
  6020. }
  6021. }
  6022. !function() {
  6023. try {
  6024. n = "function" == typeof setTimeout ? setTimeout : s
  6025. } catch (e) {
  6026. n = s
  6027. }
  6028. try {
  6029. i = "function" == typeof clearTimeout ? clearTimeout : a
  6030. } catch (e) {
  6031. i = a
  6032. }
  6033. }();
  6034. var c, l = [], h = !1, u = -1;
  6035. function f() {
  6036. h && c && (h = !1,
  6037. c.length ? l = c.concat(l) : u = -1,
  6038. l.length && d())
  6039. }
  6040. function d() {
  6041. if (!h) {
  6042. var e = o(f);
  6043. h = !0;
  6044. for (var t = l.length; t; ) {
  6045. for (c = l,
  6046. l = []; ++u < t; )
  6047. c && c[u].run();
  6048. u = -1,
  6049. t = l.length
  6050. }
  6051. c = null,
  6052. h = !1,
  6053. function(e) {
  6054. if (i === clearTimeout)
  6055. return clearTimeout(e);
  6056. if ((i === a || !i) && clearTimeout)
  6057. return i = clearTimeout,
  6058. clearTimeout(e);
  6059. try {
  6060. i(e)
  6061. } catch (t) {
  6062. try {
  6063. return i.call(null, e)
  6064. } catch (t) {
  6065. return i.call(this, e)
  6066. }
  6067. }
  6068. }(e)
  6069. }
  6070. }
  6071. function p(e, t) {
  6072. this.fun = e,
  6073. this.array = t
  6074. }
  6075. function g() {}
  6076. r.nextTick = function(e) {
  6077. var t = new Array(arguments.length - 1);
  6078. if (arguments.length > 1)
  6079. for (var n = 1; n < arguments.length; n++)
  6080. t[n - 1] = arguments[n];
  6081. l.push(new p(e,t)),
  6082. 1 !== l.length || h || o(d)
  6083. }
  6084. ,
  6085. p.prototype.run = function() {
  6086. this.fun.apply(null, this.array)
  6087. }
  6088. ,
  6089. r.title = "browser",
  6090. r.browser = !0,
  6091. r.env = {},
  6092. r.argv = [],
  6093. r.version = "",
  6094. r.versions = {},
  6095. r.on = g,
  6096. r.addListener = g,
  6097. r.once = g,
  6098. r.off = g,
  6099. r.removeListener = g,
  6100. r.removeAllListeners = g,
  6101. r.emit = g,
  6102. r.prependListener = g,
  6103. r.prependOnceListener = g,
  6104. r.listeners = function(e) {
  6105. return []
  6106. }
  6107. ,
  6108. r.binding = function(e) {
  6109. throw new Error("process.binding is not supported")
  6110. }
  6111. ,
  6112. r.cwd = function() {
  6113. return "/"
  6114. }
  6115. ,
  6116. r.chdir = function(e) {
  6117. throw new Error("process.chdir is not supported")
  6118. }
  6119. ,
  6120. r.umask = function() {
  6121. return 0
  6122. }
  6123. }
  6124. , function(e, t) {
  6125. var n = Math.abs
  6126. , i = (Math.cos,
  6127. Math.sin,
  6128. Math.pow,
  6129. Math.sqrt)
  6130. , r = (n = Math.abs,
  6131. Math.atan2)
  6132. , s = Math.PI;
  6133. e.exports.randInt = function(e, t) {
  6134. return Math.floor(Math.random() * (t - e + 1)) + e
  6135. }
  6136. ,
  6137. e.exports.randFloat = function(e, t) {
  6138. return Math.random() * (t - e + 1) + e
  6139. }
  6140. ,
  6141. e.exports.lerp = function(e, t, n) {
  6142. return e + (t - e) * n
  6143. }
  6144. ,
  6145. e.exports.decel = function(e, t) {
  6146. return e > 0 ? e = Math.max(0, e - t) : e < 0 && (e = Math.min(0, e + t)),
  6147. e
  6148. }
  6149. ,
  6150. e.exports.getDistance = function(e, t, n, r) {
  6151. return i((n -= e) * n + (r -= t) * r)
  6152. }
  6153. ,
  6154. e.exports.getDirection = function(e, t, n, i) {
  6155. return r(t - i, e - n)
  6156. }
  6157. ,
  6158. e.exports.getAngleDist = function(e, t) {
  6159. var i = n(t - e) % (2 * s);
  6160. return i > s ? 2 * s - i : i
  6161. }
  6162. ,
  6163. e.exports.isNumber = function(e) {
  6164. return "number" == typeof e && !isNaN(e) && isFinite(e)
  6165. }
  6166. ,
  6167. e.exports.isString = function(e) {
  6168. return e && "string" == typeof e
  6169. }
  6170. ,
  6171. e.exports.kFormat = function(e) {
  6172. return e > 999 ? (e / 1e3).toFixed(1) + "k" : e
  6173. }
  6174. ,
  6175. e.exports.capitalizeFirst = function(e) {
  6176. return e.charAt(0).toUpperCase() + e.slice(1)
  6177. }
  6178. ,
  6179. e.exports.fixTo = function(e, t) {
  6180. return parseFloat(e.toFixed(t))
  6181. }
  6182. ,
  6183. e.exports.sortByPoints = function(e, t) {
  6184. return parseFloat(t.points) - parseFloat(e.points)
  6185. }
  6186. ,
  6187. e.exports.lineInRect = function(e, t, n, i, r, s, a, o) {
  6188. var c = r
  6189. , l = a;
  6190. if (r > a && (c = a,
  6191. l = r),
  6192. l > n && (l = n),
  6193. c < e && (c = e),
  6194. c > l)
  6195. return !1;
  6196. var h = s
  6197. , u = o
  6198. , f = a - r;
  6199. if (Math.abs(f) > 1e-7) {
  6200. var d = (o - s) / f
  6201. , p = s - d * r;
  6202. h = d * c + p,
  6203. u = d * l + p
  6204. }
  6205. if (h > u) {
  6206. var g = u;
  6207. u = h,
  6208. h = g
  6209. }
  6210. return u > i && (u = i),
  6211. h < t && (h = t),
  6212. !(h > u)
  6213. }
  6214. ,
  6215. e.exports.containsPoint = function(e, t, n) {
  6216. var i = e.getBoundingClientRect()
  6217. , r = i.left + window.scrollX
  6218. , s = i.top + window.scrollY
  6219. , a = i.width
  6220. , o = i.height;
  6221. return t > r && t < r + a && n > s && n < s + o
  6222. }
  6223. ,
  6224. e.exports.mousifyTouchEvent = function(e) {
  6225. var t = e.changedTouches[0];
  6226. e.screenX = t.screenX,
  6227. e.screenY = t.screenY,
  6228. e.clientX = t.clientX,
  6229. e.clientY = t.clientY,
  6230. e.pageX = t.pageX,
  6231. e.pageY = t.pageY
  6232. }
  6233. ,
  6234. e.exports.hookTouchEvents = function(t, n) {
  6235. var i = !n
  6236. , r = !1;
  6237. function s(n) {
  6238. e.exports.mousifyTouchEvent(n),
  6239. window.setUsingTouch(!0),
  6240. i && (n.preventDefault(),
  6241. n.stopPropagation()),
  6242. r && (t.onclick && t.onclick(n),
  6243. t.onmouseout && t.onmouseout(n),
  6244. r = !1)
  6245. }
  6246. t.addEventListener("touchstart", e.exports.checkTrusted((function(n) {
  6247. e.exports.mousifyTouchEvent(n),
  6248. window.setUsingTouch(!0),
  6249. i && (n.preventDefault(),
  6250. n.stopPropagation()),
  6251. t.onmouseover && t.onmouseover(n),
  6252. r = !0
  6253. }
  6254. )), !1),
  6255. t.addEventListener("touchmove", e.exports.checkTrusted((function(n) {
  6256. e.exports.mousifyTouchEvent(n),
  6257. window.setUsingTouch(!0),
  6258. i && (n.preventDefault(),
  6259. n.stopPropagation()),
  6260. e.exports.containsPoint(t, n.pageX, n.pageY) ? r || (t.onmouseover && t.onmouseover(n),
  6261. r = !0) : r && (t.onmouseout && t.onmouseout(n),
  6262. r = !1)
  6263. }
  6264. )), !1),
  6265. t.addEventListener("touchend", e.exports.checkTrusted(s), !1),
  6266. t.addEventListener("touchcancel", e.exports.checkTrusted(s), !1),
  6267. t.addEventListener("touchleave", e.exports.checkTrusted(s), !1)
  6268. }
  6269. ,
  6270. e.exports.removeAllChildren = function(e) {
  6271. for (; e.hasChildNodes(); )
  6272. e.removeChild(e.lastChild)
  6273. }
  6274. ,
  6275. e.exports.generateElement = function(t) {
  6276. var n = document.createElement(t.tag || "div");
  6277. function i(e, i) {
  6278. t[e] && (n[i] = t[e])
  6279. }
  6280. for (var r in i("text", "textContent"),
  6281. i("html", "innerHTML"),
  6282. i("class", "className"),
  6283. t) {
  6284. switch (r) {
  6285. case "tag":
  6286. case "text":
  6287. case "html":
  6288. case "class":
  6289. case "style":
  6290. case "hookTouch":
  6291. case "parent":
  6292. case "children":
  6293. continue
  6294. }
  6295. n[r] = t[r]
  6296. }
  6297. if (n.onclick && (n.onclick = e.exports.checkTrusted(n.onclick)),
  6298. n.onmouseover && (n.onmouseover = e.exports.checkTrusted(n.onmouseover)),
  6299. n.onmouseout && (n.onmouseout = e.exports.checkTrusted(n.onmouseout)),
  6300. t.style && (n.style.cssText = t.style),
  6301. t.hookTouch && e.exports.hookTouchEvents(n),
  6302. t.parent && t.parent.appendChild(n),
  6303. t.children)
  6304. for (var s = 0; s < t.children.length; s++)
  6305. n.appendChild(t.children[s]);
  6306. return n
  6307. }
  6308. ,
  6309. e.exports.eventIsTrusted = function(e) {
  6310. return !e || "boolean" != typeof e.isTrusted || e.isTrusted
  6311. }
  6312. ,
  6313. e.exports.checkTrusted = function(t) {
  6314. return function(n) {
  6315. n && n instanceof Event && e.exports.eventIsTrusted(n) && t(n)
  6316. }
  6317. }
  6318. ,
  6319. e.exports.randomString = function(e) {
  6320. for (var t = "", n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", i = 0; i < e; i++)
  6321. t += n.charAt(Math.floor(Math.random() * n.length));
  6322. return t
  6323. }
  6324. ,
  6325. e.exports.countInArray = function(e, t) {
  6326. for (var n = 0, i = 0; i < e.length; i++)
  6327. e[i] === t && n++;
  6328. return n
  6329. }
  6330. }
  6331. , function(e, t) {
  6332. e.exports.AnimText = function() {
  6333. this.init = function(e, t, n, i, r, s, a) {
  6334. this.x = e,
  6335. this.y = t,
  6336. this.color = a,
  6337. this.scale = n,
  6338. this.startScale = this.scale,
  6339. this.maxScale = 1.5 * n,
  6340. this.scaleSpeed = .7,
  6341. this.speed = i,
  6342. this.life = r,
  6343. this.text = s
  6344. }
  6345. ,
  6346. this.update = function(e) {
  6347. this.life && (this.life -= e,
  6348. this.y -= this.speed * e,
  6349. this.scale += this.scaleSpeed * e,
  6350. this.scale >= this.maxScale ? (this.scale = this.maxScale,
  6351. this.scaleSpeed *= -1) : this.scale <= this.startScale && (this.scale = this.startScale,
  6352. this.scaleSpeed = 0),
  6353. this.life <= 0 && (this.life = 0))
  6354. }
  6355. ,
  6356. this.render = function(e, t, n) {
  6357. e.fillStyle = this.color,
  6358. e.font = this.scale + "px Hammersmith One",
  6359. e.fillText(this.text, this.x - t, this.y - n)
  6360. }
  6361. }
  6362. ,
  6363. e.exports.TextManager = function() {
  6364. this.texts = [],
  6365. this.update = function(e, t, n, i) {
  6366. t.textBaseline = "middle",
  6367. t.textAlign = "center";
  6368. for (var r = 0; r < this.texts.length; ++r)
  6369. this.texts[r].life && (this.texts[r].update(e),
  6370. this.texts[r].render(t, n, i))
  6371. }
  6372. ,
  6373. this.showText = function(t, n, i, r, s, a, o) {
  6374. for (var c, l = 0; l < this.texts.length; ++l)
  6375. if (!this.texts[l].life) {
  6376. c = this.texts[l];
  6377. break
  6378. }
  6379. c || (c = new e.exports.AnimText,
  6380. this.texts.push(c)),
  6381. c.init(t, n, i, r, s, a, o)
  6382. }
  6383. }
  6384. }
  6385. , function(e, t) {
  6386. e.exports = function(e) {
  6387. this.sid = e,
  6388. this.init = function(e, t, n, i, r, s, a) {
  6389. s = s || {},
  6390. this.sentTo = {},
  6391. this.gridLocations = [],
  6392. this.active = !0,
  6393. this.doUpdate = s.doUpdate,
  6394. this.x = e,
  6395. this.y = t,
  6396. this.dir = n,
  6397. this.xWiggle = 0,
  6398. this.yWiggle = 0,
  6399. this.scale = i,
  6400. this.type = r,
  6401. this.id = s.id,
  6402. this.owner = a,
  6403. this.name = s.name,
  6404. this.isItem = null != this.id,
  6405. this.group = s.group,
  6406. this.health = s.health,
  6407. this.layer = 2,
  6408. null != this.group ? this.layer = this.group.layer : 0 == this.type ? this.layer = 3 : 2 == this.type ? this.layer = 0 : 4 == this.type && (this.layer = -1),
  6409. this.colDiv = s.colDiv || 1,
  6410. this.blocker = s.blocker,
  6411. this.ignoreCollision = s.ignoreCollision,
  6412. this.dontGather = s.dontGather,
  6413. this.hideFromEnemy = s.hideFromEnemy,
  6414. this.friction = s.friction,
  6415. this.projDmg = s.projDmg,
  6416. this.dmg = s.dmg,
  6417. this.pDmg = s.pDmg,
  6418. this.pps = s.pps,
  6419. this.zIndex = s.zIndex || 0,
  6420. this.turnSpeed = s.turnSpeed,
  6421. this.req = s.req,
  6422. this.trap = s.trap,
  6423. this.healCol = s.healCol,
  6424. this.teleport = s.teleport,
  6425. this.boostSpeed = s.boostSpeed,
  6426. this.projectile = s.projectile,
  6427. this.shootRange = s.shootRange,
  6428. this.shootRate = s.shootRate,
  6429. this.shootCount = this.shootRate,
  6430. this.spawnPoint = s.spawnPoint
  6431. }
  6432. ,
  6433. this.changeHealth = function(e, t) {
  6434. return this.health += e,
  6435. this.health <= 0
  6436. }
  6437. ,
  6438. this.getScale = function(e, t) {
  6439. return e = e || 1,
  6440. this.scale * (this.isItem || 2 == this.type || 3 == this.type || 4 == this.type ? 1 : .6 * e) * (t ? 1 : this.colDiv)
  6441. }
  6442. ,
  6443. this.visibleToPlayer = function(e) {
  6444. return !this.hideFromEnemy || this.owner && (this.owner == e || this.owner.team && e.team == this.owner.team)
  6445. }
  6446. ,
  6447. this.update = function(e) {
  6448. this.active && (this.xWiggle && (this.xWiggle *= Math.pow(.99, e)),
  6449. this.yWiggle && (this.yWiggle *= Math.pow(.99, e)),
  6450. this.turnSpeed && (this.dir += this.turnSpeed * e))
  6451. }
  6452. }
  6453. }
  6454. , function(e, t) {
  6455. e.exports.groups = [{
  6456. id: 0,
  6457. name: "food",
  6458. layer: 0
  6459. }, {
  6460. id: 1,
  6461. name: "walls",
  6462. place: !0,
  6463. limit: 30,
  6464. layer: 0
  6465. }, {
  6466. id: 2,
  6467. name: "spikes",
  6468. place: !0,
  6469. limit: 15,
  6470. layer: 0
  6471. }, {
  6472. id: 3,
  6473. name: "mill",
  6474. place: !0,
  6475. limit: 7,
  6476. layer: 1
  6477. }, {
  6478. id: 4,
  6479. name: "mine",
  6480. place: !0,
  6481. limit: 1,
  6482. layer: 0
  6483. }, {
  6484. id: 5,
  6485. name: "trap",
  6486. place: !0,
  6487. limit: 6,
  6488. layer: -1
  6489. }, {
  6490. id: 6,
  6491. name: "booster",
  6492. place: !0,
  6493. limit: 12,
  6494. layer: -1
  6495. }, {
  6496. id: 7,
  6497. name: "turret",
  6498. place: !0,
  6499. limit: 2,
  6500. layer: 1
  6501. }, {
  6502. id: 8,
  6503. name: "watchtower",
  6504. place: !0,
  6505. limit: 12,
  6506. layer: 1
  6507. }, {
  6508. id: 9,
  6509. name: "buff",
  6510. place: !0,
  6511. limit: 4,
  6512. layer: -1
  6513. }, {
  6514. id: 10,
  6515. name: "spawn",
  6516. place: !0,
  6517. limit: 1,
  6518. layer: -1
  6519. }, {
  6520. id: 11,
  6521. name: "sapling",
  6522. place: !0,
  6523. limit: 2,
  6524. layer: 0
  6525. }, {
  6526. id: 12,
  6527. name: "blocker",
  6528. place: !0,
  6529. limit: 3,
  6530. layer: -1
  6531. }, {
  6532. id: 13,
  6533. name: "teleporter",
  6534. place: !0,
  6535. limit: 2,
  6536. layer: -1
  6537. }],
  6538. t.projectiles = [{
  6539. indx: 0,
  6540. layer: 0,
  6541. src: "arrow_1",
  6542. dmg: 25,
  6543. speed: 1.6,
  6544. scale: 103,
  6545. range: 1e3
  6546. }, {
  6547. indx: 1,
  6548. layer: 1,
  6549. dmg: 25,
  6550. scale: 20
  6551. }, {
  6552. indx: 0,
  6553. layer: 0,
  6554. src: "arrow_1",
  6555. dmg: 35,
  6556. speed: 2.5,
  6557. scale: 103,
  6558. range: 1200
  6559. }, {
  6560. indx: 0,
  6561. layer: 0,
  6562. src: "arrow_1",
  6563. dmg: 30,
  6564. speed: 2,
  6565. scale: 103,
  6566. range: 1200
  6567. }, {
  6568. indx: 1,
  6569. layer: 1,
  6570. dmg: 16,
  6571. scale: 20
  6572. }, {
  6573. indx: 0,
  6574. layer: 0,
  6575. src: "bullet_1",
  6576. dmg: 50,
  6577. speed: 3.6,
  6578. scale: 160,
  6579. range: 1400
  6580. }],
  6581. t.weapons = [{
  6582. id: 0,
  6583. type: 0,
  6584. name: "tool hammer",
  6585. desc: "tool for gathering all resources",
  6586. src: "hammer_1",
  6587. length: 140,
  6588. width: 140,
  6589. xOff: -3,
  6590. yOff: 18,
  6591. dmg: 25,
  6592. range: 65,
  6593. gather: 1,
  6594. speed: 300
  6595. }, {
  6596. id: 1,
  6597. type: 0,
  6598. age: 2,
  6599. name: "hand axe",
  6600. desc: "gathers resources at a higher rate",
  6601. src: "axe_1",
  6602. length: 140,
  6603. width: 140,
  6604. xOff: 3,
  6605. yOff: 24,
  6606. dmg: 30,
  6607. spdMult: 1,
  6608. range: 70,
  6609. gather: 2,
  6610. speed: 400
  6611. }, {
  6612. id: 2,
  6613. type: 0,
  6614. age: 8,
  6615. pre: 1,
  6616. name: "great axe",
  6617. desc: "deal more damage and gather more resources",
  6618. src: "great_axe_1",
  6619. length: 140,
  6620. width: 140,
  6621. xOff: -8,
  6622. yOff: 25,
  6623. dmg: 35,
  6624. spdMult: 1,
  6625. range: 75,
  6626. gather: 4,
  6627. speed: 400
  6628. }, {
  6629. id: 3,
  6630. type: 0,
  6631. age: 2,
  6632. name: "short sword",
  6633. desc: "increased attack power but slower move speed",
  6634. src: "sword_1",
  6635. iPad: 1.3,
  6636. length: 130,
  6637. width: 210,
  6638. xOff: -8,
  6639. yOff: 46,
  6640. dmg: 35,
  6641. spdMult: .85,
  6642. range: 110,
  6643. gather: 1,
  6644. speed: 300
  6645. }, {
  6646. id: 4,
  6647. type: 0,
  6648. age: 8,
  6649. pre: 3,
  6650. name: "katana",
  6651. desc: "greater range and damage",
  6652. src: "samurai_1",
  6653. iPad: 1.3,
  6654. length: 130,
  6655. width: 210,
  6656. xOff: -8,
  6657. yOff: 59,
  6658. dmg: 40,
  6659. spdMult: .8,
  6660. range: 118,
  6661. gather: 1,
  6662. speed: 300
  6663. }, {
  6664. id: 5,
  6665. type: 0,
  6666. age: 2,
  6667. name: "polearm",
  6668. desc: "long range melee weapon",
  6669. src: "spear_1",
  6670. iPad: 1.3,
  6671. length: 130,
  6672. width: 210,
  6673. xOff: -8,
  6674. yOff: 53,
  6675. dmg: 45,
  6676. knock: .2,
  6677. spdMult: .82,
  6678. range: 142,
  6679. gather: 1,
  6680. speed: 700
  6681. }, {
  6682. id: 6,
  6683. type: 0,
  6684. age: 2,
  6685. name: "bat",
  6686. desc: "fast long range melee weapon",
  6687. src: "bat_1",
  6688. iPad: 1.3,
  6689. length: 110,
  6690. width: 180,
  6691. xOff: -8,
  6692. yOff: 53,
  6693. dmg: 20,
  6694. knock: .7,
  6695. range: 110,
  6696. gather: 1,
  6697. speed: 300
  6698. }, {
  6699. id: 7,
  6700. type: 0,
  6701. age: 2,
  6702. name: "daggers",
  6703. desc: "really fast short range weapon",
  6704. src: "dagger_1",
  6705. iPad: .8,
  6706. length: 110,
  6707. width: 110,
  6708. xOff: 18,
  6709. yOff: 0,
  6710. dmg: 20,
  6711. knock: .1,
  6712. range: 65,
  6713. gather: 1,
  6714. hitSlow: .1,
  6715. spdMult: 1.13,
  6716. speed: 100
  6717. }, {
  6718. id: 8,
  6719. type: 0,
  6720. age: 2,
  6721. name: "stick",
  6722. desc: "great for gathering but very weak",
  6723. src: "stick_1",
  6724. length: 140,
  6725. width: 140,
  6726. xOff: 3,
  6727. yOff: 24,
  6728. dmg: 1,
  6729. spdMult: 1,
  6730. range: 70,
  6731. gather: 7,
  6732. speed: 400
  6733. }, {
  6734. id: 9,
  6735. type: 1,
  6736. age: 6,
  6737. name: "hunting bow",
  6738. desc: "bow used for ranged combat and hunting",
  6739. src: "bow_1",
  6740. req: ["wood", 4],
  6741. length: 120,
  6742. width: 120,
  6743. xOff: -6,
  6744. yOff: 0,
  6745. projectile: 0,
  6746. spdMult: .75,
  6747. speed: 600
  6748. }, {
  6749. id: 10,
  6750. type: 1,
  6751. age: 6,
  6752. name: "great hammer",
  6753. desc: "hammer used for destroying structures",
  6754. src: "great_hammer_1",
  6755. length: 140,
  6756. width: 140,
  6757. xOff: -9,
  6758. yOff: 25,
  6759. dmg: 10,
  6760. spdMult: .88,
  6761. range: 75,
  6762. sDmg: 7.5,
  6763. gather: 1,
  6764. speed: 400
  6765. }, {
  6766. id: 11,
  6767. type: 1,
  6768. age: 6,
  6769. name: "wooden shield",
  6770. desc: "blocks projectiles and reduces melee damage",
  6771. src: "shield_1",
  6772. length: 120,
  6773. width: 120,
  6774. shield: .2,
  6775. xOff: 6,
  6776. yOff: 0,
  6777. spdMult: .7
  6778. }, {
  6779. id: 12,
  6780. type: 1,
  6781. age: 8,
  6782. pre: 9,
  6783. name: "crossbow",
  6784. desc: "deals more damage and has greater range",
  6785. src: "crossbow_1",
  6786. req: ["wood", 5],
  6787. aboveHand: !0,
  6788. armS: .75,
  6789. length: 120,
  6790. width: 120,
  6791. xOff: -4,
  6792. yOff: 0,
  6793. projectile: 2,
  6794. spdMult: .7,
  6795. speed: 700
  6796. }, {
  6797. id: 13,
  6798. type: 1,
  6799. age: 9,
  6800. pre: 12,
  6801. name: "repeater crossbow",
  6802. desc: "high firerate crossbow with reduced damage",
  6803. src: "crossbow_2",
  6804. req: ["wood", 10],
  6805. aboveHand: !0,
  6806. armS: .75,
  6807. length: 120,
  6808. width: 120,
  6809. xOff: -4,
  6810. yOff: 0,
  6811. projectile: 3,
  6812. spdMult: .7,
  6813. speed: 230
  6814. }, {
  6815. id: 14,
  6816. type: 1,
  6817. age: 6,
  6818. name: "mc grabby",
  6819. desc: "steals resources from enemies",
  6820. src: "grab_1",
  6821. length: 130,
  6822. width: 210,
  6823. xOff: -8,
  6824. yOff: 53,
  6825. dmg: 0,
  6826. steal: 250,
  6827. knock: .2,
  6828. spdMult: 1.05,
  6829. range: 125,
  6830. gather: 0,
  6831. speed: 700
  6832. }, {
  6833. id: 15,
  6834. type: 1,
  6835. age: 9,
  6836. pre: 12,
  6837. name: "musket",
  6838. desc: "slow firerate but high damage and range",
  6839. src: "musket_1",
  6840. req: ["stone", 10],
  6841. aboveHand: !0,
  6842. rec: .35,
  6843. armS: .6,
  6844. hndS: .3,
  6845. hndD: 1.6,
  6846. length: 205,
  6847. width: 205,
  6848. xOff: 25,
  6849. yOff: 0,
  6850. projectile: 5,
  6851. hideProjectile: !0,
  6852. spdMult: .6,
  6853. speed: 1500
  6854. }],
  6855. e.exports.list = [{
  6856. group: e.exports.groups[0],
  6857. name: "apple",
  6858. desc: "restores 20 health when consumed",
  6859. req: ["food", 10],
  6860. consume: function(e) {
  6861. return e.changeHealth(20, e)
  6862. },
  6863. scale: 22,
  6864. holdOffset: 15
  6865. }, {
  6866. age: 3,
  6867. group: e.exports.groups[0],
  6868. name: "cookie",
  6869. desc: "restores 40 health when consumed",
  6870. req: ["food", 15],
  6871. consume: function(e) {
  6872. return e.changeHealth(40, e)
  6873. },
  6874. scale: 27,
  6875. holdOffset: 15
  6876. }, {
  6877. age: 7,
  6878. group: e.exports.groups[0],
  6879. name: "cheese",
  6880. desc: "restores 30 health and another 50 over 5 seconds",
  6881. req: ["food", 25],
  6882. consume: function(e) {
  6883. return !!(e.changeHealth(30, e) || e.health < 100) && (e.dmgOverTime.dmg = -10,
  6884. e.dmgOverTime.doer = e,
  6885. e.dmgOverTime.time = 5,
  6886. !0)
  6887. },
  6888. scale: 27,
  6889. holdOffset: 15
  6890. }, {
  6891. group: e.exports.groups[1],
  6892. name: "wood wall",
  6893. desc: "provides protection for your village",
  6894. req: ["wood", 10],
  6895. projDmg: !0,
  6896. health: 380,
  6897. scale: 50,
  6898. holdOffset: 20,
  6899. placeOffset: -5
  6900. }, {
  6901. age: 3,
  6902. group: e.exports.groups[1],
  6903. name: "stone wall",
  6904. desc: "provides improved protection for your village",
  6905. req: ["stone", 25],
  6906. health: 900,
  6907. scale: 50,
  6908. holdOffset: 20,
  6909. placeOffset: -5
  6910. }, {
  6911. age: 7,
  6912. pre: 1,
  6913. group: e.exports.groups[1],
  6914. name: "castle wall",
  6915. desc: "provides powerful protection for your village",
  6916. req: ["stone", 35],
  6917. health: 1500,
  6918. scale: 52,
  6919. holdOffset: 20,
  6920. placeOffset: -5
  6921. }, {
  6922. group: e.exports.groups[2],
  6923. name: "spikes",
  6924. desc: "damages enemies when they touch them",
  6925. req: ["wood", 20, "stone", 5],
  6926. health: 400,
  6927. dmg: 20,
  6928. scale: 49,
  6929. spritePadding: -23,
  6930. holdOffset: 8,
  6931. placeOffset: -5
  6932. }, {
  6933. age: 5,
  6934. group: e.exports.groups[2],
  6935. name: "greater spikes",
  6936. desc: "damages enemies when they touch them",
  6937. req: ["wood", 30, "stone", 10],
  6938. health: 500,
  6939. dmg: 35,
  6940. scale: 52,
  6941. spritePadding: -23,
  6942. holdOffset: 8,
  6943. placeOffset: -5
  6944. }, {
  6945. age: 9,
  6946. pre: 1,
  6947. group: e.exports.groups[2],
  6948. name: "poison spikes",
  6949. desc: "poisons enemies when they touch them",
  6950. req: ["wood", 35, "stone", 15],
  6951. health: 600,
  6952. dmg: 30,
  6953. pDmg: 5,
  6954. scale: 52,
  6955. spritePadding: -23,
  6956. holdOffset: 8,
  6957. placeOffset: -5
  6958. }, {
  6959. age: 9,
  6960. pre: 2,
  6961. group: e.exports.groups[2],
  6962. name: "spinning spikes",
  6963. desc: "damages enemies when they touch them",
  6964. req: ["wood", 30, "stone", 20],
  6965. health: 500,
  6966. dmg: 45,
  6967. turnSpeed: .003,
  6968. scale: 52,
  6969. spritePadding: -23,
  6970. holdOffset: 8,
  6971. placeOffset: -5
  6972. }, {
  6973. group: e.exports.groups[3],
  6974. name: "windmill",
  6975. desc: "generates gold over time",
  6976. req: ["wood", 50, "stone", 10],
  6977. health: 400,
  6978. pps: 1,
  6979. turnSpeed: .0016,
  6980. spritePadding: 25,
  6981. iconLineMult: 12,
  6982. scale: 45,
  6983. holdOffset: 20,
  6984. placeOffset: 5
  6985. }, {
  6986. age: 5,
  6987. pre: 1,
  6988. group: e.exports.groups[3],
  6989. name: "faster windmill",
  6990. desc: "generates more gold over time",
  6991. req: ["wood", 60, "stone", 20],
  6992. health: 500,
  6993. pps: 1.5,
  6994. turnSpeed: .0025,
  6995. spritePadding: 25,
  6996. iconLineMult: 12,
  6997. scale: 47,
  6998. holdOffset: 20,
  6999. placeOffset: 5
  7000. }, {
  7001. age: 8,
  7002. pre: 1,
  7003. group: e.exports.groups[3],
  7004. name: "power mill",
  7005. desc: "generates more gold over time",
  7006. req: ["wood", 100, "stone", 50],
  7007. health: 800,
  7008. pps: 2,
  7009. turnSpeed: .005,
  7010. spritePadding: 25,
  7011. iconLineMult: 12,
  7012. scale: 47,
  7013. holdOffset: 20,
  7014. placeOffset: 5
  7015. }, {
  7016. age: 5,
  7017. group: e.exports.groups[4],
  7018. type: 2,
  7019. name: "mine",
  7020. desc: "allows you to mine stone",
  7021. req: ["wood", 20, "stone", 100],
  7022. iconLineMult: 12,
  7023. scale: 65,
  7024. holdOffset: 20,
  7025. placeOffset: 0
  7026. }, {
  7027. age: 5,
  7028. group: e.exports.groups[11],
  7029. type: 0,
  7030. name: "sapling",
  7031. desc: "allows you to farm wood",
  7032. req: ["wood", 150],
  7033. iconLineMult: 12,
  7034. colDiv: .5,
  7035. scale: 110,
  7036. holdOffset: 50,
  7037. placeOffset: -15
  7038. }, {
  7039. age: 4,
  7040. group: e.exports.groups[5],
  7041. name: "pit trap",
  7042. desc: "pit that traps enemies if they walk over it",
  7043. req: ["wood", 30, "stone", 30],
  7044. trap: !0,
  7045. ignoreCollision: !0,
  7046. hideFromEnemy: !0,
  7047. health: 500,
  7048. colDiv: .2,
  7049. scale: 50,
  7050. holdOffset: 20,
  7051. placeOffset: -5
  7052. }, {
  7053. age: 4,
  7054. group: e.exports.groups[6],
  7055. name: "boost pad",
  7056. desc: "provides boost when stepped on",
  7057. req: ["stone", 20, "wood", 5],
  7058. ignoreCollision: !0,
  7059. boostSpeed: 1.5,
  7060. health: 150,
  7061. colDiv: .7,
  7062. scale: 45,
  7063. holdOffset: 20,
  7064. placeOffset: -5
  7065. }, {
  7066. age: 7,
  7067. group: e.exports.groups[7],
  7068. doUpdate: !0,
  7069. name: "turret",
  7070. desc: "defensive structure that shoots at enemies",
  7071. req: ["wood", 200, "stone", 150],
  7072. health: 800,
  7073. projectile: 1,
  7074. shootRange: 700,
  7075. shootRate: 2200,
  7076. scale: 43,
  7077. holdOffset: 20,
  7078. placeOffset: -5
  7079. }, {
  7080. age: 7,
  7081. group: e.exports.groups[8],
  7082. name: "platform",
  7083. desc: "platform to shoot over walls and cross over water",
  7084. req: ["wood", 20],
  7085. ignoreCollision: !0,
  7086. zIndex: 1,
  7087. health: 300,
  7088. scale: 43,
  7089. holdOffset: 20,
  7090. placeOffset: -5
  7091. }, {
  7092. age: 7,
  7093. group: e.exports.groups[9],
  7094. name: "healing pad",
  7095. desc: "standing on it will slowly heal you",
  7096. req: ["wood", 30, "food", 10],
  7097. ignoreCollision: !0,
  7098. healCol: 15,
  7099. health: 400,
  7100. colDiv: .7,
  7101. scale: 45,
  7102. holdOffset: 20,
  7103. placeOffset: -5
  7104. }, {
  7105. age: 9,
  7106. group: e.exports.groups[10],
  7107. name: "spawn pad",
  7108. desc: "you will spawn here when you die but it will dissapear",
  7109. req: ["wood", 100, "stone", 100],
  7110. health: 400,
  7111. ignoreCollision: !0,
  7112. spawnPoint: !0,
  7113. scale: 45,
  7114. holdOffset: 20,
  7115. placeOffset: -5
  7116. }, {
  7117. age: 7,
  7118. group: e.exports.groups[12],
  7119. name: "blocker",
  7120. desc: "blocks building in radius",
  7121. req: ["wood", 30, "stone", 25],
  7122. ignoreCollision: !0,
  7123. blocker: 300,
  7124. health: 400,
  7125. colDiv: .7,
  7126. scale: 45,
  7127. holdOffset: 20,
  7128. placeOffset: -5
  7129. }, {
  7130. age: 7,
  7131. group: e.exports.groups[13],
  7132. name: "teleporter",
  7133. desc: "teleports you to a random point on the map",
  7134. req: ["wood", 60, "stone", 60],
  7135. ignoreCollision: !0,
  7136. teleport: !0,
  7137. health: 200,
  7138. colDiv: .7,
  7139. scale: 45,
  7140. holdOffset: 20,
  7141. placeOffset: -5
  7142. }];
  7143. for (var n = 0; n < e.exports.list.length; ++n)
  7144. e.exports.list[n].id = n,
  7145. e.exports.list[n].pre && (e.exports.list[n].pre = n - e.exports.list[n].pre)
  7146. }
  7147. , function(e, t) {
  7148. e.exports = {}
  7149. }
  7150. , function(e, t) {
  7151. var n = Math.floor
  7152. , i = Math.abs
  7153. , r = Math.cos
  7154. , s = Math.sin
  7155. , a = (Math.pow,
  7156. Math.sqrt);
  7157. e.exports = function(e, t, o, c, l, h) {
  7158. var u, f;
  7159. this.objects = t,
  7160. this.grids = {},
  7161. this.updateObjects = [];
  7162. var d = c.mapScale / c.colGrid;
  7163. this.setObjectGrids = function(e) {
  7164. for (var t = Math.min(c.mapScale, Math.max(0, e.x)), n = Math.min(c.mapScale, Math.max(0, e.y)), i = 0; i < c.colGrid; ++i) {
  7165. u = i * d;
  7166. for (var r = 0; r < c.colGrid; ++r)
  7167. f = r * d,
  7168. t + e.scale >= u && t - e.scale <= u + d && n + e.scale >= f && n - e.scale <= f + d && (this.grids[i + "_" + r] || (this.grids[i + "_" + r] = []),
  7169. this.grids[i + "_" + r].push(e),
  7170. e.gridLocations.push(i + "_" + r))
  7171. }
  7172. }
  7173. ,
  7174. this.removeObjGrid = function(e) {
  7175. for (var t, n = 0; n < e.gridLocations.length; ++n)
  7176. (t = this.grids[e.gridLocations[n]].indexOf(e)) >= 0 && this.grids[e.gridLocations[n]].splice(t, 1)
  7177. }
  7178. ,
  7179. this.disableObj = function(e) {
  7180. if (e.active = !1,
  7181. h) {
  7182. e.owner && e.pps && (e.owner.pps -= e.pps),
  7183. this.removeObjGrid(e);
  7184. var t = this.updateObjects.indexOf(e);
  7185. t >= 0 && this.updateObjects.splice(t, 1)
  7186. }
  7187. }
  7188. ,
  7189. this.hitObj = function(e, t) {
  7190. for (var n = 0; n < l.length; ++n)
  7191. l[n].active && (e.sentTo[l[n].id] && (e.active ? l[n].canSee(e) && h.send(l[n].id, "8", o.fixTo(t, 1), e.sid) : h.send(l[n].id, "12", e.sid)),
  7192. e.active || e.owner != l[n] || l[n].changeItemCount(e.group.id, -1))
  7193. }
  7194. ;
  7195. var p, g, m = [];
  7196. this.getGridArrays = function(e, t, i) {
  7197. u = n(e / d),
  7198. f = n(t / d),
  7199. m.length = 0;
  7200. try {
  7201. this.grids[u + "_" + f] && m.push(this.grids[u + "_" + f]),
  7202. e + i >= (u + 1) * d && ((p = this.grids[u + 1 + "_" + f]) && m.push(p),
  7203. f && t - i <= f * d ? (p = this.grids[u + 1 + "_" + (f - 1)]) && m.push(p) : t + i >= (f + 1) * d && (p = this.grids[u + 1 + "_" + (f + 1)]) && m.push(p)),
  7204. u && e - i <= u * d && ((p = this.grids[u - 1 + "_" + f]) && m.push(p),
  7205. f && t - i <= f * d ? (p = this.grids[u - 1 + "_" + (f - 1)]) && m.push(p) : t + i >= (f + 1) * d && (p = this.grids[u - 1 + "_" + (f + 1)]) && m.push(p)),
  7206. t + i >= (f + 1) * d && (p = this.grids[u + "_" + (f + 1)]) && m.push(p),
  7207. f && t - i <= f * d && (p = this.grids[u + "_" + (f - 1)]) && m.push(p)
  7208. } catch (e) {}
  7209. return m
  7210. }
  7211. ,
  7212. this.add = function(n, i, r, s, a, o, c, l, u) {
  7213. g = null;
  7214. for (var f = 0; f < t.length; ++f)
  7215. if (t[f].sid == n) {
  7216. g = t[f];
  7217. break
  7218. }
  7219. if (!g)
  7220. for (f = 0; f < t.length; ++f)
  7221. if (!t[f].active) {
  7222. g = t[f];
  7223. break
  7224. }
  7225. g || (g = new e(n),
  7226. t.push(g)),
  7227. l && (g.sid = n),
  7228. g.init(i, r, s, a, o, c, u),
  7229. h && (this.setObjectGrids(g),
  7230. g.doUpdate && this.updateObjects.push(g));
  7231. Tach.addBuilding(g);
  7232. }
  7233. ,
  7234. this.disableBySid = function(e) {
  7235. for (var n = 0; n < t.length; ++n)
  7236. if (t[n].sid == e) {
  7237. this.disableObj(t[n]);
  7238. break
  7239. }
  7240. }
  7241. ,
  7242. this.removeAllItems = function(e, n) {
  7243. for (var i = 0; i < t.length; ++i)
  7244. t[i].active && t[i].owner && t[i].owner.sid == e && this.disableObj(t[i]);
  7245. n && n.broadcast("13", e)
  7246. }
  7247. ,
  7248. this.fetchSpawnObj = function(e) {
  7249. for (var n = null, i = 0; i < t.length; ++i)
  7250. if ((g = t[i]).active && g.owner && g.owner.sid == e && g.spawnPoint) {
  7251. n = [g.x, g.y],
  7252. this.disableObj(g),
  7253. h.broadcast("12", g.sid),
  7254. g.owner && g.owner.changeItemCount(g.group.id, -1);
  7255. break
  7256. }
  7257. return n
  7258. }
  7259. ,
  7260. this.checkItemLocation = function(e, n, i, r, s, a, l) {
  7261. for (var h = 0; h < t.length; ++h) {
  7262. var u = t[h].blocker ? t[h].blocker : t[h].getScale(r, t[h].isItem);
  7263. if (t[h].active && o.getDistance(e, n, t[h].x, t[h].y) < i + u)
  7264. return !1
  7265. }
  7266. return !(!a && 18 != s && n >= c.mapScale / 2 - c.riverWidth / 2 && n <= c.mapScale / 2 + c.riverWidth / 2)
  7267. }
  7268. ,
  7269. this.addProjectile = function(e, t, n, i, r) {
  7270. for (var s, a = items.projectiles[r], c = 0; c < projectiles.length; ++c)
  7271. if (!projectiles[c].active) {
  7272. s = projectiles[c];
  7273. break
  7274. }
  7275. s || (s = new Projectile(l,o),
  7276. projectiles.push(s)),
  7277. s.init(r, e, t, n, a.speed, i, a.scale)
  7278. }
  7279. ,
  7280. this.checkCollision = function(e, t, n) {
  7281. n = n || 1;
  7282. var l = e.x - t.x
  7283. , h = e.y - t.y
  7284. , u = e.scale + t.scale;
  7285. if (i(l) <= u || i(h) <= u) {
  7286. u = e.scale + (t.getScale ? t.getScale() : t.scale);
  7287. var f = a(l * l + h * h) - u;
  7288. if (f <= 0) {
  7289. if (t.ignoreCollision)
  7290. !t.trap || e.noTrap || t.owner == e || t.owner && t.owner.team && t.owner.team == e.team ? t.boostSpeed ? (e.xVel += n * t.boostSpeed * (t.weightM || 1) * r(t.dir),
  7291. e.yVel += n * t.boostSpeed * (t.weightM || 1) * s(t.dir)) : t.healCol ? e.healCol = t.healCol : t.teleport && (e.x = o.randInt(0, c.mapScale),
  7292. e.y = o.randInt(0, c.mapScale)) : (e.lockMove = !0,
  7293. t.hideFromEnemy = !1);
  7294. else {
  7295. var d = o.getDirection(e.x, e.y, t.x, t.y);
  7296. if (o.getDistance(e.x, e.y, t.x, t.y),
  7297. t.isPlayer ? (f = -1 * f / 2,
  7298. e.x += f * r(d),
  7299. e.y += f * s(d),
  7300. t.x -= f * r(d),
  7301. t.y -= f * s(d)) : (e.x = t.x + u * r(d),
  7302. e.y = t.y + u * s(d),
  7303. e.xVel *= .75,
  7304. e.yVel *= .75),
  7305. t.dmg && t.owner != e && (!t.owner || !t.owner.team || t.owner.team != e.team)) {
  7306. e.changeHealth(-t.dmg, t.owner, t);
  7307. var p = 1.5 * (t.weightM || 1);
  7308. e.xVel += p * r(d),
  7309. e.yVel += p * s(d),
  7310. !t.pDmg || e.skin && e.skin.poisonRes || (e.dmgOverTime.dmg = t.pDmg,
  7311. e.dmgOverTime.time = 5,
  7312. e.dmgOverTime.doer = t.owner),
  7313. e.colDmg && t.health && (t.changeHealth(-e.colDmg) && this.disableObj(t),
  7314. this.hitObj(t, o.getDirection(e.x, e.y, t.x, t.y)))
  7315. }
  7316. }
  7317. return t.zIndex > e.zIndex && (e.zIndex = t.zIndex),
  7318. !0
  7319. }
  7320. }
  7321. return !1
  7322. }
  7323. }
  7324. }
  7325. , function(e, t, n) {
  7326. var i = new (n(49));
  7327. i.addWords("jew", "black", "baby", "child", "white", "porn", "pedo", "trump", "clinton", "hitler", "nazi", "gay", "pride", "sex", "pleasure", "touch", "poo", "kids", "rape", "white power", "nigga", "nig nog", "doggy", "rapist", "boner", "nigger", "nigg", "finger", "nogger", "nagger", "nig", "fag", "gai", "pole", "stripper", "penis", "vagina", "pussy", "nazi", "hitler", "stalin", "burn", "chamber", "cock", "peen", "dick", "spick", "nieger", "die", "satan", "n|ig", "nlg", "cunt", "c0ck", "fag", "lick", "condom", "anal", "shit", "phile", "little", "kids", "free KR", "tiny", "sidney", "ass", "kill", ".io", "(dot)", "[dot]", "mini", "whiore", "whore", "faggot", "github", "1337", "666", "satan", "senpa", "discord", "d1scord", "mistik", ".io", "senpa.io", "sidney", "sid", "senpaio", "vries", "asa");
  7328. var r = Math.abs
  7329. , s = Math.cos
  7330. , a = Math.sin
  7331. , o = Math.pow
  7332. , c = Math.sqrt;
  7333. e.exports = function(e, t, n, l, h, u, f, d, p, g, m, y, k, v) {
  7334. this.id = e,
  7335. this.sid = t,
  7336. this.tmpScore = 0,
  7337. this.team = null,
  7338. this.skinIndex = 0,
  7339. this.tailIndex = 0,
  7340. this.hitTime = 0,
  7341. this.tails = {};
  7342. for (var w = 0; w < m.length; ++w)
  7343. m[w].price <= 0 && (this.tails[m[w].id] = 1);
  7344. for (this.skins = {},
  7345. w = 0; w < g.length; ++w)
  7346. g[w].price <= 0 && (this.skins[g[w].id] = 1);
  7347. this.points = 0,
  7348. this.dt = 0,
  7349. this.hidden = !1,
  7350. this.itemCounts = {},
  7351. this.isPlayer = !0,
  7352. this.pps = 0,
  7353. this.moveDir = void 0,
  7354. this.skinRot = 0,
  7355. this.lastPing = 0,
  7356. this.iconIndex = 0,
  7357. this.skinColor = 0,
  7358. this.spawn = function(e) {
  7359. this.active = !0,
  7360. this.alive = !0,
  7361. this.lockMove = !1,
  7362. this.lockDir = !1,
  7363. this.minimapCounter = 0,
  7364. this.chatCountdown = 0,
  7365. this.shameCount = 0,
  7366. this.shameTimer = 0,
  7367. this.sentTo = {},
  7368. this.gathering = 0,
  7369. this.autoGather = 0,
  7370. this.animTime = 0,
  7371. this.animSpeed = 0,
  7372. this.mouseState = 0,
  7373. this.buildIndex = -1,
  7374. this.weaponIndex = 0,
  7375. this.dmgOverTime = {},
  7376. this.noMovTimer = 0,
  7377. this.maxXP = 300,
  7378. this.XP = 0,
  7379. this.age = 1,
  7380. this.kills = 0,
  7381. this.upgrAge = 2,
  7382. this.upgradePoints = 0,
  7383. this.x = 0,
  7384. this.y = 0,
  7385. this.zIndex = 0,
  7386. this.xVel = 0,
  7387. this.yVel = 0,
  7388. this.slowMult = 1,
  7389. this.dir = 0,
  7390. this.dirPlus = 0,
  7391. this.targetDir = 0,
  7392. this.targetAngle = 0,
  7393. this.maxHealth = 100,
  7394. this.health = this.maxHealth,
  7395. this.scale = n.playerScale,
  7396. this.speed = n.playerSpeed,
  7397. this.resetMoveDir(),
  7398. this.resetResources(e),
  7399. this.items = [0, 3, 6, 10],
  7400. this.weapons = [0],
  7401. this.shootCount = 0,
  7402. this.weaponXP = [],
  7403. this.reloads = {}
  7404. }
  7405. ,
  7406. this.resetMoveDir = function() {
  7407. this.moveDir = void 0
  7408. }
  7409. ,
  7410. this.resetResources = function(e) {
  7411. for (var t = 0; t < n.resourceTypes.length; ++t)
  7412. this[n.resourceTypes[t]] = e ? 100 : 0
  7413. }
  7414. ,
  7415. this.addItem = function(e) {
  7416. var t = p.list[e];
  7417. if (t) {
  7418. for (var n = 0; n < this.items.length; ++n)
  7419. if (p.list[this.items[n]].group == t.group)
  7420. return this.buildIndex == this.items[n] && (this.buildIndex = e),
  7421. this.items[n] = e,
  7422. !0;
  7423. return this.items.push(e),
  7424. !0
  7425. }
  7426. return !1
  7427. }
  7428. ,
  7429. this.setUserData = function(e) {
  7430. if (e) {
  7431. this.name = "unknown";
  7432. var t = e.name + ""
  7433. , r = !1
  7434. , s = (t = (t = (t = (t = t.slice(0, n.maxNameLength)).replace(/[^\w:\(\)\/? -]+/gim, " ")).replace(/[^\x00-\x7F]/g, " ")).trim()).toLowerCase().replace(/\s/g, "").replace(/1/g, "i").replace(/0/g, "o").replace(/5/g, "s");
  7435. for (var a of i.list)
  7436. if (-1 != s.indexOf(a)) {
  7437. r = !0;
  7438. break
  7439. }
  7440. t.length > 0 && !r && (this.name = t),
  7441. this.skinColor = 0,
  7442. n.skinColors[e.skin] && (this.skinColor = e.skin)
  7443. }
  7444. }
  7445. ,
  7446. this.getData = function() {
  7447. return [this.id, this.sid, this.name, l.fixTo(this.x, 2), l.fixTo(this.y, 2), l.fixTo(this.dir, 3), this.health, this.maxHealth, this.scale, this.skinColor]
  7448. }
  7449. ,
  7450. this.setData = function(e) {
  7451. this.id = e[0],
  7452. this.sid = e[1],
  7453. this.name = e[2],
  7454. this.x = e[3],
  7455. this.y = e[4],
  7456. this.dir = e[5],
  7457. this.health = e[6],
  7458. this.maxHealth = e[7],
  7459. this.scale = e[8],
  7460. this.skinColor = e[9]
  7461. }
  7462. ;
  7463. var b = 0;
  7464. this.update = function(e) {
  7465. if (this.alive) {
  7466. if (this.shameTimer > 0 && (this.shameTimer -= e,
  7467. this.shameTimer <= 0 && (this.shameTimer = 0,
  7468. this.shameCount = 0)),
  7469. (b -= e) <= 0) {
  7470. var t = (this.skin && this.skin.healthRegen ? this.skin.healthRegen : 0) + (this.tail && this.tail.healthRegen ? this.tail.healthRegen : 0);
  7471. t && this.changeHealth(t, this),
  7472. this.dmgOverTime.dmg && (this.changeHealth(-this.dmgOverTime.dmg, this.dmgOverTime.doer),
  7473. this.dmgOverTime.time -= 1,
  7474. this.dmgOverTime.time <= 0 && (this.dmgOverTime.dmg = 0)),
  7475. this.healCol && this.changeHealth(this.healCol, this),
  7476. b = 1e3
  7477. }
  7478. if (this.alive) {
  7479. if (this.slowMult < 1 && (this.slowMult += 8e-4 * e,
  7480. this.slowMult > 1 && (this.slowMult = 1)),
  7481. this.noMovTimer += e,
  7482. (this.xVel || this.yVel) && (this.noMovTimer = 0),
  7483. this.lockMove)
  7484. this.xVel = 0,
  7485. this.yVel = 0;
  7486. else {
  7487. var i = (this.buildIndex >= 0 ? .5 : 1) * (p.weapons[this.weaponIndex].spdMult || 1) * (this.skin && this.skin.spdMult || 1) * (this.tail && this.tail.spdMult || 1) * (this.y <= n.snowBiomeTop ? this.skin && this.skin.coldM ? 1 : n.snowSpeed : 1) * this.slowMult;
  7488. !this.zIndex && this.y >= n.mapScale / 2 - n.riverWidth / 2 && this.y <= n.mapScale / 2 + n.riverWidth / 2 && (this.skin && this.skin.watrImm ? (i *= .75,
  7489. this.xVel += .4 * n.waterCurrent * e) : (i *= .33,
  7490. this.xVel += n.waterCurrent * e));
  7491. var r = null != this.moveDir ? s(this.moveDir) : 0
  7492. , d = null != this.moveDir ? a(this.moveDir) : 0
  7493. , g = c(r * r + d * d);
  7494. 0 != g && (r /= g,
  7495. d /= g),
  7496. r && (this.xVel += r * this.speed * i * e),
  7497. d && (this.yVel += d * this.speed * i * e)
  7498. }
  7499. var m;
  7500. this.zIndex = 0,
  7501. this.lockMove = !1,
  7502. this.healCol = 0;
  7503. for (var y = l.getDistance(0, 0, this.xVel * e, this.yVel * e), k = Math.min(4, Math.max(1, Math.round(y / 40))), v = 1 / k, w = 0; w < k; ++w) {
  7504. this.xVel && (this.x += this.xVel * e * v),
  7505. this.yVel && (this.y += this.yVel * e * v),
  7506. m = u.getGridArrays(this.x, this.y, this.scale);
  7507. for (var x = 0; x < m.length; ++x)
  7508. for (var S = 0; S < m[x].length; ++S)
  7509. m[x][S].active && u.checkCollision(this, m[x][S], v)
  7510. }
  7511. for (w = (I = f.indexOf(this)) + 1; w < f.length; ++w)
  7512. f[w] != this && f[w].alive && u.checkCollision(this, f[w]);
  7513. if (this.xVel && (this.xVel *= o(n.playerDecel, e),
  7514. this.xVel <= .01 && this.xVel >= -.01 && (this.xVel = 0)),
  7515. this.yVel && (this.yVel *= o(n.playerDecel, e),
  7516. this.yVel <= .01 && this.yVel >= -.01 && (this.yVel = 0)),
  7517. this.x - this.scale < 0 ? this.x = this.scale : this.x + this.scale > n.mapScale && (this.x = n.mapScale - this.scale),
  7518. this.y - this.scale < 0 ? this.y = this.scale : this.y + this.scale > n.mapScale && (this.y = n.mapScale - this.scale),
  7519. this.buildIndex < 0)
  7520. if (this.reloads[this.weaponIndex] > 0)
  7521. this.reloads[this.weaponIndex] -= e,
  7522. this.gathering = this.mouseState;
  7523. else if (this.gathering || this.autoGather) {
  7524. var T = !0;
  7525. if (null != p.weapons[this.weaponIndex].gather)
  7526. this.gather(f);
  7527. else if (null != p.weapons[this.weaponIndex].projectile && this.hasRes(p.weapons[this.weaponIndex], this.skin ? this.skin.projCost : 0)) {
  7528. this.useRes(p.weapons[this.weaponIndex], this.skin ? this.skin.projCost : 0),
  7529. this.noMovTimer = 0;
  7530. var I = p.weapons[this.weaponIndex].projectile
  7531. , E = 2 * this.scale
  7532. , M = this.skin && this.skin.aMlt ? this.skin.aMlt : 1;
  7533. p.weapons[this.weaponIndex].rec && (this.xVel -= p.weapons[this.weaponIndex].rec * s(this.dir),
  7534. this.yVel -= p.weapons[this.weaponIndex].rec * a(this.dir)),
  7535. h.addProjectile(this.x + E * s(this.dir), this.y + E * a(this.dir), this.dir, p.projectiles[I].range * M, p.projectiles[I].speed * M, I, this, null, this.zIndex)
  7536. } else
  7537. T = !1;
  7538. this.gathering = this.mouseState,
  7539. T && (this.reloads[this.weaponIndex] = p.weapons[this.weaponIndex].speed * (this.skin && this.skin.atkSpd || 1))
  7540. }
  7541. }
  7542. }
  7543. }
  7544. ,
  7545. this.addWeaponXP = function(e) {
  7546. this.weaponXP[this.weaponIndex] || (this.weaponXP[this.weaponIndex] = 0),
  7547. this.weaponXP[this.weaponIndex] += e
  7548. }
  7549. ,
  7550. this.earnXP = function(e) {
  7551. this.age < n.maxAge && (this.XP += e,
  7552. this.XP >= this.maxXP ? (this.age < n.maxAge ? (this.age++,
  7553. this.XP = 0,
  7554. this.maxXP *= 1.2) : this.XP = this.maxXP,
  7555. this.upgradePoints++,
  7556. y.send(this.id, "16", this.upgradePoints, this.upgrAge),
  7557. y.send(this.id, "15", this.XP, l.fixTo(this.maxXP, 1), this.age)) : y.send(this.id, "15", this.XP))
  7558. }
  7559. ,
  7560. this.changeHealth = function(e, t) {
  7561. if (e > 0 && this.health >= this.maxHealth)
  7562. return !1;
  7563. e < 0 && this.skin && (e *= this.skin.dmgMult || 1),
  7564. e < 0 && this.tail && (e *= this.tail.dmgMult || 1),
  7565. e < 0 && (this.hitTime = Date.now()),
  7566. this.health += e,
  7567. this.health > this.maxHealth && (e -= this.health - this.maxHealth,
  7568. this.health = this.maxHealth),
  7569. this.health <= 0 && this.kill(t);
  7570. for (var n = 0; n < f.length; ++n)
  7571. this.sentTo[f[n].id] && y.send(f[n].id, "h", this.sid, Math.round(this.health));
  7572. return !t || !t.canSee(this) || t == this && e < 0 || y.send(t.id, "t", Math.round(this.x), Math.round(this.y), Math.round(-e), 1),
  7573. !0
  7574. }
  7575. ,
  7576. this.kill = function(e) {
  7577. e && e.alive && (e.kills++,
  7578. e.skin && e.skin.goldSteal ? k(e, Math.round(this.points / 2)) : k(e, Math.round(100 * this.age * (e.skin && e.skin.kScrM ? e.skin.kScrM : 1))),
  7579. y.send(e.id, "9", "kills", e.kills, 1)),
  7580. this.alive = !1,
  7581. y.send(this.id, "11"),
  7582. v()
  7583. }
  7584. ,
  7585. this.addResource = function(e, t, i) {
  7586. !i && t > 0 && this.addWeaponXP(t),
  7587. 3 == e ? k(this, t, !0) : (this[n.resourceTypes[e]] += t,
  7588. y.send(this.id, "9", n.resourceTypes[e], this[n.resourceTypes[e]], 1))
  7589. }
  7590. ,
  7591. this.changeItemCount = function(e, t) {
  7592. this.itemCounts[e] = this.itemCounts[e] || 0,
  7593. this.itemCounts[e] += t,
  7594. y.send(this.id, "14", e, this.itemCounts[e])
  7595. }
  7596. ,
  7597. this.buildItem = function(e) {
  7598. var t = this.scale + e.scale + (e.placeOffset || 0)
  7599. , n = this.x + t * s(this.dir)
  7600. , i = this.y + t * a(this.dir);
  7601. if (this.canBuild(e) && !(e.consume && this.skin && this.skin.noEat) && (e.consume || u.checkItemLocation(n, i, e.scale, .6, e.id, !1, this))) {
  7602. var r = !1;
  7603. if (e.consume) {
  7604. if (this.hitTime) {
  7605. var o = Date.now() - this.hitTime;
  7606. this.hitTime = 0,
  7607. o <= 120 ? (this.shameCount++,
  7608. this.shameCount >= 8 && (this.shameTimer = 3e4,
  7609. this.shameCount = 0)) : (this.shameCount -= 2,
  7610. this.shameCount <= 0 && (this.shameCount = 0))
  7611. }
  7612. this.shameTimer <= 0 && (r = e.consume(this))
  7613. } else
  7614. r = !0,
  7615. e.group.limit && this.changeItemCount(e.group.id, 1),
  7616. e.pps && (this.pps += e.pps),
  7617. u.add(u.objects.length, n, i, this.dir, e.scale, e.type, e, !1, this);
  7618. r && (this.useRes(e),
  7619. this.buildIndex = -1)
  7620. }
  7621. }
  7622. ,
  7623. this.hasRes = function(e, t) {
  7624. for (var n = 0; n < e.req.length; ) {
  7625. if (this[e.req[n]] < Math.round(e.req[n + 1] * (t || 1)))
  7626. return !1;
  7627. n += 2
  7628. }
  7629. return !0
  7630. }
  7631. ,
  7632. this.useRes = function(e, t) {
  7633. if (!n.inSandbox)
  7634. for (var i = 0; i < e.req.length; )
  7635. this.addResource(n.resourceTypes.indexOf(e.req[i]), -Math.round(e.req[i + 1] * (t || 1))),
  7636. i += 2
  7637. }
  7638. ,
  7639. this.canBuild = function(e) {
  7640. return !!n.inSandbox || !(e.group.limit && this.itemCounts[e.group.id] >= e.group.limit) && this.hasRes(e)
  7641. }
  7642. ,
  7643. this.gather = function() {
  7644. this.noMovTimer = 0,
  7645. this.slowMult -= p.weapons[this.weaponIndex].hitSlow || .3,
  7646. this.slowMult < 0 && (this.slowMult = 0);
  7647. for (var e, t, i, r = n.fetchVariant(this), o = r.poison, c = r.val, h = {}, g = u.getGridArrays(this.x, this.y, p.weapons[this.weaponIndex].range), m = 0; m < g.length; ++m)
  7648. for (var y = 0; y < g[m].length; ++y)
  7649. if ((t = g[m][y]).active && !t.dontGather && !h[t.sid] && t.visibleToPlayer(this) && l.getDistance(this.x, this.y, t.x, t.y) - t.scale <= p.weapons[this.weaponIndex].range && (e = l.getDirection(t.x, t.y, this.x, this.y),
  7650. l.getAngleDist(e, this.dir) <= n.gatherAngle)) {
  7651. if (h[t.sid] = 1,
  7652. t.health) {
  7653. if (t.changeHealth(-p.weapons[this.weaponIndex].dmg * c * (p.weapons[this.weaponIndex].sDmg || 1) * (this.skin && this.skin.bDmg ? this.skin.bDmg : 1), this)) {
  7654. for (var k = 0; k < t.req.length; )
  7655. this.addResource(n.resourceTypes.indexOf(t.req[k]), t.req[k + 1]),
  7656. k += 2;
  7657. u.disableObj(t)
  7658. }
  7659. } else {
  7660. this.earnXP(4 * p.weapons[this.weaponIndex].gather);
  7661. var v = p.weapons[this.weaponIndex].gather + (3 == t.type ? 4 : 0);
  7662. this.skin && this.skin.extraGold && this.addResource(3, 1),
  7663. this.addResource(t.type, v)
  7664. }
  7665. i = !0,
  7666. u.hitObj(t, e)
  7667. }
  7668. for (y = 0; y < f.length + d.length; ++y)
  7669. if ((t = f[y] || d[y - f.length]) != this && t.alive && (!t.team || t.team != this.team) && l.getDistance(this.x, this.y, t.x, t.y) - 1.8 * t.scale <= p.weapons[this.weaponIndex].range && (e = l.getDirection(t.x, t.y, this.x, this.y),
  7670. l.getAngleDist(e, this.dir) <= n.gatherAngle)) {
  7671. var w = p.weapons[this.weaponIndex].steal;
  7672. w && t.addResource && (w = Math.min(t.points || 0, w),
  7673. this.addResource(3, w),
  7674. t.addResource(3, -w));
  7675. var b = c;
  7676. null != t.weaponIndex && p.weapons[t.weaponIndex].shield && l.getAngleDist(e + Math.PI, t.dir) <= n.shieldAngle && (b = p.weapons[t.weaponIndex].shield);
  7677. var x = p.weapons[this.weaponIndex].dmg * (this.skin && this.skin.dmgMultO ? this.skin.dmgMultO : 1) * (this.tail && this.tail.dmgMultO ? this.tail.dmgMultO : 1)
  7678. , S = .3 * (t.weightM || 1) + (p.weapons[this.weaponIndex].knock || 0);
  7679. t.xVel += S * s(e),
  7680. t.yVel += S * a(e),
  7681. this.skin && this.skin.healD && this.changeHealth(x * b * this.skin.healD, this),
  7682. this.tail && this.tail.healD && this.changeHealth(x * b * this.tail.healD, this),
  7683. t.skin && t.skin.dmg && 1 == b && this.changeHealth(-x * t.skin.dmg, t),
  7684. t.tail && t.tail.dmg && 1 == b && this.changeHealth(-x * t.tail.dmg, t),
  7685. !(t.dmgOverTime && this.skin && this.skin.poisonDmg) || t.skin && t.skin.poisonRes || (t.dmgOverTime.dmg = this.skin.poisonDmg,
  7686. t.dmgOverTime.time = this.skin.poisonTime || 1,
  7687. t.dmgOverTime.doer = this),
  7688. !t.dmgOverTime || !o || t.skin && t.skin.poisonRes || (t.dmgOverTime.dmg = 5,
  7689. t.dmgOverTime.time = 5,
  7690. t.dmgOverTime.doer = this),
  7691. t.skin && t.skin.dmgK && (this.xVel -= t.skin.dmgK * s(e),
  7692. this.yVel -= t.skin.dmgK * a(e)),
  7693. t.changeHealth(-x * b, this, this)
  7694. }
  7695. this.sendAnimation(i ? 1 : 0)
  7696. }
  7697. ,
  7698. this.sendAnimation = function(e) {
  7699. for (var t = 0; t < f.length; ++t)
  7700. this.sentTo[f[t].id] && this.canSee(f[t]) && y.send(f[t].id, "7", this.sid, e ? 1 : 0, this.weaponIndex)
  7701. }
  7702. ;
  7703. var x = 0
  7704. , S = 0;
  7705. this.animate = function(e) {
  7706. this.animTime > 0 && (this.animTime -= e,
  7707. this.animTime <= 0 ? (this.animTime = 0,
  7708. this.dirPlus = 0,
  7709. x = 0,
  7710. S = 0) : 0 == S ? (x += e / (this.animSpeed * n.hitReturnRatio),
  7711. this.dirPlus = l.lerp(0, this.targetAngle, Math.min(1, x)),
  7712. x >= 1 && (x = 1,
  7713. S = 1)) : (x -= e / (this.animSpeed * (1 - n.hitReturnRatio)),
  7714. this.dirPlus = l.lerp(0, this.targetAngle, Math.max(0, x))))
  7715. }
  7716. ,
  7717. this.startAnim = function(e, t) {
  7718. this.animTime = this.animSpeed = p.weapons[t].speed,
  7719. this.targetAngle = e ? -n.hitAngle : -Math.PI,
  7720. x = 0,
  7721. S = 0
  7722. }
  7723. ,
  7724. this.canSee = function(e) {
  7725. if (!e)
  7726. return !1;
  7727. if (e.skin && e.skin.invisTimer && e.noMovTimer >= e.skin.invisTimer)
  7728. return !1;
  7729. var t = r(e.x - this.x) - e.scale
  7730. , i = r(e.y - this.y) - e.scale;
  7731. return t <= n.maxScreenWidth / 2 * 1.3 && i <= n.maxScreenHeight / 2 * 1.3
  7732. }
  7733. }
  7734. }
  7735. , function(e, t, n) {
  7736. const i = n(50).words
  7737. , r = n(51).array;
  7738. e.exports = class {
  7739. constructor(e={}) {
  7740. Object.assign(this, {
  7741. list: e.emptyList && [] || Array.prototype.concat.apply(i, [r, e.list || []]),
  7742. exclude: e.exclude || [],
  7743. placeHolder: e.placeHolder || "*",
  7744. regex: e.regex || /[^a-zA-Z0-9|\$|\@]|\^/g,
  7745. replaceRegex: e.replaceRegex || /\w/g
  7746. })
  7747. }
  7748. isProfane(e) {
  7749. return this.list.filter(t=>{
  7750. const n = new RegExp(`\\b${t.replace(/(\W)/g, "\\$1")}\\b`,"gi");
  7751. return !this.exclude.includes(t.toLowerCase()) && n.test(e)
  7752. }
  7753. ).length > 0 || !1
  7754. }
  7755. replaceWord(e) {
  7756. return e.replace(this.regex, "").replace(this.replaceRegex, this.placeHolder)
  7757. }
  7758. clean(e) {
  7759. return e.split(/\b/).map(e=>this.isProfane(e) ? this.replaceWord(e) : e).join("")
  7760. }
  7761. addWords() {
  7762. let e = Array.from(arguments);
  7763. this.list.push(...e),
  7764. e.map(e=>e.toLowerCase()).forEach(e=>{
  7765. this.exclude.includes(e) && this.exclude.splice(this.exclude.indexOf(e), 1)
  7766. }
  7767. )
  7768. }
  7769. removeWords() {
  7770. this.exclude.push(...Array.from(arguments).map(e=>e.toLowerCase()))
  7771. }
  7772. }
  7773. }
  7774. , function(e) {
  7775. e.exports = {
  7776. words: ["ahole", "anus", "ash0le", "ash0les", "asholes", "ass", "Ass Monkey", "Assface", "assh0le", "assh0lez", "asshole", "assholes", "assholz", "asswipe", "azzhole", "bassterds", "bastard", "bastards", "bastardz", "basterds", "basterdz", "Biatch", "bitch", "bitches", "Blow Job", "boffing", "butthole", "buttwipe", "c0ck", "c0cks", "c0k", "Carpet Muncher", "cawk", "cawks", "Clit", "cnts", "cntz", "cock", "cockhead", "cock-head", "cocks", "CockSucker", "cock-sucker", "crap", "cum", "cunt", "cunts", "cuntz", "dick", "dild0", "dild0s", "dildo", "dildos", "dilld0", "dilld0s", "dominatricks", "dominatrics", "dominatrix", "dyke", "enema", "f u c k", "f u c k e r", "fag", "fag1t", "faget", "fagg1t", "faggit", "faggot", "fagg0t", "fagit", "fags", "fagz", "faig", "faigs", "fart", "flipping the bird", "fuck", "fucker", "fuckin", "fucking", "fucks", "Fudge Packer", "fuk", "Fukah", "Fuken", "fuker", "Fukin", "Fukk", "Fukkah", "Fukken", "Fukker", "Fukkin", "g00k", "God-damned", "h00r", "h0ar", "h0re", "hells", "hoar", "hoor", "hoore", "jackoff", "jap", "japs", "jerk-off", "jisim", "jiss", "jizm", "jizz", "knob", "knobs", "knobz", "kunt", "kunts", "kuntz", "Lezzian", "Lipshits", "Lipshitz", "masochist", "masokist", "massterbait", "masstrbait", "masstrbate", "masterbaiter", "masterbate", "masterbates", "Motha Fucker", "Motha Fuker", "Motha Fukkah", "Motha Fukker", "Mother Fucker", "Mother Fukah", "Mother Fuker", "Mother Fukkah", "Mother Fukker", "mother-fucker", "Mutha Fucker", "Mutha Fukah", "Mutha Fuker", "Mutha Fukkah", "Mutha Fukker", "n1gr", "nastt", "nigger;", "nigur;", "niiger;", "niigr;", "orafis", "orgasim;", "orgasm", "orgasum", "oriface", "orifice", "orifiss", "packi", "packie", "packy", "paki", "pakie", "paky", "pecker", "peeenus", "peeenusss", "peenus", "peinus", "pen1s", "penas", "penis", "penis-breath", "penus", "penuus", "Phuc", "Phuck", "Phuk", "Phuker", "Phukker", "polac", "polack", "polak", "Poonani", "pr1c", "pr1ck", "pr1k", "pusse", "pussee", "pussy", "puuke", "puuker", "queer", "queers", "queerz", "qweers", "qweerz", "qweir", "recktum", "rectum", "retard", "sadist", "scank", "schlong", "screwing", "semen", "sex", "sexy", "Sh!t", "sh1t", "sh1ter", "sh1ts", "sh1tter", "sh1tz", "shit", "shits", "shitter", "Shitty", "Shity", "shitz", "Shyt", "Shyte", "Shytty", "Shyty", "skanck", "skank", "skankee", "skankey", "skanks", "Skanky", "slag", "slut", "sluts", "Slutty", "slutz", "son-of-a-bitch", "tit", "turd", "va1jina", "vag1na", "vagiina", "vagina", "vaj1na", "vajina", "vullva", "vulva", "w0p", "wh00r", "wh0re", "whore", "xrated", "xxx", "b!+ch", "bitch", "blowjob", "clit", "arschloch", "fuck", "shit", "ass", "asshole", "b!tch", "b17ch", "b1tch", "bastard", "bi+ch", "boiolas", "buceta", "c0ck", "cawk", "chink", "cipa", "clits", "cock", "cum", "cunt", "dildo", "dirsa", "ejakulate", "fatass", "fcuk", "fuk", "fux0r", "hoer", "hore", "jism", "kawk", "l3itch", "l3i+ch", "lesbian", "masturbate", "masterbat*", "masterbat3", "motherfucker", "s.o.b.", "mofo", "nazi", "nigga", "nigger", "nutsack", "phuck", "pimpis", "pusse", "pussy", "scrotum", "sh!t", "shemale", "shi+", "sh!+", "slut", "smut", "teets", "tits", "boobs", "b00bs", "teez", "testical", "testicle", "titt", "w00se", "jackoff", "wank", "whoar", "whore", "*damn", "*dyke", "*fuck*", "*shit*", "@$$", "amcik", "andskota", "arse*", "assrammer", "ayir", "bi7ch", "bitch*", "bollock*", "breasts", "butt-pirate", "cabron", "cazzo", "chraa", "chuj", "Cock*", "cunt*", "d4mn", "daygo", "dego", "dick*", "dike*", "dupa", "dziwka", "ejackulate", "Ekrem*", "Ekto", "enculer", "faen", "fag*", "fanculo", "fanny", "feces", "feg", "Felcher", "ficken", "fitt*", "Flikker", "foreskin", "Fotze", "Fu(*", "fuk*", "futkretzn", "gook", "guiena", "h0r", "h4x0r", "hell", "helvete", "hoer*", "honkey", "Huevon", "hui", "injun", "jizz", "kanker*", "kike", "klootzak", "kraut", "knulle", "kuk", "kuksuger", "Kurac", "kurwa", "kusi*", "kyrpa*", "lesbo", "mamhoon", "masturbat*", "merd*", "mibun", "monkleigh", "mouliewop", "muie", "mulkku", "muschi", "nazis", "nepesaurio", "nigger*", "orospu", "paska*", "perse", "picka", "pierdol*", "pillu*", "pimmel", "piss*", "pizda", "poontsee", "poop", "porn", "p0rn", "pr0n", "preteen", "pula", "pule", "puta", "puto", "qahbeh", "queef*", "rautenberg", "schaffer", "scheiss*", "schlampe", "schmuck", "screw", "sh!t*", "sharmuta", "sharmute", "shipal", "shiz", "skribz", "skurwysyn", "sphencter", "spic", "spierdalaj", "splooge", "suka", "b00b*", "testicle*", "titt*", "twat", "vittu", "wank*", "wetback*", "wichser", "wop*", "yed", "zabourah"]
  7777. }
  7778. }
  7779. , function(e, t, n) {
  7780. e.exports = {
  7781. object: n(52),
  7782. array: n(53),
  7783. regex: n(54)
  7784. }
  7785. }
  7786. , function(e, t) {
  7787. e.exports = {
  7788. "4r5e": 1,
  7789. "5h1t": 1,
  7790. "5hit": 1,
  7791. a55: 1,
  7792. anal: 1,
  7793. anus: 1,
  7794. ar5e: 1,
  7795. arrse: 1,
  7796. arse: 1,
  7797. ass: 1,
  7798. "ass-fucker": 1,
  7799. asses: 1,
  7800. assfucker: 1,
  7801. assfukka: 1,
  7802. asshole: 1,
  7803. assholes: 1,
  7804. asswhole: 1,
  7805. a_s_s: 1,
  7806. "b!tch": 1,
  7807. b00bs: 1,
  7808. b17ch: 1,
  7809. b1tch: 1,
  7810. ballbag: 1,
  7811. balls: 1,
  7812. ballsack: 1,
  7813. bastard: 1,
  7814. beastial: 1,
  7815. beastiality: 1,
  7816. bellend: 1,
  7817. bestial: 1,
  7818. bestiality: 1,
  7819. "bi+ch": 1,
  7820. biatch: 1,
  7821. bitch: 1,
  7822. bitcher: 1,
  7823. bitchers: 1,
  7824. bitches: 1,
  7825. bitchin: 1,
  7826. bitching: 1,
  7827. bloody: 1,
  7828. "blow job": 1,
  7829. blowjob: 1,
  7830. blowjobs: 1,
  7831. boiolas: 1,
  7832. bollock: 1,
  7833. bollok: 1,
  7834. boner: 1,
  7835. boob: 1,
  7836. boobs: 1,
  7837. booobs: 1,
  7838. boooobs: 1,
  7839. booooobs: 1,
  7840. booooooobs: 1,
  7841. breasts: 1,
  7842. buceta: 1,
  7843. bugger: 1,
  7844. bum: 1,
  7845. "bunny fucker": 1,
  7846. butt: 1,
  7847. butthole: 1,
  7848. buttmuch: 1,
  7849. buttplug: 1,
  7850. c0ck: 1,
  7851. c0cksucker: 1,
  7852. "carpet muncher": 1,
  7853. cawk: 1,
  7854. chink: 1,
  7855. cipa: 1,
  7856. cl1t: 1,
  7857. clit: 1,
  7858. clitoris: 1,
  7859. clits: 1,
  7860. cnut: 1,
  7861. cock: 1,
  7862. "cock-sucker": 1,
  7863. cockface: 1,
  7864. cockhead: 1,
  7865. cockmunch: 1,
  7866. cockmuncher: 1,
  7867. cocks: 1,
  7868. cocksuck: 1,
  7869. cocksucked: 1,
  7870. cocksucker: 1,
  7871. cocksucking: 1,
  7872. cocksucks: 1,
  7873. cocksuka: 1,
  7874. cocksukka: 1,
  7875. cok: 1,
  7876. cokmuncher: 1,
  7877. coksucka: 1,
  7878. coon: 1,
  7879. cox: 1,
  7880. crap: 1,
  7881. cum: 1,
  7882. cummer: 1,
  7883. cumming: 1,
  7884. cums: 1,
  7885. cumshot: 1,
  7886. cunilingus: 1,
  7887. cunillingus: 1,
  7888. cunnilingus: 1,
  7889. cunt: 1,
  7890. cuntlick: 1,
  7891. cuntlicker: 1,
  7892. cuntlicking: 1,
  7893. cunts: 1,
  7894. cyalis: 1,
  7895. cyberfuc: 1,
  7896. cyberfuck: 1,
  7897. cyberfucked: 1,
  7898. cyberfucker: 1,
  7899. cyberfuckers: 1,
  7900. cyberfucking: 1,
  7901. d1ck: 1,
  7902. damn: 1,
  7903. dick: 1,
  7904. dickhead: 1,
  7905. dildo: 1,
  7906. dildos: 1,
  7907. dink: 1,
  7908. dinks: 1,
  7909. dirsa: 1,
  7910. dlck: 1,
  7911. "dog-fucker": 1,
  7912. doggin: 1,
  7913. dogging: 1,
  7914. donkeyribber: 1,
  7915. doosh: 1,
  7916. duche: 1,
  7917. dyke: 1,
  7918. ejaculate: 1,
  7919. ejaculated: 1,
  7920. ejaculates: 1,
  7921. ejaculating: 1,
  7922. ejaculatings: 1,
  7923. ejaculation: 1,
  7924. ejakulate: 1,
  7925. "f u c k": 1,
  7926. "f u c k e r": 1,
  7927. f4nny: 1,
  7928. fag: 1,
  7929. fagging: 1,
  7930. faggitt: 1,
  7931. faggot: 1,
  7932. faggs: 1,
  7933. fagot: 1,
  7934. fagots: 1,
  7935. fags: 1,
  7936. fanny: 1,
  7937. fannyflaps: 1,
  7938. fannyfucker: 1,
  7939. fanyy: 1,
  7940. fatass: 1,
  7941. fcuk: 1,
  7942. fcuker: 1,
  7943. fcuking: 1,
  7944. feck: 1,
  7945. fecker: 1,
  7946. felching: 1,
  7947. fellate: 1,
  7948. fellatio: 1,
  7949. fingerfuck: 1,
  7950. fingerfucked: 1,
  7951. fingerfucker: 1,
  7952. fingerfuckers: 1,
  7953. fingerfucking: 1,
  7954. fingerfucks: 1,
  7955. fistfuck: 1,
  7956. fistfucked: 1,
  7957. fistfucker: 1,
  7958. fistfuckers: 1,
  7959. fistfucking: 1,
  7960. fistfuckings: 1,
  7961. fistfucks: 1,
  7962. flange: 1,
  7963. fook: 1,
  7964. fooker: 1,
  7965. fuck: 1,
  7966. fucka: 1,
  7967. fucked: 1,
  7968. fucker: 1,
  7969. fuckers: 1,
  7970. fuckhead: 1,
  7971. fuckheads: 1,
  7972. fuckin: 1,
  7973. fucking: 1,
  7974. fuckings: 1,
  7975. fuckingshitmotherfucker: 1,
  7976. fuckme: 1,
  7977. fucks: 1,
  7978. fuckwhit: 1,
  7979. fuckwit: 1,
  7980. "fudge packer": 1,
  7981. fudgepacker: 1,
  7982. fuk: 1,
  7983. fuker: 1,
  7984. fukker: 1,
  7985. fukkin: 1,
  7986. fuks: 1,
  7987. fukwhit: 1,
  7988. fukwit: 1,
  7989. fux: 1,
  7990. fux0r: 1,
  7991. f_u_c_k: 1,
  7992. gangbang: 1,
  7993. gangbanged: 1,
  7994. gangbangs: 1,
  7995. gaylord: 1,
  7996. gaysex: 1,
  7997. goatse: 1,
  7998. God: 1,
  7999. "god-dam": 1,
  8000. "god-damned": 1,
  8001. goddamn: 1,
  8002. goddamned: 1,
  8003. hardcoresex: 1,
  8004. hell: 1,
  8005. heshe: 1,
  8006. hoar: 1,
  8007. hoare: 1,
  8008. hoer: 1,
  8009. homo: 1,
  8010. hore: 1,
  8011. horniest: 1,
  8012. horny: 1,
  8013. hotsex: 1,
  8014. "jack-off": 1,
  8015. jackoff: 1,
  8016. jap: 1,
  8017. "jerk-off": 1,
  8018. jism: 1,
  8019. jiz: 1,
  8020. jizm: 1,
  8021. jizz: 1,
  8022. kawk: 1,
  8023. knob: 1,
  8024. knobead: 1,
  8025. knobed: 1,
  8026. knobend: 1,
  8027. knobhead: 1,
  8028. knobjocky: 1,
  8029. knobjokey: 1,
  8030. kock: 1,
  8031. kondum: 1,
  8032. kondums: 1,
  8033. kum: 1,
  8034. kummer: 1,
  8035. kumming: 1,
  8036. kums: 1,
  8037. kunilingus: 1,
  8038. "l3i+ch": 1,
  8039. l3itch: 1,
  8040. labia: 1,
  8041. lust: 1,
  8042. lusting: 1,
  8043. m0f0: 1,
  8044. m0fo: 1,
  8045. m45terbate: 1,
  8046. ma5terb8: 1,
  8047. ma5terbate: 1,
  8048. masochist: 1,
  8049. "master-bate": 1,
  8050. masterb8: 1,
  8051. "masterbat*": 1,
  8052. masterbat3: 1,
  8053. masterbate: 1,
  8054. masterbation: 1,
  8055. masterbations: 1,
  8056. masturbate: 1,
  8057. "mo-fo": 1,
  8058. mof0: 1,
  8059. mofo: 1,
  8060. mothafuck: 1,
  8061. mothafucka: 1,
  8062. mothafuckas: 1,
  8063. mothafuckaz: 1,
  8064. mothafucked: 1,
  8065. mothafucker: 1,
  8066. mothafuckers: 1,
  8067. mothafuckin: 1,
  8068. mothafucking: 1,
  8069. mothafuckings: 1,
  8070. mothafucks: 1,
  8071. "mother fucker": 1,
  8072. motherfuck: 1,
  8073. motherfucked: 1,
  8074. motherfucker: 1,
  8075. motherfuckers: 1,
  8076. motherfuckin: 1,
  8077. motherfucking: 1,
  8078. motherfuckings: 1,
  8079. motherfuckka: 1,
  8080. motherfucks: 1,
  8081. muff: 1,
  8082. mutha: 1,
  8083. muthafecker: 1,
  8084. muthafuckker: 1,
  8085. muther: 1,
  8086. mutherfucker: 1,
  8087. n1gga: 1,
  8088. n1gger: 1,
  8089. nazi: 1,
  8090. nigg3r: 1,
  8091. nigg4h: 1,
  8092. nigga: 1,
  8093. niggah: 1,
  8094. niggas: 1,
  8095. niggaz: 1,
  8096. nigger: 1,
  8097. niggers: 1,
  8098. nob: 1,
  8099. "nob jokey": 1,
  8100. nobhead: 1,
  8101. nobjocky: 1,
  8102. nobjokey: 1,
  8103. numbnuts: 1,
  8104. nutsack: 1,
  8105. orgasim: 1,
  8106. orgasims: 1,
  8107. orgasm: 1,
  8108. orgasms: 1,
  8109. p0rn: 1,
  8110. pawn: 1,
  8111. pecker: 1,
  8112. penis: 1,
  8113. penisfucker: 1,
  8114. phonesex: 1,
  8115. phuck: 1,
  8116. phuk: 1,
  8117. phuked: 1,
  8118. phuking: 1,
  8119. phukked: 1,
  8120. phukking: 1,
  8121. phuks: 1,
  8122. phuq: 1,
  8123. pigfucker: 1,
  8124. pimpis: 1,
  8125. piss: 1,
  8126. pissed: 1,
  8127. pisser: 1,
  8128. pissers: 1,
  8129. pisses: 1,
  8130. pissflaps: 1,
  8131. pissin: 1,
  8132. pissing: 1,
  8133. pissoff: 1,
  8134. poop: 1,
  8135. porn: 1,
  8136. porno: 1,
  8137. pornography: 1,
  8138. pornos: 1,
  8139. prick: 1,
  8140. pricks: 1,
  8141. pron: 1,
  8142. pube: 1,
  8143. pusse: 1,
  8144. pussi: 1,
  8145. pussies: 1,
  8146. pussy: 1,
  8147. pussys: 1,
  8148. rectum: 1,
  8149. retard: 1,
  8150. rimjaw: 1,
  8151. rimming: 1,
  8152. "s hit": 1,
  8153. "s.o.b.": 1,
  8154. sadist: 1,
  8155. schlong: 1,
  8156. screwing: 1,
  8157. scroat: 1,
  8158. scrote: 1,
  8159. scrotum: 1,
  8160. semen: 1,
  8161. sex: 1,
  8162. "sh!+": 1,
  8163. "sh!t": 1,
  8164. sh1t: 1,
  8165. shag: 1,
  8166. shagger: 1,
  8167. shaggin: 1,
  8168. shagging: 1,
  8169. shemale: 1,
  8170. "shi+": 1,
  8171. shit: 1,
  8172. shitdick: 1,
  8173. shite: 1,
  8174. shited: 1,
  8175. shitey: 1,
  8176. shitfuck: 1,
  8177. shitfull: 1,
  8178. shithead: 1,
  8179. shiting: 1,
  8180. shitings: 1,
  8181. shits: 1,
  8182. shitted: 1,
  8183. shitter: 1,
  8184. shitters: 1,
  8185. shitting: 1,
  8186. shittings: 1,
  8187. shitty: 1,
  8188. skank: 1,
  8189. slut: 1,
  8190. sluts: 1,
  8191. smegma: 1,
  8192. smut: 1,
  8193. snatch: 1,
  8194. "son-of-a-bitch": 1,
  8195. spac: 1,
  8196. spunk: 1,
  8197. s_h_i_t: 1,
  8198. t1tt1e5: 1,
  8199. t1tties: 1,
  8200. teets: 1,
  8201. teez: 1,
  8202. testical: 1,
  8203. testicle: 1,
  8204. tit: 1,
  8205. titfuck: 1,
  8206. tits: 1,
  8207. titt: 1,
  8208. tittie5: 1,
  8209. tittiefucker: 1,
  8210. titties: 1,
  8211. tittyfuck: 1,
  8212. tittywank: 1,
  8213. titwank: 1,
  8214. tosser: 1,
  8215. turd: 1,
  8216. tw4t: 1,
  8217. twat: 1,
  8218. twathead: 1,
  8219. twatty: 1,
  8220. twunt: 1,
  8221. twunter: 1,
  8222. v14gra: 1,
  8223. v1gra: 1,
  8224. vagina: 1,
  8225. viagra: 1,
  8226. vulva: 1,
  8227. w00se: 1,
  8228. wang: 1,
  8229. wank: 1,
  8230. wanker: 1,
  8231. wanky: 1,
  8232. whoar: 1,
  8233. whore: 1,
  8234. willies: 1,
  8235. willy: 1,
  8236. xrated: 1,
  8237. xxx: 1
  8238. }
  8239. }
  8240. , function(e, t) {
  8241. e.exports = ["4r5e", "5h1t", "5hit", "a55", "anal", "anus", "ar5e", "arrse", "arse", "ass", "ass-fucker", "asses", "assfucker", "assfukka", "asshole", "assholes", "asswhole", "a_s_s", "b!tch", "b00bs", "b17ch", "b1tch", "ballbag", "balls", "ballsack", "bastard", "beastial", "beastiality", "bellend", "bestial", "bestiality", "bi+ch", "biatch", "bitch", "bitcher", "bitchers", "bitches", "bitchin", "bitching", "bloody", "blow job", "blowjob", "blowjobs", "boiolas", "bollock", "bollok", "boner", "boob", "boobs", "booobs", "boooobs", "booooobs", "booooooobs", "breasts", "buceta", "bugger", "bum", "bunny fucker", "butt", "butthole", "buttmuch", "buttplug", "c0ck", "c0cksucker", "carpet muncher", "cawk", "chink", "cipa", "cl1t", "clit", "clitoris", "clits", "cnut", "cock", "cock-sucker", "cockface", "cockhead", "cockmunch", "cockmuncher", "cocks", "cocksuck", "cocksucked", "cocksucker", "cocksucking", "cocksucks", "cocksuka", "cocksukka", "cok", "cokmuncher", "coksucka", "coon", "cox", "crap", "cum", "cummer", "cumming", "cums", "cumshot", "cunilingus", "cunillingus", "cunnilingus", "cunt", "cuntlick", "cuntlicker", "cuntlicking", "cunts", "cyalis", "cyberfuc", "cyberfuck", "cyberfucked", "cyberfucker", "cyberfuckers", "cyberfucking", "d1ck", "damn", "dick", "dickhead", "dildo", "dildos", "dink", "dinks", "dirsa", "dlck", "dog-fucker", "doggin", "dogging", "donkeyribber", "doosh", "duche", "dyke", "ejaculate", "ejaculated", "ejaculates", "ejaculating", "ejaculatings", "ejaculation", "ejakulate", "f u c k", "f u c k e r", "f4nny", "fag", "fagging", "faggitt", "faggot", "faggs", "fagot", "fagots", "fags", "fanny", "fannyflaps", "fannyfucker", "fanyy", "fatass", "fcuk", "fcuker", "fcuking", "feck", "fecker", "felching", "fellate", "fellatio", "fingerfuck", "fingerfucked", "fingerfucker", "fingerfuckers", "fingerfucking", "fingerfucks", "fistfuck", "fistfucked", "fistfucker", "fistfuckers", "fistfucking", "fistfuckings", "fistfucks", "flange", "fook", "fooker", "fuck", "fucka", "fucked", "fucker", "fuckers", "fuckhead", "fuckheads", "fuckin", "fucking", "fuckings", "fuckingshitmotherfucker", "fuckme", "fucks", "fuckwhit", "fuckwit", "fudge packer", "fudgepacker", "fuk", "fuker", "fukker", "fukkin", "fuks", "fukwhit", "fukwit", "fux", "fux0r", "f_u_c_k", "gangbang", "gangbanged", "gangbangs", "gaylord", "gaysex", "goatse", "God", "god-dam", "god-damned", "goddamn", "goddamned", "hardcoresex", "hell", "heshe", "hoar", "hoare", "hoer", "homo", "hore", "horniest", "horny", "hotsex", "jack-off", "jackoff", "jap", "jerk-off", "jism", "jiz", "jizm", "jizz", "kawk", "knob", "knobead", "knobed", "knobend", "knobhead", "knobjocky", "knobjokey", "kock", "kondum", "kondums", "kum", "kummer", "kumming", "kums", "kunilingus", "l3i+ch", "l3itch", "labia", "lust", "lusting", "m0f0", "m0fo", "m45terbate", "ma5terb8", "ma5terbate", "masochist", "master-bate", "masterb8", "masterbat*", "masterbat3", "masterbate", "masterbation", "masterbations", "masturbate", "mo-fo", "mof0", "mofo", "mothafuck", "mothafucka", "mothafuckas", "mothafuckaz", "mothafucked", "mothafucker", "mothafuckers", "mothafuckin", "mothafucking", "mothafuckings", "mothafucks", "mother fucker", "motherfuck", "motherfucked", "motherfucker", "motherfuckers", "motherfuckin", "motherfucking", "motherfuckings", "motherfuckka", "motherfucks", "muff", "mutha", "muthafecker", "muthafuckker", "muther", "mutherfucker", "n1gga", "n1gger", "nazi", "nigg3r", "nigg4h", "nigga", "niggah", "niggas", "niggaz", "nigger", "niggers", "nob", "nob jokey", "nobhead", "nobjocky", "nobjokey", "numbnuts", "nutsack", "orgasim", "orgasims", "orgasm", "orgasms", "p0rn", "pawn", "pecker", "penis", "penisfucker", "phonesex", "phuck", "phuk", "phuked", "phuking", "phukked", "phukking", "phuks", "phuq", "pigfucker", "pimpis", "piss", "pissed", "pisser", "pissers", "pisses", "pissflaps", "pissin", "pissing", "pissoff", "poop", "porn", "porno", "pornography", "pornos", "prick", "pricks", "pron", "pube", "pusse", "pussi", "pussies", "pussy", "pussys", "rectum", "retard", "rimjaw", "rimming", "s hit", "s.o.b.", "sadist", "schlong", "screwing", "scroat", "scrote", "scrotum", "semen", "sex", "sh!+", "sh!t", "sh1t", "shag", "shagger", "shaggin", "shagging", "shemale", "shi+", "shit", "shitdick", "shite", "shited", "shitey", "shitfuck", "shitfull", "shithead", "shiting", "shitings", "shits", "shitted", "shitter", "shitters", "shitting", "shittings", "shitty", "skank", "slut", "sluts", "smegma", "smut", "snatch", "son-of-a-bitch", "spac", "spunk", "s_h_i_t", "t1tt1e5", "t1tties", "teets", "teez", "testical", "testicle", "tit", "titfuck", "tits", "titt", "tittie5", "tittiefucker", "titties", "tittyfuck", "tittywank", "titwank", "tosser", "turd", "tw4t", "twat", "twathead", "twatty", "twunt", "twunter", "v14gra", "v1gra", "vagina", "viagra", "vulva", "w00se", "wang", "wank", "wanker", "wanky", "whoar", "whore", "willies", "willy", "xrated", "xxx"]
  8242. }
  8243. , function(e, t) {
  8244. e.exports = /\b(4r5e|5h1t|5hit|a55|anal|anus|ar5e|arrse|arse|ass|ass-fucker|asses|assfucker|assfukka|asshole|assholes|asswhole|a_s_s|b!tch|b00bs|b17ch|b1tch|ballbag|balls|ballsack|bastard|beastial|beastiality|bellend|bestial|bestiality|bi\+ch|biatch|bitch|bitcher|bitchers|bitches|bitchin|bitching|bloody|blow job|blowjob|blowjobs|boiolas|bollock|bollok|boner|boob|boobs|booobs|boooobs|booooobs|booooooobs|breasts|buceta|bugger|bum|bunny fucker|butt|butthole|buttmuch|buttplug|c0ck|c0cksucker|carpet muncher|cawk|chink|cipa|cl1t|clit|clitoris|clits|cnut|cock|cock-sucker|cockface|cockhead|cockmunch|cockmuncher|cocks|cocksuck|cocksucked|cocksucker|cocksucking|cocksucks|cocksuka|cocksukka|cok|cokmuncher|coksucka|coon|cox|crap|cum|cummer|cumming|cums|cumshot|cunilingus|cunillingus|cunnilingus|cunt|cuntlick|cuntlicker|cuntlicking|cunts|cyalis|cyberfuc|cyberfuck|cyberfucked|cyberfucker|cyberfuckers|cyberfucking|d1ck|damn|dick|dickhead|dildo|dildos|dink|dinks|dirsa|dlck|dog-fucker|doggin|dogging|donkeyribber|doosh|duche|dyke|ejaculate|ejaculated|ejaculates|ejaculating|ejaculatings|ejaculation|ejakulate|f u c k|f u c k e r|f4nny|fag|fagging|faggitt|faggot|faggs|fagot|fagots|fags|fanny|fannyflaps|fannyfucker|fanyy|fatass|fcuk|fcuker|fcuking|feck|fecker|felching|fellate|fellatio|fingerfuck|fingerfucked|fingerfucker|fingerfuckers|fingerfucking|fingerfucks|fistfuck|fistfucked|fistfucker|fistfuckers|fistfucking|fistfuckings|fistfucks|flange|fook|fooker|fuck|fucka|fucked|fucker|fuckers|fuckhead|fuckheads|fuckin|fucking|fuckings|fuckingshitmotherfucker|fuckme|fucks|fuckwhit|fuckwit|fudge packer|fudgepacker|fuk|fuker|fukker|fukkin|fuks|fukwhit|fukwit|fux|fux0r|f_u_c_k|gangbang|gangbanged|gangbangs|gaylord|gaysex|goatse|God|god-dam|god-damned|goddamn|goddamned|hardcoresex|hell|heshe|hoar|hoare|hoer|homo|hore|horniest|horny|hotsex|jack-off|jackoff|jap|jerk-off|jism|jiz|jizm|jizz|kawk|knob|knobead|knobed|knobend|knobhead|knobjocky|knobjokey|kock|kondum|kondums|kum|kummer|kumming|kums|kunilingus|l3i\+ch|l3itch|labia|lust|lusting|m0f0|m0fo|m45terbate|ma5terb8|ma5terbate|masochist|master-bate|masterb8|masterbat*|masterbat3|masterbate|masterbation|masterbations|masturbate|mo-fo|mof0|mofo|mothafuck|mothafucka|mothafuckas|mothafuckaz|mothafucked|mothafucker|mothafuckers|mothafuckin|mothafucking|mothafuckings|mothafucks|mother fucker|motherfuck|motherfucked|motherfucker|motherfuckers|motherfuckin|motherfucking|motherfuckings|motherfuckka|motherfucks|muff|mutha|muthafecker|muthafuckker|muther|mutherfucker|n1gga|n1gger|nazi|nigg3r|nigg4h|nigga|niggah|niggas|niggaz|nigger|niggers|nob|nob jokey|nobhead|nobjocky|nobjokey|numbnuts|nutsack|orgasim|orgasims|orgasm|orgasms|p0rn|pawn|pecker|penis|penisfucker|phonesex|phuck|phuk|phuked|phuking|phukked|phukking|phuks|phuq|pigfucker|pimpis|piss|pissed|pisser|pissers|pisses|pissflaps|pissin|pissing|pissoff|poop|porn|porno|pornography|pornos|prick|pricks|pron|pube|pusse|pussi|pussies|pussy|pussys|rectum|retard|rimjaw|rimming|s hit|s.o.b.|sadist|schlong|screwing|scroat|scrote|scrotum|semen|sex|sh!\+|sh!t|sh1t|shag|shagger|shaggin|shagging|shemale|shi\+|shit|shitdick|shite|shited|shitey|shitfuck|shitfull|shithead|shiting|shitings|shits|shitted|shitter|shitters|shitting|shittings|shitty|skank|slut|sluts|smegma|smut|snatch|son-of-a-bitch|spac|spunk|s_h_i_t|t1tt1e5|t1tties|teets|teez|testical|testicle|tit|titfuck|tits|titt|tittie5|tittiefucker|titties|tittyfuck|tittywank|titwank|tosser|turd|tw4t|twat|twathead|twatty|twunt|twunter|v14gra|v1gra|vagina|viagra|vulva|w00se|wang|wank|wanker|wanky|whoar|whore|willies|willy|xrated|xxx)\b/gi
  8245. }
  8246. , function(e, t) {
  8247. e.exports.hats = [{
  8248. id: 45,
  8249. name: "Shame!",
  8250. dontSell: !0,
  8251. price: 0,
  8252. scale: 120,
  8253. desc: "hacks are for losers"
  8254. }, {
  8255. id: 51,
  8256. name: "Moo Cap",
  8257. price: 0,
  8258. scale: 120,
  8259. desc: "coolest mooer around"
  8260. }, {
  8261. id: 50,
  8262. name: "Apple Cap",
  8263. price: 0,
  8264. scale: 120,
  8265. desc: "apple farms remembers"
  8266. }, {
  8267. id: 28,
  8268. name: "Moo Head",
  8269. price: 0,
  8270. scale: 120,
  8271. desc: "no effect"
  8272. }, {
  8273. id: 29,
  8274. name: "Pig Head",
  8275. price: 0,
  8276. scale: 120,
  8277. desc: "no effect"
  8278. }, {
  8279. id: 30,
  8280. name: "Fluff Head",
  8281. price: 0,
  8282. scale: 120,
  8283. desc: "no effect"
  8284. }, {
  8285. id: 36,
  8286. name: "Pandou Head",
  8287. price: 0,
  8288. scale: 120,
  8289. desc: "no effect"
  8290. }, {
  8291. id: 37,
  8292. name: "Bear Head",
  8293. price: 0,
  8294. scale: 120,
  8295. desc: "no effect"
  8296. }, {
  8297. id: 38,
  8298. name: "Monkey Head",
  8299. price: 0,
  8300. scale: 120,
  8301. desc: "no effect"
  8302. }, {
  8303. id: 44,
  8304. name: "Polar Head",
  8305. price: 0,
  8306. scale: 120,
  8307. desc: "no effect"
  8308. }, {
  8309. id: 35,
  8310. name: "Fez Hat",
  8311. price: 0,
  8312. scale: 120,
  8313. desc: "no effect"
  8314. }, {
  8315. id: 42,
  8316. name: "Enigma Hat",
  8317. price: 0,
  8318. scale: 120,
  8319. desc: "join the enigma army"
  8320. }, {
  8321. id: 43,
  8322. name: "Blitz Hat",
  8323. price: 0,
  8324. scale: 120,
  8325. desc: "hey everybody i'm blitz"
  8326. }, {
  8327. id: 49,
  8328. name: "Bob XIII Hat",
  8329. price: 0,
  8330. scale: 120,
  8331. desc: "like and subscribe"
  8332. }, {
  8333. id: 57,
  8334. name: "Pumpkin",
  8335. price: 50,
  8336. scale: 120,
  8337. desc: "Spooooky"
  8338. }, {
  8339. id: 8,
  8340. name: "Bummle Hat",
  8341. price: 100,
  8342. scale: 120,
  8343. desc: "no effect"
  8344. }, {
  8345. id: 2,
  8346. name: "Straw Hat",
  8347. price: 500,
  8348. scale: 120,
  8349. desc: "no effect"
  8350. }, {
  8351. id: 15,
  8352. name: "Winter Cap",
  8353. price: 600,
  8354. scale: 120,
  8355. desc: "allows you to move at normal speed in snow",
  8356. coldM: 1
  8357. }, {
  8358. id: 5,
  8359. name: "Cowboy Hat",
  8360. price: 1e3,
  8361. scale: 120,
  8362. desc: "no effect"
  8363. }, {
  8364. id: 4,
  8365. name: "Ranger Hat",
  8366. price: 2e3,
  8367. scale: 120,
  8368. desc: "no effect"
  8369. }, {
  8370. id: 18,
  8371. name: "Explorer Hat",
  8372. price: 2e3,
  8373. scale: 120,
  8374. desc: "no effect"
  8375. }, {
  8376. id: 31,
  8377. name: "Flipper Hat",
  8378. price: 2500,
  8379. scale: 120,
  8380. desc: "have more control while in water",
  8381. watrImm: !0
  8382. }, {
  8383. id: 1,
  8384. name: "Marksman Cap",
  8385. price: 3e3,
  8386. scale: 120,
  8387. desc: "increases arrow speed and range",
  8388. aMlt: 1.3
  8389. }, {
  8390. id: 10,
  8391. name: "Bush Gear",
  8392. price: 3e3,
  8393. scale: 160,
  8394. desc: "allows you to disguise yourself as a bush"
  8395. }, {
  8396. id: 48,
  8397. name: "Halo",
  8398. price: 3e3,
  8399. scale: 120,
  8400. desc: "no effect"
  8401. }, {
  8402. id: 6,
  8403. name: "Soldier Helmet",
  8404. price: 4e3,
  8405. scale: 120,
  8406. desc: "reduces damage taken but slows movement",
  8407. spdMult: .94,
  8408. dmgMult: .75
  8409. }, {
  8410. id: 23,
  8411. name: "Anti Venom Gear",
  8412. price: 4e3,
  8413. scale: 120,
  8414. desc: "makes you immune to poison",
  8415. poisonRes: 1
  8416. }, {
  8417. id: 13,
  8418. name: "Medic Gear",
  8419. price: 5e3,
  8420. scale: 110,
  8421. desc: "slowly regenerates health over time",
  8422. healthRegen: 3
  8423. }, {
  8424. id: 9,
  8425. name: "Miners Helmet",
  8426. price: 5e3,
  8427. scale: 120,
  8428. desc: "earn 1 extra gold per resource",
  8429. extraGold: 1
  8430. }, {
  8431. id: 32,
  8432. name: "Musketeer Hat",
  8433. price: 5e3,
  8434. scale: 120,
  8435. desc: "reduces cost of projectiles",
  8436. projCost: .5
  8437. }, {
  8438. id: 7,
  8439. name: "Bull Helmet",
  8440. price: 6e3,
  8441. scale: 120,
  8442. desc: "increases damage done but drains health",
  8443. healthRegen: -5,
  8444. dmgMultO: 1.5,
  8445. spdMult: .96
  8446. }, {
  8447. id: 22,
  8448. name: "Emp Helmet",
  8449. price: 6e3,
  8450. scale: 120,
  8451. desc: "turrets won't attack but you move slower",
  8452. antiTurret: 1,
  8453. spdMult: .7
  8454. }, {
  8455. id: 12,
  8456. name: "Booster Hat",
  8457. price: 6e3,
  8458. scale: 120,
  8459. desc: "increases your movement speed",
  8460. spdMult: 1.16
  8461. }, {
  8462. id: 26,
  8463. name: "Barbarian Armor",
  8464. price: 8e3,
  8465. scale: 120,
  8466. desc: "knocks back enemies that attack you",
  8467. dmgK: .6
  8468. }, {
  8469. id: 21,
  8470. name: "Plague Mask",
  8471. price: 1e4,
  8472. scale: 120,
  8473. desc: "melee attacks deal poison damage",
  8474. poisonDmg: 5,
  8475. poisonTime: 6
  8476. }, {
  8477. id: 46,
  8478. name: "Bull Mask",
  8479. price: 1e4,
  8480. scale: 120,
  8481. desc: "bulls won't target you unless you attack them",
  8482. bullRepel: 1
  8483. }, {
  8484. id: 14,
  8485. name: "Windmill Hat",
  8486. topSprite: !0,
  8487. price: 1e4,
  8488. scale: 120,
  8489. desc: "generates points while worn",
  8490. pps: 1.5
  8491. }, {
  8492. id: 11,
  8493. name: "Spike Gear",
  8494. topSprite: !0,
  8495. price: 1e4,
  8496. scale: 120,
  8497. desc: "deal damage to players that damage you",
  8498. dmg: .45
  8499. }, {
  8500. id: 53,
  8501. name: "Turret Gear",
  8502. topSprite: !0,
  8503. price: 1e4,
  8504. scale: 120,
  8505. desc: "you become a walking turret",
  8506. turret: {
  8507. proj: 1,
  8508. range: 700,
  8509. rate: 2500
  8510. },
  8511. spdMult: .7
  8512. }, {
  8513. id: 20,
  8514. name: "Samurai Armor",
  8515. price: 12e3,
  8516. scale: 120,
  8517. desc: "increased attack speed and fire rate",
  8518. atkSpd: .78
  8519. }, {
  8520. id: 58,
  8521. name: "Dark Knight",
  8522. price: 12e3,
  8523. scale: 120,
  8524. desc: "restores health when you deal damage",
  8525. healD: .4
  8526. }, {
  8527. id: 27,
  8528. name: "Scavenger Gear",
  8529. price: 15e3,
  8530. scale: 120,
  8531. desc: "earn double points for each kill",
  8532. kScrM: 2
  8533. }, {
  8534. id: 40,
  8535. name: "Tank Gear",
  8536. price: 15e3,
  8537. scale: 120,
  8538. desc: "increased damage to buildings but slower movement",
  8539. spdMult: .3,
  8540. bDmg: 3.3
  8541. }, {
  8542. id: 52,
  8543. name: "Thief Gear",
  8544. price: 15e3,
  8545. scale: 120,
  8546. desc: "steal half of a players gold when you kill them",
  8547. goldSteal: .5
  8548. }, {
  8549. id: 55,
  8550. name: "Bloodthirster",
  8551. price: 2e4,
  8552. scale: 120,
  8553. desc: "Restore Health when dealing damage. And increased damage",
  8554. healD: .25,
  8555. dmgMultO: 1.2
  8556. }, {
  8557. id: 56,
  8558. name: "Assassin Gear",
  8559. price: 2e4,
  8560. scale: 120,
  8561. desc: "Go invisible when not moving. Can't eat. Increased speed",
  8562. noEat: !0,
  8563. spdMult: 1.1,
  8564. invisTimer: 1e3
  8565. }],
  8566. e.exports.accessories = [{
  8567. id: 12,
  8568. name: "Snowball",
  8569. price: 1e3,
  8570. scale: 105,
  8571. xOff: 18,
  8572. desc: "no effect"
  8573. }, {
  8574. id: 9,
  8575. name: "Tree Cape",
  8576. price: 1e3,
  8577. scale: 90,
  8578. desc: "no effect"
  8579. }, {
  8580. id: 10,
  8581. name: "Stone Cape",
  8582. price: 1e3,
  8583. scale: 90,
  8584. desc: "no effect"
  8585. }, {
  8586. id: 3,
  8587. name: "Cookie Cape",
  8588. price: 1500,
  8589. scale: 90,
  8590. desc: "no effect"
  8591. }, {
  8592. id: 8,
  8593. name: "Cow Cape",
  8594. price: 2e3,
  8595. scale: 90,
  8596. desc: "no effect"
  8597. }, {
  8598. id: 11,
  8599. name: "Monkey Tail",
  8600. price: 2e3,
  8601. scale: 97,
  8602. xOff: 25,
  8603. desc: "Super speed but reduced damage",
  8604. spdMult: 1.35,
  8605. dmgMultO: .2
  8606. }, {
  8607. id: 17,
  8608. name: "Apple Basket",
  8609. price: 3e3,
  8610. scale: 80,
  8611. xOff: 12,
  8612. desc: "slowly regenerates health over time",
  8613. healthRegen: 1
  8614. }, {
  8615. id: 6,
  8616. name: "Winter Cape",
  8617. price: 3e3,
  8618. scale: 90,
  8619. desc: "no effect"
  8620. }, {
  8621. id: 4,
  8622. name: "Skull Cape",
  8623. price: 4e3,
  8624. scale: 90,
  8625. desc: "no effect"
  8626. }, {
  8627. id: 5,
  8628. name: "Dash Cape",
  8629. price: 5e3,
  8630. scale: 90,
  8631. desc: "no effect"
  8632. }, {
  8633. id: 2,
  8634. name: "Dragon Cape",
  8635. price: 6e3,
  8636. scale: 90,
  8637. desc: "no effect"
  8638. }, {
  8639. id: 1,
  8640. name: "Super Cape",
  8641. price: 8e3,
  8642. scale: 90,
  8643. desc: "no effect"
  8644. }, {
  8645. id: 7,
  8646. name: "Troll Cape",
  8647. price: 8e3,
  8648. scale: 90,
  8649. desc: "no effect"
  8650. }, {
  8651. id: 14,
  8652. name: "Thorns",
  8653. price: 1e4,
  8654. scale: 115,
  8655. xOff: 20,
  8656. desc: "no effect"
  8657. }, {
  8658. id: 15,
  8659. name: "Blockades",
  8660. price: 1e4,
  8661. scale: 95,
  8662. xOff: 15,
  8663. desc: "no effect"
  8664. }, {
  8665. id: 20,
  8666. name: "Devils Tail",
  8667. price: 1e4,
  8668. scale: 95,
  8669. xOff: 20,
  8670. desc: "no effect"
  8671. }, {
  8672. id: 16,
  8673. name: "Sawblade",
  8674. price: 12e3,
  8675. scale: 90,
  8676. spin: !0,
  8677. xOff: 0,
  8678. desc: "deal damage to players that damage you",
  8679. dmg: .15
  8680. }, {
  8681. id: 13,
  8682. name: "Angel Wings",
  8683. price: 15e3,
  8684. scale: 138,
  8685. xOff: 22,
  8686. desc: "slowly regenerates health over time",
  8687. healthRegen: 3
  8688. }, {
  8689. id: 19,
  8690. name: "Shadow Wings",
  8691. price: 15e3,
  8692. scale: 138,
  8693. xOff: 22,
  8694. desc: "increased movement speed",
  8695. spdMult: 1.1
  8696. }, {
  8697. id: 18,
  8698. name: "Blood Wings",
  8699. price: 2e4,
  8700. scale: 178,
  8701. xOff: 26,
  8702. desc: "restores health when you deal damage",
  8703. healD: .2
  8704. }, {
  8705. id: 21,
  8706. name: "Corrupt X Wings",
  8707. price: 2e4,
  8708. scale: 178,
  8709. xOff: 26,
  8710. desc: "deal damage to players that damage you",
  8711. dmg: .25
  8712. }]
  8713. }
  8714. , function(e, t) {
  8715. e.exports = function(e, t, n, i, r, s, a) {
  8716. this.init = function(e, t, n, i, r, s, o, c, l) {
  8717. this.active = !0,
  8718. this.indx = e,
  8719. this.x = t,
  8720. this.y = n,
  8721. this.dir = i,
  8722. this.skipMov = !0,
  8723. this.speed = r,
  8724. this.dmg = s,
  8725. this.scale = c,
  8726. this.range = o,
  8727. this.owner = l,
  8728. a && (this.sentTo = {})
  8729. }
  8730. ;
  8731. var o, c = [];
  8732. this.update = function(l) {
  8733. if (this.active) {
  8734. var h, u = this.speed * l;
  8735. if (this.skipMov ? this.skipMov = !1 : (this.x += u * Math.cos(this.dir),
  8736. this.y += u * Math.sin(this.dir),
  8737. this.range -= u,
  8738. this.range <= 0 && (this.x += this.range * Math.cos(this.dir),
  8739. this.y += this.range * Math.sin(this.dir),
  8740. u = 1,
  8741. this.range = 0,
  8742. this.active = !1)),
  8743. a) {
  8744. for (var f = 0; f < e.length; ++f)
  8745. !this.sentTo[e[f].id] && e[f].canSee(this) && (this.sentTo[e[f].id] = 1,
  8746. a.send(e[f].id, "18", s.fixTo(this.x, 1), s.fixTo(this.y, 1), s.fixTo(this.dir, 2), s.fixTo(this.range, 1), this.speed, this.indx, this.layer, this.sid));
  8747. for (c.length = 0,
  8748. f = 0; f < e.length + t.length; ++f)
  8749. !(o = e[f] || t[f - e.length]).alive || o == this.owner || this.owner.team && o.team == this.owner.team || s.lineInRect(o.x - o.scale, o.y - o.scale, o.x + o.scale, o.y + o.scale, this.x, this.y, this.x + u * Math.cos(this.dir), this.y + u * Math.sin(this.dir)) && c.push(o);
  8750. for (var d = n.getGridArrays(this.x, this.y, this.scale), p = 0; p < d.length; ++p)
  8751. for (var g = 0; g < d[p].length; ++g)
  8752. h = (o = d[p][g]).getScale(),
  8753. o.active && this.ignoreObj != o.sid && this.layer <= o.layer && c.indexOf(o) < 0 && !o.ignoreCollision && s.lineInRect(o.x - h, o.y - h, o.x + h, o.y + h, this.x, this.y, this.x + u * Math.cos(this.dir), this.y + u * Math.sin(this.dir)) && c.push(o);
  8754. if (c.length > 0) {
  8755. var m = null
  8756. , y = null
  8757. , k = null;
  8758. for (f = 0; f < c.length; ++f)
  8759. k = s.getDistance(this.x, this.y, c[f].x, c[f].y),
  8760. (null == y || k < y) && (y = k,
  8761. m = c[f]);
  8762. if (m.isPlayer || m.isAI) {
  8763. var v = .3 * (m.weightM || 1);
  8764. m.xVel += v * Math.cos(this.dir),
  8765. m.yVel += v * Math.sin(this.dir),
  8766. null != m.weaponIndex && i.weapons[m.weaponIndex].shield && s.getAngleDist(this.dir + Math.PI, m.dir) <= r.shieldAngle || m.changeHealth(-this.dmg, this.owner, this.owner)
  8767. } else
  8768. for (m.projDmg && m.health && m.changeHealth(-this.dmg) && n.disableObj(m),
  8769. f = 0; f < e.length; ++f)
  8770. e[f].active && (m.sentTo[e[f].id] && (m.active ? e[f].canSee(m) && a.send(e[f].id, "8", s.fixTo(this.dir, 2), m.sid) : a.send(e[f].id, "12", m.sid)),
  8771. m.active || m.owner != e[f] || e[f].changeItemCount(m.group.id, -1));
  8772. for (this.active = !1,
  8773. f = 0; f < e.length; ++f)
  8774. this.sentTo[e[f].id] && a.send(e[f].id, "19", this.sid, s.fixTo(y, 1))
  8775. }
  8776. }
  8777. }
  8778. }
  8779. }
  8780. }
  8781. , function(e, t) {
  8782. e.exports = function(e, t, n, i, r, s, a, o, c) {
  8783. this.addProjectile = function(l, h, u, f, d, p, g, m, y) {
  8784. for (var k, v = s.projectiles[p], w = 0; w < t.length; ++w)
  8785. if (!t[w].active) {
  8786. k = t[w];
  8787. break
  8788. }
  8789. return k || ((k = new e(n,i,r,s,a,o,c)).sid = t.length,
  8790. t.push(k)),
  8791. k.init(p, l, h, u, d, v.dmg, f, v.scale, g),
  8792. k.ignoreObj = m,
  8793. k.layer = y || v.layer,
  8794. k.src = v.src,
  8795. k
  8796. }
  8797. }
  8798. }
  8799. , function(e, t) {
  8800. e.exports.obj = function(e, t) {
  8801. var n;
  8802. this.sounds = [],
  8803. this.active = !0,
  8804. this.play = function(t, i, r) {
  8805. i && this.active && ((n = this.sounds[t]) || (n = new Howl({
  8806. src: ".././sound/" + t + ".mp3"
  8807. }),
  8808. this.sounds[t] = n),
  8809. r && n.isPlaying || (n.isPlaying = !0,
  8810. n.play(),
  8811. n.volume((i || 1) * e.volumeMult),
  8812. n.loop(r)))
  8813. }
  8814. ,
  8815. this.toggleMute = function(e, t) {
  8816. (n = this.sounds[e]) && n.mute(t)
  8817. }
  8818. ,
  8819. this.stop = function(e) {
  8820. (n = this.sounds[e]) && (n.stop(),
  8821. n.isPlaying = !1)
  8822. }
  8823. }
  8824. }
  8825. , function(e, t, n) {
  8826. var i = n(60)
  8827. , r = n(67);
  8828. function s(e, t, n, i, r) {
  8829. "localhost" == location.hostname && (window.location.hostname = "127.0.0.1"),
  8830. this.debugLog = !1,
  8831. this.baseUrl = e,
  8832. this.lobbySize = n,
  8833. this.devPort = t,
  8834. this.lobbySpread = i,
  8835. this.rawIPs = !!r,
  8836. this.server = void 0,
  8837. this.gameIndex = void 0,
  8838. this.callback = void 0,
  8839. this.errorCallback = void 0,
  8840. this.processServers(vultr.servers)
  8841. }
  8842. s.prototype.regionInfo = {
  8843. 0: {
  8844. name: "Local",
  8845. latitude: 0,
  8846. longitude: 0
  8847. },
  8848. "vultr:1": {
  8849. name: "New Jersey",
  8850. latitude: 40.1393329,
  8851. longitude: -75.8521818
  8852. },
  8853. "vultr:2": {
  8854. name: "Chicago",
  8855. latitude: 41.8339037,
  8856. longitude: -87.872238
  8857. },
  8858. "vultr:3": {
  8859. name: "Dallas",
  8860. latitude: 32.8208751,
  8861. longitude: -96.8714229
  8862. },
  8863. "vultr:4": {
  8864. name: "Seattle",
  8865. latitude: 47.6149942,
  8866. longitude: -122.4759879
  8867. },
  8868. "vultr:5": {
  8869. name: "Los Angeles",
  8870. latitude: 34.0207504,
  8871. longitude: -118.691914
  8872. },
  8873. "vultr:6": {
  8874. name: "Atlanta",
  8875. latitude: 33.7676334,
  8876. longitude: -84.5610332
  8877. },
  8878. "vultr:7": {
  8879. name: "Amsterdam",
  8880. latitude: 52.3745287,
  8881. longitude: 4.7581878
  8882. },
  8883. "vultr:8": {
  8884. name: "London",
  8885. latitude: 51.5283063,
  8886. longitude: -.382486
  8887. },
  8888. "vultr:9": {
  8889. name: "Frankfurt",
  8890. latitude: 50.1211273,
  8891. longitude: 8.496137
  8892. },
  8893. "vultr:12": {
  8894. name: "Silicon Valley",
  8895. latitude: 37.4024714,
  8896. longitude: -122.3219752
  8897. },
  8898. "vultr:19": {
  8899. name: "Sydney",
  8900. latitude: -33.8479715,
  8901. longitude: 150.651084
  8902. },
  8903. "vultr:24": {
  8904. name: "Paris",
  8905. latitude: 48.8588376,
  8906. longitude: 2.2773454
  8907. },
  8908. "vultr:25": {
  8909. name: "Tokyo",
  8910. latitude: 35.6732615,
  8911. longitude: 139.569959
  8912. },
  8913. "vultr:39": {
  8914. name: "Miami",
  8915. latitude: 25.7823071,
  8916. longitude: -80.3012156
  8917. },
  8918. "vultr:40": {
  8919. name: "Singapore",
  8920. latitude: 1.3147268,
  8921. longitude: 103.7065876
  8922. }
  8923. },
  8924. s.prototype.start = function(e, t) {
  8925. this.callback = e,
  8926. this.errorCallback = t;
  8927. var n = this.parseServerQuery();
  8928. n ? (this.log("Found server in query."),
  8929. this.password = n[3],
  8930. this.connect(n[0], n[1], n[2])) : (this.log("Pinging servers..."),
  8931. this.pingServers())
  8932. }
  8933. ,
  8934. s.prototype.parseServerQuery = function() {
  8935. var e = i.parse(location.href, !0)
  8936. , t = e.query.server;
  8937. if ("string" == typeof t) {
  8938. var n = t.split(":");
  8939. if (3 == n.length) {
  8940. var r = n[0]
  8941. , s = parseInt(n[1])
  8942. , a = parseInt(n[2]);
  8943. return "0" == r || r.startsWith("vultr:") || (r = "vultr:" + r),
  8944. [r, s, a, e.query.password]
  8945. }
  8946. this.errorCallback("Invalid number of server parameters in " + t)
  8947. }
  8948. }
  8949. ,
  8950. s.prototype.findServer = function(e, t) {
  8951. var n = this.servers[e];
  8952. if (Array.isArray(n)) {
  8953. for (var i = 0; i < n.length; i++) {
  8954. var r = n[i];
  8955. if (r.index == t)
  8956. return r
  8957. }
  8958. console.warn("Could not find server in region " + e + " with index " + t + ".")
  8959. } else
  8960. this.errorCallback("No server list for region " + e)
  8961. }
  8962. ,
  8963. s.prototype.pingServers = function() {
  8964. var e = this
  8965. , t = [];
  8966. for (var n in this.servers)
  8967. if (this.servers.hasOwnProperty(n)) {
  8968. var i = this.servers[n]
  8969. , r = i[Math.floor(Math.random() * i.length)];
  8970. null != r ? function(i, r) {
  8971. var s = new XMLHttpRequest;
  8972. s.onreadystatechange = function(i) {
  8973. var s = i.target;
  8974. if (4 == s.readyState)
  8975. if (200 == s.status) {
  8976. for (var a = 0; a < t.length; a++)
  8977. t[a].abort();
  8978. e.log("Connecting to region", r.region);
  8979. var o = e.seekServer(r.region);
  8980. e.connect(o[0], o[1], o[2])
  8981. } else
  8982. console.warn("Error pinging " + r.ip + " in region " + n)
  8983. }
  8984. ;
  8985. var a = "//" + e.serverAddress(r.ip, !0) + ":" + e.serverPort(r) + "/ping";
  8986. s.open("GET", a, !0),
  8987. s.send(null),
  8988. e.log("Pinging", a),
  8989. t.push(s)
  8990. }(0, r) : console.log("No target server for region " + n)
  8991. }
  8992. }
  8993. ,
  8994. s.prototype.seekServer = function(e, t, n) {
  8995. null == n && (n = "random"),
  8996. null == t && (t = !1);
  8997. const i = ["random"];
  8998. var r = this.lobbySize
  8999. , s = this.lobbySpread
  9000. , a = this.servers[e].flatMap((function(e) {
  9001. var t = 0;
  9002. return e.games.map((function(n) {
  9003. var i = t++;
  9004. return {
  9005. region: e.region,
  9006. index: e.index * e.games.length + i,
  9007. gameIndex: i,
  9008. gameCount: e.games.length,
  9009. playerCount: n.playerCount,
  9010. isPrivate: n.isPrivate
  9011. }
  9012. }
  9013. ))
  9014. }
  9015. )).filter((function(e) {
  9016. return !e.isPrivate
  9017. }
  9018. )).filter((function(e) {
  9019. return !t || 0 == e.playerCount && e.gameIndex >= e.gameCount / 2
  9020. }
  9021. )).filter((function(e) {
  9022. return "random" == n || i[e.index % i.length].key == n
  9023. }
  9024. )).sort((function(e, t) {
  9025. return t.playerCount - e.playerCount
  9026. }
  9027. )).filter((function(e) {
  9028. return e.playerCount < r
  9029. }
  9030. ));
  9031. if (t && a.reverse(),
  9032. 0 != a.length) {
  9033. var o = Math.min(s, a.length)
  9034. , c = Math.floor(Math.random() * o)
  9035. , l = a[c = Math.min(c, a.length - 1)]
  9036. , h = l.region
  9037. , u = (c = Math.floor(l.index / l.gameCount),
  9038. l.index % l.gameCount);
  9039. return this.log("Found server."),
  9040. [h, c, u]
  9041. }
  9042. this.errorCallback("No open servers.")
  9043. }
  9044. ,
  9045. s.prototype.connect = function(e, t, n) {
  9046. if (!this.connected) {
  9047. var i = this.findServer(e, t);
  9048. null != i ? (this.log("Connecting to server", i, "with game index", n),
  9049. i.games[n].playerCount >= this.lobbySize ? this.errorCallback("Server is already full.") : (window.history.replaceState(document.title, document.title, this.generateHref(e, t, n, this.password)),
  9050. this.server = i,
  9051. this.gameIndex = n,
  9052. this.log("Calling callback with address", this.serverAddress(i.ip), "on port", this.serverPort(i), "with game index", n),
  9053. this.callback(this.serverAddress(i.ip), this.serverPort(i), n))) : this.errorCallback("Failed to find server for region " + e + " and index " + t)
  9054. }
  9055. }
  9056. ,
  9057. s.prototype.switchServer = function(e, t, n, i) {
  9058. this.switchingServers = !0,
  9059. window.location.href = this.generateHref(e, t, n, i)
  9060. }
  9061. ,
  9062. s.prototype.generateHref = function(e, t, n, i) {
  9063. var r = "/?server=" + (e = this.stripRegion(e)) + ":" + t + ":" + n;
  9064. return i && (r += "&password=" + encodeURIComponent(i)),
  9065. r
  9066. }
  9067. ,
  9068. s.prototype.serverAddress = function(e, t) {
  9069. return "127.0.0.1" == e || "7f000001" == e || "903d62ef5d1c2fecdcaeb5e7dd485eff" == e ? window.location.hostname : this.rawIPs ? t ? "ip_" + this.hashIP(e) + "." + this.baseUrl : e : "ip_" + e + "." + this.baseUrl
  9070. }
  9071. ,
  9072. s.prototype.serverPort = function(e) {
  9073. return 0 == e.region ? this.devPort : location.protocol.startsWith("https") ? 443 : 80
  9074. }
  9075. ,
  9076. s.prototype.processServers = function(e) {
  9077. for (var t = {}, n = 0; n < e.length; n++) {
  9078. var i = e[n]
  9079. , r = t[i.region];
  9080. null == r && (r = [],
  9081. t[i.region] = r),
  9082. r.push(i)
  9083. }
  9084. for (var s in t)
  9085. t[s] = t[s].sort((function(e, t) {
  9086. return e.index - t.index
  9087. }
  9088. ));
  9089. this.servers = t
  9090. }
  9091. ,
  9092. s.prototype.ipToHex = function(e) {
  9093. return e.split(".").map(e=>("00" + parseInt(e).toString(16)).substr(-2)).join("").toLowerCase()
  9094. }
  9095. ,
  9096. s.prototype.hashIP = function(e) {
  9097. return r(this.ipToHex(e))
  9098. }
  9099. ,
  9100. s.prototype.log = function() {
  9101. return this.debugLog ? console.log.apply(void 0, arguments) : console.verbose ? console.verbose.apply(void 0, arguments) : void 0
  9102. }
  9103. ,
  9104. s.prototype.stripRegion = function(e) {
  9105. return e.startsWith("vultr:") ? e = e.slice(6) : e.startsWith("do:") && (e = e.slice(3)),
  9106. e
  9107. }
  9108. ,
  9109. window.testVultrClient = function() {
  9110. var e = 1;
  9111. function t(t, n) {
  9112. (t = "" + t) == (n = "" + n) ? console.log(`Assert ${e} passed.`) : console.warn(`Assert ${e} failed. Expected ${n}, got ${t}.`),
  9113. e++
  9114. }
  9115. var n = new s("test.io",-1,5,1,!1);
  9116. n.errorCallback = function(e) {}
  9117. ,
  9118. n.processServers(function(e) {
  9119. var t = [];
  9120. for (var n in e)
  9121. for (var i = e[n], r = 0; r < i.length; r++)
  9122. t.push({
  9123. ip: n + ":" + r,
  9124. scheme: "testing",
  9125. region: n,
  9126. index: r,
  9127. games: i[r].map(e=>({
  9128. playerCount: e,
  9129. isPrivate: !1
  9130. }))
  9131. });
  9132. return t
  9133. }({
  9134. 1: [[0, 0, 0, 0], [0, 0, 0, 0]],
  9135. 2: [[5, 1, 0, 0], [0, 0, 0, 0]],
  9136. 3: [[5, 0, 1, 5], [0, 0, 0, 0]],
  9137. 4: [[5, 1, 1, 5], [1, 0, 0, 0]],
  9138. 5: [[5, 1, 1, 5], [1, 0, 4, 0]],
  9139. 6: [[5, 5, 5, 5], [2, 3, 1, 4]],
  9140. 7: [[5, 5, 5, 5], [5, 5, 5, 5]]
  9141. })),
  9142. t(n.seekServer(1, !1), [1, 0, 0]),
  9143. t(n.seekServer(1, !0), [1, 1, 3]),
  9144. t(n.seekServer(2, !1), [2, 0, 1]),
  9145. t(n.seekServer(2, !0), [2, 1, 3]),
  9146. t(n.seekServer(3, !1), [3, 0, 2]),
  9147. t(n.seekServer(3, !0), [3, 1, 3]),
  9148. t(n.seekServer(4, !1), [4, 0, 1]),
  9149. t(n.seekServer(4, !0), [4, 1, 3]),
  9150. t(n.seekServer(5, !1), [5, 1, 2]),
  9151. t(n.seekServer(5, !0), [5, 1, 3]),
  9152. t(n.seekServer(6, !1), [6, 1, 3]),
  9153. t(n.seekServer(6, !0), void 0),
  9154. t(n.seekServer(7, !1), void 0),
  9155. t(n.seekServer(7, !0), void 0),
  9156. console.log("Tests passed.")
  9157. }
  9158. ;
  9159. var a = function(e, t) {
  9160. return e.concat(t)
  9161. };
  9162. Array.prototype.flatMap = function(e) {
  9163. return function(e, t) {
  9164. return t.map(e).reduce(a, [])
  9165. }(e, this)
  9166. }
  9167. ,
  9168. e.exports = s
  9169. }
  9170. , function(e, t, n) {
  9171. "use strict";
  9172. var i = n(61)
  9173. , r = n(63);
  9174. function s() {
  9175. this.protocol = null,
  9176. this.slashes = null,
  9177. this.auth = null,
  9178. this.host = null,
  9179. this.port = null,
  9180. this.hostname = null,
  9181. this.hash = null,
  9182. this.search = null,
  9183. this.query = null,
  9184. this.pathname = null,
  9185. this.path = null,
  9186. this.href = null
  9187. }
  9188. t.parse = v,
  9189. t.resolve = function(e, t) {
  9190. return v(e, !1, !0).resolve(t)
  9191. }
  9192. ,
  9193. t.resolveObject = function(e, t) {
  9194. return e ? v(e, !1, !0).resolveObject(t) : t
  9195. }
  9196. ,
  9197. t.format = function(e) {
  9198. return r.isString(e) && (e = v(e)),
  9199. e instanceof s ? e.format() : s.prototype.format.call(e)
  9200. }
  9201. ,
  9202. t.Url = s;
  9203. var a = /^([a-z0-9.+-]+:)/i
  9204. , o = /:[0-9]*$/
  9205. , c = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/
  9206. , l = ["{", "}", "|", "\\", "^", "`"].concat(["<", ">", '"', "`", " ", "\r", "\n", "\t"])
  9207. , h = ["'"].concat(l)
  9208. , u = ["%", "/", "?", ";", "#"].concat(h)
  9209. , f = ["/", "?", "#"]
  9210. , d = /^[+a-z0-9A-Z_-]{0,63}$/
  9211. , p = /^([+a-z0-9A-Z_-]{0,63})(.*)$/
  9212. , g = {
  9213. javascript: !0,
  9214. "javascript:": !0
  9215. }
  9216. , m = {
  9217. javascript: !0,
  9218. "javascript:": !0
  9219. }
  9220. , y = {
  9221. http: !0,
  9222. https: !0,
  9223. ftp: !0,
  9224. gopher: !0,
  9225. file: !0,
  9226. "http:": !0,
  9227. "https:": !0,
  9228. "ftp:": !0,
  9229. "gopher:": !0,
  9230. "file:": !0
  9231. }
  9232. , k = n(64);
  9233. function v(e, t, n) {
  9234. if (e && r.isObject(e) && e instanceof s)
  9235. return e;
  9236. var i = new s;
  9237. return i.parse(e, t, n),
  9238. i
  9239. }
  9240. s.prototype.parse = function(e, t, n) {
  9241. if (!r.isString(e))
  9242. throw new TypeError("Parameter 'url' must be a string, not " + typeof e);
  9243. var s = e.indexOf("?")
  9244. , o = -1 !== s && s < e.indexOf("#") ? "?" : "#"
  9245. , l = e.split(o);
  9246. l[0] = l[0].replace(/\\/g, "/");
  9247. var v = e = l.join(o);
  9248. if (v = v.trim(),
  9249. !n && 1 === e.split("#").length) {
  9250. var w = c.exec(v);
  9251. if (w)
  9252. return this.path = v,
  9253. this.href = v,
  9254. this.pathname = w[1],
  9255. w[2] ? (this.search = w[2],
  9256. this.query = t ? k.parse(this.search.substr(1)) : this.search.substr(1)) : t && (this.search = "",
  9257. this.query = {}),
  9258. this
  9259. }
  9260. var b = a.exec(v);
  9261. if (b) {
  9262. var x = (b = b[0]).toLowerCase();
  9263. this.protocol = x,
  9264. v = v.substr(b.length)
  9265. }
  9266. if (n || b || v.match(/^\/\/[^@\/]+@[^@\/]+/)) {
  9267. var S = "//" === v.substr(0, 2);
  9268. !S || b && m[b] || (v = v.substr(2),
  9269. this.slashes = !0)
  9270. }
  9271. if (!m[b] && (S || b && !y[b])) {
  9272. for (var T, I, E = -1, M = 0; M < f.length; M++)
  9273. -1 !== (A = v.indexOf(f[M])) && (-1 === E || A < E) && (E = A);
  9274. for (-1 !== (I = -1 === E ? v.lastIndexOf("@") : v.lastIndexOf("@", E)) && (T = v.slice(0, I),
  9275. v = v.slice(I + 1),
  9276. this.auth = decodeURIComponent(T)),
  9277. E = -1,
  9278. M = 0; M < u.length; M++) {
  9279. var A;
  9280. -1 !== (A = v.indexOf(u[M])) && (-1 === E || A < E) && (E = A)
  9281. }
  9282. -1 === E && (E = v.length),
  9283. this.host = v.slice(0, E),
  9284. v = v.slice(E),
  9285. this.parseHost(),
  9286. this.hostname = this.hostname || "";
  9287. var P = "[" === this.hostname[0] && "]" === this.hostname[this.hostname.length - 1];
  9288. if (!P)
  9289. for (var B = this.hostname.split(/\./), C = (M = 0,
  9290. B.length); M < C; M++) {
  9291. var O = B[M];
  9292. if (O && !O.match(d)) {
  9293. for (var R = "", j = 0, _ = O.length; j < _; j++)
  9294. O.charCodeAt(j) > 127 ? R += "x" : R += O[j];
  9295. if (!R.match(d)) {
  9296. var U = B.slice(0, M)
  9297. , D = B.slice(M + 1)
  9298. , L = O.match(p);
  9299. L && (U.push(L[1]),
  9300. D.unshift(L[2])),
  9301. D.length && (v = "/" + D.join(".") + v),
  9302. this.hostname = U.join(".");
  9303. break
  9304. }
  9305. }
  9306. }
  9307. this.hostname.length > 255 ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(),
  9308. P || (this.hostname = i.toASCII(this.hostname));
  9309. var F = this.port ? ":" + this.port : ""
  9310. , z = this.hostname || "";
  9311. this.host = z + F,
  9312. this.href += this.host,
  9313. P && (this.hostname = this.hostname.substr(1, this.hostname.length - 2),
  9314. "/" !== v[0] && (v = "/" + v))
  9315. }
  9316. if (!g[x])
  9317. for (M = 0,
  9318. C = h.length; M < C; M++) {
  9319. var H = h[M];
  9320. if (-1 !== v.indexOf(H)) {
  9321. var V = encodeURIComponent(H);
  9322. V === H && (V = escape(H)),
  9323. v = v.split(H).join(V)
  9324. }
  9325. }
  9326. var q = v.indexOf("#");
  9327. -1 !== q && (this.hash = v.substr(q),
  9328. v = v.slice(0, q));
  9329. var Y = v.indexOf("?");
  9330. if (-1 !== Y ? (this.search = v.substr(Y),
  9331. this.query = v.substr(Y + 1),
  9332. t && (this.query = k.parse(this.query)),
  9333. v = v.slice(0, Y)) : t && (this.search = "",
  9334. this.query = {}),
  9335. v && (this.pathname = v),
  9336. y[x] && this.hostname && !this.pathname && (this.pathname = "/"),
  9337. this.pathname || this.search) {
  9338. F = this.pathname || "";
  9339. var W = this.search || "";
  9340. this.path = F + W
  9341. }
  9342. return this.href = this.format(),
  9343. this
  9344. }
  9345. ,
  9346. s.prototype.format = function() {
  9347. var e = this.auth || "";
  9348. e && (e = (e = encodeURIComponent(e)).replace(/%3A/i, ":"),
  9349. e += "@");
  9350. var t = this.protocol || ""
  9351. , n = this.pathname || ""
  9352. , i = this.hash || ""
  9353. , s = !1
  9354. , a = "";
  9355. this.host ? s = e + this.host : this.hostname && (s = e + (-1 === this.hostname.indexOf(":") ? this.hostname : "[" + this.hostname + "]"),
  9356. this.port && (s += ":" + this.port)),
  9357. this.query && r.isObject(this.query) && Object.keys(this.query).length && (a = k.stringify(this.query));
  9358. var o = this.search || a && "?" + a || "";
  9359. return t && ":" !== t.substr(-1) && (t += ":"),
  9360. this.slashes || (!t || y[t]) && !1 !== s ? (s = "//" + (s || ""),
  9361. n && "/" !== n.charAt(0) && (n = "/" + n)) : s || (s = ""),
  9362. i && "#" !== i.charAt(0) && (i = "#" + i),
  9363. o && "?" !== o.charAt(0) && (o = "?" + o),
  9364. t + s + (n = n.replace(/[?#]/g, (function(e) {
  9365. return encodeURIComponent(e)
  9366. }
  9367. ))) + (o = o.replace("#", "%23")) + i
  9368. }
  9369. ,
  9370. s.prototype.resolve = function(e) {
  9371. return this.resolveObject(v(e, !1, !0)).format()
  9372. }
  9373. ,
  9374. s.prototype.resolveObject = function(e) {
  9375. if (r.isString(e)) {
  9376. var t = new s;
  9377. t.parse(e, !1, !0),
  9378. e = t
  9379. }
  9380. for (var n = new s, i = Object.keys(this), a = 0; a < i.length; a++) {
  9381. var o = i[a];
  9382. n[o] = this[o]
  9383. }
  9384. if (n.hash = e.hash,
  9385. "" === e.href)
  9386. return n.href = n.format(),
  9387. n;
  9388. if (e.slashes && !e.protocol) {
  9389. for (var c = Object.keys(e), l = 0; l < c.length; l++) {
  9390. var h = c[l];
  9391. "protocol" !== h && (n[h] = e[h])
  9392. }
  9393. return y[n.protocol] && n.hostname && !n.pathname && (n.path = n.pathname = "/"),
  9394. n.href = n.format(),
  9395. n
  9396. }
  9397. if (e.protocol && e.protocol !== n.protocol) {
  9398. if (!y[e.protocol]) {
  9399. for (var u = Object.keys(e), f = 0; f < u.length; f++) {
  9400. var d = u[f];
  9401. n[d] = e[d]
  9402. }
  9403. return n.href = n.format(),
  9404. n
  9405. }
  9406. if (n.protocol = e.protocol,
  9407. e.host || m[e.protocol])
  9408. n.pathname = e.pathname;
  9409. else {
  9410. for (var p = (e.pathname || "").split("/"); p.length && !(e.host = p.shift()); )
  9411. ;
  9412. e.host || (e.host = ""),
  9413. e.hostname || (e.hostname = ""),
  9414. "" !== p[0] && p.unshift(""),
  9415. p.length < 2 && p.unshift(""),
  9416. n.pathname = p.join("/")
  9417. }
  9418. if (n.search = e.search,
  9419. n.query = e.query,
  9420. n.host = e.host || "",
  9421. n.auth = e.auth,
  9422. n.hostname = e.hostname || e.host,
  9423. n.port = e.port,
  9424. n.pathname || n.search) {
  9425. var g = n.pathname || ""
  9426. , k = n.search || "";
  9427. n.path = g + k
  9428. }
  9429. return n.slashes = n.slashes || e.slashes,
  9430. n.href = n.format(),
  9431. n
  9432. }
  9433. var v = n.pathname && "/" === n.pathname.charAt(0)
  9434. , w = e.host || e.pathname && "/" === e.pathname.charAt(0)
  9435. , b = w || v || n.host && e.pathname
  9436. , x = b
  9437. , S = n.pathname && n.pathname.split("/") || []
  9438. , T = (p = e.pathname && e.pathname.split("/") || [],
  9439. n.protocol && !y[n.protocol]);
  9440. if (T && (n.hostname = "",
  9441. n.port = null,
  9442. n.host && ("" === S[0] ? S[0] = n.host : S.unshift(n.host)),
  9443. n.host = "",
  9444. e.protocol && (e.hostname = null,
  9445. e.port = null,
  9446. e.host && ("" === p[0] ? p[0] = e.host : p.unshift(e.host)),
  9447. e.host = null),
  9448. b = b && ("" === p[0] || "" === S[0])),
  9449. w)
  9450. n.host = e.host || "" === e.host ? e.host : n.host,
  9451. n.hostname = e.hostname || "" === e.hostname ? e.hostname : n.hostname,
  9452. n.search = e.search,
  9453. n.query = e.query,
  9454. S = p;
  9455. else if (p.length)
  9456. S || (S = []),
  9457. S.pop(),
  9458. S = S.concat(p),
  9459. n.search = e.search,
  9460. n.query = e.query;
  9461. else if (!r.isNullOrUndefined(e.search))
  9462. return T && (n.hostname = n.host = S.shift(),
  9463. (P = !!(n.host && n.host.indexOf("@") > 0) && n.host.split("@")) && (n.auth = P.shift(),
  9464. n.host = n.hostname = P.shift())),
  9465. n.search = e.search,
  9466. n.query = e.query,
  9467. r.isNull(n.pathname) && r.isNull(n.search) || (n.path = (n.pathname ? n.pathname : "") + (n.search ? n.search : "")),
  9468. n.href = n.format(),
  9469. n;
  9470. if (!S.length)
  9471. return n.pathname = null,
  9472. n.search ? n.path = "/" + n.search : n.path = null,
  9473. n.href = n.format(),
  9474. n;
  9475. for (var I = S.slice(-1)[0], E = (n.host || e.host || S.length > 1) && ("." === I || ".." === I) || "" === I, M = 0, A = S.length; A >= 0; A--)
  9476. "." === (I = S[A]) ? S.splice(A, 1) : ".." === I ? (S.splice(A, 1),
  9477. M++) : M && (S.splice(A, 1),
  9478. M--);
  9479. if (!b && !x)
  9480. for (; M--; M)
  9481. S.unshift("..");
  9482. !b || "" === S[0] || S[0] && "/" === S[0].charAt(0) || S.unshift(""),
  9483. E && "/" !== S.join("/").substr(-1) && S.push("");
  9484. var P, B = "" === S[0] || S[0] && "/" === S[0].charAt(0);
  9485. return T && (n.hostname = n.host = B ? "" : S.length ? S.shift() : "",
  9486. (P = !!(n.host && n.host.indexOf("@") > 0) && n.host.split("@")) && (n.auth = P.shift(),
  9487. n.host = n.hostname = P.shift())),
  9488. (b = b || n.host && S.length) && !B && S.unshift(""),
  9489. S.length ? n.pathname = S.join("/") : (n.pathname = null,
  9490. n.path = null),
  9491. r.isNull(n.pathname) && r.isNull(n.search) || (n.path = (n.pathname ? n.pathname : "") + (n.search ? n.search : "")),
  9492. n.auth = e.auth || n.auth,
  9493. n.slashes = n.slashes || e.slashes,
  9494. n.href = n.format(),
  9495. n
  9496. }
  9497. ,
  9498. s.prototype.parseHost = function() {
  9499. var e = this.host
  9500. , t = o.exec(e);
  9501. t && (":" !== (t = t[0]) && (this.port = t.substr(1)),
  9502. e = e.substr(0, e.length - t.length)),
  9503. e && (this.hostname = e)
  9504. }
  9505. }
  9506. , function(e, t, n) {
  9507. (function(e, i) {
  9508. var r;
  9509. !function(s) {
  9510. t && t.nodeType,
  9511. e && e.nodeType;
  9512. var a = "object" == typeof i && i;
  9513. a.global !== a && a.window !== a && a.self;
  9514. var o, c = 2147483647, l = 36, h = /^xn--/, u = /[^\x20-\x7E]/, f = /[\x2E\u3002\uFF0E\uFF61]/g, d = {
  9515. overflow: "Overflow: input needs wider integers to process",
  9516. "not-basic": "Illegal input >= 0x80 (not a basic code point)",
  9517. "invalid-input": "Invalid input"
  9518. }, p = Math.floor, g = String.fromCharCode;
  9519. function m(e) {
  9520. throw new RangeError(d[e])
  9521. }
  9522. function y(e, t) {
  9523. for (var n = e.length, i = []; n--; )
  9524. i[n] = t(e[n]);
  9525. return i
  9526. }
  9527. function k(e, t) {
  9528. var n = e.split("@")
  9529. , i = "";
  9530. return n.length > 1 && (i = n[0] + "@",
  9531. e = n[1]),
  9532. i + y((e = e.replace(f, ".")).split("."), t).join(".")
  9533. }
  9534. function v(e) {
  9535. for (var t, n, i = [], r = 0, s = e.length; r < s; )
  9536. (t = e.charCodeAt(r++)) >= 55296 && t <= 56319 && r < s ? 56320 == (64512 & (n = e.charCodeAt(r++))) ? i.push(((1023 & t) << 10) + (1023 & n) + 65536) : (i.push(t),
  9537. r--) : i.push(t);
  9538. return i
  9539. }
  9540. function w(e) {
  9541. return y(e, (function(e) {
  9542. var t = "";
  9543. return e > 65535 && (t += g((e -= 65536) >>> 10 & 1023 | 55296),
  9544. e = 56320 | 1023 & e),
  9545. t + g(e)
  9546. }
  9547. )).join("")
  9548. }
  9549. function b(e) {
  9550. return e - 48 < 10 ? e - 22 : e - 65 < 26 ? e - 65 : e - 97 < 26 ? e - 97 : l
  9551. }
  9552. function x(e, t) {
  9553. return e + 22 + 75 * (e < 26) - ((0 != t) << 5)
  9554. }
  9555. function S(e, t, n) {
  9556. var i = 0;
  9557. for (e = n ? p(e / 700) : e >> 1,
  9558. e += p(e / t); e > 455; i += l)
  9559. e = p(e / 35);
  9560. return p(i + 36 * e / (e + 38))
  9561. }
  9562. function T(e) {
  9563. var t, n, i, r, s, a, o, h, u, f, d = [], g = e.length, y = 0, k = 128, v = 72;
  9564. for ((n = e.lastIndexOf("-")) < 0 && (n = 0),
  9565. i = 0; i < n; ++i)
  9566. e.charCodeAt(i) >= 128 && m("not-basic"),
  9567. d.push(e.charCodeAt(i));
  9568. for (r = n > 0 ? n + 1 : 0; r < g; ) {
  9569. for (s = y,
  9570. a = 1,
  9571. o = l; r >= g && m("invalid-input"),
  9572. ((h = b(e.charCodeAt(r++))) >= l || h > p((c - y) / a)) && m("overflow"),
  9573. y += h * a,
  9574. !(h < (u = o <= v ? 1 : o >= v + 26 ? 26 : o - v)); o += l)
  9575. a > p(c / (f = l - u)) && m("overflow"),
  9576. a *= f;
  9577. v = S(y - s, t = d.length + 1, 0 == s),
  9578. p(y / t) > c - k && m("overflow"),
  9579. k += p(y / t),
  9580. y %= t,
  9581. d.splice(y++, 0, k)
  9582. }
  9583. return w(d)
  9584. }
  9585. function I(e) {
  9586. var t, n, i, r, s, a, o, h, u, f, d, y, k, w, b, T = [];
  9587. for (y = (e = v(e)).length,
  9588. t = 128,
  9589. n = 0,
  9590. s = 72,
  9591. a = 0; a < y; ++a)
  9592. (d = e[a]) < 128 && T.push(g(d));
  9593. for (i = r = T.length,
  9594. r && T.push("-"); i < y; ) {
  9595. for (o = c,
  9596. a = 0; a < y; ++a)
  9597. (d = e[a]) >= t && d < o && (o = d);
  9598. for (o - t > p((c - n) / (k = i + 1)) && m("overflow"),
  9599. n += (o - t) * k,
  9600. t = o,
  9601. a = 0; a < y; ++a)
  9602. if ((d = e[a]) < t && ++n > c && m("overflow"),
  9603. d == t) {
  9604. for (h = n,
  9605. u = l; !(h < (f = u <= s ? 1 : u >= s + 26 ? 26 : u - s)); u += l)
  9606. b = h - f,
  9607. w = l - f,
  9608. T.push(g(x(f + b % w, 0))),
  9609. h = p(b / w);
  9610. T.push(g(x(h, 0))),
  9611. s = S(n, k, i == r),
  9612. n = 0,
  9613. ++i
  9614. }
  9615. ++n,
  9616. ++t
  9617. }
  9618. return T.join("")
  9619. }
  9620. o = {
  9621. version: "1.4.1",
  9622. ucs2: {
  9623. decode: v,
  9624. encode: w
  9625. },
  9626. decode: T,
  9627. encode: I,
  9628. toASCII: function(e) {
  9629. return k(e, (function(e) {
  9630. return u.test(e) ? "xn--" + I(e) : e
  9631. }
  9632. ))
  9633. },
  9634. toUnicode: function(e) {
  9635. return k(e, (function(e) {
  9636. return h.test(e) ? T(e.slice(4).toLowerCase()) : e
  9637. }
  9638. ))
  9639. }
  9640. },
  9641. void 0 === (r = function() {
  9642. return o
  9643. }
  9644. .call(t, n, t, e)) || (e.exports = r)
  9645. }()
  9646. }
  9647. ).call(this, n(62)(e), n(12))
  9648. }
  9649. , function(e, t) {
  9650. e.exports = function(e) {
  9651. return e.webpackPolyfill || (e.deprecate = function() {}
  9652. ,
  9653. e.paths = [],
  9654. e.children || (e.children = []),
  9655. Object.defineProperty(e, "loaded", {
  9656. enumerable: !0,
  9657. get: function() {
  9658. return e.l
  9659. }
  9660. }),
  9661. Object.defineProperty(e, "id", {
  9662. enumerable: !0,
  9663. get: function() {
  9664. return e.i
  9665. }
  9666. }),
  9667. e.webpackPolyfill = 1),
  9668. e
  9669. }
  9670. }
  9671. , function(e, t, n) {
  9672. "use strict";
  9673. e.exports = {
  9674. isString: function(e) {
  9675. return "string" == typeof e
  9676. },
  9677. isObject: function(e) {
  9678. return "object" == typeof e && null !== e
  9679. },
  9680. isNull: function(e) {
  9681. return null === e
  9682. },
  9683. isNullOrUndefined: function(e) {
  9684. return null == e
  9685. }
  9686. }
  9687. }
  9688. , function(e, t, n) {
  9689. "use strict";
  9690. t.decode = t.parse = n(65),
  9691. t.encode = t.stringify = n(66)
  9692. }
  9693. , function(e, t, n) {
  9694. "use strict";
  9695. function i(e, t) {
  9696. return Object.prototype.hasOwnProperty.call(e, t)
  9697. }
  9698. e.exports = function(e, t, n, s) {
  9699. t = t || "&",
  9700. n = n || "=";
  9701. var a = {};
  9702. if ("string" != typeof e || 0 === e.length)
  9703. return a;
  9704. var o = /\+/g;
  9705. e = e.split(t);
  9706. var c = 1e3;
  9707. s && "number" == typeof s.maxKeys && (c = s.maxKeys);
  9708. var l = e.length;
  9709. c > 0 && l > c && (l = c);
  9710. for (var h = 0; h < l; ++h) {
  9711. var u, f, d, p, g = e[h].replace(o, "%20"), m = g.indexOf(n);
  9712. m >= 0 ? (u = g.substr(0, m),
  9713. f = g.substr(m + 1)) : (u = g,
  9714. f = ""),
  9715. d = decodeURIComponent(u),
  9716. p = decodeURIComponent(f),
  9717. i(a, d) ? r(a[d]) ? a[d].push(p) : a[d] = [a[d], p] : a[d] = p
  9718. }
  9719. return a
  9720. }
  9721. ;
  9722. var r = Array.isArray || function(e) {
  9723. return "[object Array]" === Object.prototype.toString.call(e)
  9724. }
  9725. }
  9726. , function(e, t, n) {
  9727. "use strict";
  9728. var i = function(e) {
  9729. switch (typeof e) {
  9730. case "string":
  9731. return e;
  9732. case "boolean":
  9733. return e ? "true" : "false";
  9734. case "number":
  9735. return isFinite(e) ? e : "";
  9736. default:
  9737. return ""
  9738. }
  9739. };
  9740. e.exports = function(e, t, n, o) {
  9741. return t = t || "&",
  9742. n = n || "=",
  9743. null === e && (e = void 0),
  9744. "object" == typeof e ? s(a(e), (function(a) {
  9745. var o = encodeURIComponent(i(a)) + n;
  9746. return r(e[a]) ? s(e[a], (function(e) {
  9747. return o + encodeURIComponent(i(e))
  9748. }
  9749. )).join(t) : o + encodeURIComponent(i(e[a]))
  9750. }
  9751. )).join(t) : o ? encodeURIComponent(i(o)) + n + encodeURIComponent(i(e)) : ""
  9752. }
  9753. ;
  9754. var r = Array.isArray || function(e) {
  9755. return "[object Array]" === Object.prototype.toString.call(e)
  9756. }
  9757. ;
  9758. function s(e, t) {
  9759. if (e.map)
  9760. return e.map(t);
  9761. for (var n = [], i = 0; i < e.length; i++)
  9762. n.push(t(e[i], i));
  9763. return n
  9764. }
  9765. var a = Object.keys || function(e) {
  9766. var t = [];
  9767. for (var n in e)
  9768. Object.prototype.hasOwnProperty.call(e, n) && t.push(n);
  9769. return t
  9770. }
  9771. }
  9772. , function(e, t, n) {
  9773. !function() {
  9774. var t = n(68)
  9775. , i = n(20).utf8
  9776. , r = n(69)
  9777. , s = n(20).bin
  9778. , a = function(e, n) {
  9779. e.constructor == String ? e = n && "binary" === n.encoding ? s.stringToBytes(e) : i.stringToBytes(e) : r(e) ? e = Array.prototype.slice.call(e, 0) : Array.isArray(e) || (e = e.toString());
  9780. for (var o = t.bytesToWords(e), c = 8 * e.length, l = 1732584193, h = -271733879, u = -1732584194, f = 271733878, d = 0; d < o.length; d++)
  9781. o[d] = 16711935 & (o[d] << 8 | o[d] >>> 24) | 4278255360 & (o[d] << 24 | o[d] >>> 8);
  9782. o[c >>> 5] |= 128 << c % 32,
  9783. o[14 + (c + 64 >>> 9 << 4)] = c;
  9784. var p = a._ff
  9785. , g = a._gg
  9786. , m = a._hh
  9787. , y = a._ii;
  9788. for (d = 0; d < o.length; d += 16) {
  9789. var k = l
  9790. , v = h
  9791. , w = u
  9792. , b = f;
  9793. h = y(h = y(h = y(h = y(h = m(h = m(h = m(h = m(h = g(h = g(h = g(h = g(h = p(h = p(h = p(h = p(h, u = p(u, f = p(f, l = p(l, h, u, f, o[d + 0], 7, -680876936), h, u, o[d + 1], 12, -389564586), l, h, o[d + 2], 17, 606105819), f, l, o[d + 3], 22, -1044525330), u = p(u, f = p(f, l = p(l, h, u, f, o[d + 4], 7, -176418897), h, u, o[d + 5], 12, 1200080426), l, h, o[d + 6], 17, -1473231341), f, l, o[d + 7], 22, -45705983), u = p(u, f = p(f, l = p(l, h, u, f, o[d + 8], 7, 1770035416), h, u, o[d + 9], 12, -1958414417), l, h, o[d + 10], 17, -42063), f, l, o[d + 11], 22, -1990404162), u = p(u, f = p(f, l = p(l, h, u, f, o[d + 12], 7, 1804603682), h, u, o[d + 13], 12, -40341101), l, h, o[d + 14], 17, -1502002290), f, l, o[d + 15], 22, 1236535329), u = g(u, f = g(f, l = g(l, h, u, f, o[d + 1], 5, -165796510), h, u, o[d + 6], 9, -1069501632), l, h, o[d + 11], 14, 643717713), f, l, o[d + 0], 20, -373897302), u = g(u, f = g(f, l = g(l, h, u, f, o[d + 5], 5, -701558691), h, u, o[d + 10], 9, 38016083), l, h, o[d + 15], 14, -660478335), f, l, o[d + 4], 20, -405537848), u = g(u, f = g(f, l = g(l, h, u, f, o[d + 9], 5, 568446438), h, u, o[d + 14], 9, -1019803690), l, h, o[d + 3], 14, -187363961), f, l, o[d + 8], 20, 1163531501), u = g(u, f = g(f, l = g(l, h, u, f, o[d + 13], 5, -1444681467), h, u, o[d + 2], 9, -51403784), l, h, o[d + 7], 14, 1735328473), f, l, o[d + 12], 20, -1926607734), u = m(u, f = m(f, l = m(l, h, u, f, o[d + 5], 4, -378558), h, u, o[d + 8], 11, -2022574463), l, h, o[d + 11], 16, 1839030562), f, l, o[d + 14], 23, -35309556), u = m(u, f = m(f, l = m(l, h, u, f, o[d + 1], 4, -1530992060), h, u, o[d + 4], 11, 1272893353), l, h, o[d + 7], 16, -155497632), f, l, o[d + 10], 23, -1094730640), u = m(u, f = m(f, l = m(l, h, u, f, o[d + 13], 4, 681279174), h, u, o[d + 0], 11, -358537222), l, h, o[d + 3], 16, -722521979), f, l, o[d + 6], 23, 76029189), u = m(u, f = m(f, l = m(l, h, u, f, o[d + 9], 4, -640364487), h, u, o[d + 12], 11, -421815835), l, h, o[d + 15], 16, 530742520), f, l, o[d + 2], 23, -995338651), u = y(u, f = y(f, l = y(l, h, u, f, o[d + 0], 6, -198630844), h, u, o[d + 7], 10, 1126891415), l, h, o[d + 14], 15, -1416354905), f, l, o[d + 5], 21, -57434055), u = y(u, f = y(f, l = y(l, h, u, f, o[d + 12], 6, 1700485571), h, u, o[d + 3], 10, -1894986606), l, h, o[d + 10], 15, -1051523), f, l, o[d + 1], 21, -2054922799), u = y(u, f = y(f, l = y(l, h, u, f, o[d + 8], 6, 1873313359), h, u, o[d + 15], 10, -30611744), l, h, o[d + 6], 15, -1560198380), f, l, o[d + 13], 21, 1309151649), u = y(u, f = y(f, l = y(l, h, u, f, o[d + 4], 6, -145523070), h, u, o[d + 11], 10, -1120210379), l, h, o[d + 2], 15, 718787259), f, l, o[d + 9], 21, -343485551),
  9794. l = l + k >>> 0,
  9795. h = h + v >>> 0,
  9796. u = u + w >>> 0,
  9797. f = f + b >>> 0
  9798. }
  9799. return t.endian([l, h, u, f])
  9800. };
  9801. a._ff = function(e, t, n, i, r, s, a) {
  9802. var o = e + (t & n | ~t & i) + (r >>> 0) + a;
  9803. return (o << s | o >>> 32 - s) + t
  9804. }
  9805. ,
  9806. a._gg = function(e, t, n, i, r, s, a) {
  9807. var o = e + (t & i | n & ~i) + (r >>> 0) + a;
  9808. return (o << s | o >>> 32 - s) + t
  9809. }
  9810. ,
  9811. a._hh = function(e, t, n, i, r, s, a) {
  9812. var o = e + (t ^ n ^ i) + (r >>> 0) + a;
  9813. return (o << s | o >>> 32 - s) + t
  9814. }
  9815. ,
  9816. a._ii = function(e, t, n, i, r, s, a) {
  9817. var o = e + (n ^ (t | ~i)) + (r >>> 0) + a;
  9818. return (o << s | o >>> 32 - s) + t
  9819. }
  9820. ,
  9821. a._blocksize = 16,
  9822. a._digestsize = 16,
  9823. e.exports = function(e, n) {
  9824. if (null == e)
  9825. throw new Error("Illegal argument " + e);
  9826. var i = t.wordsToBytes(a(e, n));
  9827. return n && n.asBytes ? i : n && n.asString ? s.bytesToString(i) : t.bytesToHex(i)
  9828. }
  9829. }()
  9830. }
  9831. , function(e, t) {
  9832. !function() {
  9833. var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
  9834. , n = {
  9835. rotl: function(e, t) {
  9836. return e << t | e >>> 32 - t
  9837. },
  9838. rotr: function(e, t) {
  9839. return e << 32 - t | e >>> t
  9840. },
  9841. endian: function(e) {
  9842. if (e.constructor == Number)
  9843. return 16711935 & n.rotl(e, 8) | 4278255360 & n.rotl(e, 24);
  9844. for (var t = 0; t < e.length; t++)
  9845. e[t] = n.endian(e[t]);
  9846. return e
  9847. },
  9848. randomBytes: function(e) {
  9849. for (var t = []; e > 0; e--)
  9850. t.push(Math.floor(256 * Math.random()));
  9851. return t
  9852. },
  9853. bytesToWords: function(e) {
  9854. for (var t = [], n = 0, i = 0; n < e.length; n++,
  9855. i += 8)
  9856. t[i >>> 5] |= e[n] << 24 - i % 32;
  9857. return t
  9858. },
  9859. wordsToBytes: function(e) {
  9860. for (var t = [], n = 0; n < 32 * e.length; n += 8)
  9861. t.push(e[n >>> 5] >>> 24 - n % 32 & 255);
  9862. return t
  9863. },
  9864. bytesToHex: function(e) {
  9865. for (var t = [], n = 0; n < e.length; n++)
  9866. t.push((e[n] >>> 4).toString(16)),
  9867. t.push((15 & e[n]).toString(16));
  9868. return t.join("")
  9869. },
  9870. hexToBytes: function(e) {
  9871. for (var t = [], n = 0; n < e.length; n += 2)
  9872. t.push(parseInt(e.substr(n, 2), 16));
  9873. return t
  9874. },
  9875. bytesToBase64: function(e) {
  9876. for (var n = [], i = 0; i < e.length; i += 3)
  9877. for (var r = e[i] << 16 | e[i + 1] << 8 | e[i + 2], s = 0; s < 4; s++)
  9878. 8 * i + 6 * s <= 8 * e.length ? n.push(t.charAt(r >>> 6 * (3 - s) & 63)) : n.push("=");
  9879. return n.join("")
  9880. },
  9881. base64ToBytes: function(e) {
  9882. e = e.replace(/[^A-Z0-9+\/]/gi, "");
  9883. for (var n = [], i = 0, r = 0; i < e.length; r = ++i % 4)
  9884. 0 != r && n.push((t.indexOf(e.charAt(i - 1)) & Math.pow(2, -2 * r + 8) - 1) << 2 * r | t.indexOf(e.charAt(i)) >>> 6 - 2 * r);
  9885. return n
  9886. }
  9887. };
  9888. e.exports = n
  9889. }()
  9890. }
  9891. , function(e, t) {
  9892. function n(e) {
  9893. return !!e.constructor && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e)
  9894. }
  9895. e.exports = function(e) {
  9896. return null != e && (n(e) || function(e) {
  9897. return "function" == typeof e.readFloatLE && "function" == typeof e.slice && n(e.slice(0, 0))
  9898. }(e) || !!e._isBuffer)
  9899. }
  9900. }
  9901. , function(e, t) {
  9902. e.exports = function(e, t, n, i, r, s, a, o, c) {
  9903. this.aiTypes = [{
  9904. id: 0,
  9905. src: "cow_1",
  9906. killScore: 150,
  9907. health: 500,
  9908. weightM: .8,
  9909. speed: 95e-5,
  9910. turnSpeed: .001,
  9911. scale: 72,
  9912. drop: ["food", 50]
  9913. }, {
  9914. id: 1,
  9915. src: "pig_1",
  9916. killScore: 200,
  9917. health: 800,
  9918. weightM: .6,
  9919. speed: 85e-5,
  9920. turnSpeed: .001,
  9921. scale: 72,
  9922. drop: ["food", 80]
  9923. }, {
  9924. id: 2,
  9925. name: "Bull",
  9926. src: "bull_2",
  9927. hostile: !0,
  9928. dmg: 20,
  9929. killScore: 1e3,
  9930. health: 1800,
  9931. weightM: .5,
  9932. speed: 94e-5,
  9933. turnSpeed: 74e-5,
  9934. scale: 78,
  9935. viewRange: 800,
  9936. chargePlayer: !0,
  9937. drop: ["food", 100]
  9938. }, {
  9939. id: 3,
  9940. name: "Bully",
  9941. src: "bull_1",
  9942. hostile: !0,
  9943. dmg: 20,
  9944. killScore: 2e3,
  9945. health: 2800,
  9946. weightM: .45,
  9947. speed: .001,
  9948. turnSpeed: 8e-4,
  9949. scale: 90,
  9950. viewRange: 900,
  9951. chargePlayer: !0,
  9952. drop: ["food", 400]
  9953. }, {
  9954. id: 4,
  9955. name: "Wolf",
  9956. src: "wolf_1",
  9957. hostile: !0,
  9958. dmg: 8,
  9959. killScore: 500,
  9960. health: 300,
  9961. weightM: .45,
  9962. speed: .001,
  9963. turnSpeed: .002,
  9964. scale: 84,
  9965. viewRange: 800,
  9966. chargePlayer: !0,
  9967. drop: ["food", 200]
  9968. }, {
  9969. id: 5,
  9970. name: "Quack",
  9971. src: "chicken_1",
  9972. dmg: 8,
  9973. killScore: 2e3,
  9974. noTrap: !0,
  9975. health: 300,
  9976. weightM: .2,
  9977. speed: .0018,
  9978. turnSpeed: .006,
  9979. scale: 70,
  9980. drop: ["food", 100]
  9981. }, {
  9982. id: 6,
  9983. name: "MOOSTAFA",
  9984. nameScale: 50,
  9985. src: "enemy",
  9986. hostile: !0,
  9987. dontRun: !0,
  9988. fixedSpawn: !0,
  9989. spawnDelay: 6e4,
  9990. noTrap: !0,
  9991. colDmg: 100,
  9992. dmg: 40,
  9993. killScore: 8e3,
  9994. health: 18e3,
  9995. weightM: .4,
  9996. speed: 7e-4,
  9997. turnSpeed: .01,
  9998. scale: 80,
  9999. spriteMlt: 1.8,
  10000. leapForce: .9,
  10001. viewRange: 1e3,
  10002. hitRange: 210,
  10003. hitDelay: 1e3,
  10004. chargePlayer: !0,
  10005. drop: ["food", 100]
  10006. }, {
  10007. id: 7,
  10008. name: "Treasure",
  10009. hostile: !0,
  10010. nameScale: 35,
  10011. src: "crate_1",
  10012. fixedSpawn: !0,
  10013. spawnDelay: 12e4,
  10014. colDmg: 200,
  10015. killScore: 5e3,
  10016. health: 2e4,
  10017. weightM: .1,
  10018. speed: 0,
  10019. turnSpeed: 0,
  10020. scale: 70,
  10021. spriteMlt: 1
  10022. }, {
  10023. id: 8,
  10024. name: "MOOFIE",
  10025. src: "wolf_2",
  10026. hostile: !0,
  10027. fixedSpawn: !0,
  10028. dontRun: !0,
  10029. hitScare: 4,
  10030. spawnDelay: 3e4,
  10031. noTrap: !0,
  10032. nameScale: 35,
  10033. dmg: 10,
  10034. colDmg: 100,
  10035. killScore: 3e3,
  10036. health: 7e3,
  10037. weightM: .45,
  10038. speed: .0015,
  10039. turnSpeed: .002,
  10040. scale: 90,
  10041. viewRange: 800,
  10042. chargePlayer: !0,
  10043. drop: ["food", 1e3]
  10044. }],
  10045. this.spawn = function(l, h, u, f) {
  10046. for (var d, p = 0; p < e.length; ++p)
  10047. if (!e[p].active) {
  10048. d = e[p];
  10049. break
  10050. }
  10051. return d || (d = new t(e.length,r,n,i,a,s,o,c),
  10052. e.push(d)),
  10053. d.init(l, h, u, f, this.aiTypes[f]),
  10054. d
  10055. }
  10056. }
  10057. }
  10058. , function(e, t) {
  10059. var n = 2 * Math.PI;
  10060. e.exports = function(e, t, i, r, s, a, o, c) {
  10061. this.sid = e,
  10062. this.isAI = !0,
  10063. this.nameIndex = s.randInt(0, a.cowNames.length - 1),
  10064. this.init = function(e, t, n, i, r) {
  10065. this.x = e,
  10066. this.y = t,
  10067. this.startX = r.fixedSpawn ? e : null,
  10068. this.startY = r.fixedSpawn ? t : null,
  10069. this.xVel = 0,
  10070. this.yVel = 0,
  10071. this.zIndex = 0,
  10072. this.dir = n,
  10073. this.dirPlus = 0,
  10074. this.index = i,
  10075. this.src = r.src,
  10076. r.name && (this.name = r.name),
  10077. this.weightM = r.weightM,
  10078. this.speed = r.speed,
  10079. this.killScore = r.killScore,
  10080. this.turnSpeed = r.turnSpeed,
  10081. this.scale = r.scale,
  10082. this.maxHealth = r.health,
  10083. this.leapForce = r.leapForce,
  10084. this.health = this.maxHealth,
  10085. this.chargePlayer = r.chargePlayer,
  10086. this.viewRange = r.viewRange,
  10087. this.drop = r.drop,
  10088. this.dmg = r.dmg,
  10089. this.hostile = r.hostile,
  10090. this.dontRun = r.dontRun,
  10091. this.hitRange = r.hitRange,
  10092. this.hitDelay = r.hitDelay,
  10093. this.hitScare = r.hitScare,
  10094. this.spriteMlt = r.spriteMlt,
  10095. this.nameScale = r.nameScale,
  10096. this.colDmg = r.colDmg,
  10097. this.noTrap = r.noTrap,
  10098. this.spawnDelay = r.spawnDelay,
  10099. this.hitWait = 0,
  10100. this.waitCount = 1e3,
  10101. this.moveCount = 0,
  10102. this.targetDir = 0,
  10103. this.active = !0,
  10104. this.alive = !0,
  10105. this.runFrom = null,
  10106. this.chargeTarget = null,
  10107. this.dmgOverTime = {}
  10108. }
  10109. ;
  10110. var l = 0;
  10111. this.update = function(e) {
  10112. if (this.active) {
  10113. if (this.spawnCounter)
  10114. return this.spawnCounter -= e,
  10115. void (this.spawnCounter <= 0 && (this.spawnCounter = 0,
  10116. this.x = this.startX || s.randInt(0, a.mapScale),
  10117. this.y = this.startY || s.randInt(0, a.mapScale)));
  10118. (l -= e) <= 0 && (this.dmgOverTime.dmg && (this.changeHealth(-this.dmgOverTime.dmg, this.dmgOverTime.doer),
  10119. this.dmgOverTime.time -= 1,
  10120. this.dmgOverTime.time <= 0 && (this.dmgOverTime.dmg = 0)),
  10121. l = 1e3);
  10122. var r = !1
  10123. , o = 1;
  10124. if (!this.zIndex && !this.lockMove && this.y >= a.mapScale / 2 - a.riverWidth / 2 && this.y <= a.mapScale / 2 + a.riverWidth / 2 && (o = .33,
  10125. this.xVel += a.waterCurrent * e),
  10126. this.lockMove)
  10127. this.xVel = 0,
  10128. this.yVel = 0;
  10129. else if (this.waitCount > 0) {
  10130. if (this.waitCount -= e,
  10131. this.waitCount <= 0)
  10132. if (this.chargePlayer) {
  10133. for (var h, u, f, d = 0; d < i.length; ++d)
  10134. !i[d].alive || i[d].skin && i[d].skin.bullRepel || (f = s.getDistance(this.x, this.y, i[d].x, i[d].y)) <= this.viewRange && (!h || f < u) && (u = f,
  10135. h = i[d]);
  10136. h ? (this.chargeTarget = h,
  10137. this.moveCount = s.randInt(8e3, 12e3)) : (this.moveCount = s.randInt(1e3, 2e3),
  10138. this.targetDir = s.randFloat(-Math.PI, Math.PI))
  10139. } else
  10140. this.moveCount = s.randInt(4e3, 1e4),
  10141. this.targetDir = s.randFloat(-Math.PI, Math.PI)
  10142. } else if (this.moveCount > 0) {
  10143. var p = this.speed * o;
  10144. if (this.runFrom && this.runFrom.active && (!this.runFrom.isPlayer || this.runFrom.alive) ? (this.targetDir = s.getDirection(this.x, this.y, this.runFrom.x, this.runFrom.y),
  10145. p *= 1.42) : this.chargeTarget && this.chargeTarget.alive && (this.targetDir = s.getDirection(this.chargeTarget.x, this.chargeTarget.y, this.x, this.y),
  10146. p *= 1.75,
  10147. r = !0),
  10148. this.hitWait && (p *= .3),
  10149. this.dir != this.targetDir) {
  10150. this.dir %= n;
  10151. var g = (this.dir - this.targetDir + n) % n
  10152. , m = Math.min(Math.abs(g - n), g, this.turnSpeed * e)
  10153. , y = g - Math.PI >= 0 ? 1 : -1;
  10154. this.dir += y * m + n
  10155. }
  10156. this.dir %= n,
  10157. this.xVel += p * e * Math.cos(this.dir),
  10158. this.yVel += p * e * Math.sin(this.dir),
  10159. this.moveCount -= e,
  10160. this.moveCount <= 0 && (this.runFrom = null,
  10161. this.chargeTarget = null,
  10162. this.waitCount = this.hostile ? 1500 : s.randInt(1500, 6e3))
  10163. }
  10164. this.zIndex = 0,
  10165. this.lockMove = !1;
  10166. var k = s.getDistance(0, 0, this.xVel * e, this.yVel * e)
  10167. , v = Math.min(4, Math.max(1, Math.round(k / 40)))
  10168. , w = 1 / v;
  10169. for (d = 0; d < v; ++d) {
  10170. this.xVel && (this.x += this.xVel * e * w),
  10171. this.yVel && (this.y += this.yVel * e * w),
  10172. M = t.getGridArrays(this.x, this.y, this.scale);
  10173. for (var b = 0; b < M.length; ++b)
  10174. for (var x = 0; x < M[b].length; ++x)
  10175. M[b][x].active && t.checkCollision(this, M[b][x], w)
  10176. }
  10177. var S, T, I, E = !1;
  10178. if (this.hitWait > 0 && (this.hitWait -= e,
  10179. this.hitWait <= 0)) {
  10180. E = !0,
  10181. this.hitWait = 0,
  10182. this.leapForce && !s.randInt(0, 2) && (this.xVel += this.leapForce * Math.cos(this.dir),
  10183. this.yVel += this.leapForce * Math.sin(this.dir));
  10184. for (var M = t.getGridArrays(this.x, this.y, this.hitRange), A = 0; A < M.length; ++A)
  10185. for (b = 0; b < M[A].length; ++b)
  10186. (S = M[A][b]).health && (T = s.getDistance(this.x, this.y, S.x, S.y)) < S.scale + this.hitRange && (S.changeHealth(5 * -this.dmg) && t.disableObj(S),
  10187. t.hitObj(S, s.getDirection(this.x, this.y, S.x, S.y)));
  10188. for (b = 0; b < i.length; ++b)
  10189. i[b].canSee(this) && c.send(i[b].id, "aa", this.sid)
  10190. }
  10191. if (r || E)
  10192. for (d = 0; d < i.length; ++d)
  10193. (S = i[d]) && S.alive && (T = s.getDistance(this.x, this.y, S.x, S.y),
  10194. this.hitRange ? !this.hitWait && T <= this.hitRange + S.scale && (E ? (I = s.getDirection(S.x, S.y, this.x, this.y),
  10195. S.changeHealth(-this.dmg),
  10196. S.xVel += .6 * Math.cos(I),
  10197. S.yVel += .6 * Math.sin(I),
  10198. this.runFrom = null,
  10199. this.chargeTarget = null,
  10200. this.waitCount = 3e3,
  10201. this.hitWait = s.randInt(0, 2) ? 0 : 600) : this.hitWait = this.hitDelay) : T <= this.scale + S.scale && (I = s.getDirection(S.x, S.y, this.x, this.y),
  10202. S.changeHealth(-this.dmg),
  10203. S.xVel += .55 * Math.cos(I),
  10204. S.yVel += .55 * Math.sin(I)));
  10205. this.xVel && (this.xVel *= Math.pow(a.playerDecel, e)),
  10206. this.yVel && (this.yVel *= Math.pow(a.playerDecel, e));
  10207. var P = this.scale;
  10208. this.x - P < 0 ? (this.x = P,
  10209. this.xVel = 0) : this.x + P > a.mapScale && (this.x = a.mapScale - P,
  10210. this.xVel = 0),
  10211. this.y - P < 0 ? (this.y = P,
  10212. this.yVel = 0) : this.y + P > a.mapScale && (this.y = a.mapScale - P,
  10213. this.yVel = 0)
  10214. }
  10215. }
  10216. ,
  10217. this.canSee = function(e) {
  10218. if (!e)
  10219. return !1;
  10220. if (e.skin && e.skin.invisTimer && e.noMovTimer >= e.skin.invisTimer)
  10221. return !1;
  10222. var t = Math.abs(e.x - this.x) - e.scale
  10223. , n = Math.abs(e.y - this.y) - e.scale;
  10224. return t <= a.maxScreenWidth / 2 * 1.3 && n <= a.maxScreenHeight / 2 * 1.3
  10225. }
  10226. ;
  10227. var h = 0
  10228. , u = 0;
  10229. this.animate = function(e) {
  10230. this.animTime > 0 && (this.animTime -= e,
  10231. this.animTime <= 0 ? (this.animTime = 0,
  10232. this.dirPlus = 0,
  10233. h = 0,
  10234. u = 0) : 0 == u ? (h += e / (this.animSpeed * a.hitReturnRatio),
  10235. this.dirPlus = s.lerp(0, this.targetAngle, Math.min(1, h)),
  10236. h >= 1 && (h = 1,
  10237. u = 1)) : (h -= e / (this.animSpeed * (1 - a.hitReturnRatio)),
  10238. this.dirPlus = s.lerp(0, this.targetAngle, Math.max(0, h))))
  10239. }
  10240. ,
  10241. this.startAnim = function() {
  10242. this.animTime = this.animSpeed = 600,
  10243. this.targetAngle = .8 * Math.PI,
  10244. h = 0,
  10245. u = 0
  10246. }
  10247. ,
  10248. this.changeHealth = function(e, t, n) {
  10249. if (this.active && (this.health += e,
  10250. n && (this.hitScare && !s.randInt(0, this.hitScare) ? (this.runFrom = n,
  10251. this.waitCount = 0,
  10252. this.moveCount = 2e3) : this.hostile && this.chargePlayer && n.isPlayer ? (this.chargeTarget = n,
  10253. this.waitCount = 0,
  10254. this.moveCount = 8e3) : this.dontRun || (this.runFrom = n,
  10255. this.waitCount = 0,
  10256. this.moveCount = 2e3)),
  10257. e < 0 && this.hitRange && s.randInt(0, 1) && (this.hitWait = 500),
  10258. t && t.canSee(this) && e < 0 && c.send(t.id, "t", Math.round(this.x), Math.round(this.y), Math.round(-e), 1),
  10259. this.health <= 0 && (this.spawnDelay ? (this.spawnCounter = this.spawnDelay,
  10260. this.x = -1e6,
  10261. this.y = -1e6) : (this.x = this.startX || s.randInt(0, a.mapScale),
  10262. this.y = this.startY || s.randInt(0, a.mapScale)),
  10263. this.health = this.maxHealth,
  10264. this.runFrom = null,
  10265. t && (o(t, this.killScore),
  10266. this.drop))))
  10267. for (var i = 0; i < this.drop.length; )
  10268. t.addResource(a.resourceTypes.indexOf(this.drop[i]), this.drop[i + 1]),
  10269. i += 2
  10270. }
  10271. }
  10272. }
  10273. ]);
  10274. //# sourceMappingURL=bundle.js.map