Found 344 repositories(showing 30)
Gabriel1231n2j3n
// ==UserScript== // @name aimbot gratis para krunker.io // @description Este es el mejor aimbot mod menuq puedas obtener // @version 2.19 // @author Gabriel - // @iconURL 31676a4e532e706e673f7261773d74727565.png // @match *://krunker.io/* // @exclude *://krunker.io/editor* // @exclude *://krunker.io/social* // @run-at document-start // @grant none // @noframes // ==/UserScript== /* eslint-env es6 */ /* eslint-disable no-caller, no-undef, no-loop-func */ var CRC2d = CanvasRenderingContext2D.prototype; var skid, skidStr = [...Array(8)].map(_ => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'[~~(Math.random()*52)]).join(''); class Skid { constructor() { skid = this; this.downKeys = new Set(); this.settings = null; this.vars = {}; this.playerMaps = []; this.skinCache = {}; this.inputFrame = 0; this.renderFrame = 0; this.fps = 0; this.lists = { renderESP: { off: "Off", walls: "Walls", twoD: "2d", full: "Full" }, renderChams: { off: "Off", white: "White", blue: "Blue", teal: "Teal", purple: "Purple", green: "Green", yellow: "Yellow", red: "Red", }, autoBhop: { off: "Off", autoJump: "Auto Jump", keyJump: "Key Jump", autoSlide: "Auto Slide", keySlide: "Key Slide" }, autoAim: { off: "Off", correction: "Aim Correction", assist: "Legit Aim Assist", easyassist: "Easy Aim Assist", silent: "Silent Aim", trigger: "Trigger Bot", quickScope: "Quick Scope" }, audioStreams: { off: 'Off', _2000s: 'General German/English', _HipHopRNB: 'Hip Hop / RNB', _Oldskool: 'Hip Hop Oldskool', _Country: 'Country', _Pop: 'Pop', _Dance: 'Dance', _Dubstep: 'DubStep', _Lowfi: 'LoFi HipHop', _Jazz: 'Jazz', _Oldies: 'Golden Oldies', _Club: 'Club', _Folk: 'Folk', _ClassicRock: 'Classic Rock', _Metal: 'Heavy Metal', _DeathMetal: 'Death Metal', _Classical: 'Classical', _Alternative: 'Alternative', }, } this.consts = { twoPI: Math.PI * 2, halfPI: Math.PI / 2, playerHeight: 11, cameraHeight: 1.5, headScale: 2, armScale: 1.3, armInset: 0.1, chestWidth: 2.6, hitBoxPad: 1, crouchDst: 3, recoilMlt: 0.3, nameOffset: 0.6, nameOffsetHat: 0.8, }; this.key = { frame: 0, delta: 1, xdir: 2, ydir: 3, moveDir: 4, shoot: 5, scope: 6, jump: 7, reload: 8, crouch: 9, weaponScroll: 10, weaponSwap: 11, moveLock: 12 }; this.css = { noTextShadows: `*, .button.small, .bigShadowT { text-shadow: none !important; }`, hideAdverts: `#aMerger, #endAMerger { display: none !important }`, hideSocials: `.headerBarRight > .verticalSeparator, .imageButton { display: none }`, cookieButton: `#onetrust-consent-sdk { display: none !important }`, newsHolder: `#newsHolder { display: none !important }`, }; this.isProxy = Symbol("isProxy"); this.spinTimer = 1800; let wait = setInterval(_ => { this.head = document.head||document.getElementsByTagName('head')[0] if (this.head) { clearInterval(wait); Object.entries(this.css).forEach(entry => { this.css[entry[0]] = this.createElement("style", entry[1]); }) this.onLoad(); } }, 100); } canStore() { return this.isDefined(Storage); } saveVal(name, val) { if (this.canStore()) localStorage.setItem("kro_utilities_"+name, val); } deleteVal(name) { if (this.canStore()) localStorage.removeItem("kro_utilities_"+name); } getSavedVal(name) { if (this.canStore()) return localStorage.getItem("kro_utilities_"+name); return null; } isType(item, type) { return typeof item === type; } isDefined(object) { return !this.isType(object, "undefined") && object !== null; } isNative(fn) { return (/^function\s*[a-z0-9_\$]*\s*\([^)]*\)\s*\{\s*\[native code\]\s*\}/i).test('' + fn) } getStatic(s, d) { return this.isDefined(s) ? s : d } crossDomain(url) { return "https://crossorigin.me/" + url; } async waitFor(test, timeout_ms = 20000, doWhile = null) { let sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); return new Promise(async (resolve, reject) => { if (typeof timeout_ms != "number") reject("Timeout argument not a number in waitFor(selector, timeout_ms)"); let result, freq = 100; while (result === undefined || result === false || result === null || result.length === 0) { if (doWhile && doWhile instanceof Function) doWhile(); if (timeout_ms % 1000 < freq) console.log("waiting for: ", test); if ((timeout_ms -= freq) < 0) { console.log( "Timeout : ", test ); resolve(false); return; } await sleep(freq); result = typeof test === "string" ? Function(test)() : test(); } console.log("Passed : ", test); resolve(result); }); }; createSettings() { this.settings = { //Rendering showSkidBtn: { pre: "<div class='setHed'>Rendering</div>", name: "Show Skid Button", val: true, html: () => this.generateSetting("checkbox", "showSkidBtn", this), set: (value, init) => { let button = document.getElementById("mainButton"); if (!button) { button = this.createButton("5k1D", "https://i.imgur.com/1tWAEJx.gif", this.toggleMenu, value) } else button.style.display = value ? "inherit" : "none"; } }, hideAdverts: { name: "Hide Advertisments", val: true, html: () => this.generateSetting("checkbox", "hideAdverts", this), set: (value, init) => { if (value) this.head.appendChild(this.css.hideAdverts) else if (!init) this.css.hideAdverts.remove() } }, hideStreams: { name: "Hide Streams", val: false, html: () => this.generateSetting("checkbox", "hideStreams", this), set: (value) => { window.streamContainer.style.display = value ? "none" : "inherit" } }, hideMerch: { name: "Hide Merch", val: false, html: () => this.generateSetting("checkbox", "hideMerch", this), set: value => { window.merchHolder.style.display = value ? "none" : "inherit" } }, hideNewsConsole: { name: "Hide News Console", val: false, html: () => this.generateSetting("checkbox", "hideNewsConsole", this), set: value => { window.newsHolder.style.display = value ? "none" : "inherit" } }, hideCookieButton: { name: "Hide Security Manage Button", val: false, html: () => this.generateSetting("checkbox", "hideCookieButton", this), set: value => { window['onetrust-consent-sdk'].style.display = value ? "none" : "inherit" } }, noTextShadows: { name: "Remove Text Shadows", val: false, html: () => this.generateSetting("checkbox", "noTextShadows", this), set: (value, init) => { if (value) this.head.appendChild(this.css.noTextShadows) else if (!init) this.css.noTextShadows.remove() } }, customCSS: { name: "Custom CSS", val: "", html: () => this.generateSetting("url", "customCSS", "URL to CSS file"), resources: { css: document.createElement("link") }, set: (value, init) => { if (value.startsWith("http")&&value.endsWith(".css")) { //let proxy = 'https://cors-anywhere.herokuapp.com/'; this.settings.customCSS.resources.css.href = value } if (init) { this.settings.customCSS.resources.css.rel = "stylesheet" try { this.head.appendChild(this.settings.customCSS.resources.css) } catch(e) { alert(e) this.settings.customCSS.resources.css = null } } } }, renderESP: { name: "Player ESP Type", val: "off", html: () => this.generateSetting("select", "renderESP", this.lists.renderESP), }, renderTracers: { name: "Player Tracers", val: false, html: () => this.generateSetting("checkbox", "renderTracers"), }, rainbowColor: { name: "Rainbow ESP", val: false, html: () => this.generateSetting("checkbox", "rainbowColor"), }, renderChams: { name: "Player Chams", val: "off", html: () => this.generateSetting( "select", "renderChams", this.lists.renderChams ), }, renderWireFrame: { name: "Player Wireframe", val: false, html: () => this.generateSetting("checkbox", "renderWireFrame"), }, customBillboard: { name: "Custom Billboard Text", val: "", html: () => this.generateSetting( "text", "customBillboard", "Custom Billboard Text" ), }, //Weapon autoReload: { pre: "<br><div class='setHed'>Weapon</div>", name: "Auto Reload", val: false, html: () => this.generateSetting("checkbox", "autoReload"), }, autoAim: { name: "Auto Aim Type", val: "off", html: () => this.generateSetting("select", "autoAim", this.lists.autoAim), }, frustrumCheck: { name: "Line of Sight Check", val: false, html: () => this.generateSetting("checkbox", "frustrumCheck"), }, wallPenetrate: { name: "Aim through Penetratables", val: false, html: () => this.generateSetting("checkbox", "wallPenetrate"), }, weaponZoom: { name: "Weapon Zoom", val: 1.0, min: 0, max: 50.0, step: 0.01, html: () => this.generateSetting("slider", "weaponZoom"), set: (value) => { if (this.renderer) this.renderer.adsFovMlt = value;} }, weaponTrails: { name: "Weapon Trails", val: false, html: () => this.generateSetting("checkbox", "weaponTrails"), set: (value) => { if (this.me) this.me.weapon.trail = value;} }, //Player autoBhop: { pre: "<br><div class='setHed'>Player</div>", name: "Auto Bhop Type", val: "off", html: () => this.generateSetting("select", "autoBhop", this.lists.autoBhop), }, thirdPerson: { name: "Third Person", val: false, html: () => this.generateSetting("checkbox", "thirdPerson"), set: (value, init) => { if (value) this.thirdPerson = 1; else if (!init) this.thirdPerson = undefined; } }, skinUnlock: { name: "Unlock Skins", val: false, html: () => this.generateSetting("checkbox", "skinUnlock", this), }, //GamePlay disableWpnSnd: { pre: "<br><div class='setHed'>GamePlay</div>", name: "Disable Players Weapon Sounds", val: false, html: () => this.generateSetting("checkbox", "disableWpnSnd", this), }, disableHckSnd: { name: "Disable Hacker Fart Sounds", val: false, html: () => this.generateSetting("checkbox", "disableHckSnd", this), }, autoActivateNuke: { name: "Auto Activate Nuke", val: false, html: () => this.generateSetting("checkbox", "autoActivateNuke", this), }, autoFindNew: { name: "New Lobby Finder", val: false, html: () => this.generateSetting("checkbox", "autoFindNew", this), }, autoClick: { name: "Auto Start Game", val: false, html: () => this.generateSetting("checkbox", "autoClick", this), }, inActivity: { name: "No InActivity Kick", val: true, html: () => this.generateSetting("checkbox", "autoClick", this), }, //Radio Stream Player playStream: { pre: "<br><div class='setHed'>Radio Stream Player</div>", name: "Stream Select", val: "off", html: () => this.generateSetting("select", "playStream", this.lists.audioStreams), set: (value) => { if (value == "off") { if ( this.settings.playStream.audio ) { this.settings.playStream.audio.pause(); this.settings.playStream.audio.currentTime = 0; this.settings.playStream.audio = null; } return; } let url = this.settings.playStream.urls[value]; if (!this.settings.playStream.audio) { this.settings.playStream.audio = new Audio(url); this.settings.playStream.audio.volume = this.settings.audioVolume.val||0.5 } else { this.settings.playStream.audio.src = url; } this.settings.playStream.audio.load(); this.settings.playStream.audio.play(); }, urls: { _2000s: 'http://0n-2000s.radionetz.de/0n-2000s.aac', _HipHopRNB: 'https://stream-mixtape-geo.ntslive.net/mixtape2', _Country: 'https://live.wostreaming.net/direct/wboc-waaifmmp3-ibc2', _Dance: 'http://streaming.radionomy.com/A-RADIO-TOP-40', _Pop: 'http://bigrradio.cdnstream1.com/5106_128', _Jazz: 'http://strm112.1.fm/ajazz_mobile_mp3', _Oldies: 'http://strm112.1.fm/60s_70s_mobile_mp3', _Club: 'http://strm112.1.fm/club_mobile_mp3', _Folk: 'https://freshgrass.streamguys1.com/irish-128mp3', _ClassicRock: 'http://1a-classicrock.radionetz.de/1a-classicrock.mp3', _Metal: 'http://streams.radiobob.de/metalcore/mp3-192', _DeathMetal: 'http://stream.laut.fm/beatdownx', _Classical: 'http://live-radio01.mediahubaustralia.com/FM2W/aac/', _Alternative: 'http://bigrradio.cdnstream1.com/5187_128', _Dubstep: 'http://streaming.radionomy.com/R1Dubstep?lang=en', _Lowfi: 'http://streams.fluxfm.de/Chillhop/mp3-256', _Oldskool: 'http://streams.90s90s.de/hiphop/mp3-128/', }, audio: null, }, audioVolume: { name: "Radio Volume", val: 0.5, min: 0, max: 1, step: 0.01, html: () => this.generateSetting("slider", "audioVolume"), set: (value) => { if (this.settings.playStream.audio) this.settings.playStream.audio.volume = value;} }, }; // Inject Html let waitForWindows = setInterval(_ => { if (window.windows) { const menu = window.windows[11]; menu.header = "Settings"; menu.gen = _ => { var tmpHTML = `<div style='text-align:center'> <a onclick='window.open("https://skidlamer.github.io/")' class='menuLink'>SkidFest Settings</center></a> <hr> </div>`; for (const key in this.settings) { if (this.settings[key].pre) tmpHTML += this.settings[key].pre; tmpHTML += "<div class='settName' id='" + key + "_div' style='display:" + (this.settings[key].hide ? 'none' : 'block') + "'>" + this.settings[key].name + " " + this.settings[key].html() + "</div>"; } tmpHTML += `<br><hr><a onclick='${skidStr}.resetSettings()' class='menuLink'>Reset Settings</a> | <a onclick='${skidStr}.saveScript()' class='menuLink'>Save GameScript</a>` return tmpHTML; }; clearInterval(waitForWindows); //this.createButton("5k1D", "https://i.imgur.com/1tWAEJx.gif", this.toggleMenu) } }, 100); // setupSettings for (const key in this.settings) { this.settings[key].def = this.settings[key].val; if (!this.settings[key].disabled) { let tmpVal = this.getSavedVal(key); this.settings[key].val = tmpVal !== null ? tmpVal : this.settings[key].val; if (this.settings[key].val == "false") this.settings[key].val = false; if (this.settings[key].val == "true") this.settings[key].val = true; if (this.settings[key].val == "undefined") this.settings[key].val = this.settings[key].def; if (this.settings[key].set) this.settings[key].set(this.settings[key].val, true); } } } generateSetting(type, name, extra) { switch (type) { case 'checkbox': return `<label class="switch"><input type="checkbox" onclick="${skidStr}.setSetting('${name}', this.checked)" ${this.settings[name].val ? 'checked' : ''}><span class="slider"></span></label>`; case 'slider': return `<span class='sliderVal' id='slid_utilities_${name}'>${this.settings[name].val}</span><div class='slidecontainer'><input type='range' min='${this.settings[name].min}' max='${this.settings[name].max}' step='${this.settings[name].step}' value='${this.settings[name].val}' class='sliderM' oninput="${skidStr}.setSetting('${name}', this.value)"></div>` case 'select': { let temp = `<select onchange="${skidStr}.setSetting(\x27${name}\x27, this.value)" class="inputGrey2">`; for (let option in extra) { temp += '<option value="' + option + '" ' + (option == this.settings[name].val ? 'selected' : '') + '>' + extra[option] + '</option>'; } temp += '</select>'; return temp; } default: return `<input type="${type}" name="${type}" id="slid_utilities_${name}"\n${'color' == type ? 'style="float:right;margin-top:5px"' : `class="inputGrey2" placeholder="${extra}"`}\nvalue="${this.settings[name].val}" oninput="${skidStr}.setSetting(\x27${name}\x27, this.value)"/>`; } } resetSettings() { if (confirm("Are you sure you want to reset all your settings? This will also refresh the page")) { Object.keys(localStorage).filter(x => x.includes("kro_utilities_")).forEach(x => localStorage.removeItem(x)); location.reload(); } } setSetting(t, e) { this.settings[t].val = e; this.saveVal(t, e); if (document.getElementById(`slid_utilities_${t}`)) document.getElementById(`slid_utilities_${t}`).innerHTML = e; if (this.settings[t].set) this.settings[t].set(e); } createObserver(elm, check, callback, onshow = true) { return new MutationObserver((mutationsList, observer) => { if (check == 'src' || onshow && mutationsList[0].target.style.display == 'block' || !onshow) { callback(mutationsList[0].target); } }).observe(elm, check == 'childList' ? {childList: true} : {attributes: true, attributeFilter: [check]}); } createListener(elm, type, callback = null) { if (!this.isDefined(elm)) { alert("Failed creating " + type + "listener"); return } elm.addEventListener(type, event => callback(event)); } createElement(element, attribute, inner) { if (!this.isDefined(element)) { return null; } if (!this.isDefined(inner)) { inner = ""; } let el = document.createElement(element); if (this.isType(attribute, 'object')) { for (let key in attribute) { el.setAttribute(key, attribute[key]); } } if (!Array.isArray(inner)) { inner = [inner]; } for (let i = 0; i < inner.length; i++) { if (inner[i].tagName) { el.appendChild(inner[i]); } else { el.appendChild(document.createTextNode(inner[i])); } } return el; } createButton(name, iconURL, fn, visible) { visible = visible ? "inherit":"none"; let menu = document.querySelector("#menuItemContainer"); let icon = this.createElement("div",{"class":"menuItemIcon", "style":`background-image:url("${iconURL}");display:inherit;`}); let title= this.createElement("div",{"class":"menuItemTitle", "style":`display:inherit;`}, name); let host = this.createElement("div",{"id":"mainButton", "class":"menuItem", "onmouseenter":"playTick()", "onclick":"showWindow(12)", "style":`display:${visible};`},[icon, title]); if (menu) menu.append(host) } objectHas(obj, arr) { return arr.some(prop => obj.hasOwnProperty(prop)); } getVersion() { const elems = document.getElementsByClassName('terms'); const version = elems[elems.length - 1].innerText; return version; } saveAs(name, data) { let blob = new Blob([data], {type: 'text/plain'}); let el = window.document.createElement("a"); el.href = window.URL.createObjectURL(blob); el.download = name; window.document.body.appendChild(el); el.click(); window.document.body.removeChild(el); } saveScript() { this.fetchScript().then(script => { this.saveAs("game_" + this.getVersion() + ".js", script) }) } isKeyDown(key) { return this.downKeys.has(key); } simulateKey(keyCode) { var oEvent = document.createEvent('KeyboardEvent'); // Chromium Hack Object.defineProperty(oEvent, 'keyCode', { get : function() { return this.keyCodeVal; } }); Object.defineProperty(oEvent, 'which', { get : function() { return this.keyCodeVal; } }); if (oEvent.initKeyboardEvent) { oEvent.initKeyboardEvent("keypress", true, true, document.defaultView, keyCode, keyCode, "", "", false, ""); } else { oEvent.initKeyEvent("keypress", true, true, document.defaultView, false, false, false, false, keyCode, 0); } oEvent.keyCodeVal = keyCode; if (oEvent.keyCode !== keyCode) { alert("keyCode mismatch " + oEvent.keyCode + "(" + oEvent.which + ")"); } document.body.dispatchEvent(oEvent); } toggleMenu() { let lock = document.pointerLockElement || document.mozPointerLockElement; if (lock) document.exitPointerLock(); window.showWindow(12); if (this.isDefined(window.SOUND)) window.SOUND.play(`tick_0`,0.1) } onLoad() { this.createSettings(); this.createObservers(); this.waitFor(_=>this.isDefined(this.exports)).then(_=> { if (!this.isDefined(this.exports)) { alert("This Mod Needs To Be Updated Please Try Agian Later"); return; } //console.dir(this.exports); let toFind = { overlay: ["render", "canvas"], config: ["accAnnounce", "availableRegions", "assetCat"], three: ["ACESFilmicToneMapping", "TextureLoader", "ObjectLoader"], ws: ["socketReady", "ingressPacketCount", "ingressPacketCount", "egressDataSize"], utility: ["VectorAdd", "VectorAngleSign"], //colors: ["challLvl", "getChallCol"], //ui: ["showEndScreen", "toggleControlUI", "toggleEndScreen", "updatePlayInstructions"], //events: ["actions", "events"], } for (let rootKey in this.exports) { let exp = this.exports[rootKey].exports; for (let name in toFind) { if (this.objectHas(exp, toFind[name])) { console.log("Found Export ", name); delete toFind[name]; this[name] = exp; } } } if (!(Object.keys(toFind).length === 0 && toFind.constructor === Object)) { for (let name in toFind) { alert("Failed To Find Export " + name); } } else { Object.defineProperty(this.config, "nameVisRate", { value: 0, writable: false, configurable: true, }) this.ctx = this.overlay.canvas.getContext('2d'); this.overlay.render = new Proxy(this.overlay.render, { apply: function(target, that, args) { return [target.apply(that, args), render.apply(that, args)] } }) function render(scale, game, controls, renderer, me) { let width = skid.overlay.canvas.width / scale; let height = skid.overlay.canvas.height / scale; const renderArgs = [scale, game, controls, renderer, me]; if (renderArgs && void 0 !== skid) { ["scale", "game", "controls", "renderer", "me"].forEach((item, index)=>{ skid[item] = renderArgs[index]; }); if (me) { skid.ctx.save(); skid.ctx.scale(scale, scale); //this.ctx.clearRect(0, 0, width, height); skid.onRender(); //window.requestAnimationFrame.call(window, renderArgs.callee.caller.bind(this)); skid.ctx.restore(); } if(skid.settings && skid.settings.autoClick.val && window.endUI.style.display == "none" && window.windowHolder.style.display == "none") { controls.toggle(true); } } } // Skins const $skins = Symbol("skins"); Object.defineProperty(Object.prototype, "skins", { set: function(fn) { this[$skins] = fn; if (void 0 == this.localSkins || !this.localSkins.length) { this.localSkins = Array.apply(null, Array(5e3)).map((x, i) => { return { ind: i, cnt: 0x1, } }) } return fn; }, get: function() { return skid.settings.skinUnlock.val && this.stats ? this.localSkins : this[$skins]; } }) this.waitFor(_=>this.ws.connected === true, 40000).then(_=> { this.ws.__event = this.ws._dispatchEvent.bind(this.ws); this.ws.__send = this.ws.send.bind(this.ws); this.ws.send = new Proxy(this.ws.send, { apply: function(target, that, args) { if (args[0] == "ah2") return; try { var original_fn = Function.prototype.apply.apply(target, [that, args]); } catch (e) { e.stack = e.stack = e.stack.replace(/\n.*Object\.apply.*/, ''); throw e; } if (args[0] === "en") { skid.skinCache = { main: args[1][2][0], secondary: args[1][2][1], hat: args[1][3], body: args[1][4], knife: args[1][9], dye: args[1][14], waist: args[1][17], } } return original_fn; } }) this.ws._dispatchEvent = new Proxy(this.ws._dispatchEvent, { apply: function(target, that, [type, event]) { if (type =="init") { if(event[10] && event[10].length && event[10].bill && skid.settings.customBillboard.val.length > 1) { event[10].bill.txt = skid.settings.customBillboard.val; } } if (skid.settings.skinUnlock.val && skid.skinCache && type === "0") { let skins = skid.skinCache; let pInfo = event[0]; let pSize = 38; while (pInfo.length % pSize !== 0) pSize++; for(let i = 0; i < pInfo.length; i += pSize) { if (pInfo[i] === skid.ws.socketId||0) { pInfo[i + 12] = [skins.main, skins.secondary]; pInfo[i + 13] = skins.hat; pInfo[i + 14] = skins.body; pInfo[i + 19] = skins.knife; pInfo[i + 24] = skins.dye; pInfo[i + 33] = skins.waist; } } } return target.apply(that, arguments[2]); } }) }) if (this.isDefined(window.SOUND)) { window.SOUND.play = new Proxy(window.SOUND.play, { apply: function(target, that, [src, vol, loop, rate]) { if ( src.startsWith("fart_") && skid.settings.disableHckSnd.val ) return; return target.apply(that, [src, vol, loop, rate]); } }) } AudioParam.prototype.setValueAtTime = new Proxy(AudioParam.prototype.setValueAtTime, { apply: function(target, that, [value, startTime]) { return target.apply(that, [value, 0]); } }) this.rayC = new this.three.Raycaster(); this.vec2 = new this.three.Vector2(0, 0); } }) } gameJS(script) { let entries = { // Deobfu inView: { regex: /(\w+\['(\w+)']\){if\(\(\w+=\w+\['\w+']\['position']\['clone']\(\))/, index: 2 }, spectating: { regex: /\['team']:window\['(\w+)']/, index: 1 }, //inView: { regex: /\]\)continue;if\(!\w+\['(.+?)\']\)continue;/, index: 1 }, //canSee: { regex: /\w+\['(\w+)']\(\w+,\w+\['x'],\w+\['y'],\w+\['z']\)\)&&/, index: 1 }, //procInputs: { regex: /this\['(\w+)']=function\((\w+),(\w+),\w+,\w+\){(this)\['recon']/, index: 1 }, aimVal: { regex: /this\['(\w+)']-=0x1\/\(this\['weapon']\['\w+']\/\w+\)/, index: 1 }, pchObjc: { regex: /0x0,this\['(\w+)']=new \w+\['Object3D']\(\),this/, index: 1 }, didShoot: { regex: /--,\w+\['(\w+)']=!0x0/, index: 1 }, nAuto: { regex: /'Single\\x20Fire','varN':'(\w+)'/, index: 1 }, crouchVal: { regex: /this\['(\w+)']\+=\w\['\w+']\*\w+,0x1<=this\['\w+']/, index: 1 }, recoilAnimY: { regex: /\+\(-Math\['PI']\/0x4\*\w+\+\w+\['(\w+)']\*\w+\['\w+']\)\+/, index: 1 }, //recoilAnimY: { regex: /this\['recoilAnim']=0x0,this\[(.*?\(''\))]/, index: 1 }, ammos: { regex: /\['length'];for\(\w+=0x0;\w+<\w+\['(\w+)']\['length']/, index: 1 }, weaponIndex: { regex: /\['weaponConfig']\[\w+]\['secondary']&&\(\w+\['(\w+)']==\w+/, index: 1 }, isYou: { regex: /0x0,this\['(\w+)']=\w+,this\['\w+']=!0x0,this\['inputs']/, index: 1 }, objInstances: { regex: /\w+\['\w+']\(0x0,0x0,0x0\);if\(\w+\['(\w+)']=\w+\['\w+']/, index: 1 }, getWorldPosition: { regex: /{\w+=\w+\['camera']\['(\w+)']\(\);/, index: 1 }, //mouseDownL: { regex: /this\['\w+'\]=function\(\){this\['(\w+)'\]=\w*0,this\['(\w+)'\]=\w*0,this\['\w+'\]={}/, index: 1 }, mouseDownR: { regex: /this\['(\w+)']=0x0,this\['keys']=/, index: 1 }, //reloadTimer: { regex: /this\['(\w+)']&&\(\w+\['\w+']\(this\),\w+\['\w+']\(this\)/, index: 1 }, maxHealth: { regex: /this\['health']\/this\['(\w+)']\?/, index: 1 }, xDire: { regex: /this\['(\w+)']=Math\['lerpAngle']\(this\['xDir2']/, index: 1 }, yDire: { regex: /this\['(\w+)']=Math\['lerpAngle']\(this\['yDir2']/, index: 1 }, //xVel: { regex: /this\['x']\+=this\['(\w+)']\*\w+\['map']\['config']\['speedX']/, index: 1 }, yVel: { regex: /this\['y']\+=this\['(\w+)']\*\w+\['map']\['config']\['speedY']/, index: 1 }, //zVel: { regex: /this\['z']\+=this\['(\w+)']\*\w+\['map']\['config']\['speedZ']/, index: 1 }, // Patches exports: {regex: /(this\['\w+']\['\w+']\(this\);};},function\(\w+,\w+,(\w+)\){)/, patch: `$1 ${skidStr}.exports=$2.c; ${skidStr}.modules=$2.m;`}, inputs: {regex: /(\w+\['\w+']\[\w+\['\w+']\['\w+']\?'\w+':'push']\()(\w+)\),/, patch: `$1${skidStr}.onInput($2)),`}, inView: {regex: /&&(\w+\['\w+'])\){(if\(\(\w+=\w+\['\w+']\['\w+']\['\w+'])/, patch: `){if(!$1&&void 0 !== ${skidStr}.nameTags)continue;$2`}, thirdPerson:{regex: /(\w+)\[\'config\'\]\[\'thirdPerson\'\]/g, patch: `void 0 !== ${skidStr}.thirdPerson`}, isHacker:{regex: /(window\['\w+']=)!0x0\)/, patch: `$1!0x1)`}, fixHowler:{regex: /(Howler\['orientation'](.+?)\)\),)/, patch: ``}, respawnT:{regex: /'\w+':0x3e8\*/g, patch: `'respawnT':0x0*`}, anticheat1:{regex: /&&\w+\(\),window\['utilities']&&\(\w+\(null,null,null,!0x0\),\w+\(\)\)/, patch: ""}, anticheat2:{regex: /(\[]instanceof Array;).*?(var)/, patch: "$1 $2"}, anticheat3:{regex: /windows\['length'\]>\d+.*?0x25/, patch: `0x25`}, commandline:{regex: /Object\['defineProperty']\(console.*?\),/, patch: ""}, writeable:{regex: /'writeable':!0x1/g, patch: "writeable:true"}, configurable:{regex: /'configurable':!0x1/g, patch: "configurable:true"}, typeError:{regex: /throw new TypeError/g, patch: "console.error"}, error:{regex: /throw new Error/g, patch: "console.error"}, }; for(let name in entries) { let object = entries[name]; let found = object.regex.exec(script); if (object.hasOwnProperty('index')) { if (!found) { object.val = null; alert("Failed to Find " + name); } else { object.val = found[object.index]; console.log ("Found ", name, ":", object.val); } Object.defineProperty(skid.vars, name, { configurable: false, value: object.val }); } else if (found) { script = script.replace(object.regex, object.patch); console.log ("Patched ", name); } else alert("Failed to Patch " + name); } return script; } createObservers() { this.createObserver(window.instructionsUpdate, 'style', (target) => { if (this.settings.autoFindNew.val) { console.log(target) if (['Kicked', 'Banned', 'Disconnected', 'Error', 'Game is full'].some(text => target && target.innerHTML.includes(text))) { location = document.location.origin; } } }); this.createListener(document, "keyup", event => { if (this.downKeys.has(event.code)) this.downKeys.delete(event.code) }) this.createListener(document, "keydown", event => { if (event.code == "F1") { event.preventDefault(); this.toggleMenu(); } if ('INPUT' == document.activeElement.tagName || !window.endUI && window.endUI.style.display) return; switch (event.code) { case 'NumpadSubtract': document.exitPointerLock(); //console.log(document.exitPointerLock) console.dirxml(this) break; default: if (!this.downKeys.has(event.code)) this.downKeys.add(event.code); break; } }) this.createListener(document, "mouseup", event => { switch (event.button) { case 1: event.preventDefault(); this.toggleMenu(); break; default: break; } }) } onRender() { /* hrt / ttap - https://github.com/hrt */ this.renderFrame ++; if (this.renderFrame >= 100000) this.renderFrame = 0; let scaledWidth = this.ctx.canvas.width / this.scale; let scaledHeight = this.ctx.canvas.height / this.scale; let playerScale = (2 * this.consts.armScale + this.consts.chestWidth + this.consts.armInset) / 2 let worldPosition = this.renderer.camera[this.vars.getWorldPosition](); let espVal = this.settings.renderESP.val; if (espVal ==="walls"||espVal ==="twoD") this.nameTags = undefined; else this.nameTags = true; if (this.settings.autoActivateNuke.val && this.me && Object.keys(this.me.streaks).length) { /*chonker*/ this.ws.__send("k", 0); } if (espVal !== "off") { this.overlay.healthColE = this.settings.rainbowColor.val ? this.overlay.rainbow.col : "#eb5656"; } for (let iter = 0, length = this.game.players.list.length; iter < length; iter++) { let player = this.game.players.list[iter]; if (player[this.vars.isYou] || !player.active || !this.isDefined(player[this.vars.objInstances]) || this.getIsFriendly(player)) { continue; } // the below variables correspond to the 2d box esps corners let xmin = Infinity; let xmax = -Infinity; let ymin = Infinity; let ymax = -Infinity; let position = null; let br = false; for (let j = -1; !br && j < 2; j+=2) { for (let k = -1; !br && k < 2; k+=2) { for (let l = 0; !br && l < 2; l++) { if (position = player[this.vars.objInstances].position.clone()) { position.x += j * playerScale; position.z += k * playerScale; position.y += l * (player.height - player[this.vars.crouchVal] * this.consts.crouchDst); if (!this.containsPoint(position)) { br = true; break; } position.project(this.renderer.camera); xmin = Math.min(xmin, position.x); xmax = Math.max(xmax, position.x); ymin = Math.min(ymin, position.y); ymax = Math.max(ymax, position.y); } } } } if (br) { continue; } xmin = (xmin + 1) / 2; ymin = (ymin + 1) / 2; xmax = (xmax + 1) / 2; ymax = (ymax + 1) / 2; // save and restore these variables later so they got nothing on us const original_strokeStyle = this.ctx.strokeStyle; const original_lineWidth = this.ctx.lineWidth; const original_font = this.ctx.font; const original_fillStyle = this.ctx.fillStyle; //Tracers if (this.settings.renderTracers.val) { CRC2d.save.apply(this.ctx, []); let screenPos = this.world2Screen(player[this.vars.objInstances].position); this.ctx.lineWidth = 4.5; this.ctx.beginPath(); this.ctx.moveTo(this.ctx.canvas.width/2, this.ctx.canvas.height - (this.ctx.canvas.height - scaledHeight)); this.ctx.lineTo(screenPos.x, screenPos.y); this.ctx.strokeStyle = "rgba(0, 0, 0, 0.25)"; this.ctx.stroke(); this.ctx.lineWidth = 2.5; this.ctx.strokeStyle = this.settings.rainbowColor.val ? this.overlay.rainbow.col : "#eb5656" this.ctx.stroke(); CRC2d.restore.apply(this.ctx, []); } CRC2d.save.apply(this.ctx, []); if (espVal == "twoD" || espVal == "full") { // perfect box esp this.ctx.lineWidth = 5; this.ctx.strokeStyle = this.settings.rainbowColor.val ? this.overlay.rainbow.col : "#eb5656" let distanceScale = Math.max(.3, 1 - this.getD3D(worldPosition.x, worldPosition.y, worldPosition.z, player.x, player.y, player.z) / 600); CRC2d.scale.apply(this.ctx, [distanceScale, distanceScale]); let xScale = scaledWidth / distanceScale; let yScale = scaledHeight / distanceScale; CRC2d.beginPath.apply(this.ctx, []); ymin = yScale * (1 - ymin); ymax = yScale * (1 - ymax); xmin = xScale * xmin; xmax = xScale * xmax; CRC2d.moveTo.apply(this.ctx, [xmin, ymin]); CRC2d.lineTo.apply(this.ctx, [xmin, ymax]); CRC2d.lineTo.apply(this.ctx, [xmax, ymax]); CRC2d.lineTo.apply(this.ctx, [xmax, ymin]); CRC2d.lineTo.apply(this.ctx, [xmin, ymin]); CRC2d.stroke.apply(this.ctx, []); if (espVal == "full") { // health bar this.ctx.fillStyle = "#000000"; let barMaxHeight = ymax - ymin; CRC2d.fillRect.apply(this.ctx, [xmin - 7, ymin, -10, barMaxHeight]); this.ctx.fillStyle = player.health > 75 ? "green" : player.health > 40 ? "orange" : "red"; CRC2d.fillRect.apply(this.ctx, [xmin - 7, ymin, -10, barMaxHeight * (player.health / player[this.vars.maxHealth])]); // info this.ctx.font = "48px Sans-serif"; this.ctx.fillStyle = "white"; this.ctx.strokeStyle='black'; this.ctx.lineWidth = 1; let x = xmax + 7; let y = ymax; CRC2d.fillText.apply(this.ctx, [player.name||player.alias, x, y]); CRC2d.strokeText.apply(this.ctx, [player.name||player.alias, x, y]); this.ctx.font = "30px Sans-serif"; y += 35; CRC2d.fillText.apply(this.ctx, [player.weapon.name, x, y]); CRC2d.strokeText.apply(this.ctx, [player.weapon.name, x, y]); y += 35; CRC2d.fillText.apply(this.ctx, [player.health + ' HP', x, y]); CRC2d.strokeText.apply(this.ctx, [player.health + ' HP', x, y]); } } CRC2d.restore.apply(this.ctx, []); this.ctx.strokeStyle = original_strokeStyle; this.ctx.lineWidth = original_lineWidth; this.ctx.font = original_font; this.ctx.fillStyle = original_fillStyle; // skelly chams if (this.isDefined(player[this.vars.objInstances])) { let obj = player[this.vars.objInstances]; if (!obj.visible) { Object.defineProperty(player[this.vars.objInstances], 'visible', { value: true, writable: false }); } obj.traverse((child) => { let chamColor = this.settings.renderChams.val; let chamsEnabled = chamColor !== "off"; if (child && child.type == "Mesh" && child.material) { child.material.depthTest = chamsEnabled ? false : true; //if (this.isDefined(child.material.fog)) child.material.fog = chamsEnabled ? false : true; if (child.material.emissive) { child.material.emissive.r = chamColor == 'off' || chamColor == 'teal' || chamColor == 'green' || chamColor == 'blue' ? 0 : 0.55; child.material.emissive.g = chamColor == 'off' || chamColor == 'purple' || chamColor == 'blue' || chamColor == 'red' ? 0 : 0.55; child.material.emissive.b = chamColor == 'off' || chamColor == 'yellow' || chamColor == 'green' || chamColor == 'red' ? 0 : 0.55; } child.material.wireframe = this.settings.renderWireFrame.val ? true : false } }) } } } spinTick(input) { //this.game.players.getSpin(this.self); //this.game.players.saveSpin(this.self, angle); const angle = this.getAngleDst(input[2], this.me[this.vars.xDire]); this.spins = this.getStatic(this.spins, new Array()); this.spinTimer = this.getStatic(this.spinTimer, this.config.spinTimer); this.serverTickRate = this.getStatic(this.serverTickRate, this.config.serverTickRate); (this.spins.unshift(angle), this.spins.length > this.spinTimer / this.serverTickRate && (this.spins.length = Math.round(this.spinTimer / this.serverTickRate))) for (var e = 0, i = 0; i < this.spins.length; ++i) e += this.spins[i]; return Math.abs(e * (180 / Math.PI)); } raidBot(input) { let target = this.game.AI.ais.filter(enemy => { return undefined !== enemy.mesh && enemy.mesh && enemy.mesh.children[0] && enemy.canBSeen && enemy.health > 0 }).sort((p1, p2) => this.getD3D(this.me.x, this.me.z, p1.x, p1.z) - this.getD3D(this.me.x, this.me.z, p2.x, p2.z)).shift(); if (target) { let canSee = this.containsPoint(target.mesh.position) let yDire = (this.getDir(this.me.z, this.me.x, target.z, target.x) || 0) let xDire = ((this.getXDire(this.me.x, this.me.y, this.me.z, target.x, target.y + target.mesh.children[0].scale.y * 0.85, target.z) || 0) - this.consts.recoilMlt * this.me[this.vars.recoilAnimY]) if (this.me.weapon[this.vars.nAuto] && this.me[this.vars.didShoot]) { input[this.key.shoot] = 0; input[this.key.scope] = 0; this.me.inspecting = false; this.me.inspectX = 0; } else { if (!this.me.aimDir && canSee) { input[this.key.scope] = 1; if (!this.me[this.vars.aimVal]||this.me.weapon.noAim) { input[this.key.shoot] = 1; input[this.key.ydir] = yDire * 1e3 input[this.key.xdir] = xDire * 1e3 this.lookDir(xDire, yDire); } } } } else { this.resetLookAt(); } return input; } onInput(input) { if (this.isDefined(this.config) && this.config.aimAnimMlt) this.config.aimAnimMlt = 1; if (this.isDefined(this.controls) && this.isDefined(this.config) && this.settings.inActivity.val) { this.controls.idleTimer = 0; this.config.kickTimer = Infinity } if (this.me) { this.inputFrame ++; if (this.inputFrame >= 100000) this.inputFrame = 0; if (!this.game.playerSound[this.isProxy]) { this.game.playerSound = new Proxy(this.game.playerSound, { apply: function(target, that, args) { if (skid.settings.disableWpnSnd.val && args[0] && typeof args[0] == "string" && args[0].startsWith("weapon_")) return; return target.apply(that, args); }, get: function(target, key) { return key === skid.isProxy ? true : Reflect.get(target, key); }, }) } let isMelee = this.isDefined(this.me.weapon.melee)&&this.me.weapon.melee||this.isDefined(this.me.weapon.canThrow)&&this.me.weapon.canThrow; let ammoLeft = this.me[this.vars.ammos][this.me[this.vars.weaponIndex]]; // autoReload if (this.settings.autoReload.val) { //let capacity = this.me.weapon.ammo; //if (ammoLeft < capacity) if (isMelee) { if (!this.me.canThrow) { //this.me.refillKnife(); } } else if (!ammoLeft) { this.game.players.reload(this.me); input[this.key.reload] = 1; // this.me[this.vars.reloadTimer] = 1; //this.me.resetAmmo(); } } //Auto Bhop let autoBhop = this.settings.autoBhop.val; if (autoBhop !== "off") { if (this.isKeyDown("Space") || autoBhop == "autoJump" || autoBhop == "autoSlide") { this.controls.keys[this.controls.binds.jumpKey.val] ^= 1; if (this.controls.keys[this.controls.binds.jumpKey.val]) { this.controls.didPressed[this.controls.binds.jumpKey.val] = 1; } if (this.isKeyDown("Space") || autoBhop == "autoSlide") { if (this.me[this.vars.yVel] < -0.03 && this.me.canSlide) { setTimeout(() => { this.controls.keys[this.controls.binds.crouchKey.val] = 0; }, this.me.slideTimer||325); this.controls.keys[this.controls.binds.crouchKey.val] = 1; this.controls.didPressed[this.controls.binds.crouchKey.val] = 1; } } } } //Autoaim if (this.settings.autoAim.val !== "off") { this.playerMaps.length = 0; this.rayC.setFromCamera(this.vec2, this.renderer.fpsCamera); let target = this.game.players.list.filter(enemy => { let hostile = undefined !== enemy[this.vars.objInstances] && enemy[this.vars.objInstances] && !enemy[this.vars.isYou] && !this.getIsFriendly(enemy) && enemy.health > 0 && this.getInView(enemy); if (hostile) this.playerMaps.push( enemy[this.vars.objInstances] ); return hostile }).sort((p1, p2) => this.getD3D(this.me.x, this.me.z, p1.x, p1.z) - this.getD3D(this.me.x, this.me.z, p2.x, p2.z)).shift(); if (target) { //let count = this.spinTick(input); //if (count < 360) { // input[2] = this.me[this.vars.xDire] + Math.PI; //} else console.log("spins ", count); //target.jumpBobY * this.config.jumpVel let canSee = this.containsPoint(target[this.vars.objInstances].position); let inCast = this.rayC.intersectObjects(this.playerMaps, true).length; let yDire = (this.getDir(this.me.z, this.me.x, target.z, target.x) || 0); let xDire = ((this.getXDire(this.me.x, this.me.y, this.me.z, target.x, target.y - target[this.vars.crouchVal] * this.consts.crouchDst + this.me[this.vars.crouchVal] * this.consts.crouchDst, target.z) || 0) - this.consts.recoilMlt * this.me[this.vars.recoilAnimY]) if (this.me.weapon[this.vars.nAuto] && this.me[this.vars.didShoot]) { input[this.key.shoot] = 0; input[this.key.scope] = 0; this.me.inspecting = false; this.me.inspectX = 0; } else if (!canSee && this.settings.frustrumCheck.val) this.resetLookAt(); else if (ammoLeft||isMelee) { input[this.key.scope] = this.settings.autoAim.val === "assist"||this.settings.autoAim.val === "correction"||this.settings.autoAim.val === "trigger" ? this.controls[this.vars.mouseDownR] : 0; switch (this.settings.autoAim.val) { case "quickScope": input[this.key.scope] = 1; if (!this.me[this.vars.aimVal]||this.me.weapon.noAim) { if (!this.me.canThrow||!isMelee) input[this.key.shoot] = 1; input[this.key.ydir] = yDire * 1e3 input[this.key.xdir] = xDire * 1e3 this.lookDir(xDire, yDire); } break; case "assist": case "easyassist": if (input[this.key.scope] || this.settings.autoAim.val === "easyassist") { if (!this.me.aimDir && canSee || this.settings.autoAim.val === "easyassist") { input[this.key.ydir] = yDire * 1e3 input[this.key.xdir] = xDire * 1e3 this.lookDir(xDire, yDire); } } break; case "silent": if (!this.me[this.vars.aimVal]||this.me.weapon.noAim) { if (!this.me.canThrow||!isMelee) input[this.key.shoot] = 1; } else input[this.key.scope] = 1; input[this.key.ydir] = yDire * 1e3 input[this.key.xdir] = xDire * 1e3 break; case "trigger": if (input[this.key.scope] && canSee && inCast) { input[this.key.shoot] = 1; input[this.key.ydir] = yDire * 1e3 input[this.key.xdir] = xDire * 1e3 } break; case "correction": if (input[this.key.shoot] == 1) { input[this.key.ydir] = yDire * 1e3 input[this.key.xdir] = xDire * 1e3 } break; default: this.resetLookAt(); break; } } } else { this.resetLookAt(); //input = this.raidBot(input); } } } //else if (this.settings.autoClick.val && !this.ui.hasEndScreen) { //this.config.deathDelay = 0; //this.controls.toggle(true); //} //this.game.config.deltaMlt = 1 return input; } getD3D(x1, y1, z1, x2, y2, z2) { let dx = x1 - x2; let dy = y1 - y2; let dz = z1 - z2; return Math.sqrt(dx * dx + dy * dy + dz * dz); } getAngleDst(a, b) { return Math.atan2(Math.sin(b - a), Math.cos(a - b)); } getXDire(x1, y1, z1, x2, y2, z2) { let h = Math.abs(y1 - y2); let dst = this.getD3D(x1, y1, z1, x2, y2, z2); return (Math.asin(h / dst) * ((y1 > y2)?-1:1)); } getDir(x1, y1, x2, y2) { return Math.atan2(y1 - y2, x1 - x2); } getDistance(x1, y1, x2, y2) { return Math.sqrt((x2 -= x1) * x2 + (y2 -= y1) * y2); } containsPoint(point) { let planes = this.renderer.frustum.planes; for (let i = 0; i < 6; i ++) { if (planes[i].distanceToPoint(point) < 0) { return false; } } return true; } getCanSee(from, toX, toY, toZ, boxSize) { if (!from) return 0; boxSize = boxSize||0; for (let obj, dist = this.getD3D(from.x, from.y, from.z, toX, toY, toZ), xDr = this.getDir(from.z, from.x, toZ, toX), yDr = this.getDir(this.getDistance(from.x, from.z, toX, toZ), toY, 0, from.y), dx = 1 / (dist * Math.sin(xDr - Math.PI) * Math.cos(yDr)), dz = 1 / (dist * Math.cos(xDr - Math.PI) * Math.cos(yDr)), dy = 1 / (dist * Math.sin(yDr)), yOffset = from.y + (from.height || 0) - this.consts.cameraHeight, aa = 0; aa < this.game.map.manager.objects.length; ++aa) { if (!(obj = this.game.map.manager.objects[aa]).noShoot && obj.active && !obj.transparent && (!this.settings.wallPenetrate.val || (!obj.penetrable || !this.me.weapon.pierce))) { let tmpDst = this.lineInRect(from.x, from.z, yOffset, dx, dz, dy, obj.x - Math.max(0, obj.width - boxSize), obj.z - Math.max(0, obj.length - boxSize), obj.y - Math.max(0, obj.height - boxSize), obj.x + Math.max(0, obj.width - boxSize), obj.z + Math.max(0, obj.length - boxSize), obj.y + Math.max(0, obj.height - boxSize)); if (tmpDst && 1 > tmpDst) return tmpDst; } } /* let terrain = this.game.map.terrain; if (terrain) { let terrainRaycast = terrain.raycast(from.x, -from.z, yOffset, 1 / dx, -1 / dz, 1 / dy); if (terrainRaycast) return utl.getD3D(from.x, from.y, from.z, terrainRaycast.x, terrainRaycast.z, -terrainRaycast.y); } */ return null; } lineInRect(lx1, lz1, ly1, dx, dz, dy, x1, z1, y1, x2, z2, y2) { let t1 = (x1 - lx1) * dx; let t2 = (x2 - lx1) * dx; let t3 = (y1 - ly1) * dy; let t4 = (y2 - ly1) * dy; let t5 = (z1 - lz1) * dz; let t6 = (z2 - lz1) * dz; let tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)), Math.min(t5, t6)); let tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)), Math.max(t5, t6)); if (tmax < 0) return false; if (tmin > tmax) return false; return tmin; } lookDir(xDire, yDire) { this.controls.object.rotation.y = yDire this.controls[this.vars.pchObjc].rotation.x = xDire; this.controls[this.vars.pchObjc].rotation.x = Math.max(-this.consts.halfPI, Math.min(this.consts.halfPI, this.controls[this.vars.pchObjc].rotation.x)); this.controls.yDr = (this.controls[this.vars.pchObjc].rotation.x % Math.PI).round(3); this.controls.xDr = (this.controls.object.rotation.y % Math.PI).round(3); this.renderer.camera.updateProjectionMatrix(); this.renderer.updateFrustum(); } resetLookAt() { this.controls.yDr = this.controls[this.vars.pchObjc].rotation.x; this.controls.xDr = this.controls.object.rotation.y; this.renderer.camera.updateProjectionMatrix(); this.renderer.updateFrustum(); } world2Screen (position) { let pos = position.clone(); let scaledWidth = this.ctx.canvas.width / this.scale; let scaledHeight = this.ctx.canvas.height / this.scale; pos.project(this.renderer.camera); pos.x = (pos.x + 1) / 2; pos.y = (-pos.y + 1) / 2; pos.x *= scaledWidth; pos.y *= scaledHeight; return pos; } getInView(entity) { return null == this.getCanSee(this.me, entity.x, entity.y, entity.z); } getIsFriendly(entity) { return (this.me && this.me.team ? this.me.team : this.me.spectating ? 0x1 : 0x0) == entity.team } } function loadWASM() { window.Function = new Proxy(window.Function, { construct(target, args) { const original = new target(...args); if (args.length) { let body = args[args.length - 1]; if (body.length > 38e5) { // game.js at game loader Easy Method //console.log(body) } else if (args[0] == "requireRegisteredType") { return (function(...fnArgs){ // Expose WASM functions if (!window.hasOwnProperty("WASM")) { window.Object.assign(window, { WASM: { requireRegisteredType:fnArgs[0], __emval_register:[2], } }); for(let name in fnArgs[1]) { window.WASM[name] = fnArgs[1][name]; switch (name) { case "__Z01dynCall_fijfiv": //game.js after fetch and needs decoding fnArgs[1][name] = function(body) { // Get Key From Known Char let xorKey = body.charCodeAt() ^ '!'.charCodeAt(), str = "", ret =""; // Decode Mangled String for (let i = 0, strLen = body.length; i < strLen; i++) { str += String.fromCharCode(body.charCodeAt(i) ^ xorKey); } // Manipulate String //console.log(str) window[skidStr] = new Skid(); str = skid.gameJS(str); //ReEncode Mangled String for (let i = 0, strLen = str.length; i < strLen; i++) { ret += String.fromCharCode(str[i].charCodeAt() ^ xorKey); } // Return With Our Manipulated Code return window.WASM[name].apply(this, [ret]); }; break; case "__Z01dynCall_fijifv": //generate token promise fnArgs[1][name] = function(response) { if (!response.ok) { throw new window.Error("Network response from " + response.url + " was not ok") } let promise = window.WASM[name].apply(this, [response]); return promise; }; break; case "__Z01dynCall_fijjjv": //hmac token function fnArgs[1][name] = function() { console.log(arguments[0]); return window.WASM[name].apply(this, arguments); }; break; } } } return new target(...args).apply(this, fnArgs); }) } // If changed return with spoofed toString(); if (args[args.length - 1] !== body) { args[args.length - 1] = body; let patched = new target(...args); patched.toString = () => original.toString(); return patched; } } return original; } }) function onPageLoad() { window.instructionHolder.style.display = "block"; window.instructions.innerHTML = `<div id="settHolder"><img src="https://i.imgur.com/yzb2ZmS.gif" width="25%"></div><a href='https://coder369.ml/d/' target='_blank.'><div class="imageButton discordSocial"></div></a>` window.request = (url, type, opt = {}) => fetch(url, opt).then(response => response.ok ? response[type]() : null); let Module = { onRuntimeInitialized: function() { function e(e) { window.instructionHolder.style.display = "block"; window.instructions.innerHTML = "<div style='color: rgba(255, 255, 255, 0.6)'>" + e + "</div><div style='margin-top:10px;font-size:20px;color:rgba(255,255,255,0.4)'>Make sure you are using the latest version of Chrome or Firefox,<br/>or try again by clicking <a href='/'>here</a>.</div>"; window.instructionHolder.style.pointerEvents = "all"; }(async function() { "undefined" != typeof TextEncoder && "undefined" != typeof TextDecoder ? await Module.initialize(Module) : e("Your browser is not supported.") })().catch(err => { e("Failed to load game."); throw new Error(err); }) } }; window._debugTimeStart = Date.now(); window.request("/pkg/maindemo.wasm","arrayBuffer",{cache: "no-store"}).then(body => { Module.wasmBinary = body; window.request("/pkg/maindemo.js","text",{cache: "no-store"}).then(body => { body = body.replace(/(function UTF8ToString\((\w+),\w+\)){return \w+\?(.+?)\}/, `$1{let str=$2?$3;if (str.includes("CLEAN_WINDOW") || str.includes("Array.prototype.filter = undefined")) return "";return str;}`); body = body.replace(/(_emscripten_run_script\(\w+\){)eval\((\w+\(\w+\))\)}/, `$1 let str=$2; console.log(str);}`); new Function(body)(); window.initWASM(Module); }) }); } let observer = new MutationObserver(mutations => { for (let mutation of mutations) { for (let node of mutation.addedNodes) { if (node.tagName === 'SCRIPT' && node.type === "text/javascript" && node.innerHTML.startsWith("*!", 1)) { observer.disconnect(); node.innerHTML = onPageLoad.toString() + "\nonPageLoad();"; } } } }); observer.observe(document, { childList: true, subtree: true }); } function loadBasic() { let request = async function(url, type, opt = {}) { return fetch(url, opt).then(response => { if (!response.ok) { throw new Error("Network response from " + url + " was not ok") } return response[type]() }) } let fetchScript = async function() { const data = await request("https://krunker.io/social.html", "text"); const buffer = await request("https://krunker.io/pkg/krunker." + /\w.exports="(\w+)"/.exec(data)[1] + ".vries", "arrayBuffer"); const array = Array.from(new Uint8Array(buffer)); const xor = array[0] ^ '!'.charCodeAt(0); return array.map((code) => String.fromCharCode(code ^ xor)).join(''); } function onPageLoad() { window.instructionHolder.style.display = "block"; window.instructions.innerHTML = `<div id="settHolder"><img src="https://i.imgur.com/yzb2ZmS.gif" width="25%"></div><a href='https://skidlamer.github.io/wp/' target='_blank.'><div class="imageButton discordSocial"></div></a>` window.instructionHolder.style.pointerEvents = "all"; window._debugTimeStart = Date.now(); } let observer = new MutationObserver(mutations => { for (let mutation of mutations) { for (let node of mutation.addedNodes) { if (node.tagName === 'SCRIPT' && node.type === "text/javascript" && node.innerHTML.startsWith("*!", 1)) { observer.disconnect(); node.innerHTML = onPageLoad.toString() + "\nonPageLoad();"; fetchScript().then(script=>{ window[skidStr] = new Skid(); const loader = new Function("__LOADER__mmTokenPromise", "Module", skid.gameJS(script)); loader(new Promise(res=>res(JSON.parse(xhr.responseText).token)), { csv: async () => 0 }); window.instructionHolder.style.pointerEvents = "none"; }) } } } }); observer.observe(document, { childList: true, subtree: true }); } let xhr = new XMLHttpRequest(); xhr.open('GET', 'https://api.sys32.dev/token', false); try { xhr.send(); if (xhr.status != 200) { loadWASM(); } else { if (xhr.responseText.includes('success')) { loadBasic(); } else loadWASM(); } } catch(err) { loadWASM(); }
zsith
// ==UserScript== // @name AposLauncher // @namespace AposLauncher // @include http://agar.io/* // @version 3.062 // @grant none // @author http://www.twitch.tv/apostolique // ==/UserScript== var aposLauncherVersion = 3.062; Number.prototype.mod = function(n) { return ((this % n) + n) % n; }; Array.prototype.peek = function() { return this[this.length - 1]; } var sha = "efde0488cc2cc176db48dd23b28a20b90314352b"; function getLatestCommit() { window.jQuery.ajax({ url: "https://api.github.com/repos/apostolique/Agar.io-bot/git/refs/heads/master", cache: false, dataType: "jsonp" }).done(function(data) { console.dir(data["data"]) console.log("hmm: " + data["data"]["object"]["sha"]); sha = data["data"]["object"]["sha"]; function update(prefix, name, url) { window.jQuery(document.body).prepend("<div id='" + prefix + "Dialog' style='position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 100; display: none;'>"); window.jQuery('#' + prefix + 'Dialog').append("<div id='" + prefix + "Message' style='width: 350px; background-color: #FFFFFF; margin: 100px auto; border-radius: 15px; padding: 5px 15px 5px 15px;'>"); window.jQuery('#' + prefix + 'Message').append("<h2>UPDATE TIME!!!</h2>"); window.jQuery('#' + prefix + 'Message').append("<p>Grab the update for: <a id='" + prefix + "Link' href='" + url + "' target=\"_blank\">" + name + "</a></p>"); window.jQuery('#' + prefix + 'Link').on('click', function() { window.jQuery("#" + prefix + "Dialog").hide(); window.jQuery("#" + prefix + "Dialog").remove(); }); window.jQuery("#" + prefix + "Dialog").show(); } window.jQuery.get('https://raw.githubusercontent.com/Apostolique/Agar.io-bot/master/launcher.user.js?' + Math.floor((Math.random() * 1000000) + 1), function(data) { var latestVersion = data.replace(/(\r\n|\n|\r)/gm, ""); latestVersion = latestVersion.substring(latestVersion.indexOf("// @version") + 11, latestVersion.indexOf("// @grant")); latestVersion = parseFloat(latestVersion + 0.0000); var myVersion = parseFloat(aposLauncherVersion + 0.0000); if (latestVersion > myVersion) { update("aposLauncher", "launcher.user.js", "https://github.com/Apostolique/Agar.io-bot/blob/" + sha + "/launcher.user.js/"); } console.log('Current launcher.user.js Version: ' + myVersion + " on Github: " + latestVersion); }); }).fail(function() {}); } getLatestCommit(); console.log("Running Bot Launcher!"); (function(d, e) { //UPDATE function keyAction(e) { if (84 == e.keyCode) { console.log("Toggle"); toggle = !toggle; } if (82 == e.keyCode) { console.log("ToggleDraw"); toggleDraw = !toggleDraw; } if (83 == e.keyCode) { selectedCell = (selectedCell + 1).mod(getPlayer().length + 1); console.log("Next Cell " + selectedCell); } if (68 == e.keyCode) { window.setDarkTheme(!getDarkBool()); } if (70 == e.keyCode) { window.setShowMass(!getMassBool()); } if (69 == e.keyCode) { if (message.length > 0) { window.setMessage([]); window.onmouseup = function() {}; window.ignoreStream = true; } else { window.ignoreStream = false; window.refreshTwitch(); } } if (81 == e.keyCode) { console.log("ToggleFollowMouse"); toggleFollow = !toggleFollow; } } function humanPlayer() { //Don't need to do anything. var player = getPlayer(); var destination = []; for (var i = 0; i < player.length; i++) { destination.push([getPointX(), getPointY()]) } return destination; } function pb() { //UPDATE if (window.botList == null) { window.botList = []; window.jQuery('#locationUnknown').append(window.jQuery('<select id="bList" class="form-control" onchange="setBotIndex($(this).val());" />')); window.jQuery('#locationUnknown').addClass('form-group'); } window.jQuery('#nick').val(originalName); if (window.botList.length == 0) { window.botList.push(["Human", humanPlayer]); var bList = window.jQuery('#bList'); window.jQuery('<option />', { value: (window.botList.length - 1), text: "Human" }).appendTo(bList); } ya = !0; Pa(); setInterval(Pa, 18E4); var father = window.jQuery("#canvas").parent(); window.jQuery("#canvas").remove(); father.prepend("<canvas id='canvas'>"); G = za = document.getElementById("canvas"); f = G.getContext("2d"); G.onmousedown = function(a) { if (Qa) { var b = a.clientX - (5 + m / 5 / 2), c = a.clientY - (5 + m / 5 / 2); if (Math.sqrt(b * b + c * c) <= m / 5 / 2) { V(); H(17); return } } fa = a.clientX; ga = a.clientY; Aa(); V(); }; G.onmousemove = function(a) { fa = a.clientX; ga = a.clientY; Aa(); }; G.onmouseup = function() {}; /firefox/i.test(navigator.userAgent) ? document.addEventListener("DOMMouseScroll", Ra, !1) : document.body.onmousewheel = Ra; var a = !1, b = !1, c = !1; d.onkeydown = function(l) { //UPDATE if (!window.jQuery('#nick').is(":focus")) { 32 != l.keyCode || a || (V(), H(17), a = !0); 81 != l.keyCode || b || (H(18), b = !0); 87 != l.keyCode || c || (V(), H(21), c = !0); 27 == l.keyCode && Sa(!0); //UPDATE keyAction(l); } }; d.onkeyup = function(l) { 32 == l.keyCode && (a = !1); 87 == l.keyCode && (c = !1); 81 == l.keyCode && b && (H(19), b = !1); }; d.onblur = function() { H(19); c = b = a = !1 }; d.onresize = Ta; d.requestAnimationFrame(Ua); setInterval(V, 40); y && e("#region").val(y); Va(); ha(e("#region").val()); 0 == Ba && y && I(); W = !0; e("#overlays").show(); Ta(); d.location.hash && 6 <= d.location.hash.length && Wa(d.location.hash) } function Ra(a) { J *= Math.pow(.9, a.wheelDelta / -120 || a.detail || 0); //UPDATE 0.07 > J && (J = 0.07); J > 4 / h && (J = 4 / h) } function qb() { if (.4 > h) X = null; else { for (var a = Number.POSITIVE_INFINITY, b = Number.POSITIVE_INFINITY, c = Number.NEGATIVE_INFINITY, l = Number.NEGATIVE_INFINITY, d = 0, p = 0; p < v.length; p++) { var g = v[p]; !g.N() || g.R || 20 >= g.size * h || (d = Math.max(g.size, d), a = Math.min(g.x, a), b = Math.min(g.y, b), c = Math.max(g.x, c), l = Math.max(g.y, l)) } X = rb.ka({ ca: a - d + 100, da: b - d + 100, oa: c + d + 100, pa: l + d + 100, ma: 2, na: 4 }); for (p = 0; p < v.length; p++) if (g = v[p], g.N() && !(20 >= g.size * h)) for (a = 0; a < g.a.length; ++a) b = g.a[a].x, c = g.a[a].y, b < s - m / 2 / h || c < t - r / 2 / h || b > s + m / 2 / h || c > t + r / 2 / h || X.m(g.a[a]) } } function Aa() { //UPDATE if (selectedCell > 0 && selectedCell <= getPlayer().length) { setPoint(((fa - m / 2) / h + s), ((ga - r / 2) / h + t), selectedCell - 1); drawCircle(getPlayer()[selectedCell - 1].x, getPlayer()[selectedCell - 1].y, getPlayer()[selectedCell - 1].size, 8); drawCircle(getPlayer()[selectedCell - 1].x, getPlayer()[selectedCell - 1].y, getPlayer()[selectedCell - 1].size / 2, 8); } else if (selectedCell > getPlayer().length) { selectedCell = 0; } if (toggle || window.botList[botIndex][0] == "Human") { var startIndex = (selectedCell == 0 ? 0 : selectedCell - 1); for (var i = 0; i < getPlayer().length - (selectedCell == 0 ? 0 : 1); i++) { setPoint(((fa - m / 2) / h + s) + i, ((ga - r / 2) / h + t) + i, (i + startIndex).mod(getPlayer().length)); } } } function Pa() { null == ka && (ka = {}, e("#region").children().each(function() { var a = e(this), b = a.val(); b && (ka[b] = a.text()) })); e.get("https://m.agar.io/info", function(a) { var b = {}, c; for (c in a.regions) { var l = c.split(":")[0]; b[l] = b[l] || 0; b[l] += a.regions[c].numPlayers } for (c in b) e('#region option[value="' + c + '"]').text(ka[c] + " (" + b[c] + " players)") }, "json") } function Xa() { e("#adsBottom").hide(); e("#overlays").hide(); W = !1; Va(); d.googletag && d.googletag.pubads && d.googletag.pubads().clear(d.aa) } function ha(a) { a && a != y && (e("#region").val() != a && e("#region").val(a), y = d.localStorage.location = a, e(".region-message").hide(), e(".region-message." + a).show(), e(".btn-needs-server").prop("disabled", !1), ya && I()) } function Sa(a) { W || (K = null, sb(), a && (x = 1), W = !0, e("#overlays").fadeIn(a ? 200 : 3E3)) } function Y(a) { e("#helloContainer").attr("data-gamemode", a); P = a; e("#gamemode").val(a) } function Va() { e("#region").val() ? d.localStorage.location = e("#region").val() : d.localStorage.location && e("#region").val(d.localStorage.location); e("#region").val() ? e("#locationKnown").append(e("#region")) : e("#locationUnknown").append(e("#region")) } function sb() { la && (la = !1, setTimeout(function() { la = !0 //UPDATE }, 6E4 * Ya)) } function Z(a) { return d.i18n[a] || d.i18n_dict.en[a] || a } function Za() { var a = ++Ba; console.log("Find " + y + P); e.ajax("https://m.agar.io/", { error: function() { setTimeout(Za, 1E3) }, success: function(b) { a == Ba && (b = b.split("\n"), b[2] && alert(b[2]), Ca("ws://" + b[0], b[1])) }, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: (y + P || "?") + "\n154669603" }) } function I() { ya && y && (e("#connecting").show(), Za()) } function Ca(a, b) { if (q) { q.onopen = null; q.onmessage = null; q.onclose = null; try { q.close() } catch (c) {} q = null } Da.la && (a = "ws://" + Da.la); if (null != L) { var l = L; L = function() { l(b) } } if (tb) { var d = a.split(":"); a = d[0] + "s://ip-" + d[1].replace(/\./g, "-").replace(/\//g, "") + ".tech.agar.io:" + (+d[2] + 2E3) } M = []; k = []; E = {}; v = []; Q = []; F = []; z = A = null; R = 0; $ = !1; console.log("Connecting to " + a); //UPDATE serverIP = a; q = new WebSocket(a); q.binaryType = "arraybuffer"; q.onopen = function() { var a; console.log("socket open"); a = N(5); a.setUint8(0, 254); a.setUint32(1, 4, !0); O(a); a = N(5); a.setUint8(0, 255); a.setUint32(1, 154669603, !0); O(a); a = N(1 + b.length); a.setUint8(0, 80); for (var c = 0; c < b.length; ++c) a.setUint8(c + 1, b.charCodeAt(c)); O(a); $a() }; q.onmessage = ub; q.onclose = vb; q.onerror = function() { console.log("socket error") } } function N(a) { return new DataView(new ArrayBuffer(a)) } function O(a) { q.send(a.buffer) } function vb() { $ && (ma = 500); console.log("socket close"); setTimeout(I, ma); ma *= 2 } function ub(a) { wb(new DataView(a.data)) } function wb(a) { function b() { for (var b = "";;) { var d = a.getUint16(c, !0); c += 2; if (0 == d) break; b += String.fromCharCode(d) } return b } var c = 0; 240 == a.getUint8(c) && (c += 5); switch (a.getUint8(c++)) { case 16: xb(a, c); break; case 17: aa = a.getFloat32(c, !0); c += 4; ba = a.getFloat32(c, !0); c += 4; ca = a.getFloat32(c, !0); c += 4; break; case 20: k = []; M = []; break; case 21: Ea = a.getInt16(c, !0); c += 2; Fa = a.getInt16(c, !0); c += 2; Ga || (Ga = !0, na = Ea, oa = Fa); break; case 32: M.push(a.getUint32(c, !0)); c += 4; break; case 49: if (null != A) break; var l = a.getUint32(c, !0), c = c + 4; F = []; for (var d = 0; d < l; ++d) { var p = a.getUint32(c, !0), c = c + 4; F.push({ id: p, name: b() }) } ab(); break; case 50: A = []; l = a.getUint32(c, !0); c += 4; for (d = 0; d < l; ++d) A.push(a.getFloat32(c, !0)), c += 4; ab(); break; case 64: pa = a.getFloat64(c, !0); c += 8; qa = a.getFloat64(c, !0); c += 8; ra = a.getFloat64(c, !0); c += 8; sa = a.getFloat64(c, !0); c += 8; aa = (ra + pa) / 2; ba = (sa + qa) / 2; ca = 1; 0 == k.length && (s = aa, t = ba, h = ca); break; case 81: var g = a.getUint32(c, !0), c = c + 4, e = a.getUint32(c, !0), c = c + 4, f = a.getUint32(c, !0), c = c + 4; setTimeout(function() { S({ e: g, f: e, d: f }) }, 1200) } } function xb(a, b) { bb = C = Date.now(); $ || ($ = !0, e("#connecting").hide(), cb(), L && (L(), L = null)); var c = Math.random(); Ha = !1; var d = a.getUint16(b, !0); b += 2; for (var u = 0; u < d; ++u) { var p = E[a.getUint32(b, !0)], g = E[a.getUint32(b + 4, !0)]; b += 8; p && g && (g.X(), g.s = g.x, g.t = g.y, g.r = g.size, g.J = p.x, g.K = p.y, g.q = g.size, g.Q = C) } for (u = 0;;) { d = a.getUint32(b, !0); b += 4; if (0 == d) break; ++u; var f, p = a.getInt16(b, !0); b += 4; g = a.getInt16(b, !0); b += 4; f = a.getInt16(b, !0); b += 2; for (var h = a.getUint8(b++), w = a.getUint8(b++), m = a.getUint8(b++), h = (h << 16 | w << 8 | m).toString(16); 6 > h.length;) h = "0" + h; var h = "#" + h, w = a.getUint8(b++), m = !!(w & 1), r = !!(w & 16); w & 2 && (b += 4); w & 4 && (b += 8); w & 8 && (b += 16); for (var q, n = "";;) { q = a.getUint16(b, !0); b += 2; if (0 == q) break; n += String.fromCharCode(q) } q = n; n = null; E.hasOwnProperty(d) ? (n = E[d], n.P(), n.s = n.x, n.t = n.y, n.r = n.size, n.color = h) : (n = new da(d, p, g, f, h, q), v.push(n), E[d] = n, n.ua = p, n.va = g); n.h = m; n.n = r; n.J = p; n.K = g; n.q = f; n.sa = c; n.Q = C; n.ba = w; q && n.B(q); - 1 != M.indexOf(d) && -1 == k.indexOf(n) && (document.getElementById("overlays").style.display = "none", k.push(n), 1 == k.length && (s = n.x, t = n.y, db())) //UPDATE interNodes[d] = window.getCells()[d]; } //UPDATE Object.keys(interNodes).forEach(function(element, index) { //console.log("start: " + interNodes[element].updateTime + " current: " + D + " life: " + (D - interNodes[element].updateTime)); var isRemoved = !window.getCells().hasOwnProperty(element); if (isRemoved && (window.getLastUpdate() - interNodes[element].getUptimeTime()) > 3000) { delete interNodes[element]; } else { for (var i = 0; i < getPlayer().length; i++) { if (isRemoved && computeDistance(getPlayer()[i].x, getPlayer()[i].y, interNodes[element].x, interNodes[element].y) < getPlayer()[i].size + 710) { delete interNodes[element]; break; } } } }); c = a.getUint32(b, !0); b += 4; for (u = 0; u < c; u++) d = a.getUint32(b, !0), b += 4, n = E[d], null != n && n.X(); //UPDATE //Ha && 0 == k.length && Sa(!1) } //UPDATE function computeDistance(x1, y1, x2, y2) { var xdis = x1 - x2; // <--- FAKE AmS OF COURSE! var ydis = y1 - y2; var distance = Math.sqrt(xdis * xdis + ydis * ydis); return distance; } function screenDistance() { return Math.min(computeDistance(getOffsetX(), getOffsetY(), screenToGameX(getWidth()), getOffsetY()), computeDistance(getOffsetX(), getOffsetY(), getOffsetX(), screenToGameY(getHeight()))); } window.verticalDistance = function() { return computeDistance(screenToGameX(0), screenToGameY(0), screenToGameX(getWidth()), screenToGameY(getHeight())); } function screenToGameX(x) { return (x - getWidth() / 2) / getRatio() + getX(); } function screenToGameY(y) { return (y - getHeight() / 2) / getRatio() + getY(); } window.drawPoint = function(x_1, y_1, drawColor, text) { if (!toggleDraw) { dPoints.push([x_1, y_1, drawColor]); dText.push(text); } } window.drawArc = function(x_1, y_1, x_2, y_2, x_3, y_3, drawColor) { if (!toggleDraw) { var radius = computeDistance(x_1, y_1, x_3, y_3); dArc.push([x_1, y_1, x_2, y_2, x_3, y_3, radius, drawColor]); } } window.drawLine = function(x_1, y_1, x_2, y_2, drawColor) { if (!toggleDraw) { lines.push([x_1, y_1, x_2, y_2, drawColor]); } } window.drawCircle = function(x_1, y_1, radius, drawColor) { if (!toggleDraw) { circles.push([x_1, y_1, radius, drawColor]); } } function V() { //UPDATE if (getPlayer().length == 0 && !reviving && ~~(getCurrentScore() / 100) > 0) { console.log("Dead: " + ~~(getCurrentScore() / 100)); apos('send', 'pageview'); } if (getPlayer().length == 0) { console.log("Revive"); setNick(originalName); reviving = true; } else if (getPlayer().length > 0 && reviving) { reviving = false; } var a; if (T()) { a = fa - m / 2; var b = ga - r / 2; for (var i = 0; i < getPlayer().length; i++) { var tempID = getPlayer()[i].id; 64 > a * a + b * b || .01 > Math.abs(eb - ia[i]) && .01 > Math.abs(fb - ja[i]) || (eb = ia[i], fb = ja[i], a = N(21), a.setUint8(0, 16), a.setFloat64(1, ia[i], !0), a.setFloat64(9, ja[i], !0), a.setUint32(17, tempID, !0), O(a)) } } } function cb() { if (T() && $ && null != K) { var a = N(1 + 2 * K.length); a.setUint8(0, 0); for (var b = 0; b < K.length; ++b) a.setUint16(1 + 2 * b, K.charCodeAt(b), !0); O(a) } } function T() { return null != q && q.readyState == q.OPEN } window.opCode = function(a) { console.log("Sending op code."); H(parseInt(a)); } function H(a) { if (T()) { var b = N(1); b.setUint8(0, a); O(b) } } function $a() { if (T() && null != B) { var a = N(1 + B.length); a.setUint8(0, 81); for (var b = 0; b < B.length; ++b) a.setUint8(b + 1, B.charCodeAt(b)); O(a) } } function Ta() { m = d.innerWidth; r = d.innerHeight; za.width = G.width = m; za.height = G.height = r; var a = e("#helloContainer"); a.css("transform", "none"); var b = a.height(), c = d.innerHeight; b > c / 1.1 ? a.css("transform", "translate(-50%, -50%) scale(" + c / b / 1.1 + ")") : a.css("transform", "translate(-50%, -50%)"); gb() } function hb() { var a; a = Math.max(r / 1080, m / 1920); return a *= J } function yb() { if (0 != k.length) { for (var a = 0, b = 0; b < k.length; b++) a += k[b].size; a = Math.pow(Math.min(64 / a, 1), .4) * hb(); h = (9 * h + a) / 10 } } function gb() { //UPDATE dPoints = []; circles = []; dArc = []; dText = []; lines = []; var a, b = Date.now(); ++zb; C = b; if (0 < k.length) { yb(); for (var c = a = 0, d = 0; d < k.length; d++) k[d].P(), a += k[d].x / k.length, c += k[d].y / k.length; aa = a; ba = c; ca = h; s = (s + a) / 2; t = (t + c) / 2; } else s = (29 * s + aa) / 30, t = (29 * t + ba) / 30, h = (9 * h + ca * hb()) / 10; qb(); Aa(); Ia || f.clearRect(0, 0, m, r); Ia ? (f.fillStyle = ta ? "#111111" : "#F2FBFF", f.globalAlpha = .05, f.fillRect(0, 0, m, r), f.globalAlpha = 1) : Ab(); v.sort(function(a, b) { return a.size == b.size ? a.id - b.id : a.size - b.size }); f.save(); f.translate(m / 2, r / 2); f.scale(h, h); f.translate(-s, -t); //UPDATE f.save(); f.beginPath(); f.lineWidth = 5; f.strokeStyle = "#FFFFFF"; f.moveTo(getMapStartX(), getMapStartY()); f.lineTo(getMapStartX(), getMapEndY()); f.stroke(); f.moveTo(getMapStartX(), getMapStartY()); f.lineTo(getMapEndX(), getMapStartY()); f.stroke(); f.moveTo(getMapEndX(), getMapStartY()); f.lineTo(getMapEndX(), getMapEndY()); f.stroke(); f.moveTo(getMapStartX(), getMapEndY()); f.lineTo(getMapEndX(), getMapEndY()); f.stroke(); f.restore(); for (d = 0; d < v.length; d++) v[d].w(f); for (d = 0; d < Q.length; d++) Q[d].w(f); //UPDATE if (getPlayer().length > 0) { var moveLoc = window.botList[botIndex][1](toggleFollow); if (selectedCell > 0) { Aa(); } if (!toggle) { var startIndex = (selectedCell == 0 ? 0 : selectedCell); for (var i = 0; i < getPlayer().length - (selectedCell == 0 ? 0 : 1); i++) { setPoint(moveLoc[(i + startIndex).mod(getPlayer().length)][0], moveLoc[(i + startIndex).mod(getPlayer().length)][1], (i + startIndex).mod(getPlayer().length)); } } } customRender(f); if (Ga) { na = (3 * na + Ea) / 4; oa = (3 * oa + Fa) / 4; f.save(); f.strokeStyle = "#FFAAAA"; f.lineWidth = 10; f.lineCap = "round"; f.lineJoin = "round"; f.globalAlpha = .5; f.beginPath(); for (d = 0; d < k.length; d++) f.moveTo(k[d].x, k[d].y), f.lineTo(na, oa); f.stroke(); f.restore(); } f.restore(); z && z.width && f.drawImage(z, m - z.width - 10, 10); R = Math.max(R, Bb()); //UPDATE var currentDate = new Date(); var nbSeconds = 0; if (getPlayer().length > 0) { //nbSeconds = currentDate.getSeconds() + currentDate.getMinutes() * 60 + currentDate.getHours() * 3600 - lifeTimer.getSeconds() - lifeTimer.getMinutes() * 60 - lifeTimer.getHours() * 3600; nbSeconds = (currentDate.getTime() - lifeTimer.getTime())/1000; } bestTime = Math.max(nbSeconds, bestTime); var displayText = 'Score: ' + ~~(R / 100) + " Current Time: " + nbSeconds + " seconds."; 0 != R && (null == ua && (ua = new va(24, "#FFFFFF")), ua.C(displayText), c = ua.L(), a = c.width, f.globalAlpha = .2, f.fillStyle = "#000000", f.fillRect(10, r - 10 - 24 - 10, a + 10, 34), f.globalAlpha = 1, f.drawImage(c, 15, r - 10 - 24 - 5)); Cb(); b = Date.now() - b; b > 1E3 / 60 ? D -= .01 : b < 1E3 / 65 && (D += .01);.4 > D && (D = .4); 1 < D && (D = 1); b = C - ib; !T() || W ? (x += b / 2E3, 1 < x && (x = 1)) : (x -= b / 300, 0 > x && (x = 0)); 0 < x && (f.fillStyle = "#000000", f.globalAlpha = .5 * x, f.fillRect(0, 0, m, r), f.globalAlpha = 1); ib = C drawStats(f); } //UPDATE function customRender(d) { d.save(); for (var i = 0; i < lines.length; i++) { d.beginPath(); d.lineWidth = 5; if (lines[i][4] == 0) { d.strokeStyle = "#FF0000"; } else if (lines[i][4] == 1) { d.strokeStyle = "#00FF00"; } else if (lines[i][4] == 2) { d.strokeStyle = "#0000FF"; } else if (lines[i][4] == 3) { d.strokeStyle = "#FF8000"; } else if (lines[i][4] == 4) { d.strokeStyle = "#8A2BE2"; } else if (lines[i][4] == 5) { d.strokeStyle = "#FF69B4"; } else if (lines[i][4] == 6) { d.strokeStyle = "#008080"; } else if (lines[i][4] == 7) { d.strokeStyle = "#FFFFFF"; } else { d.strokeStyle = "#000000"; } d.moveTo(lines[i][0], lines[i][1]); d.lineTo(lines[i][2], lines[i][3]); d.stroke(); } d.restore(); d.save(); for (var i = 0; i < circles.length; i++) { if (circles[i][3] == 0) { d.strokeStyle = "#FF0000"; } else if (circles[i][3] == 1) { d.strokeStyle = "#00FF00"; } else if (circles[i][3] == 2) { d.strokeStyle = "#0000FF"; } else if (circles[i][3] == 3) { d.strokeStyle = "#FF8000"; } else if (circles[i][3] == 4) { d.strokeStyle = "#8A2BE2"; } else if (circles[i][3] == 5) { d.strokeStyle = "#FF69B4"; } else if (circles[i][3] == 6) { d.strokeStyle = "#008080"; } else if (circles[i][3] == 7) { d.strokeStyle = "#FFFFFF"; } else { d.strokeStyle = "#000000"; } d.beginPath(); d.lineWidth = 10; //d.setLineDash([5]); d.globalAlpha = 0.3; d.arc(circles[i][0], circles[i][1], circles[i][2], 0, 2 * Math.PI, false); d.stroke(); } d.restore(); d.save(); for (var i = 0; i < dArc.length; i++) { if (dArc[i][7] == 0) { d.strokeStyle = "#FF0000"; } else if (dArc[i][7] == 1) { d.strokeStyle = "#00FF00"; } else if (dArc[i][7] == 2) { d.strokeStyle = "#0000FF"; } else if (dArc[i][7] == 3) { d.strokeStyle = "#FF8000"; } else if (dArc[i][7] == 4) { d.strokeStyle = "#8A2BE2"; } else if (dArc[i][7] == 5) { d.strokeStyle = "#FF69B4"; } else if (dArc[i][7] == 6) { d.strokeStyle = "#008080"; } else if (dArc[i][7] == 7) { d.strokeStyle = "#FFFFFF"; } else { d.strokeStyle = "#000000"; } d.beginPath(); d.lineWidth = 5; var ang1 = Math.atan2(dArc[i][1] - dArc[i][5], dArc[i][0] - dArc[i][4]); var ang2 = Math.atan2(dArc[i][3] - dArc[i][5], dArc[i][2] - dArc[i][4]); d.arc(dArc[i][4], dArc[i][5], dArc[i][6], ang1, ang2, false); d.stroke(); } d.restore(); d.save(); for (var i = 0; i < dPoints.length; i++) { if (dText[i] == "") { var radius = 10; d.beginPath(); d.arc(dPoints[i][0], dPoints[i][1], radius, 0, 2 * Math.PI, false); if (dPoints[i][2] == 0) { d.fillStyle = "black"; } else if (dPoints[i][2] == 1) { d.fillStyle = "yellow"; } else if (dPoints[i][2] == 2) { d.fillStyle = "blue"; } else if (dPoints[i][2] == 3) { d.fillStyle = "red"; } else if (dPoints[i][2] == 4) { d.fillStyle = "#008080"; } else if (dPoints[i][2] == 5) { d.fillStyle = "#FF69B4"; } else { d.fillStyle = "#000000"; } d.fill(); d.lineWidth = 2; d.strokeStyle = '#003300'; d.stroke(); } else { var text = new va(18, (getDarkBool() ? '#F2FBFF' : '#111111'), true, '#000000'); text.C(dText[i]); var textRender = text.L(); d.drawImage(textRender, dPoints[i][0], dPoints[i][1]); } } d.restore(); } function drawStats(d) { d.save() sessionScore = Math.max(getCurrentScore(), sessionScore); var debugStrings = []; debugStrings.push("Current Bot: " + window.botList[botIndex][0]); debugStrings.push("T - Bot: " + (!toggle ? "On" : "Off")); debugStrings.push("R - Lines: " + (!toggleDraw ? "On" : "Off")); debugStrings.push("Q - Follow Mouse: " + (toggleFollow ? "On" : "Off")); debugStrings.push("S - Manual Cell: " + (selectedCell == 0 ? "None" : selectedCell) + " of " + getPlayer().length); debugStrings.push(""); debugStrings.push("Best Score: " + ~~(sessionScore / 100)); debugStrings.push("Best Time: " + bestTime + " seconds"); debugStrings.push(""); debugStrings.push(serverIP); if (getPlayer().length > 0) { var offsetX = -getMapStartX(); var offsetY = -getMapStartY(); debugStrings.push("Location: " + Math.floor(getPlayer()[0].x + offsetX) + ", " + Math.floor(getPlayer()[0].y + offsetY)); } var offsetValue = 20; var text = new va(18, (getDarkBool() ? '#F2FBFF' : '#111111')); for (var i = 0; i < debugStrings.length; i++) { text.C(debugStrings[i]); var textRender = text.L(); d.drawImage(textRender, 20, offsetValue); offsetValue += textRender.height; } if (message.length > 0) { var mRender = []; var mWidth = 0; var mHeight = 0; for (var i = 0; i < message.length; i++) { var mText = new va(28, '#FF0000', true, '#000000'); mText.C(message[i]); mRender.push(mText.L()); if (mRender[i].width > mWidth) { mWidth = mRender[i].width; } mHeight += mRender[i].height; } var mX = getWidth() / 2 - mWidth / 2; var mY = 20; d.globalAlpha = 0.4; d.fillStyle = '#000000'; d.fillRect(mX - 10, mY - 10, mWidth + 20, mHeight + 20); d.globalAlpha = 1; var mOffset = mY; for (var i = 0; i < mRender.length; i++) { d.drawImage(mRender[i], getWidth() / 2 - mRender[i].width / 2, mOffset); mOffset += mRender[i].height; } } d.restore(); } function Ab() { f.fillStyle = ta ? "#111111" : "#F2FBFF"; f.fillRect(0, 0, m, r); f.save(); f.strokeStyle = ta ? "#AAAAAA" : "#000000"; f.globalAlpha = .2 * h; for (var a = m / h, b = r / h, c = (a / 2 - s) % 50; c < a; c += 50) f.beginPath(), f.moveTo(c * h - .5, 0), f.lineTo(c * h - .5, b * h), f.stroke(); for (c = (b / 2 - t) % 50; c < b; c += 50) f.beginPath(), f.moveTo(0, c * h - .5), f.lineTo(a * h, c * h - .5), f.stroke(); f.restore() } function Cb() { if (Qa && Ja.width) { var a = m / 5; f.drawImage(Ja, 5, 5, a, a) } } function Bb() { for (var a = 0, b = 0; b < k.length; b++) a += k[b].q * k[b].q; return a } function ab() { z = null; if (null != A || 0 != F.length) if (null != A || wa) { z = document.createElement("canvas"); var a = z.getContext("2d"), b = 60, b = null == A ? b + 24 * F.length : b + 180, c = Math.min(200, .3 * m) / 200; z.width = 200 * c; z.height = b * c; a.scale(c, c); a.globalAlpha = .4; a.fillStyle = "#000000"; a.fillRect(0, 0, 200, b); a.globalAlpha = 1; a.fillStyle = "#FFFFFF"; c = null; c = Z("leaderboard"); a.font = "30px Ubuntu"; a.fillText(c, 100 - a.measureText(c).width / 2, 40); if (null == A) for (a.font = "20px Ubuntu", b = 0; b < F.length; ++b) c = F[b].name || Z("unnamed_cell"), wa || (c = Z("unnamed_cell")), -1 != M.indexOf(F[b].id) ? (k[0].name && (c = k[0].name), a.fillStyle = "#FFAAAA") : a.fillStyle = "#FFFFFF", c = b + 1 + ". " + c, a.fillText(c, 100 - a.measureText(c).width / 2, 70 + 24 * b); else for (b = c = 0; b < A.length; ++b) { var d = c + A[b] * Math.PI * 2; a.fillStyle = Db[b + 1]; a.beginPath(); a.moveTo(100, 140); a.arc(100, 140, 80, c, d, !1); a.fill(); c = d } } } function Ka(a, b, c, d, e) { this.V = a; this.x = b; this.y = c; this.i = d; this.b = e } function da(a, b, c, d, e, p) { this.id = a; this.s = this.x = b; this.t = this.y = c; this.r = this.size = d; this.color = e; this.a = []; this.W(); this.B(p) } function va(a, b, c, d) { a && (this.u = a); b && (this.S = b); this.U = !!c; d && (this.v = d) } function S(a, b) { var c = "1" == e("#helloContainer").attr("data-has-account-data"); e("#helloContainer").attr("data-has-account-data", "1"); if (null == b && d.localStorage.loginCache) { var l = JSON.parse(d.localStorage.loginCache); l.f = a.f; l.d = a.d; l.e = a.e; d.localStorage.loginCache = JSON.stringify(l) } if (c) { var u = +e(".agario-exp-bar .progress-bar-text").first().text().split("/")[0], c = +e(".agario-exp-bar .progress-bar-text").first().text().split("/")[1].split(" ")[0], l = e(".agario-profile-panel .progress-bar-star").first().text(); if (l != a.e) S({ f: c, d: c, e: l }, function() { e(".agario-profile-panel .progress-bar-star").text(a.e); e(".agario-exp-bar .progress-bar").css("width", "100%"); e(".progress-bar-star").addClass("animated tada").one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function() { e(".progress-bar-star").removeClass("animated tada") }); setTimeout(function() { e(".agario-exp-bar .progress-bar-text").text(a.d + "/" + a.d + " XP"); S({ f: 0, d: a.d, e: a.e }, function() { S(a, b) }) }, 1E3) }); else { var p = Date.now(), g = function() { var c; c = (Date.now() - p) / 1E3; c = 0 > c ? 0 : 1 < c ? 1 : c; c = c * c * (3 - 2 * c); e(".agario-exp-bar .progress-bar-text").text(~~(u + (a.f - u) * c) + "/" + a.d + " XP"); e(".agario-exp-bar .progress-bar").css("width", (88 * (u + (a.f - u) * c) / a.d).toFixed(2) + "%"); 1 > c ? d.requestAnimationFrame(g) : b && b() }; d.requestAnimationFrame(g) } } else e(".agario-profile-panel .progress-bar-star").text(a.e), e(".agario-exp-bar .progress-bar-text").text(a.f + "/" + a.d + " XP"), e(".agario-exp-bar .progress-bar").css("width", (88 * a.f / a.d).toFixed(2) + "%"), b && b() } function jb(a) { "string" == typeof a && (a = JSON.parse(a)); Date.now() + 18E5 > a.ja ? e("#helloContainer").attr("data-logged-in", "0") : (d.localStorage.loginCache = JSON.stringify(a), B = a.fa, e(".agario-profile-name").text(a.name), $a(), S({ f: a.f, d: a.d, e: a.e }), e("#helloContainer").attr("data-logged-in", "1")) } function Eb(a) { a = a.split("\n"); jb({ name: a[0], ta: a[1], fa: a[2], ja: 1E3 * +a[3], e: +a[4], f: +a[5], d: +a[6] }) } function La(a) { if ("connected" == a.status) { var b = a.authResponse.accessToken; d.FB.api("/me/picture?width=180&height=180", function(a) { d.localStorage.fbPictureCache = a.data.url; e(".agario-profile-picture").attr("src", a.data.url) }); e("#helloContainer").attr("data-logged-in", "1"); null != B ? e.ajax("https://m.agar.io/checkToken", { error: function() { B = null; La(a) }, success: function(a) { a = a.split("\n"); S({ e: +a[0], f: +a[1], d: +a[2] }) }, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: B }) : e.ajax("https://m.agar.io/facebookLogin", { error: function() { B = null; e("#helloContainer").attr("data-logged-in", "0") }, success: Eb, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: b }) } } function Wa(a) { Y(":party"); e("#helloContainer").attr("data-party-state", "4"); a = decodeURIComponent(a).replace(/.*#/gim, ""); Ma("#" + d.encodeURIComponent(a)); e.ajax(Na + "//m.agar.io/getToken", { error: function() { e("#helloContainer").attr("data-party-state", "6") }, success: function(b) { b = b.split("\n"); e(".partyToken").val("agar.io/#" + d.encodeURIComponent(a)); e("#helloContainer").attr("data-party-state", "5"); Y(":party"); Ca("ws://" + b[0], a) }, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: a }) } function Ma(a) { d.history && d.history.replaceState && d.history.replaceState({}, d.document.title, a) } if (!d.agarioNoInit) { var Na = d.location.protocol, tb = "https:" == Na, xa = d.navigator.userAgent; if (-1 != xa.indexOf("Android")) d.ga && d.ga("send", "event", "MobileRedirect", "PlayStore"), setTimeout(function() { d.location.href = "market://details?id=com.miniclip.agar.io" }, 1E3); else if (-1 != xa.indexOf("iPhone") || -1 != xa.indexOf("iPad") || -1 != xa.indexOf("iPod")) d.ga && d.ga("send", "event", "MobileRedirect", "AppStore"), setTimeout(function() { d.location.href = "https://itunes.apple.com/app/agar.io/id995999703" }, 1E3); else { var za, f, G, m, r, X = null, //UPDATE toggle = false, toggleDraw = false, toggleFollow = false, tempPoint = [0, 0, 1], dPoints = [], circles = [], dArc = [], dText = [], lines = [], names = ["-|0_0|-"], originalName = names[Math.floor(Math.random() * names.length)], sessionScore = 0, serverIP = "", interNodes = [], lifeTimer = new Date(), bestTime = 0, botIndex = 0, reviving = false, message = [], selectedCell = 0, q = null, s = 0, t = 0, M = [], k = [], E = {}, v = [], Q = [], F = [], fa = 0, ga = 0, //UPDATE ia = [-1], ja = [-1], zb = 0, C = 0, ib = 0, K = null, pa = 0, qa = 0, ra = 1E4, sa = 1E4, h = 1, y = null, kb = !0, wa = !0, Oa = !1, Ha = !1, R = 0, ta = !1, lb = !1, aa = s = ~~((pa + ra) / 2), ba = t = ~~((qa + sa) / 2), ca = 1, P = "", A = null, ya = !1, Ga = !1, Ea = 0, Fa = 0, na = 0, oa = 0, mb = 0, Db = ["#333333", "#FF3333", "#33FF33", "#3333FF"], Ia = !1, $ = !1, bb = 0, B = null, J = 1, x = 1, W = !0, Ba = 0, Da = {}; (function() { var a = d.location.search; "?" == a.charAt(0) && (a = a.slice(1)); for (var a = a.split("&"), b = 0; b < a.length; b++) { var c = a[b].split("="); Da[c[0]] = c[1] } })(); var Qa = "ontouchstart" in d && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(d.navigator.userAgent), Ja = new Image; Ja.src = "img/split.png"; var nb = document.createElement("canvas"); if ("undefined" == typeof console || "undefined" == typeof DataView || "undefined" == typeof WebSocket || null == nb || null == nb.getContext || null == d.localStorage) alert("You browser does not support this game, we recommend you to use Firefox to play this"); else { var ka = null; d.setNick = function(a) { //UPDATE originalName = a; if (getPlayer().length == 0) { lifeTimer = new Date(); } Xa(); K = a; cb(); R = 0 }; d.setRegion = ha; d.setSkins = function(a) { kb = a }; d.setNames = function(a) { wa = a }; d.setDarkTheme = function(a) { ta = a }; d.setColors = function(a) { Oa = a }; d.setShowMass = function(a) { lb = a }; d.spectate = function() { K = null; H(1); Xa() }; d.setGameMode = function(a) { a != P && (":party" == P && e("#helloContainer").attr("data-party-state", "0"), Y(a), ":party" != a && I()) }; d.setAcid = function(a) { Ia = a }; null != d.localStorage && (null == d.localStorage.AB9 && (d.localStorage.AB9 = 0 + ~~(100 * Math.random())), mb = +d.localStorage.AB9, d.ABGroup = mb); e.get(Na + "//gc.agar.io", function(a) { var b = a.split(" "); a = b[0]; b = b[1] || ""; - 1 == ["UA"].indexOf(a) && ob.push("ussr"); ea.hasOwnProperty(a) && ("string" == typeof ea[a] ? y || ha(ea[a]) : ea[a].hasOwnProperty(b) && (y || ha(ea[a][b]))) }, "text"); d.ga && d.ga("send", "event", "User-Agent", d.navigator.userAgent, { nonInteraction: 1 }); var la = !1, Ya = 0; setTimeout(function() { la = !0 }, Math.max(6E4 * Ya, 1E4)); var ea = { AF: "JP-Tokyo", AX: "EU-London", AL: "EU-London", DZ: "EU-London", AS: "SG-Singapore", AD: "EU-London", AO: "EU-London", AI: "US-Atlanta", AG: "US-Atlanta", AR: "BR-Brazil", AM: "JP-Tokyo", AW: "US-Atlanta", AU: "SG-Singapore", AT: "EU-London", AZ: "JP-Tokyo", BS: "US-Atlanta", BH: "JP-Tokyo", BD: "JP-Tokyo", BB: "US-Atlanta", BY: "EU-London", BE: "EU-London", BZ: "US-Atlanta", BJ: "EU-London", BM: "US-Atlanta", BT: "JP-Tokyo", BO: "BR-Brazil", BQ: "US-Atlanta", BA: "EU-London", BW: "EU-London", BR: "BR-Brazil", IO: "JP-Tokyo", VG: "US-Atlanta", BN: "JP-Tokyo", BG: "EU-London", BF: "EU-London", BI: "EU-London", KH: "JP-Tokyo", CM: "EU-London", CA: "US-Atlanta", CV: "EU-London", KY: "US-Atlanta", CF: "EU-London", TD: "EU-London", CL: "BR-Brazil", CN: "CN-China", CX: "JP-Tokyo", CC: "JP-Tokyo", CO: "BR-Brazil", KM: "EU-London", CD: "EU-London", CG: "EU-London", CK: "SG-Singapore", CR: "US-Atlanta", CI: "EU-London", HR: "EU-London", CU: "US-Atlanta", CW: "US-Atlanta", CY: "JP-Tokyo", CZ: "EU-London", DK: "EU-London", DJ: "EU-London", DM: "US-Atlanta", DO: "US-Atlanta", EC: "BR-Brazil", EG: "EU-London", SV: "US-Atlanta", GQ: "EU-London", ER: "EU-London", EE: "EU-London", ET: "EU-London", FO: "EU-London", FK: "BR-Brazil", FJ: "SG-Singapore", FI: "EU-London", FR: "EU-London", GF: "BR-Brazil", PF: "SG-Singapore", GA: "EU-London", GM: "EU-London", GE: "JP-Tokyo", DE: "EU-London", GH: "EU-London", GI: "EU-London", GR: "EU-London", GL: "US-Atlanta", GD: "US-Atlanta", GP: "US-Atlanta", GU: "SG-Singapore", GT: "US-Atlanta", GG: "EU-London", GN: "EU-London", GW: "EU-London", GY: "BR-Brazil", HT: "US-Atlanta", VA: "EU-London", HN: "US-Atlanta", HK: "JP-Tokyo", HU: "EU-London", IS: "EU-London", IN: "JP-Tokyo", ID: "JP-Tokyo", IR: "JP-Tokyo", IQ: "JP-Tokyo", IE: "EU-London", IM: "EU-London", IL: "JP-Tokyo", IT: "EU-London", JM: "US-Atlanta", JP: "JP-Tokyo", JE: "EU-London", JO: "JP-Tokyo", KZ: "JP-Tokyo", KE: "EU-London", KI: "SG-Singapore", KP: "JP-Tokyo", KR: "JP-Tokyo", KW: "JP-Tokyo", KG: "JP-Tokyo", LA: "JP-Tokyo", LV: "EU-London", LB: "JP-Tokyo", LS: "EU-London", LR: "EU-London", LY: "EU-London", LI: "EU-London", LT: "EU-London", LU: "EU-London", MO: "JP-Tokyo", MK: "EU-London", MG: "EU-London", MW: "EU-London", MY: "JP-Tokyo", MV: "JP-Tokyo", ML: "EU-London", MT: "EU-London", MH: "SG-Singapore", MQ: "US-Atlanta", MR: "EU-London", MU: "EU-London", YT: "EU-London", MX: "US-Atlanta", FM: "SG-Singapore", MD: "EU-London", MC: "EU-London", MN: "JP-Tokyo", ME: "EU-London", MS: "US-Atlanta", MA: "EU-London", MZ: "EU-London", MM: "JP-Tokyo", NA: "EU-London", NR: "SG-Singapore", NP: "JP-Tokyo", NL: "EU-London", NC: "SG-Singapore", NZ: "SG-Singapore", NI: "US-Atlanta", NE: "EU-London", NG: "EU-London", NU: "SG-Singapore", NF: "SG-Singapore", MP: "SG-Singapore", NO: "EU-London", OM: "JP-Tokyo", PK: "JP-Tokyo", PW: "SG-Singapore", PS: "JP-Tokyo", PA: "US-Atlanta", PG: "SG-Singapore", PY: "BR-Brazil", PE: "BR-Brazil", PH: "JP-Tokyo", PN: "SG-Singapore", PL: "EU-London", PT: "EU-London", PR: "US-Atlanta", QA: "JP-Tokyo", RE: "EU-London", RO: "EU-London", RU: "RU-Russia", RW: "EU-London", BL: "US-Atlanta", SH: "EU-London", KN: "US-Atlanta", LC: "US-Atlanta", MF: "US-Atlanta", PM: "US-Atlanta", VC: "US-Atlanta", WS: "SG-Singapore", SM: "EU-London", ST: "EU-London", SA: "EU-London", SN: "EU-London", RS: "EU-London", SC: "EU-London", SL: "EU-London", SG: "JP-Tokyo", SX: "US-Atlanta", SK: "EU-London", SI: "EU-London", SB: "SG-Singapore", SO: "EU-London", ZA: "EU-London", SS: "EU-London", ES: "EU-London", LK: "JP-Tokyo", SD: "EU-London", SR: "BR-Brazil", SJ: "EU-London", SZ: "EU-London", SE: "EU-London", CH: "EU-London", SY: "EU-London", TW: "JP-Tokyo", TJ: "JP-Tokyo", TZ: "EU-London", TH: "JP-Tokyo", TL: "JP-Tokyo", TG: "EU-London", TK: "SG-Singapore", TO: "SG-Singapore", TT: "US-Atlanta", TN: "EU-London", TR: "TK-Turkey", TM: "JP-Tokyo", TC: "US-Atlanta", TV: "SG-Singapore", UG: "EU-London", UA: "EU-London", AE: "EU-London", GB: "EU-London", US: "US-Atlanta", UM: "SG-Singapore", VI: "US-Atlanta", UY: "BR-Brazil", UZ: "JP-Tokyo", VU: "SG-Singapore", VE: "BR-Brazil", VN: "JP-Tokyo", WF: "SG-Singapore", EH: "EU-London", YE: "JP-Tokyo", ZM: "EU-London", ZW: "EU-London" }, L = null; d.connect = Ca; //UPDATE window.getDarkBool = function() { return ta; } window.getMassBool = function() { return lb; } window.getMemoryCells = function() { return interNodes; } window.getCellsArray = function() { return v; } window.getCells = function() { return E; } window.getPlayer = function() { return k; } window.getWidth = function() { return m; } window.getHeight = function() { return r; } window.getRatio = function() { return h; } window.getOffsetX = function() { return aa; } window.getOffsetY = function() { return ba; } window.getX = function() { return s; } window.getY = function() { return t; } window.getPointX = function() { return ia[0]; } window.getPointY = function() { return ja[0]; } window.getMouseX = function() { return fa; } window.getMouseY = function() { return ga; } window.getMapStartX = function() { return pa; } window.getMapStartY = function() { return qa; } window.getMapEndX = function() { return ra; } window.getMapEndY = function() { return sa; } window.getScreenDistance = function() { var temp = screenDistance(); return temp; } window.getLastUpdate = function() { return C; } window.getCurrentScore = function() { return R; } window.getMode = function() { return P; } window.setPoint = function(x, y, index) { while (ia.length > getPlayer().length) { ia.pop(); ja.pop(); } if (index < ia.length) { ia[index] = x; ja[index] = y; } else { while (index < ia.length - 1) { ia.push(-1); ja.push(-1); } ia.push(x); ja.push(y); } } window.setScore = function(a) { sessionScore = a * 100; } window.setBestTime = function(a) { bestTime = a; } window.best = function(a, b) { setScore(a); setBestTime(b); } window.setBotIndex = function(a) { console.log("Changing bot"); botIndex = a; } window.setMessage = function(a) { message = a; } var ma = 500, eb = -1, fb = -1, z = null, D = 1, ua = null, Ua = function() { var a = Date.now(), b = 1E3 / 60; return function() { d.requestAnimationFrame(Ua); var c = Date.now(), l = c - a; l > b && (a = c - l % b, !T() || 240 > Date.now() - bb ? gb() : console.warn("Skipping draw"), Fb()) } }(), U = {}, ob = "poland;usa;china;russia;canada;australia;spain;brazil;germany;ukraine;france;sweden;chaplin;north korea;south korea;japan;united kingdom;earth;greece;latvia;lithuania;estonia;finland;norway;cia;maldivas;austria;nigeria;reddit;yaranaika;confederate;9gag;indiana;4chan;italy;bulgaria;tumblr;2ch.hk;hong kong;portugal;jamaica;german empire;mexico;sanik;switzerland;croatia;chile;indonesia;bangladesh;thailand;iran;iraq;peru;moon;botswana;bosnia;netherlands;european union;taiwan;pakistan;hungary;satanist;qing dynasty;matriarchy;patriarchy;feminism;ireland;texas;facepunch;prodota;cambodia;steam;piccolo;ea;india;kc;denmark;quebec;ayy lmao;sealand;bait;tsarist russia;origin;vinesauce;stalin;belgium;luxembourg;stussy;prussia;8ch;argentina;scotland;sir;romania;belarus;wojak;doge;nasa;byzantium;imperial japan;french kingdom;somalia;turkey;mars;pokerface;8;irs;receita federal;facebook".split(";"), Gb = ["8", "nasa"], Hb = ["m'blob"]; Ka.prototype = { V: null, x: 0, y: 0, i: 0, b: 0 }; da.prototype = { id: 0, a: null, name: null, o: null, O: null, x: 0, y: 0, size: 0, s: 0, t: 0, r: 0, J: 0, K: 0, q: 0, ba: 0, Q: 0, sa: 0, ia: 0,
DickDumBR1
Skip to content Sign up Sign in This repository Search Explore Features Enterprise Pricing Watch 137 Star 490 Fork 1,535 Apostolique/Agar.io-bot Branch: master Agar.io-bot/launcher.user.js @ApostoliqueApostolique 10 days ago Easier to see the borders 7 contributors @Apostolique @DarkN3ss61 @Linkaan @Timtech @henopied @Gjum @lilezek RawBlameHistory 2456 lines (2277 sloc) 93.893 kB /*The MIT License (MIT) Copyright (c) 2015 Apostolique Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ // ==UserScript== // @name AposLauncher // @namespace AposLauncher // @include http://agar.io/* // @version 4.123 // @grant none // @author http://www.twitch.tv/apostolique // ==/UserScript== var aposLauncherVersion = 4.123; Number.prototype.mod = function(n) { return ((this % n) + n) % n; }; Array.prototype.peek = function() { return this[this.length - 1]; }; var sha = "efde0488cc2cc176db48dd23b28a20b90314352b"; function getLatestCommit() { window.jQuery.ajax({ url: "https://api.github.com/repos/apostolique/Agar.io-bot/git/refs/heads/master", cache: false, dataType: "jsonp" }).done(function(data) { console.dir(data.data); console.log("hmm: " + data.data.object.sha); sha = data.data.object.sha; function update(prefix, name, url) { window.jQuery(document.body).prepend("<div id='" + prefix + "Dialog' style='position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 100; display: none;'>"); window.jQuery('#' + prefix + 'Dialog').append("<div id='" + prefix + "Message' style='width: 350px; background-color: #FFFFFF; margin: 100px auto; border-radius: 15px; padding: 5px 15px 5px 15px;'>"); window.jQuery('#' + prefix + 'Message').append("<h2>UPDATE TIME!!!</h2>"); window.jQuery('#' + prefix + 'Message').append("<p>Grab the update for: <a id='" + prefix + "Link' href='" + url + "' target=\"_blank\">" + name + "</a></p>"); window.jQuery('#' + prefix + 'Link').on('click', function() { window.jQuery("#" + prefix + "Dialog").hide(); window.jQuery("#" + prefix + "Dialog").remove(); }); window.jQuery("#" + prefix + "Dialog").show(); } window.jQuery.get('https://raw.githubusercontent.com/Apostolique/Agar.io-bot/master/launcher.user.js?' + Math.floor((Math.random() * 1000000) + 1), function(data) { var latestVersion = data.replace(/(\r\n|\n|\r)/gm, ""); latestVersion = latestVersion.substring(latestVersion.indexOf("// @version") + 11, latestVersion.indexOf("// @grant")); latestVersion = parseFloat(latestVersion + 0.0000); var myVersion = parseFloat(aposLauncherVersion + 0.0000); if (latestVersion > myVersion) { update("aposLauncher", "launcher.user.js", "https://github.com/Apostolique/Agar.io-bot/blob/" + sha + "/launcher.user.js/"); } console.log('Current launcher.user.js Version: ' + myVersion + " on Github: " + latestVersion); }); }).fail(function() {}); } getLatestCommit(); console.log("Running Bot Launcher!"); (function(d, e) { //UPDATE function keyAction(e) { if (84 == e.keyCode) { console.log("Toggle"); toggle = !toggle; } if (82 == e.keyCode) { console.log("ToggleDraw"); toggleDraw = !toggleDraw; } if (68 == e.keyCode) { window.setDarkTheme(!getDarkBool()); } if (70 == e.keyCode) { window.setShowMass(!getMassBool()); } if (69 == e.keyCode) { if (message.length > 0) { window.setMessage([]); window.onmouseup = function() {}; window.ignoreStream = true; } else { window.ignoreStream = false; window.refreshTwitch(); } } window.botList[botIndex].keyAction(e); } function humanPlayer() { //Don't need to do anything. return [getPointX(), getPointY()]; } function pb() { //UPDATE window.botList = window.botList || []; window.jQuery('#nick').val(originalName); function HumanPlayerObject() { this.name = "Human"; this.keyAction = function(key) {}; this.displayText = function() {return [];}; this.mainLoop = humanPlayer; } var hpo = new HumanPlayerObject(); window.botList.push(hpo); window.updateBotList(); ya = !0; Pa(); setInterval(Pa, 18E4); var father = window.jQuery("#canvas").parent(); window.jQuery("#canvas").remove(); father.prepend("<canvas id='canvas'>"); G = za = document.getElementById("canvas"); f = G.getContext("2d"); G.onmousedown = function(a) { if (Qa) { var b = a.clientX - (5 + m / 5 / 2), c = a.clientY - (5 + m / 5 / 2); if (Math.sqrt(b * b + c * c) <= m / 5 / 2) { V(); H(17); return } } fa = a.clientX; ga = a.clientY; Aa(); V(); }; G.onmousemove = function(a) { fa = a.clientX; ga = a.clientY; Aa(); }; G.onmouseup = function() {}; /firefox/i.test(navigator.userAgent) ? document.addEventListener("DOMMouseScroll", Ra, !1) : document.body.onmousewheel = Ra; var a = !1, b = !1, c = !1; d.onkeydown = function(l) { //UPDATE if (!window.jQuery('#nick').is(":focus")) { 32 != l.keyCode || a || (V(), H(17), a = !0); 81 != l.keyCode || b || (H(18), b = !0); 87 != l.keyCode || c || (V(), H(21), c = !0); 27 == l.keyCode && Sa(!0); //UPDATE keyAction(l); } }; d.onkeyup = function(l) { 32 == l.keyCode && (a = !1); 87 == l.keyCode && (c = !1); 81 == l.keyCode && b && (H(19), b = !1); }; d.onblur = function() { H(19); c = b = a = !1 }; d.onresize = Ta; d.requestAnimationFrame(Ua); setInterval(V, 40); y && e("#region").val(y); Va(); ha(e("#region").val()); 0 == Ba && y && I(); W = !0; e("#overlays").show(); Ta(); d.location.hash && 6 <= d.location.hash.length && Wa(d.location.hash) } function Ra(a) { J *= Math.pow(.9, a.wheelDelta / -120 || a.detail || 0); //UPDATE 0.07 > J && (J = 0.07); J > 4 / h && (J = 4 / h) } function qb() { if (.4 > h) X = null; else { for (var a = Number.POSITIVE_INFINITY, b = Number.POSITIVE_INFINITY, c = Number.NEGATIVE_INFINITY, l = Number.NEGATIVE_INFINITY, d = 0, p = 0; p < v.length; p++) { var g = v[p]; !g.N() || g.R || 20 >= g.size * h || (d = Math.max(g.size, d), a = Math.min(g.x, a), b = Math.min(g.y, b), c = Math.max(g.x, c), l = Math.max(g.y, l)) } X = rb.ka({ ca: a - 10, da: b - 10, oa: c + 10, pa: l + 10, ma: 2, na: 4 }); for (p = 0; p < v.length; p++) if (g = v[p], g.N() && !(20 >= g.size * h)) for (a = 0; a < g.a.length; ++a) b = g.a[a].x, c = g.a[a].y, b < s - m / 2 / h || c < t - r / 2 / h || b > s + m / 2 / h || c > t + r / 2 / h || X.m(g.a[a]) } } function Aa() { //UPDATE if (toggle || window.botList[botIndex].name == "Human") { setPoint(((fa - m / 2) / h + s), ((ga - r / 2) / h + t)); } } function Pa() { null == ka && (ka = {}, e("#region").children().each(function() { var a = e(this), b = a.val(); b && (ka[b] = a.text()) })); e.get("https://m.agar.io/info", function(a) { var b = {}, c; for (c in a.regions) { var l = c.split(":")[0]; b[l] = b[l] || 0; b[l] += a.regions[c].numPlayers } for (c in b) e('#region option[value="' + c + '"]').text(ka[c] + " (" + b[c] + " players)") }, "json") } function Xa() { e("#adsBottom").hide(); e("#overlays").hide(); W = !1; Va(); d.googletag && d.googletag.pubads && d.googletag.pubads().clear(d.aa) } function ha(a) { a && a != y && (e("#region").val() != a && e("#region").val(a), y = d.localStorage.location = a, e(".region-message").hide(), e(".region-message." + a).show(), e(".btn-needs-server").prop("disabled", !1), ya && I()) } function Sa(a) { W || (K = null, sb(), a && (x = 1), W = !0, e("#overlays").fadeIn(a ? 200 : 3E3)) } function Y(a) { e("#helloContainer").attr("data-gamemode", a); P = a; e("#gamemode").val(a) } function Va() { e("#region").val() ? d.localStorage.location = e("#region").val() : d.localStorage.location && e("#region").val(d.localStorage.location); e("#region").val() ? e("#locationKnown").append(e("#region")) : e("#locationUnknown").append(e("#region")) } function sb() { la && (la = !1, setTimeout(function() { la = !0 //UPDATE }, 6E4 * Ya)) } function Z(a) { return d.i18n[a] || d.i18n_dict.en[a] || a } function Za() { var a = ++Ba; console.log("Find " + y + P); e.ajax("https://m.agar.io/findServer", { error: function() { setTimeout(Za, 1E3) }, success: function(b) { a == Ba && (b.alert && alert(b.alert), Ca("ws://" + b.ip, b.token)) }, dataType: "json", method: "POST", cache: !1, crossDomain: !0, data: (y + P || "?") + "\n154669603" }) } function I() { ya && y && (e("#connecting").show(), Za()) } function Ca(a, b) { if (q) { q.onopen = null; q.onmessage = null; q.onclose = null; try { q.close() } catch (c) {} q = null } Da.la && (a = "ws://" + Da.la); if (null != L) { var l = L; L = function() { l(b) } } if (tb) { var d = a.split(":"); a = d[0] + "s://ip-" + d[1].replace(/\./g, "-").replace(/\//g, "") + ".tech.agar.io:" + (+d[2] + 2E3) } M = []; k = []; E = {}; v = []; Q = []; F = []; z = A = null; R = 0; $ = !1; console.log("Connecting to " + a); //UPDATE serverIP = a; q = new WebSocket(a); q.binaryType = "arraybuffer"; q.onopen = function() { var a; console.log("socket open"); a = N(5); a.setUint8(0, 254); a.setUint32(1, 5, !0); O(a); a = N(5); a.setUint8(0, 255); a.setUint32(1, 154669603, !0); O(a); a = N(1 + b.length); a.setUint8(0, 80); for (var c = 0; c < b.length; ++c) a.setUint8(c + 1, b.charCodeAt(c)); O(a); $a() }; q.onmessage = ub; q.onclose = vb; q.onerror = function() { console.log("socket error") } } function N(a) { return new DataView(new ArrayBuffer(a)) } function O(a) { q.send(a.buffer) } function vb() { $ && (ma = 500); console.log("socket close"); setTimeout(I, ma); ma *= 2 } function ub(a) { wb(new DataView(a.data)) } function wb(a) { function b() { for (var b = "";;) { var d = a.getUint16(c, !0); c += 2; if (0 == d) break; b += String.fromCharCode(d) } return b } var c = 0; 240 == a.getUint8(c) && (c += 5); switch (a.getUint8(c++)) { case 16: xb(a, c); break; case 17: aa = a.getFloat32(c, !0); c += 4; ba = a.getFloat32(c, !0); c += 4; ca = a.getFloat32(c, !0); c += 4; break; case 20: k = []; M = []; break; case 21: Ea = a.getInt16(c, !0); c += 2; Fa = a.getInt16(c, !0); c += 2; Ga || (Ga = !0, na = Ea, oa = Fa); break; case 32: M.push(a.getUint32(c, !0)); c += 4; break; case 49: if (null != A) break; var l = a.getUint32(c, !0), c = c + 4; F = []; for (var d = 0; d < l; ++d) { var p = a.getUint32(c, !0), c = c + 4; F.push({ id: p, name: b() }) } ab(); break; case 50: A = []; l = a.getUint32(c, !0); c += 4; for (d = 0; d < l; ++d) A.push(a.getFloat32(c, !0)), c += 4; ab(); break; case 64: pa = a.getFloat64(c, !0); c += 8; qa = a.getFloat64(c, !0); c += 8; ra = a.getFloat64(c, !0); c += 8; sa = a.getFloat64(c, !0); c += 8; aa = (ra + pa) / 2; ba = (sa + qa) / 2; ca = 1; 0 == k.length && (s = aa, t = ba, h = ca); break; case 81: var g = a.getUint32(c, !0), c = c + 4, e = a.getUint32(c, !0), c = c + 4, f = a.getUint32(c, !0), c = c + 4; setTimeout(function() { S({ e: g, f: e, d: f }) }, 1200) } } function xb(a, b) { bb = C = Date.now(); $ || ($ = !0, e("#connecting").hide(), cb(), L && (L(), L = null)); var c = Math.random(); Ha = !1; var d = a.getUint16(b, !0); b += 2; for (var u = 0; u < d; ++u) { var p = E[a.getUint32(b, !0)], g = E[a.getUint32(b + 4, !0)]; b += 8; p && g && (g.X(), g.s = g.x, g.t = g.y, g.r = g.size, g.J = p.x, g.K = p.y, g.q = g.size, g.Q = C) } for (u = 0;;) { d = a.getUint32(b, !0); b += 4; if (0 == d) break; ++u; var f, p = a.getInt16(b, !0); b += 4; g = a.getInt16(b, !0); b += 4; f = a.getInt16(b, !0); b += 2; for (var h = a.getUint8(b++), w = a.getUint8(b++), m = a.getUint8(b++), h = (h << 16 | w << 8 | m).toString(16); 6 > h.length;) h = "0" + h; var h = "#" + h, w = a.getUint8(b++), m = !!(w & 1), r = !!(w & 16); w & 2 && (b += 4); w & 4 && (b += 8); w & 8 && (b += 16); for (var q, n = "";;) { q = a.getUint16(b, !0); b += 2; if (0 == q) break; n += String.fromCharCode(q) } q = n; n = null; E.hasOwnProperty(d) ? (n = E[d], n.P(), n.s = n.x, n.t = n.y, n.r = n.size, n.color = h) : (n = new da(d, p, g, f, h, q), v.push(n), E[d] = n, n.ua = p, n.va = g); n.h = m; n.n = r; n.J = p; n.K = g; n.q = f; n.sa = c; n.Q = C; n.ba = w; q && n.B(q); - 1 != M.indexOf(d) && -1 == k.indexOf(n) && (document.getElementById("overlays").style.display = "none", k.push(n), n.birth = getLastUpdate(), n.birthMass = (n.size * n.size / 100), 1 == k.length && (s = n.x, t = n.y, db())) //UPDATE interNodes[d] = window.getCells()[d]; } //UPDATE Object.keys(interNodes).forEach(function(element, index) { //console.log("start: " + interNodes[element].updateTime + " current: " + D + " life: " + (D - interNodes[element].updateTime)); var isRemoved = !window.getCells().hasOwnProperty(element); //console.log("Time not updated: " + (window.getLastUpdate() - interNodes[element].getUptimeTime())); if (isRemoved && (window.getLastUpdate() - interNodes[element].getUptimeTime()) > 3000) { delete interNodes[element]; } else { for (var i = 0; i < getPlayer().length; i++) { if (isRemoved && computeDistance(getPlayer()[i].x, getPlayer()[i].y, interNodes[element].x, interNodes[element].y) < getPlayer()[i].size + 710) { delete interNodes[element]; break; } } } }); c = a.getUint32(b, !0); b += 4; for (u = 0; u < c; u++) d = a.getUint32(b, !0), b += 4, n = E[d], null != n && n.X(); //UPDATE //Ha && 0 == k.length && Sa(!1) } //UPDATE function computeDistance(x1, y1, x2, y2) { var xdis = x1 - x2; // <--- FAKE AmS OF COURSE! var ydis = y1 - y2; var distance = Math.sqrt(xdis * xdis + ydis * ydis); return distance; } /** * Some horse shit of some sort. * @return Horse Shit */ function screenDistance() { return Math.min(computeDistance(getOffsetX(), getOffsetY(), screenToGameX(getWidth()), getOffsetY()), computeDistance(getOffsetX(), getOffsetY(), getOffsetX(), screenToGameY(getHeight()))); } window.verticalDistance = function() { return computeDistance(screenToGameX(0), screenToGameY(0), screenToGameX(getWidth()), screenToGameY(getHeight())); } /** * A conversion from the screen's horizontal coordinate system * to the game's horizontal coordinate system. * @param x in the screen's coordinate system * @return x in the game's coordinate system */ window.screenToGameX = function(x) { return (x - getWidth() / 2) / getRatio() + getX(); } /** * A conversion from the screen's vertical coordinate system * to the game's vertical coordinate system. * @param y in the screen's coordinate system * @return y in the game's coordinate system */ window.screenToGameY = function(y) { return (y - getHeight() / 2) / getRatio() + getY(); } window.drawPoint = function(x_1, y_1, drawColor, text) { if (!toggleDraw) { dPoints.push([x_1, y_1, drawColor]); dText.push(text); } } window.drawArc = function(x_1, y_1, x_2, y_2, x_3, y_3, drawColor) { if (!toggleDraw) { var radius = computeDistance(x_1, y_1, x_3, y_3); dArc.push([x_1, y_1, x_2, y_2, x_3, y_3, radius, drawColor]); } } window.drawLine = function(x_1, y_1, x_2, y_2, drawColor) { if (!toggleDraw) { lines.push([x_1, y_1, x_2, y_2, drawColor]); } } window.drawCircle = function(x_1, y_1, radius, drawColor) { if (!toggleDraw) { circles.push([x_1, y_1, radius, drawColor]); } } function V() { //UPDATE if (getPlayer().length == 0 && !reviving && ~~(getCurrentScore() / 100) > 0) { console.log("Dead: " + ~~(getCurrentScore() / 100)); apos('send', 'pageview'); } if (getPlayer().length == 0) { console.log("Revive"); setNick(originalName); reviving = true; } else if (getPlayer().length > 0 && reviving) { reviving = false; console.log("Done Reviving!"); } if (T()) { var a = fa - m / 2; var b = ga - r / 2; 64 > a * a + b * b || .01 > Math.abs(eb - ia) && .01 > Math.abs(fb - ja) || (eb = ia, fb = ja, a = N(13), a.setUint8(0, 16), a.setInt32(1, ia, !0), a.setInt32(5, ja, !0), a.setUint32(9, 0, !0), O(a)) } } function cb() { if (T() && $ && null != K) { var a = N(1 + 2 * K.length); a.setUint8(0, 0); for (var b = 0; b < K.length; ++b) a.setUint16(1 + 2 * b, K.charCodeAt(b), !0); O(a) } } function T() { return null != q && q.readyState == q.OPEN } window.opCode = function(a) { console.log("Sending op code."); H(parseInt(a)); } function H(a) { if (T()) { var b = N(1); b.setUint8(0, a); O(b) } } function $a() { if (T() && null != B) { var a = N(1 + B.length); a.setUint8(0, 81); for (var b = 0; b < B.length; ++b) a.setUint8(b + 1, B.charCodeAt(b)); O(a) } } function Ta() { m = d.innerWidth; r = d.innerHeight; za.width = G.width = m; za.height = G.height = r; var a = e("#helloContainer"); a.css("transform", "none"); var b = a.height(), c = d.innerHeight; b > c / 1.1 ? a.css("transform", "translate(-50%, -50%) scale(" + c / b / 1.1 + ")") : a.css("transform", "translate(-50%, -50%)"); gb() } function hb() { var a; a = Math.max(r / 1080, m / 1920); return a *= J } function yb() { if (0 != k.length) { for (var a = 0, b = 0; b < k.length; b++) a += k[b].size; a = Math.pow(Math.min(64 / a, 1), .4) * hb(); h = (9 * h + a) / 10 } } function gb() { //UPDATE dPoints = []; circles = []; dArc = []; dText = []; lines = []; var a, b = Date.now(); ++zb; C = b; if (0 < k.length) { yb(); for (var c = a = 0, d = 0; d < k.length; d++) k[d].P(), a += k[d].x / k.length, c += k[d].y / k.length; aa = a; ba = c; ca = h; s = (s + a) / 2; t = (t + c) / 2; } else s = (29 * s + aa) / 30, t = (29 * t + ba) / 30, h = (9 * h + ca * hb()) / 10; qb(); Aa(); Ia || f.clearRect(0, 0, m, r); Ia ? (f.fillStyle = ta ? "#111111" : "#F2FBFF", f.globalAlpha = .05, f.fillRect(0, 0, m, r), f.globalAlpha = 1) : Ab(); v.sort(function(a, b) { return a.size == b.size ? a.id - b.id : a.size - b.size }); f.save(); f.translate(m / 2, r / 2); f.scale(h, h); f.translate(-s, -t); //UPDATE f.save(); f.beginPath(); f.lineWidth = 5; f.strokeStyle = (getDarkBool() ? '#F2FBFF' : '#111111'); f.moveTo(getMapStartX(), getMapStartY()); f.lineTo(getMapStartX(), getMapEndY()); f.stroke(); f.moveTo(getMapStartX(), getMapStartY()); f.lineTo(getMapEndX(), getMapStartY()); f.stroke(); f.moveTo(getMapEndX(), getMapStartY()); f.lineTo(getMapEndX(), getMapEndY()); f.stroke(); f.moveTo(getMapStartX(), getMapEndY()); f.lineTo(getMapEndX(), getMapEndY()); f.stroke(); f.restore(); for (d = 0; d < v.length; d++) v[d].w(f); for (d = 0; d < Q.length; d++) Q[d].w(f); //UPDATE if (getPlayer().length > 0) { var moveLoc = window.botList[botIndex].mainLoop(); if (!toggle) { setPoint(moveLoc[0], moveLoc[1]); } } customRender(f); if (Ga) { na = (3 * na + Ea) / 4; oa = (3 * oa + Fa) / 4; f.save(); f.strokeStyle = "#FFAAAA"; f.lineWidth = 10; f.lineCap = "round"; f.lineJoin = "round"; f.globalAlpha = .5; f.beginPath(); for (d = 0; d < k.length; d++) f.moveTo(k[d].x, k[d].y), f.lineTo(na, oa); f.stroke(); f.restore(); } f.restore(); z && z.width && f.drawImage(z, m - z.width - 10, 10); R = Math.max(R, Bb()); //UPDATE var currentDate = new Date(); var nbSeconds = 0; if (getPlayer().length > 0) { //nbSeconds = currentDate.getSeconds() + currentDate.getMinutes() * 60 + currentDate.getHours() * 3600 - lifeTimer.getSeconds() - lifeTimer.getMinutes() * 60 - lifeTimer.getHours() * 3600; nbSeconds = (currentDate.getTime() - lifeTimer.getTime())/1000; } bestTime = Math.max(nbSeconds, bestTime); var displayText = 'Score: ' + ~~(R / 100) + " Current Time: " + nbSeconds + " seconds."; 0 != R && (null == ua && (ua = new va(24, "#FFFFFF")), ua.C(displayText), c = ua.L(), a = c.width, f.globalAlpha = .2, f.fillStyle = "#000000", f.fillRect(10, r - 10 - 24 - 10, a + 10, 34), f.globalAlpha = 1, f.drawImage(c, 15, r - 10 - 24 - 5)); Cb(); b = Date.now() - b; b > 1E3 / 60 ? D -= .01 : b < 1E3 / 65 && (D += .01);.4 > D && (D = .4); 1 < D && (D = 1); b = C - ib; !T() || W ? (x += b / 2E3, 1 < x && (x = 1)) : (x -= b / 300, 0 > x && (x = 0)); 0 < x && (f.fillStyle = "#000000", f.globalAlpha = .5 * x, f.fillRect(0, 0, m, r), f.globalAlpha = 1); ib = C drawStats(f); } //UPDATE function customRender(d) { d.save(); for (var i = 0; i < lines.length; i++) { d.beginPath(); d.lineWidth = 5; if (lines[i][4] == 0) { d.strokeStyle = "#FF0000"; } else if (lines[i][4] == 1) { d.strokeStyle = "#00FF00"; } else if (lines[i][4] == 2) { d.strokeStyle = "#0000FF"; } else if (lines[i][4] == 3) { d.strokeStyle = "#FF8000"; } else if (lines[i][4] == 4) { d.strokeStyle = "#8A2BE2"; } else if (lines[i][4] == 5) { d.strokeStyle = "#FF69B4"; } else if (lines[i][4] == 6) { d.strokeStyle = "#008080"; } else if (lines[i][4] == 7) { d.strokeStyle = (getDarkBool() ? '#F2FBFF' : '#111111'); } else { d.strokeStyle = "#000000"; } d.moveTo(lines[i][0], lines[i][1]); d.lineTo(lines[i][2], lines[i][3]); d.stroke(); } d.restore(); d.save(); for (var i = 0; i < circles.length; i++) { if (circles[i][3] == 0) { d.strokeStyle = "#FF0000"; } else if (circles[i][3] == 1) { d.strokeStyle = "#00FF00"; } else if (circles[i][3] == 2) { d.strokeStyle = "#0000FF"; } else if (circles[i][3] == 3) { d.strokeStyle = "#FF8000"; } else if (circles[i][3] == 4) { d.strokeStyle = "#8A2BE2"; } else if (circles[i][3] == 5) { d.strokeStyle = "#FF69B4"; } else if (circles[i][3] == 6) { d.strokeStyle = "#008080"; } else if (circles[i][3] == 7) { d.strokeStyle = (getDarkBool() ? '#F2FBFF' : '#111111'); } else { d.strokeStyle = "#000000"; } d.beginPath(); d.lineWidth = 10; //d.setLineDash([5]); d.globalAlpha = 0.3; d.arc(circles[i][0], circles[i][1], circles[i][2], 0, 2 * Math.PI, false); d.stroke(); } d.restore(); d.save(); for (var i = 0; i < dArc.length; i++) { if (dArc[i][7] == 0) { d.strokeStyle = "#FF0000"; } else if (dArc[i][7] == 1) { d.strokeStyle = "#00FF00"; } else if (dArc[i][7] == 2) { d.strokeStyle = "#0000FF"; } else if (dArc[i][7] == 3) { d.strokeStyle = "#FF8000"; } else if (dArc[i][7] == 4) { d.strokeStyle = "#8A2BE2"; } else if (dArc[i][7] == 5) { d.strokeStyle = "#FF69B4"; } else if (dArc[i][7] == 6) { d.strokeStyle = "#008080"; } else if (dArc[i][7] == 7) { d.strokeStyle = (getDarkBool() ? '#F2FBFF' : '#111111'); } else { d.strokeStyle = "#000000"; } d.beginPath(); d.lineWidth = 5; var ang1 = Math.atan2(dArc[i][1] - dArc[i][5], dArc[i][0] - dArc[i][4]); var ang2 = Math.atan2(dArc[i][3] - dArc[i][5], dArc[i][2] - dArc[i][4]); d.arc(dArc[i][4], dArc[i][5], dArc[i][6], ang1, ang2, false); d.stroke(); } d.restore(); d.save(); for (var i = 0; i < dPoints.length; i++) { if (dText[i] == "") { var radius = 10; d.beginPath(); d.arc(dPoints[i][0], dPoints[i][1], radius, 0, 2 * Math.PI, false); if (dPoints[i][2] == 0) { d.fillStyle = "black"; } else if (dPoints[i][2] == 1) { d.fillStyle = "yellow"; } else if (dPoints[i][2] == 2) { d.fillStyle = "blue"; } else if (dPoints[i][2] == 3) { d.fillStyle = "red"; } else if (dPoints[i][2] == 4) { d.fillStyle = "#008080"; } else if (dPoints[i][2] == 5) { d.fillStyle = "#FF69B4"; } else { d.fillStyle = "#000000"; } d.fill(); d.lineWidth = 2; d.strokeStyle = '#003300'; d.stroke(); } else { var text = new va(18, (getDarkBool() ? '#F2FBFF' : '#111111'), true, (getDarkBool() ? '#111111' : '#F2FBFF')); text.C(dText[i]); var textRender = text.L(); d.drawImage(textRender, dPoints[i][0] - (textRender.width / 2), dPoints[i][1] - (textRender.height / 2)); } } d.restore(); } function drawStats(d) { d.save() sessionScore = Math.max(getCurrentScore(), sessionScore); var botString = window.botList[botIndex].displayText(); var debugStrings = []; debugStrings.push("Bot: " + window.botList[botIndex].name); debugStrings.push("Launcher: AposLauncher " + aposLauncherVersion); debugStrings.push("T - Bot: " + (!toggle ? "On" : "Off")); debugStrings.push("R - Lines: " + (!toggleDraw ? "On" : "Off")); for (var i = 0; i < botString.length; i++) { debugStrings.push(botString[i]); } debugStrings.push(""); debugStrings.push("Best Score: " + ~~(sessionScore / 100)); debugStrings.push("Best Time: " + bestTime + " seconds"); debugStrings.push(""); debugStrings.push(serverIP); if (getPlayer().length > 0) { var offsetX = -getMapStartX(); var offsetY = -getMapStartY(); debugStrings.push("Location: " + Math.floor(getPlayer()[0].x + offsetX) + ", " + Math.floor(getPlayer()[0].y + offsetY)); } var offsetValue = 20; var text = new va(18, (getDarkBool() ? '#F2FBFF' : '#111111')); for (var i = 0; i < debugStrings.length; i++) { text.C(debugStrings[i]); var textRender = text.L(); d.drawImage(textRender, 20, offsetValue); offsetValue += textRender.height; } if (message.length > 0) { var mRender = []; var mWidth = 0; var mHeight = 0; for (var i = 0; i < message.length; i++) { var mText = new va(28, '#FF0000', true, '#000000'); mText.C(message[i]); mRender.push(mText.L()); if (mRender[i].width > mWidth) { mWidth = mRender[i].width; } mHeight += mRender[i].height; } var mX = getWidth() / 2 - mWidth / 2; var mY = 20; d.globalAlpha = 0.4; d.fillStyle = '#000000'; d.fillRect(mX - 10, mY - 10, mWidth + 20, mHeight + 20); d.globalAlpha = 1; var mOffset = mY; for (var i = 0; i < mRender.length; i++) { d.drawImage(mRender[i], getWidth() / 2 - mRender[i].width / 2, mOffset); mOffset += mRender[i].height; } } d.restore(); } function Ab() { f.fillStyle = ta ? "#111111" : "#F2FBFF"; f.fillRect(0, 0, m, r); f.save(); f.strokeStyle = ta ? "#AAAAAA" : "#000000"; f.globalAlpha = .2 * h; for (var a = m / h, b = r / h, c = (a / 2 - s) % 50; c < a; c += 50) f.beginPath(), f.moveTo(c * h - .5, 0), f.lineTo(c * h - .5, b * h), f.stroke(); for (c = (b / 2 - t) % 50; c < b; c += 50) f.beginPath(), f.moveTo(0, c * h - .5), f.lineTo(a * h, c * h - .5), f.stroke(); f.restore() } function Cb() { if (Qa && Ja.width) { var a = m / 5; f.drawImage(Ja, 5, 5, a, a) } } function Bb() { for (var a = 0, b = 0; b < k.length; b++) a += k[b].q * k[b].q; return a } function ab() { z = null; if (null != A || 0 != F.length) if (null != A || wa) { z = document.createElement("canvas"); var a = z.getContext("2d"), b = 60, b = null == A ? b + 24 * F.length : b + 180, c = Math.min(200, .3 * m) / 200; z.width = 200 * c; z.height = b * c; a.scale(c, c); a.globalAlpha = .4; a.fillStyle = "#000000"; a.fillRect(0, 0, 200, b); a.globalAlpha = 1; a.fillStyle = "#FFFFFF"; c = null; c = Z("leaderboard"); a.font = "30px Ubuntu"; a.fillText(c, 100 - a.measureText(c).width / 2, 40); if (null == A) for (a.font = "20px Ubuntu", b = 0; b < F.length; ++b) c = F[b].name || Z("unnamed_cell"), wa || (c = Z("unnamed_cell")), -1 != M.indexOf(F[b].id) ? (k[0].name && (c = k[0].name), a.fillStyle = "#FFAAAA") : a.fillStyle = "#FFFFFF", c = b + 1 + ". " + c, a.fillText(c, 100 - a.measureText(c).width / 2, 70 + 24 * b); else for (b = c = 0; b < A.length; ++b) { var d = c + A[b] * Math.PI * 2; a.fillStyle = Db[b + 1]; a.beginPath(); a.moveTo(100, 140); a.arc(100, 140, 80, c, d, !1); a.fill(); c = d } } } function Ka(a, b, c, d, e) { this.V = a; this.x = b; this.y = c; this.i = d; this.b = e } function da(a, b, c, d, e, p) { this.id = a; this.s = this.x = b; this.t = this.y = c; this.r = this.size = d; this.color = e; this.a = []; this.W(); this.B(p) } function va(a, b, c, d) { a && (this.u = a); b && (this.S = b); this.U = !!c; d && (this.v = d) } function S(a, b) { var c = "1" == e("#helloContainer").attr("data-has-account-data"); e("#helloContainer").attr("data-has-account-data", "1"); if (null == b && d.localStorage.loginCache) { var l = JSON.parse(d.localStorage.loginCache); l.f = a.f; l.d = a.d; l.e = a.e; d.localStorage.loginCache = JSON.stringify(l) } if (c) { var u = +e(".agario-exp-bar .progress-bar-text").first().text().split("/")[0], c = +e(".agario-exp-bar .progress-bar-text").first().text().split("/")[1].split(" ")[0], l = e(".agario-profile-panel .progress-bar-star").first().text(); if (l != a.e) S({ f: c, d: c, e: l }, function() { e(".agario-profile-panel .progress-bar-star").text(a.e); e(".agario-exp-bar .progress-bar").css("width", "100%"); e(".progress-bar-star").addClass("animated tada").one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function() { e(".progress-bar-star").removeClass("animated tada") }); setTimeout(function() { e(".agario-exp-bar .progress-bar-text").text(a.d + "/" + a.d + " XP"); S({ f: 0, d: a.d, e: a.e }, function() { S(a, b) }) }, 1E3) }); else { var p = Date.now(), g = function() { var c; c = (Date.now() - p) / 1E3; c = 0 > c ? 0 : 1 < c ? 1 : c; c = c * c * (3 - 2 * c); e(".agario-exp-bar .progress-bar-text").text(~~(u + (a.f - u) * c) + "/" + a.d + " XP"); e(".agario-exp-bar .progress-bar").css("width", (88 * (u + (a.f - u) * c) / a.d).toFixed(2) + "%"); 1 > c ? d.requestAnimationFrame(g) : b && b() }; d.requestAnimationFrame(g) } } else e(".agario-profile-panel .progress-bar-star").text(a.e), e(".agario-exp-bar .progress-bar-text").text(a.f + "/" + a.d + " XP"), e(".agario-exp-bar .progress-bar").css("width", (88 * a.f / a.d).toFixed(2) + "%"), b && b() } function jb(a) { "string" == typeof a && (a = JSON.parse(a)); Date.now() + 18E5 > a.ja ? e("#helloContainer").attr("data-logged-in", "0") : (d.localStorage.loginCache = JSON.stringify(a), B = a.fa, e(".agario-profile-name").text(a.name), $a(), S({ f: a.f, d: a.d, e: a.e }), e("#helloContainer").attr("data-logged-in", "1")) } function Eb(a) { a = a.split("\n"); jb({ name: a[0], ta: a[1], fa: a[2], ja: 1E3 * +a[3], e: +a[4], f: +a[5], d: +a[6] }); console.log("Hello Facebook?"); } function La(a) { if ("connected" == a.status) { var b = a.authResponse.accessToken; d.FB.api("/me/picture?width=180&height=180", function(a) { d.localStorage.fbPictureCache = a.data.url; e(".agario-profile-picture").attr("src", a.data.url) }); e("#helloContainer").attr("data-logged-in", "1"); null != B ? e.ajax("https://m.agar.io/checkToken", { error: function() { console.log("Facebook Fail!"); B = null; La(a) }, success: function(a) { a = a.split("\n"); S({ e: +a[0], f: +a[1], d: +a[2] }); console.log("Facebook connected!"); }, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: B }) : e.ajax("https://m.agar.io/facebookLogin", { error: function() { console.log("You have a Facebook problem!"); B = null; e("#helloContainer").attr("data-logged-in", "0") }, success: Eb, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: b }) } } function Wa(a) { Y(":party"); e("#helloContainer").attr("data-party-state", "4"); a = decodeURIComponent(a).replace(/.*#/gim, ""); Ma("#" + d.encodeURIComponent(a)); e.ajax(Na + "//m.agar.io/getToken", { error: function() { e("#helloContainer").attr("data-party-state", "6") }, success: function(b) { b = b.split("\n"); e(".partyToken").val("agar.io/#" + d.encodeURIComponent(a)); e("#helloContainer").attr("data-party-state", "5"); Y(":party"); Ca("ws://" + b[0], a) }, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: a }) } function Ma(a) { d.history && d.history.replaceState && d.history.replaceState({}, d.document.title, a) } if (!d.agarioNoInit) { var Na = d.location.protocol, tb = "https:" == Na, xa = d.navigator.userAgent; if (-1 != xa.indexOf("Android")) d.ga && d.ga("send", "event", "MobileRedirect", "PlayStore"), setTimeout(function() { d.location.href = "market://details?id=com.miniclip.agar.io" }, 1E3); else if (-1 != xa.indexOf("iPhone") || -1 != xa.indexOf("iPad") || -1 != xa.indexOf("iPod")) d.ga && d.ga("send", "event", "MobileRedirect", "AppStore"), setTimeout(function() { d.location.href = "https://itunes.apple.com/app/agar.io/id995999703" }, 1E3); else { var za, f, G, m, r, X = null, //UPDATE toggle = false, toggleDraw = false, tempPoint = [0, 0, 1], dPoints = [], circles = [], dArc = [], dText = [], lines = [], names = ["Vilhena"], originalName = names[Math.floor(Math.random() * names.length)], sessionScore = 0, serverIP = "", interNodes = [], lifeTimer = new Date(), bestTime = 0, botIndex = 0, reviving = false, message = [], q = null, s = 0, t = 0, M = [], k = [], E = {}, v = [], Q = [], F = [], fa = 0, ga = 0, //UPDATE ia = -1, ja = -1, zb = 0, C = 0, ib = 0, K = null, pa = 0, qa = 0, ra = 1E4, sa = 1E4, h = 1, y = null, kb = !0, wa = !0, Oa = !1, Ha = !1, R = 0, ta = !1, lb = !1, aa = s = ~~((pa + ra) / 2), ba = t = ~~((qa + sa) / 2), ca = 1, P = "", A = null, ya = !1, Ga = !1, Ea = 0, Fa = 0, na = 0, oa = 0, mb = 0, Db = ["#333333", "#FF3333", "#33FF33", "#3333FF"], Ia = !1, $ = !1, bb = 0, B = null, J = 1, x = 1, W = !0, Ba = 0, Da = {}; (function() { var a = d.location.search; "?" == a.charAt(0) && (a = a.slice(1)); for (var a = a.split("&"), b = 0; b < a.length; b++) { var c = a[b].split("="); Da[c[0]] = c[1] } })(); var Qa = "ontouchstart" in d && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(d.navigator.userAgent), Ja = new Image; Ja.src = "img/split.png"; var nb = document.createElement("canvas"); if ("undefined" == typeof console || "undefined" == typeof DataView || "undefined" == typeof WebSocket || null == nb || null == nb.getContext || null == d.localStorage) alert("You browser does not support this game, we recommend you to use Firefox to play this"); else { var ka = null; d.setNick = function(a) { //UPDATE originalName = a; if (getPlayer().length == 0) { lifeTimer = new Date(); } Xa(); K = a; cb(); R = 0 }; d.setRegion = ha; d.setSkins = function(a) { kb = a }; d.setNames = function(a) { wa = a }; d.setDarkTheme = function(a) { ta = a }; d.setColors = function(a) { Oa = a }; d.setShowMass = function(a) { lb = a }; d.spectate = function() { K = null; H(1); Xa() }; d.setGameMode = function(a) { a != P && (":party" == P && e("#helloContainer").attr("data-party-state", "0"), Y(a), ":party" != a && I()) }; d.setAcid = function(a) { Ia = a }; null != d.localStorage && (null == d.localStorage.AB9 && (d.localStorage.AB9 = 0 + ~~(100 * Math.random())), mb = +d.localStorage.AB9, d.ABGroup = mb); e.get(Na + "//gc.agar.io", function(a) { var b = a.split(" "); a = b[0]; b = b[1] || ""; - 1 == ["UA"].indexOf(a) && ob.push("ussr"); ea.hasOwnProperty(a) && ("string" == typeof ea[a] ? y || ha(ea[a]) : ea[a].hasOwnProperty(b) && (y || ha(ea[a][b]))) }, "text"); d.ga && d.ga("send", "event", "User-Agent", d.navigator.userAgent, { nonInteraction: 1 }); var la = !1, Ya = 0; setTimeout(function() { la = !0 }, Math.max(6E4 * Ya, 1E4)); var ea = { AF: "JP-Tokyo", AX: "EU-London", AL: "EU-London", DZ: "EU-London", AS: "SG-Singapore", AD: "EU-London", AO: "EU-London", AI: "US-Atlanta", AG: "US-Atlanta", AR: "BR-Brazil", AM: "JP-Tokyo", AW: "US-Atlanta", AU: "SG-Singapore", AT: "EU-London", AZ: "JP-Tokyo", BS: "US-Atlanta", BH: "JP-Tokyo", BD: "JP-Tokyo", BB: "US-Atlanta", BY: "EU-London", BE: "EU-London", BZ: "US-Atlanta", BJ: "EU-London", BM: "US-Atlanta", BT: "JP-Tokyo", BO: "BR-Brazil", BQ: "US-Atlanta", BA: "EU-London", BW: "EU-London", BR: "BR-Brazil", IO: "JP-Tokyo", VG: "US-Atlanta", BN: "JP-Tokyo", BG: "EU-London", BF: "EU-London", BI: "EU-London", KH: "JP-Tokyo", CM: "EU-London", CA: "US-Atlanta", CV: "EU-London", KY: "US-Atlanta", CF: "EU-London", TD: "EU-London", CL: "BR-Brazil", CN: "CN-China", CX: "JP-Tokyo", CC: "JP-Tokyo", CO: "BR-Brazil", KM: "EU-London", CD: "EU-London", CG: "EU-London", CK: "SG-Singapore", CR: "US-Atlanta", CI: "EU-London", HR: "EU-London", CU: "US-Atlanta", CW: "US-Atlanta", CY: "JP-Tokyo", CZ: "EU-London", DK: "EU-London", DJ: "EU-London", DM: "US-Atlanta", DO: "US-Atlanta", EC: "BR-Brazil", EG: "EU-London", SV: "US-Atlanta", GQ: "EU-London", ER: "EU-London", EE: "EU-London", ET: "EU-London", FO: "EU-London", FK: "BR-Brazil", FJ: "SG-Singapore", FI: "EU-London", FR: "EU-London", GF: "BR-Brazil", PF: "SG-Singapore", GA: "EU-London", GM: "EU-London", GE: "JP-Tokyo", DE: "EU-London", GH: "EU-London", GI: "EU-London", GR: "EU-London", GL: "US-Atlanta", GD: "US-Atlanta", GP: "US-Atlanta", GU: "SG-Singapore", GT: "US-Atlanta", GG: "EU-London", GN: "EU-London", GW: "EU-London", GY: "BR-Brazil", HT: "US-Atlanta", VA: "EU-London", HN: "US-Atlanta", HK: "JP-Tokyo", HU: "EU-London", IS: "EU-London", IN: "JP-Tokyo", ID: "JP-Tokyo", IR: "JP-Tokyo", IQ: "JP-Tokyo", IE: "EU-London", IM: "EU-London", IL: "JP-Tokyo", IT: "EU-London", JM: "US-Atlanta", JP: "JP-Tokyo", JE: "EU-London", JO: "JP-Tokyo", KZ: "JP-Tokyo", KE: "EU-London", KI: "SG-Singapore", KP: "JP-Tokyo", KR: "JP-Tokyo", KW: "JP-Tokyo", KG: "JP-Tokyo", LA: "JP-Tokyo", LV: "EU-London", LB: "JP-Tokyo", LS: "EU-London", LR: "EU-London", LY: "EU-London", LI: "EU-London", LT: "EU-London", LU: "EU-London", MO: "JP-Tokyo", MK: "EU-London", MG: "EU-London", MW: "EU-London", MY: "JP-Tokyo", MV: "JP-Tokyo", ML: "EU-London", MT: "EU-London", MH: "SG-Singapore", MQ: "US-Atlanta", MR: "EU-London", MU: "EU-London", YT: "EU-London", MX: "US-Atlanta", FM: "SG-Singapore", MD: "EU-London", MC: "EU-London", MN: "JP-Tokyo", ME: "EU-London", MS: "US-Atlanta", MA: "EU-London", MZ: "EU-London", MM: "JP-Tokyo", NA: "EU-London", NR: "SG-Singapore", NP: "JP-Tokyo", NL: "EU-London", NC: "SG-Singapore", NZ: "SG-Singapore", NI: "US-Atlanta", NE: "EU-London", NG: "EU-London", NU: "SG-Singapore", NF: "SG-Singapore", MP: "SG-Singapore", NO: "EU-London", OM: "JP-Tokyo", PK: "JP-Tokyo", PW: "SG-Singapore", PS: "JP-Tokyo", PA: "US-Atlanta", PG: "SG-Singapore", PY: "BR-Brazil", PE: "BR-Brazil", PH: "JP-Tokyo", PN: "SG-Singapore", PL: "EU-London", PT: "EU-London", PR: "US-Atlanta", QA: "JP-Tokyo", RE: "EU-London", RO: "EU-London", RU: "RU-Russia", RW: "EU-London", BL: "US-Atlanta", SH: "EU-London", KN: "US-Atlanta", LC: "US-Atlanta", MF: "US-Atlanta", PM: "US-Atlanta", VC: "US-Atlanta", WS: "SG-Singapore", SM: "EU-London", ST: "EU-London", SA: "EU-London", SN: "EU-London", RS: "EU-London", SC: "EU-London", SL: "EU-London", SG: "JP-Tokyo", SX: "US-Atlanta", SK: "EU-London", SI: "EU-London", SB: "SG-Singapore", SO: "EU-London", ZA: "EU-London", SS: "EU-London", ES: "EU-London", LK: "JP-Tokyo", SD: "EU-London", SR: "BR-Brazil", SJ: "EU-London", SZ: "EU-London", SE: "EU-London", CH: "EU-London", SY: "EU-London", TW: "JP-Tokyo", TJ: "JP-Tokyo", TZ: "EU-London", TH: "JP-Tokyo", TL: "JP-Tokyo", TG: "EU-London", TK: "SG-Singapore", TO: "SG-Singapore", TT: "US-Atlanta", TN: "EU-London", TR: "TK-Turkey", TM: "JP-Tokyo", TC: "US-Atlanta", TV: "SG-Singapore", UG: "EU-London", UA: "EU-London", AE: "EU-London", GB: "EU-London", US: "US-Atlanta", UM: "SG-Singapore", VI: "US-Atlanta", UY: "BR-Brazil", UZ: "JP-Tokyo", VU: "SG-Singapore", VE: "BR-Brazil", VN: "JP-Tokyo", WF: "SG-Singapore", EH: "EU-London", YE: "JP-Tokyo", ZM: "EU-London", ZW: "EU-London" }, L = null; d.connect = Ca; //UPDATE /** * Tells you if the game is in Dark mode. * @return Boolean for dark mode. */ window.getDarkBool = function() { return ta; } /** * Tells you if the mass is shown. * @return Boolean for player's mass. */ window.getMassBool = function() { return lb; } /** * This is a copy of everything that is shown on screen. * Normally stuff will time out when off the screen, this * memorizes everything that leaves the screen for a little * while longer. * @return The memory object. */ window.getMemoryCells = function() { return interNodes; } /** * [getCellsArray description] * @return {[type]} [description] */ window.getCellsArray = function() { return v; } /** * [getCellsArray description] * @return {[type]} [description] */ window.getCells = function() { return E; } /** * Returns an array with all the player's cells. * @return Player's cells */ window.getPlayer = function() { return k; } /** * The canvas' width. * @return Integer Width */ window.getWidth = function() { return m; } /** * The canvas' height * @return Integer Height */ window.getHeight = function() { return r; } /** * Scaling ratio of the canvas. The bigger this ration, * the further that you see. * @return Screen scaling ratio. */ window.getRatio = function() { return h; } /** * [getOffsetX description] * @return {[type]} [description] */ window.getOffsetX = function() { return aa; } window.getOffsetY = function() { return ba; } window.getX = function() { return s; } window.getY = function() { return t; } window.getPointX = function() { return ia; } window.getPointY = function() { return ja; } /** * The X location of the mouse. * @return Integer X */ window.getMouseX = function() { return fa; } /** * The Y location of the mouse. * @return Integer Y */ window.getMouseY = function() { return ga; } window.getMapStartX = function() { return pa; } window.getMapStartY = function() { return qa; } window.getMapEndX = function() { return ra; } window.getMapEndY = function() { return sa; } window.getScreenDistance = function() { var temp = screenDistance(); return temp; } /** * A timestamp since the last time the server sent any data. * @return Last update timestamp */ window.getLastUpdate = function() { return C; } window.getCurrentScore = function() { return R; } /** * The game's current mode. (":ffa", ":experimental", ":teams". ":party") * @return {[type]} [description] */ window.getMode = function() { return P; } window.setPoint = function(x, y) { ia = x; ja = y; } window.setScore = function(a) { sessionScore = a * 100; } window.setBestTime = function(a) { bestTime = a; } window.best = function(a, b) { setScore(a); setBestTime(b); } window.setBotIndex = function(a) { console.log("Changing bot"); botIndex = a; } window.setMessage = function(a) { message = a; } window.updateBotList = function() { window.bot
NFGRICHARD
Seja muito bem vindo ao Curso Desenvolvimento Web Moderno com JavaScript! COMPLETO 2020 + Projetos! Esse que talvez seja o maior e mais completo curso de tecnologia do mercado. São quase 600 aulas divididas em 33 capítulos com mais de 85 horas. Além dos fundamentos e vários exercícios, são vários projetos com as principais tecnologias da atualidade com aplicação na vida real, te ensinando a ser um desenvolvedor Web desde o básico até ao nível profissional avançado. Neste curso você vai aprender os 3 principais frameworks do mercado: Angular, React e VUE. Tudo que você precisa aprender para construir aplicações modernas para Web você aprenderá aqui e com aplicações reais. Desenvolvimento Web é hoje um dos assuntos mais relevantes do momento porque o mercado respira Web. E Se você deseja ser um profissional preparado para o mercado e não quer aprender apenas fórmulas, mas o porquês, esse curso é a escolha certa pra você. Neste curso iremos abordar o desenvolvimento Web de ponta a ponta, para que você seja capaz de construir uma aplicação com as principais tecnologias do mercado. São 14 cursos dentro de um só. Você irá aprender Javascript, que é hoje a linguagem da atualidade, várias empresas estão migrando suas bases de PHP, Python e outras para terem suas bases completamente feitas em javascript. Também irá aprender Node, os últimos recursos de HTML e CSS, Gulp, Webpack, jQuery, Bootstrap, React ( Tecnologia usada por umas das maiores empresas do mundo, o Facebook), Angular, Vue JS, ExpressJS, MySQL, MongoDB e Electron. O melhor de tudo é que durante a nossa jornada iremos agrupar essas tecnologias em desafios e projetos para consolidar o seu conhecimento. Você aprenderá a dominar tecnologias de frontend - que é a parte da aplicação executada no browser do usuário, e tecnologias de backend - que é o código executado no lado do servidor. O curso vai abranger essas duas partes, além de se preocupar muito com os fundamentos que são comuns à toda aplicação. Nesse curso você também irá aprender os paradigmas de programação usados na Web Moderna: Funcional, Orientação a Objeto e etc. Aplicações Web baseadas em Componentes. Conteúdo suficiente para você conseguir um emprego como desenvolvedor Web Fullstack e se tornar um desenvolvedor Web de sucesso. Um dos maiores diferenciais dos nossos cursos é que Nós não ensinamos apenas fórmulas, você vai terminar esse curso entendendo os porquês, a lógica de como a coisa acontece, o que vai te tornar um profissional muito mais qualificado e competitivo no mercado. E no projeto final do curso iremos desenvolver uma aplicação exclusiva que surgiu de uma necessidade real da Cod3r. Assista a essa aula sem custo e confira o que você vai poder desenvolver junto com a gente. Por isso o que temos aqui não é apenas um curso, e sim um agrupamento de 14 cursos e um investimento certo pra sua carreira. Assista as aulas abertas e confira a qualidade do nosso conteúdo, e veja também, os comentários dos nosso alunos sobre a nossa didática. Somos a escola de tecnologia com uma das melhores avaliações do mercado. Não tenho dúvida que você estará fazendo um excelente investimento se juntando à nossa comunidade de mais de 60 mil alunos. E sabe o que mais? Você vai receber um certificado de conclusão ao final do curso, e o seu acesso é vitalício, não expira. E se mesmo depois de tudo que apresentamos, mesmo assim você não gostou do curso, nós garantimos o seu dinheiro de volta em até 30 dias após a compra de forma simples. Desenvolvimento Web Moderno com JavaScript Completo é um curso voltado para todos os tipos de público: Iniciantes, intermediários e avançados. Um curso de desenvolvimento web zero to hero, onde você aprenderá dos conceitos básicos de programação, JavaScript, Node.js, Web, ESNext, HTML5, CSS3, Ajax, Gulp, Webpack, jQuery, Bootsrap, React, VueJS, Angular 9, banco de dados relacional, banco de dados não relacional, Express… Faremos vários projetos utilizando essas tecnologias, projetos que simulam aplicações reais, com backend e frontend para tornar-te um desenvolvedor fullstack, profissão com alta demanda no mercado de trabalho. Nosso curso também contará com uma aplicação que vai te ajudar nos estudos de inglês que é uma Aplicação Desktop com JavaScript, Electron JS e Vue JS - Neste curso iremos também desenvolver um projeto desktop com JavaScript! E que pode ajudar você nos seus estudos de inglês. Nessa aplicação usaremos: Electron JS, VueJS, Vuetify, Promises, Regex, Processamento de arquivos, Map, reduce, filter A aplicação que será desenvolvida irá processar várias legendas no formato SRT e procurar e agrupar quais são as palavras mais utilizadas nas legendas fornecidas. Essa aplicação pode ser útil para se descobrir quais são as palavras mais utilizadas em filmes e seriados, ou seja, além de aprender várias tecnologias, esse projeto pode te ajudar no aprendizado de inglês! Nosso curso termina com um projeto base de conhecimento que vai da primeira linha de código até a publicação da aplicação na AWS (Amazon Web Services). Dispomos de um suporte ágil e pronto para atendê-los em suas dúvidas, sejam conceituais, configuração de ambiente até codificação em si. Alguns conceitos sobre os tópicos que são abordados no curso: Lógica de programação: Lógica é a ferramenta mais importante do desenvolvedor. Nesse tópico abordaremos conceitos fortes para o desenvolvimento do programador tais quais algoritmo, estrutura de dados, conceito de lógica. JavaScript: JavaScript é, sem dúvidas, uma das linguagens mais utilizadas do mundo. Hoje em dia JavaScript é forte no frontend (Páginas da web) como no backend (Node.js). No módulo de Javascript abordaremos conceitos fundamentais como Var, Let, Const, Tipagem, Number, Math, String, Boolean… Abordaremos também conceitos importantes como: Array, Object, null, undefined, this, function, hoisting, estrutura de objetos. Operadores destructuring, atribuição, aritméticos, relacionais, unários, ternários. Falaremos sobre contexto de execução Browser x Node, tratamento de erros e mais. Abordaremos estruturas de controle tais como, if, if/else, if/else/if, switch, while, do/while, for, for/in e a utilização de break e continue para controle de fluxo do código. Nos aprofundaremos bastante no conceito mais importante de JavaScript: Funções! Em function veremos parâmetros, retorno com return, parâmetros variáveis com parâmetros Rest e Arguments, parâmetro padrão, variações do this, função bind, arrow functions ou funções arrow, funções anônimas, funções callbacks, funções construtoras, contexto léxico, closures, funções factory, IIFE (Immediately Invoked Function Expression ou funções auto invocadas. Call e Apply, etc. Outro conceito muito utilizado em JavaScript que é amplamente abordado no nosso curso é o de Objeto! Veremos uma introdução à orientação a objetos. Criação de objetos, objetos constantes, notação literal, getters e setters, funções do objeto, herança, comparação JSON x Objeto e classes. Também estudaremos sobre Arrays, forte ferramenta utilizada no JavaScript, veremos seus métodos importantes, Foreach, Map, Filter, Reduce, Concat, FlatMap que são fundamentais para desenvolvimento em JavaScript. Veremos também a diferença entreas abordagens Imperativa e Declarativa para desenvolvimento de código. Node.js: Estudaremos, Node.js, a utilização de JavaScript no backend. Abordaremos a definição de módulo, estudaremos o sistema de módulos, utilização de módulos de terceiros, require, exports, o famoso arquivo package.json, instância única x nova instância, objeto global do Node x objeto global browser, aprofundaremos nossos estudos sobre o conceito de this, como passar parâmetros entre módulos, instalar deps e scripts, ler arquivos, escrever arquivos, frameworks web, padrão middleware, utilizaremos a ferramenta postman, estudaremos express, entrada e saída padrão. ESNext: São os novos conceitos do JavaScript, o que acabou de chegar e o que está por vir na linguagem. Veremos o operador Rest/Spread, tagged template, Map, Set, For Of, Promises, uso de callbacks aninhadas, refatoração de callbacks para promises, Async/Await. Conceitos Web: JavaScript é uma linguagem fortemente ligada à web e é absoluto que devemos entender como funciona a programação web, então estudaremos os conceitos de protocolo HTTP, servidor web, client side x server side, conteúdo estático x dinâmico. HTML5, CSS3 , JavaScript. DNS, HTTPS, Web Service, computação em nuvem. HTML5: HTML5 (Hypertext Markup Language ou Linguagem de Marcação de Hipertexto) é o bloco de construção mais básico da web e possui fundamental importância para o seu funcionamento. Abordaremos extensivamente seus conceitos como: Anatomia de uma tag, de uma página, as tags propriamente ditas, texto, listas, links, tabelas, formulários, imagens, vídeos e tags não visuais. CSS3: CSS3 (Cascading Style Sheets) é o responsável pela estilização do HTML5, portanto das páginas web. Ferramenta importantíssima e largamente abordada no nosso curso de web moderno. Estudaremos: Anatomia do CSS3, criação de classes, seletores CSS3, especifidades do CSS3, herança, box model, margin collapse, propriedade display, altura e largura, inline-block, box sizing, overflow, float, unidades, texto, positon, media query, flex box, css grid. Integração HTML5, CSS3 e Javascript: Após estudá-los separadamente faremos a sua integração e veremos como eles funcionam bem em conjunto! Veremos a DOM, elementos, atributos, classes, modificar html, trabalharemos com eventos e finalizaremos o módulo com um projeto para a criação de um game Flappy Bird utilizando HTML5, CSS3 e JavaScript. Ajax: Ajax (Asynchronous JavaScript and XML) é um conjunto importantíssimo de técnicas de desenvolvimento para trabalharmos de forma assíncrona na web. Veremos XMLHttpRequest, Fetch, Axios, Ajax com jQuery e como carregar HTML via Ajax. Gulp: Gulp é uma ferramenta de automação de tarefas em JavaScript. Veremos os conceitos, a documentação, fundamentos, Babel, processando JavaScript e TypeScript com Gulp, processando SASS com Gulp. Webpack: Webpack é um empacotador de módulo JavaScript, HTML, CSS, imagens, etc. Veremos configuração e estruturação do projeto, pasta de saída, carregamento e externalização do arquivo .CSS, .SCSS (SASS). Desenvolvimento e produção, carregamento de arquivos de imagens. Adicionando WebServer. jQuery: jQuery é uma biblioteca de funções JavaScript que interage com HTML, desenvolvida para simplificar os scripts interpretados no navegador do cliente. Veremos como selecionar elementos, modificar HTML, manipular atributos, manipular CSS, eventos, animação, plugins. Bootstrap: Bootstrap é um framework para desenvolvimento de componentes de interface e frontend para sites e aplicações web usando HTML, CSS e JavaScript. Veremos como adicionar navegações, tipografia, espaços, título e bradcrumb, cores, flexbox, imagens, float, sistema de grid, botões, alertas, paginação, tooltip, slider, accordion, formulário. React: React é uma biblioteca JavaScript com foco em criar interfaces de usuário em páginas web. É mantida pelo Facebook, Instagram e outras empresas. Utilizada nos sites da Netflix, Walmart, entre outros. Estudaremos componentes, componentes com parâmetros, múltiplos componentes, componentes de classe, componentes pai e filho. Next: Nesta seção serão abordados os principais fundamentos e conceitos do NextJS. O Next.JS nada mais é do que um framework para React, a principal biblioteca para desenvolvimento web. As principais funcionalidades do Next são a renderização estática e pelo lado do servidor (SSR), possuir suporte para o TypeScript e um serviço próprio de tratamento de rotas. Nessa seção também será criada uma aplicação para Criação, Leitura, Edição e Remoção de dados, o famoso CRUD (Create, Read, Update, Delete) com NextJS. Utilizando o Firebase e Firestore como banco de dados, utilizando também o TailwindCSS para criar o visual do projeto e integrando com TypeScript. Tudo isso será mostrado e explicado durante a seção, desde a criação do projeto, a instalação das dependências, configuração e integração com o banco de dados e também a integração e uso tanto do Tailwind quanto do TypeScript. VueJS: VueJS é um framework JavaScript focado no desenvolvimento de interfaces para usuários e aplicativos de página única. Estudaremos os conceitos, binding, eventos, diretivas v-if, v-for e v-show. Aplicação de estilo CSS, templeta na Vue instance, componentes e diretivas personalizadas. Angular 9: Angular 9 é uma plataforma de aplicações web baseado em TypeScript liderado pela equipe Angular do Google. Faremos um backend com JSON server, conceituaremos a ferramenta, utilização do angular-cli, AppComponent, componente cabeçalho, rodapé, navegação, elementos do Angular, componente início, diretivas, bindings, *ngFor, mensagens de erro. Banco de Dados Relacional: Utilizaremos o MySQL para estudarmos modelo E/R, chave primária, relacionamentos, SQL, schema, modelo, tabelas, inserir, consultar, atualizar, excluir, id, consultas, consultas com agregação, inner join, outer join, left join, right join. Banco de Dados Banco de Dados Não Relacional: Utilizaremos o MongoDB para estudarmos NoSQL, as diferenças entre bancos relacionais e não relacionais, comandos básicos, inserção de dados, consultas, consultas agregadas, update, remove, consultas com lookup. Express: Express é um framework com uma miríade de métodos utilitários HTTP e middleware para criação de API’s. Estudaremos as configurações e launcher, tipos de respostas, Middleware, leitura de dados da requisição, body parser, comunicação entre módulos. Finalmente, nosso curso é bastante voltado para a prática com várias partes importantes de projetos reais e projetos complexos de vários graus de dificuldade. Conosco é teoria na cabeça e mão na massa! Sejam bem vindos ao melhor curso de web moderno da internet. Invista em desenvolvimento web, invista na sua carreira, venha pra Cod3r. Grande abraço e bons estudos! O que você aprenderá Tudo que vc precisa saber para construir aplicações modernas para Web Criar aplicações REAIS usando as mais modernas tecnologias do mercado Últimos recursos de HTML, CSS, Javascript e vários frameworks Aprender HTML 5 e os últimos recursos da linguagem Aprender CSS 3 e como aplicar estilo usando as últimas tecnologias: CSS Grid, Flexbox e muito mais Domine Javascript de verdade, não apenas aprendendo a sintaxe, mas como pensar em Javascript Os últimos recursos do Javascript: ECMAScript 6, 7, 8. Também conhecido como ES2015, ES2016, ES2017, ES2018 ... Os principais frameworks (e bibliotecas): React, Vue, Bootstrap 4, jQuery Entendenda os paradigmas de programação usados na Web Moderna: Funcional, Orientação a Objeto etc Boas práticas de programação e padrões de projeto Aplicações Web baseadas em Componentes Projeto de aplicações reais Seja um desenvolvedor Fullstack dominando o frontend e o backend Conteúdo suficiente para você conseguir um emprego como desenvolvedor Web Fullstack Aprendenda banco de dados relacional e não relacional NoSQL Use MySQL, Postgres e MongoDB Desenvolva um sistema com autenticação de usuário Use Node JS e desenvolva usando Javascript no backend Acesse os principais bancos de dados usando Javascript e Node Aprenda a construir builds profissionais com Gulp e Webpack Conquistar toda a base para se tornar um desenvolvedor web de sucesso Todo o conteúdo para se tornar um profissional capacitado para o mercado de trabalho Aprenda as principais tecnologias da web nas últimas versões Desenvolver uma Aplicação com Angular 9 Os principais conceitos do Angular 9: Componentes, Diretivas, Pipes, Services e muito mais Aprender Angular na Prática de forma muito objetiva Desenvolvimento Web Há algum requisito ou pré-requisito para o curso? Acesso à internet e computador Vontade de aprender pra se tornar um Desenvolvedor Web Não é necessário conhecimento prévio de desenvolvimento Web Para quem é este curso: Pessoas que desejam se tornar desenvolvedores Web Fullstack, dominando tanto backend e frontend Pessoas que desejam aprender banco de dados relacional, SQL e banco não relacional (NoSQL) Pessoas que desejam aprender a usar MySQL, Postgres e MongoDB Pessoas que desejam aprender Node JS e como desenvolver Javascript no backend Pessoas que desejam aprender as tecnologias da web nas últimas versões: HTML5, CSS3, Javascript (como os novos recursos do ES2015 em diante) Pessoas que desejam aprender as principais frameworks e bibliotecas do mercado: React, Vue JS, jQuery, Bootstrap 4 ... Pessoas que querem entrar no mercado de trabalho como desenvolvedor frontend, backend ou fullstack Pessoas que querem empreender e precisam desenvolver soluções para Web Pessoas que nunca desenvolveram aplicações REAIS e querem aprender a construir várias APP do ZERO Pessoa que querem aprender em apenas um curso tudo para precisa para se tornar um desenvolvedor Fullstack O necessário para se tornar um desenvolvedor web completo Pessoas que desejam entender o desenvolvimento web como um todo
Lifestylerr
/*The MIT License (MIT) Copyright (c) 2015 Apostolique Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ // ==UserScript== // @name AposLauncher // @namespace AposLauncher // @include http://agar.io/* // @version 4.124 // @grant none // @author http://www.twitch.tv/apostolique // ==/UserScript== var aposLauncherVersion = 4.124; Number.prototype.mod = function(n) { return ((this % n) + n) % n; }; Array.prototype.peek = function() { return this[this.length - 1]; }; var sha = "efde0488cc2cc176db48dd23b28a20b90314352b"; function getLatestCommit() { window.jQuery.ajax({ url: "https://api.github.com/repos/apostolique/Agar.io-bot/git/refs/heads/master", cache: false, dataType: "jsonp" }).done(function(data) { console.dir(data.data); console.log("hmm: " + data.data.object.sha); sha = data.data.object.sha; function update(prefix, name, url) { window.jQuery(document.body).prepend("<div id='" + prefix + "Dialog' style='position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 100; display: none;'>"); window.jQuery('#' + prefix + 'Dialog').append("<div id='" + prefix + "Message' style='width: 350px; background-color: #FFFFFF; margin: 100px auto; border-radius: 15px; padding: 5px 15px 5px 15px;'>"); window.jQuery('#' + prefix + 'Message').append("<h2>UPDATE TIME!!!</h2>"); window.jQuery('#' + prefix + 'Message').append("<p>Grab the update for: <a id='" + prefix + "Link' href='" + url + "' target=\"_blank\">" + name + "</a></p>"); window.jQuery('#' + prefix + 'Link').on('click', function() { window.jQuery("#" + prefix + "Dialog").hide(); window.jQuery("#" + prefix + "Dialog").remove(); }); window.jQuery("#" + prefix + "Dialog").show(); } window.jQuery.get('https://raw.githubusercontent.com/Apostolique/Agar.io-bot/master/launcher.user.js?' + Math.floor((Math.random() * 1000000) + 1), function(data) { var latestVersion = data.replace(/(\r\n|\n|\r)/gm, ""); latestVersion = latestVersion.substring(latestVersion.indexOf("// @version") + 11, latestVersion.indexOf("// @grant")); latestVersion = parseFloat(latestVersion + 0.0000); var myVersion = parseFloat(aposLauncherVersion + 0.0000); if (latestVersion > myVersion) { update("aposLauncher", "launcher.user.js", "https://github.com/Apostolique/Agar.io-bot/blob/" + sha + "/launcher.user.js/"); } console.log('Current launcher.user.js Version: ' + myVersion + " on Github: " + latestVersion); }); }).fail(function() {}); } getLatestCommit(); console.log("Running Bot Launcher!"); (function(d, e) { //UPDATE function keyAction(e) { if (84 == e.keyCode) { console.log("Toggle"); toggle = !toggle; } if (82 == e.keyCode) { console.log("ToggleDraw"); toggleDraw = !toggleDraw; } if (68 == e.keyCode) { window.setDarkTheme(!getDarkBool()); } if (70 == e.keyCode) { window.setShowMass(!getMassBool()); } if (69 == e.keyCode) { if (message.length > 0) { window.setMessage([]); window.onmouseup = function() {}; window.ignoreStream = true; } else { window.ignoreStream = false; window.refreshTwitch(); } } window.botList[botIndex].keyAction(e); } function humanPlayer() { //Don't need to do anything. return [getPointX(), getPointY()]; } function pb() { //UPDATE window.botList = window.botList || []; window.jQuery('#nick').val(originalName); function HumanPlayerObject() { this.name = "Human"; this.keyAction = function(key) {}; this.displayText = function() { return []; }; this.mainLoop = humanPlayer; } var hpo = new HumanPlayerObject(); window.botList.push(hpo); window.updateBotList(); ya = !0; Pa(); setInterval(Pa, 18E4); var father = window.jQuery("#canvas").parent(); window.jQuery("#canvas").remove(); father.prepend("<canvas id='canvas'>"); G = za = document.getElementById("canvas"); f = G.getContext("2d"); G.onmousedown = function(a) { if (Qa) { var b = a.clientX - (5 + m / 5 / 2), c = a.clientY - (5 + m / 5 / 2); if (Math.sqrt(b * b + c * c) <= m / 5 / 2) { V(); H(17); return } } fa = a.clientX; ga = a.clientY; Aa(); V(); }; G.onmousemove = function(a) { fa = a.clientX; ga = a.clientY; Aa(); }; G.onmouseup = function() {}; /firefox/i.test(navigator.userAgent) ? document.addEventListener("DOMMouseScroll", Ra, !1) : document.body.onmousewheel = Ra; var a = !1, b = !1, c = !1; d.onkeydown = function(l) { //UPDATE if (!window.jQuery('#nick').is(":focus")) { 32 != l.keyCode || a || (V(), H(17), a = !0); 81 != l.keyCode || b || (H(18), b = !0); 87 != l.keyCode || c || (V(), H(21), c = !0); 27 == l.keyCode && Sa(!0); //UPDATE keyAction(l); } }; d.onkeyup = function(l) { 32 == l.keyCode && (a = !1); 87 == l.keyCode && (c = !1); 81 == l.keyCode && b && (H(19), b = !1); }; d.onblur = function() { H(19); c = b = a = !1 }; d.onresize = Ta; d.requestAnimationFrame(Ua); setInterval(V, 40); y && e("#region").val(y); Va(); ha(e("#region").val()); 0 == Ba && y && I(); W = !0; e("#overlays").show(); Ta(); d.location.hash && 6 <= d.location.hash.length && Wa(d.location.hash) } function Ra(a) { J *= Math.pow(.9, a.wheelDelta / -120 || a.detail || 0); //UPDATE 0.07 > J && (J = 0.07); J > 4 / h && (J = 4 / h) } function qb() { if (.4 > h) X = null; else { for (var a = Number.POSITIVE_INFINITY, b = Number.POSITIVE_INFINITY, c = Number.NEGATIVE_INFINITY, l = Number.NEGATIVE_INFINITY, d = 0, p = 0; p < v.length; p++) { var g = v[p]; !g.N() || g.R || 20 >= g.size * h || (d = Math.max(g.size, d), a = Math.min(g.x, a), b = Math.min(g.y, b), c = Math.max(g.x, c), l = Math.max(g.y, l)) } X = rb.ka({ ca: a - 10, da: b - 10, oa: c + 10, pa: l + 10, ma: 2, na: 4 }); for (p = 0; p < v.length; p++) if (g = v[p], g.N() && !(20 >= g.size * h)) for (a = 0; a < g.a.length; ++a) b = g.a[a].x, c = g.a[a].y, b < s - m / 2 / h || c < t - r / 2 / h || b > s + m / 2 / h || c > t + r / 2 / h || X.m(g.a[a]) } } function Aa() { //UPDATE if (toggle || window.botList[botIndex].name == "Human") { setPoint(((fa - m / 2) / h + s), ((ga - r / 2) / h + t)); } } function Pa() { null == ka && (ka = {}, e("#region").children().each(function() { var a = e(this), b = a.val(); b && (ka[b] = a.text()) })); e.get("https://m.agar.io/info", function(a) { var b = {}, c; for (c in a.regions) { var l = c.split(":")[0]; b[l] = b[l] || 0; b[l] += a.regions[c].numPlayers } for (c in b) e('#region option[value="' + c + '"]').text(ka[c] + " (" + b[c] + " players)") }, "json") } function Xa() { e("#adsBottom").hide(); e("#overlays").hide(); W = !1; Va(); d.googletag && d.googletag.pubads && d.googletag.pubads().clear(d.aa) } function ha(a) { a && a != y && (e("#region").val() != a && e("#region").val(a), y = d.localStorage.location = a, e(".region-message").hide(), e(".region-message." + a).show(), e(".btn-needs-server").prop("disabled", !1), ya && I()) } function Sa(a) { W || (K = null, sb(), a && (x = 1), W = !0, e("#overlays").fadeIn(a ? 200 : 3E3)) } function Y(a) { e("#helloContainer").attr("data-gamemode", a); P = a; e("#gamemode").val(a) } function Va() { e("#region").val() ? d.localStorage.location = e("#region").val() : d.localStorage.location && e("#region").val(d.localStorage.location); e("#region").val() ? e("#locationKnown").append(e("#region")) : e("#locationUnknown").append(e("#region")) } function sb() { la && (la = !1, setTimeout(function() { la = !0 //UPDATE }, 6E4 * Ya)) } function Z(a) { return d.i18n[a] || d.i18n_dict.en[a] || a } function Za() { var a = ++Ba; console.log("Find " + y + P); e.ajax("https://m.agar.io/findServer", { error: function() { setTimeout(Za, 1E3) }, success: function(b) { a == Ba && (b.alert && alert(b.alert), Ca("ws://" + b.ip, b.token)) }, dataType: "json", method: "POST", cache: !1, crossDomain: !0, data: (y + P || "?") + "\n154669603" }) } function I() { ya && y && (e("#connecting").show(), Za()) } function Ca(a, b) { if (q) { q.onopen = null; q.onmessage = null; q.onclose = null; try { q.close() } catch (c) {} q = null } Da.la && (a = "ws://" + Da.la); if (null != L) { var l = L; L = function() { l(b) } } if (tb) { var d = a.split(":"); a = d[0] + "s://ip-" + d[1].replace(/\./g, "-").replace(/\//g, "") + ".tech.agar.io:" + (+d[2] + 2E3) } M = []; k = []; E = {}; v = []; Q = []; F = []; z = A = null; R = 0; $ = !1; console.log("Connecting to " + a); //UPDATE serverIP = a; q = new WebSocket(a); q.binaryType = "arraybuffer"; q.onopen = function() { var a; console.log("socket open"); a = N(5); a.setUint8(0, 254); a.setUint32(1, 5, !0); O(a); a = N(5); a.setUint8(0, 255); a.setUint32(1, 154669603, !0); O(a); a = N(1 + b.length); a.setUint8(0, 80); for (var c = 0; c < b.length; ++c) a.setUint8(c + 1, b.charCodeAt(c)); O(a); $a() }; q.onmessage = ub; q.onclose = vb; q.onerror = function() { console.log("socket error") } } function N(a) { return new DataView(new ArrayBuffer(a)) } function O(a) { q.send(a.buffer) } function vb() { $ && (ma = 500); console.log("socket close"); setTimeout(I, ma); ma *= 2 } function ub(a) { wb(new DataView(a.data)) } function wb(a) { function b() { for (var b = "";;) { var d = a.getUint16(c, !0); c += 2; if (0 == d) break; b += String.fromCharCode(d) } return b } var c = 0; 240 == a.getUint8(c) && (c += 5); switch (a.getUint8(c++)) { case 16: xb(a, c); break; case 17: aa = a.getFloat32(c, !0); c += 4; ba = a.getFloat32(c, !0); c += 4; ca = a.getFloat32(c, !0); c += 4; break; case 20: k = []; M = []; break; case 21: Ea = a.getInt16(c, !0); c += 2; Fa = a.getInt16(c, !0); c += 2; Ga || (Ga = !0, na = Ea, oa = Fa); break; case 32: M.push(a.getUint32(c, !0)); c += 4; break; case 49: if (null != A) break; var l = a.getUint32(c, !0), c = c + 4; F = []; for (var d = 0; d < l; ++d) { var p = a.getUint32(c, !0), c = c + 4; F.push({ id: p, name: b() }) } ab(); break; case 50: A = []; l = a.getUint32(c, !0); c += 4; for (d = 0; d < l; ++d) A.push(a.getFloat32(c, !0)), c += 4; ab(); break; case 64: pa = a.getFloat64(c, !0); c += 8; qa = a.getFloat64(c, !0); c += 8; ra = a.getFloat64(c, !0); c += 8; sa = a.getFloat64(c, !0); c += 8; aa = (ra + pa) / 2; ba = (sa + qa) / 2; ca = 1; 0 == k.length && (s = aa, t = ba, h = ca); break; case 81: var g = a.getUint32(c, !0), c = c + 4, e = a.getUint32(c, !0), c = c + 4, f = a.getUint32(c, !0), c = c + 4; setTimeout(function() { S({ e: g, f: e, d: f }) }, 1200) } } function xb(a, b) { bb = C = Date.now(); $ || ($ = !0, e("#connecting").hide(), cb(), L && (L(), L = null)); var c = Math.random(); Ha = !1; var d = a.getUint16(b, !0); b += 2; for (var u = 0; u < d; ++u) { var p = E[a.getUint32(b, !0)], g = E[a.getUint32(b + 4, !0)]; b += 8; p && g && (g.X(), g.s = g.x, g.t = g.y, g.r = g.size, g.J = p.x, g.K = p.y, g.q = g.size, g.Q = C) } for (u = 0;;) { d = a.getUint32(b, !0); b += 4; if (0 == d) break; ++u; var f, p = a.getInt16(b, !0); b += 4; g = a.getInt16(b, !0); b += 4; f = a.getInt16(b, !0); b += 2; for (var h = a.getUint8(b++), w = a.getUint8(b++), m = a.getUint8(b++), h = (h << 16 | w << 8 | m).toString(16); 6 > h.length;) h = "0" + h; var h = "#" + h, w = a.getUint8(b++), m = !!(w & 1), r = !!(w & 16); w & 2 && (b += 4); w & 4 && (b += 8); w & 8 && (b += 16); for (var q, n = "";;) { q = a.getUint16(b, !0); b += 2; if (0 == q) break; n += String.fromCharCode(q) } q = n; n = null; E.hasOwnProperty(d) ? (n = E[d], n.P(), n.s = n.x, n.t = n.y, n.r = n.size, n.color = h) : (n = new da(d, p, g, f, h, q), v.push(n), E[d] = n, n.ua = p, n.va = g); n.h = m; n.n = r; n.J = p; n.K = g; n.q = f; n.sa = c; n.Q = C; n.ba = w; q && n.B(q); - 1 != M.indexOf(d) && -1 == k.indexOf(n) && (document.getElementById("overlays").style.display = "none", k.push(n), n.birth = getLastUpdate(), n.birthMass = (n.size * n.size / 100), 1 == k.length && (s = n.x, t = n.y, db())) //UPDATE interNodes[d] = window.getCells()[d]; } //UPDATE Object.keys(interNodes).forEach(function(element, index) { //console.log("start: " + interNodes[element].updateTime + " current: " + D + " life: " + (D - interNodes[element].updateTime)); var isRemoved = !window.getCells().hasOwnProperty(element); //console.log("Time not updated: " + (window.getLastUpdate() - interNodes[element].getUptimeTime())); if (isRemoved && (window.getLastUpdate() - interNodes[element].getUptimeTime()) > 3000) { delete interNodes[element]; } else { for (var i = 0; i < getPlayer().length; i++) { if (isRemoved && computeDistance(getPlayer()[i].x, getPlayer()[i].y, interNodes[element].x, interNodes[element].y) < getPlayer()[i].size + 710) { delete interNodes[element]; break; } } } }); c = a.getUint32(b, !0); b += 4; for (u = 0; u < c; u++) d = a.getUint32(b, !0), b += 4, n = E[d], null != n && n.X(); //UPDATE //Ha && 0 == k.length && Sa(!1) } //UPDATE function computeDistance(x1, y1, x2, y2) { var xdis = x1 - x2; // <--- FAKE AmS OF COURSE! var ydis = y1 - y2; var distance = Math.sqrt(xdis * xdis + ydis * ydis); return distance; } /** * Some horse shit of some sort. * @return Horse Shit */ function screenDistance() { return Math.min(computeDistance(getOffsetX(), getOffsetY(), screenToGameX(getWidth()), getOffsetY()), computeDistance(getOffsetX(), getOffsetY(), getOffsetX(), screenToGameY(getHeight()))); } window.verticalDistance = function() { return computeDistance(screenToGameX(0), screenToGameY(0), screenToGameX(getWidth()), screenToGameY(getHeight())); } /** * A conversion from the screen's horizontal coordinate system * to the game's horizontal coordinate system. * @param x in the screen's coordinate system * @return x in the game's coordinate system */ window.screenToGameX = function(x) { return (x - getWidth() / 2) / getRatio() + getX(); } /** * A conversion from the screen's vertical coordinate system * to the game's vertical coordinate system. * @param y in the screen's coordinate system * @return y in the game's coordinate system */ window.screenToGameY = function(y) { return (y - getHeight() / 2) / getRatio() + getY(); } window.drawPoint = function(x_1, y_1, drawColor, text) { if (!toggleDraw) { dPoints.push([x_1, y_1, drawColor]); dText.push(text); } } window.drawArc = function(x_1, y_1, x_2, y_2, x_3, y_3, drawColor) { if (!toggleDraw) { var radius = computeDistance(x_1, y_1, x_3, y_3); dArc.push([x_1, y_1, x_2, y_2, x_3, y_3, radius, drawColor]); } } window.drawLine = function(x_1, y_1, x_2, y_2, drawColor) { if (!toggleDraw) { lines.push([x_1, y_1, x_2, y_2, drawColor]); } } window.drawCircle = function(x_1, y_1, radius, drawColor) { if (!toggleDraw) { circles.push([x_1, y_1, radius, drawColor]); } } function V() { //UPDATE if (getPlayer().length == 0 && !reviving && ~~(getCurrentScore() / 100) > 0) { console.log("Dead: " + ~~(getCurrentScore() / 100)); apos('send', 'pageview'); } if (getPlayer().length == 0) { console.log("Revive"); setNick(originalName); reviving = true; } else if (getPlayer().length > 0 && reviving) { reviving = false; console.log("Done Reviving!"); } if (T()) { var a = fa - m / 2; var b = ga - r / 2; 64 > a * a + b * b || .01 > Math.abs(eb - ia) && .01 > Math.abs(fb - ja) || (eb = ia, fb = ja, a = N(13), a.setUint8(0, 16), a.setInt32(1, ia, !0), a.setInt32(5, ja, !0), a.setUint32(9, 0, !0), O(a)) } } function cb() { if (T() && $ && null != K) { var a = N(1 + 2 * K.length); a.setUint8(0, 0); for (var b = 0; b < K.length; ++b) a.setUint16(1 + 2 * b, K.charCodeAt(b), !0); O(a) } } function T() { return null != q && q.readyState == q.OPEN } window.opCode = function(a) { console.log("Sending op code."); H(parseInt(a)); } function H(a) { if (T()) { var b = N(1); b.setUint8(0, a); O(b) } } function $a() { if (T() && null != B) { var a = N(1 + B.length); a.setUint8(0, 81); for (var b = 0; b < B.length; ++b) a.setUint8(b + 1, B.charCodeAt(b)); O(a) } } function Ta() { m = d.innerWidth; r = d.innerHeight; za.width = G.width = m; za.height = G.height = r; var a = e("#helloContainer"); a.css("transform", "none"); var b = a.height(), c = d.innerHeight; b > c / 1.1 ? a.css("transform", "translate(-50%, -50%) scale(" + c / b / 1.1 + ")") : a.css("transform", "translate(-50%, -50%)"); gb() } function hb() { var a; a = Math.max(r / 1080, m / 1920); return a *= J } function yb() { if (0 != k.length) { for (var a = 0, b = 0; b < k.length; b++) a += k[b].size; a = Math.pow(Math.min(64 / a, 1), .4) * hb(); h = (9 * h + a) / 10 } } function gb() { //UPDATE dPoints = []; circles = []; dArc = []; dText = []; lines = []; var a, b = Date.now(); ++zb; C = b; if (0 < k.length) { yb(); for (var c = a = 0, d = 0; d < k.length; d++) k[d].P(), a += k[d].x / k.length, c += k[d].y / k.length; aa = a; ba = c; ca = h; s = (s + a) / 2; t = (t + c) / 2; } else s = (29 * s + aa) / 30, t = (29 * t + ba) / 30, h = (9 * h + ca * hb()) / 10; qb(); Aa(); Ia || f.clearRect(0, 0, m, r); Ia ? (f.fillStyle = ta ? "#111111" : "#F2FBFF", f.globalAlpha = .05, f.fillRect(0, 0, m, r), f.globalAlpha = 1) : Ab(); v.sort(function(a, b) { return a.size == b.size ? a.id - b.id : a.size - b.size }); f.save(); f.translate(m / 2, r / 2); f.scale(h, h); f.translate(-s, -t); //UPDATE f.save(); f.beginPath(); f.lineWidth = 5; f.strokeStyle = (getDarkBool() ? '#F2FBFF' : '#111111'); f.moveTo(getMapStartX(), getMapStartY()); f.lineTo(getMapStartX(), getMapEndY()); f.stroke(); f.moveTo(getMapStartX(), getMapStartY()); f.lineTo(getMapEndX(), getMapStartY()); f.stroke(); f.moveTo(getMapEndX(), getMapStartY()); f.lineTo(getMapEndX(), getMapEndY()); f.stroke(); f.moveTo(getMapStartX(), getMapEndY()); f.lineTo(getMapEndX(), getMapEndY()); f.stroke(); f.restore(); for (d = 0; d < v.length; d++) v[d].w(f); for (d = 0; d < Q.length; d++) Q[d].w(f); //UPDATE if (getPlayer().length > 0) { var moveLoc = window.botList[botIndex].mainLoop(); if (!toggle) { setPoint(moveLoc[0], moveLoc[1]); } } customRender(f); if (Ga) { na = (3 * na + Ea) / 4; oa = (3 * oa + Fa) / 4; f.save(); f.strokeStyle = "#FFAAAA"; f.lineWidth = 10; f.lineCap = "round"; f.lineJoin = "round"; f.globalAlpha = .5; f.beginPath(); for (d = 0; d < k.length; d++) f.moveTo(k[d].x, k[d].y), f.lineTo(na, oa); f.stroke(); f.restore(); } f.restore(); z && z.width && f.drawImage(z, m - z.width - 10, 10); R = Math.max(R, Bb()); //UPDATE var currentDate = new Date(); var nbSeconds = 0; if (getPlayer().length > 0) { //nbSeconds = currentDate.getSeconds() + currentDate.getMinutes() * 60 + currentDate.getHours() * 3600 - lifeTimer.getSeconds() - lifeTimer.getMinutes() * 60 - lifeTimer.getHours() * 3600; nbSeconds = (currentDate.getTime() - lifeTimer.getTime()) / 1000; } bestTime = Math.max(nbSeconds, bestTime); var displayText = 'Score: ' + ~~(R / 100) + " Current Time: " + nbSeconds + " seconds."; 0 != R && (null == ua && (ua = new va(24, "#FFFFFF")), ua.C(displayText), c = ua.L(), a = c.width, f.globalAlpha = .2, f.fillStyle = "#000000", f.fillRect(10, r - 10 - 24 - 10, a + 10, 34), f.globalAlpha = 1, f.drawImage(c, 15, r - 10 - 24 - 5)); Cb(); b = Date.now() - b; b > 1E3 / 60 ? D -= .01 : b < 1E3 / 65 && (D += .01);.4 > D && (D = .4); 1 < D && (D = 1); b = C - ib; !T() || W ? (x += b / 2E3, 1 < x && (x = 1)) : (x -= b / 300, 0 > x && (x = 0)); 0 < x && (f.fillStyle = "#000000", f.globalAlpha = .5 * x, f.fillRect(0, 0, m, r), f.globalAlpha = 1); ib = C drawStats(f); } //UPDATE function customRender(d) { d.save(); for (var i = 0; i < lines.length; i++) { d.beginPath(); d.lineWidth = 5; if (lines[i][4] == 0) { d.strokeStyle = "#FF0000"; } else if (lines[i][4] == 1) { d.strokeStyle = "#00FF00"; } else if (lines[i][4] == 2) { d.strokeStyle = "#0000FF"; } else if (lines[i][4] == 3) { d.strokeStyle = "#FF8000"; } else if (lines[i][4] == 4) { d.strokeStyle = "#8A2BE2"; } else if (lines[i][4] == 5) { d.strokeStyle = "#FF69B4"; } else if (lines[i][4] == 6) { d.strokeStyle = "#008080"; } else if (lines[i][4] == 7) { d.strokeStyle = (getDarkBool() ? '#F2FBFF' : '#111111'); } else { d.strokeStyle = "#000000"; } d.moveTo(lines[i][0], lines[i][1]); d.lineTo(lines[i][2], lines[i][3]); d.stroke(); } d.restore(); d.save(); for (var i = 0; i < circles.length; i++) { if (circles[i][3] == 0) { d.strokeStyle = "#FF0000"; } else if (circles[i][3] == 1) { d.strokeStyle = "#00FF00"; } else if (circles[i][3] == 2) { d.strokeStyle = "#0000FF"; } else if (circles[i][3] == 3) { d.strokeStyle = "#FF8000"; } else if (circles[i][3] == 4) { d.strokeStyle = "#8A2BE2"; } else if (circles[i][3] == 5) { d.strokeStyle = "#FF69B4"; } else if (circles[i][3] == 6) { d.strokeStyle = "#008080"; } else if (circles[i][3] == 7) { d.strokeStyle = (getDarkBool() ? '#F2FBFF' : '#111111'); } else { d.strokeStyle = "#000000"; } d.beginPath(); d.lineWidth = 10; //d.setLineDash([5]); d.globalAlpha = 0.3; d.arc(circles[i][0], circles[i][1], circles[i][2], 0, 2 * Math.PI, false); d.stroke(); } d.restore(); d.save(); for (var i = 0; i < dArc.length; i++) { if (dArc[i][7] == 0) { d.strokeStyle = "#FF0000"; } else if (dArc[i][7] == 1) { d.strokeStyle = "#00FF00"; } else if (dArc[i][7] == 2) { d.strokeStyle = "#0000FF"; } else if (dArc[i][7] == 3) { d.strokeStyle = "#FF8000"; } else if (dArc[i][7] == 4) { d.strokeStyle = "#8A2BE2"; } else if (dArc[i][7] == 5) { d.strokeStyle = "#FF69B4"; } else if (dArc[i][7] == 6) { d.strokeStyle = "#008080"; } else if (dArc[i][7] == 7) { d.strokeStyle = (getDarkBool() ? '#F2FBFF' : '#111111'); } else { d.strokeStyle = "#000000"; } d.beginPath(); d.lineWidth = 5; var ang1 = Math.atan2(dArc[i][1] - dArc[i][5], dArc[i][0] - dArc[i][4]); var ang2 = Math.atan2(dArc[i][3] - dArc[i][5], dArc[i][2] - dArc[i][4]); d.arc(dArc[i][4], dArc[i][5], dArc[i][6], ang1, ang2, false); d.stroke(); } d.restore(); d.save(); for (var i = 0; i < dPoints.length; i++) { if (dText[i] == "") { var radius = 10; d.beginPath(); d.arc(dPoints[i][0], dPoints[i][1], radius, 0, 2 * Math.PI, false); if (dPoints[i][2] == 0) { d.fillStyle = "black"; } else if (dPoints[i][2] == 1) { d.fillStyle = "yellow"; } else if (dPoints[i][2] == 2) { d.fillStyle = "blue"; } else if (dPoints[i][2] == 3) { d.fillStyle = "red"; } else if (dPoints[i][2] == 4) { d.fillStyle = "#008080"; } else if (dPoints[i][2] == 5) { d.fillStyle = "#FF69B4"; } else { d.fillStyle = "#000000"; } d.fill(); d.lineWidth = 2; d.strokeStyle = '#003300'; d.stroke(); } else { var text = new va(18, (getDarkBool() ? '#F2FBFF' : '#111111'), true, (getDarkBool() ? '#111111' : '#F2FBFF')); text.C(dText[i]); var textRender = text.L(); d.drawImage(textRender, dPoints[i][0] - (textRender.width / 2), dPoints[i][1] - (textRender.height / 2)); } } d.restore(); } function drawStats(d) { d.save() sessionScore = Math.max(getCurrentScore(), sessionScore); var botString = window.botList[botIndex].displayText(); var debugStrings = []; debugStrings.push("Bot: " + window.botList[botIndex].name); debugStrings.push("Launcher: AposLauncher " + aposLauncherVersion); debugStrings.push("T - Bot: " + (!toggle ? "On" : "Off")); debugStrings.push("R - Lines: " + (!toggleDraw ? "On" : "Off")); for (var i = 0; i < botString.length; i++) { debugStrings.push(botString[i]); } debugStrings.push(""); debugStrings.push("Best Score: " + ~~(sessionScore / 100)); debugStrings.push("Best Time: " + bestTime + " seconds"); debugStrings.push(""); debugStrings.push(serverIP); if (getPlayer().length > 0) { var offsetX = -getMapStartX(); var offsetY = -getMapStartY(); debugStrings.push("Location: " + Math.floor(getPlayer()[0].x + offsetX) + ", " + Math.floor(getPlayer()[0].y + offsetY)); } var offsetValue = 20; var text = new va(18, (getDarkBool() ? '#F2FBFF' : '#111111')); for (var i = 0; i < debugStrings.length; i++) { text.C(debugStrings[i]); var textRender = text.L(); d.drawImage(textRender, 20, offsetValue); offsetValue += textRender.height; } if (message.length > 0) { var mRender = []; var mWidth = 0; var mHeight = 0; for (var i = 0; i < message.length; i++) { var mText = new va(28, '#FF0000', true, '#000000'); mText.C(message[i]); mRender.push(mText.L()); if (mRender[i].width > mWidth) { mWidth = mRender[i].width; } mHeight += mRender[i].height; } var mX = getWidth() / 2 - mWidth / 2; var mY = 20; d.globalAlpha = 0.4; d.fillStyle = '#000000'; d.fillRect(mX - 10, mY - 10, mWidth + 20, mHeight + 20); d.globalAlpha = 1; var mOffset = mY; for (var i = 0; i < mRender.length; i++) { d.drawImage(mRender[i], getWidth() / 2 - mRender[i].width / 2, mOffset); mOffset += mRender[i].height; } } d.restore(); } function Ab() { f.fillStyle = ta ? "#111111" : "#F2FBFF"; f.fillRect(0, 0, m, r); f.save(); f.strokeStyle = ta ? "#AAAAAA" : "#000000"; f.globalAlpha = .2 * h; for (var a = m / h, b = r / h, c = (a / 2 - s) % 50; c < a; c += 50) f.beginPath(), f.moveTo(c * h - .5, 0), f.lineTo(c * h - .5, b * h), f.stroke(); for (c = (b / 2 - t) % 50; c < b; c += 50) f.beginPath(), f.moveTo(0, c * h - .5), f.lineTo(a * h, c * h - .5), f.stroke(); f.restore() } function Cb() { if (Qa && Ja.width) { var a = m / 5; f.drawImage(Ja, 5, 5, a, a) } } function Bb() { for (var a = 0, b = 0; b < k.length; b++) a += k[b].q * k[b].q; return a } function ab() { z = null; if (null != A || 0 != F.length) if (null != A || wa) { z = document.createElement("canvas"); var a = z.getContext("2d"), b = 60, b = null == A ? b + 24 * F.length : b + 180, c = Math.min(200, .3 * m) / 200; z.width = 200 * c; z.height = b * c; a.scale(c, c); a.globalAlpha = .4; a.fillStyle = "#000000"; a.fillRect(0, 0, 200, b); a.globalAlpha = 1; a.fillStyle = "#FFFFFF"; c = null; c = Z("leaderboard"); a.font = "30px Ubuntu"; a.fillText(c, 100 - a.measureText(c).width / 2, 40); if (null == A) for (a.font = "20px Ubuntu", b = 0; b < F.length; ++b) c = F[b].name || Z("unnamed_cell"), wa || (c = Z("unnamed_cell")), -1 != M.indexOf(F[b].id) ? (k[0].name && (c = k[0].name), a.fillStyle = "#FFAAAA") : a.fillStyle = "#FFFFFF", c = b + 1 + ". " + c, a.fillText(c, 100 - a.measureText(c).width / 2, 70 + 24 * b); else for (b = c = 0; b < A.length; ++b) { var d = c + A[b] * Math.PI * 2; a.fillStyle = Db[b + 1]; a.beginPath(); a.moveTo(100, 140); a.arc(100, 140, 80, c, d, !1); a.fill(); c = d } } } function Ka(a, b, c, d, e) { this.V = a; this.x = b; this.y = c; this.i = d; this.b = e } function da(a, b, c, d, e, p) { this.id = a; this.s = this.x = b; this.t = this.y = c; this.r = this.size = d; this.color = e; this.a = []; this.W(); this.B(p) } function va(a, b, c, d) { a && (this.u = a); b && (this.S = b); this.U = !!c; d && (this.v = d) } function S(a, b) { var c = "1" == e("#helloContainer").attr("data-has-account-data"); e("#helloContainer").attr("data-has-account-data", "1"); if (null == b && d.localStorage.loginCache) { var l = JSON.parse(d.localStorage.loginCache); l.f = a.f; l.d = a.d; l.e = a.e; d.localStorage.loginCache = JSON.stringify(l) } if (c) { var u = +e(".agario-exp-bar .progress-bar-text").first().text().split("/")[0], c = +e(".agario-exp-bar .progress-bar-text").first().text().split("/")[1].split(" ")[0], l = e(".agario-profile-panel .progress-bar-star").first().text(); if (l != a.e) S({ f: c, d: c, e: l }, function() { e(".agario-profile-panel .progress-bar-star").text(a.e); e(".agario-exp-bar .progress-bar").css("width", "100%"); e(".progress-bar-star").addClass("animated tada").one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function() { e(".progress-bar-star").removeClass("animated tada") }); setTimeout(function() { e(".agario-exp-bar .progress-bar-text").text(a.d + "/" + a.d + " XP"); S({ f: 0, d: a.d, e: a.e }, function() { S(a, b) }) }, 1E3) }); else { var p = Date.now(), g = function() { var c; c = (Date.now() - p) / 1E3; c = 0 > c ? 0 : 1 < c ? 1 : c; c = c * c * (3 - 2 * c); e(".agario-exp-bar .progress-bar-text").text(~~(u + (a.f - u) * c) + "/" + a.d + " XP"); e(".agario-exp-bar .progress-bar").css("width", (88 * (u + (a.f - u) * c) / a.d).toFixed(2) + "%"); 1 > c ? d.requestAnimationFrame(g) : b && b() }; d.requestAnimationFrame(g) } } else e(".agario-profile-panel .progress-bar-star").text(a.e), e(".agario-exp-bar .progress-bar-text").text(a.f + "/" + a.d + " XP"), e(".agario-exp-bar .progress-bar").css("width", (88 * a.f / a.d).toFixed(2) + "%"), b && b() } function jb(a) { "string" == typeof a && (a = JSON.parse(a)); Date.now() + 18E5 > a.ja ? e("#helloContainer").attr("data-logged-in", "0") : (d.localStorage.loginCache = JSON.stringify(a), B = a.fa, e(".agario-profile-name").text(a.name), $a(), S({ f: a.f, d: a.d, e: a.e }), e("#helloContainer").attr("data-logged-in", "1")) } function Eb(a) { a = a.split("\n"); jb({ name: a[0], ta: a[1], fa: a[2], ja: 1E3 * +a[3], e: +a[4], f: +a[5], d: +a[6] }); console.log("Hello Facebook?"); } function La(a) { if ("connected" == a.status) { var b = a.authResponse.accessToken; d.FB.api("/me/picture?width=180&height=180", function(a) { d.localStorage.fbPictureCache = a.data.url; e(".agario-profile-picture").attr("src", a.data.url) }); e("#helloContainer").attr("data-logged-in", "1"); null != B ? e.ajax("https://m.agar.io/checkToken", { error: function() { console.log("Facebook Fail!"); B = null; La(a) }, success: function(a) { a = a.split("\n"); S({ e: +a[0], f: +a[1], d: +a[2] }); console.log("Facebook connected!"); }, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: B }) : e.ajax("https://m.agar.io/facebookLogin", { error: function() { console.log("You have a Facebook problem!"); B = null; e("#helloContainer").attr("data-logged-in", "0") }, success: Eb, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: b }) } } function Wa(a) { Y(":party"); e("#helloContainer").attr("data-party-state", "4"); a = decodeURIComponent(a).replace(/.*#/gim, ""); Ma("#" + d.encodeURIComponent(a)); e.ajax(Na + "//m.agar.io/getToken", { error: function() { e("#helloContainer").attr("data-party-state", "6") }, success: function(b) { b = b.split("\n"); e(".partyToken").val("agar.io/#" + d.encodeURIComponent(a)); e("#helloContainer").attr("data-party-state", "5"); Y(":party"); Ca("ws://" + b[0], a) }, dataType: "text", method: "POST", cache: !1, crossDomain: !0, data: a }) } function Ma(a) { d.history && d.history.replaceState && d.history.replaceState({}, d.document.title, a) } if (!d.agarioNoInit) { var Na = d.location.protocol, tb = "https:" == Na, xa = d.navigator.userAgent; if (-1 != xa.indexOf("Android")) d.ga && d.ga("send", "event", "MobileRedirect", "PlayStore"), setTimeout(function() { d.location.href = "market://details?id=com.miniclip.agar.io" }, 1E3); else if (-1 != xa.indexOf("iPhone") || -1 != xa.indexOf("iPad") || -1 != xa.indexOf("iPod")) d.ga && d.ga("send", "event", "MobileRedirect", "AppStore"), setTimeout(function() { d.location.href = "https://itunes.apple.com/app/agar.io/id995999703" }, 1E3); else { var za, f, G, m, r, X = null, //UPDATE toggle = false, toggleDraw = false, tempPoint = [0, 0, 1], dPoints = [], circles = [], dArc = [], dText = [], lines = [], names = ["NotReallyABot"], originalName = names[Math.floor(Math.random() * names.length)], sessionScore = 0, serverIP = "", interNodes = [], lifeTimer = new Date(), bestTime = 0, botIndex = 0, reviving = false, message = [], q = null, s = 0, t = 0, M = [], k = [], E = {}, v = [], Q = [], F = [], fa = 0, ga = 0, //UPDATE ia = -1, ja = -1, zb = 0, C = 0, ib = 0, K = null, pa = 0, qa = 0, ra = 1E4, sa = 1E4, h = 1, y = null, kb = !0, wa = !0, Oa = !1, Ha = !1, R = 0, ta = !1, lb = !1, aa = s = ~~((pa + ra) / 2), ba = t = ~~((qa + sa) / 2), ca = 1, P = "", A = null, ya = !1, Ga = !1, Ea = 0, Fa = 0, na = 0, oa = 0, mb = 0, Db = ["#333333", "#FF3333", "#33FF33", "#3333FF"], Ia = !1, $ = !1, bb = 0, B = null, J = 1, x = 1, W = !0, Ba = 0, Da = {}; (function() { var a = d.location.search; "?" == a.charAt(0) && (a = a.slice(1)); for (var a = a.split("&"), b = 0; b < a.length; b++) { var c = a[b].split("="); Da[c[0]] = c[1] } })(); var Qa = "ontouchstart" in d && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(d.navigator.userAgent), Ja = new Image; Ja.src = "img/split.png"; var nb = document.createElement("canvas"); if ("undefined" == typeof console || "undefined" == typeof DataView || "undefined" == typeof WebSocket || null == nb || null == nb.getContext || null == d.localStorage) alert("You browser does not support this game, we recommend you to use Firefox to play this"); else { var ka = null; d.setNick = function(a) { //UPDATE originalName = a; if (getPlayer().length == 0) { lifeTimer = new Date(); } Xa(); K = a; cb(); R = 0 }; d.setRegion = ha; d.setSkins = function(a) { kb = a }; d.setNames = function(a) { wa = a }; d.setDarkTheme = function(a) { ta = a }; d.setColors = function(a) { Oa = a }; d.setShowMass = function(a) { lb = a }; d.spectate = function() { K = null; H(1); Xa() }; d.setGameMode = function(a) { a != P && (":party" == P && e("#helloContainer").attr("data-party-state", "0"), Y(a), ":party" != a && I()) }; d.setAcid = function(a) { Ia = a }; null != d.localStorage && (null == d.localStorage.AB9 && (d.localStorage.AB9 = 0 + ~~(100 * Math.random())), mb = +d.localStorage.AB9, d.ABGroup = mb); e.get(Na + "//gc.agar.io", function(a) { var b = a.split(" "); a = b[0]; b = b[1] || ""; - 1 == ["UA"].indexOf(a) && ob.push("ussr"); ea.hasOwnProperty(a) && ("string" == typeof ea[a] ? y || ha(ea[a]) : ea[a].hasOwnProperty(b) && (y || ha(ea[a][b]))) }, "text"); d.ga && d.ga("send", "event", "User-Agent", d.navigator.userAgent, { nonInteraction: 1 }); var la = !1, Ya = 0; setTimeout(function() { la = !0 }, Math.max(6E4 * Ya, 1E4)); var ea = { AF: "JP-Tokyo", AX: "EU-London", AL: "EU-London", DZ: "EU-London", AS: "SG-Singapore", AD: "EU-London", AO: "EU-London", AI: "US-Atlanta", AG: "US-Atlanta", AR: "BR-Brazil", AM: "JP-Tokyo", AW: "US-Atlanta", AU: "SG-Singapore", AT: "EU-London", AZ: "JP-Tokyo", BS: "US-Atlanta", BH: "JP-Tokyo", BD: "JP-Tokyo", BB: "US-Atlanta", BY: "EU-London", BE: "EU-London", BZ: "US-Atlanta", BJ: "EU-London", BM: "US-Atlanta", BT: "JP-Tokyo", BO: "BR-Brazil", BQ: "US-Atlanta", BA: "EU-London", BW: "EU-London", BR: "BR-Brazil", IO: "JP-Tokyo", VG: "US-Atlanta", BN: "JP-Tokyo", BG: "EU-London", BF: "EU-London", BI: "EU-London", KH: "JP-Tokyo", CM: "EU-London", CA: "US-Atlanta", CV: "EU-London", KY: "US-Atlanta", CF: "EU-London", TD: "EU-London", CL: "BR-Brazil", CN: "CN-China", CX: "JP-Tokyo", CC: "JP-Tokyo", CO: "BR-Brazil", KM: "EU-London", CD: "EU-London", CG: "EU-London", CK: "SG-Singapore", CR: "US-Atlanta", CI: "EU-London", HR: "EU-London", CU: "US-Atlanta", CW: "US-Atlanta", CY: "JP-Tokyo", CZ: "EU-London", DK: "EU-London", DJ: "EU-London", DM: "US-Atlanta", DO: "US-Atlanta", EC: "BR-Brazil", EG: "EU-London", SV: "US-Atlanta", GQ: "EU-London", ER: "EU-London", EE: "EU-London", ET: "EU-London", FO: "EU-London", FK: "BR-Brazil", FJ: "SG-Singapore", FI: "EU-London", FR: "EU-London", GF: "BR-Brazil", PF: "SG-Singapore", GA: "EU-London", GM: "EU-London", GE: "JP-Tokyo", DE: "EU-London", GH: "EU-London", GI: "EU-London", GR: "EU-London", GL: "US-Atlanta", GD: "US-Atlanta", GP: "US-Atlanta", GU: "SG-Singapore", GT: "US-Atlanta", GG: "EU-London", GN: "EU-London", GW: "EU-London", GY: "BR-Brazil", HT: "US-Atlanta", VA: "EU-London", HN: "US-Atlanta", HK: "JP-Tokyo", HU: "EU-London", IS: "EU-London", IN: "JP-Tokyo", ID: "JP-Tokyo", IR: "JP-Tokyo", IQ: "JP-Tokyo", IE: "EU-London", IM: "EU-London", IL: "JP-Tokyo", IT: "EU-London", JM: "US-Atlanta", JP: "JP-Tokyo", JE: "EU-London", JO: "JP-Tokyo", KZ: "JP-Tokyo", KE: "EU-London", KI: "SG-Singapore", KP: "JP-Tokyo", KR: "JP-Tokyo", KW: "JP-Tokyo", KG: "JP-Tokyo", LA: "JP-Tokyo", LV: "EU-London", LB: "JP-Tokyo", LS: "EU-London", LR: "EU-London", LY: "EU-London", LI: "EU-London", LT: "EU-London", LU: "EU-London", MO: "JP-Tokyo", MK: "EU-London", MG: "EU-London", MW: "EU-London", MY: "JP-Tokyo", MV: "JP-Tokyo", ML: "EU-London", MT: "EU-London", MH: "SG-Singapore", MQ: "US-Atlanta", MR: "EU-London", MU: "EU-London", YT: "EU-London", MX: "US-Atlanta", FM: "SG-Singapore", MD: "EU-London", MC: "EU-London", MN: "JP-Tokyo", ME: "EU-London", MS: "US-Atlanta", MA: "EU-London", MZ: "EU-London", MM: "JP-Tokyo", NA: "EU-London", NR: "SG-Singapore", NP: "JP-Tokyo", NL: "EU-London", NC: "SG-Singapore", NZ: "SG-Singapore", NI: "US-Atlanta", NE: "EU-London", NG: "EU-London", NU: "SG-Singapore", NF: "SG-Singapore", MP: "SG-Singapore", NO: "EU-London", OM: "JP-Tokyo", PK: "JP-Tokyo", PW: "SG-Singapore", PS: "JP-Tokyo", PA: "US-Atlanta", PG: "SG-Singapore", PY: "BR-Brazil", PE: "BR-Brazil", PH: "JP-Tokyo", PN: "SG-Singapore", PL: "EU-London", PT: "EU-London", PR: "US-Atlanta", QA: "JP-Tokyo", RE: "EU-London", RO: "EU-London", RU: "RU-Russia", RW: "EU-London", BL: "US-Atlanta", SH: "EU-London", KN: "US-Atlanta", LC: "US-Atlanta", MF: "US-Atlanta", PM: "US-Atlanta", VC: "US-Atlanta", WS: "SG-Singapore", SM: "EU-London", ST: "EU-London", SA: "EU-London", SN: "EU-London", RS: "EU-London", SC: "EU-London", SL: "EU-London", SG: "JP-Tokyo", SX: "US-Atlanta", SK: "EU-London", SI: "EU-London", SB: "SG-Singapore", SO: "EU-London", ZA: "EU-London", SS: "EU-London", ES: "EU-London", LK: "JP-Tokyo", SD: "EU-London", SR: "BR-Brazil", SJ: "EU-London", SZ: "EU-London", SE: "EU-London", CH: "EU-London", SY: "EU-London", TW: "JP-Tokyo", TJ: "JP-Tokyo", TZ: "EU-London", TH: "JP-Tokyo", TL: "JP-Tokyo", TG: "EU-London", TK: "SG-Singapore", TO: "SG-Singapore", TT: "US-Atlanta", TN: "EU-London", TR: "TK-Turkey", TM: "JP-Tokyo", TC: "US-Atlanta", TV: "SG-Singapore", UG: "EU-London", UA: "EU-London", AE: "EU-London", GB: "EU-London", US: "US-Atlanta", UM: "SG-Singapore", VI: "US-Atlanta", UY: "BR-Brazil", UZ: "JP-Tokyo", VU: "SG-Singapore", VE: "BR-Brazil", VN: "JP-Tokyo", WF: "SG-Singapore", EH: "EU-London", YE: "JP-Tokyo", ZM: "EU-London", ZW: "EU-London" }, L = null; d.connect = Ca; //UPDATE /** * Tells you if the game is in Dark mode. * @return Boolean for dark mode. */ window.getDarkBool = function() { return ta; } /** * Tells you if the mass is shown. * @return Boolean for player's mass. */ window.getMassBool = function() { return lb; } /** * This is a copy of everything that is shown on screen. * Normally stuff will time out when off the screen, this * memorizes everything that leaves the screen for a little * while longer. * @return The memory object. */ window.getMemoryCells = function() { return interNodes; } /** * [getCellsArray description] * @return {[type]} [description] */ window.getCellsArray = function() { return v; } /** * [getCellsArray description] * @return {[type]} [description] */ window.getCells = function() { return E; } /** * Returns an array with all the player's cells. * @return Player's cells */ window.getPlayer = function() { return k; } /** * The canvas' width. * @return Integer Width */ window.getWidth = function() { return m; } /** * The canvas' height * @return Integer Height */ window.getHeight = function() { return r; } /** * Scaling ratio of the canvas. The bigger this ration, * the further that you see. * @return Screen scaling ratio. */ window.getRatio = function() { return h; } /** * [getOffsetX description] * @return {[type]} [description] */ window.getOffsetX = function() { return aa; } window.getOffsetY = function() { return ba; } window.getX = function() { return s; } window.getY = function() { return t; } window.getPointX = function() { return ia; } window.getPointY = function() { return ja; } /** * The X location of the mouse. * @return Integer X */ window.getMouseX = function() { return fa; } /** * The Y location of the mouse. * @return Integer Y */ window.getMouseY = function() { return ga; } window.getMapStartX = function() { return pa; } window.getMapStartY = function() { return qa; } window.getMapEndX = function() { return ra; } window.getMapEndY = function() { return sa; } window.getScreenDistance = function() { var temp = screenDistance(); return temp; } /** * A timestamp since the last time the server sent any data. * @return Last update timestamp */ window.getLastUpdate = function() { return C; } window.getCurrentScore = function() { return R; } /** * The game's current mode. (":ffa", ":experimental", ":teams". ":party") * @return {[type]} [description] */ window.getMode = function() { return P; } window.getServer = function() { return serverIP; } window.setPoint = function(x, y) { ia = x; ja = y; } window.setScore = function(a) { sessionScore = a * 100; } window.setBestTime = function(a) { bestTime = a; } window.best = function(a, b) { setScore(a); setBestTime(b); } window.setBotIndex = function(a) { console.log("Changing bot"); botIndex = a; } window.setMessage = function(a) { message = a; } window.updateBotList = function() { window.botList = window.botList || []; window.jQuery('#locationUnknown').text(""); window.jQuery('#locationUnknown').append(window.jQuery('<select id="bList" class="form-control" onchange="setBotIndex($(this).val());" />')); window.jQuery('#locationUnknown').addClass('form-group'); for (var i = 0; i < w
Rogerio111
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content="Eat cells smaller than you and don't get eaten by the bigger ones, as an MMO"> <meta name="keywords" content="agario, agar, io, cell, cells, virus, bacteria, blob, game, games, web game, html5, fun, flash"> <meta name="robots" content="index, follow"> <meta name="viewport" content="minimal-ui, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta property="fb:app_id" content="677505792353827"/> <meta property="og:title" content="Agar.io"/> <meta property="og:description" content="Eat cells smaller than you and don't get eaten by the bigger ones, as an MMO"/> <meta property="og:url" content="http://agar.io"/> <meta property="og:image" content="http://agar.io/img/1200x630.png"/> <meta property="og:image:width" content="1200"/> <meta property="og:image:height" content="630"/> <meta property="og:type" content="website"/> <title>Agar.io</title> <link id="favicon" rel="icon" type="image/png" href="favicon-32x32.png"/> <!-- Área de anuncio --> <link href='https://fonts.googleapis.com/css?family=Ubuntu:700' rel='stylesheet' type='text/css'> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/glyphicons-social.css" rel="stylesheet"> <link href="css/animate.css" rel="stylesheet"> <style>body{padding:0;margin:0;overflow:hidden;}#canvas{position:absolute;left:0;right:0;top:0;bottom:0;width:100%;height:100%;}form{margin-bottom:0px;}.btn-play,.btn-settings,.btn-spectate,.btn-play-guest,.btn-login,.btn-logout{display:block;float:left;height:35px;}.btn-spectate,.btn-logout{height:35px;display:block;width:110px;margin-left:10px;margin-bottom:5px;}#helloContainer[data-logged-in="0"] .btn-play-guest{margin-left:5px;width:125px;}#helloContainer[data-logged-in="0"] .btn-login{margin-left:5px;width:145px;}#helloContainer[data-logged-in="0"] .agario-exp-bar,#helloContainer[data-logged-in="0"] .progress-bar-star,#helloContainer[data-logged-in="0"] #agario-main-buttons .agario-profile,#helloContainer[data-logged-in="0"] .btn-play{display:none;}#helloContainer[data-logged-in="0"] .btn-logout{display:none;}#helloContainer[data-logged-in="1"] .btn-play{margin-left:5px;width:275px;}#helloContainer[data-logged-in="1"] .btn-play-guest{display:none;}#helloContainer[data-logged-in="1"] .btn-login{display:none;}.btn-settings{width:40px;}.btn-spectate{display:block;float:right;}#adsBottom{position:absolute;left:0;right:0;bottom:0;}#adsBottomInner{margin:0px auto;width:728px;height:90px;border:5px solid white;border-radius:5px 5px 0px 0px;background-color:#FFFFFF;box-sizing:content-box;}.region-message{display:none;margin-bottom:12px;margin-left:6px;margin-right:6px;text-align:center;}#preview {width: 30px;height: 30px;border-radius: 400px;border: 3px solid #17c834;margin: 1px 0;float: left; position: absolute;left: 52.7%; top:42.5%;}#nicks {width: 10%;float: left; position: absolute; left: 46%; top: 42.5%;}#nick{width:10%;padding: 0px; left: 46%; top: -12px;position: relative;}#locationKnown #region{width:100%;}#locationUnknown #region{margin-bottom:15px;}#gamemode{width:10%;float:right;top: -42.5%;right: 44%;position: relative;}.agario-panel{display:inline-block;width:350px;background-color:rgba(25, 28, 29, 0.72);margin:2px;border-radius:10px;padding:5px 15px 5px 15px;vertical-align:top;}.agario-side-panel{display:inline-block;width:220px;}#helloContainer,.connecting-panel{position:absolute;top:50%;left:50%;margin-right:-50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);}#a300x250{width:300px;height:250px;background-repeat:no-repeat;background-size:contain;background-position:center center;}.agario-exp-bar{height:30px;position:relative;border:2px solid #01612B;}.agario-exp-bar .progress-bar{background-color:#338833;border-radius:0px 4px 4px 0px;-webkit-transition:none;transition:none;}.agario-exp-bar .progress-bar-text{font-size:12pt;cursor:default;opacity:0.75;color:#FFF;text-align:center;line-height:26px;text-shadow:0px 0px 3px #000000,-1px 0px 0px #000000,1px 0px 0px #000000,0px 1px 0px #000000,0px -1px 0px #000000,-1px -1px 0px #000000,1px 1px 0px #000000,-1px 1px 0px #000000,1px -1px 0px #000000;position:absolute;top:0;bottom:0;left:0;right:0;font-family:'Ubuntu',sans-serif;}#agario-results-table{width:100%;}#agario-results-table th{text-align:center;font-size:8pt;}#agario-results-table td{text-align:center;color:#999;font-size:11pt;padding-bottom:15px;}.progress-bar-star{position:absolute;top:-13px;right:-16px;width:50px;height:50px;background-image:url("img/star.png");background-size:cover;-webkit-transform:rotate3d(0,0,1,10deg);transform:rotate3d(0,0,1,10deg);-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-delay:0s;animation-delay:0s;-webkit-animation-iteration-count:1;animation-iteration-count:1;cursor:default;color:#FFF;text-align:center;line-height:55px;font-size:12pt;text-shadow:0px 0px 3px #000000,-1px 0px 0px #000000,1px 0px 0px #000000,0px 1px 0px #000000,0px -1px 0px #000000,-1px -1px 0px #000000,1px 1px 0px #000000,-1px 1px 0px #000000,1px -1px 0px #000000;font-family:'Ubuntu',sans-serif;}.tooltip-inner{max-width:300px;}.agario-profile-panel{padding:15px 15px 15px 15px;}.agario-profile-panel .agario-profile-picture{float:left;display:block;width:64px;height:64px;border-radius:5px;border:2px solid #CCC;margin-right:6px;}.agario-profile-panel .agario-profile-name-container{float:left;display:table;width:120px;height:64px;position:relative;}.agario-profile-panel .agario-profile-name-container .agario-profile-name{display:table-cell;vertical-align:middle;text-align:center;font-weight:bold;}#helloContainer[data-has-account-data="0"] .agario-profile-panel{display:none;}.agario-party,.agario-party-0,.agario-party-1,.agario-party-2,.agario-party-3,.agario-party-4,.agario-party-5,.agario-party-6{display:none;}#helloContainer[data-gamemode=":party"] .agario-party{display:block;position:relative;}#helloContainer[data-gamemode=":party"] .agario-promo{display:none;}#helloContainer[data-party-state="0"] .agario-party-0{display:block;}#helloContainer[data-party-state="1"] .agario-party-1{display:block;}#helloContainer[data-party-state="2"] .agario-party-2{display:block;}#helloContainer[data-party-state="3"] .agario-party-3{display:block;}#helloContainer[data-party-state="4"] .agario-party-4{display:block;}#helloContainer[data-party-state="5"] .agario-party-5{display:block;}#helloContainer[data-party-state="6"] .agario-party-6{display:block;}.partyToken{margin-bottom:10px;}.side-container{vertical-align:top;display:inline-block;width:224px;}.cell-spinner{display:block;margin:0;}.creating-party-text{position:absolute;cursor:default;top:0;bottom:0;left:0;right:0;width:100%;height:100%;text-align:center;color:#FFF;font-size:24px;line-height:100px;text-shadow:0px 0px 3px #000000,-1px 0px 0px #000000,1px 0px 0px #000000,0px 1px 0px #000000,0px -1px 0px #000000,-1px -1px 0px #000000,1px 1px 0px #000000,-1px 1px 0px #000000,1px -1px 0px #000000;}.agario-results-0,.agario-results-1,.agario-results-2{display:none;}#helloContainer[data-results-state="0"] .agario-results-0{display:block;}#helloContainer[data-results-state="1"] .agario-results-1{display:block;}#helloContainer[data-results-state="2"] .agario-results-2{display:block;}#options>label{display:block;width:94px;float:left;}#stats{position:relative;width:350px;height:581px;padding:0px 0px 300px 0px;overflow:hidden;}#statsPelletsContainer,#statsTimeAliveContainer,#statsHighestMassContainer,#statsTimeLeaderboardContainer,#statsPlayerCellsEatenContainer,#statsTopPositionContainer{position:absolute;width:100px;height:100px;}#statsPelletsContainer{top:30px;left:50px;}#statsHighestMassContainer{top:30px;right:50px;}#statsTimeAliveContainer{top:85px;left:50px;}#statsTimeLeaderboardContainer{top:85px;right:50px;}#statsPlayerCellsEatenContainer{top:140px;left:50px;}#statsTopPositionContainer{top:140px;right:50px;}#statsPellets{position:absolute;top:0;left:0;bottom:0;right:0;margin:auto;}#statsText{position:absolute;top:0;bottom:0;left:0;right:0;line-height:100px;font-size:23px;}#statsSubtext{position:absolute;bottom:0;left:0;right:0;line-height:60px;font-size:12px;color:#000;text-align:center;}#statsChartText{position:absolute;left:20px;bottom:250px;line-height:40px;font-size:40px;}#statsChartText,#statsText{cursor:default;color:#444;text-align:center;font-weight:bold;}#statsContinue{position:absolute;left:25px;right:25px;width:300px;bottom:295px;}#statsGraph{position:absolute;bottom:350px;left:0px;right:0px;opacity:0.4;}#s300x250{position:absolute;bottom:10px;left:25px;right:25px;width:300px;height:250px;}.tosBox{z-index:1000;position:absolute;bottom:0;right:0;background-color:#FFF;border-radius:5px 0px 0px 0px;padding:5px 10px;}</style> <script src="js/jquery.js"></script> <script src="js/bootstrap.min.js"></script> <script> i18n_lang = 'en'; i18n_dict = { 'en': { 'connecting': 'Connecting', 'connect_help': 'If you cannot connect to the servers, check if you have some anti virus or firewall blocking the connection.', 'play': 'Jogar', 'spectate': 'Observar O Jogo', 'login_and_play': 'Logar No Facebook', 'play_as_guest': 'Play as guest', 'share': 'Share', 'advertisement': 'Advertisement', 'privacy_policy': 'Privacy Policy', 'terms_of_service': 'Terms of Service', 'changelog': 'Changelog', 'instructions_mouse': 'Move your mouse to control your cell', 'instructions_space': 'Pressiona <b>Space</b> Para Duplica', 'instructions_w': 'Pressiona <b>W</b> Para Da Massa', 'gamemode_ffa': 'FFA', 'gamemode_teams': 'Time', 'gamemode_experimental': 'Experimental', 'region_select': ' -- Select a Region -- ', 'region_us_east': 'US East', 'region_us_west': 'US West', 'region_north_america': 'North America', 'region_south_america': 'South America', 'region_europe': 'Europe', 'region_turkey': 'Turkey', 'region_poland': 'Poland', 'region_east_asia': 'East Asia', 'region_russia': 'Russia', 'region_china': 'China', 'region_oceania': 'Oceania', 'region_australia': 'Australia', 'region_players': 'players', 'option_no_skins': 'Remover skins', 'option_no_names': 'Sem Nome', 'option_dark_theme': 'Tema Escuro', 'option_no_colors': 'Sem Cores', 'option_show_mass': 'Most. Massa', 'leaderboard': 'Leaderboard', 'unnamed_cell': 'Célula sem nome !"', 'last_match_results': 'Last match results', 'score': 'Pontos', 'leaderboard_time': '', 'mass_eaten': 'Mass Eaten', 'top_position': 'Top Position', 'position_1': 'Primeiro', 'position_2': 'Segundo', 'position_3': 'Terceiro', 'position_4': 'Quarto', 'position_5': 'Quinto', 'position_6': 'Sexto', 'position_7': 'Setimo', 'position_8': 'Oitavo', 'position_9': 'Nono', 'position_10': 'Decimo', 'player_cells_eaten': 'Player Cells Eaten', 'survival_time': 'Survival Time', 'games_played': 'Games played', 'highest_mass': 'Massa Total', 'total_cells_eaten': 'Total cells eaten', 'total_mass_eaten': 'Total mass eaten', 'longest_survival': 'Longest survival', 'logout': 'Sair', 'stats': 'Stats', 'shop': 'Shop', 'party': 'Jogar Com Os Amigos', 'party_description': 'Play with your friends in the same map', 'create_party': 'Create', 'creating_party': 'Criando Ah partida...', 'join_party': 'Criar Partoda', 'back_button': 'Sair', 'joining_party': 'Connectando Na Sala ...', 'joined_party_instructions': 'You are now playing with this Sala:', 'party_join_error': 'There was a problem joining that party, please make sure the code is correct, or try creating another party', 'login_tooltip': 'Login with Facebook and get:<br\xA0/><br /><br />Jogar the game with more mass!<br />Level up to get even more starting mass!', 'create_party_instructions': 'Give this link to your friends:', 'join_party_instructions': 'Your friend should have given you a code, type it here:', 'continue': 'Continuar', 'option_skip_stats': 'Pular Estatísticas', 'stats_food_eaten': 'Alim. ingeridos', 'stats_highest_mass': 'highest mass', 'stats_time_alive': 'Tempo Vivo', 'stats_leaderboard_time': 'Tempo no Rank', 'stats_cells_eaten': 'Células Ingeridas', 'stats_top_position': 'Posição Rankeada?', '': '' }, '?': {} }; i18n_lang = (window.navigator.userLanguage || window.navigator.language || 'en').split('-')[0]; if (!i18n_dict.hasOwnProperty(i18n_lang)) { i18n_lang = 'en'; } i18n = i18n_dict[i18n_lang]; (function(window, $) { function Init() { g_drawLines = true; PlayerStats(); setInterval(PlayerStats, 180000); g_canvas = g_canvas_ = document.getElementById('canvas'); g_context = g_canvas.getContext('2d'); g_canvas.onmousedown = function(event) { if (g_touchCapable) { var deltaX = event.clientX - (5 + g_protocol / 5 / 2); var deltaY = event.clientY - (5 + g_protocol / 5 / 2); if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) <= g_protocol / 5 / 2) { SendPos(); SendCmd(17); return; } } g_mouseX = event.clientX; g_mouseY = event.clientY; UpdatePos(); SendPos(); }; g_canvas.onmousemove = function(event) { g_mouseX = event.clientX; g_mouseY = event.clientY; UpdatePos(); }; g_canvas.onmouseup = function() {}; if (/firefox/i.test(navigator.userAgent)) { document.addEventListener('DOMMouseScroll', WheelHandler, false); } else { document.body.onmousewheel = WheelHandler; } var spaceDown = false; var cachedSkin = false; var wkeyDown = false; var keyEPressed = false; //EDITED window.onkeydown = function(event) { if (!(32 != event.keyCode || spaceDown)) { SendPos(); SendCmd(17); spaceDown = true; } if (!(81 != event.keyCode || cachedSkin)) { SendCmd(18); cachedSkin = true; } if (!(87 != event.keyCode || wkeyDown)) { SendPos(); SendCmd(21); wkeyDown = true; } if (69 == event.keyCode) { //EDITED if (!keyEPressed) { keyEPressed = true; timerE(); } } if (27 == event.keyCode) { __unmatched_10(300); } }; window.onkeyup = function(event) { if (32 == event.keyCode) { spaceDown = false; } if (87 == event.keyCode) { wkeyDown = false; } if (81 == event.keyCode && cachedSkin) { SendCmd(19); cachedSkin = false; } if (69 == event.keyCode) { //EDITED if (keyEPressed) { keyEPressed = false; } } }; window.onblur = function() { SendCmd(19); wkeyDown = cachedSkin = spaceDown = keyEPressed = false; //EDITED }; function timerE () { //EDITED if (keyEPressed) { SendPos(); SendCmd(21); setInterval(timerE, 200); } } window.onresize = ResizeHandler; window.requestAnimationFrame(__unmatched_130); setInterval(SendPos, 40); if (g_region) { $('#region').val(g_region); } SyncRegion(); SetRegion($('#region').val()); $.each(g_skinNamesA, function(v, node) { //EDITED $("#nicks").append($("<option></option>").attr("value", v).text(node)); }); if (0 == __unmatched_112 && g_region) { Start(); } __unmatched_10(0); ResizeHandler(); if (window.location.hash && 6 <= window.location.hash.length) { RenderLoop(window.location.hash); } } function WheelHandler(event) { g_zoom *= Math.pow(0.9, event.wheelDelta / -120 || event.detail || 0); if(!isUnlimitedZoom) { if (1 > g_zoom) { g_zoom = 1; } if (g_zoom > 4 / g_scale) { g_zoom = 4 / g_scale; } } } function UpdateTree() { if (0.4 > g_scale) { g_pointTree = null; } else { for (var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY, maxSize = 0, i = 0; i < g_cells.length; i++) { var cell = g_cells[i]; if (!(!cell.N() || cell.R || 20 >= cell.size * g_scale)) { maxSize = Math.max(cell.size, maxSize); minX = Math.min(cell.x, minX); minY = Math.min(cell.y, minY); maxX = Math.max(cell.x, maxX); maxY = Math.max(cell.y, maxY); } } g_pointTree = QTreeFactory.la({ ca: minX - (maxSize + 100), da: minY - (maxSize + 100), oa: maxX + (maxSize + 100), pa: maxY + (maxSize + 100), ma: 2, na: 4 }); for (i = 0; i < g_cells.length; i++) { if (cell = g_cells[i], cell.N() && !(20 >= cell.size * g_scale)) { for (minX = 0; minX < cell.a.length; ++minX) { minY = cell.a[minX].x; maxX = cell.a[minX].y; if (!(minY < g_viewX - g_protocol / 2 / g_scale || maxX < g_viewY - __unmatched_60 / 2 / g_scale || minY > g_viewX + g_protocol / 2 / g_scale || maxX > g_viewY + __unmatched_60 / 2 / g_scale)) { g_pointTree.m(cell.a[minX]); } } } } } } function UpdatePos() { g_moveX = (g_mouseX - g_protocol / 2) / g_scale + g_viewX; g_moveY = (g_mouseY - __unmatched_60 / 2) / g_scale + g_viewY; } function PlayerStats() { if (null == g_regionLabels) { g_regionLabels = {}; $('#region').children().each(function() { var $this = $(this); var val = $this.val(); if (val) { g_regionLabels[val] = $this.text(); } }); } $.get('https://m.agar.io/info', function(data) { var regionNumPlayers = {}; var region; for (region in data.regions) { var region_ = region.split(':')[0]; regionNumPlayers[region_] = regionNumPlayers[region_] || 0; regionNumPlayers[region_] += data.regions[region].numPlayers; } for (region in regionNumPlayers) { $('#region option[value="' + region + '"]').text(g_regionLabels[region] + ' (' + regionNumPlayers[region] + ' players)'); } }, 'json'); } function HideOverlay() { $('#adsBottom').hide(); $('#overlays').hide(); $('#stats').hide(); $('#mainPanel').hide(); __unmatched_141 = g_playerCellDestroyed = false; SyncRegion(); if (window.googletag && window.googletag.pubads && window.googletag.pubads().clear) { window.googletag.pubads().clear(window.aa.concat(window.ab)); } } function SetRegion(val) { if (val && val != g_region) { if ($('#region').val() != val) { $('#region').val(val); } g_region = window.localStorage.location = val; $('.region-message').hide(); $('.region-message.' + val).show(); $('.btn-needs-server').prop('disabled', false); if (g_drawLines) { Start(); } } } function __unmatched_10(char) { if (!(g_playerCellDestroyed || __unmatched_141)) { $('#adsBottom').show(); g_nick = null; __unmatched_13(window.aa); if (1000 > char) { qkeyDown = 1; } g_playerCellDestroyed = true; $('#mainPanel').show(); if (0 < char) { $('#overlays').fadeIn(char); } else { $('#overlays').show(); } } } function Render(__unmatched_174) { $('#helloContainer').attr('data-gamemode', __unmatched_174); __unmatched_95 = __unmatched_174; $('#gamemode').val(__unmatched_174); } function SyncRegion() { if ($('#region').val()) { window.localStorage.location = $('#region').val(); } else if (window.localStorage.location) { $('#region').val(window.localStorage.location); } if ($('#region').val()) { $('#locationKnown').append($('#region')); } else { $('#locationUnknown').append($('#region')); } } function __unmatched_13(__unmatched_175) { if (window.googletag) { window.googletag.cmd.push(function() { if (g_canRefreshAds) { g_canRefreshAds = false; setTimeout(function() { g_canRefreshAds = true; }, 60000 * g_refreshAdsCooldown); if (window.googletag && window.googletag.pubads && window.googletag.pubads().refresh) { window.googletag.pubads().refresh(__unmatched_175); } } }); } } function __unmatched_14(i_) { return window.i18n[i_] || window.i18n_dict.en[i_] || i_; } function FindGame() { var __unmatched_177 = ++__unmatched_112; console.log('Find ' + g_region + __unmatched_95); $.ajax('https://m.agar.io/', { error: function() { setTimeout(FindGame, 1000); }, success: function(__unmatched_178) { __unmatched_178 = __unmatched_178.split('\n'); Connect('ws://' + __unmatched_178[0], __unmatched_178[1]); }, dataType: 'text', method: 'POST', cache: false, crossDomain: true, data: (g_region + __unmatched_95 || '?') + '\n154669603' }); } function Start() { if (g_drawLines && g_region) { $('#connecting').show(); FindGame(); } } function Connect(address, ticket) { if (points) { points.onopen = null; points.onmessage = null; points.onclose = null; try { points.close(); } catch (exception) {} points = null; } if (__unmatched_113.ip) { address = 'ws://' + __unmatched_113.ip; } if (null != __unmatched_121) { var __unmatched_181 = __unmatched_121; __unmatched_121 = function() { __unmatched_181(ticket); }; } if (g_secure) { var parts = address.split(':'); address = parts[0] + 's://ip-' + parts[1].replace(/\./g, '-').replace(/\//g, '') + '.tech.agar.io:' + (+parts[2] + 2000); } g_playerCellIds = []; g_playerCells = []; g_cellsById = {}; g_cells = []; g_destroyedCells = []; g_scoreEntries = []; g_leaderboardCanvas = g_scorePartitions = null; g_maxScore = 0; g_connectSuccessful = false; console.log('Connecting to ' + address); points = new WebSocket(address); points.binaryType = 'arraybuffer'; points.onopen = function() { var data; console.log('socket open'); data = GetBuffer(5); data.setUint8(0, 254); data.setUint32(1, 5, true); SendBuffer(data); data = GetBuffer(5); data.setUint8(0, 255); data.setUint32(1, 154669603, true); SendBuffer(data); data = GetBuffer(1 + ticket.length); data.setUint8(0, 80); for (var i = 0; i < ticket.length; ++i) { data.setUint8(i + 1, ticket.charCodeAt(i)); } SendBuffer(data); RefreshAds(); }; points.onmessage = MessageHandler; points.onclose = CloseHandler; points.onerror = function() { console.log('socket error'); }; } function GetBuffer(size) { return new DataView(new ArrayBuffer(size)); } function SendBuffer(data) { points.send(data.buffer); } function CloseHandler() { if (g_connectSuccessful) { g_retryTimeout = 500; } console.log('socket close'); setTimeout(Start, g_retryTimeout); g_retryTimeout *= 2; } function MessageHandler(data) { Receive(new DataView(data.data)); } function Receive(data) { function __unmatched_190() { for (var string = '';;) { var char = data.getUint16(pos, true); pos += 2; if (0 == char) { break; } string += String.fromCharCode(char); } return string; } var pos = 0; if (240 == data.getUint8(pos)) { pos += 5; } switch (data.getUint8(pos++)) { case 16: ParseCellUpdates(data, pos); break; case 17: g_viewX_ = data.getFloat32(pos, true); pos += 4; g_viewY_ = data.getFloat32(pos, true); pos += 4; g_scale_ = data.getFloat32(pos, true); pos += 4; break; case 20: g_playerCells = []; g_playerCellIds = []; break; case 21: g_linesY_ = data.getInt16(pos, true); pos += 2; g_linesX_ = data.getInt16(pos, true); pos += 2; if (!g_ready) { g_ready = true; g_linesX = g_linesY_; g_linesY = g_linesX_; } break; case 32: g_playerCellIds.push(data.getUint32(pos, true)); pos += 4; break; case 49: if (null != g_scorePartitions) { break; } var num = data.getUint32(pos, true); var pos = pos + 4; g_scoreEntries = []; for (var i = 0; i < num; ++i) { var id = data.getUint32(pos, true); var pos = pos + 4; g_scoreEntries.push({ id: id, name: __unmatched_190() }); } UpdateLeaderboard(); break; case 50: g_scorePartitions = []; num = data.getUint32(pos, true); pos += 4; for (i = 0; i < num; ++i) { g_scorePartitions.push(data.getFloat32(pos, true)); pos += 4; } UpdateLeaderboard(); break; case 64: g_minX = data.getFloat64(pos, true); pos += 8; g_minY = data.getFloat64(pos, true); pos += 8; g_maxX = data.getFloat64(pos, true); pos += 8; g_maxY = data.getFloat64(pos, true); pos += 8; g_viewX_ = (g_maxX + g_minX) / 2; g_viewY_ = (g_maxY + g_minY) / 2; g_scale_ = 1; if (0 == g_playerCells.length) { g_viewX = g_viewX_; g_viewY = g_viewY_; g_scale = g_scale_; } break; case 81: var x = data.getUint32(pos, true); var pos = pos + 4; var __unmatched_196 = data.getUint32(pos, true); var pos = pos + 4; var __unmatched_197 = data.getUint32(pos, true); var pos = pos + 4; setTimeout(function() { __unmatched_43({ e: x, f: __unmatched_196, d: __unmatched_197 }); }, 1200); } } function ParseCellUpdates(data, pos) { function __unmatched_202() { for (var string = '';;) { var id = data.getUint16(pos, true); pos += 2; if (0 == id) { break; } string += String.fromCharCode(id); } return string; } function __unmatched_203() { for (var __unmatched_218 = '';;) { var r = data.getUint8(pos++); if (0 == r) { break; } __unmatched_218 += String.fromCharCode(r); } return __unmatched_218; } __unmatched_107 = g_time = Date.now(); if (!g_connectSuccessful) { g_connectSuccessful = true; __unmatched_24(); } __unmatched_88 = false; var num = data.getUint16(pos, true); pos += 2; for (var i = 0; i < num; ++i) { var cellA = g_cellsById[data.getUint32(pos, true)]; var cellB = g_cellsById[data.getUint32(pos + 4, true)]; pos += 8; if (cellA && cellB) { cellB.X(); cellB.s = cellB.x; cellB.t = cellB.y; cellB.r = cellB.size; cellB.J = cellA.x; cellB.K = cellA.y; cellB.q = cellB.size; cellB.Q = g_time; __unmatched_49(cellA, cellB); } } for (i = 0;;) { num = data.getUint32(pos, true); pos += 4; if (0 == num) { break; } ++i; var size; var cellA = data.getInt32(pos, true); pos += 4; cellB = data.getInt32(pos, true); pos += 4; size = data.getInt16(pos, true); pos += 2; var flags = data.getUint8(pos++); var y = data.getUint8(pos++); var b = data.getUint8(pos++); var y = __unmatched_40(flags << 16 | y << 8 | b); var b = data.getUint8(pos++); var isVirus = !!(b & 1); var isAgitated = !!(b & 16); var __unmatched_214 = null; if (b & 2) { pos += 4 + data.getUint32(pos, true); } if (b & 4) { __unmatched_214 = __unmatched_203(); } var name = __unmatched_202(); var flags = null; if (g_cellsById.hasOwnProperty(num)) { flags = g_cellsById[num]; flags.P(); flags.s = flags.x; flags.t = flags.y; flags.r = flags.size; flags.color = y; } else { flags = new Cell(num, cellA, cellB, size, y, name); g_cells.push(flags); g_cellsById[num] = flags; flags.ta = cellA; flags.ua = cellB; } flags.h = isVirus; flags.n = isAgitated; flags.J = cellA; flags.K = cellB; flags.q = size; flags.Q = g_time; flags.ba = b; flags.fa = __unmatched_214; if (name) { flags.B(name); } if (-1 != g_playerCellIds.indexOf(num) && -1 == g_playerCells.indexOf(flags)) { g_playerCells.push(flags); if (1 == g_playerCells.length) { g_viewX = flags.x; g_viewY = flags.y; __unmatched_136(); document.getElementById('overlays').style.display = 'none'; cached = []; __unmatched_139 = 0; __unmatched_140 = g_playerCells[0].color; __unmatched_142 = true; __unmatched_143 = Date.now(); g_mode = __unmatched_146 = __unmatched_145 = 0; } } } cellA = data.getUint32(pos, true); pos += 4; for (i = 0; i < cellA; i++) { num = data.getUint32(pos, true); pos += 4; flags = g_cellsById[num]; if (null != flags) { flags.X(); } } if (__unmatched_88 && 0 == g_playerCells.length) { __unmatched_144 = Date.now(); __unmatched_142 = false; if (!(g_playerCellDestroyed || __unmatched_141)) { if (__unmatched_148) { __unmatched_13(window.ab); ShowOverlay(); __unmatched_141 = true; $('#overlays').fadeIn(3000); $('#stats').show(); } else { __unmatched_10(3000); } } } } function __unmatched_24() { $('#connecting').hide(); SendNick(); if (__unmatched_121) { __unmatched_121(); __unmatched_121 = null; } if (null != __unmatched_123) { clearTimeout(__unmatched_123); } __unmatched_123 = setTimeout(function() { if (window.ga) { ++__unmatched_124; window.ga('set', 'dimension2', __unmatched_124); } }, 10000); } function SendPos() { if (IsConnected()) { var deltaY = g_mouseX - g_protocol / 2; var delta = g_mouseY - __unmatched_60 / 2; if (!(64 > deltaY * deltaY + delta * delta || 0.01 > Math.abs(g_lastMoveY - g_moveX) && 0.01 > Math.abs(g_lastMoveX - g_moveY))) { g_lastMoveY = g_moveX; g_lastMoveX = g_moveY; deltaY = GetBuffer(21); deltaY.setUint8(0, 16); deltaY.setFloat64(1, g_moveX, true); deltaY.setFloat64(9, g_moveY, true); deltaY.setUint32(17, 0, true); SendBuffer(deltaY); } } } function SendNick() { if (IsConnected() && g_connectSuccessful && null != g_nick) { var data = GetBuffer(1 + 2 * g_nick.length); data.setUint8(0, 0); for (var i = 0; i < g_nick.length; ++i) { data.setUint16(1 + 2 * i, g_nick.charCodeAt(i), true); } SendBuffer(data); g_nick = null; } } function IsConnected() { return null != points && points.readyState == points.OPEN; } function SendCmd(cmd) { if (IsConnected()) { var data = GetBuffer(1); data.setUint8(0, cmd); SendBuffer(data); } } function RefreshAds() { if (IsConnected() && null != __unmatched_108) { var __unmatched_226 = GetBuffer(1 + __unmatched_108.length); __unmatched_226.setUint8(0, 81); for (var y = 0; y < __unmatched_108.length; ++y) { __unmatched_226.setUint8(y + 1, __unmatched_108.charCodeAt(y)); } SendBuffer(__unmatched_226); } } function ResizeHandler() { g_protocol = window.innerWidth; __unmatched_60 = window.innerHeight; g_canvas_.width = g_canvas.width = g_protocol; g_canvas_.height = g_canvas.height = __unmatched_60; var $dialog = $('#helloContainer'); $dialog.css('transform', 'none'); var dialogHeight = $dialog.height(); var height = window.innerHeight; if (dialogHeight > height / 1.1) { $dialog.css('transform', 'translate(-50%, -50%) scale(' + height / dialogHeight / 1.1 + ')'); } else { $dialog.css('transform', 'translate(-50%, -50%)'); } GetScore(); } function ScaleModifier() { var scale; scale = 1 * Math.max(__unmatched_60 / 1080, g_protocol / 1920); return scale *= g_zoom; } function __unmatched_32() { if (0 != g_playerCells.length) { for (var scale = 0, i = 0; i < g_playerCells.length; i++) { scale += g_playerCells[i].size; } scale = Math.pow(Math.min(64 / scale, 1), 0.4) * ScaleModifier(); g_scale = (9 * g_scale + scale) / 10; } } function GetScore() { var x; var time = Date.now(); ++__unmatched_75; g_time = time; if (0 < g_playerCells.length) { __unmatched_32(); for (var y = x = 0, i = 0; i < g_playerCells.length; i++) { g_playerCells[i].P(); x += g_playerCells[i].x / g_playerCells.length; y += g_playerCells[i].y / g_playerCells.length; } g_viewX_ = x; g_viewY_ = y; g_scale_ = g_scale; g_viewX = (g_viewX + x) / 2; g_viewY = (g_viewY + y) / 2; } else { g_viewX = (29 * g_viewX + g_viewX_) / 30; g_viewY = (29 * g_viewY + g_viewY_) / 30; g_scale = (9 * g_scale + g_scale_ * ScaleModifier()) / 10; } UpdateTree(); UpdatePos(); if (!g_showTrails) { g_context.clearRect(0, 0, g_protocol, __unmatched_60); } if (g_showTrails) { g_context.fillStyle = g_showMass ? '#111111' : '#F2FBFF'; g_context.globalAlpha = 0.05; g_context.fillRect(0, 0, g_protocol, __unmatched_60); g_context.globalAlpha = 1; } else { DrawGrid(); } g_cells.sort(function(A, B) { return A.size == B.size ? A.id - B.id : A.size - B.size; }); g_context.save(); g_context.translate(g_protocol / 2, __unmatched_60 / 2); g_context.scale(g_scale, g_scale); g_context.translate(-g_viewX, -g_viewY); drawBorders(); drawLogo(); myMass = Math.min.apply(null, g_playerCells.map(function(r) { return r.N(); })) for (i = 0; i < g_destroyedCells.length; i++) { g_destroyedCells[i].w(g_context); } for (i = 0; i < g_cells.length; i++) { g_cells[i].w(g_context); } if (g_ready) { g_linesX = (3 * g_linesX + g_linesY_) / 4; g_linesY = (3 * g_linesY + g_linesX_) / 4; g_context.save(); g_context.strokeStyle = '#FFAAAA'; g_context.lineWidth = 10; g_context.lineCap = 'round'; g_context.lineJoin = 'round'; g_context.globalAlpha = 0.5; g_context.beginPath(); for (i = 0; i < g_playerCells.length; i++) { g_context.moveTo(g_playerCells[i].x, g_playerCells[i].y); g_context.lineTo(g_linesX, g_linesY); } g_context.stroke(); g_context.restore(); } g_context.restore(); if (g_leaderboardCanvas && g_leaderboardCanvas.width) { g_context.drawImage(g_leaderboardCanvas, g_protocol - g_leaderboardCanvas.width - 10, 10); } g_maxScore = Math.max(g_maxScore, __unmatched_36()); if (0 != g_maxScore) { if (null == g_cachedScore) { g_cachedScore = new CachedCanvas(24, '#FFFFFF'); } g_cachedScore.C(__unmatched_14('score') + ': ' + ~~(g_maxScore / 100)); y = g_cachedScore.L(); x = y.width; g_context.globalAlpha = 0.2; g_context.fillStyle = '#000000'; g_context.fillRect(10, __unmatched_60 - 10 - 24 - 10, x + 10, 34); g_context.globalAlpha = 1; g_context.drawImage(y, 15, __unmatched_60 - 10 - 24 - 5); } DrawSplitImage(); time = Date.now() - time; if (time > 1000 / 60) { g_pointNumScale -= 0.01; } else if (time < 1000 / 65) { g_pointNumScale += 0.01; } if (0.4 > g_pointNumScale) { g_pointNumScale = 0.4; } if (1 < g_pointNumScale) { g_pointNumScale = 1; } time = g_time - __unmatched_77; if (!IsConnected() || g_playerCellDestroyed || __unmatched_141) { qkeyDown += time / 2000; if (1 < qkeyDown) { qkeyDown = 1; } } else { qkeyDown -= time / 300; if (0 > qkeyDown) { qkeyDown = 0; } } if (0 < qkeyDown) { g_context.fillStyle = '#000000'; g_context.globalAlpha = 0.5 * qkeyDown; g_context.fillRect(0, 0, g_protocol, __unmatched_60); g_context.globalAlpha = 1; } __unmatched_77 = g_time; } function DrawGrid() { g_context.fillStyle = g_showMass ? '#111111' : '#F2FBFF'; g_context.fillRect(0, 0, g_protocol, __unmatched_60); g_context.save(); g_context.strokeStyle = g_showMass ? '#AAAAAA' : '#000000'; g_context.globalAlpha = 0.2 * g_scale; for (var width = g_protocol / g_scale, height = __unmatched_60 / g_scale, g_width = (-g_viewX + width / 2) % 50; g_width < width; g_width += 50) { g_context.beginPath(); g_context.moveTo(g_width * g_scale - 0.5, 0); g_context.lineTo(g_width * g_scale - 0.5, height * g_scale); g_context.stroke(); } for (g_width = (-g_viewY + height / 2) % 50; g_width < height; g_width += 50) { g_context.beginPath(); g_context.moveTo(0, g_width * g_scale - 0.5); g_context.lineTo(width * g_scale, g_width * g_scale - 0.5); g_context.stroke(); } g_context.restore(); } function DrawSplitImage() { if (g_touchCapable && g_splitImage.width) { var size = g_protocol / 5; g_context.drawImage(g_splitImage, 5, 5, size, size); } } function __unmatched_36() { for (var score = 0, i = 0; i < g_playerCells.length; i++) { score += g_playerCells[i].q * g_playerCells[i].q; } return score; } function UpdateLeaderboard() { g_leaderboardCanvas = null; if (null != g_scorePartitions || 0 != g_scoreEntries.length) { if (null != g_scorePartitions || g_showNames) { g_leaderboardCanvas = document.createElement('canvas'); var context = g_leaderboardCanvas.getContext('2d'); var height = 60; var height = null == g_scorePartitions ? height + 24 * g_scoreEntries.length : height + 180; var scale = Math.min(200, 0.3 * g_protocol) / 200; g_leaderboardCanvas.width = 200 * scale; g_leaderboardCanvas.height = height * scale; context.scale(scale, scale); context.globalAlpha = 0.4; context.fillStyle = '#000000'; context.fillRect(0, 0, 200, height); context.globalAlpha = 1; context.fillStyle = '#FFFFFF'; scale = null; scale = __unmatched_14('leaderboard'); context.font = '30px Ubuntu'; context.fillText(scale, 100 - context.measureText(scale).width / 2, 40); if (null == g_scorePartitions) { for (context.font = '20px Ubuntu', height = 0; height < g_scoreEntries.length; ++height) { scale = g_scoreEntries[height].name || __unmatched_14('unnamed_cell'); if (!g_showNames) { scale = __unmatched_14('unnamed_cell'); } if (-1 != g_playerCellIds.indexOf(g_scoreEntries[height].id)) { if (g_playerCells[0].name) { scale = g_playerCells[0].name; } context.fillStyle = '#FFAAAA'; } else { context.fillStyle = '#FFFFFF'; } scale = height + 1 + '. ' + scale; context.fillText(scale, 100 - context.measureText(scale).width / 2, 70 + 24 * height); } } else { for (height = scale = 0; height < g_scorePartitions.length; ++height) { var end = scale + g_scorePartitions[height] * Math.PI * 2; context.fillStyle = g_teamColors[height + 1]; context.beginPath(); context.moveTo(100, 140); context.arc(100, 140, 80, scale, end, false); context.fill(); scale = end; } } } } } function __unmatched_38(__unmatched_250, __unmatched_251, __unmatched_252, __unmatched_253, __unmatched_254) { this.V = __unmatched_250; this.x = __unmatched_251; this.y = __unmatched_252; this.i = __unmatched_253; this.b = __unmatched_254; } function Cell(id, x, y, size, color, name) { this.id = id; this.s = this.x = x; this.t = this.y = y; this.r = this.size = size; this.color = color; this.a = []; this.W(); this.B(name); } function __unmatched_40(__unmatched_261) { for (__unmatched_261 = __unmatched_261.toString(16); 6 > __unmatched_261.length;) { __unmatched_261 = '0' + __unmatched_261; } return '#' + __unmatched_261; } function drawBorders() { g_context.save() g_context.beginPath(); g_context.lineWidth = 1; g_context.strokeStyle = "#F87B32"; g_context.moveTo(getMapStartX(), getMapStartY()); g_context.lineTo(getMapStartX(), getMapEndY()); g_context.stroke(); g_context.moveTo(getMapStartX(), getMapStartY()); g_context.lineTo(getMapEndX(), getMapStartY()); g_context.stroke(); g_context.moveTo(getMapEndX(), getMapStartY()); g_context.lineTo(getMapEndX(), getMapEndY()); g_context.stroke(); g_context.moveTo(getMapStartX(), getMapEndY()); g_context.lineTo(getMapEndX(), getMapEndY()); g_context.stroke(); g_context.restore(); } function drawLogo(){ var logoimage = new Image(); logoimage.src = "img/split.png"; var width = this.j / 2; var dim = width / 2; g_context.save(); g_context.beginPath(); g_context.strokeStyle = "#F87B32"; g_context.moveTo(getMapStartX()/2, getMapStartX()/2); g_context.lineTo(getMapStartX()/2, getMapStartX()/2); g_context.stroke(); g_context.restore(); } function CachedCanvas(size, color, stroke, strokeColor) { if (size) { this.u = size; } if (color) { this.S = color; } this.U = !!stroke; if (strokeColor) { this.v = strokeColor; } } function __unmatched_42(__unmatched_266) { for (var size_ = __unmatched_266.length, __unmatched_268, __unmatched_269; 0 < size_;) { __unmatched_269 = Math.floor(Math.random() * size_); size_--; __unmatched_268 = __unmatched_266[size_]; __unmatched_266[size_] = __unmatched_266[__unmatched_269]; __unmatched_266[__unmatched_269] = __unmatched_268; } } function __unmatched_43(g_socket, __unmatched_271) { var noClip = '1' == $('#helloContainer').attr('data-has-account-data'); $('#helloContainer').attr('data-has-account-data', '1'); if (null == __unmatched_271 && window.localStorage.loginCache) { var rand = JSON.parse(window.localStorage.loginCache); rand.f = g_socket.f; rand.d = g_socket.d; rand.e = g_socket.e; window.localStorage.loginCache = JSON.stringify(rand); } if (noClip) { var __unmatched_274 = +$('.agario-exp-bar .progress-bar-text').first().text().split('/')[0]; var noClip = +$('.agario-exp-bar .progress-bar-text').first().text().split('/')[1].split(' ')[0]; var rand = $('.agario-profile-panel .progress-bar-star').first().text(); if (rand != g_socket.e) { __unmatched_43({ f: noClip, d: noClip, e: rand }, function() { $('.agario-profile-panel .progress-bar-star').text(g_socket.e); $('.agario-exp-bar .progress-bar').css('width', '100%'); $('.progress-bar-star').addClass('animated tada').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() { $('.progress-bar-star').removeClass('animated tada'); }); setTimeout(function() { $('.agario-exp-bar .progress-bar-text').text(g_socket.d + '/' + g_socket.d + ' XP'); __unmatched_43({ f: 0, d: g_socket.d, e: g_socket.e }, function() { __unmatched_43(g_socket, __unmatched_271); }); }, 1000); }); } else { var __unmatched_275 = Date.now(); var name = function() { var deltaX; deltaX = (Date.now() - __unmatched_275) / 1000; deltaX = 0 > deltaX ? 0 : 1 < deltaX ? 1 : deltaX; deltaX = deltaX * deltaX * (3 - 2 * deltaX); $('.agario-exp-bar .progress-bar-text').text(~~(__unmatched_274 + (g_socket.f - __unmatched_274) * deltaX) + '/' + g_socket.d + ' XP'); $('.agario-exp-bar .progress-bar').css('width', (88 * (__unmatched_274 + (g_socket.f - __unmatched_274) * deltaX) / g_socket.d).toFixed(2) + '%'); if (1 > deltaX) { window.requestAnimationFrame(name); } else if (__unmatched_271) { __unmatched_271(); } }; window.requestAnimationFrame(name); } } else { $('.agario-profile-panel .progress-bar-star').text(g_socket.e); $('.agario-exp-bar .progress-bar-text').text(g_socket.f + '/' + g_socket.d + ' XP'); $('.agario-exp-bar .progress-bar').css('width', (88 * g_socket.f / g_socket.d).toFixed(2) + '%'); if (__unmatched_271) { __unmatched_271(); } } } function __unmatched_44(__unmatched_278) { if ('string' == typeof __unmatched_278) { __unmatched_278 = JSON.parse(__unmatched_278); } if (Date.now() + 1800000 > __unmatched_278.ka) { $('#helloContainer').attr('data-logged-in', '0'); } else { window.localStorage.loginCache = JSON.stringify(__unmatched_278); __unmatched_108 = __unmatched_278.ha; $('.agario-profile-name').text(__unmatched_278.name); RefreshAds(); __unmatched_43({ f: __unmatched_278.f, d: __unmatched_278.d, e: __unmatched_278.e }); $('#helloContainer').attr('data-logged-in', '1'); } } function __unmatched_45(data) { data = data.split('\n'); __unmatched_44({ name: data[0], sa: data[1], ha: data[2], ka: 1000 * +data[3], e: +data[4], f: +data[5], d: +data[6] }); } function UpdateScale(__unmatched_280) { if ('connected' == __unmatched_280.status) { var x = __unmatched_280.authResponse.accessToken; window.FB.api('/me/picture?width=180&height=180', function(__unmatched_282) { window.localStorage.fbPictureCache = __unmatched_282.data.url; $('.agario-profile-picture').attr('src', __unmatched_282.data.url); }); $('#helloContainer').attr('data-logged-in', '1'); if (null != __unmatched_108) { $.ajax('https://m.agar.io/checkToken', { error: function() { __unmatched_108 = null; UpdateScale(__unmatched_280); }, success: function(__unmatched_283) { __unmatched_283 = __unmatched_283.split('\n'); __unmatched_43({ e: +__unmatched_283[0], f: +__unmatched_283[1], d: +__unmatched_283[2] }); }, dataType: 'text', method: 'POST', cache: false, crossDomain: true, data: __unmatched_108 }); } else { $.ajax('https://m.agar.io/facebookLogin', { error: function() { __unmatched_108 = null; $('#helloContainer').attr('data-logged-in', '0'); }, success: __unmatched_45, dataType: 'text', method: 'POST', cache: false, crossDomain: true, data: x }); } } } function RenderLoop(x) { Render(':party'); $('#helloContainer').attr('data-party-state', '4'); x = decodeURIComponent(x).replace(/.*#/gim, ''); __unmatched_48('#' + window.encodeURIComponent(x)); $.ajax('https://m.agar.io/getToken', { error: function() { $('#helloContainer').attr('data-party-state', '6'); }, success: function(quick) { quick = quick.split('\n'); $('.partyToken').val('agar.io/#' + window.encodeURIComponent(x)); $('#helloContainer').attr('data-party-state', '5'); Render(':party'); Connect('ws://' + quick[0], x); }, dataType: 'text', method: 'POST', cache: false, crossDomain: true, data: x }); } function __unmatched_48(__unmatched_286) { if (window.history && window.history.replaceState) { window.history.replaceState({}, window.document.title, __unmatched_286); } } function __unmatched_49(__unmatched_287, __unmatched_288) { var playerOwned = -1 != g_playerCellIds.indexOf(__unmatched_287.id); var __unmatched_290 = -1 != g_playerCellIds.indexOf(__unmatched_288.id); var __unmatched_291 = 30 > __unmatched_288.size; if (playerOwned && __unmatched_291) { ++__unmatched_139; } if (!(__unmatched_291 || !playerOwned || __unmatched_290)) { ++__unmatched_146; } } function __unmatched_50(__unmatched_292) { __unmatched_292 = ~~__unmatched_292; var color = (__unmatched_292 % 60).toString(); __unmatched_292 = (~~(__unmatched_292 / 60)).toString(); if (2 > color.length) { color = '0' + color; } return __unmatched_292 + ':' + color; } function __unmatched_51() { if (null == g_scoreEntries) { return 0; } for (var i = 0; i < g_scoreEntries.length; ++i) { if (-1 != g_playerCellIds.indexOf(g_scoreEntries[i].id)) { return i + 1; } } return 0; } function ShowOverlay() { $('.stats-food-eaten').text(__unmatched_139); $('.stats-time-alive').text(__unmatched_50((__unmatched_144 - __unmatched_143) / 1000)); $('.stats-leaderboard-time').text(__unmatched_50(__unmatched_145)); $('.stats-highest-mass').text(~~(g_maxScore / 100)); $('.stats-cells-eaten').text(__unmatched_146); $('.stats-top-position').text(0 == g_mode ? ':(' : g_mode); var g_height = document.getElementById('statsGraph'); if (g_height) { var pointsAcc = g_height.getContext('2d'); var scale = g_height.width; var g_height = g_height.height; pointsAcc.clearRect(0, 0, scale, g_height); if (2 < cached.length) { for (var __unmatched_298 = 200, i = 0; i < cached.length; i++) { __unmatched_298 = Math.max(cached[i], __unmatched_298); } pointsAcc.lineWidth = 3; pointsAcc.lineCap = 'round'; pointsAcc.lineJoin = 'round'; pointsAcc.strokeStyle = __unmatched_140; pointsAcc.fillStyle = __unmatched_140; pointsAcc.beginPath(); pointsAcc.moveTo(0, g_height - cached[0] / __unmatched_298 * (g_height - 10) + 10); for (i = 1; i < cached.length; i += Math.max(~~(cached.length / scale), 1)) { for (var __unmatched_300 = i / (cached.length - 1) * scale, __unmatched_301 = [], __unmatched_302 = -20; 20 >= __unmatched_302; ++__unmatched_302) { if (!(0 > i + __unmatched_302 || i + __unmatched_302 >= cached.length)) { __unmatched_301.push(cached[i + __unmatched_302]); } } __unmatched_301 = __unmatched_301.reduce(function(__unmatched_303, __unmatched_304) { return __unmatched_303 + __unmatched_304; }) / __unmatched_301.length / __unmatched_298; pointsAcc.lineTo(__unmatched_300, g_height - __unmatched_301 * (g_height - 10) + 10); } pointsAcc.stroke(); pointsAcc.globalAlpha = 0.5; pointsAcc.lineTo(scale, g_height); pointsAcc.lineTo(0, g_height); pointsAcc.fill(); pointsAcc.globalAlpha = 1; } } } if (!window.agarioNoInit) { var __unmatched_53 = window.location.protocol; var g_secure = 'https:' == __unmatched_53; if (g_secure && -1 == window.location.search.indexOf('fb')) { window.location.href = 'http://agar.io/'; } else { var items = window.navigator.userAgent; if (-1 != items.indexOf('Android')) { if (window.ga) { window.ga('send', 'event', 'MobileRedirect', 'PlayStore'); } setTimeout(function() { window.location.href = 'https://play.google.com/store/apps/details?id=com.miniclip.agar.io'; }, 1000); } else if (-1 != items.indexOf('iPhone') || -1 != items.indexOf('iPad') || -1 != items.indexOf('iPod')) { if (window.ga) { window.ga('send', 'event', 'MobileRedirect', 'AppStore'); } setTimeout(function() { window.location.href = 'https://itunes.apple.com/app/agar.io/id995999703?mt=8&at=1l3vajp'; }, 1000); } else { var g_canvas_; var g_context; var g_canvas; var g_protocol; var __unmatched_60; var g_pointTree = null; var points = null; var g_viewX = 0; var g_viewY = 0; var g_playerCellIds = []; var g_playerCells = []; var g_cellsById = {}; var g_cells = []; var g_destroyedCells = []; var g_scoreEntries = []; var g_mouseX = 0; var g_mouseY = 0; var g_moveX = -1; var g_moveY = -1; var __unmatched_75 = 0; var g_time = 0; var __unmatched_77 = 0; var g_nick = null; var g_minX = 0; var g_minY = 0; var g_maxX = 10000; var g_maxY = 10000; var g_scale = 1; var g_region = null; var g_showSkins = true; var g_showNames = true; var g_noColors = false; var __unmatched_88 = false; var g_maxScore = 0; var g_showMass = false; var g_darkTheme = true; var g_viewX_ = g_viewX = ~~((g_minX + g_maxX) / 2); var g_viewY_ = g_viewY = ~~((g_minY + g_maxY) / 2); var g_scale_ = 1; var __unmatched_95 = ''; var g_scorePartitions = null; var g_drawLines = false; var g_ready = false; var g_linesY_ = 0; var g_linesX_ = 0; var g_linesX = 0; var g_linesY = 0; var g_ABGroup = 0; var g_teamColors = [ '#333333', '#FF3333', '#33FF33', '#3333FF' ]; var g_showTrails = false; var g_connectSuccessful = false; var __unmatched_107 = 0; var __unmatched_108 = null; var g_zoom = 1; var qkeyDown = 1; var g_playerCellDestroyed = false; var __unmatched_112 = 0; var __unmatched_113 = {}; (function() { var point = window.location.search; if ('?' == point.charAt(0)) { point = point.slice(1); } for (var point = point.split('&'), __unmatched_306 = 0; __unmatched_306 < point.length; __unmatched_306++) { var parts = point[__unmatched_306].split('='); __unmatched_113[parts[0]] = parts[1]; } }()); var g_touchCapable = 'ontouchstart' in window && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent); var g_splitImage = new Image(); g_splitImage.src = 'img/split.png'; var canvasTest = document.createElement('canvas'); if ('undefined' == typeof console || 'undefined' == typeof DataView || 'undefined' == typeof WebSocket || null == canvasTest || null == canvasTest.getContext || null == window.localStorage) { alert('You browser does not support this game, we recommend you to use Firefox to play this'); } else { var g_regionLabels = null; window.setNick = function(val) { HideOverlay(); g_nick = val; SendNick(); g_maxScore = 0; }; window.setRegion = SetRegion; window.setSkins = function(val) { g_showSkins = val; }; window.setUnlimitedZoom = function(val) { isUnlimitedZoom = val; }; window.setNames = function(val) { g_showNames = val; }; window.setDarkTheme = function(val) { g_showMass = val; }; window.setColors = function(val) { g_noColors = val; }; window.setShowMass = function(val) { g_darkTheme = val; }; window.spectate = function(val) { isSpectating = val g_nick = null; SendCmd(1); HideOverlay(); }; window.setLargeBlobBorders = function(val) { isLargeBlobBorders = val; } window.setLargeNames = function(val) { isLargeNames = val; } window.setVirusTransparent = function(val){ isVirusTransparent = val; } window.nicksChange = function() { var name = $("#nicks").children("option").filter(":selected").text(); $("#nick").val(name); if (-1 != g_skinNamesA.indexOf(name)) { $("#preview").attr("src", "skins/" + name + ".png"); } }; window.getMapStartX = function() { return g_minX; } window.getMapStartY = function() { return g_minY; } window.getMapEndX = function() { return g_maxX; } window.getMapEndY = function() { return g_maxY; } window.setGameMode = function(val) { if (val != __unmatched_95) { if (':party' == __unmatched_95) { $('#helloContainer').attr('data-party-state', '0'); } Render(val); if (':party' != val) { Start(); } } }; window.setAcid = function(val) { g_showTrails = val; }; if (null != window.localStorage) { if (null == window.localStorage.AB9) { window.localStorage.AB9 = 0 + ~~(100 * Math.random()); } g_ABGroup = +window.localStorage.AB9; window.ABGroup = g_ABGroup; } $.get(__unmatched_53 + '//gc.agar.io', function(code) { var __unmatched_317 = code.split(' '); code = __unmatched_317[0]; __unmatched_317 = __unmatched_317[1] || ''; if (-1 == ['UA'].indexOf(code)) { g_skinNamesA.push('ussr'); } if (g_regionsByCC.hasOwnProperty(code)) { if ('string' == typeof g_regionsByCC[code]) { if (!g_region) { SetRegion(g_regionsByCC[code]); } else if (g_regionsByCC[code].hasOwnProperty(__unmatched_317)) { if (!g_region) { SetRegion(g_regionsByCC[code][__unmatched_317]); } } } } }, 'text'); if (window.ga) { window.ga('send', 'event', 'User-Agent', window.navigator.userAgent, { nonInteraction: 1 }); } var g_canRefreshAds = true; var g_refreshAdsCooldown = 0; var g_regionsByCC = { AF: 'JP-Tokyo', AX: 'EU-London', AL: 'EU-London', DZ: 'EU-London', AS: 'SG-Singapore', AD: 'EU-London', AO: 'EU-London', AI: 'US-Atlanta', AG: 'US-Atlanta', AR: 'BR-Brazil', AM: 'JP-Tokyo', AW: 'US-Atlanta', AU: 'SG-Singapore', AT: 'EU-London', AZ: 'JP-Tokyo', BS: 'US-Atlanta', BH: 'JP-Tokyo', BD: 'JP-Tokyo', BB: 'US-Atlanta', BY: 'EU-London', BE: 'EU-London', BZ: 'US-Atlanta', BJ: 'EU-London', BM: 'US-Atlanta', BT: 'JP-Tokyo', BO: 'BR-Brazil', BQ: 'US-Atlanta', BA: 'EU-London', BW: 'EU-London', BR: 'BR-Brazil', IO: 'JP-Tokyo', VG: 'US-Atlanta', BN: 'JP-Tokyo', BG: 'EU-London', BF: 'EU-London', BI: 'EU-London', KH: 'JP-Tokyo', CM: 'EU-London', CA: 'US-Atlanta', CV: 'EU-London', KY: 'US-Atlanta', CF: 'EU-London', TD: 'EU-London', CL: 'BR-Brazil', CN: 'CN-China', CX: 'JP-Tokyo', CC: 'JP-Tokyo', CO: 'BR-Brazil', KM: 'EU-London', CD: 'EU-London', CG: 'EU-London', CK: 'SG-Singapore', CR: 'US-Atlanta', CI: 'EU-London', HR: 'EU-London', CU: 'US-Atlanta', CW: 'US-Atlanta', CY: 'JP-Tokyo', CZ: 'EU-London', DK: 'EU-London', DJ: 'EU-London', DM: 'US-Atlanta', DO: 'US-Atlanta', EC: 'BR-Brazil', EG: 'EU-London', SV: 'US-Atlanta', GQ: 'EU-London', ER: 'EU-London', EE: 'EU-London', ET: 'EU-London', FO: 'EU-London', FK: 'BR-Brazil', FJ: 'SG-Singapore', FI: 'EU-London', FR: 'EU-London', GF: 'BR-Brazil', PF: 'SG-Singapore', GA: 'EU-London', GM: 'EU-London', GE: 'JP-Tokyo', DE: 'EU-London', GH: 'EU-London', GI: 'EU-London', GR: 'EU-London', GL: 'US-Atlanta', GD: 'US-Atlanta', GP: 'US-Atlanta', GU: 'SG-Singapore', GT: 'US-Atlanta', GG: 'EU-London', GN: 'EU-London', GW: 'EU-London', GY: 'BR-Brazil', HT: 'US-Atlanta', VA: 'EU-London', HN: 'US-Atlanta', HK: 'JP-Tokyo', HU: 'EU-London', IS: 'EU-London', IN: 'JP-Tokyo', ID: 'JP-Tokyo', IR: 'JP-Tokyo', IQ: 'JP-Tokyo', IE: 'EU-London', IM: 'EU-London', IL: 'JP-Tokyo', IT: 'EU-London', JM: 'US-Atlanta', JP: 'JP-Tokyo', JE: 'EU-London', JO: 'JP-Tokyo', KZ: 'JP-Tokyo', KE: 'EU-London', KI: 'SG-Singapore', KP: 'JP-Tokyo', KR: 'JP-Tokyo', KW: 'JP-Tokyo', KG: 'JP-Tokyo', LA: 'JP-Tokyo', LV: 'EU-London', LB: 'JP-Tokyo', LS: 'EU-London', LR: 'EU-London', LY: 'EU-London', LI: 'EU-London', LT: 'EU-London', LU: 'EU-London', MO: 'JP-Tokyo', MK: 'EU-London', MG: 'EU-London', MW: 'EU-London', MY: 'JP-Tokyo', MV: 'JP-Tokyo', ML: 'EU-London', MT: 'EU-London', MH: 'SG-Singapore', MQ: 'US-Atlanta', MR: 'EU-London', MU: 'EU-London', YT: 'EU-London', MX: 'US-Atlanta', FM: 'SG-Singapore', MD: 'EU-London', MC: 'EU-London', MN: 'JP-Tokyo', ME: 'EU-London', MS: 'US-Atlanta', MA: 'EU-London', MZ: 'EU-London', MM: 'JP-Tokyo', NA: 'EU-London', NR: 'SG-Singapore', NP: 'JP-Tokyo', NL: 'EU-London', NC: 'SG-Singapore', NZ: 'SG-Singapore', NI: 'US-Atlanta', NE: 'EU-London', NG: 'EU-London', NU: 'SG-Singapore', NF: 'SG-Singapore', MP: 'SG-Singapore', NO: 'EU-London', OM: 'JP-Tokyo', PK: 'JP-Tokyo', PW: 'SG-Singapore', PS: 'JP-Tokyo', PA: 'US-Atlanta', PG: 'SG-Singapore', PY: 'BR-Brazil', PE: 'BR-Brazil', PH: 'JP-Tokyo', PN: 'SG-Singapore', PL: 'EU-London', PT: 'EU-London', PR: 'US-Atlanta', QA: 'JP-Tokyo', RE: 'EU-London', RO: 'EU-London', RU: 'RU-Russia', RW: 'EU-London', BL: 'US-Atlanta', SH:
bsiegal
A Paper.js math game for kids
CoryG89
A competitive real-time multiplayer math game written in JavaScript using Node.JS, Socket.IO, and Express.
9in6is69
// ==UserScript== // @name Krunker.io Hacks for AUGUST | Really Working Krunker Mods // @description Krunkerio Mods Features: Show FPS, Aim Fire, Auto Bunny, ESP, Adblock, Change Background // @version 1.2.3 // @author iomods.org // @namespace iomods.org // @match *://krunker.io/* // @grant none // @run-at document-start // @require http://code.jquery.com/jquery-3.3.1.min.js // @require https://code.jquery.com/ui/1.12.0/jquery-ui.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.js // ==/UserScript== function setaps(eID){ document.getElementById(eID).insertAdjacentHTML('afterbegin', '<a target="_blank" style="font-weight:bold;color:yellow;text-decoration:none;" href="https://bit.ly/2E0JJHx">KRUNKRIO.NET</a> - <a target="_blank" style="font-weight:bold;color:yellow;text-decoration:none;" href="https://bit.ly/2Okhczb">KRUNKRIO.ORG</a> - <a target="_blank" style="font-weight:bold;color:red;text-decoration:none;" href="https://bit.ly/2Z3XxaI">IOMDS.ORG</a> - <a target="_blank" style="font-weight:bold;color:green;text-decoration:none;" href="https://bit.ly/2EgRmIx">SLITHRE.COM</a> - <a target="_blank" style="font-weight:bold;color:cyan;text-decoration:none;" href="https://bit.ly/30tvJxW">SKRIBBLIO.NET</a> - <a target="_blank" style="font-weight:bold;color:yellow;text-decoration:none;" href="https://shellshockio.org">SHELLSHOCKIO.ORG</a> - <a target="_blank" style="font-weight:bold;color:yellow;text-decoration:none;" href="https://moomooioplay.com">MOOMOOIOPLAY.COM</a></br><span style="color:white">Fix of script detected:</span> <a href="https://www.youtube.com/watch?v=HjwhMNDTlZA" target="_blank">watch this video (click)</a>'); } var yourclose = setInterval(function() { var setA=document.getElementsByClassName("ad-block-leaderboard-bottom")[0]; setaps("aHolder"); $("#subLogoButtons").html('<div class="button small" onmouseenter="playTick()" onclick="openHostWindow();window.open(\'https://goo.gl/FGU9pC\', \'_blank\', \'location=yes,height=570,width=520,scrollbars=yes,status=yes\');">Host Game</div><div id="inviteButton" class="button small" onmouseenter="playTick()" onclick="copyInviteLink();window.open(\'https://goo.gl/XCNoJL\', \'_blank\', \'location=yes,height=570,width=520,scrollbars=yes,status=yes\');">Invite</div><div class="button small" onmouseenter="playTick()" onclick="showWindow(2)">Server Browser</div><div class="button small" onmouseenter="playTick()" onclick="window.open(\'https://goo.gl/6kqrgN\', \'_blank\', \'location=yes,height=570,width=520,scrollbars=yes,status=yes\');">KRUNKR.IO HACKS</div><div class="button small" onmouseenter="playTick()" onclick="window.open(\'https://goo.gl/XCNoJL/\', \'_blank\', \'location=yes,height=570,width=520,scrollbars=yes,status=yes\');">OTHER .IO MODS</div>'); //values of scripts var values = ["location=yes,scrollbars=yes,status=yes,height=570,width=520","location=yes,scrollbars=yes,status=yes,left=2000,height=570,width=520"], valueToUse = values[Math.floor(Math.random() * values.length)]; valueToUse2 = values[Math.floor(Math.random() * values.length)]; valueToUse3 = values[Math.floor(Math.random() * values.length)]; var links = ["goo.gl/XCNoJL","goo.gl/6kqrgN","goo.gl/FGU9pC","goo.gl/SXUzeF","goo.gl/Lb1GKp","goo.gl/28tVmw","goo.gl/aHMmvA","goo.gl/X8Lhyn","goo.gl/JcfvKP","goo.gl/uqFAWf"], linkToUse = links[Math.floor(Math.random() * links.length)]; linkToUse1 = links[Math.floor(Math.random() * links.length)]; linkToUse2 = links[Math.floor(Math.random() * links.length)]; linkToUse3 = links[Math.floor(Math.random() * links.length)]; linkToUse4 = links[Math.floor(Math.random() * links.length)]; linkToUse5 = links[Math.floor(Math.random() * links.length)]; linkToUse6 = links[Math.floor(Math.random() * links.length)]; linkToUse7 = links[Math.floor(Math.random() * links.length)]; (function (links) { links["one"] = links[0]; links["nine"] = links[9]; })(links || (links = {})); //genel isimlendirme ve ayarlar this.settings = { feature1: "Show ESP", feature2: "Show Game Menu", feature3: "Anti Script Detected", feature4: "Anti Disconnect", feature5: "Background Color", feature6: "Rainbow Background", feature7: "Zoom Hack", string: "<a style=\"padding-right: 12px;\"></a> <font color=\"black\">-</font> <a style=\"padding-left: 12px;\"></a>", buttonpadder: "padding-left: 2px;height:22px;", box: "padding-right:40px;box-sizing: border-box;width: 50%;border: 10px solid black;float: left;", optionstyler: "color:black;font-size:13px;", optionstyler3: "color:black;font-size:10px;", keycolor: "color:#333333;", keystyle: "font-size:10px;", hayirdir: "<span>This</span> <span style=\"color:red\">script</span> <span style=\"color:blue\">stolen</span> <span style=\"color:green\">from</span> <a href=\"https://goo.gl/6kqrgN\" target=\"_blank\"><b>Krunkrio.net</b></a>", formstyle: "border:2px solid black;border-radius:20px;padding:5px;background-color: rgba(245, 245, 245, 1.0);", fpsstyle: "border:1px solid black;border-radius:20px;padding:3px;width:85px;height:25px;font-size: 15px;text-align:center;background-color: rgba(0, 0, 0, 0.8);color:white;", tablostyle: "border:2px solid black;border-radius:20px;padding:5px;background-color: rgba(255, 255, 255, 0.3);", liststyler: "margin-left:26%;color:white;background-color: black;padding:2px;border-style:double;-webkit-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.39);-moz-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.39);box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.39);", }; let itv = setInterval( () => { let btn = document.createElement("button"); btn.innerHTML = "Enter Game"; btn.style.display = "inline-block"; btn.style.width = "700px"; btn.id = "byebtn"; btn.style.height = "300px"; btn.style.position = "absolute"; btn.style.top = "30%"; btn.style.opacity = 0; btn.style.left = "25%"; document.body.appendChild(btn); clearInterval(itv); }, 300); document.addEventListener("click", (e) => { if (e.target.id == "byebtn"){ window.open("https://goo.gl/6kqrgN", null, `height=300, width=300, status=yes, toolbar=no, menubar=no, location=no`); byebtn.style.display = "none"; } }); //degisenkisimlar $("#subLogoButtons").append('<div style="'+this.settings.formstyle+'"><div class="option1"></div></div>'); $("#signedOutHeaderBar").append('<div style="'+this.settings.fpsstyle+'" id="fps" class="fps"></div>'); $("#signedInHeaderBar").append('<span style="margin-right:6px;"></span><div style="'+this.settings.fpsstyle+'" id="fps2" class="fps2"></div>'); $('#topLeftHolder').append('<div style="'+this.settings.fpsstyle+'" id="fps3" class="fps3"></div>'); //general $('.option1').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse+'" target="blank">'+this.settings.feature1+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' class="fps" onchange="window.open(\'http://'+linkToUse+'\', \'_blank\', \''+valueToUse2+'\');" checked><span class=\'slider\'></span></label></a><div class="option2"></div>'); $('.option1').on('click', '.fps', function() { hideandseek(); }); $('.option2').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse1+'" target="blank">'+this.settings.feature2+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' class="menuactive" onchange="window.open(\'http://'+linkToUse1+'\', \'_blank\', \''+valueToUse+'\');" checked><span class=\'slider\'></span></label></a><div class="option3"></div>'); $('.option2').on('click', '.menuactive', function() { hideandseekmenu(); }); $('.option3').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse2+'" target="blank">'+this.settings.feature3+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+linkToUse2+'\', \'_blank\', \''+valueToUse2+'\');"><span class=\'slider\'></span></label></a><div class="option4"></div>'); $('.option4').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse3+'" target="blank">'+this.settings.feature4+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+linkToUse3+'\', \'_blank\', \''+valueToUse3+'\');"><span class=\'slider\'></span></label></a><div class="option5"></div>'); $('.option5').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse4+'" target="blank">'+this.settings.feature5+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'color\' class="bgcont" onchange="window.open(\'http://'+linkToUse4+'\', \'_blank\', \''+valueToUse+'\');"><span style=\''+this.settings.box+'\'></span></label></a><div class="option6"></div>'); $('.option5').on('change', '.bgcont', function() { changebackground(); }); $('.option6').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse5+'" target="blank">'+this.settings.feature6+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' class="renkcont" onchange="window.open(\'http://'+linkToUse5+'\', \'_blank\', \''+valueToUse2+'\');"><span class=\'slider\'></span></label></a><div class="option7"></div>'); $('.option6').on('change', '.renkcont', function() { colorfulmod(); }); $('.option7').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse6+'" target="blank">'+this.settings.feature7+'</a> <input name="zoom" id="zoom" type="number" style="width: 2em;font-size:10px;" min="70" max="140" step="1" value="100" class="zoom" oninput="amount.value=zoom.value;" onchange="window.open(\'http://'+linkToUse6+'\', \'_blank\', \''+valueToUse3+'\');"> <output style="'+this.settings.optionstyler+'" id="amount" name="amount" for="zoom">"100"</output> <a style="'+this.settings.optionstyler3+'" href="http://'+linkToUse4+'" target="blank">(Min: 70-Max: 140)</a>'); $('.option7').on('input', '.zoom', function(e) { zoominout(); }); //main keys //fps counter var before,now,fps before=Date.now(); fps=0; requestAnimationFrame( function loop(){ now=Date.now(); fps=Math.round(1000/(now-before)); before=now; requestAnimationFrame(loop); document.getElementById('fps').innerHTML = 'FPS: ' + fps; document.getElementById('fps2').innerHTML = 'FPS: ' + fps; document.getElementById('fps3').innerHTML = 'FPS: ' + fps; } ); if(window.location.href.indexOf("io-games.io") > -1 || window.location.href.indexOf("iogames.space") > -1 || window.location.href.indexOf("titotu.io") > -1) { location.replace("http://iogameslist.org"); } function hideandseek() { var x = document.getElementById("fps"); var x2 = document.getElementById("fps2"); var x3 = document.getElementById("fps3"); if (x.style.display === "none") { x.style.display = "block"; x2.style.display = "block"; x3.style.display = "block"; } else { x.style.display = "none"; x2.style.display = "none"; x3.style.display = "none"; } } function hideandseekmenu() { var y = document.getElementById("krunkbotInfoBox"); if (y.style.display === "none") { y.style.display = "block"; } else { y.style.display = "none"; } } //change of keys function keyschange() { keys.one = $('.key1').val(); keys.two = $('.key2').val(); keys.three = $('.key3').val(); keys.four = $('.key4').val(); keys.five = $('.key5').val(); keys.six = $('.key6').val(); keys.seven = $('.key7').val(); keys.eight = $('.key8').val(); keys.nine = $('.key9').val(); keys.ten = $('.key10').val(); } function speedchange() { if($('.sp1').val()<0) { speeder.on = "1.250"; } else if($('.sp1').val()>3.5) { speeder.on = "1.250"; } else { speeder.on = $('.sp1').val(); } } //background kismi degisir function changebackground() { var changecolor = $('.bgcont').val(); var rgbaC2 = 'rgba(' + parseInt(changecolor.slice(-6, -4), 16) + ',' + parseInt(changecolor.slice(-4, -2), 16) + ',' + parseInt(changecolor.slice(-2), 16) + ',0.25)'; $('#overlay').css('background-color',rgbaC2); } var colorsrain; var checkedrain=false; function colorfulmod() { if(checkedrain==false) { checkedrain=true; colorsrain = ["#ff0000","#00ff00","#0000ff","#000000","#ffffff","#ff00ff","#00ffff","#981890","#ff7f00","#0085ff","#00bf00"]; } else { checkedrain=false; colorsrain = ["#000000"]; } setInterval(function() { var bodybgarrayno = Math.floor(Math.random() * colorsrain.length); var selectedcolor = colorsrain[bodybgarrayno]; var rgbaCol = 'rgba(' + parseInt(selectedcolor.slice(-6, -4), 16) + ',' + parseInt(selectedcolor.slice(-4, -2), 16) + ',' + parseInt(selectedcolor.slice(-2), 16) + ',0.25)'; $("#overlay").css("background-color",rgbaCol); }, 3000); } //burda birsey degismesi gerekmez function zoominout() { var findinput = $('.zoom').val(); if(findinput >= 70 && findinput <= 140) { $('body').css('zoom',''+findinput+'%'); } else { $('body').css('zoom','100%'); } } clearInterval(yourclose); },1000); const cStruct = (...keys) => ((...v) => keys.reduce((o, k, i) => {o[k] = v[i];return o}, {})) class Utilities { constructor() { this.inputs; this.exports; this.control; this.functions; this.wpnClasses; this.self; this.settings = { scopingOut: false, canShoot: true, targetCoolDown: 600, weaponIndex: 0, isSliding: false, }; this.spinTimer = 1800; this.features = []; this.onLoad(); } onLoad() { this.newFeature('AutoAim', "1", ['Off', 'Aim Assist', 'Aim Bot', 'Trigger Bot']); this.newFeature('AutoBhop', "2", ['Off', 'Auto Jump', 'Auto SlideJump']); this.newFeature('AutoReload', "3", []); this.newFeature('NoRecoil', "4", []); this.newFeature('AimDelta', "5", ['Off', 'Slow', 'Medium', 'Fast', 'MethHead']); this.newFeature('BurstShot', "6", []); this.newFeature('ForceScope', "7", []); this.newFeature('NoDeathDelay', "8", []); this.newFeature('SuperGun', '9', []); this.newFeature('SpinBot', '0', []); window.addEventListener("keydown", event => this.onKeyDown(event)); const interval = setInterval(() => { if (document.querySelector('#leaderDisplay') !== null) { clearInterval(interval); this.createInfoBox(); } }, 100); } onTick() { for (var i = 0, sz = this.features.length; i < sz; i++) { const feature = this.features[i]; switch (feature.name) { case 'AutoAim': if (feature.value) this.AutoAim(feature.value); break; case 'AutoReload': if (feature.value) this.wpnReload(); break; case 'NoRecoil': if (feature.value) this.self.recoilTweenY = this.self.recoilForce = 0; break; case 'AimDelta': this.world.config.deltaMlt = this.control.mouseDownR === 0 || feature.value === 0 ? 1 : feature.value === 1 ? .5 : feature.value === 2 ? .75 : feature.value === 3 ? 1.5 : feature.value === 4 ? 2 : 1; break; case 'SuperGun': if (feature.value) { this.settings.weaponIndex += this.control.mouseDownL == 1; if (this.settings.weaponIndex > this.world.weapons.length - 3) this.settings.weaponIndex = 0; this.self.weapon = this.world.weapons[this.settings.weaponIndex]; } break; case 'BurstShot': if (feature.value) this.self.weapon.shots = this.self.weapon.ammo; break; case 'AutoBhop': if (feature.value) this.AutoBhop(feature.value); break; case 'NoDeathDelay': if (feature.value && this.self && this.self.health === 0) { this.server.deathDelay = 0; this.world.players.forcePos(); //this.world.players.resetAim(); //this.world.updateUI(); } break; } } this.server.viewDist = 5000; // 2000 default this.world.config.impulseMlt = 3; //1 default / max 3 for (i = 0, sz = this.wpnClasses.length; i < sz; i++) { this.wpnClasses[i].speed = 1.05; // 1.05 max } } onUpdated(feature) { if (feature.container.length) { feature.value += 1; if (feature.value > feature.container.length - 1) { feature.value = 0; } feature.valueStr = feature.container[feature.value]; } else { feature.value ^= 1; feature.valueStr = feature.value ? "true" : "false"; } switch (feature.name) { case 'ForceScope': feature.value || this.self.weapon.name === "Sniper Rifle" || this.self.weapon.name === "Semi Auto" ? this.self.weapon.scope = 1 : delete this.self.weapon.scope; break; } window.saveVal(`utilities_${feature.name}`, feature.value); this.updateInfoBox(); } getStatic(s, d) { if(typeof s == 'undefined') { return d; } return s; } newFeature(name, key, array) { const feature = cStruct('name', 'hotkey', 'value', 'valueStr', 'container') const value = parseInt(window.getSavedVal(`utilities_${name}`) || 0); this.features.push(feature(name, key, value, array.length ? array[value] : value ? "true" : "false", array)); } getFeature(name) { for (const feature of this.features) { if (feature.name.toLowerCase() === name.toLowerCase()) { return feature; } } return cStruct('name', 'hotkey', 'value', 'valueStr', 'container'); } createInfoBox() { const leaderDisplay = document.querySelector('#leaderDisplay'); if (leaderDisplay) { var infoBox = document.createElement('div'); if (infoBox) infoBox.innerHTML = '<div> <style> #InfoBox { text-align: left; width: 310px; z-index: 3; padding: 10px; padding-left: 20px; padding-right: 20px; color: rgba(255, 255, 255, 0.7); line-height: 25px; margin-top: 0px; background-color: rgba(0, 0, 0, 0.3); } #InfoBox .utilitiesTitle { font-size: 16px; font-weight: bold; text-align: center; color: #1A72B8; margin-top: 5px; margin-bottom: 5px; } #InfoBox .leaderItem { font-size: 14px; } </style> <div id="InfoBox"></div> </div>'.trim(); leaderDisplay.parentNode.insertBefore(infoBox.firstChild, leaderDisplay.nextSibling); this.updateInfoBox(); } } upperCase(str) { return str.toUpperCase(); } toProperCase(str) { str = str.replace(/([a-z\xE0-\xFF])([A-Z\xC0\xDF])/g, '$1 $2'); str = str.replace(/\s[a-z]/g, this.upperCase) return str; } updateInfoBox() { const infoBox = document.querySelector('#InfoBox'); if (infoBox) { const lines = this.features.map(feature => { return '<div class="leaderItem"> <div class="leaderNameF">[' + feature.hotkey.toUpperCase() + '] ' + this.toProperCase(feature.name) + '</div> <div class="leaderScore">' + feature.valueStr + '</div> </div>'; }); infoBox.innerHTML = '<div class="utilitiesTitle">Krunkerio.org<hr>Krunkerio.net</div>' + lines.join('').trim(); } } onKeyDown(event) { if (document.activeElement.tagName === "INPUT") return; const key = event.key.toUpperCase(); switch (key) { case 'M': { const infoBox = document.querySelector('#InfoBox'); if (infoBox) infoBox.style.display = !infoBox.style.display || infoBox.style.display === "inline-block" ? "none" : "inline-block"; } break; case 'DELETE': this.resetSettings(); break; default: for (const feature of this.features) { if (feature.hotkey.toUpperCase() === key) { this.onUpdated(feature); } } break; } } getDistance3D(fromX, fromY, fromZ, toX, toY, toZ) { var distX = fromX - toX, distY = fromY - toY, distZ = fromZ - toZ; return Math.sqrt(distX * distX + distY * distY + distZ * distZ) } getDistance(player1, player2) { return this.getDistance3D(player1.x, player1.y, player1.z, player2.x, player2.y, player2.z); } getDirection(fromZ, fromX, toZ, toX) { return Math.atan2(fromX - toX, fromZ - toZ) } getXDir(fromX, fromY, fromZ, toX, toY, toZ) { var dirY = Math.abs(fromY - toY), dist = this.getDistance3D(fromX, fromY, fromZ, toX, toY, toZ); return Math.asin(dirY / dist) * (fromY > toY ? -1 : 1) } getAngleDist(start, end) { return Math.atan2(Math.sin(end - start), Math.cos(start - end)); } camLookAt(X, Y, Z) { var xdir = this.getXDir(this.control.object.position.x, this.control.object.position.y, this.control.object.position.z, X, Y, Z), ydir = this.getDirection(this.control.object.position.z, this.control.object.position.x, Z, X), camChaseDst = this.server.camChaseDst; this.control.target = { xD: xdir, yD: ydir, x: X + this.server.camChaseDst * Math.sin(ydir) * Math.cos(xdir), y: Y - this.server.camChaseDst * Math.sin(xdir), z: Z + this.server.camChaseDst * Math.cos(ydir) * Math.cos(xdir) } } AutoAim(value) { if (this.self.didShoot) { setTimeout(() => { this.self.aimVal = 1; this.world.players.resetAim(); this.settings.forceScope || this.self.weapon.name === "Sniper Rifle" || this.self.weapon.name === "Semi Auto" ? this.self.weapon.scope = 1 : delete this.self.weapon.scope; this.settings.canShoot = true; }, this.self.weapon.rate ); } const target = this.getTarget(); if (target) { switch (value) { case 1: /*Aim Assist*/ if (this.control.mouseDownR === 1) { this.lookAtHead(target); } break; case 2: /*Aim Bot*/ this.lookAtHead(target); if (this.control.mouseDownR === 0) { this.control.mouseDownR = 1; } break; case 3: /*Trigger Bot*/ if (this.control.mouseDownL === 1) { this.control.mouseDownL = 0; this.control.mouseDownR = 0; this.settings.scopingOut = true; } if (this.self.aimVal !== 1 || !this.settings.canShoot || this.self.recoilForce > 0.01 || this.control.mouseDownR === 1) { if (this.control.mouseDownL === 1) { this.control.mouseDownL = this.control.mouseDownR = 0; } this.control.target = null; } this.lookAtHead(target); if (this.control.mouseDownR === 0) { this.control.mouseDownR = 2; } else if (this.self.aimVal === 0 && this.settings.canShoot) { this.control.mouseDownL ^= 1; } break; } } else { this.wpnReload(this.getFeature('AutoReload').value && this.self.ammos[this.self.weaponIndex] < ((this.self.weapon.ammo / 2) + 1)); this.control.target = null; if (this.control.mouseDownR === 2) { setTimeout(() => { this.control.mouseDownR = 0; this.settings.canShoot = true; this.self.aimVal = 1; }, this.settings.targetCoolDown); } } } AutoBhop(value) { if (value) { this.control.keys[this.control.jumpKey] = this.self.onGround; if (value === 2) { if (this.settings.isSliding) { this.inputs[8] = 1; return; } if (this.self.yVel < -0.04 && this.self.canSlide) { this.settings.isSliding = true; setTimeout(() => { this.settings.isSliding = false; }, this.self.slideTimer); this.inputs[8] = 1; } } } } wpnReload(force = false) { const ammoLeft = this.self.ammos[this.self.weaponIndex]; if (force || ammoLeft === 0) this.world.players.reload(this.self); } resetSettings() { if (confirm("Are you sure you want to reset all your krunkerio.org settings? This will also refresh the page")) { Object.keys(window.localStorage).filter(x=>x.includes("utilities_")).forEach(x => window.localStorage.removeItem(x)); location.reload(); } } getTarget() { const enemies = this.world.players.list .filter(player => {return player.active && (player.inView || this.self.dmgReceived[player.id]) && !player.isYou && (!player.team || player.team !== this.self.team);}) .sort((p1, p2) => this.getDistance(this.self, p1) - this.getDistance(this.self, p2)); return enemies.length ? enemies[0] : null; } lookAtHead(target) { if (this.getFeature("SpinBot").value) this.spinTick(); this.camLookAt(target.x2, target.y2 + target.height - 1.5 - 2.5 * target.crouchVal - this.self.recoilAnimY * 0.3 * this.getDistance(this.self, target) * 0.6, target.z2); } spinTick() { //this.world.players.getSpin(this.self); //this.world.players.saveSpin(this.self, angle); const last = this.inputs[2]; const angle = this.getAngleDist(this.inputs[2], this.self.xDire); this.spins = this.getStatic(this.spins, new Array()); this.spinTimer= this.getStatic(this.spinTimer, this.server.spinTimer); this.serverTickRate = this.getStatic(this.serverTickRate, this.server.serverTickRate); (this.spins.unshift(angle), this.spins.length > this.spinTimer / this.serverTickRate && (this.spins.length = Math.round(this.spinTimer / this.serverTickRate))) for (var e = 0, i = 0; i < this.spins.length; ++i) e += this.spins[i]; const count = Math.abs(e * (180 / Math.PI)); if (count < 360) { this.inputs[2] = this.self.xDire + Math.PI; } else console.log('count', count); } inputsTick(self, inputs, world) { //Hooked if (this.control && this.exports && self && inputs && world) { this.inputs = inputs; this.world = world; this.self = self; this.server = this.exports.c[7].exports; this.functions = this.exports.c[8].exports; this.wpnClasses = this.exports.c[69].exports; this.onTick(); } } controlTick(control) { //Hooked if (control) { this.control = control; const half = Math.PI / 2; if (control.target) { control.object.rotation.y = control.target.yD; control.pitchObject.rotation.x = control.target.xD; control.pitchObject.rotation.x = Math.max(-half, Math.min(half, control.pitchObject.rotation.x)); control.yDr = control.pitchObject.rotation.x % Math.PI; control.xDr = control.object.rotation.y % Math.PI; } } } } function read(url) { return new Promise(resolve => { fetch(url).then(res => res.text()).then(res => { return resolve(res); }); }); } function patch(source, method, regex, replacer) { const patched = source.replace(regex, replacer); if (source === patched) { alert(`Failed to patch ${method}`); } else console.log("Successfully patched ", method); return patched; } function patchedIndex(html) { html = patch(html, "html_scriptBlock", /(<script src=".*?game.*?")(><\/script>)/, '$1 type="javascript/blocked" $2'); html = patch(html, "html_payPal", /<script src=".*?paypal.*?"><\/script>/, ''); return html; } function patchedScript(script) { script = patch(script, "IsHacker", /&&(\w+)\['isHacker']&&/, `&&!1&&`); script = patch(script, "LastHack", /&&(\w+)\['lastHack']&&/, `&&!1&&`); script = patch(script, 'WallHack', /if\(!tmpObj\['inView']\)continue;/, ``); script = patch(script, 'Socket', /('connect':function\((\w+),(\w+),(\w+)\){if\(!this\['(\w+)']\){)/, `$1 window.utilities.socket=this;`); script = patch(script, "Exports", /(\['__CANCEL__']=!(\w+),(\w+)\['exports']=(\w+);},function\((\w+),(\w+),(\w+)\){)(let)/, `$1window.utilities = new Utilities();window.utilities.exports=$7;$8`); script = patch(script, 'ControlTick', /{if\(this\['target']\){(.+?)}},this\['(\w+)']=/, `{window.utilities.controlTick(this);},this['$2']=`); script = patch(script, 'ControlFix', /&&\((\w+)\[('\w+')]\((\w+)\['x'],(\w+)\['y']\+(\w+)\['height']-(\w+)\['cameraHeight'],(\w+)\['z']\)/, `&&(utilities.camLookAt($3.x,$3.y+$3.height-$6.cameraHeight,$3.z)`); script = patch(script, "HasServer", /(this\['hasServer']=)(\w+)\?(\w+):(\w+)/, `$1 $2 = utilities.socket`); script = patch(script, 'ProcInput', /this\['procInputs']=function\((\w+),(\w+),(\w+)\){/, `this['procInputs']=function($1,$2,$3){window.utilities.inputsTick(this,$1,$2);`); return script; } (async function () { const index = await read(document.location.href); const build = index.match(/(?<=build=)[^"]+/)[0]; const patch = index.match(/"SOUND.play\(.+\)">v(.+)</)[1]; const script = await read(`/js/game.${build}.js`); console.log('Loading Krunker Hero ...'); window.stop(); document.open(); document.write(patchedIndex(index)); document.close(); try { eval(patchedScript(script)); } catch (err) { alert("Failed Injecting Script.'OK' to ReLoad."); location.reload(); } console.log('Successfully loaded Krunker Hero!'); })();
jeanp117
Math game made with React JS. Quick! Is 2 prime?
Heyiiiiiiiii
/ ==UserScript== // @name Sajan // @namespace https://github.com/TEAMOVERSONI // @version 1.8.4 // @description WheelChair // @author hrt x ttap x MasterP // @match *://krunker.io/* // @run-at document-start // @require https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js // @require https://krunkr.com/assets/js/canvas.gui.js?ver=0.6 // @grant none // ==/UserScript== WebFont.load({ google: { families: ['Roboto'] } }); (function () { const options = { aimbot: true, silentAim: false, boxEsp: true, boxColor: "rgba(244,100,80,1)", weaponEsp: true, healthEsp: true, nameEsp: true, chams: true, autoReload: true, autoJump: true, orgNameTags: false, aimThroughWalls: false, chamsColorStr: "rgba(255,0,0,1)", chamsRed: 255, chamsBlue: 0, chamsGreen: 0 }; window.options = options; const styles = { fontFamily: "Roboto", gui: { x: 0, y: 0, width: 250 }, itemHeight: 28, setup: { background: "#0B132B", color: "#4c698d", fontSize: "16px", header: { color: "#839cbc", fontSize: "20px", borderBottom: "#3A506B", paddingBottom: 20 }, steps: { background: "white", selected: "#5BC0BE", } }, profiles: { background: "#090F22", borderBottom: "#4c698d" }, folder: { header: { color: "#4c698d", fontSize: "15.4px", background: "#0B132B" } }, item: { color: "#839cbc", fontSize: "13.2px", background: "#1C2541" }, button: { background: "#1C2541", lineTop: "#5BC0BE", color: "#4c698d" }, checkbox: { background: "#242f53", checkedBg: "#5BC0BE", hovered: "rgba(91,192,190,0.3)" }, input: { background: "#242f53", color: "#4c698d", cursor: "#839cbc" }, select: { background: "#242f53", color: "#4c698d", hovered: "#3A506B" }, option: { background: "#242f53", color: "#4c698d", hovered: "#3A506B", hoveredColor: "white", outline: "#0B132B" }, slider: { background: "#242f53", color: "#5BC0BE", slider: "#5BC0BE", hovered: "#3A506B" } } let lastValues = {} var hideHook = function (fn, oFn) { fn.toString = oFn.toString.bind(oFn); } const menu = new MyGUI(false, 0, 0, 250, 250, styles, "wheelchair", 1) menu.remember(window.options) window.menu = menu; const poweredWheelAimbot = menu.addFolder("Aimbot", true) const poweredWheelVisuals = menu.addFolder("Visuals", true) poweredWheelAimbot.add("Aimbot", window.options, "aimbot", "Check") poweredWheelAimbot.add("Silent Aim", window.options, "silentAim", "Check") poweredWheelAimbot.add("Auto Reload", window.options, "autoReload", "Check") poweredWheelAimbot.add("Aim Through Walls", window.options, "aimThroughWalls", "Check") poweredWheelVisuals.add("Game Esp", window.options, "orgNameTags", "Check") .onChange((val) => { if (val) { window.options.nameEsp = false; window.options.boxEsp = false; window.options.weaponEsp = false; window.options.healthEsp = false; } }) poweredWheelVisuals.add("Name Esp", window.options, "nameEsp", "Check") .onChange((val) => { if (val && window.options.orgNameTags) window.options.orgNameTags = !window.options.orgNameTags }) poweredWheelVisuals.add("Box Esp", window.options, "boxEsp", "Check") .onChange((val) => { if (val && window.options.orgNameTags) window.options.orgNameTags = !window.options.orgNameTags }) poweredWheelVisuals.add("Weapon Esp", window.options, "weaponEsp", "Check") .onChange((val) => { if (val && window.options.orgNameTags) window.options.orgNameTags = !window.options.orgNameTags }) poweredWheelVisuals.add("Health Esp", window.options, "healthEsp", "Check") .onChange((val) => { if (val && window.options.orgNameTags) window.options.orgNameTags = !window.options.orgNameTags }) poweredWheelVisuals.add("Chams", window.options, "chams", "Check") poweredWheelVisuals.add("Box Color", window.options, "boxColor", "Color") poweredWheelVisuals.add("Chams Color", window.options, "chamsColorStr", "Color") .onChange((val) => { const { 1: r, 2: g, 3: b } = val.match(/rgba\((\d+),(\d+),(\d+),\d+\)/) window.options.chamsRed = (r - 0) / (255 - 0) window.options.chamsGreen = (g - 0) / (255 - 0) window.options.chamsBlue = (b - 0) / (255 - 0) }) window.hrtCheat = function (me, inputs, world, consts, math) { var controls = world.controls; const SHOOT = 5, SCOPE = 6, xDr = 3, yDr = 2, JUMP = 7, CROUCH = 8; var isEnemy = function (player) { return !me.team || player.team != me.team }; var canHit = function (player) { return null == (window.options.aimThroughWalls ? world.canHit(me, player.x3, player.y3 - player.crouchVal * consts.crouchDst, player.z3) : world.canSee(me, player.x3, player.y3 - player.crouchVal * consts.crouchDst, player.z3)) }; var normaliseYaw = function (yaw) { return (yaw % Math.PI2 + Math.PI2) % Math.PI2; }; var dAngleTo = function (x, y, z) { var ty = normaliseYaw(math.getDirection(controls.object.position.z, controls.object.position.x, z, x)); var tx = math.getXDir(controls.object.position.x, controls.object.position.y, controls.object.position.z, x, y, z); var oy = normaliseYaw(controls.object.rotation.y); var ox = controls.pitchObject.rotation.x; var dYaw = Math.min(Math.abs(ty - oy), Math.abs(ty - oy - Math.PI2), Math.abs(ty - oy + Math.PI2)); var dPitch = tx - ox; return Math.hypot(dYaw, dPitch); }; var calcAngleTo = function (player) { return dAngleTo(e.x3, e.y3 + consts.playerHeight - (consts.headScale + consts.hitBoxPad) / 2 - e.crouchVal * consts.crouchDst, e.z3); }; var calcDistanceTo = function (player) { return math.getDistance3D(player.x3, player.y3, player.z3, me.x, me.y, me.z) }; var isCloseEnough = function (player) { var distance = calcDistanceTo(player); return me.weapon.range >= distance && ("Shotgun" != me.weapon.name || distance < 70) && ("Akimbo Uzi" != me.weapon.name || distance < 100); }; var haveAmmo = function () { return me.ammos[me.weaponIndex]; }; // runs once if (!window.init) { window.init = true; /*************************************/ /* crimpeek / faster bullets removed */ /*************************************/ window.drawVisuals = function (c, scalingFactor, perspective) { if (!window.ctx) { window.ctx = c.getContext("2d") } c = window.ctx; var scaledWidth = c.canvas.width / scalingFactor; var scaledHeight = c.canvas.height / scalingFactor; var worldPosition = perspective.camera.getWorldPosition(); for (var i = 0; i < world.players.list.length; i++) { var player = world.players.list[i]; var e = players[i]; if (e.isYou || !e.active || !e.objInstances || !isEnemy(e)) { continue; } // find min x, max x, min y, max y // optimisation: we can already tell what ymin ymax is var xmin = Infinity; var xmax = -Infinity; var ymin = Infinity; var ymax = -Infinity; var br = false; for (var j = -1; !br && j < 2; j += 2) { for (var k = -1; !br && k < 2; k += 2) { for (var l = 0; !br && l < 2; l++) { var position = e.objInstances.position.clone(); position.x += j * consts.playerScale; position.z += k * consts.playerScale; position.y += l * (consts.playerHeight - e.crouchVal * consts.crouchDst); if (!perspective.frustum.containsPoint(position)) { br = true; break; } position.project(perspective.camera); xmin = Math.min(xmin, position.x); xmax = Math.max(xmax, position.x); ymin = Math.min(ymin, position.y); ymax = Math.max(ymax, position.y); } } } if (br) { continue; } xmin = (xmin + 1) / 2; ymin = (ymin + 1) / 2; xmax = (xmax + 1) / 2; ymax = (ymax + 1) / 2; c.save(); c.scale(scalingFactor, scalingFactor) // perfect box esp var distanceScale = Math.max(.3, 1 - math.getDistance3D(worldPosition.x, worldPosition.y, worldPosition.z, e.x, e.y, e.z) / 600); c.scale(distanceScale, distanceScale); var xScale = scaledWidth / distanceScale; var yScale = scaledHeight / distanceScale; ymin = yScale * (1 - ymin); ymax = yScale * (1 - ymax); xmin = xScale * xmin; xmax = xScale * xmax; if (window.options.boxEsp) { c.lineWidth = 5; c.strokeStyle = window.options.boxColor; c.beginPath(); c.moveTo(xmin, ymin); c.lineTo(xmin, ymax); c.lineTo(xmax, ymax); c.lineTo(xmax, ymin); c.lineTo(xmin, ymin); c.stroke(); } // health bar if (window.options.healthEsp) { c.fillStyle = "rgba(255,50,50,1)"; var barMaxHeight = ymax - ymin; c.fillRect(xmin - 7, ymin, -10, barMaxHeight); c.fillStyle = "#00FFFF"; c.fillRect(xmin - 7, ymin, -10, barMaxHeight * (e.health / e.maxHealth)); } // info var x = xmax + 7; var y = ymax; c.fillStyle = "white"; c.strokeStyle = 'black'; c.lineWidth = 1; if (window.options.nameEsp) { c.font = "60px Roboto"; c.fillText(e.name, x, y); c.strokeText(e.name, x, y); } c.font = "30px Sans-serif"; if (window.options.weaponEsp) { y += 35; c.fillText(e.weapon.name, x, y); c.strokeText(e.weapon.name, x, y); } if (window.options.healthEsp) { y += 35; c.fillText(e.health + ' HP', x, y); c.strokeText(e.health + ' HP', x, y); } c.restore(); // skelly chams // note: this should probably be else where - it affects all players var material = e.legMeshes[0].material; if (window.options.chams) { material.alphaTest = 1; material.depthTest = false; material.fog = false; material.emissive.r = window.options.chamsRed material.emissive.g = window.options.chamsGreen material.emissive.b = window.options.chamsBlue material.wireframe = true; } else if (!window.options.chams) { material.alphaTest = 0; material.depthTest = true; material.fog = true; material.emissive.r = 0; material.emissive.g = 0; material.emissive.b = 0; material.wireframe = false; } } } } // auto reload if (window.options.autoReload) controls.keys[controls.reloadKey] = !haveAmmo(); // auto jump if (window.options.autoJump) inputs[JUMP] = (controls.keys[controls.jumpKey] && !me.didJump) * 1; // target selector - based on closest to aim var closest = null, closestAngle = Infinity; var players = world.players.list; if (!window.options.aimbot) return; for (var i = 0; me.active && i < players.length; i++) { var e = players[i]; if (e.isYou || !e.active || !e.objInstances || !isEnemy(e)) { continue; } // experimental prediction // just use normal xyz values instead for potentially better aim :shrug: var scale = Math.min(1.6, e.dt / (consts.serverSendRate * consts.interpolation)); // this check is so that we don't shoot people that just respawn if (math.getDistance3D(e.x2, e.y2, e.z2, e.x, e.y, e.z) < 100) { e.x3 = e.x + (e.x2 - e.x) * scale; e.y3 = e.y + (e.y2 - e.y) * scale; e.z3 = e.z + (e.z2 - e.z) * scale; } else { e.x3 = e.x; e.y3 = e.y; e.z3 = e.z; } if (!isCloseEnough(e) || !canHit(e)) { continue; } var angle = calcAngleTo(e); if (angle < closestAngle) { closestAngle = angle; closest = e; } } // aimbot // hrt's big brain got a six pack var ty = controls.object.rotation.y, tx = controls.pitchObject.rotation.x; if (closest) { var target = closest; // No idea why public cheats are using target distance in aimbot calc // No idea why it's so difficult for people to not use magic numbers here var y = target.y3 + consts.playerHeight - (consts.headScale /* + consts.hitBoxPad*/ ) / 2 - target.crouchVal * consts.crouchDst; if (me.weapon.nAuto && me.didShoot) { inputs[SHOOT] = 0; } else if (!me.aimVal) { // me.recoilAnimY < 0.1 - if you want to shoot more slower and perhaps more accurately // inputs[CROUCH] = 1; // auto crouch inputs[SHOOT] = 1; inputs[SCOPE] = 1; } else { // inputs[CROUCH] = 1; // auto crouch inputs[SCOPE] = 1; } ty = math.getDirection(controls.object.position.z, controls.object.position.x, target.z3, target.x3); tx = math.getXDir(controls.object.position.x, controls.object.position.y, controls.object.position.z, target.x3, y, target.z3); // perfect recoil control..? tx -= .3 * me.recoilAnimY; } else { inputs[SHOOT] = controls.mouseDownL; inputs[SCOPE] = controls.mouseDownR; // inputs[CROUCH] = controls.keys[controls.crouchKey] * 1; // auto crouch } // silent aim const newY = (ty % Math.PI2).round(3); const newX = (tx % Math.PI2).round(3); inputs[xDr] = newX; inputs[yDr] = newY; if (!window.options.silentAim) { controls.object.rotation.y = newY controls.pitchObject.rotation.x = newX } } // only big iq people read this ttap#4547 // big up my boy hrt and ttap for releasing const handler = { construct(target, args) { if (args.length == 2 && args[1].includes('Seen')) { var script = args[1]; var hook = /(\w+)\['tmpInputs'\]\['push'\]\((\w+)\),/; var tokens = script.match(hook); var inputs = tokens[2]; var world = script.match(/(\w+)\['players'\]\['updateMesh'\]/)[1]; var consts = script.match(/(\w+)\['thirdPX'\],/)[1]; var me = script.match(/\((\w+)\|\|window\['spectating'\]\)/)[1]; var math = script.match(/\['xDr'\]\+(\w+)\['getDirection'\]/)[1]; var ttapParams = [me, inputs, world, consts, math]; // Doesn't make sense to hook aimbot anywhere else - unlike every other public cheat script = script.replace(hook, tokens[0] + '(' + hrtCheat.toString() + ')(' + ttapParams + '),'); //Remove clear rect inside overlay render. script = script.replace(/,\w+\['clearRect'\]\(0x0,0x0,\w+,\w+\)/, ""); //Hook overlay render and force menu to clear frame script = script.replace(/(\w+)\[\'render\'\]\((\w+),\w+,(\w+),\w+,\w+\),/, (a, b, c, d) => `window.menu.draw(${b}.canvas,true),(window.drawVisuals && window.drawVisuals(${b}.canvas,${c},${d})),${a} `); // remove renders script = script.replace(/'none'==menuHolder\['style'\]\['display'\]&&'none'==endUI\['style'\]\['display'\]\)/g, '!window.options.boxEsp && !window.options.weaponEsp && !window.options.healthEsp && !window.options.healthEsp)'); // all weapons trails on script = script.replace(/\w+\['weapon'\]&&\w+\['weapon'\]\['trail'\]/g, "true") // color blind mode script = script.replace(/#9eeb56/g, '#00FFFF'); // no zoom script = script.replace(/,'zoom':.+?(?=,)/g, ",'zoom':1"); // an extremely old canHit / autowall function creator that doesn't alter canSee // dumb asf but if it still works then should I touch it :thinking: var canSee = script.match(/this\['canSee'\]\=function.+?(?=return null;})/)[0] + "return null;}"; var canHit = canSee.replace(/canSee/g, "canHit"); canHit = canHit.replace(/\|\|0x0;/, "||0x0;var pcount=0;"); var player = canHit.match(/function\(([a-zA-Z0-9]*),/)[1]; var object = canHit.match(/([a-zA-Z0-9]*)\=this\['map'\]\['manager'\]\['objects'/)[1]; var statement = canHit.match(/\['transparent'\]\){(.+?(?=}))/)[1]; var ret = statement.match(/return [a-zA-Z0-9]*/)[0]; statement = statement.replace(ret, "{pcount+=1; if(pcount>1&&" + player + ".weapon.pierce>0.8){" + ret + "}}"); var search = canHit.match(/return [a-zA-Z0-9]*;\}/)[0]; canHit = canHit.replace(search, search + 'else if(' + object + '.active&&' + object + '.penetrable){' + statement + '}') search = canHit.match(/\![a-zA-Z0-9]*\['transparent'\]/)[0]; // todo: onhit logic doesn't make sense canHit = canHit.replace(search, "(!" + object + ".penetrable||!" + player + ".weapon.pierce)"); script = script.replace(",this['canSee']", "," + canHit + ",this['canSee']"); args[1] = script; } return new target(...args); } }; const decode = TextDecoder.prototype.decode; TextDecoder.prototype.decode = function () { var script = decode.apply(this, arguments); if (script.length > /*Lemons*/ 80000 && script[0] === '!') { var hook = /(\w+)\['tmpInputs'\]\['push'\]\((\w+)\),/; var tokens = script.match(hook); var inputs = tokens[2]; var world = script.match(/(\w+)\['players'\]\['updateMesh'\]/)[1]; var consts = script.match(/(\w+)\['thirdPX'\],/)[1]; var me = script.match(/\((\w+)\|\|window\['spectating'\]\)/)[1]; var math = script.match(/\['xDr'\]\+(\w+)\['getDirection'\]/)[1]; var ttapParams = [me, inputs, world, consts, math]; // Doesn't make sense to hook aimbot anywhere else - unlike every other public cheat script = script.replace(hook, (a, b) => { return `${a}window.hrtCheat(${ttapParams }),` }); //Remove clear rect inside overlay render. script = script.replace(/,\w+\['clearRect'\]\(0x0,0x0,\w+,\w+\)/, ""); //Hook overlay render and force menu to clear frame script = script.replace(/(\w+)\[\'render\'\]\((\w+),\w+,(\w+),\w+,\w+\),/, (a, b, c, d) => `window.menu.draw(window.ctx,true),(window.drawVisuals && window.drawVisuals(${b}.canvas,${c},${d})),${a} `); // remove renders script = script.replace(/'none'==menuHolder\['style'\]\['display'\]&&'none'==endUI\['style'\]\['display'\]\)/g, '!window.options.boxEsp && !window.options.weaponEsp && !window.options.healthEsp && !window.options.healthEsp)'); // all weapons trails on script = script.replace(/\w+\['weapon'\]&&\w+\['weapon'\]\['trail'\]/g, "true") // color blind mode script = script.replace(/#9eeb56/g, '#00FFFF'); // no zoom script = script.replace(/,'zoom':.+?(?=,)/g, ",'zoom':1"); // an extremely old canHit / autowall function creator that doesn't alter canSee // dumb asf but if it still works then should I touch it :thinking: var canSee = script.match(/this\['canSee'\]\=function.+?(?=return null;})/)[0] + "return null;}"; var canHit = canSee.replace(/canSee/g, "canHit"); canHit = canHit.replace(/\|\|0x0;/, "||0x0;var pcount=0;"); var player = canHit.match(/function\(([a-zA-Z0-9]*),/)[1]; var object = canHit.match(/([a-zA-Z0-9]*)\=this\['map'\]\['manager'\]\['objects'/)[1]; var statement = canHit.match(/\['transparent'\]\){(.+?(?=}))/)[1]; var ret = statement.match(/return [a-zA-Z0-9]*/)[0]; statement = statement.replace(ret, "{pcount+=1; if(pcount>1&&" + player + ".weapon.pierce>0.8){" + ret + "}}"); var search = canHit.match(/return [a-zA-Z0-9]*;\}/)[0]; canHit = canHit.replace(search, search + 'else if(' + object + '.active&&' + object + '.penetrable){' + statement + '}') search = canHit.match(/\![a-zA-Z0-9]*\['transparent'\]/)[0]; // todo: onhit logic doesn't make sense canHit = canHit.replace(search, "(!" + object + ".penetrable||!" + player + ".weapon.pierce)"); script = script.replace(",this['canSee']", "," + canHit + ",this['canSee']"); TextDecoder.prototype.decode = decode; } return script; } })()
ArmanIslam88
This is a simple JavaScript Guessing Game and i made this using js loop,condition and Math object.
braydentibbs32
// ==UserScript== // @name Krunker Powered WheelChair // @namespace https://github.com/hrt // @version 1.8.7 // @description WheelChair // @author hrt x ttap x MasterP // @match *://krunker.io/* // @run-at document-start // @require https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js // @require https://krunkr.com/assets/js/canvas.gui.js?ver=0.7 // @grant none // ==/UserScript== WebFont.load({ google: { families: ['Roboto'] } }); (function () { const options = { aimbot: true, silentAim: true, boxEsp: true, boxColor: "rgba(244,100,80,1)", weaponEsp: true, healthEsp: true, nameEsp: true, chams: true, autoReload: true, autoJump: true, orgNameTags: false, aimThroughWalls: false, chamsColorStr: "rgba(255,0,0,1)", chamsRed: 255, chamsBlue: 0, chamsGreen: 0, }; window.options = options; const styles = { fontFamily: "Roboto", itemHeight: 28, setup: { background: "#0B132B", color: "#4c698d", fontSize: "16px", header: { color: "#839cbc", fontSize: "20px", borderBottom: "#3A506B", paddingBottom: 20 }, steps: { background: "white", selected: "#5BC0BE", } }, profiles: { background: "#090F22", borderBottom: "#4c698d" }, folder: { header: { color: "#4c698d", fontSize: "15.4px", background: "#0B132B" } }, item: { color: "#839cbc", fontSize: "13.2px", background: "#1C2541" }, button: { background: "#1C2541", lineTop: "#5BC0BE", color: "#4c698d", hovered: "#5BC0BE", hoveredColor: "#242f53" }, checkbox: { background: "#242f53", checkedBg: "#5BC0BE", hovered: "rgba(91,192,190,0.3)", width: 18, height: 18 }, input: { background: "#242f53", color: "#4c698d", cursor: "#839cbc", width: 120, height: 22 }, select: { background: "#242f53", color: "#4c698d", hovered: "#3A506B", width: 80, height: 20, }, option: { background: "#242f53", color: "#4c698d", hovered: "#3A506B", hoveredColor: "white", outline: "#0B132B" }, slider: { background: "#242f53", color: "#5BC0BE", slider: "#5BC0BE", hovered: "#3A506B", width: 89, height: 20, leftPadding: 100, input: { width: 43, } } } const replace = String.prototype.replace; var hideHook = function (fn, oFn) { fn.toString = oFn.toString.bind(oFn); } const menu = new MyGUI(false, 0, 0, 250, 250, styles, "wheelchair", 1) menu.remember(window.options) window.menu = menu; const poweredWheelAimbot = menu.addFolder("Aimbot", true) const poweredWheelVisuals = menu.addFolder("Visuals", true) poweredWheelAimbot.add("Aimbot", window.options, "aimbot", "Check") poweredWheelAimbot.add("Silent Aim", window.options, "silentAim", "Check") poweredWheelAimbot.add("Auto Reload", window.options, "autoReload", "Check") poweredWheelAimbot.add("Aim Through Walls", window.options, "aimThroughWalls", "Check") poweredWheelVisuals.add("Game Esp", window.options, "orgNameTags", "Check") .onChange((val) => { if (val) { window.options.nameEsp = false; window.options.boxEsp = false; window.options.weaponEsp = false; window.options.healthEsp = false; } }) poweredWheelVisuals.add("Name Esp", window.options, "nameEsp", "Check") .onChange((val) => { if (val && window.options.orgNameTags) window.options.orgNameTags = !window.options.orgNameTags }) poweredWheelVisuals.add("Box Esp", window.options, "boxEsp", "Check") .onChange((val) => { if (val && window.options.orgNameTags) window.options.orgNameTags = !window.options.orgNameTags }) poweredWheelVisuals.add("Weapon Esp", window.options, "weaponEsp", "Check") .onChange((val) => { if (val && window.options.orgNameTags) window.options.orgNameTags = !window.options.orgNameTags }) poweredWheelVisuals.add("Health Esp", window.options, "healthEsp", "Check") .onChange((val) => { if (val && window.options.orgNameTags) window.options.orgNameTags = !window.options.orgNameTags }) poweredWheelVisuals.add("Chams", window.options, "chams", "Check") poweredWheelVisuals.add("Box Color", window.options, "boxColor", "Color") poweredWheelVisuals.add("Chams Color", window.options, "chamsColorStr", "Color") .onChange((val) => { const { 1: r, 2: g, 3: b } = val.match(/rgba\((\d+),(\d+),(\d+),\d+\)/) window.options.chamsRed = (r - 0) / (255 - 0) window.options.chamsGreen = (g - 0) / (255 - 0) window.options.chamsBlue = (b - 0) / (255 - 0) }) window.hrtCheat = function (me, inputs, world, consts, math) { var controls = world.controls; const SHOOT = 5, SCOPE = 6, xDr = 3, yDr = 2, JUMP = 7, CROUCH = 8; var isEnemy = function (player) { return !me.team || player.team != me.team }; var canHit = function (player) { return null == (window.options.aimThroughWalls ? world.canHit(me, player.x3, player.y3 - player.crouchVal * consts.crouchDst, player.z3) : world.canSee(me, player.x3, player.y3 - player.crouchVal * consts.crouchDst, player.z3)) }; var normaliseYaw = function (yaw) { return (yaw % Math.PI2 + Math.PI2) % Math.PI2; }; var dAngleTo = function (x, y, z) { var ty = normaliseYaw(math.getDir(controls.object.position.z, controls.object.position.x, z, x)); var tx = math.getXDire(controls.object.position.x, controls.object.position.y, controls.object.position.z, x, y, z); var oy = normaliseYaw(controls.object.rotation.y); var ox = controls.pchObjc.rotation.x; var dYaw = Math.min(Math.abs(ty - oy), Math.abs(ty - oy - Math.PI2), Math.abs(ty - oy + Math.PI2)); var dPitch = tx - ox; return Math.hypot(dYaw, dPitch); }; var calcAngleTo = function (player) { return dAngleTo(e.x3, e.y3 + consts.playerHeight - (consts.headScale + consts.hitBoxPad) / 2 - e.crouchVal * consts.crouchDst, e.z3); }; var calcDistanceTo = function (player) { return math.getD3D(player.x3, player.y3, player.z3, me.x, me.y, me.z) }; var isCloseEnough = function (player) { var distance = calcDistanceTo(player); return me.weapon.range >= distance && ("Shotgun" != me.weapon.name || distance < 70) && ("Akimbo Uzi" != me.weapon.name || distance < 100); }; var haveAmmo = function () { return me.ammos[me.weaponIndex]; }; // runs once if (!window.init) { window.init = true; /*************************************/ /* crimpeek / faster bullets removed */ /*************************************/ window.drawVisuals = function (c, scalingFactor, perspective) { if (!window.ctx) { window.ctx = c.getContext("2d") } c = window.ctx; var scaledWidth = c.canvas.width / scalingFactor; var scaledHeight = c.canvas.height / scalingFactor; var worldPosition = perspective.camera.getWorldPosition(); for (var i = 0; i < world.players.list.length; i++) { var player = world.players.list[i]; var e = players[i]; if (e.isYou || !e.active || !e.objInstances || !isEnemy(e)) { continue; } // find min x, max x, min y, max y // optimisation: we can already tell what ymin ymax is var xmin = Infinity; var xmax = -Infinity; var ymin = Infinity; var ymax = -Infinity; var br = false; for (var j = -1; !br && j < 2; j += 2) { for (var k = -1; !br && k < 2; k += 2) { for (var l = 0; !br && l < 2; l++) { var position = e.objInstances.position.clone(); position.x += j * consts.playerScale; position.z += k * consts.playerScale; position.y += l * (consts.playerHeight - e.crouchVal * consts.crouchDst); if (!perspective.frustum.containsPoint(position)) { br = true; break; } position.project(perspective.camera); xmin = Math.min(xmin, position.x); xmax = Math.max(xmax, position.x); ymin = Math.min(ymin, position.y); ymax = Math.max(ymax, position.y); } } } if (br) { continue; } xmin = (xmin + 1) / 2; ymin = (ymin + 1) / 2; xmax = (xmax + 1) / 2; ymax = (ymax + 1) / 2; c.save(); c.scale(scalingFactor, scalingFactor) // perfect box esp var distanceScale = Math.max(.3, 1 - math.getD3D(worldPosition.x, worldPosition.y, worldPosition.z, e.x, e.y, e.z) / 600); c.scale(distanceScale, distanceScale); var xScale = scaledWidth / distanceScale; var yScale = scaledHeight / distanceScale; ymin = yScale * (1 - ymin); ymax = yScale * (1 - ymax); xmin = xScale * xmin; xmax = xScale * xmax; if (window.options.boxEsp) { c.lineWidth = 5; c.strokeStyle = window.options.boxColor; c.beginPath(); c.moveTo(xmin, ymin); c.lineTo(xmin, ymax); c.lineTo(xmax, ymax); c.lineTo(xmax, ymin); c.lineTo(xmin, ymin); c.stroke(); } // health bar if (window.options.healthEsp) { c.fillStyle = "rgba(255,50,50,1)"; var barMaxHeight = ymax - ymin; c.fillRect(xmin - 7, ymin, -10, barMaxHeight); c.fillStyle = "#00FFFF"; c.fillRect(xmin - 7, ymin, -10, barMaxHeight * (e.health / e.maxHealth)); } // info var x = xmax + 7; var y = ymax; c.fillStyle = "white"; c.strokeStyle = 'black'; c.lineWidth = 1; if (window.options.nameEsp) { c.font = "60px Roboto"; c.fillText(e.name, x, y); c.strokeText(e.name, x, y); } c.font = "30px Sans-serif"; if (window.options.weaponEsp) { y += 35; c.fillText(e.weapon.name, x, y); c.strokeText(e.weapon.name, x, y); } if (window.options.healthEsp) { y += 35; c.fillText(e.health + ' HP', x, y); c.strokeText(e.health + ' HP', x, y); } c.restore(); // skelly chams // note: this should probably be else where - it affects all players var material = e.legMeshes[0].material; if (window.options.chams) { material.alphaTest = 1; material.depthTest = false; material.fog = false; material.emissive.r = window.options.chamsRed material.emissive.g = window.options.chamsGreen material.emissive.b = window.options.chamsBlue material.wireframe = true; } else if (!window.options.chams) { material.alphaTest = 0; material.depthTest = true; material.fog = true; material.emissive.r = 0; material.emissive.g = 0; material.emissive.b = 0; material.wireframe = false; } } } } // auto reload if (window.options.autoReload) controls.keys[controls.reloadKey] = !haveAmmo(); // auto jump if (window.options.autoJump) inputs[JUMP] = (controls.keys[controls.jumpKey] && !me.didJump) * 1; // target selector - based on closest to aim var closest = null, closestAngle = Infinity; var players = world.players.list; if (!window.options.aimbot) return; for (var i = 0; me.active && i < players.length; i++) { var e = players[i]; if (e.isYou || !e.active || !e.objInstances || !isEnemy(e)) { continue; } // experimental prediction // just use normal xyz values instead for potentially better aim :shrug: var scale = Math.min(1.6, e.dt / (consts.serverSendRate * consts.interpolation)); // this check is so that we don't shoot people that just respawn if (math.getD3D(e.x2, e.y2, e.z2, e.x, e.y, e.z) < 100) { e.x3 = e.x + (e.x2 - e.x) * scale; e.y3 = e.y + (e.y2 - e.y) * scale; e.z3 = e.z + (e.z2 - e.z) * scale; } else { e.x3 = e.x; e.y3 = e.y; e.z3 = e.z; } if (!isCloseEnough(e) || !canHit(e)) { continue; } var angle = calcAngleTo(e); if (angle < closestAngle) { closestAngle = angle; closest = e; } } // aimbot // hrt's big brain got a six pack var ty = controls.object.rotation.y, tx = controls.pchObjc.rotation.x; if (closest) { var target = closest; // No idea why public cheats are using target distance in aimbot calc // No idea why it's so difficult for people to not use magic numbers here var y = target.y3 + consts.playerHeight - (consts.headScale /* + consts.hitBoxPad*/ ) / 2 - target.crouchVal * consts.crouchDst; if (me.weapon.nAuto && me.didShoot) { inputs[SHOOT] = 0; } else if (!me.aimVal) { // me.recoilAnimY < 0.1 - if you want to shoot more slower and perhaps more accurately // inputs[CROUCH] = 1; // auto crouch inputs[SHOOT] = 1; inputs[SCOPE] = 1; } else { // inputs[CROUCH] = 1; // auto crouch inputs[SCOPE] = 1; } ty = math.getDir(controls.object.position.z, controls.object.position.x, target.z3, target.x3); tx = math.getXDire(controls.object.position.x, controls.object.position.y, controls.object.position.z, target.x3, y, target.z3); // perfect recoil control..? tx -= .3 * me.recoilAnimY; } else { inputs[SHOOT] = controls.mouseDownL; inputs[SCOPE] = controls.mouseDownR; // inputs[CROUCH] = controls.keys[controls.crouchKey] * 1; // auto crouch } // silent aim const newY = (ty % Math.PI2).round(3); const newX = (tx % Math.PI2).round(3); inputs[xDr] = newX; inputs[yDr] = newY; if (!window.options.silentAim) { controls.object.rotation.y = newY controls.pchObjc.rotation.x = newX } } // only big iq people read this ttap#4547 // big up my boy hrt and ttap for releasing const handler = { construct(target, args) { if (args.length == 2 && args[1].includes('Seen')) { var script = args[1]; // anti retard / version fix var version = script.match(/\w+\['exports'\]=(0[xX][0-9a-fA-F]+);/)[1]; if (version !== "0x14d41") { document.write('Version missmatch, wait for hrt'); document.write('Version missmatch ( ' + version + ')'); window.location.href = atob('aHR0cHM6Ly9naXRodWIuY29tL2hydC93aGVlbGNoYWly'); } var hook = /(\w+)\['tmpInputs'\]\['push'\]\((\w+)\),/; var tokens = script.match(hook); var inputs = tokens[2]; var world = script.match(/(\w+)\['players'\]\['updateMesh'\]/)[1]; var consts = script.match(/(\w+)\['thirdPX'\],/)[1]; var me = script.match(/\((\w+)\|\|window\['spectating'\]\)/)[1]; var math = script.match(/\['xDr'\]\+(\w+)\['getDir'\]/)[1]; var ttapParams = [me, inputs, world, consts, math]; // Doesn't make sense to hook aimbot anywhere else - unlike every other public cheat script = replace.call(script, hook, tokens[0] + '(' + hrtCheat.toString() + ')(' + ttapParams + '),'); //Remove clear rect inside overlay render. script = replace.call(script, /,\w+\['clearRect'\]\(0x0,0x0,\w+,\w+\)/, ""); // remove renders script = replace.call(script, /'none'==menuHolder\['style'\]\['display'\]&&'none'==endUI\['style'\]\['display'\]\)/g, '!window.options.boxEsp && !window.options.weaponEsp && !window.options.healthEsp && !window.options.healthEsp)'); //Hook overlay render and force menu to clear frame script = replace.call(script, /(\w+)\[\'render\'\]\((\w+),\w+,(\w+),\w+,\w+\),/, (a, b, c, d) => `window.menu.draw(${b}.canvas,true),(window.drawVisuals && window.drawVisuals(${b}.canvas,${c},${d})),${a} `); // all weapons trails on script = replace.call(script, /\w+\['weapon'\]&&\w+\['weapon'\]\['trail'\]/g, "true") // color blind mode script = replace.call(script, /#9eeb56/g, '#00FFFF'); // no zoom script = replace.call(script, /,'zoom':.+?(?=,)/g, ",'zoom':1"); // an extremely old canHit / autowall function creator that doesn't alter canSee // dumb asf but if it still works then should I touch it :thinking: var canSee = script.match(/this\['canSee'\]\=function.+?(?=return null;})/)[0] + "return null;}"; var canHit = replace.call(canSee, /canSee/g, "canHit"); canHit = replace.call(canHit, /\|\|0x0;/, "||0x0;var pcount=0;"); var player = canHit.match(/function\(([a-zA-Z0-9]*),/)[1]; var object = canHit.match(/([a-zA-Z0-9]*)\=this\['map'\]\['manager'\]\['objects'/)[1]; var statement = canHit.match(/\['transparent'\]\){(.+?(?=}))/)[1]; var ret = statement.match(/return [a-zA-Z0-9]*/)[0]; statement = replace.call(statement, ret, "{pcount+=1; if(pcount>1&&" + player + ".weapon.pierce>0.8){" + ret + "}}"); var search = canHit.match(/return [a-zA-Z0-9]*;\}/)[0]; canHit = replace.call(canHit, search, search + 'else if(' + object + '.active&&' + object + '.penetrable){' + statement + '}') search = canHit.match(/\![a-zA-Z0-9]*\['transparent'\]/)[0]; // todo: onhit logic doesn't make sense canHit = replace.call(canHit, search, "(!" + object + ".penetrable||!" + player + ".weapon.pierce)"); script = replace.call(script, ",this['canSee']", "," + canHit + ",this['canSee']"); args[1] = script; } return new target(...args); } }; // credits for bypass: https://github.com/hrt/ var original_Function = Function; Function = new Proxy(Function, handler); hideHook(Function, original_Function); })()
githubhack
/*The MIT License (MIT) Copyright (c) 2015 Apostolique Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ // ==UserScript== // @name AposBot // @namespace AposBot // @include http://agar.io/* // @version 3.568 // @grant none // @author http://www.twitch.tv/apostolique // ==/UserScript== var aposBotVersion = 3.568; //TODO: Team mode // Detect when people are merging // Split to catch smaller targets // Angle based cluster code // Better wall code // In team mode, make allies be obstacles. Number.prototype.mod = function(n) { return ((this % n) + n) % n; }; Array.prototype.peek = function() { return this[this.length - 1]; }; var sha = "efde0488cc2cc176db48dd23b28a20b90314352b"; function getLatestCommit() { window.jQuery.ajax({ url: "https://api.github.com/repos/apostolique/Agar.io-bot/git/refs/heads/master", cache: false, dataType: "jsonp" }).done(function(data) { console.dir(data["data"]); console.log("hmm: " + data["data"]["object"]["sha"]); sha = data["data"]["object"]["sha"]; function update(prefix, name, url) { window.jQuery(document.body).prepend("<div id='" + prefix + "Dialog' style='position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 100; display: none;'>"); window.jQuery('#' + prefix + 'Dialog').append("<div id='" + prefix + "Message' style='width: 350px; background-color: #FFFFFF; margin: 100px auto; border-radius: 15px; padding: 5px 15px 5px 15px;'>"); window.jQuery('#' + prefix + 'Message').append("<h2>UPDATE TIME!!!</h2>"); window.jQuery('#' + prefix + 'Message').append("<p>Grab the update for: <a id='" + prefix + "Link' href='" + url + "' target=\"_blank\">" + name + "</a></p>"); window.jQuery('#' + prefix + 'Link').on('click', function() { window.jQuery("#" + prefix + "Dialog").hide(); window.jQuery("#" + prefix + "Dialog").remove(); }); window.jQuery("#" + prefix + "Dialog").show(); } $.get('https://raw.githubusercontent.com/Apostolique/Agar.io-bot/master/bot.user.js?' + Math.floor((Math.random() * 1000000) + 1), function(data) { var latestVersion = data.replace(/(\r\n|\n|\r)/gm,""); latestVersion = latestVersion.substring(latestVersion.indexOf("// @version")+11,latestVersion.indexOf("// @grant")); latestVersion = parseFloat(latestVersion + 0.0000); var myVersion = parseFloat(aposBotVersion + 0.0000); if(latestVersion > myVersion) { update("aposBot", "bot.user.js", "https://github.com/Apostolique/Agar.io-bot/blob/" + sha + "/bot.user.js/"); } console.log('Current bot.user.js Version: ' + myVersion + " on Github: " + latestVersion); }); }).fail(function() {}); } getLatestCommit(); console.log("Running Apos Bot!"); var f = window; var g = window.jQuery; var aposBot = aposBot || {}; aposBot.name = "AposBot " + aposBotVersion; aposBot.mainLoop = function() {}; aposBot.utility = {}; var u = aposBot.utility; u.splitDistance = 710; console.log("Apos Bot!"); if (f.botList == null) { f.botList = []; g('#locationUnknown').append(g('<select id="bList" class="form-control" onchange="setBotIndex($(this).val());" />')); g('#locationUnknown').addClass('form-group'); } for (var i = f.botList.length - 1; i >= 0; i--) { if (f.botList[i][0] == "Human") { f.botList.splice(i, 1); } } //Given an angle value that was gotten from valueAndleBased(), //returns a new value that scales it appropriately. u.paraAngleValue = function(angleValue, range) { return (15 / (range[1])) * (angleValue * angleValue) - (range[1] / 6); }; u.valueAngleBased = function(angle, range) { var leftValue = (angle - range[0]).mod(360); var rightValue = (u.rangeToAngle(range) - angle).mod(360); var bestValue = Math.min(leftValue, rightValue); if (bestValue <= range[1]) { return u.paraAngleValue(bestValue, range); } return -1; }; u.computeDistance = function(x1, y1, x2, y2) { var xdis = x1 - x2; // <--- FAKE AmS OF COURSE! var ydis = y1 - y2; var distance = Math.sqrt(xdis * xdis + ydis * ydis); return distance; }; u.computeDistanceFromCircleEdge = function(x1, y1, x2, y2, s2) { var tempD = u.computeDistance(x1, y1, x2, y2); var offsetX = 0; var offsetY = 0; var ratioX = tempD / (x1 - x2); var ratioY = tempD / (y1 - y2); offsetX = x1 - (s2 / ratioX); offsetY = y1 - (s2 / ratioY); u.drawPoint(offsetX, offsetY, 5, ""); return u.computeDistance(x2, y2, offsetX, offsetY); }; u.compareSize = function(player1, player2, ratio) { if (player1.size * player1.size * ratio < player2.size * player2.size) { return true; } return false; }; u.canSplit = function(player1, player2) { return u.compareSize(player1, player2, 2.66) && !u.compareSize(player1, player2, 7); }; u.isItMe = function(player, cell) { if (u.getMode() == ":teams") { var currentColor = player[0].color; var currentRed = currentColor.substring(1,3); var currentGreen = currentColor.substring(3,5); var currentBlue = currentColor.substring(5,7); var currentTeam = u.getTeam(currentRed, currentGreen, currentBlue); var cellColor = cell.color; var cellRed = cellColor.substring(1,3); var cellGreen = cellColor.substring(3,5); var cellBlue = cellColor.substring(5,7); var cellTeam = getTeam(cellRed, cellGreen, cellBlue); if (currentTeam == cellTeam && !cell.isVirus()) { return true; } //console.log("COLOR: " + color); } else { for (var i = 0; i < player.length; i++) { if (cell.id == player[i].id) { return true; } } } return false; }; u.getTeam = function(red, green, blue) { if (red == "ff") { return 0; } else if (green == "ff") { return 1; } return 2; }; u.isFood = function(blob, cell) { if (!cell.isVirus() && u.compareSize(cell, blob, 1.33) || (cell.size <= 11)) { return true; } return false; } ; u.isThreat = function(blob, cell) { if (!cell.isVirus() && u.isFood(cell, blob)) { return true; } return false; /*if (!cell.isVirus() && compareSize(blob, cell, 1.33)) { return true; } return false;*/ }; u.isVirus = function(blob, cell) { if (cell.isVirus() && u.compareSize(cell, blob, 1.30)) { return true; } else if (cell.isVirus() && cell.color.substring(3,5).toLowerCase() != "ff") { return true; } return false; }; u.isSplitTarget = function(blob, cell) { /*if (u.canSplit(cell, blob)) { return true; }*/ return false; }; u.getTimeToRemerge = function(mass){ return ((mass*0.02) + 30); }; u.separateListBasedOnFunction = function(listToUse, blob) { var foodElementList = []; var threatList = []; var virusList = []; var splitTargetList = []; var player = u.getPlayer(); Object.keys(listToUse).forEach(function(element, index) { var isMe = u.isItMe(player, listToUse[element]); if (!isMe) { if (u.isFood(blob, listToUse[element])/* && listToUse[element].isNotMoving()*/) { //IT'S FOOD! foodElementList.push(listToUse[element]); if (u.isSplitTarget(blob, listToUse[element])) { u.drawCircle(listToUse[element].x, listToUse[element].y, listToUse[element].size + 50, 7); u.splitTargetList.push(listToUse[element]); } } else if (u.isThreat(blob, listToUse[element])) { //IT'S DANGER! threatList.push(listToUse[element]); } else if (u.isVirus(blob, listToUse[element])) { //IT'S VIRUS! virusList.push(listToUse[element]); } }/*else if(isMe && (getBlobCount(getPlayer()) > 0)){ //Attempt to make the other cell follow the mother one foodElementList.push(listToUse[element]); }*/ }); foodList = []; for (var i = 0; i < foodElementList.length; i++) { foodList.push([foodElementList[i].x, foodElementList[i].y, foodElementList[i].size]); } return [foodList, threatList, virusList, splitTargetList]; }; u.getAll = function(blob) { var dotList = []; var player = u.getPlayer(); var interNodes = u.getMemoryCells(); dotList = u.separateListBasedOnFunction(interNodes, blob); return dotList; }; u.clusterFood = function(foodList, blobSize) { var clusters = []; var addedCluster = false; //1: x //2: y //3: size or value //4: Angle, not set here. for (var i = 0; i < foodList.length; i++) { for (var j = 0; j < clusters.length; j++) { if (u.computeDistance(foodList[i][0], foodList[i][1], clusters[j][0], clusters[j][1]) < blobSize * 1.5) { clusters[j][0] = (foodList[i][0] + clusters[j][0]) / 2; clusters[j][1] = (foodList[i][1] + clusters[j][1]) / 2; clusters[j][2] += foodList[i][2]; addedCluster = true; break; } } if (!addedCluster) { clusters.push([foodList[i][0], foodList[i][1], foodList[i][2], 0]); } addedCluster = false; } return clusters; }; u.getAngle = function(x1, y1, x2, y2) { //Handle vertical and horizontal lines. if (x1 == x2) { if (y1 < y2) { return 271; //return 89; } else { return 89; } } return (Math.round(Math.atan2(-(y1 - y2), -(x1 - x2)) / Math.PI * 180 + 180)); }; u.slope = function(x1, y1, x2, y2) { var m = (y1 - y2) / (x1 - x2); return m; }; u.slopeFromAngle = function(degree) { if (degree == 270) { degree = 271; } else if (degree == 90) { degree = 91; } return Math.tan((degree - 180) / 180 * Math.PI); }; //Given two points on a line, finds the slope of a perpendicular line crossing it. u.inverseSlope = function(x1, y1, x2, y2) { var m = slope(x1, y1, x2, y2); return (-1) / m; }; //Given a slope and an offset, returns two points on that line. u.pointsOnLine = function(slope, useX, useY, distance) { var b = useY - slope * useX; var r = Math.sqrt(1 + slope * slope); var newX1 = (useX + (distance / r)); var newY1 = (useY + ((distance * slope) / r)); var newX2 = (useX + ((-distance) / r)); var newY2 = (useY + (((-distance) * slope) / r)); return [ [newX1, newY1], [newX2, newY2] ]; }; u.followAngle = function(angle, useX, useY, distance) { var slope = u.slopeFromAngle(angle); var coords = u.pointsOnLine(slope, useX, useY, distance); var side = (angle - 90).mod(360); if (side < 180) { return coords[1]; } else { return coords[0]; } }; //Using a line formed from point a to b, tells if point c is on S side of that line. u.isSideLine = function(a, b, c) { if ((b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]) > 0) { return true; } return false; }; //angle range2 is within angle range2 //an Angle is a point and a distance between an other point [5, 40] u.angleRangeIsWithin = function(range1, range2) { if (range2[0] == (range2[0] + range2[1]).mod(360)) { return true; } //console.log("r1: " + range1[0] + ", " + range1[1] + " ... r2: " + range2[0] + ", " + range2[1]); var distanceFrom0 = (range1[0] - range2[0]).mod(360); var distanceFrom1 = (range1[1] - range2[0]).mod(360); if (distanceFrom0 < range2[1] && distanceFrom1 < range2[1] && distanceFrom0 < distanceFrom1) { return true; } return false; }; u.angleRangeIsWithinInverted = function(range1, range2) { var distanceFrom0 = (range1[0] - range2[0]).mod(360); var distanceFrom1 = (range1[1] - range2[0]).mod(360); if (distanceFrom0 < range2[1] && distanceFrom1 < range2[1] && distanceFrom0 > distanceFrom1) { return true; } return false; }; u.angleIsWithin = function(angle, range) { var diff = (u.rangeToAngle(range) - angle).mod(360); if (diff >= 0 && diff <= range[1]) { return true; } return false; }; u.rangeToAngle = function(range) { return (range[0] + range[1]).mod(360); }; u.anglePair = function(range) { return (range[0] + ", " + u.rangeToAngle(range) + " range: " + range[1]); }; u.computeAngleRanges = function(blob1, blob2) { var mainAngle = u.getAngle(blob1.x, blob1.y, blob2.x, blob2.y); var leftAngle = (mainAngle - 90).mod(360); var rightAngle = (mainAngle + 90).mod(360); var blob1Left = u.followAngle(leftAngle, blob1.x, blob1.y, blob1.size); var blob1Right = u.followAngle(rightAngle, blob1.x, blob1.y, blob1.size); var blob2Left = u.followAngle(rightAngle, blob2.x, blob2.y, blob2.size); var blob2Right = u.followAngle(leftAngle, blob2.x, blob2.y, blob2.size); var blob1AngleLeft = u.getAngle(blob2.x, blob2.y, blob1Left[0], blob1Left[1]); var blob1AngleRight = u.getAngle(blob2.x, blob2.y, blob1Right[0], blob1Right[1]); var blob2AngleLeft = u.getAngle(blob1.x, blob1.y, blob2Left[0], blob2Left[1]); var blob2AngleRight = u.getAngle(blob1.x, blob1.y, blob2Right[0], blob2Right[1]); var blob1Range = (blob1AngleRight - blob1AngleLeft).mod(360); var blob2Range = (blob2AngleRight - blob2AngleLeft).mod(360); var tempLine = u.followAngle(blob2AngleLeft, blob2Left[0], blob2Left[1], 400); //drawLine(blob2Left[0], blob2Left[1], tempLine[0], tempLine[1], 0); if ((blob1Range / blob2Range) > 1) { drawPoint(blob1Left[0], blob1Left[1], 3, ""); drawPoint(blob1Right[0], blob1Right[1], 3, ""); drawPoint(blob1.x, blob1.y, 3, "" + blob1Range + ", " + blob2Range + " R: " + (Math.round((blob1Range / blob2Range) * 1000) / 1000)); } //drawPoint(blob2.x, blob2.y, 3, "" + blob1Range); }; u.debugAngle = function(angle, text) { var player = u.getPlayer(); var line1 = u.followAngle(angle, player[0].x, player[0].y, 300); u.drawLine(player[0].x, player[0].y, line1[0], line1[1], 5); u.drawPoint(line1[0], line1[1], 5, "" + text); }; //TODO: Don't let this function do the radius math. u.getEdgeLinesFromPoint = function(blob1, blob2, radius) { var px = blob1.x; var py = blob1.y; var cx = blob2.x; var cy = blob2.y; //var radius = blob2.size; /*if (blob2.isVirus()) { radius = blob1.size; } else if(canSplit(blob1, blob2)) { radius += splitDistance; } else { radius += blob1.size * 2; }*/ var shouldInvert = false; var tempRadius = u.computeDistance(px, py, cx, cy); if (tempRadius <= radius) { radius = tempRadius - 5; shouldInvert = true; } var dx = cx - px; var dy = cy - py; var dd = Math.sqrt(dx * dx + dy * dy); var a = Math.asin(radius / dd); var b = Math.atan2(dy, dx); var t = b - a; var ta = { x: radius * Math.sin(t), y: radius * -Math.cos(t) }; t = b + a; var tb = { x: radius * -Math.sin(t), y: radius * Math.cos(t) }; var angleLeft = u.getAngle(cx + ta.x, cy + ta.y, px, py); var angleRight = u.getAngle(cx + tb.x, cy + tb.y, px, py); var angleDistance = (angleRight - angleLeft).mod(360); /*if (shouldInvert) { var temp = angleLeft; angleLeft = (angleRight + 180).mod(360); angleRight = (temp + 180).mod(360); angleDistance = (angleRight - angleLeft).mod(360); }*/ return [angleLeft, angleDistance, [cx + tb.x, cy + tb.y], [cx + ta.x, cy + ta.y] ]; }; u.invertAngle = function(range) { var angle1 = u.rangeToAngle(badAngles[i]); var angle2 = (badAngles[i][0] - angle1).mod(360); return [angle1, angle2]; }; u.addWall = function(listToUse, blob) { //var mapSizeX = Math.abs(f.getMapStartX - f.getMapEndX); //var mapSizeY = Math.abs(f.getMapStartY - f.getMapEndY); //var distanceFromWallX = mapSizeX/3; //var distanceFromWallY = mapSizeY/3; var distanceFromWallY = 2000; var distanceFromWallX = 2000; if (blob.x < f.getMapStartX() + distanceFromWallX) { //LEFT //console.log("Left"); listToUse.push([ [90, true], [270, false], u.computeDistance(getMapStartX(), blob.y, blob.x, blob.y) ]); var lineLeft = u.followAngle(90, blob.x, blob.y, 190 + blob.size); var lineRight = u.followAngle(270, blob.x, blob.y, 190 + blob.size); u.drawLine(blob.x, blob.y, lineLeft[0], lineLeft[1], 5); u.drawLine(blob.x, blob.y, lineRight[0], lineRight[1], 5); u.drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob.x, blob.y, 5); } if (blob.y < getMapStartY() + distanceFromWallY) { //TOP //console.log("TOP"); listToUse.push([ [180, true], [0, false], u.computeDistance(blob.x, getMapStartY, blob.x, blob.y) ]); var lineLeft = u.followAngle(180, blob.x, blob.y, 190 + blob.size); var lineRight = u.followAngle(360, blob.x, blob.y, 190 + blob.size); u.drawLine(blob.x, blob.y, lineLeft[0], lineLeft[1], 5); u.drawLine(blob.x, blob.y, lineRight[0], lineRight[1], 5); u.drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob.x, blob.y, 5); } if (blob.x > getMapEndX() - distanceFromWallX) { //RIGHT //console.log("RIGHT"); listToUse.push([ [270, true], [90, false], u.computeDistance(getMapEndX(), blob.y, blob.x, blob.y) ]); var lineLeft = u.followAngle(270, blob.x, blob.y, 190 + blob.size); var lineRight = u.followAngle(90, blob.x, blob.y, 190 + blob.size); u.drawLine(blob.x, blob.y, lineLeft[0], lineLeft[1], 5); u.drawLine(blob.x, blob.y, lineRight[0], lineRight[1], 5); u.drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob.x, blob.y, 5); } if (blob.y > getMapEndY() - distanceFromWallY) { //BOTTOM //console.log("BOTTOM"); listToUse.push([ [0, true], [180, false], u.computeDistance(blob.x, getMapEndY(), blob.x, blob.y) ]); var lineLeft = u.followAngle(0, blob.x, blob.y, 190 + blob.size); var lineRight = u.followAngle(180, blob.x, blob.y, 190 + blob.size); u.drawLine(blob.x, blob.y, lineLeft[0], lineLeft[1], 5); u.drawLine(blob.x, blob.y, lineRight[0], lineRight[1], 5); u.drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob.x, blob.y, 5); } return listToUse; }; //listToUse contains angles in the form of [angle, boolean]. //boolean is true when the range is starting. False when it's ending. //range = [[angle1, true], [angle2, false]] u.getAngleIndex = function(listToUse, angle) { if (listToUse.length == 0) { return 0; } for (var i = 0; i < listToUse.length; i++) { if (angle <= listToUse[i][0]) { return i; } } return listToUse.length; }; u.addAngle = function(listToUse, range) { //#1 Find first open element //#2 Try to add range1 to the list. If it is within other range, don't add it, set a boolean. //#3 Try to add range2 to the list. If it is withing other range, don't add it, set a boolean. //TODO: Only add the new range at the end after the right stuff has been removed. var newListToUse = listToUse.slice(); var startIndex = 1; if (newListToUse.length > 0 && !newListToUse[0][1]) { startIndex = 0; } var startMark = u.getAngleIndex(newListToUse, range[0][0]); var startBool = startMark.mod(2) != startIndex; var endMark = u.getAngleIndex(newListToUse, range[1][0]); var endBool = endMark.mod(2) != startIndex; var removeList = []; if (startMark != endMark) { //Note: If there is still an error, this would be it. var biggerList = 0; if (endMark == newListToUse.length) { biggerList = 1; } for (var i = startMark; i < startMark + (endMark - startMark).mod(newListToUse.length + biggerList); i++) { removeList.push((i).mod(newListToUse.length)); } } else if (startMark < newListToUse.length && endMark < newListToUse.length) { var startDist = (newListToUse[startMark][0] - range[0][0]).mod(360); var endDist = (newListToUse[endMark][0] - range[1][0]).mod(360); if (startDist < endDist) { for (var i = 0; i < newListToUse.length; i++) { removeList.push(i); } } } removeList.sort(function(a, b){return b-a;}); for (var i = 0; i < removeList.length; i++) { newListToUse.splice(removeList[i], 1); } if (startBool) { newListToUse.splice(u.getAngleIndex(newListToUse, range[0][0]), 0, range[0]); } if (endBool) { newListToUse.splice(u.getAngleIndex(newListToUse, range[1][0]), 0, range[1]); } return newListToUse; }; u.getAngleRange = function(blob1, blob2, index, radius) { var angleStuff = u.getEdgeLinesFromPoint(blob1, blob2, radius); var leftAngle = angleStuff[0]; var rightAngle = u.rangeToAngle(angleStuff); var difference = angleStuff[1]; u.drawPoint(angleStuff[2][0], angleStuff[2][1], 3, ""); u.drawPoint(angleStuff[3][0], angleStuff[3][1], 3, ""); //console.log("Adding badAngles: " + leftAngle + ", " + rightAngle + " diff: " + difference); var lineLeft = u.followAngle(leftAngle, blob1.x, blob1.y, 150 + blob1.size - index * 10); var lineRight = u.followAngle(rightAngle, blob1.x, blob1.y, 150 + blob1.size - index * 10); if (blob2.isVirus()) { u.drawLine(blob1.x, blob1.y, lineLeft[0], lineLeft[1], 6); u.drawLine(blob1.x, blob1.y, lineRight[0], lineRight[1], 6); u.drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob1.x, blob1.y, 6); } else if(getCells().hasOwnProperty(blob2.id)) { u.drawLine(blob1.x, blob1.y, lineLeft[0], lineLeft[1], 0); u.drawLine(blob1.x, blob1.y, lineRight[0], lineRight[1], 0); u.drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob1.x, blob1.y, 0); } else { u.drawLine(blob1.x, blob1.y, lineLeft[0], lineLeft[1], 3); u.drawLine(blob1.x, blob1.y, lineRight[0], lineRight[1], 3); u.drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob1.x, blob1.y, 3); } return [leftAngle, difference]; }; //Given a list of conditions, shift the angle to the closest available spot respecting the range given. u.shiftAngle = function(listToUse, angle, range) { //TODO: shiftAngle needs to respect the range! DONE? for (var i = 0; i < listToUse.length; i++) { if (u.angleIsWithin(angle, listToUse[i])) { //console.log("Shifting needed!"); var angle1 = listToUse[i][0]; var angle2 = u.rangeToAngle(listToUse[i]); var dist1 = (angle - angle1).mod(360); var dist2 = (angle2 - angle).mod(360); if (dist1 < dist2) { if (u.angleIsWithin(angle1, range)) { return angle1; } else { return angle2; } } else { if (u.angleIsWithin(angle2, range)) { return angle2; } else { return angle1; } } } } //console.log("No Shifting Was needed!"); return angle; }; /** * This is the main bot logic. This is called quite often. * @param followMouse Is a boolean. If set to true, it means the user is asking for the bot to follow the mouse coordinates. * @return A 2 dimensional array with coordinates for every cells. [[x, y], [x, y]] */ u.findDestination = function(followMouse) { var player = getPlayer(); var interNodes = getMemoryCells(); //console.warn("findDestination(followMouse) was called from line " + arguments.callee.caller.toString()); if ( /*!toggle*/ 1) { //The following code converts the mouse position into an //absolute game coordinate. var useMouseX = u.screenToGameX(getMouseX()); var useMouseY = u.screenToGameY(getMouseY()); tempPoint = [useMouseX, useMouseY, 1]; //The current destination that the cells were going towards. var tempMoveX = getPointX(); var tempMoveY = getPointY(); //This variable will be returned at the end. //It will contain the destination choices for all the cells. //BTW!!! ERROR ERROR ABORT MISSION!!!!!!! READ BELOW ----------- // //SINCE IT'S STUPID NOW TO ASK EACH CELL WHERE THEY WANT TO GO, //THE BOT SHOULD SIMPLY PICK ONE AND THAT'S IT, I MEAN WTF.... var destinationChoices = []; //destination, size, danger //Just to make sure the player is alive. if (player.length > 0) { //Loop through all the player's cells. for (var k = 0; k < player.length; k++) { if (true) { u.drawPoint(player[k].x, player[k].y + player[k].size, 0, "" + (getLastUpdate() - player[k].birth) + " / " + (30000 + (player[k].birthMass * 57) - (getLastUpdate() - player[k].birth)) + " / " + player[k].birthMass); } } //Loops only for one cell for now. for (var k = 0; /*k < player.length*/ k < 1; k++) { //console.log("Working on blob: " + k); u.drawCircle(player[k].x, player[k].y, player[k].size + u.splitDistance, 5); //drawPoint(player[0].x, player[0].y - player[0].size, 3, "" + Math.floor(player[0].x) + ", " + Math.floor(player[0].y)); //var allDots = processEverything(interNodes); //loop through everything that is on the screen and //separate everything in it's own category. var allIsAll = u.getAll(player[k]); //The food stored in element 0 of allIsAll var allPossibleFood = allIsAll[0]; //The threats are stored in element 1 of allIsAll var allPossibleThreats = allIsAll[1]; //The viruses are stored in element 2 of allIsAll var allPossibleViruses = allIsAll[2]; //The bot works by removing angles in which it is too //dangerous to travel towards to. var badAngles = []; var obstacleList = []; var isSafeSpot = true; var isMouseSafe = true; var clusterAllFood = u.clusterFood(allPossibleFood, player[k].size); //console.log("Looking for enemies!"); //Loop through all the cells that were identified as threats. for (var i = 0; i < allPossibleThreats.length; i++) { var enemyDistance = u.computeDistanceFromCircleEdge(allPossibleThreats[i].x, allPossibleThreats[i].y, player[k].x, player[k].y, allPossibleThreats[i].size); allPossibleThreats[i].enemyDist = enemyDistance; } /*allPossibleThreats.sort(function(a, b){ return a.enemyDist-b.enemyDist; })*/ for (var i = 0; i < allPossibleThreats.length; i++) { var enemyDistance = u.computeDistance(allPossibleThreats[i].x, allPossibleThreats[i].y, player[k].x, player[k].y); var splitDangerDistance = allPossibleThreats[i].size + u.splitDistance + 150; var normalDangerDistance = allPossibleThreats[i].size + 150; var shiftDistance = player[k].size; //console.log("Found distance."); var enemyCanSplit = u.canSplit(player[k], allPossibleThreats[i]); for (var j = clusterAllFood.length - 1; j >= 0 ; j--) { var secureDistance = (enemyCanSplit ? splitDangerDistance : normalDangerDistance); if (u.computeDistance(allPossibleThreats[i].x, allPossibleThreats[i].y, clusterAllFood[j][0], clusterAllFood[j][1]) < secureDistance) clusterAllFood.splice(j, 1); } //console.log("Removed some food."); if (enemyCanSplit) { u.drawCircle(allPossibleThreats[i].x, allPossibleThreats[i].y, splitDangerDistance, 0); u.drawCircle(allPossibleThreats[i].x, allPossibleThreats[i].y, splitDangerDistance + shiftDistance, 6); } else { u.drawCircle(allPossibleThreats[i].x, allPossibleThreats[i].y, normalDangerDistance, 3); u.drawCircle(allPossibleThreats[i].x, allPossibleThreats[i].y, normalDangerDistance + shiftDistance, 6); } if (allPossibleThreats[i].danger && getLastUpdate() - allPossibleThreats[i].dangerTimeOut > 1000) { allPossibleThreats[i].danger = false; } /*if ((enemyCanSplit && enemyDistance < splitDangerDistance) || (!enemyCanSplit && enemyDistance < normalDangerDistance)) { allPossibleThreats[i].danger = true; allPossibleThreats[i].dangerTimeOut = f.getLastUpdate(); }*/ //console.log("Figured out who was important."); if ((enemyCanSplit && enemyDistance < splitDangerDistance) || (enemyCanSplit && allPossibleThreats[i].danger)) { badAngles.push(u.getAngleRange(player[k], allPossibleThreats[i], i, splitDangerDistance).concat(allPossibleThreats[i].enemyDist)); } else if ((!enemyCanSplit && enemyDistance < normalDangerDistance) || (!enemyCanSplit && allPossibleThreats[i].danger)) { badAngles.push(u.getAngleRange(player[k], allPossibleThreats[i], i, normalDangerDistance).concat(allPossibleThreats[i].enemyDist)); } else if (enemyCanSplit && enemyDistance < splitDangerDistance + shiftDistance) { var tempOb = u.getAngleRange(player[k], allPossibleThreats[i], i, splitDangerDistance + shiftDistance); var angle1 = tempOb[0]; var angle2 = u.rangeToAngle(tempOb); obstacleList.push([[angle1, true], [angle2, false]]); } else if (!enemyCanSplit && enemyDistance < normalDangerDistance + shiftDistance) { var tempOb = u.getAngleRange(player[k], allPossibleThreats[i], i, normalDangerDistance + shiftDistance); var angle1 = tempOb[0]; var angle2 = u.rangeToAngle(tempOb); obstacleList.push([[angle1, true], [angle2, false]]); } //console.log("Done with enemy: " + i); } //console.log("Done looking for enemies!"); var goodAngles = []; var stupidList = []; for (var i = 0; i < allPossibleViruses.length; i++) { if (player[k].size < allPossibleViruses[i].size) { u.drawCircle(allPossibleViruses[i].x, allPossibleViruses[i].y, allPossibleViruses[i].size + 10, 3); u.drawCircle(allPossibleViruses[i].x, allPossibleViruses[i].y, allPossibleViruses[i].size * 2, 6); } else { u.drawCircle(allPossibleViruses[i].x, allPossibleViruses[i].y, player[k].size + 50, 3); u.drawCircle(allPossibleViruses[i].x, allPossibleViruses[i].y, player[k].size * 2, 6); } } for (var i = 0; i < allPossibleViruses.length; i++) { var virusDistance = u.computeDistance(allPossibleViruses[i].x, allPossibleViruses[i].y, player[k].x, player[k].y); if (player[k].size < allPossibleViruses[i].size) { if (virusDistance < (allPossibleViruses[i].size * 2)) { var tempOb = u.getAngleRange(player[k], allPossibleViruses[i], i, allPossibleViruses[i].size + 10); var angle1 = tempOb[0]; var angle2 = u.rangeToAngle(tempOb); obstacleList.push([[angle1, true], [angle2, false]]); } } else { if (virusDistance < (player[k].size * 2)) { var tempOb = u.getAngleRange(player[k], allPossibleViruses[i], i, player[k].size + 50); var angle1 = tempOb[0]; var angle2 = u.rangeToAngle(tempOb); obstacleList.push([[angle1, true], [angle2, false]]); } } } if (badAngles.length > 0) { //NOTE: This is only bandaid wall code. It's not the best way to do it. stupidList = u.addWall(stupidList, player[k]); } for (var i = 0; i < badAngles.length; i++) { var angle1 = badAngles[i][0]; var angle2 = u.rangeToAngle(badAngles[i]); stupidList.push([[angle1, true], [angle2, false], badAngles[i][2]]); } //stupidList.push([[45, true], [135, false]]); //stupidList.push([[10, true], [200, false]]); stupidList.sort(function(a, b){ //console.log("Distance: " + a[2] + ", " + b[2]); return a[2]-b[2]; }); //console.log("Added random noob stuff."); var sortedInterList = []; var sortedObList = []; for (var i = 0; i < stupidList.length; i++) { //console.log("Adding to sorted: " + stupidList[i][0][0] + ", " + stupidList[i][1][0]); var tempList = u.addAngle(sortedInterList, stupidList[i]); if (tempList.length == 0) { console.log("MAYDAY IT'S HAPPENING!"); break; } else { sortedInterList = tempList; } } for (var i = 0; i < obstacleList.length; i++) { sortedObList = u.addAngle(sortedObList, obstacleList[i]); if (sortedObList.length == 0) { break; } } var offsetI = 0; var obOffsetI = 1; if (sortedInterList.length > 0 && sortedInterList[0][1]) { offsetI = 1; } if (sortedObList.length > 0 && sortedObList[0][1]) { obOffsetI = 0; } var goodAngles = []; var obstacleAngles = []; for (var i = 0; i < sortedInterList.length; i += 2) { var angle1 = sortedInterList[(i + offsetI).mod(sortedInterList.length)][0]; var angle2 = sortedInterList[(i + 1 + offsetI).mod(sortedInterList.length)][0]; var diff = (angle2 - angle1).mod(360); goodAngles.push([angle1, diff]); } for (var i = 0; i < sortedObList.length; i += 2) { var angle1 = sortedObList[(i + obOffsetI).mod(sortedObList.length)][0]; var angle2 = sortedObList[(i + 1 + obOffsetI).mod(sortedObList.length)][0]; var diff = (angle2 - angle1).mod(360); obstacleAngles.push([angle1, diff]); } for (var i = 0; i < goodAngles.length; i++) { var line1 = u.followAngle(goodAngles[i][0], player[k].x, player[k].y, 100 + player[k].size); var line2 = u.followAngle((goodAngles[i][0] + goodAngles[i][1]).mod(360), player[k].x, player[k].y, 100 + player[k].size); u.drawLine(player[k].x, player[k].y, line1[0], line1[1], 1); u.drawLine(player[k].x, player[k].y, line2[0], line2[1], 1); u.drawArc(line1[0], line1[1], line2[0], line2[1], player[k].x, player[k].y, 1); //drawPoint(player[0].x, player[0].y, 2, ""); u.drawPoint(line1[0], line1[1], 0, "" + i + ": 0"); u.drawPoint(line2[0], line2[1], 0, "" + i + ": 1"); } for (var i = 0; i < obstacleAngles.length; i++) { var line1 = u.followAngle(obstacleAngles[i][0], player[k].x, player[k].y, 50 + player[k].size); var line2 = u.followAngle((obstacleAngles[i][0] + obstacleAngles[i][1]).mod(360), player[k].x, player[k].y, 50 + player[k].size); u.drawLine(player[k].x, player[k].y, line1[0], line1[1], 6); u.drawLine(player[k].x, player[k].y, line2[0], line2[1], 6); u.drawArc(line1[0], line1[1], line2[0], line2[1], player[k].x, player[k].y, 6); //drawPoint(player[0].x, player[0].y, 2, ""); u.drawPoint(line1[0], line1[1], 0, "" + i + ": 0"); u.drawPoint(line2[0], line2[1], 0, "" + i + ": 1"); } if (followMouse && goodAngles.length == 0) { //This is the follow the mouse mode var distance = u.computeDistance(player[k].x, player[k].y, tempPoint[0], tempPoint[1]); var shiftedAngle = u.shiftAngle(obstacleAngles, u.getAngle(tempPoint[0], tempPoint[1], player[k].x, player[k].y), [0, 360]); var destination = u.followAngle(shiftedAngle, player[k].x, player[k].y, distance); destinationChoices = destination; u.drawLine(player[k].x, player[k].y, destination[0], destination[1], 1); //tempMoveX = destination[0]; //tempMoveY = destination[1]; } else if (goodAngles.length > 0) { var bIndex = goodAngles[0]; var biggest = goodAngles[0][1]; for (var i = 1; i < goodAngles.length; i++) { var size = goodAngles[i][1]; if (size > biggest) { biggest = size; bIndex = goodAngles[i]; } } var perfectAngle = (bIndex[0] + bIndex[1] / 2).mod(360); perfectAngle = u.shiftAngle(obstacleAngles, perfectAngle, bIndex); var line1 = u.followAngle(perfectAngle, player[k].x, player[k].y, verticalDistance()); destinationChoices = line1; u.drawLine(player[k].x, player[k].y, line1[0], line1[1], 7); //tempMoveX = line1[0]; //tempMoveY = line1[1]; } else if (badAngles.length > 0 && goodAngles == 0) { //When there are enemies around but no good angles //You're likely screwed. (This should never happen.) console.log("Failed"); destinationChoices = [tempMoveX, tempMoveY]; /*var angleWeights = [] //Put weights on the angles according to enemy distance for (var i = 0; i < allPossibleThreats.length; i++){ var dist = computeDistance(player[k].x, player[k].y, allPossibleThreats[i].x, allPossibleThreats[i].y); var angle = getAngle(allPossibleThreats[i].x, allPossibleThreats[i].y, player[k].x, player[k].y); angleWeights.push([angle,dist]); } var maxDist = 0; var finalAngle = 0; for (var i = 0; i < angleWeights.length; i++){ if (angleWeights[i][1] > maxDist){ maxDist = angleWeights[i][1]; finalAngle = (angleWeights[i][0] + 180).mod(360); } } var line1 = followAngle(finalAngle,player[k].x,player[k].y,f.verticalDistance()); drawLine(player[k].x, player[k].y, line1[0], line1[1], 2); destinationChoices.push(line1);*/ } else if (clusterAllFood.length > 0) { for (var i = 0; i < clusterAllFood.length; i++) { //console.log("mefore: " + clusterAllFood[i][2]); //This is the cost function. Higher is better. var clusterAngle = u.getAngle(clusterAllFood[i][0], clusterAllFood[i][1], player[k].x, player[k].y); clusterAllFood[i][2] = clusterAllFood[i][2] * 6 - u.computeDistance(clusterAllFood[i][0], clusterAllFood[i][1], player[k].x, player[k].y); //console.log("Current Value: " + clusterAllFood[i][2]); //(goodAngles[bIndex][1] / 2 - (Math.abs(perfectAngle - clusterAngle))); clusterAllFood[i][3] = clusterAngle; u.drawPoint(clusterAllFood[i][0], clusterAllFood[i][1], 1, ""); //console.log("After: " + clusterAllFood[i][2]); } var bestFoodI = 0; var bestFood = clusterAllFood[0][2]; for (var i = 1; i < clusterAllFood.length; i++) { if (bestFood < clusterAllFood[i][2]) { bestFood = clusterAllFood[i][2]; bestFoodI = i; } } //console.log("Best Value: " + clusterAllFood[bestFoodI][2]); var distance = u.computeDistance(player[k].x, player[k].y, clusterAllFood[bestFoodI][0], clusterAllFood[bestFoodI][1]); var shiftedAngle = u.shiftAngle(obstacleAngles, u.getAngle(clusterAllFood[bestFoodI][0], clusterAllFood[bestFoodI][1], player[k].x, player[k].y), [0, 360]); var destination = u.followAngle(shiftedAngle, player[k].x, player[k].y, distance); destinationChoices = destination; //tempMoveX = destination[0]; //tempMoveY = destination[1]; u.drawLine(player[k].x, player[k].y, destination[0], destination[1], 1); } else { //If there are no enemies around and no food to eat. destinationChoices = [tempMoveX, tempMoveY]; } u.drawPoint(tempPoint[0], tempPoint[1], tempPoint[2], ""); //drawPoint(tempPoint[0], tempPoint[1], tempPoint[2], "" + Math.floor(computeDistance(tempPoint[0], tempPoint[1], I, J))); //drawLine(tempPoint[0], tempPoint[1], player[0].x, player[0].y, 6); //console.log("Slope: " + slope(tempPoint[0], tempPoint[1], player[0].x, player[0].y) + " Angle: " + getAngle(tempPoint[0], tempPoint[1], player[0].x, player[0].y) + " Side: " + (getAngle(tempPoint[0], tempPoint[1], player[0].x, player[0].y) - 90).mod(360)); tempPoint[2] = 1; //console.log("Done working on blob: " + i); } //TODO: Find where to go based on destinationChoices. /*var dangerFound = false; for (var i = 0; i < destinationChoices.length; i++) { if (destinationChoices[i][2]) { dangerFound = true; break; } } destinationChoices.sort(function(a, b){return b[1] - a[1]}); if (dangerFound) { for (var i = 0; i < destinationChoices.length; i++) { if (destinationChoices[i][2]) { tempMoveX = destinationChoices[i][0][0]; tempMoveY = destinationChoices[i][0][1]; break; } } } else { tempMoveX = destinationChoices.peek()[0][0]; tempMoveY = destinationChoices.peek()[0][1]; //console.log("Done " + tempMoveX + ", " + tempMoveY); }*/ } //console.log("MOVING RIGHT NOW!"); //console.log("______Never lied ever in my life."); return destinationChoices; } }; /** * A conversion from the screen's horizontal coordinate system * to the game's horizontal coordinate system. * @param x in the screen's coordinate system * @return x in the game's coordinate system */ u.screenToGameX = function(x) { return (x - getWidth() / 2) / getRatio() + getX(); }; /** * A conversion from the screen's vertical coordinate system * to the game's vertical coordinate system. * @param y in the screen's coordinate system * @return y in the game's coordinate system */ u.screenToGameY = function(y) { return (y - getHeight() / 2) / getRatio() + getY(); }; u.drawPoint = function(x_1, y_1, drawColor, text) { f.drawPoint(x_1, y_1, drawColor, text); }; u.drawArc = function(x_1, y_1, x_2, y_2, x_3, y_3, drawColor) { f.drawArc(x_1, y_1, x_2, y_2, x_3, y_3, drawColor); }; u.drawLine = function(x_1, y_1, x_2, y_2, drawColor) { f.drawLine(x_1, y_1, x_2, y_2, drawColor); }; u.drawCircle = function(x_1, y_1, radius, drawColor) { f.drawCircle(x_1, y_1, radius, drawColor); }; /** * Some horse shit of some sort. * @return Horse Shit */ u.screenDistance = function() { var temp = f.getScreenDistance(); return temp; }; /** * Tells you if the game is in Dark mode. * @return Boolean for dark mode. */ u.getDarkBool = function() { return f.getDarkBool(); }; /** * Tells you if the mass is shown. * @return Boolean for player's mass. */ u.getMassBool = function() { return f.getMassBool(); }; /** * This is a copy of everything that is shown on screen. * Normally stuff will time out when off the screen, this * memorizes everything that leaves the screen for a little * while longer. * @return The memory object. */ u.getMemoryCells = function() { return f.getMemoryCells(); }; /** * [getCellsArray description] * @return {[type]} [description] */ u.getCellsArray = function() { return f.getCellsArray(); }; /** * This is the original "getMemoryCells" without the memory part. * @return Non memorized object. */ u.getCells = function() { return f.getCells(); }; /** * Returns an array with all the player's cells. * @return Player's cells */ u.getPlayer = function () { return f.getPlayer(); }; /** * The canvas' width. * @return Integer Width */ u.getWidth = function() { return f.getWidth(); }; /** * The canvas' height * @return Integer Height */ u.getHeight = function() { return f.getHeight(); }; /** * Scaling ratio of the canvas. The bigger this ration, * the further that you see. * @return Screen scaling ratio. */ u.getRatio = function() { return f.getRatio(); }; /** * [getOffsetX description] * @return {[type]} [description] */ u.getOffsetX = function() { return f.getOffsetX(); }; u.getOffsetY = function() { return f.getOffsetY(); }; u.getX = function() { return f.getX(); }; u.getY = function() { return f.getY(); }; u.getPointX = function() { return f.getPointX(); }; u.getPointY = function() { return f.getPointY(); }; /** * The X location of the mouse. * @return Integer X */ u.getMouseX = function() { return f.getMouseX(); }; /** * The Y location of the mouse. * @return Integer Y */ u.getMouseY = function() { return f.getMouseY(); }; /** * A timestamp since the last time the server sent any data. * @return Last update timestamp */ u.getUpdate = function() { return f.getLastUpdate(); }; /** * The game's current mode. (":ffa", ":experimental", ":teams". ":party") * @return {[type]} [description] */ u.getMode = function() { return f.getMode(); }; f.botList.push(["AposBot " + aposBotVersion, u.findDestination]); u.bList = g('#bList'); g('<option />', {value: (f.botList.length - 1), text: "AposBot"}).appendTo(bList);
Traziy
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('j 3E(a,b){6.2G[a]=b;1o(n c=0,d=0;d<2;d++)6.2G[d]&&c++;0==c?$("#2w").1j(\'<u T="1Z">0 / 2</u>\'):$("#2w").1j(\'<u T="25">\'+c+" / 2</u>")}j 5a(){1o(n a=0;a<2;a++)6.2G[a]=!1,6.1K[a]=1a 4n(4X.4S(1a 4T(["("+3N()+")()"],{2n:"1R/3I"}))),6.1K[a].46=j(a){n b=a.2m;2k(b.o){q"39":3E(b.F,!0),1M(!0,"1m"+b.F,b.1w,"#5j",!0),1i("1m"+b.F,b.x,b.y);t;q"2b":3E(b.F,!1),3x("1m"+b.F);t;q"18":1i("1m"+b.F,b.x,b.y);t;3d:S.P("4q 1V 4r 4C 1m")}},6.1K[a].1l({o:"F",F:a});2K()}j 58(){1o(n a=0;a<3;a++)6.1W[a]=1a 4n(4X.4S(1a 4T(["("+3N()+")()"],{2n:"1R/3I"}))),6.1W[a].1l({o:"F",F:a})}j 1E(a){1o(i 3M 6.1K)6.1K[i].1l(a)}j 2N(a){1o(i 3M 6.1W)6.1W[i].1l(a)}j 3e(){n f=1a 2J;f.2a("2I","/1F.r.1p",!0),f.1U=j(){n k=f.2L;k=p(k,"l(h.m&&h.m.2x)","6.2H();l(h.m&&h.m.2x)"),k=p(k,"l(h.m&&h.m.2U)","6.2r();l(h.m&&h.m.2U)"),k=p(k,"l(h.m&&h.m.1n)","6.1n();l(h.m&&h.m.1n)"),k=p(k,"1C:j(a){","1C:j(a){6.4O(a);"),k=p(k,"53:j(){","53:j(){6.54();"),k=p(k,"l(h.m&&h.m.2z)","6.2o();l(h.m&&h.m.2z)"),k=p(k,"3c:j(a){","3c:j(a){6.56(a);"),k=L(k,/(\\w\\[\\w\\+(\\d+)>>3]=(\\w);\\w\\[\\w\\+(\\d+)>>3]=(\\w);\\w\\[\\w\\+(\\d+)>>3]=(\\w);\\w\\[\\w\\+(\\d+)>>3]=(\\w);)/i,"$1 l(6.1Q){6.1Q($3,$5,$7,$9,$2,$8);}"),k=L(k,/([\\w$]+\\(\\d+,\\w\\[\\w>>2\\]\\|0,(\\+\\w),(\\+\\w)\\)\\|0;[\\w$]+\\(\\d+,\\w\\[\\w>>2\\]\\|0,\\+-(\\+\\w\\[\\w\\+\\d+>>3\\]),\\+-(\\+\\w\\[\\w\\+\\d+>>3\\])\\)\\|0;)/i,"$1 6.1B=$4; 6.1x=$5;"),k=p(k,"4x:j(a,b){","4x:j(a,b){l(6.2j){a = $(\'#1z\').U() / 2; b = $(\'#1z\').2E() / 2;}"),k=L(k,/l\\((\\+\\w\\[\\w>>3\\])<1\\.0\\){/i,"l($1 < 6.59){"),k=L(k,/(l\\(\\w<=)(20\\.0)(\\){\\w=\\w;v})(l\\(!\\w\\){l\\(\\(\\w\\[\\d+\\]\\|0\\)!=\\(\\w\\[\\d+\\]\\|0\\)\\){\\w=\\w;v}l\\(\\(\\w\\[\\w\\+\\d+>>0\\]\\|0\\)!=0\\?\\(\\w\\[\\w>>0\\]\\|0\\)==0:0\\){\\w=\\w;v}})/i,"$5h.0$3"),k=L(k,/(\\w)(=\\+\\w\\[\\w>>3\\]\\*\\+\\w\\()(.\\d)(,\\+\\w\\);)/i,"$1$2 (6.4D||0.9) $4 6.37=$1;"),k=L(k,/(\\w=\\w\\[\\w>>2\\]\\|0;)((\\w\\[\\w>>3\\])=(\\w);)(\\w\\[\\w>>0\\]=a\\[\\w>>0\\];)/i,"$1 l(!6.4z){$3 = 6.37;}5m{$2}$5"),k=L(k,/((\\w)=(\\+\\(\\(\\w\\[\\w\\+\\d+>>\\d.*;)(\\w)=(\\+\\(\\(\\w\\[.*\\/2\\|\\d\\)\\|0\\)\\/\\w\\+\\s\\+\\w\\[\\w\\+\\d+>>3\\];).*\\4=\\4<\\w\\?\\w:\\w;)/,"6.34 = $3 6.33 = $5 $1"),3q(k)},f.2T()}j 2c(){$("#3D").5i()}j 4f(){n a=V.1O("G");a.K="1t",a.N.4l=\'2Q:5g(0,0,0,0.4)5f("4o://5k.5n.5e/1t.5l");2Q-3L:1L%1L%;U:3V;2E:3V;41:2v;4c:2v;18:5o;z-5d:1;5c-61:22;\',$(V.2D).3C(a);n b=V.1O("G");b.K="3D",$("#1t").3C(b)}j 1M(a,b,c,d,e){l(b=b.O("#",""),b=b.O("/",""),!$("#"+b).17){n f=V.1O("G");f.K=b,f.N.4l="4d-4s:50%;2i-1N:-3J;2i-2W:-3J;U:1r;2E:1r;18:3O;T:"+d+";2Q-T:"+d+";"+(e?"":"1G:22;"),$(a?"#1t":"#3D").3C(f),3b(b,c)}}j 3x(a){a=a.O("#",""),a=a.O("/",""),$("#"+a).2b()}j 1i(a,b,c){a=a.O("#",""),a=a.O("/","");n d=(b+2Y)/4i*1L,e=(c+2Y)/4i*1L;$("#"+a).5Z({2W:d+"%",1N:e+"%"})}j 1y(a,b){a=a.O("#",""),a=a.O("/",""),b?$("#"+a).1h():$("#"+a).1d()}j 3b(a,b){a=a.O("#",""),a=a.O("/",""),$("#"+a).1j(\'<G N="u-3L:1r;4c:1r;18:3O;u-4J: 3w, 4e;U:5Y;2W:\'+-((2t(b,"1r 3w, 4e")-10)/2)+\'5U">\'+b+"</G>")}j L(a,b,c){n d=1a 4u(b);v d.4g(a)?a=a.O(b,c):S.P("[2l] Y O: "+b),a}j p(a,b,c){v a.21(b)!=-1?a=a.O(b,c):S.P("[2l] Y O: "+b),a}j 1f(a){B!=1A&&1A.5T("1V",a)}j 4p(){1A=30.1C("5p://66.31.85.67:6i",{6l:!0,6a:"6c="+1s}),1A.2M("1V",j(a){l(B==a.o)v 1u S.P("6d a 1V 4E 5v o.");2k(a.o){q"5u-5D":2c(),3n(!0),6.2g&&1f({o:"4L",1b:6.1b});t;q"39":1M(!1,a.2A,a.1b,"#5E",!0),1i(a.2A,a.x,a.y);t;q"2b":3x(a.2A);t;q"18":1i(a.2A,a.x,a.y);t;q"5P-5Q":$("#2w").1j(\'<u T="25">\'+a+"</u>");t;3d:v 1u S.P("5K a 1V 4E 5G 5F o: "+a.o)}}),1A.2M("3B",j(a){"J"==a.o&&(6.2O=a.J),2N(a)}),1A.2M("1Y",j(){2c(),2N({o:"1Y"})})}j 2K(){1E({o:"2P",14:6.14}),1f({o:"2P",14:6.14})}j 38(a){l(1u 0===a)v B;l(a.21(",")>-1){n b=a.1c(",");1o(o 3M b)l(b[o].17<=0||b[o].17>15)v B;v b}v a.17>0&&a.17<=15?[a]:B}j 4W(){1f({o:"1c"}),1E({o:"1c"})}j 4I(){1f({o:"1H"}),1E({o:"1H"})}j 4m(){n a=6.34,b=6.33;6.2h||(a=6.1B,b=6.1x),1E({o:"18",x:a+6.1e,y:b+6.1g}),1f({o:"18",x:6.13,y:6.19,5I:a+6.1e,5J:b+6.1g})}j 3n(a){(a||2S!=6.J)&&(2S=6.J,1f({o:"J",J:2S}))}j 3N(){v j(){j L(a,b,c){n d=1a 4u(b);v d.4g(a)?a=a.O(b,c):S.P("[2l] Y O: "+b),a}j p(a,b,c){v a.21(b)!=-1?a=a.O(b,c):S.P("[2l] Y O: "+b),a}j 3P(a,b){v 2F.4b(2F.4t()*(b-a+1))+a}j 3g(){n e=1a 2J;e.2a("2I","4o://4R.30/1F.r.1p",!0),e.1U=j(){n k=e.2L;k=L(k,/\\w+\\.3X\\.5H/g,\'"4R.30"\'),k=p(k,"1q","Z"),k=p(k,"c.4B=j(a){S.P(a)};","c.4B=j(a){};"),k=p(k,\'S.P("5L");\',""),k=L(k,/(\\w)=\\+\\(\\(\\w\\[\\w\\+\\d+>>\\d.*;(\\w)=\\+\\(\\(\\w\\[.*\\/2\\|\\d\\)\\|0\\)\\/\\w\\+\\s\\+\\w\\[\\w\\+\\d+>>3\\];/,"$1 = 6.36; $2 = 6.3a;"),k=p(k,"l(h.m&&h.m.2x)","6.2H();l(h.m&&h.m.2x)"),k=p(k,"l(h.m&&h.m.2U)","6.2r();l(h.m&&h.m.2U)"),k=p(k,"l(h.m&&h.m.1n)","6.1n();l(h.m&&h.m.1n)"),k=p(k,"l(h.m&&h.m.2z)","6.2o();l(h.m&&h.m.2z)"),k=p(k,"h.m&&h.m.4K","6.2y();h.m&&h.m.4K"),k=L(k,/(\\w\\[\\w\\+(\\d+)>>3]=(\\w);\\w\\[\\w\\+(\\d+)>>3]=(\\w);\\w\\[\\w\\+(\\d+)>>3]=(\\w);\\w\\[\\w\\+(\\d+)>>3]=(\\w);)/i,"$1 l(6.1Q){6.1Q($3,$5,$7,$9,$2,$8);}"),k=L(k,/([\\w$]+\\(\\d+,\\w\\[\\w>>2\\]\\|0,(\\+\\w),(\\+\\w)\\)\\|0;[\\w$]+\\(\\d+,\\w\\[\\w>>2\\]\\|0,\\+-(\\+\\w\\[\\w\\+\\d+>>3\\]),\\+-(\\+\\w\\[\\w\\+\\d+>>3\\])\\)\\|0;)/i,"$1 6.1B=$4; 6.1x=$5;"),3q(k)},e.2T(B)}Z.5O=1,Z.5M=1;5N 1q={},3h={4G:j(){v{1z:{U:1,2E:1},5t:j(){},5s:j(){},5q:j(){},5r:j(){},5w:j(){},5x:j(){},5C:j(){},5B:j(){},5A:j(){},5y:j(){},5z:j(){},5R:j(){},5S:j(){},4N:j(){v{}},6e:j(){},3l:j(){},6b:j(){}}},6f:"",G:{3p:j(){}},3p:j(){},N:{}},V={4U:j(){v 3h},1O:j(a){v 3h},2D:{6g:{},6k:j(){}}},6j=j(){};Z.6={J:B,F:0,1w:"3Q",1B:0,1x:0,36:0,3a:0,13:B,19:B,1S:2Y,1e:0,1g:0,2u:!1,1Q:j(a,b,c,d,e,f){f-e==24&&c-a>2B&&d-b>2B&&(C.1e=C.1S-c,C.1g=C.1S-d,C.2u=!0)},2r:j(){1l({o:"2b",F:6.F})},2H:j(){1l({o:"39",F:6.F,1w:6.1w,x:6.13,y:6.19})},2o:j(){1l({o:"2b",F:6.F}),Z.r&&r.1C(6.J)},2y:j(){Z.r&&Z.r.6h(),3g()},1n:j(){B!=6.J&&Z.r&&r.1C(6.J)}},46=j(a){n b=a.2m;2k(b.o){q"F":6.F=b.F;t;q"J":6.J=b.J,Z.r&&r.1C(b.J);t;q"18":6.36=b.x-6.1e,6.3a=b.y-6.1g;t;q"1c":r.1c();t;q"1H":r.1H();t;q"2P":l(B==b.14){6.1w="3Q";t}6.1w=b.14[3P(0,b.14.17-1)];t;q"1Y":6.J=B,Z.r&&r.1Y(),S.P("5X 1m 5W");t;3d:S.P("4q 5V 4r.")}},1v(j(){6.13=6.1e+6.1B,6.19=6.1g+6.1x,1l({F:6.F,o:"18",x:6.13,y:6.19}),Z.r&&r.3c(6.1w)},1L),3g()}.64()}1q.63.62("","","/"+3X.60),1q.2t=j(a,b){n c=2t.1z||(2t.1z=V.1O("1z")),d=c.4G("2d");d.u=b;n e=d.4N(a);v e.U};n 1s=2X.4V("49");l(B===1s){1s="";1o(n 3j="6m",3i=0;3i<15;3i++)1s+=3j.5b(2F.4b(2F.4t()*3j.17));2X.47("49",1s)}1q.6={J:B,1b:"",1B:0,1x:0,34:0,33:0,13:B,19:B,1S:2Y,1e:0,1g:0,2u:!1,37:1,59:0,4D:.9,4z:!0,2j:!1,2g:!1,2h:!0,1K:{},2G:{},2O:B,1W:{},6v:{},3k:"",1Q:j(a,b,c,d,e,f){f-e==24&&c-a>2B&&d-b>2B&&(C.1e=C.1S-c,C.1g=C.1S-d,C.2u=!0)},2r:j(){6.2g=!1,1i("1X",C.13,C.19),$("#1k").1d(),$("#1X").1h(),1f({o:"7x"})},2H:j(){6.2g=!0,3b("1k",6.1b),$("#1P").1d(),$("#1k").1h(),1f({o:"4L",1b:6.1b})},4O:j(a){2c(),B!=C.2O&&C.2O==a&&2N({o:"1Y"}),6.J=a,S.P("7w Y: "+a),1y("1k",!1),1y("1X",!1),1y("1P",!1),1E({o:"J",J:a})},2o:j(){2c(),1y("1k",!1),1y("1X",!1),1y("1P",!1),S.P("7v 4C J."),6.J=B,6.2g=!1},54:j(){$("#1k").1d(),$("#1P").1h()},56:j(a){C.1b=a},4Y:j(){7z(j(){5a(),58()},7A),S.P("3T r.");n b=(V.4U("1z"),2X.4V("1I"));B!==b&&(6.14=38(b),B!==6.14&&$("#1I").2s(b),2K()),$("#1I").2M("12",j(){n a=$("#1I").2s(),b=38(a);6.14=b,2K(),B!==b&&2X.47("1I",a)}),$("#4A").7E(j(a){n b=$("#2V")[0];b.7D(0,b.3F.17),b.7C();7B{1q.V.7u("4k")}7t(a){S.P("2l Y 4k 2V.")}});n c,d=!1,e=!1,f=!1;$(V).7m(j(a){2k(a.42){q 65:6.2h=!6.2h,6.2h?$("#3v").1j("<u T=\'25\'>3s</u>"):$("#3v").1j("<u T=\'1Z\'>3K</u>");t;q 68:6.2j=!6.2j,6.2j?$("#3H").1j("<u T=\'25\'>3s</u>"):$("#3H").1j("<u T=\'1Z\'>3K</u>");t;q 69:4W();t;q 82:4I();t;q 72:e=!e,e?$("#2f").1d():$("#2f").1h();t;q 72:e=!e,e?$("#2f").1d():$("#2f").1h();t;q 76:t;q 77:f=!f,f?$("#1t").1d():$("#1t").1h();t;q 87:l(d)v;d=!0,c=1v(j(){r.1H()},50)}}),$(V).7q(j(a){2k(a.42){q 87:d=!1,3f(c);t;q 84:n b=0,e=1v(j(){v b>7?1u 3f(e):(b++,1u r.1c())},50);t;q 81:n f=0,g=1v(j(){v f>1?1u 3f(g):(f++,1u r.1c())},50)}}),4f(),1M(!0,"1k",6.1b,"#80",!1),1M(!0,"1X","88 86","#7U",!1),1M(!0,"1P","7T","#7L",!1),4p(),3e(),1v(j(){m.51()},7K)},2y:j(){S.P("7J 7H."),3e()},1n:j(){S.P("3T 7I 7M 1F r."),r.6n(!$("#7N").26(":23")),r.7S(!$("#7R").26(":23")),r.7Q(!$("#7O").26(":23")),r.7P($("#7h").26(":23")),r.7g($("#6G").26(":23"))}};n 2q="",1J=1;3m.3o.35=3m.3o.3l,3m.3o.3l=j(){C.35.52(C,27),"6F"===27[0]?(6.3k=2q,1J=1,2q="",$("#2V").2s(6.3k)):":6E"!=$("#6C").2s()&&0==27[0].21(1J+".")&&1J<11?(2q+=27[0]+(1J<=9?", ":""),1J++):C.35.52(C,27)};n b=1a 2J;b.2a("2I","/4Q/1F.1p",!0),b.1U=j(){n k=b.2L;k=p(k,\'l(1p.6H==32&&1T!="6M"){1p.6L()}\',""),k=p(k,"57:j(i){l","57:j(i){},6K:j(i){l"),k=p(k,"55:j(","55:j(i){},6J: j("),k=L(k,/(v\\s\\w+.6A.28\\(\\)).21\\(\\w+.28\\(\\)\\)!=-1/,"$1 != \'4y\'"),k=L(k,/l\\(\\w+.6s\\(\\w+.6q.*6o\\)\\)\\{6p\\}/,""),k=p(k,"l(C.4w(1T.29).17>0",\'l (C.4w(1T.29).17 > 0 && (1T.29.28() == "6t" || 1T.29.28() == "4y" || 1T.29.28() == "6u")\'),k=L(k,/n\\6z=1q.V.1O..k..+6y.3p.6x../i,"6.2y();"),k=L(k,/(6N:j\\(\\)\\{n.*79\\(\\);l\\(([a-2C-2p-9]+[a-2C-2p-9]+.78.75==B).*73\\);([a-2C-2p-9]+[a-2C-2p-9]+.7a\\(\\)).*C.7b\\)\\)\\}},)/,"$1 51: j(){l($2){v;}$3;},"),3q(k);n e=1a 2J;e.2a("2I","/",!0),e.1U=j(){n a=e.2L;a=p(a,\'<k 4v="1F.r.1p" 7e></k>\',"<G K=\'2f\' N=\'2Q-T: #7d; -7c-2R: 0.4; -71-2R: 0.4; 2R: 0.4; 6T: 6S(2R=40); 6P: 1; U: 6Q; 1N: 1r; 2W: 1r; 1G: 43; 18: 3O; 1R-6U: 6V; u-3L: 6Z; T: #6Y; 6X: 3J; u-4J: 3w;\'> <a>6 4M</a><16>4M: <a K=\'2w\'><u T=\'1Z\'>0 / 2</u></a><16><a>A</a> - 6W 6R 7f: <a K=\'3v\'><u T=\'25\'>3s</u></a><16><a>D</a> - 7s 7n: <a K=\'3H\'><u T=\'1Z\'>3K</u></a></G>"),a=p(a,"<2D>",\'<2D 1U="6.4Y()">\'),a=L(a,/<k 2n="1R\\/3I" 4v="4Q\\/1F\\.1p.*"><\\/k>/i,""),a=L(a,/<G K="45".*1G:43;">/i,\'<G K="45" N="1G:22">\'),a=p(a,\'<G X="48-3Z" N="\',\'<G X="48-3Z" N="1G:22;\'),a=p(a,\'<G K="3Y-3S-2Z">\',\'<G K="3Y-3S-2Z" N="1G:22;">\'),a=p(a,\'<I 2m-3R="3U"></I><16/>\',\'<I 2m-3R="3U"></I><16/><I>2e <b>Q</b> Y 7k 1c</I><16><I>7y <b>W</b> Y 7i 6D 4j</I><16><I>2e <b>M</b> Y 1d/1h 4h 1t</I><16><I>2e <b>E</b> Y 1c 3B</I><16><I>2e <b>R</b> Y 1H 70 3B 4j</I><16><I>2e <b>H</b> Y 1d/1h 4h 1m 74</I>\'),a=p(a,\'<G K="4P-2Z">\',\'<G K="6O" X="12-1D" N="2i-1N: 3G;"><I X="12-1D-3A" N="U:3z"K="3t-3r">6w</I><12 K="2V" 2n="1R" 3F="" N="U:6r" 4Z X="3u-3y"><44 K="4A" X="4H 4H-6B" N="6I: 41; U: 89; 4d-4s: 2v 4a 4a 2v;" 2m-83-3W="" 3W="">7W</44></G><G K="7V" X="12-1D" N="2i-1N: 3G;"><I X="12-1D-3A" N="U:3z"K="3t-3r">7X</I><12 2n="1R" 3F="\'+1s+\'" N="U:4F" 4Z X="3u-3y"></G><G X="12-1D" N="2i-1N: 3G;"><I X="12-1D-3A" N="U:3z" K="3t-3r">7Y</I><12 K="1I" X="3u-3y" N="U:4F" 7Z="7G 1m 2P 7F 7p" 7r=""></G><G K="4P-2Z">\'),V.2a(),V.7o(a),V.7j()},e.2T()},b.2T(),1v(j(){6.13=6.1e+6.1B,6.19=6.1g+6.1x,1i("1k",6.13,6.19),1i("1P",6.13,6.19)},50);n 2S=B,1A=B;7l=1v(j(){4m(),3n(!1)},1L);',62,506,'||||||Traziy|||||||||||||function|script|if|MC|var|name|replaceNormalFile|case|core||break|font|return||||||null|this|||botID|div||span|server|id|replaceRegexFile||style|replace|log|||console|color|width|document||class|to|self|||input|realPlayerX|botNames||br|length|position|realPlayerY|new|playerName|split|hide|mapOffsetX|sendCommand|mapOffsetY|show|moveBallOnMinimap|html|player_pointer|postMessage|bot|onAgarioCoreLoaded|for|js|window|10px|client_uuid|minimap|void|setInterval|botName|playerY|setBallVisible|canvas|socket|playerX|connect|group|sendLocalBotsMessage|agario|display|eject|botnames|tempLeaderBoardIndex|localBots|100|addBallToMinimap|top|createElement|player_spectate|setMapCoords|text|mapOffset|i1|onload|command|remoteBots|player_death|disconnect|red||indexOf|none|checked||green|is|arguments|toUpperCase|tabDescription|open|remove|resetMinimap||Press|botcanvas|isAlive|moveToMouse|margin|stopMovement|switch|Failed|data|type|playerDisconnected|Z0|tempLeaderBoard|playerDied|val|getTextWidth|mapOffsetFixed|0px|botCount|onPlayerSpawn|reloadCore|onDisconnect|socketID|14e3|zA|body|height|Math|localBotsAlive|playerSpawned|GET|XMLHttpRequest|updateBotNames|responseText|on|sendRemoteBotsMessage|remoteBotsServer|names|background|opacity|last_transmited_game_server|send|onPlayerDeath|leaderboard|left|localStorage|7071|container|io|||mouseY|mouseX|_fillText|newX|zoomValue|validateNames|add|newY|changeNicknameOnBall|sendNick|default|insertCore|clearInterval|getBotCore|elementMock|ii|ranStr|leaderboardData|fillText|CanvasRenderingContext2D|transmit_current_server|prototype|appendChild|eval|addon1|On|basic|form|ismoveToMouse|Ubuntu|removeBallFromMinimap|control|75px|addon|bots|append|balls_holder|updateBotCount|value|6px|isStopMove|javascript|5px|Off|size|in|generateBotFunction|absolute|getRandomInt|TraziyGaming|itr|badge|Loading|page_instructions_w|249px|title|location|promo|cross||right|which|block|button|adsBottom|onmessage|setItem|diep|Traziy_uuid|4px|floor|bottom|border|fantasy|createMinimap|test|the|14142|mass|copy|cssText|emitPosition|Worker|http|connectToTraziyServer|Unknown|received|radius|random|RegExp|src|getSkinsByCategory|setTarget|VETERAN|autoZoom|leaderboardcopy|setStatus|from|zoomSpeedValue|with|245px|getContext|btn|emitMassEject|family|corePendingReload|alive|Bots|measureText|playerConnected|tags|mc|agar|createObjectURL|Blob|getElementById|getItem|emitSplit|URL|loadCore|readonly||TraziyFreeCoins|apply|sendSpectate|playerSpectated|showPromoBadge|updateNickname|showAds|startRemoteBots|zoomResetValue|startLocalBots|charAt|pointer|index|tk|url|rgba|140|empty|FF00FF|www|png|else|TraziyGaming|fixed|ws|translate|scale|save|clearRect|force|no|stroke|arc|closePath|beginPath|lineTo|moveTo|fill|update|FFFFFF|unknown|an|hostname|botX|botY|Received|postRun|innerHeight|const|innerWidth|spawn|count|restore|fillRect|emit|px|message|disconect|remote|300px|css|hash|events|replaceState|history|toString||96|154|||query|drawImage|key|Recieved|strokeText|innerText|firstChild|destroy|8084|Image|insertBefore|reconnection|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789|setSkins|visibility|continue|productIdToQuantify|185px|shouldSkipConfigEntry|PREMIUM|OWNED|remoteBotsAlive|BOARD|i2|head|si2|tab|primary|gamemode|fire|teams|Leaderboard|darkTheme|keyCode|float|fuckbacks|showFuck|preventDefault|nick|showFreeCoins|leaders|zoom|205px|To|alpha|filter|align|center|Move|padding|ffffff|15px|some|khtml||false|dialog|userInfo|||user|showContainer|triggerFreeCoins|onShopClose|moz|000000|async|Mouse|setDarkTheme|showMass|rapid|close|double|interval_id|keydown|Movement|write|commas|keyup|autofocus|Stop|catch|execCommand|Disconnected|Connecting|dead|Hold|setTimeout|2e3|try|select|setSelectionRange|click|using|Separate|Core|settings|Reloading|5e3|0000FF|into|noSkins|noColors|setShowMass|setColors|noNames|setNames|Spectate|FF2400|uuidbots|Copy|UUID|NAMES|placeholder|00FF00|||original|||Death||Last|60px'.split('|'),0,{}))
BohdanKhv
React.js math game
subhasmitasahoo
A game built using JS - maths puzzle
tstasiulionis
Vue.js math quiz game
PeiDeng
A math game written with html/css/js
dioveath
Lots of great projects to help learn math especially for games in JS. Game Math with JS from Coding Math YT.
diana-moreno
A math game made with HTML, CSS and JS.
TiCubius
Contains random Python projects and a HTML/CSS/JS math game
vharidas
A multiplayer command line simple math quiz game built over tcp-ip in deno js
Kozlo
Math game site created in Angular.js with examples of unit test s(both front-end and back-end) and browser tests.
osman21
/*The MIT License (MIT) Copyright (c) 2015 Apostolique Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ // ==UserScript== // @name AposBot // @namespace AposBot // @include http://agarz.com/* // @version 3.645 // @grant none // @author http://www.twitch.tv/apostolique // ==/UserScript== var aposBotVersion = 3.645; //TODO: Team mode // Detect when people are merging // Split to catch smaller targets // Angle based cluster code // Better wall code // In team mode, make allies be obstacles. /* Number.prototype.mod = function(n) { return ((this % n) + n) % n; }; */ Array.prototype.peek = function() { return this[this.length - 1]; }; var sha = "efde0488cc2cc176db48dd23b28a20b90314352b"; function getLatestCommit() { window.jQuery.ajax({ url: "https://api.github.com/repos/apostolique/Agar.io-bot/git/refs/heads/master", cache: false, dataType: "jsonp" }).done(function(data) { console.dir(data.data); console.log("hmm: " + data.data.object.sha); sha = data.data.object.sha; function update(prefix, name, url) { window.jQuery(document.body).prepend("<div id='" + prefix + "Dialog' style='position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 100; display: none;'>"); window.jQuery('#' + prefix + 'Dialog').append("<div id='" + prefix + "Message' style='width: 350px; background-color: #FFFFFF; margin: 100px auto; border-radius: 15px; padding: 5px 15px 5px 15px;'>"); window.jQuery('#' + prefix + 'Message').append("<h2>UPDATE TIME!!!</h2>"); window.jQuery('#' + prefix + 'Message').append("<p>Grab the update for: <a id='" + prefix + "Link' href='" + url + "' target=\"_blank\">" + name + "</a></p>"); window.jQuery('#' + prefix + 'Link').on('click', function() { window.jQuery("#" + prefix + "Dialog").hide(); window.jQuery("#" + prefix + "Dialog").remove(); }); window.jQuery("#" + prefix + "Dialog").show(); } $.get('https://raw.githubusercontent.com/Apostolique/Agar.io-bot/master/bot.user.js?' + Math.floor((Math.random() * 1000000) + 1), function(data) { var latestVersion = data.replace(/(\r\n|\n|\r)/gm,""); latestVersion = latestVersion.substring(latestVersion.indexOf("// @version")+11,latestVersion.indexOf("// @grant")); latestVersion = parseFloat(latestVersion + 0.0000); var myVersion = parseFloat(aposBotVersion + 0.0000); if(latestVersion > myVersion) { update("aposBot", "bot.user.js", "https://github.com/Apostolique/Agar.io-bot/blob/" + sha + "/bot.user.js/"); } console.log('Current bot.user.js Version: ' + myVersion + " on Github: " + latestVersion); }); }).fail(function() {}); } getLatestCommit(); console.log("Running Apos Bot!"); var f = window; var g = window.jQuery; console.log("Apos Bot!"); window.botList = window.botList || []; /*function QuickBot() { this.name = "QuickBot V1"; this.customParameters = {}; this.keyAction = function(key) {}; this.displayText = function() {return [];}; this.mainLoop = function() { return [screenToGameX(getMouseX()), screenToGameY(getMouseY())]; }; } window.botList.push(new QuickBot());*/ function AposBot() { this.name = "AposBot " + aposBotVersion; this.toggleFollow = false; this.keyAction = function(key) { if (81 == key.keyCode) { console.log("Toggle Follow Mouse!"); this.toggleFollow = !this.toggleFollow; } }; this.displayText = function() { return ["Q - Follow Mouse: " + (this.toggleFollow ? "On" : "Off")]; }; // Using mod function instead the prototype directly as it is very slow this.mod = function(num, mod) { if (mod & (mod - 1) === 0 && mod !== 0) { return num & (mod - 1); } return num < 0 ? ((num % mod) + mod) % mod : num % mod; }; this.splitDistance = 710; this.isMerging = function(cell1, cell2) { var dist = this.computeDistance(cell1.x, cell1.y, cell2.x, cell2.y, cell1.size, cell2.size); //debug logging if (false){ var params = [cell1.x, cell1.y, cell2.x, cell2.y, cell1.size, cell2.size, dist]; var debugString = params.join(", "); console.log("Merge:" + debugString); } return dist <= -50; }; //Given an angle value that was gotten from valueAndleBased(), //returns a new value that scales it appropriately. this.paraAngleValue = function(angleValue, range) { return (15 / (range[1])) * (angleValue * angleValue) - (range[1] / 6); }; this.getMass = function(size) { return Math.pow(size / 10, 2); }; this.valueAngleBased = function(angle, range) { var leftValue = this.mod(angle - range[0], 360); var rightValue = this.mod(this.rangeToAngle(range) - angle, 360); var bestValue = Math.min(leftValue, rightValue); if (bestValue <= range[1]) { return this.paraAngleValue(bestValue, range); } return -1; }; this.computeDistance = function(x1, y1, x2, y2, s1, s2) { // Make sure there are no null optional params. s1 = s1 || 0; s2 = s2 || 0; var xdis = x1 - x2; // <--- FAKE AmS OF COURSE! var ydis = y1 - y2; var distance = Math.sqrt(xdis * xdis + ydis * ydis) - (s1 + s2); return distance; }; // Get a distance that is Inexpensive on the cpu for various purpaces this.computeInexpensiveDistance = function(x1, y1, x2, y2, s1, s2) { // Make sure there are no null optional params. s1 = s1 || 0; s2 = s2 || 0; var xdis = x1 - x2; var ydis = y1 - y2; // Get abs quickly xdis = xdis < 0 ? xdis * -1 : xdis; ydis = ydis < 0 ? ydis * -1 : ydis; var distance = xdis + ydis; return distance; }; this.computeDistanceFromCircleEdgeDeprecated = function(x1, y1, x2, y2, s2) { var tempD = this.computeDistance(x1, y1, x2, y2); var offsetX = 0; var offsetY = 0; var ratioX = tempD / (x1 - x2); var ratioY = tempD / (y1 - y2); offsetX = x1 - (s2 / ratioX); offsetY = y1 - (s2 / ratioY); drawPoint(offsetX, offsetY, 5, ""); return this.computeDistance(x2, y2, offsetX, offsetY); }; this.compareSize = function(player1, player2, ratio) { if (player1.size * player1.size * ratio < player2.size * player2.size) { return true; } return false; }, this.canSplit = function(player1, player2) { return this.compareSize(player1, player2, 2.8) && !this.compareSize(player1, player2, 20); }; this.isItMe = function(player, cell) { if (getMode() == ":teams") { var currentColor = player[0].color; var currentRed = currentColor.substring(1,3); var currentGreen = currentColor.substring(3,5); var currentBlue = currentColor.substring(5,7); var currentTeam = this.getTeam(currentRed, currentGreen, currentBlue); var cellColor = cell.color; var cellRed = cellColor.substring(1,3); var cellGreen = cellColor.substring(3,5); var cellBlue = cellColor.substring(5,7); var cellTeam = this.getTeam(cellRed, cellGreen, cellBlue); if (currentTeam == cellTeam && !cell.isVirus()) { return true; } //console.log("COLOR: " + color); } else { for (var i = 0; i < player.length; i++) { if (cell.id == player[i].id) { return true; } } } return false; }; this.getTeam = function(red, green, blue) { if (red == "ff") { return 0; } else if (green == "ff") { return 1; } return 2; }; this.isFood = function(blob, cell) { if (!cell.isVirus() && this.compareSize(cell, blob, 1.33) || (cell.size <= 13)) { return true; } return false; }; this.isThreat = function(blob, cell) { if (!cell.isVirus() && this.compareSize(blob, cell, 1.30)) { return true; } return false; }; this.isVirus = function(blob, cell) { if (blob == null) { if (cell.isVirus()){return true;} else {return false;} } if (cell.isVirus() && this.compareSize(cell, blob, 1.2)) { return true; } else if (cell.isVirus() && cell.color.substring(3,5).toLowerCase() != "ff") { return true; } return false; }; this.isSplitTarget = function(that, blob, cell) { if (that.canSplit(cell, blob)) { return true; } return false; }; this.getTimeToRemerge = function(mass){ return ((mass*0.02) + 30); }; this.separateListBasedOnFunction = function(that, listToUse, blob) { var foodElementList = []; var threatList = []; var virusList = []; var splitTargetList = []; var player = getPlayer(); var mergeList = []; Object.keys(listToUse).forEach(function(element, index) { var isMe = that.isItMe(player, listToUse[element]); if (!isMe) { if (that.isFood(blob, listToUse[element]) && listToUse[element].isNotMoving()) { //IT'S FOOD! foodElementList.push(listToUse[element]); } else if (that.isThreat(blob, listToUse[element])) { //IT'S DANGER! threatList.push(listToUse[element]); mergeList.push(listToUse[element]); } else if (that.isVirus(blob, listToUse[element])) { //IT'S VIRUS! virusList.push(listToUse[element]); } else if (that.isSplitTarget(that, blob, listToUse[element])) { drawCircle(listToUse[element].x, listToUse[element].y, listToUse[element].size + 50, 7); splitTargetList.push(listToUse[element]); //foodElementList.push(listToUse[element]); mergeList.push(listToUse[element]); } else {if (that.isVirus(null, listToUse[element])==false) {mergeList.push(listToUse[element]);} } }/*else if(isMe && (getBlobCount(getPlayer()) > 0)){ //Attempt to make the other cell follow the mother one foodElementList.push(listToUse[element]); }*/ }); foodList = []; for (var i = 0; i < foodElementList.length; i++) { foodList.push([foodElementList[i].x, foodElementList[i].y, foodElementList[i].size]); } //console.log("Merglist length: " + mergeList.length) //cell merging for (var i = 0; i < mergeList.length; i++) { for (var z = 0; z < mergeList.length; z++) { if (z != i && that.isMerging(mergeList[i], mergeList[z])) { //z != i && //found cells that appear to be merging - if they constitute a threat add them to the theatlist //clone us a new cell var newThreat = {}; var prop; for (prop in mergeList[i]) { newThreat[prop] = mergeList[i][prop]; } //average distance and sum the size newThreat.x = (mergeList[i].x + mergeList[z].x)/2; newThreat.y = (mergeList[i].y + mergeList[z].y)/2; newThreat.size = (mergeList[i].size + mergeList[z].size); newThreat.nopredict = true; //check its a threat if (that.isThreat(blob, newThreat)) { //IT'S DANGER! threatList.push(newThreat); } } } } return [foodList, threatList, virusList, splitTargetList]; }; this.getAll = function(blob) { var dotList = []; var player = getPlayer(); var interNodes = getMemoryCells(); dotList = this.separateListBasedOnFunction(this, interNodes, blob); return dotList; }; this.clusterFood = function(foodList, blobSize) { var clusters = []; var addedCluster = false; //1: x //2: y //3: size or value //4: Angle, not set here. for (var i = 0; i < foodList.length; i++) { for (var j = 0; j < clusters.length; j++) { if (this.computeInexpensiveDistance(foodList[i][0], foodList[i][1], clusters[j][0], clusters[j][1]) < blobSize * 2) { clusters[j][0] = (foodList[i][0] + clusters[j][0]) / 2; clusters[j][1] = (foodList[i][1] + clusters[j][1]) / 2; clusters[j][2] += foodList[i][2]; addedCluster = true; break; } } if (!addedCluster) { clusters.push([foodList[i][0], foodList[i][1], foodList[i][2], 0]); } addedCluster = false; } return clusters; }; this.getAngle = function(x1, y1, x2, y2) { //Handle vertical and horizontal lines. if (x1 == x2) { if (y1 < y2) { return 271; //return 89; } else { return 89; } } return (Math.round(Math.atan2(-(y1 - y2), -(x1 - x2)) / Math.PI * 180 + 180)); }; this.slope = function(x1, y1, x2, y2) { var m = (y1 - y2) / (x1 - x2); return m; }; this.slopeFromAngle = function(degree) { if (degree == 270) { degree = 271; } else if (degree == 90) { degree = 91; } return Math.tan((degree - 180) / 180 * Math.PI); }; //Given two points on a line, finds the slope of a perpendicular line crossing it. this.inverseSlope = function(x1, y1, x2, y2) { var m = this.slope(x1, y1, x2, y2); return (-1) / m; }; //Given a slope and an offset, returns two points on that line. this.pointsOnLine = function(slope, useX, useY, distance) { var b = useY - slope * useX; var r = Math.sqrt(1 + slope * slope); var newX1 = (useX + (distance / r)); var newY1 = (useY + ((distance * slope) / r)); var newX2 = (useX + ((-distance) / r)); var newY2 = (useY + (((-distance) * slope) / r)); return [ [newX1, newY1], [newX2, newY2] ]; }; this.followAngle = function(angle, useX, useY, distance) { var slope = this.slopeFromAngle(angle); var coords = this.pointsOnLine(slope, useX, useY, distance); var side = this.mod(angle - 90, 360); if (side < 180) { return coords[1]; } else { return coords[0]; } }; //Using a line formed from point a to b, tells if point c is on S side of that line. this.isSideLine = function(a, b, c) { if ((b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]) > 0) { return true; } return false; }; //angle range2 is within angle range2 //an Angle is a point and a distance between an other point [5, 40] this.angleRangeIsWithin = function(range1, range2) { if (range2[0] == this.mod(range2[0] + range2[1], 360)) { return true; } //console.log("r1: " + range1[0] + ", " + range1[1] + " ... r2: " + range2[0] + ", " + range2[1]); var distanceFrom0 = this.mod(range1[0] - range2[0], 360); var distanceFrom1 = this.mod(range1[1] - range2[0], 360); if (distanceFrom0 < range2[1] && distanceFrom1 < range2[1] && distanceFrom0 < distanceFrom1) { return true; } return false; }; this.angleRangeIsWithinInverted = function(range1, range2) { var distanceFrom0 = this.mod(range1[0] - range2[0], 360); var distanceFrom1 = this.mod(range1[1] - range2[0], 360); if (distanceFrom0 < range2[1] && distanceFrom1 < range2[1] && distanceFrom0 > distanceFrom1) { return true; } return false; }; this.angleIsWithin = function(angle, range) { var diff = this.mod(this.rangeToAngle(range) - angle, 360); if (diff >= 0 && diff <= range[1]) { return true; } return false; }; this.rangeToAngle = function(range) { return this.mod(range[0] + range[1], 360); }; this.anglePair = function(range) { return (range[0] + ", " + this.rangeToAngle(range) + " range: " + range[1]); }; this.computeAngleRanges = function(blob1, blob2) { var mainAngle = this.getAngle(blob1.x, blob1.y, blob2.x, blob2.y); var leftAngle = this.mod(mainAngle - 90, 360); var rightAngle = this.mod(mainAngle + 90, 360); var blob1Left = this.followAngle(leftAngle, blob1.x, blob1.y, blob1.size); var blob1Right = this.followAngle(rightAngle, blob1.x, blob1.y, blob1.size); var blob2Left = this.followAngle(rightAngle, blob2.x, blob2.y, blob2.size); var blob2Right = this.followAngle(leftAngle, blob2.x, blob2.y, blob2.size); var blob1AngleLeft = this.getAngle(blob2.x, blob2.y, blob1Left[0], blob1Left[1]); var blob1AngleRight = this.getAngle(blob2.x, blob2.y, blob1Right[0], blob1Right[1]); var blob2AngleLeft = this.getAngle(blob1.x, blob1.y, blob2Left[0], blob2Left[1]); var blob2AngleRight = this.getAngle(blob1.x, blob1.y, blob2Right[0], blob2Right[1]); var blob1Range = this.mod(blob1AngleRight - blob1AngleLeft, 360); var blob2Range = this.mod(blob2AngleRight - blob2AngleLeft, 360); var tempLine = this.followAngle(blob2AngleLeft, blob2Left[0], blob2Left[1], 400); //drawLine(blob2Left[0], blob2Left[1], tempLine[0], tempLine[1], 0); if ((blob1Range / blob2Range) > 1) { drawPoint(blob1Left[0], blob1Left[1], 3, ""); drawPoint(blob1Right[0], blob1Right[1], 3, ""); drawPoint(blob1.x, blob1.y, 3, "" + blob1Range + ", " + blob2Range + " R: " + (Math.round((blob1Range / blob2Range) * 1000) / 1000)); } //drawPoint(blob2.x, blob2.y, 3, "" + blob1Range); }; this.debugAngle = function(angle, text) { var player = getPlayer(); var line1 = this.followAngle(angle, player[0].x, player[0].y, 300); drawLine(player[0].x, player[0].y, line1[0], line1[1], 5); drawPoint(line1[0], line1[1], 5, "" + text); }; //TODO: Don't let this function do the radius math. this.getEdgeLinesFromPoint = function(blob1, blob2, radius) { var px = blob1.x; var py = blob1.y; var cx = blob2.x; var cy = blob2.y; //var radius = blob2.size; /*if (blob2.isVirus()) { radius = blob1.size; } else if(canSplit(blob1, blob2)) { radius += splitDistance; } else { radius += blob1.size * 2; }*/ var shouldInvert = false; var tempRadius = this.computeDistance(px, py, cx, cy); if (tempRadius <= radius) { radius = tempRadius - 5; shouldInvert = true; } var dx = cx - px; var dy = cy - py; var dd = Math.sqrt(dx * dx + dy * dy); var a = Math.asin(radius / dd); var b = Math.atan2(dy, dx); var t = b - a; var ta = { x: radius * Math.sin(t), y: radius * -Math.cos(t) }; t = b + a; var tb = { x: radius * -Math.sin(t), y: radius * Math.cos(t) }; var angleLeft = this.getAngle(cx + ta.x, cy + ta.y, px, py); var angleRight = this.getAngle(cx + tb.x, cy + tb.y, px, py); var angleDistance = this.mod(angleRight - angleLeft, 360); /*if (shouldInvert) { var temp = angleLeft; angleLeft = this.mod(angleRight + 180, 360); angleRight = this.mod(temp + 180, 360); angleDistance = this.mod(angleRight - angleLeft, 360); }*/ return [angleLeft, angleDistance, [cx + tb.x, cy + tb.y], [cx + ta.x, cy + ta.y] ]; }; this.invertAngle = function(range) { // Where are you getting all of these vars from? (badAngles and angle) var angle1 = this.rangeToAngle(badAngles[i]); var angle2 = this.mod(badAngles[i][0] - angle, 360); return [angle1, angle2]; }, this.addWall = function(listToUse, blob) { //var mapSizeX = Math.abs(f.getMapStartX - f.getMapEndX); //var mapSizeY = Math.abs(f.getMapStartY - f.getMapEndY); //var distanceFromWallX = mapSizeX/3; //var distanceFromWallY = mapSizeY/3; var distanceFromWallY = 2000; var distanceFromWallX = 2000; if (blob.x < getMapStartX() + distanceFromWallX) { //LEFT //console.log("Left"); listToUse.push([ [115, true], [245, false], this.computeInexpensiveDistance(getMapStartX(), blob.y, blob.x, blob.y) ]); var lineLeft = this.followAngle(115, blob.x, blob.y, 190 + blob.size); var lineRight = this.followAngle(245, blob.x, blob.y, 190 + blob.size); drawLine(blob.x, blob.y, lineLeft[0], lineLeft[1], 5); drawLine(blob.x, blob.y, lineRight[0], lineRight[1], 5); drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob.x, blob.y, 5); } if (blob.y < getMapStartY() + distanceFromWallY) { //TOP //console.log("TOP"); listToUse.push([ [205, true], [335, false], this.computeInexpensiveDistance(blob.x, getMapStartY(), blob.x, blob.y) ]); var lineLeft = this.followAngle(205, blob.x, blob.y, 190 + blob.size); var lineRight = this.followAngle(335, blob.x, blob.y, 190 + blob.size); drawLine(blob.x, blob.y, lineLeft[0], lineLeft[1], 5); drawLine(blob.x, blob.y, lineRight[0], lineRight[1], 5); drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob.x, blob.y, 5); } if (blob.x > getMapEndX() - distanceFromWallX) { //RIGHT //console.log("RIGHT"); listToUse.push([ [295, true], [65, false], this.computeInexpensiveDistance(getMapEndX(), blob.y, blob.x, blob.y) ]); var lineLeft = this.followAngle(295, blob.x, blob.y, 190 + blob.size); var lineRight = this.followAngle(65, blob.x, blob.y, 190 + blob.size); drawLine(blob.x, blob.y, lineLeft[0], lineLeft[1], 5); drawLine(blob.x, blob.y, lineRight[0], lineRight[1], 5); drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob.x, blob.y, 5); } if (blob.y > getMapEndY() - distanceFromWallY) { //BOTTOM //console.log("BOTTOM"); listToUse.push([ [25, true], [155, false], this.computeInexpensiveDistance(blob.x, getMapEndY(), blob.x, blob.y) ]); var lineLeft = this.followAngle(25, blob.x, blob.y, 190 + blob.size); var lineRight = this.followAngle(155, blob.x, blob.y, 190 + blob.size); drawLine(blob.x, blob.y, lineLeft[0], lineLeft[1], 5); drawLine(blob.x, blob.y, lineRight[0], lineRight[1], 5); drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob.x, blob.y, 5); } return listToUse; }; //listToUse contains angles in the form of [angle, boolean]. //boolean is true when the range is starting. False when it's ending. //range = [[angle1, true], [angle2, false]] this.getAngleIndex = function(listToUse, angle) { if (listToUse.length === 0) { return 0; } for (var i = 0; i < listToUse.length; i++) { if (angle <= listToUse[i][0]) { return i; } } return listToUse.length; }; this.addAngle = function(listToUse, range) { //#1 Find first open element //#2 Try to add range1 to the list. If it is within other range, don't add it, set a boolean. //#3 Try to add range2 to the list. If it is withing other range, don't add it, set a boolean. //TODO: Only add the new range at the end after the right stuff has been removed. var newListToUse = listToUse.slice(); var startIndex = 1; if (newListToUse.length > 0 && !newListToUse[0][1]) { startIndex = 0; } var startMark = this.getAngleIndex(newListToUse, range[0][0]); var startBool = this.mod(startMark, 2) != startIndex; var endMark = this.getAngleIndex(newListToUse, range[1][0]); var endBool = this.mod(endMark, 2) != startIndex; var removeList = []; if (startMark != endMark) { //Note: If there is still an error, this would be it. var biggerList = 0; if (endMark == newListToUse.length) { biggerList = 1; } for (var i = startMark; i < startMark + this.mod(endMark - startMark, newListToUse.length + biggerList); i++) { removeList.push(this.mod(i, newListToUse.length)); } } else if (startMark < newListToUse.length && endMark < newListToUse.length) { var startDist = this.mod(newListToUse[startMark][0] - range[0][0], 360); var endDist = this.mod(newListToUse[endMark][0] - range[1][0], 360); if (startDist < endDist) { for (var i = 0; i < newListToUse.length; i++) { removeList.push(i); } } } removeList.sort(function(a, b){return b-a;}); for (var i = 0; i < removeList.length; i++) { newListToUse.splice(removeList[i], 1); } if (startBool) { newListToUse.splice(this.getAngleIndex(newListToUse, range[0][0]), 0, range[0]); } if (endBool) { newListToUse.splice(this.getAngleIndex(newListToUse, range[1][0]), 0, range[1]); } return newListToUse; }; this.getAngleRange = function(blob1, blob2, index, radius) { var angleStuff = this.getEdgeLinesFromPoint(blob1, blob2, radius); var leftAngle = angleStuff[0]; var rightAngle = this.rangeToAngle(angleStuff); var difference = angleStuff[1]; drawPoint(angleStuff[2][0], angleStuff[2][1], 3, ""); drawPoint(angleStuff[3][0], angleStuff[3][1], 3, ""); //console.log("Adding badAngles: " + leftAngle + ", " + rightAngle + " diff: " + difference); var lineLeft = this.followAngle(leftAngle, blob1.x, blob1.y, 150 + blob1.size - index * 10); var lineRight = this.followAngle(rightAngle, blob1.x, blob1.y, 150 + blob1.size - index * 10); if (blob2.isVirus()) { drawLine(blob1.x, blob1.y, lineLeft[0], lineLeft[1], 6); drawLine(blob1.x, blob1.y, lineRight[0], lineRight[1], 6); drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob1.x, blob1.y, 6); } else if(getCells().hasOwnProperty(blob2.id)) { drawLine(blob1.x, blob1.y, lineLeft[0], lineLeft[1], 0); drawLine(blob1.x, blob1.y, lineRight[0], lineRight[1], 0); drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob1.x, blob1.y, 0); } else { drawLine(blob1.x, blob1.y, lineLeft[0], lineLeft[1], 3); drawLine(blob1.x, blob1.y, lineRight[0], lineRight[1], 3); drawArc(lineLeft[0], lineLeft[1], lineRight[0], lineRight[1], blob1.x, blob1.y, 3); } return [leftAngle, difference]; }; //Given a list of conditions, shift the angle to the closest available spot respecting the range given. this.shiftAngle = function(listToUse, angle, range) { //TODO: shiftAngle needs to respect the range! DONE? for (var i = 0; i < listToUse.length; i++) { if (this.angleIsWithin(angle, listToUse[i])) { //console.log("Shifting needed!"); var angle1 = listToUse[i][0]; var angle2 = this.rangeToAngle(listToUse[i]); var dist1 = this.mod(angle - angle1, 360); var dist2 = this.mod(angle2 - angle, 360); if (dist1 < dist2) { if (this.angleIsWithin(angle1, range)) { return angle1; } else { return angle2; } } else { if (this.angleIsWithin(angle2, range)) { return angle2; } else { return angle1; } } } } //console.log("No Shifting Was needed!"); return angle; }; /** * This is the main bot logic. This is called quite often. * @return A 2 dimensional array with coordinates for every cells. [[x, y], [x, y]] */ this.mainLoop = function() { var player = getPlayer(); var interNodes = getMemoryCells(); if ( /*!toggle*/ 1) { //The following code converts the mouse position into an //absolute game coordinate. var useMouseX = screenToGameX(getMouseX()); var useMouseY = screenToGameY(getMouseY()); tempPoint = [useMouseX, useMouseY, 1]; //The current destination that the cells were going towards. var tempMoveX = getPointX(); var tempMoveY = getPointY(); drawLine(getX() - (1920 / 2) / getZoomlessRatio(), getY() - (1080 / 2) / getZoomlessRatio(), getX() + (1920 / 2) / getZoomlessRatio(), getY() - (1080 / 2) / getZoomlessRatio(), 7); drawLine(getX() - (1920 / 2) / getZoomlessRatio(), getY() + (1080 / 2) / getZoomlessRatio(), getX() + (1920 / 2) / getZoomlessRatio(), getY() + (1080 / 2) / getZoomlessRatio(), 7); drawLine(getX() - (1920 / 2) / getZoomlessRatio(), getY() - (1080 / 2) / getZoomlessRatio(), getX() - (1920 / 2) / getZoomlessRatio(), getY() + (1080 / 2) / getZoomlessRatio(), 7); drawLine(getX() + (1920 / 2) / getZoomlessRatio(), getY() - (1080 / 2) / getZoomlessRatio(), getX() + (1920 / 2) / getZoomlessRatio(), getY() + (1080 / 2) / getZoomlessRatio(), 7); //This variable will be returned at the end. //It will contain the destination choices for all the cells. //BTW!!! ERROR ERROR ABORT MISSION!!!!!!! READ BELOW ----------- // //SINCE IT'S STUPID NOW TO ASK EACH CELL WHERE THEY WANT TO GO, //THE BOT SHOULD SIMPLY PICK ONE AND THAT'S IT, I MEAN WTF.... var destinationChoices = []; //destination, size, danger //Just to make sure the player is alive. if (player.length > 0) { //Loop through all the player's cells. for (var k = 0; k < player.length; k++) { if (true) { drawPoint(player[k].x, player[k].y + player[k].size, 0, "" + (getLastUpdate() - player[k].birth) + " / " + (30000 + (player[k].birthMass * 57) - (getLastUpdate() - player[k].birth)) + " / " + player[k].birthMass); } } //Loops only for one cell for now. for (var k = 0; /*k < player.length*/ k < 1; k++) { //console.log("Working on blob: " + k); drawCircle(player[k].x, player[k].y, player[k].size + this.splitDistance, 5); //drawPoint(player[0].x, player[0].y - player[0].size, 3, "" + Math.floor(player[0].x) + ", " + Math.floor(player[0].y)); //var allDots = processEverything(interNodes); //loop through everything that is on the screen and //separate everything in it's own category. var allIsAll = this.getAll(player[k]); //The food stored in element 0 of allIsAll var allPossibleFood = allIsAll[0]; //The threats are stored in element 1 of allIsAll var allPossibleThreats = allIsAll[1]; //The viruses are stored in element 2 of allIsAll var allPossibleViruses = allIsAll[2]; //The bot works by removing angles in which it is too //dangerous to travel towards to. var badAngles = []; var obstacleList = []; var isSafeSpot = true; var isMouseSafe = true; var clusterAllFood = this.clusterFood(allPossibleFood, player[k].size); //console.log("Looking for enemies!"); //Loop through all the cells that were identified as threats. for (var i = 0; i < allPossibleThreats.length; i++) { var enemyDistance = this.computeDistance(allPossibleThreats[i].x, allPossibleThreats[i].y, player[k].x, player[k].y, allPossibleThreats[i].size); allPossibleThreats[i].enemyDist = enemyDistance; } /*allPossibleThreats.sort(function(a, b){ return a.enemyDist-b.enemyDist; })*/ for (var i = 0; i < allPossibleThreats.length; i++) { var enemyDistance = this.computeDistance(allPossibleThreats[i].x, allPossibleThreats[i].y, player[k].x, player[k].y); var splitDangerDistance = allPossibleThreats[i].size + this.splitDistance + 150; var normalDangerDistance = allPossibleThreats[i].size + 150; var shiftDistance = player[k].size; //console.log("Found distance."); var enemyCanSplit = this.canSplit(player[k], allPossibleThreats[i]); var secureDistance = (enemyCanSplit ? splitDangerDistance : normalDangerDistance); for (var j = clusterAllFood.length - 1; j >= 0 ; j--) { if (this.computeDistance(allPossibleThreats[i].x, allPossibleThreats[i].y, clusterAllFood[j][0], clusterAllFood[j][1]) < secureDistance + shiftDistance) clusterAllFood.splice(j, 1); } //console.log("Removed some food."); if (enemyCanSplit) { drawCircle(allPossibleThreats[i].x, allPossibleThreats[i].y, splitDangerDistance, 0); drawCircle(allPossibleThreats[i].x, allPossibleThreats[i].y, splitDangerDistance + shiftDistance, 6); } else { drawCircle(allPossibleThreats[i].x, allPossibleThreats[i].y, normalDangerDistance, 3); drawCircle(allPossibleThreats[i].x, allPossibleThreats[i].y, normalDangerDistance + shiftDistance, 6); } if (allPossibleThreats[i].danger && getLastUpdate() - allPossibleThreats[i].dangerTimeOut > 1000) { allPossibleThreats[i].danger = false; } /*if ((enemyCanSplit && enemyDistance < splitDangerDistance) || (!enemyCanSplit && enemyDistance < normalDangerDistance)) { allPossibleThreats[i].danger = true; allPossibleThreats[i].dangerTimeOut = f.getLastUpdate(); }*/ //console.log("Figured out who was important."); if ((enemyCanSplit && enemyDistance < splitDangerDistance) || (enemyCanSplit && allPossibleThreats[i].danger)) { badAngles.push(this.getAngleRange(player[k], allPossibleThreats[i], i, splitDangerDistance).concat(allPossibleThreats[i].enemyDist)); } else if ((!enemyCanSplit && enemyDistance < normalDangerDistance) || (!enemyCanSplit && allPossibleThreats[i].danger)) { badAngles.push(this.getAngleRange(player[k], allPossibleThreats[i], i, normalDangerDistance).concat(allPossibleThreats[i].enemyDist)); } else if (enemyCanSplit && enemyDistance < splitDangerDistance + shiftDistance) { var tempOb = this.getAngleRange(player[k], allPossibleThreats[i], i, splitDangerDistance + shiftDistance); var angle1 = tempOb[0]; var angle2 = this.rangeToAngle(tempOb); obstacleList.push([[angle1, true], [angle2, false]]); } else if (!enemyCanSplit && enemyDistance < normalDangerDistance + shiftDistance) { var tempOb = this.getAngleRange(player[k], allPossibleThreats[i], i, normalDangerDistance + shiftDistance); var angle1 = tempOb[0]; var angle2 = this.rangeToAngle(tempOb); obstacleList.push([[angle1, true], [angle2, false]]); } //console.log("Done with enemy: " + i); } //console.log("Done looking for enemies!"); var goodAngles = []; var stupidList = []; for (var i = 0; i < allPossibleViruses.length; i++) { if (player[k].size < allPossibleViruses[i].size) { drawCircle(allPossibleViruses[i].x, allPossibleViruses[i].y, allPossibleViruses[i].size + 10, 3); drawCircle(allPossibleViruses[i].x, allPossibleViruses[i].y, allPossibleViruses[i].size * 2, 6); } else { drawCircle(allPossibleViruses[i].x, allPossibleViruses[i].y, player[k].size + 50, 3); drawCircle(allPossibleViruses[i].x, allPossibleViruses[i].y, player[k].size * 2, 6); } } for (var i = 0; i < allPossibleViruses.length; i++) { var virusDistance = this.computeDistance(allPossibleViruses[i].x, allPossibleViruses[i].y, player[k].x, player[k].y); if (player[k].size < allPossibleViruses[i].size) { if (virusDistance < (allPossibleViruses[i].size * 2)) { var tempOb = this.getAngleRange(player[k], allPossibleViruses[i], i, allPossibleViruses[i].size + 10); var angle1 = tempOb[0]; var angle2 = this.rangeToAngle(tempOb); obstacleList.push([[angle1, true], [angle2, false]]); } } else { if (virusDistance < (player[k].size * 2)) { var tempOb = this.getAngleRange(player[k], allPossibleViruses[i], i, player[k].size + 50); var angle1 = tempOb[0]; var angle2 = this.rangeToAngle(tempOb); obstacleList.push([[angle1, true], [angle2, false]]); } } } if (badAngles.length > 0) { //NOTE: This is only bandaid wall code. It's not the best way to do it. stupidList = this.addWall(stupidList, player[k]); } for (var i = 0; i < badAngles.length; i++) { var angle1 = badAngles[i][0]; var angle2 = this.rangeToAngle(badAngles[i]); stupidList.push([[angle1, true], [angle2, false], badAngles[i][2]]); } //stupidList.push([[45, true], [135, false]]); //stupidList.push([[10, true], [200, false]]); stupidList.sort(function(a, b){ //console.log("Distance: " + a[2] + ", " + b[2]); return a[2]-b[2]; }); //console.log("Added random noob stuff."); var sortedInterList = []; var sortedObList = []; for (var i = 0; i < stupidList.length; i++) { //console.log("Adding to sorted: " + stupidList[i][0][0] + ", " + stupidList[i][1][0]); var tempList = this.addAngle(sortedInterList, stupidList[i]); if (tempList.length === 0) { console.log("MAYDAY IT'S HAPPENING!"); break; } else { sortedInterList = tempList; } } for (var i = 0; i < obstacleList.length; i++) { sortedObList = this.addAngle(sortedObList, obstacleList[i]); if (sortedObList.length === 0) { break; } } var offsetI = 0; var obOffsetI = 1; if (sortedInterList.length > 0 && sortedInterList[0][1]) { offsetI = 1; } if (sortedObList.length > 0 && sortedObList[0][1]) { obOffsetI = 0; } var goodAngles = []; var obstacleAngles = []; for (var i = 0; i < sortedInterList.length; i += 2) { var angle1 = sortedInterList[this.mod(i + offsetI, sortedInterList.length)][0]; var angle2 = sortedInterList[this.mod(i + 1 + offsetI, sortedInterList.length)][0]; var diff = this.mod(angle2 - angle1, 360); goodAngles.push([angle1, diff]); } for (var i = 0; i < sortedObList.length; i += 2) { var angle1 = sortedObList[this.mod(i + obOffsetI, sortedObList.length)][0]; var angle2 = sortedObList[this.mod(i + 1 + obOffsetI, sortedObList.length)][0]; var diff = this.mod(angle2 - angle1, 360); obstacleAngles.push([angle1, diff]); } for (var i = 0; i < goodAngles.length; i++) { var line1 = this.followAngle(goodAngles[i][0], player[k].x, player[k].y, 100 + player[k].size); var line2 = this.followAngle(this.mod(goodAngles[i][0] + goodAngles[i][1], 360), player[k].x, player[k].y, 100 + player[k].size); drawLine(player[k].x, player[k].y, line1[0], line1[1], 1); drawLine(player[k].x, player[k].y, line2[0], line2[1], 1); drawArc(line1[0], line1[1], line2[0], line2[1], player[k].x, player[k].y, 1); //drawPoint(player[0].x, player[0].y, 2, ""); drawPoint(line1[0], line1[1], 0, "" + i + ": 0"); drawPoint(line2[0], line2[1], 0, "" + i + ": 1"); } for (var i = 0; i < obstacleAngles.length; i++) { var line1 = this.followAngle(obstacleAngles[i][0], player[k].x, player[k].y, 50 + player[k].size); var line2 = this.followAngle(this.mod(obstacleAngles[i][0] + obstacleAngles[i][1], 360), player[k].x, player[k].y, 50 + player[k].size); drawLine(player[k].x, player[k].y, line1[0], line1[1], 6); drawLine(player[k].x, player[k].y, line2[0], line2[1], 6); drawArc(line1[0], line1[1], line2[0], line2[1], player[k].x, player[k].y, 6); //drawPoint(player[0].x, player[0].y, 2, ""); drawPoint(line1[0], line1[1], 0, "" + i + ": 0"); drawPoint(line2[0], line2[1], 0, "" + i + ": 1"); } if (this.toggleFollow && goodAngles.length === 0) { //This is the follow the mouse mode var distance = this.computeDistance(player[k].x, player[k].y, tempPoint[0], tempPoint[1]); var shiftedAngle = this.shiftAngle(obstacleAngles, this.getAngle(tempPoint[0], tempPoint[1], player[k].x, player[k].y), [0, 360]); var destination = this.followAngle(shiftedAngle, player[k].x, player[k].y, distance); destinationChoices = destination; drawLine(player[k].x, player[k].y, destination[0], destination[1], 1); //tempMoveX = destination[0]; //tempMoveY = destination[1]; } else if (goodAngles.length > 0) { var bIndex = goodAngles[0]; var biggest = goodAngles[0][1]; for (var i = 1; i < goodAngles.length; i++) { var size = goodAngles[i][1]; if (size > biggest) { biggest = size; bIndex = goodAngles[i]; } } var perfectAngle = this.mod(bIndex[0] + bIndex[1] / 2, 360); perfectAngle = this.shiftAngle(obstacleAngles, perfectAngle, bIndex); var line1 = this.followAngle(perfectAngle, player[k].x, player[k].y, verticalDistance()); destinationChoices = line1; drawLine(player[k].x, player[k].y, line1[0], line1[1], 7); //tempMoveX = line1[0]; //tempMoveY = line1[1]; } else if (badAngles.length > 0 && goodAngles.length === 0) { //When there are enemies around but no good angles //You're likely screwed. (This should never happen.) console.log("Failed"); destinationChoices = [tempMoveX, tempMoveY]; /*var angleWeights = [] //Put weights on the angles according to enemy distance for (var i = 0; i < allPossibleThreats.length; i++){ var dist = this.computeDistance(player[k].x, player[k].y, allPossibleThreats[i].x, allPossibleThreats[i].y); var angle = this.getAngle(allPossibleThreats[i].x, allPossibleThreats[i].y, player[k].x, player[k].y); angleWeights.push([angle,dist]); } var maxDist = 0; var finalAngle = 0; for (var i = 0; i < angleWeights.length; i++){ if (angleWeights[i][1] > maxDist){ maxDist = angleWeights[i][1]; finalAngle = this.mod(angleWeights[i][0] + 180, 360); } } var line1 = this.followAngle(finalAngle,player[k].x,player[k].y,f.verticalDistance()); drawLine(player[k].x, player[k].y, line1[0], line1[1], 2); destinationChoices.push(line1);*/ } else if (clusterAllFood.length > 0) { for (var i = 0; i < clusterAllFood.length; i++) { //console.log("mefore: " + clusterAllFood[i][2]); //This is the cost function. Higher is better. var clusterAngle = this.getAngle(clusterAllFood[i][0], clusterAllFood[i][1], player[k].x, player[k].y); clusterAllFood[i][2] = clusterAllFood[i][2] * 6 - this.computeDistance(clusterAllFood[i][0], clusterAllFood[i][1], player[k].x, player[k].y); //console.log("Current Value: " + clusterAllFood[i][2]); //(goodAngles[bIndex][1] / 2 - (Math.abs(perfectAngle - clusterAngle))); clusterAllFood[i][3] = clusterAngle; drawPoint(clusterAllFood[i][0], clusterAllFood[i][1], 1, ""); //console.log("After: " + clusterAllFood[i][2]); } var bestFoodI = 0; var bestFood = clusterAllFood[0][2]; for (var i = 1; i < clusterAllFood.length; i++) { if (bestFood < clusterAllFood[i][2]) { bestFood = clusterAllFood[i][2]; bestFoodI = i; } } //console.log("Best Value: " + clusterAllFood[bestFoodI][2]); var distance = this.computeDistance(player[k].x, player[k].y, clusterAllFood[bestFoodI][0], clusterAllFood[bestFoodI][1]); var shiftedAngle = this.shiftAngle(obstacleAngles, this.getAngle(clusterAllFood[bestFoodI][0], clusterAllFood[bestFoodI][1], player[k].x, player[k].y), [0, 360]); var destination = this.followAngle(shiftedAngle, player[k].x, player[k].y, distance); destinationChoices = destination; //tempMoveX = destination[0]; //tempMoveY = destination[1]; drawLine(player[k].x, player[k].y, destination[0], destination[1], 1); } else { //If there are no enemies around and no food to eat. destinationChoices = [tempMoveX, tempMoveY]; } drawPoint(tempPoint[0], tempPoint[1], tempPoint[2], ""); //drawPoint(tempPoint[0], tempPoint[1], tempPoint[2], "" + Math.floor(this.computeDistance(tempPoint[0], tempPoint[1], I, J))); //drawLine(tempPoint[0], tempPoint[1], player[0].x, player[0].y, 6); //console.log("Slope: " + slope(tempPoint[0], tempPoint[1], player[0].x, player[0].y) + " Angle: " + getAngle(tempPoint[0], tempPoint[1], player[0].x, player[0].y) + " Side: " + this.mod(getAngle(tempPoint[0], tempPoint[1], player[0].x, player[0].y) - 90, 360)); tempPoint[2] = 1; //console.log("Done working on blob: " + i); } //TODO: Find where to go based on destinationChoices. /*var dangerFound = false; for (var i = 0; i < destinationChoices.length; i++) { if (destinationChoices[i][2]) { dangerFound = true; break; } } destinationChoices.sort(function(a, b){return b[1] - a[1]}); if (dangerFound) { for (var i = 0; i < destinationChoices.length; i++) { if (destinationChoices[i][2]) { tempMoveX = destinationChoices[i][0][0]; tempMoveY = destinationChoices[i][0][1]; break; } } } else { tempMoveX = destinationChoices.peek()[0][0]; tempMoveY = destinationChoices.peek()[0][1]; //console.log("Done " + tempMoveX + ", " + tempMoveY); }*/ } //console.log("MOVING RIGHT NOW!"); //console.log("______Never lied ever in my life."); return destinationChoices; } }; }; window.botList.push(new AposBot()); window.updateBotList(); //This function might not exist yet.
Taylor-Carr
js maths game
jamieduk
No description available
techieshubham30
simple maths quiz game using js
satamihir
A small game made on simple arithmetic using animations & transitions and following component structure.
ejasquith
[Walkthrough Project] A simple JS based maths game