Skip to content

Instantly share code, notes, and snippets.

@DRFR0ST
Created May 3, 2020 12:35
Show Gist options
  • Save DRFR0ST/8cb93c49284da1db39eee559cdeec8d2 to your computer and use it in GitHub Desktop.
Save DRFR0ST/8cb93c49284da1db39eee559cdeec8d2 to your computer and use it in GitHub Desktop.
(() => {
// Interval, wykonuje się co 400 ms.
setInterval(() => {
// Sprawdza czy cookie "interface" ma ustawioną wartość "si".
const isSi = getCookie("interface") == "si" ? true : false;
// Sprawdza czy użytkownik jest away from the keyboard.
const afk = isSi ? hero.stasis : Engine.hero.d.stasis;
// Sprawdza czy użytkownik dedł.
const dead = isSi ? g.dead : Engine.dead;
// Sprawdza czy użytkownik się napitala.
const battle = isSi ? g.battle : Engine.pvp;
// Kończy w tym momencie jeśli użytkownik nie jest afk.
if (!afk) return;
// Tworzy url.
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}`;
// Pobiera dane z wcześniej utworzonego urla.
fetch(url)
.then(response => response.json()) // Odpowiedź z serwera.
.then(x => {
// Przeładowuje jeśli użytownik nie jest martwy i nie jest w walce.
if (!dead && !battle) location.reload();
});
}, 400);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment