Untitled
Guest 11 20th Dec, 2024
// ==UserScript==
// @name KtoTuJest
// @version 2.12
// @description ok
// @author You
// @match gefion.margonem.pl/
// @match jaruna.margonem.pl/
// @match tarhuna.margonem.pl/
// @match brutal.margonem.pl/
// @match experimental.margonem.pl/
// @match lelwani.margonem.pl/
// @grant none
// ==/UserScript==
window.hero.miniMapPlusSearchPath = function (j, k) {
if (this.isBlockedSearchPath()) return this.blockedInfoSearchPath();
for (var n = [], p = 128 & hero.opt ? 8 : 20, q = Math.max(0, Math.min(j, this.x) - p), u = Math.min(map.x - 1, Math.max(j, this.x) + p), v = Math.max(0, Math.min(k, this.y) - p), w = Math.min(map.y - 1, Math.max(k, this.y) + p), z = q - 1; u + 1 >= z; z++) {
n[z] = [];
for (var A = v - 1; w + 1 >= A; A++) n[z][A] = !(z >= q && u >= z && A >= v && w >= A) || isset(g.npccol[z + 256 * A]) || map.col && "0" != map.col.charAt(z + A * map.x) ? -2 : -1
}
n[this.x][this.y] = 0, b = -1, road = [];
for (var B = {
x: -1,
y: -1,
dist: 99
}, C = 1; u - q + w - v + 3 > C; C++)
for (var z = q; u >= z; z++)
for (var A = v; w >= A; A++) {
if (-1 != n[z][A] || n[z][A - 1] != C - 1 && n[z][A + 1] != C - 1 && n[z - 1][A] != C - 1 && n[z + 1][A] != C - 1 || (n[z][A] = C), 0 < n[j][k]) {
z = u + 1;
break
}
B.dist2 = Math.abs(j - z) + Math.abs(k - A), n[z][A] == C && B.dist2 < B.dist && (B.x = z, B.y = A, B.dist = B.dist2)
}
if (B.hdist = Math.abs(j - hero.x) + Math.abs(k - hero.y), 0 < n[j][k] || B.dist < B.hdist) {
0 > n[j][k] && (j > B.x ? b = 2 : j < B.x ? b = 1 : k > B.y ? b = 0 : k < B.y && (b = 3), j = B.x, k = B.y), road[0] = {
x: j,
y: k
};
for (var D = n[j][k] - 1, E = j, F = k; 0 < D; D--) n[E][F - 1] == D ? F-- : n[E][F + 1] == D ? F++ : n[E - 1][F] == D ? E-- : n[E + 1][F] == D ? E++ : D = 0, D && (road[n[j][k] - D] = {
x: E,
y: F
})
}
1 < road.length && null == g.playerCatcher.follow && $("#target").stop().css({
left: 32 * j,
top: 32 * k,
display: "block",
opacity: 1
}).fadeOut(1e3)
};
var cweldozdedania = 0,
czyatakowany = !1,
czyatakowac = true;
window.atakujGracza = function (j) {
czyatakowac = true;
0 != cweldozdedania && 2 == map.pvp && ($("#other" + cweldozdedania).css("border-radius", ""), $("#other" + cweldozdedania).css("box-shadow", "")), 2 == map.pvp ? (cweldozdedania = j, czyatakowany = !1, message("[color=lightblue]Jazda z " + g.other[cweldozdedania].nick + "![/color]")) : (cweldozdedania = 0, czyatakowany = !0, message("[color=lightblue']Nie jeste\u015B na red mapce[/color]"))
}
window.sledzGracza = function (j) {
if(cweldozdedania != 0) $("#other" + cweldozdedania).css("border-radius", ""), $("#other" + cweldozdedania).css("box-shadow", "");
czyatakowac = false;
cweldozdedania = j;
}
window.copyPIn = parseInput;
window.dobijGracza = function (j) {
parseInput = (input) => {
if (input && input.emo) {
for (var emo in input.emo) {
if (input.emo[emo].name === "noemo" && input.emo[emo].source_id == j) {
_g("fight&a=attack&id=" + j);
parseInput = window.copyPIn;
}
}
}
window.copyPIn(input);
};
window.hero.miniMapPlusSearchPath(g.other[j].x, g.other[j].y);
}
var lastTimestamp = unix_time(true);
cancelChase = function () {
czyatakowany = !1, $("#other" + cweldozdedania).css("border-radius", ""), $("#other" + cweldozdedania).css("box-shadow", ""), hero.miniMapPlusSearchPath(hero.x, hero.y), cweldozdedania = 0, message("[color=lightblue]Przerwano[/color]")
}
let p, q;
(g => {
_g = function (data, ...args){
g(data, ...args);
if(data == "walk"){
p = undefined;
q = undefined;
}
}
})(_g);
! function (j) {
hero.run = function () {
if (!czyatakowany && 0 != cweldozdedania) {
let k = hero.x,
n = hero.y;
if (g.other[cweldozdedania]) {
p = g.other[cweldozdedania].x,
q = g.other[cweldozdedania].y;
$("#other" + cweldozdedania).css("border-radius", "5px"), $("#other" + cweldozdedania).css("box-shadow", "0 0 2px 2px red"), 2 >= Math.abs(hero.x - p) && 2 >= Math.abs(n - q) && (!g.battle && czyatakowac) ? (
(unix_time(true) - lastTimestamp > 1) ?
(_g("fight&a=attack&id=" + cweldozdedania),
lastTimestamp = unix_time(true)) : 1, g.battle ? (czyatakowany = !0, $("#other" + cweldozdedania).css("border-radius", ""), $("#other" + cweldozdedania).css("box-shadow", ""), cweldozdedania = 0) : hero.miniMapPlusSearchPath(p, q)) : (1 < Math.abs(k - p) || 1 < Math.abs(n - q)) && hero.miniMapPlusSearchPath(p, q)
} else {
if(p != undefined && q != undefined){
for(let i in Object.keys(g.gw)){
let d = Object.keys(g.gw)[i].split('.');
let dx = parseInt(d[0]);
let dy = parseInt(d[1]);
if(Math.abs(p - dx) + Math.abs(q - dy) < 8){
hero.miniMapPlusSearchPath(dx, dy)
break;
}
}
}
}
}
j.apply(this, arguments)
}
}(hero.run);
document.querySelector("#nick").addEventListener("click", cancelChase);
var powiadomienia = localStorage;
if (powiadomienia.getItem('pdzwiekowe') == null) powiadomienia.setItem('pdzwiekowe', 'false');
g.loadQueue.push({
fun: function () {
$('<div id="pDzw">Włącz powiadomienia dźwiękowe</div>').appendTo('#cfg_options').click(function () {
if ($('#pDzw').attr('class')) {
$('#pDzw').removeClass('active');
powiadomienia.setItem('pdzwiekowe', 'false')
} else {
$('#pDzw').addClass('active');
powiadomienia.setItem('pdzwiekowe', 'true')
}
});
if (powiadomienia.getItem('pdzwiekowe') == 'true') $('#pDzw').addClass('active');
},
data: ''
});
if (powiadomienia.getItem('pwrog') == null) powiadomienia.setItem('pwrog', 'false');
g.loadQueue.push({
fun: function () {
$('<div id="pTekst">Informuj o wrogu na mapce</div>').appendTo('#cfg_options').click(function () {
if ($('#pTekst').attr('class')) {
$('#pTekst').removeClass('active');
powiadomienia.setItem('pwrog', 'false')
} else {
$('#pTekst').addClass('active');
powiadomienia.setItem('pwrog', 'true')
}
});
if (powiadomienia.getItem('pwrog') == 'true') $('#pTekst').addClass('active');
},
data: ''
});
if (powiadomienia.getItem('ptyt') == null) powiadomienia.setItem('ptyt', 'false');
g.loadQueue.push({
fun: function () {
$('<div id="pTytan">Informuj o tytanie/herosie na mapie</div>').appendTo('#cfg_options').click(function () {
if ($('#pTytan').attr('class')) {
$('#pTytan').removeClass('active');
powiadomienia.setItem('ptyt', 'false')
} else {
$('#pTytan').addClass('active');
powiadomienia.setItem('ptyt', 'true')
}
});
if (powiadomienia.getItem('ptyt') == 'true') $('#pTytan').addClass('active');
},
data: ''
});
//wykrywacz
$.getScript("https://code.responsivevoice.org/responsivevoice.js", function () {
var lista = [];
var czek = false;
(k => {
newOther = function (b) {
k(b);
for (var c in b) {
let P = b[c];
for (var i = 0; i < lista.length; i++) {
if (lista[i] == P.id) {
czek = true;
break;
} else {
czek = false;
continue;
}
}
if ((P.relation == "en" || P.relation == "cl-en") && map.pvp == 2 && czek == false) {
lista.push(P.id);
var text_to_sp = "";
message('[color=red][b]Wróg: ' + P.nick + '[/b][/color]');
if (responsiveVoice.isPlaying() == false && powiadomienia.getItem('pdzwiekowe') == 'true') {
text_to_sp = "Wróg: " + P.nick;
if (P.clan) {
text_to_sp += " z klanu " + P.clan.name;
}
responsiveVoice.speak(text_to_sp, "Polish Female");
}
if (hero.clan != 0 && powiadomienia.getItem('pwrog') == 'true') {
let clanName = "";
if(P.clan) clanName = "["+P.clan.name+"]";
chatSend(`/k Wróg ${P.nick} (${P.lvl}${P.prof}) ${clanName} - ${map.name} (${P.x},${P.y})`);
}
for (var i = 0; i < lista.length; i++) {
if (lista[i] == P.id) {
setTimeout(function () {
lista.splice(i, 1);
}, 6e4);
break;
}
}
}
}
}
})(newOther);
window.btnClick = function(e,x,y){
if(x && y) hero.miniMapPlusSearchPath(x ,y);
$(e).parent().parent().remove();
}
//wykrywacz herosa
! function (_newNpc) {
newNpc = function (npcs) {
for (var x in npcs) {
var npc = npcs[x];
if (npc.wt > 79 && g.worldname != "experimental" && map.mode != 5 && npc.walkover != 1) {
var npcnick = npc.nick;
var cord1 = npc.x;
var cord2 = npc.y;
if (hero.clan != 0 && powiadomienia.getItem('ptyt') == 'true') {
chatSend(`/k Znalazłem: ${npc.nick} ${npc.lvl}lvl na mapie ${map.name} ${npc.x},${npc.y}`);
}
if (!responsiveVoice.isPlaying() && powiadomienia.getItem('pdzwiekowe') == 'true') {
if (npc.wt > 100) responsiveVoice.speak("Znaleziono tytana: " + npcnick, "Polish Female");
else responsiveVoice.speak("Znaleziono herosa: " + npcnick, "Polish Female");
}
if (!g.battle) {
$(`<div id="heroBox" style="z-index: 300;width: 400px;text-align: center;border: 1px solid white;display: flex;box-sizing: border-box;padding: 1em;font-size: 15px;border-radius: 15px;height: 125px;background: rgb(0 0 175 / 0.7);font-family: Consolas;position: fixed;right: 0;left: 0;margin: 0 auto;top: 50%;transform: translateY(-50%);">
<div style="width:25%"><img src=obrazki/npc/${npc.icon} style="max-width: 100px; max-height: 100px; object-fit: contain;" ></div>
<div style="width:75%"> ${npc.nick} (${npc.lvl}) <br> ${map.name} - ${npc.x},${npc.y}</div><div style="position: absolute;bottom: 1em;right: 0;left: 0;">
<button style="margin: 0 0.5em" onclick="btnClick(this,${npc.x},${npc.y})">Podejdź</button>
<button style="margin: 0 0.5em" onclick="btnClick(this)">Zamknij</button></div>
</div>`).appendTo("body");
} else {
message('Niedaleko jest:[br][img=https://www.margonem.pl/obrazki/npc/' + npc.icon + ' ][br][b]' + npc.nick + '[/b] ' + npc.lvl + 'lvl [' + npc.x + ',' + npc.y + ']')
}
}
}
_newNpc.call(this, npcs);
}
}(newNpc);
});
mamnacos = function () {
$('<div id="detektor" style="width: auto; font-size: 13px; font-family: sans-serif; top: 0px; left: 0px; position: absolute"><div class="head"><b>KtoTuJest</b> ⋅ <a ctip="t_other" tip="Teleportuje na Kwiatki." class="ucieczka">[UCIECZKA]</a></div><div class="content"></div></div><br>').appendTo("body");
$('<style>#detektor a:link { color: white; text-decoration: none }</style>').appendTo('head');
$('<style>#detektor a:visited { color: white; text-decoration: none }</style>').appendTo('head');
$('<style>#detektor a:hover { color: lightblue; text-decoration: underline }</style>').appendTo('head');
$("#detektor .ucieczka").css({
'color': 'white'
});
var ucieczka = false;
var id_teleporta = "";
$("#detektor .ucieczka").click(function () {
if (ucieczka) {
ucieczka = false;
$("#detektor .ucieczka").css({
'color': 'white'
});
id_teleporta = ""
} else if (g.battle) {
$("#detektor .ucieczka").css({
'color': 'green'
});
ucieczka = true;
if (hero.lvl >= 70) {
for (var i in g.item) {
if (g.item[i].name == 'Zwój teleportacji na Kwieciste Przejście') {
id_teleporta = g.item[i].id;
break;
}
}
} else {
message("Radź sobie sam :(");
ucieczka = false;
$("#detektor .ucieczka").css({
'color': 'white'
});
}
} else {
ucieczka = false;
}
});
! function (tmpBattleMsg) {
battleMsg = function (c, t) {
var ret = tmpBattleMsg(c, t);
if (c.search(/winner=/) >= 0) {
if (ucieczka && id_teleporta != "") {
_g("moveitem&st=1&id=" + id_teleporta);
ucieczka = false;
$("#detektor .ucieczka").css({
'color': 'white'
});
}
}
return ret;
}
}(battleMsg);
ahahahahaahahhah = window.setInterval(function () {
var numerek = 1;
var jest = false;
$('#detektor .content').html('');
for (var a in g.other) {
var user = g.other[a];
if ((user.relation == 'en' || user.relation == 'cl-en') && map.pvp == 2) {
jest = true;
}
if (numerek < 10) {
numerek = "0" + numerek;
}
d = Math.round(Math.sqrt(Math.pow(user.x - hero.x, 2) + Math.pow(user.y - hero.y, 2)));
if (user.lvl === undefined || user.nick === undefined) {
return false;
} else if (user.relation == "fr" || user.relation == "cl-fr") {
$('#detektor .content').append('<div id="detektor-' + user.id + '" class="user"><span style="color: #11ff4d">' + numerek + '. <b>' + user.nick + '</span></b></a> ' + user.lvl + '' + user.prof + ' [<a href="javascript:onclick=window.sledzGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby śledzić.">Odl.:' + d + '</a>]</div>');
} else if (user.relation == "cl") {
$('#detektor .content').append('<div id="detektor-' + user.id + '" class="user"><span style="color: #388eff">' + numerek + '. <b>' + user.nick + '</span></b></a> ' + user.lvl + '' + user.prof + ' [<a href="javascript:onclick=window.sledzGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby śledzić.">Odl.:' + d + '</a>]</div>');
} else if (user.relation == "en") {
$('#detektor .content').append('<div id="detektor-' + user.id + '" class="user"><span style="color: #ff0000">' + numerek + '. <b>' + user.nick + '</span></b></a> ' + user.lvl + '' + user.prof + ' [<a href="javascript:onclick=window.sledzGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby śledzić.">Odl.:' + d + '</a>] [<a href="javascript:onclick=window.atakujGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby rozpocząć pościg.">ATAKUJ</a>][<a href="javascript:onclick=window.dobijGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby dobić.">DOBIJ</a>]</div>');
} else if (user.relation == "cl-en") {
$('#detektor .content').append('<div id="detektor-' + user.id + '" class="user"><span style="color: #c11f1f">' + numerek + '. <b>' + user.nick + '</span></b></a> ' + user.lvl + '' + user.prof + ' [<a href="javascript:onclick=window.sledzGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby śledzić.">Odl.:' + d + '</a>] [<a href="javascript:onclick=window.atakujGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby rozpocząć pościg.">ATAKUJ</a>][<a href="javascript:onclick=window.dobijGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby dobić.">DOBIJ</a>]</div>');
} else {
$('#detektor .content').append('<div id="detektor-' + user.id + '" class="user">' + numerek + '. <b>' + user.nick + '</b></a> ' + user.lvl + '' + user.prof + ' [<a href="javascript:onclick=window.sledzGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby śledzić.">Odl.:' + d + '</a>] [<a href="javascript:onclick=window.atakujGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby rozpocząć pościg.">ATAKUJ</a>][<a href="javascript:onclick=window.dobijGracza(' + user.id + ');" ctip="t_other" tip="Kliknij, aby dobić.">DOBIJ</a>]</div>');
}
numerek++;
}
}, 500);
}
g.loadQueue.push({
fun: mamnacos,
data: ''
})
To share this paste please copy this url and send to your friends
RAW Paste Data