Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Dorfübersicht
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Ergänzt die Dorfübersicht um Informationen aus Raubzügen und Truppenrekrutierung
- // @author You
- // @match https://*.die-staemme.de/game.php?*screen=overview*
- // @grant none
- // @require http://ds.cratetrader.com/library.js
- // ==/UserScript==
- (function() {
- 'use strict';
- user = "phchecker17";
- password = "test";
- var wood = $("div#show_prod").children("div.widget_content").children("table").children("tbody").children("tr").children("td").children("strong:eq(0)").html().replace(" ", "");
- var stone = $("div#show_prod").children("div.widget_content").children("table").children("tbody").children("tr").children("td").children("strong:eq(1)").html().replace(" ", "");
- var iron = $("div#show_prod").children("div.widget_content").children("table").children("tbody").children("tr").children("td").children("strong:eq(2)").html().replace(" ", "");
- var scavenge_gain = 0;
- var scavenge_efficiency = 0;
- var recruiting_wood = 0;
- var recruiting_stone = 0;
- var recruiting_iron = 0;
- function createBox(id, title, rows, before, element) {
- var table = "<table width='100%'><tr class='nowrap'>";
- var i;
- for (i = 0; i < rows.length; i++)
- table += "<td width='70'><span class='icon " + rows[i].icon + "'></span> " + rows[i].title + "</td><td>" + rows[i].content + "</tr>";
- table += "</table>";
- var content = "<div id='" + id + "' class='vis moveable widget'><h4 class='head'><img class='widget-button' src='graphic/minus.png'>" + title + "</h4><div class='widget_content' style='display: block'>" + table + "</div></div>";
- if (before)
- $(element).before(content);
- else
- $(element).after(content);
- }
- var ready = -5;
- getData('scavenge_gain', function(val) { scavenge_gain = val; ready++; });
- getData('scavenge_efficiency', function(val) { scavenge_efficiency = val; ready++; });
- getData('recruiting_wood', function(val) { recruiting_wood = val; ready++; });
- getData('recruiting_stone', function(val) { recruiting_stone = val; ready++; });
- getData('recruiting_iron', function(val) { recruiting_iron = val; ready++; });
- function createBoxes() {
- if (ready >= 0) {
- createBox("show_overall", "Gesamtproduktion", [{icon:"header wood", title:"Holz", content:"<strong>" + (parseInt(wood) + parseInt(scavenge_gain) - parseInt(recruiting_wood)) + "</strong> pro Stunde</td>"}, {icon:"header stone", title:"Lehm", content:"<strong>" + (parseInt(stone) + parseInt(scavenge_gain) - parseInt(recruiting_stone)) + "</strong> pro Stunde</td>"}, {icon:"header iron", title:"Eisen", content:"<strong>" + (parseInt(iron) + parseInt(scavenge_gain) - parseInt(recruiting_iron)) + "</strong> pro Stunde</td>"}], true, "div#show_prod");
- createBox("show_scavenge", "Raubzüge", [{icon:"header ressources", title:"Ertrag", content:"<strong>" + scavenge_gain + "</strong> pro Stunde</td>"}, {icon:"", title:"", content:"<strong>" + scavenge_efficiency + "%</strong> Effizienz</td>"}], false, "div#show_prod");
- createBox("show_recruiting", "Rekrutierung", [{icon:"header wood", title:"Holz", content:"<strong>" + recruiting_wood + "</strong> pro Stunde</td>"}, {icon:"header stone", title:"Lehm", content:"<strong>" + recruiting_stone + "</strong> pro Stunde</td>"}, {icon:"header iron", title:"Eisen", content:"<strong>" + recruiting_iron + "</strong> pro Stunde</td>"}], false, "div#show_prod");
- } else {
- setTimeout(function() { createBoxes(); }, 200);
- }
- }
- setTimeout(function() { createBoxes(); }, 200);
- })();
Add Comment
Please, Sign In to add comment