The All Mighty

Wave builder for Travian Legends and Travian Codex Victoria

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name           The All Mighty
// @namespace      https://greasyfork.org/en/users/560174-adir-avisar
// @description    Wave builder for Travian Legends and Travian Codex Victoria
// @author         Mr Cheeses' team
// @include        *://*.travian.*/*
// @include        *://*.travian.*.*/*
// @include        *://*/*.travian.*/*
// @include        *://*/*.travian.*.*/*

// @version        1.5
// ==/UserScript==

function OneCodeToRuleThemAll () {
    'use strict';
    var version = '1.5';
    var scriptURL = 'https://greasyfork.org/en/scripts/403175-the-all-mighty';
    var OVER_VIEW_COLUMNS = ['tro', 'bui', 'att']
    var OVER_VIEW_COLORS = ['Blue', 'Black', 'Red']
    var OPTIONS = {
        "/village/statistics" : OVER_VIEW_COLUMNS.forEach(OverViewGenrCol), // Over view
        "/village/statistics?s=0" : OVER_VIEW_COLUMNS.forEach(OverViewGenrCol), // Over view second option
        "build.php?id=39&gid=16" : RobberyPrecenage() // Farm List
    }

    // This function changes the images to the onhover text in the over view.
    // Over View - Start //
    function OverViewGenrCol(name) {
        var counter = 0;
        for(var village = 0; village < document.getElementsByTagName('tbody')[0].getElementsByClassName(name).length; village++){
            // Variable reset
            counter = 1;
            if(document.getElementsByTagName('tbody')[0].getElementsByClassName(name).item(village).getElementsByTagName('img')[0]){
                for(var element = 0; element < document.getElementsByTagName('tbody')[0].getElementsByClassName(name).item(village).getElementsByTagName('a').length;element++){
                    // Change text value
                    document.getElementsByTagName('tbody')[0].getElementsByClassName(name)
                            .item(village).getElementsByTagName('a')[element].innerHTML = document.getElementsByTagName('tbody')[0].getElementsByClassName(name).
                            item(village).getElementsByTagName('img')[0].alt + '</br>'

                    // Change text size
                    document.getElementsByTagName('tbody')[0].getElementsByClassName(name)
                            .item(village).getElementsByTagName('a')[element].style.fontSize = '85%'

                    // Change text color
                    document.getElementsByTagName('tbody')[0].getElementsByClassName(name)
                            .item(village).getElementsByTagName('a')[element].style.color = OVER_VIEW_COLORS[counter % 3]
                     
                    // Add to counter to change the color of the next element
                    counter++
                }
            }
        }
    }
    // Over View - End //

    //****************//
    /******************/
    /******Buffer******/
    /******************/
    //****************//

    // Farm List - Start //
    function RobberyPrecenage() {
        var total = 0;
        var RaidLists = document.getElementsByClassName('troop_details inReturn');


        for (var i = 0; i < RaidLists.length; i++) {
            var RaidList = RaidLists[i];

            var carry = RaidList.getElementsByClassName('carry')

            if(carry.length > 1) {
                var current = carry[0].getElementsByClassName('value')[0].innerText.split('/')[0].replace(/\s/g, '');

                total += parseInt(current.replace(/\D/g, ""), 10);
            }
        }

        var header = document.getElementsByClassName('spacer')[0]

        header.innerText = header.innerText + ' Total = ' + total
    }

    function getValues(str) {
        return str.replace(/\D/g, " ").replace(/\s+/g,' ').trim()
    }

    // Calculate the precenage
    function CalculatePercentage(values) {
        var value = values.split(' ')
        return (value[0] / value[1] * 100).toFixed(2)
    }
    // Farm List - End //

    /********** begin of main code block ************/
    var URL = window.location.href // Get URL
    var URL_SPLITED = URL.split('/') // Split the URL
    var page = URL_SPLITED[URL_SPLITED.length -1] // Get the page

    OPTIONS[page] // Run the function for the page.
    /********** end of main code block ************/
}

OneCodeToRuleThemAll();