Facebook
From Chocolate Ibis, 4 Years ago, written in Plain Text.
This paste is a reply to e2 from Michał Zawadka - view diff
Embed
Download Paste or View Raw
Hits: 541
  1. // ==UserScript==
  2. // @name         Bot na e2 test!!!
  3. // @version      1.4
  4. // @description  bot na e2 w trakcie rozbudowy, dziala na NI i SI
  5. // @author       Adi Wilk
  6. // @match        http://*.margonem.pl/
  7. // @match        https://*.margonem.pl/
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (()=>{class a{constructor(a,b,c,d,e,f){this.width=b,this.height=c,this.collisions=this.parseCollisions(a,b,c),this.additionalCollisions=f||{},this.start=this.collisions[d.x][d.y],this.end=this.collisions[e.x][e.y],this.start.beginning=!0,this.start.g=0,this.start.f=this.heuristic(this.start,this.end),this.end.target=!0,this.end.g=0,this.addNeighbours(),this.openSet=[],this.closedSet=[],this.openSet.push(this.start)}parseCollisions(a,c,d){const e=Array(c);for(let f=0;f<c;f++){e[f]=Array(d);for(let g=0;g<d;g++)e[f][g]=new b(f,g,"0"!==a.charAt(f+g*c))}return e}addNeighbours(){for(let a=0;a<this.width;a++)for(let b=0;b<this.height;b++)this.addPointNeighbours(this.collisions[a][b])}addPointNeighbours(a){const[b,c]=[a.x,a.y],d=[];0<b&&d.push(this.collisions[b-1][c]),0<c&&d.push(this.collisions[b][c-1]),b<this.width-1&&d.push(this.collisions[b+1][c]),c<this.height-1&&d.push(this.collisions[b][c+1]),a.neighbours=d}anotherFindPath(){for(;0<this.openSet.length;){let a=this.getLowestF(),b=this.openSet[a];if(b===this.end)return this.reconstructPath();this.openSet.splice(a,1),this.closedSet.push(b);for(const a of b.neighbours)if(this.closedSet.includes(a))continue;else{const c=b.g+1;let d=!1;this.end!=this.collisions[a.x][a.y]&&(this.openSet.includes(a)||a.collision||this.additionalCollisions[a.x+256*a.y])?c<a.g&&!a.collision&&(d=!0):(this.openSet.push(a),a.h=this.heuristic(a,this.end),d=!0),d&&(a.previous=b,a.g=c,a.f=a.g+a.h)}}}getLowestF(){let a=0;for(let b=0;b<this.openSet.length;b++)this.openSet[b].f<this.openSet[a].f&&(a=b);return a}reconstructPath(){const a=[];for(let b=this.end;b!==this.start;)a.push(b),b=b.previous;return a}heuristic(a,b){return Math.abs(a.x-b.x)+Math.abs(a.y-b.y)}}class b{constructor(a,b,c){this.x=a,this.y=b,this.collision=c,this.g=1e7,this.f=1e7,this.neighbours=[],this.beginning=!1,this.target=!1,this.previous=void 0}}new class{constructor(){this.storage=JSON.parse(localStorage.getItem("adi-bot-storage"))||{x:0,y:0,name:"",minimalized:!1},this.interface="object"==typeof window.Engine?"ni":"object"==typeof window.g?"si":"none",this.lootfilterSettings=JSON.parse(localStorage.getItem("adi-bot-lootfilterSettings"))||{stat:{gold:{translation:"Z\u0142oto",active:!0},quest:{translation:"Questowe",active:!0},runes:{translation:"Runy",active:!0},unique:{translation:"Unikaty",active:!0},heroic:{translation:"Heroiki",active:!0},legendary:{translation:"Legendy",active:!0}},names:[]},this.QuickGroupSettings=JSON.parse(localStorage.getItem("adi-bot-QuickGroupSettings12"))||{adding:{translation:"Automatycznie dodawaj do grupy znaj/klan",active:!0},accepting:{translation:"Automatycznie przyjmuj zaproszenia do grupy",active:!0},reSendingMessage:{translation:"Automatycznie odpisuj innym graczom",active:!0}},this.npcToKillId=void 0,this.lastAttackTimestamp=this.timeStamp,this.timerData=JSON.parse(this.getCookie("adi-bot-timer"))||{},this.refreshTime=[3,6],this.delayToRelog=35,this.waitForNpcRespawn=120,this.randomAnswers=["nie interesuje mnie to","kiedy\u015B to by\u0142o, nie to co tera","to fajnie","nom","super","co ?","interesuj\u0105ce","bombowo","Bardzo si\u0119 ciesz\u0119.","Xd","co","co.?","co?","xD","xd","ehhhhhh","heh","fajnie fajnie :]"],this.answersBeforeAddingToEnemies=["dobra, do wrog\xF3w cie daje :)","papapappapapapap","nara.","w ty\u0142ku cie mam gosciu, nara","papapapp","nara kole\u017Cko","lecisz do wrogow :P","narka ;)","hehehehhe, narq","ej jeste\u015B?","haha. ;)"],this.messagesInc=JSON.parse(localStorage.getItem("adi-bot-messages"))||{},this.isHealing=!1,this.isActuallySendingMessage=!1,this.startInctementingLagRefresher=!1,this.incrementValue=0,this.init()}get collisions(){return"ni"===this.interface?this.updateCollisions():window.map.col}get npccol(){return"ni"===this.interface?this.getNpcColsNI():window.g.npccol}get timeStamp(){return Math.floor(new Date().getTime()/1e3)}get hero(){return"ni"===this.interface?window.Engine.hero.d:window.hero}get map(){return"ni"===this.interface?window.Engine.map.size:window.map}get mapName(){return"ni"===this.interface?window.Engine.map.d.name:window.map.name}get npcs(){return"ni"===this.interface?this.npcsOnNewInterface:window.g.npc}get others(){return"ni"===this.interface?this.othersOnNewInterface:window.g.other}get world(){return"ni"===this.interface?window.Engine.worldName:window.g.worldname}get serverTimerSpeed(){return"none"!==this.interface&&["aldous","berufs","brutal","classic","gefion","hutena","jaruna","katahha","lelwani","majuna","nomada","perkun","tarhuna","telawel","tempest","zemyna","zorza"].includes(this.world.toLowerCase())?1:"none"!==this.interface&&"syberia"===this.world.toLowerCase()?2:3}get battle(){return"ni"===this.interface?!!window.Engine.battle&&!window.Engine.battle.endBattle:window.g.battle}get dead(){return"ni"===this.interface?window.Engine.dead:window.g.dead}get party(){return"ni"===this.interface?Engine.party:window.g.party}get loots(){return"ni"===this.interface?window.Engine.loots!==void 0&&!!(0<Object.keys(window.Engine.loots.items).length):!1!==window.g.loots}get issetMyNpcOnMap(){return Object.values(this.npcs).some(a=>this.storage.name.toLowerCase().includes(a.nick.toLowerCase()))}get items(){return"ni"===this.interface?window.Engine.items.fetchLocationItems("g"):Object.values(window.g.item)}get npcsOnNewInterface(){const a=window.Engine.npcs.check(),b={};for(const[c,d]of Object.entries(a))b[c]=d.d;return b}get othersOnNewInterface(){const a=window.Engine.others.check(),b={};for(const[c,d]of Object.entries(a))b[c]=d.d;return b}getNpcColsNI(){const a={};for(const{x:b,y:c}of Object.values(this.npcs))a[b+256*c]=!0;return a}chatParser(){"ni"===this.interface&&window.API.addCallbackToEvent("newMsg",([a,b])=>{this.chatFilter(b)}),"si"===this.interface&&window.g.chat.parsers.push(a=>{this.chatFilter(a)})}chatFilter(a){const{n:b,t:c,ts:d,k:e}=a;if(""!==b&&b!==this.hero.nick&&"System"!==b&&!1!==this.QuickGroupSettings.reSendingMessage.active&&1>=window.unix_time()-d&&!this.isActuallySendingMessage){if(void 0!==this.messagesInc[b+this.world]&&3<this.messagesInc[b+this.world])return;c.toLowerCase().includes(this.hero.nick.toLowerCase())&&0===e&&this.sendMessage(b,e),3===e&&this.sendMessage(b,e)}}sendMessage(a,b,c=!1,d){this.isActuallySendingMessage=!0,this.messagesInc[a+this.world]===void 0?this.messagesInc[a+this.world]=1:this.messagesInc[a+this.world]++,this.saveMessages(),3<this.messagesInc[a+this.world]&&(c=!0),d=c?this.answersBeforeAddingToEnemies[Math.floor(Math.random()*this.answersBeforeAddingToEnemies.length)]:this.randomAnswers[Math.floor(Math.random()*this.randomAnswers.length)],3===b&&(d=`@${a.split(" ").join("_")} ${d}`),this.Sleep(1e3*(Math.floor(11*Math.random())+5)).then(()=>{window._g("chat",{c:d}),!0===c&&this.addToEnemy(a),this.isActuallySendingMessage=!1})}Sleep(a){return new Promise(b=>{setTimeout(()=>{b(null)},a)})}saveMessages(){localStorage.setItem("adi-bot-messages",JSON.stringify(this.messagesInc))}addToEnemy(a){window._g(`friends&a=eadd&nick=${a}`)}getWay(b,c){return new a(this.collisions,this.map.x,this.map.y,{x:this.hero.x,y:this.hero.y},{x:b,y:c},this.npccol).anotherFindPath()}goTo(a,b){const c=this.getWay(a,b);Array.isArray(c)&&("ni"===this.interface?window.Engine.hero.autoPath=c:window.road=c)}getDistanceToNpc(a,b){const c=this.getWay(a,b);return Array.isArray(c)?c.length:void 0}updateCollisions(){const a=[],{x:b,y:c}=this.map;for(let d=0;d<c;d++)for(let c=0;c<b;c++)a.push(window.Engine.map.col.check(c,d));return a.join("")}initBox(){const a=document.createElement("div");a.classList.add("adi-bot-box"),this.appendText(a,"Wprowad\u017A nazwy elit II:");const b=document.createElement("input");b.type="text",b.classList.add("adi-bot-input-text"),b.value=this.storage.name,b.addEventListener("keyup",()=>{this.storage.name=b.value,this.saveStorage()}),a.appendChild(b),this.appendText(a,"Lootfilter:");for(const[b,{translation:c,active:d}]of Object.entries(this.lootfilterSettings.stat))this.createCheckBox(a,c,d,a=>{this.lootfilterSettings.stat[b].active=a,localStorage.setItem("adi-bot-lootfilterSettings",JSON.stringify(this.lootfilterSettings))});this.appendText(a,"\u0141ap itemki po nazwie:");const c=document.createElement("input");c.classList.add("adi-bot-input-text"),c.tip="Oddzielaj przecinkiem!",c.type="text",c.value=this.lootfilterSettings.names.join(", "),c.addEventListener("keyup",()=>{const a=c.value.split(",");for(let b=0;b<a.length;b++)a[b]=a[b].trim();this.lootfilterSettings.names=a,localStorage.setItem("adi-bot-lootfilterSettings",JSON.stringify(this.lootfilterSettings))}),a.appendChild(c),this.appendText(a,"Ustawienia QG:");for(const[b,{translation:c,active:d}]of Object.entries(this.QuickGroupSettings))this.createCheckBox(a,c,d,a=>{this.QuickGroupSettings[b].active=a,localStorage.setItem("adi-bot-QuickGroupSettings12",JSON.stringify(this.QuickGroupSettings))});this.makeBoxDraggable(a,()=>{this.storage.x=parseInt(a.style.left),this.storage.y=parseInt(a.style.top),this.saveStorage(),window.message(`<span style="color: red">Zapisano pozycję okienka :)</span>`)}),this.storage.hasOwnProperty("minimalized")||(this.storage.minimalized=!1,this.saveStorage()),a.addEventListener("dblclick",({x:b,y:c})=>{!1===this.storage.minimalized?(a.style.width="10px",a.style.height="10px",this.storage.minimalized=!0,this.changeVisibility(a,!0)):(a.style.width="360px",a.style.height="272px",this.storage.minimalized=!1,this.changeVisibility(a,!1)),a.style.left=b-parseInt(a.style.width)/2+"px",a.style.top=c-parseInt(a.style.height)/2+"px",this.storage.x=parseInt(a.style.left),this.storage.y=parseInt(a.style.top),this.saveStorage()}),"ni"===this.interface?document.querySelector(".game-window-positioner").appendChild(a):document.body.appendChild(a),this.initStyle(),!0===this.storage.minimalized&&(a.style.width="10px",a.style.height="10px",this.changeVisibility(a,!0))}changeVisibility(a,b){for(const c of a.childNodes)c.style.display=!0===b?"none":""}appendText(a,b){const c=document.createElement("div");c.appendChild(document.createTextNode(b)),a.appendChild(c)}createCheckBox(a,b,c,d){const e=document.createElement("div"),f=document.createElement("input");f.type="checkbox",f.name=b+"adi-bot",f.id=b+"adi-bot",f.checked=c,e.appendChild(f);const g=document.createElement("label");g.setAttribute("for",b+"adi-bot"),g.innerHTML=b,f.addEventListener("change",()=>{d(f.checked)}),e.appendChild(g),a.appendChild(e)}makeBoxDraggable(a,b){$(a).draggable({containment:"window",stop:b})}saveStorage(){localStorage.setItem("adi-bot-storage",JSON.stringify(this.storage))}initStyle(){const a=document.createElement("style"),b=`
  12.             .adi-bot-box {
  13.                 position: absolute;
  14.                 text-align: center;
  15.                 padding: 10px;
  16.                 height: 272px;
  17.                 width: 360px;
  18.                 left: ${this.storage.x}px;
  19.                 top: ${this.storage.y}px;
  20.                 background: #975b83;
  21.                 border: 2px solid white;
  22.                 border-radius: 8px;
  23.                 color: black;
  24.                 z-index: 999;
  25.             }
  26.             .adi-bot-input-text {
  27.                 text-align: center;
  28.                 border: 2px solid lightblue;
  29.                 border-radius: 3px;
  30.                 color: black;
  31.                 cursor: text;
  32.             }
  33.             `;a.type="text/css",a.appendChild(document.createTextNode(b)),document.head.appendChild(a)}initNewNpc(){if("ni"===this.interface&&(window.API.addCallbackToEvent("newNpc",a=>{void 0!==a&&this.addNpcs(a.d)}),window.API.addCallbackToEvent("removeNpc",a=>{void 0!==a&&this.removeNpcs(a.d)})),"si"===this.interface){const a=window.newNpc;window.newNpc=b=>{if(void 0!==b)for(const[a,c]of Object.entries(b))void 0!==c.del&&void 0!==window.g.npc[a]?this.removeNpcs(window.g.npc[a],a):void 0!==c&&this.addNpcs(c,a);a(b)}}}initNewOther(){if("ni"===this.interface&&(this.makeParty(),window.API.addCallbackToEvent("newOther",a=>{this.filterOther(a.d)})),"si"===this.interface){this.makeParty();const a=window.newOther;window.newOther=b=>{if(a(b),void 0!==b)for(const a of Object.values(b))this.filterOther(a)}}}filterOther(a){if(a!==void 0){const{relation:b,id:c}=a;!0===this.canHeroTryToAttack()&&["cl","fr"].includes(b)&&!0===this.QuickGroupSettings.adding.active&&this.sendInviteToParty(c)}}makeParty(){if("object"!=typeof this.party)return this.sendInvites();const a="ni"===this.interface?this.party.getLeaderId()===this.hero.id:1===this.party[this.hero.id].r;!0==a&&this.sendInvites()}sendInvites(){if(this.others!==void 0)for(const a of Object.values(this.others))this.filterOther(a)}sendInviteToParty(a){window._g(`party&a=inv&id=${a}`)}initChecker(){if(setTimeout(()=>{this.initChecker()},500),!0===this.dead&&(this.removeNpcsFromThisCharId(this.hero.id),this.logout()),!0===this.canHeroTryToAttack())try{if(void 0!==this.npcToKillId){const{x:a,y:b}=this.npcs[this.npcToKillId];1>=Math.abs(this.hero.x-a)&&1>=Math.abs(this.hero.y-b)?0<this.timeStamp-this.lastAttackTimestamp&&window._g(`fight&a=attack&ff=1&id=-${this.npcToKillId}`,a=>a.hasOwnProperty("alert")&&a.alert.includes("Przeciwnik walczy ju\u017C z kim\u015B innym")?void(this.lastAttackTimestamp=this.timeStamp+2):void(this.lastAttackTimestamp=this.timeStamp+1)):this.goTo(a,b)}else this.reFindNpcs()}catch(a){this.npcToKillId=void 0}}canHeroTryToAttack(){return!(this.battle||this.dead)}removeNpcs(a){const{x:b,y:c,nick:d,lvl:e}=a;"ni"===this.interface?window.Engine.map.col.unset(b,c,window.Engine.map.col.check(b,c)):window.map.nodes.changeCollision(b,c,0),this.storage.name.toLowerCase().includes(d.toLowerCase())&&(this.addNpcToTimer(d,e),this.npcToKillId=void 0,this.reFindNpcs())}findEilteIIName(a){for(const b of Object.values(this.npcs)){const{nick:c,lvl:d,grp:e,wt:f}=b;if(e===a&&19<f)return[c,d]}}addNpcs(a,b){"ni"===this.interface&&(b=a.id),this.filterNpc(a,b)}isNpcFake(a,b){const c=new Image,d=document.createElement("canvas").getContext("2d"),e=()=>{const a=d.getImageData(Math.floor(d.width/2),0,1,d.height).data;for(let c=3;c<a.length;c+=4)if(0<a[c])return b(!1);return b(!0)};c.onload=function(){d.width=this.width,d.height=this.height,d.drawImage(c,0,0),e()},c.src=a}filterNpc(a,b){const{nick:c,icon:d,type:e,wt:f,grp:g}=a;if(!(2!==e&&3!==e||10>f||void 0===c)&&void 0===this.npcToKillId&&this.storage.name.toLowerCase().includes(c.toLowerCase())&&""!==this.storage.name){const a=d.includes("/obrazki/npc/")?d:`/obrazki/npc/${d}`;this.isNpcFake(a,a=>{!1===a&&(this.npcToKillId=0===g?parseInt(b):parseInt(this.findBestNpcFromGrp(g)),this.makeParty())})}}findBestNpcFromGrp(a){let b,c=999999;for(const[d,e]of Object.entries(this.npcs)){const{x:f,y:g,grp:h}=e;if(a===h){const a=this.getDistanceToNpc(f,g);a<c&&(b=d,c=a)}}return b}reFindNpcs(){for(const[a,b]of Object.entries(this.npcs))this.filterNpc(b,a)}logout(){this.battle||this.loots||this.issetMyNpcOnMap||this.isHealing||(window.location.href="http://margonem.pl")}logIn(a,b){if(("none"===this.interface||void 0===this.hero.id||this.hero.id!=a)&&!("none"!==this.interface&&(this.battle||this.loots||this.issetMyNpcOnMap||this.isHealing)))try{const c=new Date;c.setTime(c.getTime()+259200000),document.cookie=`mchar_id=${a}; path=/; expires=${c.toGMTString()}; domain=.margonem.pl`,window.location.href=`http://${b.toLowerCase()}.margonem.pl`}catch(a){}}getNewRespawnTime(a){return Math.round(1*(60*(200<a?18:Math.min(18,.7+.18*a-45e-5*a*a)))/parseInt(this.serverTimerSpeed))}addNpcToTimer(a,b){const c=this.mapName;this.timerData[a+this.world]={name:a,lvl:b,mapName:c,nextRespawn:this.timeStamp+this.getNewRespawnTime(b),charId:this.hero.id,world:this.world},this.saveTimersCookies()}deleteNpcFromTimer(a){this.timerData[a]!==void 0&&(delete this.timerData[a],this.saveTimersCookies())}removeNpcsFromThisCharId(a){if(void 0!==a)for(const[b,c]of Object.entries(this.timerData))c.charId==a&&this.deleteNpcFromTimer(b)}checkTimers(){for(const[a,b]of Object.entries(this.timerData))b.nextRespawn+this.waitForNpcRespawn<this.timeStamp&&this.createNewRespawnTime(a)}createNewRespawnTime(a){if(!(Object.values(this.npcs).some(b=>b.nick==this.timerData[a].name)||this.timerData[a].charId!==this.hero.id)){for(;this.timeStamp>this.timerData[a].nextRespawn;)this.timerData[a].nextRespawn+=this.getNewRespawnTime(this.timerData[a].lvl);this.saveTimersCookies()}}isThisHeroIssetInTimer(b){return void 0!==b&&Object.values(this.timerData).some(c=>c.charId==b)}isntTimersInRange(){return Object.values(this.timerData).every(b=>b.nextRespawn-this.timeStamp>this.delayToRelog)}checkHeroOnGoodMap(a){for(const[b,c]of Object.entries(this.timerData)){const{mapName:d,charId:e}=c;e==a&&this.mapName!==void 0&&d!==void 0&&d!==this.mapName&&this.deleteNpcFromTimer(b)}}initTimer(){if(0<Object.keys(this.timerData).length)if("none"===this.interface){if(Object.values(this.timerData).some(b=>b.nextRespawn-this.timeStamp<=this.delayToRelog)){const{world:a,charId:b}=Object.values(this.timerData).reduce((c,a)=>c.nextRespawn<=a.nextRespawn?c:a);void 0!==b&&this.logIn(b,a)}}else if(this.isntTimersInRange()&&this.isThisHeroIssetInTimer(this.hero.id))this.logout();else{this.checkHeroOnGoodMap(this.hero.id);const a=Object.values(this.timerData).filter(b=>b.nextRespawn-this.timeStamp<=this.delayToRelog);if(0<a.length){const{charId:b,world:c}=a.reduce((c,a)=>c.nextRespawn<=a.nextRespawn?c:a);void 0!==this.hero.id&&parseInt(b)!==this.hero.id&&this.logIn(b,c)}}this.checkTimers(),setTimeout(()=>{this.initTimer()},500)}saveTimersCookies(){const a=new Date;a.setMonth(a.getMonth()+1),this.setCookie("adi-bot-timer",JSON.stringify(this.timerData),a,"/","margonem.pl")}randomSeconds(a,b){return a*=60,b*=60,Math.floor(Math.random()*(b-a+1))+a}randomRefresh(){const[a,b]=this.refreshTime;setTimeout(()=>{window.location.reload()},1e3*this.randomSeconds(a,b))}getCookie(a){const b=document.cookie,c=a+"=";let d=b.indexOf("; "+c);if(-1!=d)d+=2;else if(d=b.indexOf(c),0!=d)return null;let e=document.cookie.indexOf(";",d);return-1==e&&(e=b.length),unescape(b.substring(d+c.length,e))}setCookie(a,b,c,d,e,f){const g=a+"="+escape(b)+(c?"; expires="+c.toGMTString():"")+(d?"; path="+d:"")+(e?"; domain="+e:"")+(f?"; secure":"");document.cookie=g}createTimerOnMainPage(){if(0===Object.keys(this.timerData).length)return;const a=document.createElement("div");a.classList.add("adi-bot-minutnik-strona-glowna"),document.querySelector(".rmenu").appendChild(a);const b=document.createElement("style");b.type="text/css",b.appendChild(document.createTextNode(`
  34.             .adi-bot-minutnik-strona-glowna {
  35.                 color: white;
  36.                 font-size: 14px;
  37.                 text-align: left;
  38.             }
  39.  
  40.             .timer_data {
  41.                 font-weight: bold;
  42.                 float: right;
  43.                 cursor: pointer;
  44.             }
  45.  
  46.             .timer_data:hover {
  47.                 color: gray;
  48.             }
  49.  
  50.             .adi-bot-konfiguracja {
  51.  
  52.             }
  53.         `)),document.head.appendChild(b),this.addNpcsToTimerBox(a),document.addEventListener("click",a=>{try{if("timer_data"===a.target.className){const[b,c]=a.target.getAttribute("timer-data").split("|");c!==void 0&&b!==void 0&&(this.deleteNpcFromTimer(b+c),window.showMsg(`Usunięto ${b} ze świata ${c.charAt(0).toUpperCase()+c.slice(1)}.`))}}catch(a){}})}addNpcsToTimerBox(a){const b={};for(const c of Object.values(this.timerData)){const{name:a,nextRespawn:d,world:e}=c;b[e]===void 0?b[e]=[{name:a,nextRespawn:d}]:b[e].push({name:a,nextRespawn:d})}let c="";for(const[d,e]of Object.entries(b)){c+=`<br><div style="text-align: center; font-weight: bold; text-decoration: underline">${this.capitalizeWorld(d)}</div>`,e.sort((a,b)=>a.nextRespawn-b.nextRespawn);const a=[];a.push("");for(const b of e){const{name:c,nextRespawn:e}=b;a.push(`<span>${this.getTimeToRespawn(c,e)}</span><span class="timer_data" tip="Kliknij, aby usunąć z timera." timer-data="${c}|${d}">---</span>`)}a.push(""),c+=a.join("<hr>")}a.innerHTML=c,setTimeout(()=>{this.addNpcsToTimerBox(a)},1e3)}capitalizeWorld(a){return a.charAt(0).toUpperCase()+a.slice(1)+":"}getTimeToRespawn(a,b){const c=b-this.timeStamp,d=10>parseInt(c/60)?`0${parseInt(c/60)}`:parseInt(c/60),e=10>c%60?`0${c%60}`:c%60;return`${a}: ${d}:${e}`}removeLockAdding(){"ni"===this.interface&&(window.Engine.lock.add=Function.prototype),"si"===this.interface&&(window.g.lock.add=Function.prototype),window.mAlert=Function.prototype}initLagRefresher(){!1===this.startInctementingLagRefresher&&(this.startInctementingLagRefresher=!0,setInterval(()=>{this.incrementValue++,8<this.incrementValue&&window.location.reload()},500));const a=this,b=window.$.ajax;window.$.ajax=(...c)=>{if(c[0].url.includes("engine?t=")){const b=c[0].success;c[0].success=(...c)=>{const d="object"==typeof c[0]&&null!==c[0]&&"ok"===c[0].e,e=b.apply(this,c);return d&&a.parseAjaxData(c[0]),e}}return b.apply(this,c)}}parseAjaxData(a){if((a.hasOwnProperty("d")&&"stop"===a.d||a.hasOwnProperty("t")&&"stop"===a.t)&&this.Sleep(2500).then(()=>{window.location.reload()}),this.incrementValue=0,a.hasOwnProperty("loot")&&a.hasOwnProperty("item")&&a.loot.hasOwnProperty("init")&&a.loot.hasOwnProperty("source")&&1===a.loot.init&&"fight"===a.loot.source){const b=[],c=[];for(const[d,e]of Object.entries(a.item)){const{stat:a,name:f}=e;!0==this.isGoodItem(a,f)?b.push(d):c.push(d)}this.sendLoots(b,c)}a.hasOwnProperty("f")&&a.f.hasOwnProperty("move")&&a.f.hasOwnProperty("current")&&0===a.f.current&&-1===a.f.move&&(this.closeBattle(),a.f.hasOwnProperty("w")&&this.autoHeal()),a.hasOwnProperty("event_done")&&this.autoHeal(),a.hasOwnProperty("ask")&&a.ask.hasOwnProperty("re")&&"party&a=accept&answer="===a.ask.re&&!0===this.QuickGroupSettings.accepting.active&&window._g("party&a=accept&answer=1")}isGoodItem(a,b){const c=[];for(const[d,{active:e}]of Object.entries(this.lootfilterSettings.stat))!0===e&&c.push(d);const d=this.lootfilterSettings.names;for(const d of c)if(a.includes(d))return!0;for(const c of d)if(b.toLowerCase()===c.toLowerCase())return!0;return!1}sendLoots(a,b){window._g(`loot&not=${b.join(",")}&want=&must=${a.join(",")}&final=1`),"si"===this.interface&&(document.querySelector("#loots").style.display="none")}closeBattle(){window._g("fight&a=quit"),"si"===this.interface&&(document.querySelector("#battle").style.display="none")}autoHeal(){if(this.dead)return;const a="ni"===this.interface?window.Engine.hero.d.warrior_stats:window.hero;if(a.hp===a.maxhp)return this.isHealing=!1;this.isHealing=!0;const b=[],c=[];let d=!1;for(const e of this.items){const{stat:f,loc:g,name:h}=e;if("g"===g){const{timelimit:g,lvl:i,leczy:j,fullheal:k}=this.parseItemStat(f);if(g!==void 0&&g.includes(","))continue;if(void 0!==i&&i>a.lvl)continue;j!==void 0&&(j<=a.maxhp-a.hp?c.push(e):d=!0),"Czarna per\u0142a \u017Cycia"===h&&(16e3<=a.maxhp-a.hp?c.push(e):d=!0),k!==void 0&&b.push(e)}}if(0<c.length){const a=c.sort((a,b)=>this.parseItemStat(b.stat).leczy-this.parseItemStat(a.stat).leczy);this.useItem(a[0].id,()=>{this.Sleep(100).then(()=>{this.autoHeal()})})}else 0<b.length?this.useItem(b[0].id,()=>{this.Sleep(100).then(()=>{this.autoHeal()})}):!1==d&&window.message(`<span style="color: red">Brakuje Ci potek!</span>`);this.isHealing=!1}parseItemStat(a){const b={},c=a.split(";");for(const d of c){const[a,c]=d.split("=");b[a]=c}return b}useItem(a,b){window._g(`moveitem&id=${a}&st=1`,b)}init(){if(this.initTimer(),"none"===this.interface)return this.createTimerOnMainPage();if("ni"===this.interface){const a=window.Storage.prototype.setItem;window.Storage.prototype.setItem=function(b,c){if("Margonem"===b){const a=JSON.parse(c);a.f=0,c=JSON.stringify(a)}a.apply(this,[b,c])}}else window.bB=Function.prototype;this.initBox(),this.initNewNpc(),this.initNewOther(),this.removeLockAdding(),this.initChecker(),this.randomRefresh(),this.initLagRefresher(),this.chatParser()}}})();

Replies to Re: e2 rss

Title Name Language When
Re: Re: e2 Bitty Echidna text 4 Years ago.