AttackRange Helper

Shows your attack range for the new Grepolis Casual World's

24.12.2018 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         AttackRange Helper
// @namespace    http://tampermonkey.net/
// @version      0.3.1
// @description  Shows your attack range for the new Grepolis Casual World's
// @author       Marvins13
// @include      http://de99.grepolis.com/game/*
// @include      https://de99.grepolis.com/game/*
// @grant        GM_addStyle
// ==/UserScript==

var pPoints = Game.player_points;
var rankingButton;
var infoButton;
load_menu_button();
load_info_button();
/*
$.get("/data/players.txt", function(Playerdata)
                   {
    var playerList = Playerdata;
    //var a = playerList.indexOf("1046261");
    var sub = playerList.split(/\r\n|\n/);
    console.log(sub);

    var player = sub.find(function(element) {
        return element.includes("9238672");
    });
    var playerArr = player.split(/,/);
    console.log(playerArr[3]);
});


$.get("/data/towns.txt", function(Towndata)
      {
    var townList = Towndata;
    //console.log(townList);
});*/


GM_addStyle ( `
    .dr_city_shield_blessing {
        background: url(https://i.ibb.co/W05MsxT/dr-city-shield-blessing-a1471e5.png) no-repeat 0 0 !important;
        width: 120px !important;
        height: 72px !important;
        pointer-events: none !important;
    }
` );

GM_addStyle ( `
    .hr_city_shield_blessing {
        background: url(https://i.ibb.co/X8cn1fK/r-city-shield-blessing-a1471e5.png) no-repeat 0 0 !important;
        width: 120px !important;
        height: 72px !important;
        pointer-events: none !important;
    }
` );

GM_addStyle ( `
    .b_city_shield_blessing {
        background: url(https://i.ibb.co/9crM5x6/b-city-shield-blessing-a1471e5.png) no-repeat 0 0 !important;
        width: 120px !important;
        height: 72px !important;
        pointer-events: none !important;
    }
` );

GM_addStyle ( `
    .g_city_shield_blessing {
        background: url(https://i.ibb.co/6YmdJVk/g-city-shield-blessing-a1471e5.png) no-repeat 0 0 !important;
        width: 120px !important;
        height: 72px !important;
        pointer-events: none !important;
    }
` );

function load_menu_button() {
   var rankingButtons = document.getElementsByClassName('ranking main_menu_item');
    if (rankingButtons.length === 0) {
        setTimeout(() => load_menu_button(), 500);
    } else {
        rankingButton = rankingButtons[0];
        rankingButton.addEventListener('click', () => {
            setInterval(() => att_range_ranking(), 1000);
        });
    }
}

function load_info_button(){
    infoButton = document.getElementById('info');
    if (infoButton == null) {
        setTimeout(() => load_info_button(), 100);
    } else {
        infoButton.addEventListener('click', () => {
            setInterval(() => att_range_info(), 1000);
        });
    }
}

function load_popup(){
    var popups = document.getElementsByClassName('popup_table_inside town_tooltip_table');
    if (popups.length === 0) {
        setTimeout(() => load_popup(), 500);
    } else {
        console.log('hi');
    }
}


function att_range_ranking() {
    var points = document.getElementsByClassName('r_points');
    var names = document.getElementsByClassName('r_name');

    //Coloring for the world ranking
    if (document.getElementById('ranking-index').className=="submenu_link active"){
        for(var point of points) {
            if (point.innerHTML > 0) {
                if (point.innerHTML < (pPoints * 0.83333333333) || point.innerHTML > (pPoints * 1.2)) {
                    point.style.color = 'red';
                } else {
                    point.style.color = 'green';
                }
            }
        }
    }

    //Coloring for the sea ranking
    if (document.getElementById('ranking-sea_player').className=="submenu_link active"){
        try{
            $.get("/data/players.txt", function(Playerdata)
                  {
                var playerList = Playerdata;
                var sub = playerList.split(/\r\n|\n/);
                for(var i = 0; i < names.length; i++){

                    var name = names[i];
                    var content = name.innerHTML;
                    var base64 = window.atob(content.substring(content.indexOf("href")+7, content.indexOf("class")-2));
                    var id = base64.substring(base64.indexOf("id\"")+4,base64.indexOf("}"));
                    var player = sub.find(function(element) {
                        return element.includes(id);
                    });
                    try{
                        var playerArr = player.split(/,/);
                        if (playerArr[3] < (pPoints * 0.83333333333) || playerArr[3] > (pPoints * 1.2)) {
                            points[i].style.color = 'red';
                        } else {
                            points[i].style.color = 'green';
                        }
                    }catch(err){}

                }
            });
        }catch(err){}
    }
}

function att_range_info(){
    try{

        if (document.getElementById('town_info-info').className=="submenu_link active"){
            var line = document.getElementsByClassName('list_item_left');
            var line_str = (document.getElementsByClassName('list_item_left')[0]).innerHTML;
            var a = line_str.indexOf("(");
            var b = line_str.indexOf(")");
            var player_points_line = line_str.substring(a+1,b-7);
            if (player_points_line < (pPoints * 0.83333333333) || player_points_line > (pPoints * 1.2)) {
                line[0].style.color = 'red';
            } else {
                line[0].style.color = 'green';
            }

        }
    }catch(err){}
}