Greasy Fork

Greasy Fork is available in English.

AttackRange Helper

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

当前为 2018-12-21 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         AttackRange Helper
// @namespace    http://tampermonkey.net/
// @version      0.2
// @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/*
// ==/UserScript==

var pPoints = Game.player_points;
var rankingButton;
load_menu_button();
load_info_button();

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(){
    var infoButton = document.getElementById('info');
    if (infoButton == null) {
        setTimeout(() => load_info_button(), 100);
    } else {
    infoButton.addEventListener('click', () => {
        setTimeout(() => att_range_info(), 100);
        setInterval(() => att_range_info(), 1000);
    });
    }
}


function att_range_ranking() {
   var points = document.getElementsByClassName('r_points');
    if (!(points.length === 0)) {
        for(var point of points) {
            if ((document.getElementById('ranking-sea_player').className=="submenu_link active") || (document.getElementById('ranking-index').className=="submenu_link active")){
                if (point.innerHTML > 0) {
                    if (point.innerHTML < (pPoints * 0.83333333333) || point.innerHTML > (pPoints * 1.2)) {
                        point.style.color = 'red';
                    } else {
                        point.style.color = 'green';
                    }
                }
            }
        }
    }
}

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){}
}