If you like this site and you like coffee, why not buy me one. Because I love it

Click to buy coffe
avatar
Untitled

Guest 81 1st Nov, 2022

MARKUP 13.43 KB
                                           
                         // ==UserScript==
// @name         UCIEKANIE BRUTUS
// @version      1.7
// @description  co tu opisywac duzo, fajny dodatek... i przydatny....
// @author       adi wilk
// @match        http://berufs.margonem.pl/
// @match        https://berufs.margonem.pl/
// @grant        none
// ==/UserScript==

(function(d, _n, _b) {
    //graficzne elementy
    let box = d.createElement("span");
    box.id = "adisonzawodowiec";
    box.innerHTML = "Przeciągnij teleport<br>";

    //chowanie okienka
    let box3 = d.createElement("span");
    box3.id = "asdasdrewwq";
    box3.classList.add("b_buttons");
    box3.tip = "Wyświetl okienko od uciekania";
    let style1 = d.createElement("style");
    style1.innerHTML = "#asdasdrewwq{left:127px;top:115px;background-image:url();opaciy:.7}#asdasdrewwq:hover{opacty:}";
    d.querySelector("#panel").appendChild(box3);
    d.head.appendChild(style1);
    box3.addEventListener("click", function() {
        let dane = localStorage.getItem("brutus_position").split("|");
        let x = dane[0];
        let y = dane[1];
        if(dane[2] == 1){
            d.querySelector("#adisonzawodowiec").style.display = "none";
            localStorage.setItem("brutus_position", `${x}|${y}|0`);
        } else {
            d.querySelector("#adisonzawodowiec").style.display = "block";
            localStorage.setItem("brutus_position", `${x}|${y}|1`);
        }
    });

    //dla itemka
    let inpTp = d.createElement("div");
    inpTp.id = "adison_inpTp";
    inpTp.style = "position: relative; left: 77px; width: 32px; height: 32px; background: rgba(40,40,40,0.5); border: 1px solid #333333; margin-bottom: 5px; margin-top: 2px";
    box.appendChild(inpTp);

    let inpLvl = d.createElement("input");
    inpLvl.type = "text";
    inpLvl.size = "1";
    inpLvl.id = "adison_inpLvl";
    box.appendChild(inpLvl);
    box.innerHTML += "<br>";

    let inpClan = d.createElement("input");
    inpClan.type = "checkbox";
    inpClan.name = "adison_inpClan";
    box.appendChild(inpClan);
    box.innerHTML += "Uciekać znaj/klan?<br>";

    let inpEscape = d.createElement("input");
    inpEscape.type = "checkbox";
    inpEscape.name = "adison_inpEscape";
    box.appendChild(inpEscape);
    let strEscape = d.createElement("span");
    strEscape.id = "adison_strEscape";
    strEscape.innerHTML = "Uciekanie włączone"
    strEscape.style.fontWeight = "bold";
    box.appendChild(strEscape);

    d.body.appendChild(box);

    let style = d.createElement("style");
    style.innerHTML = "#adisonzawodowiec{position:absolute; z-index: 400; width: 188px; height: 110px; background:#b8b8b8;text-align:center;padding:5px;border:2px solid red}input[id=adison_inpLvl]{border:1px solid #86cdda;border-radius:4px;padding:1px}input[id=adison_inpLvl]:hover{background:#dadada;cursor:auto}input[id=adison_inpLvl]:focus{background:#dadada}";
    d.head.appendChild(style);

    //zmienne do tp po walce
    let tpAfterFight = false;
    let tpItemId = 0;

    //pozycja okienka
    if(!localStorage.getItem("brutus_position")) localStorage.setItem("brutus_position", "0|0|1");
    (function(pos, element){
        let position = pos.split("|");
        let x = position[0] + "px";
        let y = position[1] + "px";
        if(position[2] == "1"){
            element.style.display = "block";
        } else if(position[2] == "0"){
            element.style.display = "none";
        } else {
            throw "Error z wyświetlaniem";
        }
        element.style.top = x;
        element.style.left = y;
    })(localStorage.getItem("brutus_position"), d.querySelector("#adisonzawodowiec"))

    //generowanie tipu itemsa
    function generateItem(item) {
        let tip = itemTip(item);
        let html = "";
        html += `<div class="item" ctip="t_item" tip="${tip.replace(/"/g, '&quot;')}">`;

        if(item.stat.indexOf("legendary") > -1) html += `<div class="itemHighlighter t_leg"></div>`;
        if(item.stat.indexOf("heroic") > -1) html += `<div class="itemHighlighter t_her"></div>`;
        if(item.stat.indexOf("unique") > -1) html += `<div class="itemHighlighter t_uni"></div>`;
        if(item.stat.indexOf("upgraded") > -1) html += `<div class="itemHighlighter t_upg"></div>`;
        html += `<img src="/obrazki/itemy/${item.icon}">`;

        html += `</div>`;
        return html;
    }
    //localStorage
    g.loadQueue.push({
        fun: function() {
            //lvl
            if (!localStorage.getItem(`brutus${hero.id}_lvl`)) localStorage.setItem(`brutus${hero.id}_lvl`, `-30`);
            d.querySelector("#adison_inpLvl").value = localStorage.getItem(`brutus${hero.id}_lvl`);

            //lastPerson
            if (localStorage.getItem(`lastPerson`)) log(localStorage.getItem(`lastPerson`));

            //tp
            if (!localStorage.getItem(`brutus${hero.id}_tp1`)) localStorage.setItem(`brutus${hero.id}_tp1`, JSON.stringify({
                    name: "Zwój teleportacji na Kwieciste Przejście",
                    stat: "amount=14;capacity=15;lvl=70;teleport=344,17,60",
                    icon: "pap/pap44.gif",
                    pr: 42000,
                    cl: 16
            }));
            d.querySelector("#adison_inpTp").innerHTML = generateItem(JSON.parse(localStorage.getItem(`brutus${hero.id}_tp1`)));

            //clan/znaj
            if (!localStorage.getItem(`brutus_clanfr`)) localStorage.setItem(`brutus_clanfr`, true);
            d.querySelector("input[name=adison_inpClan]").checked = JSON.parse(localStorage.getItem(`brutus_clanfr`));

            //ogolny przycisk uciekania
            if (!localStorage.getItem(`brutus_escape${hero.id}`)) localStorage.setItem(`brutus_escape${hero.id}`, true);
            d.querySelector("input[name=adison_inpEscape]").checked = JSON.parse(localStorage.getItem(`brutus_escape${hero.id}`));
            if(JSON.parse(localStorage.getItem(`brutus_escape${hero.id}`))) {
                d.querySelector("#adison_strEscape").style.color = "green";
                d.querySelector("#adison_strEscape").innerHTML = "Uciekanie włączone";
            } else {
                d.querySelector("#adison_strEscape").style.color = "red";
                d.querySelector("#adison_strEscape").innerHTML = "Uciekanie wyłączone";
            }
        }
    });

    //zapisywanie ustawien
    d.querySelector("#adison_inpTp").addEventListener("keyup", function() {
        localStorage.setItem(`brutus${hero.id}_tp1`, this.value);
    });
    d.querySelector("#adison_inpLvl").addEventListener("keyup", function() {
        localStorage.setItem(`brutus${hero.id}_lvl`, this.value);
    });
    d.querySelector("input[name=adison_inpClan]").addEventListener("change", function() {
            localStorage.setItem(`brutus_clanfr`, this.checked);
    });
    d.querySelector("input[name=adison_inpEscape]").addEventListener("change", function() {
        localStorage.setItem(`brutus_escape${hero.id}`, this.checked);
        if(this.checked == true){
            d.querySelector("#adison_strEscape").style.color = "green";
            d.querySelector("#adison_strEscape").innerHTML = "Uciekanie włączone";
        } else {
            d.querySelector("#adison_strEscape").style.color = "red";
            d.querySelector("#adison_strEscape").innerHTML = "Uciekanie wyłączone";
        }
    });

    function savePosition(){
        let x = parseInt(d.querySelector("#adisonzawodowiec").style.top);
        let y = parseInt(d.querySelector("#adisonzawodowiec").style.left);
        localStorage.setItem(`brutus_position`, `${x}|${y}|1`);
    }
    //draggable dla okienka z zapisem pozycji
    $("#adisonzawodowiec").draggable({
        start: function(){
            g.lock.add("adi_zmiana_pozycji");
        },
        stop: function(){
            g.lock.remove("adi_zmiana_pozycji");
            message("Zapisano pozycję!");
            savePosition();
        }
    });

    //droppable dla teleporta
    $("#adison_inpTp").droppable({
        accept: ".item",
        drop: (e, ui) => {
            let item = g.item[ui.draggable.attr("id").replace("item", "")];
            if(item.cl == 16 && item.loc == "g"){
                d.querySelector("#adison_inpTp").innerHTML = generateItem(item);
                localStorage.setItem(`brutus${hero.id}_tp1`, JSON.stringify(item));
                message("Zapisano");
            } else {
                message("To nie teleport wtf");
            }
        }
    });
    //funkcja szukajaca Tp
    function teleport(nazwa, asd){
        let Person = g.other[asd];
        let content = `Ostatnia osoba przed którą próbowałeś uciekać: ${Person.nick} ${Person.lvl}${Person.prof} lvl`;
        localStorage.setItem("lastPerson", content);
        for(let i in g.item){
            if(g.item[i].loc == "g" && g.item[i].name == nazwa){
                let item = parseItemStat(g.item[i].stat);
                if(item.timelimit){
                    let itemsikTime = item.timelimit.split(",");
                    let ts = unix_time();
                    let min = itemsikTime[1];
                    if(min){
                        if(ts > min){
                            tpItemId = g.item[i].id;
                            break;
                        }
                    } else {
                        tpItemId = g.item[i].id;
                        break;
                    }
                } else {
                    tpItemId = g.item[i].id;
                    break;
                }
            }
        }
        if(tpItemId != 0){
            if(!g.battle){
                let t_mapa = map.name;
                let t_id = tpItemId;
                _g(`moveitem&st=1&id=${tpItemId}`);
                tpItemId = 0;
                setTimeout(()=>{
                    if(map.name == t_mapa){
                        _g(`moveitem&st=1&id=${t_id}`);
                    }
                }, 50);
            } else {
                message("Teleport zostanie użyty po walce");
                tpAfterFight = true;
            }
        } else {
            message("Nie posiadasz teleportu");
        }
    }
    newOther = function(e) {
        _n(e);
        if(map.pvp == 2){
            let obj = JSON.parse(localStorage.getItem(`brutus${hero.id}_tp1`));
            let TpName = obj.name;
            let leverz = Number(localStorage.getItem(`brutus${hero.id}_lvl`));
            let ClanFrEscape = JSON.parse(localStorage.getItem(`brutus_clanfr`));
            let Escape = JSON.parse(localStorage.getItem(`brutus_escape${hero.id}`));
            let hlvl = hero.lvl;
            for (let i in e) {
                if(e[i].lvl - hlvl >= leverz && Escape){
                    if(ClanFrEscape){
                        teleport(TpName, i);
                        break;
                    } else {
                        if(e[i].relation != "fr" && e[i].relation != "cl"){
                            teleport(TpName, i);
                            break;
                        }
                    }
                }
            }
        }
    }
    battleMsg = function(a, b) {
        let ret = _b(a, b);
        if (a.indexOf("winner=") > -1) {
            _g("fight&a=exit");
            if(tpAfterFight){
                let t_mapa = map.name;
                let t_id = tpItemId;
                _g(`moveitem&st=1&id=${tpItemId}`);
                tpItemId = 0;
                setTimeout(()=>{
                    if(map.name == t_mapa){
                        _g(`moveitem&st=1&id=${t_id}`);
                    }
                }, 50);
                tpAfterFight = false;
            }
        }
        return ret;
    }
})(document, newOther, battleMsg)
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes
Ta strona używa plików cookie w celu usprawnienia i ułatwienia dostępu do serwisu oraz prowadzenia danych statystycznych. Dalsze korzystanie z tej witryny oznacza akceptację tego stanu rzeczy.
Wykorzystywanie plików Cookie
Jak wyłączyć cookies?
ROZUMIEM