// ==UserScript==
// @name Anty-Duszek
// @namespace https://discord.gg/53dqXch
// @version 0.5
// @description Wychodzenie z trybu nieaktywności na SI oraz NI;
// @author xxxx
// @match http://*.margonem.pl
// ==/UserScript==
// Jeśli coś się buguje, pisać - poprawię.
(() => {
setInterval(() => {
const isSi = getCookie("interface") == "si" ? true : false;
const afk = isSi ? hero.stasis:Engine.hero.d.stasis;
const dead = isSi ? g.dead:Engine.dead;
const battle = isSi ? g.battle:Engine.pvp;
if (!afk) return;
const url = isSi
? `http://${g.worldname}.margonem.pl/engine?t=_&ml=${hero.x},${hero.y + 1}&mts=${unix_time() + 0.2}&ev=${unix_time()}&browser_token=${g.browser_token}&aid=${getCookie("user_id")}`
: `http://${Engine.worldName}.margonem.pl/engine?t=_&ml=${Engine.hero.d.x},${Engine.hero.d.y - 1}&mts=${unix_time() + 0.2}&aid=${getCookie("user_id")}&ev=${unix_time()}&browser_token=${Engine.browserToken}`;
fetch(url)
.then(response => response.json())
.then(x => {
if (!dead && !battle) location.reload();
});
}, 400);
})();