Ikariam G8
By Miktnyik Levente
—
Last update May 15, 2008
—
Installed
1,194 times.
Add Syntax Highlighting (this will take a few seconds, probably freezing your browser while it works)
// ==UserScript==
// @name Alianza G8 Ikariam
// @version 0.8
// @namespace Lordbeni
// @description Script que crea una pequeña lista para poder añadir Enemigos. Además de otras modificaciones importantes.
// @include http://*.ikariam.*/index.php*
// @exclude http://board.ikariam.*/*
// @exclude http://*.ikariam.*/index.php?view=militaryAdvisorMilitaryMovements*
// @exclude http://*.ikariam.*/index.php?view=barracks*
// @exclude http://*.ikariam.*/index.php?view=shipyard*
// ==/UserScript==
// ===========================================================================
// Basado en "Ikariam Friend List v0.4" de Elnaira (c) http://www.arisen-guild.com.
// Basado en "ExtMenu"
// Basado en "ScoreLinker 0.5.7" de ImmortalNights (c)
// Basado en la modificación de "Kronos Utils v.04 by Kronos" por Johan Sundström
//
//
// Beta
//
// v0.1 - Añadida completamente la Lista de Enemigos.
// - Añadidos los links superiores.
// v0.2 - Arreglados algunos fallos leves.
// - Fusionado el script "ScoreLinker" y traducción a castellano.
// v0.3 - Fusionado el script "Kronos Utils MOD" y adaptación.
// - Pequeños cambios en "Lista de Enlaces" (anterior "Lista de Enemigos").
// - Adaptación de la zona superior de enlaces.
// v0.4 - Arreglados algunos fallos leves en traducciones.
// - Modificación del panel anterior de Ikariam.
// - Añadidos "excludes" que creaban conflictos con el script.
// - Semicompatibilidad con version 0.2.0 de Ikariam
// v0.8 -Levi's Módosítások
// ===========================================================================
// Funcion para añadir estilos
if(!window.addGlobalStyle){
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
}
// Estilos actuales
addGlobalStyle(
'#flBox { height: 29px; width: 29px; position: absolute; margin:-189px 29px -18px 945px; z-index:31; display: none; }' +
'#flHeader { height: 26px; background-image: url(http://i262.photobucket.com/albums/ii105/Lordbeni/flheadervv3.jpg); background-repeat: no-repeat; font-weight: bold; font-size: 13px; text-align: center; padding-top: 5px; cursor: pointer; }' +
'#flHeader2 { height: 26px; width: 26px; background-image: url(http://i262.photobucket.com/albums/ii105/Lordbeni/flheader2kf8.jpg); background-repeat: no-repeat; background-position: right; font-weight: bold; font-size: 13px; text-align: right; cursor: pointer; }' +
'#flContent { height: 395px; background-image: url(http://i262.photobucket.com/albums/ii105/Lordbeni/flbackgroundum3.jpg); margin-top: -5px; padding: 7px; overflow: auto; display: none; font-family: Arial; font-size: 12px; }' +
'#flFooter { background-image: url(http://i262.photobucket.com/albums/ii105/Lordbeni/flfooterwc5.jpg); height: 5px; display: none; }' +
'#flBox ul { margin-left: 25px; } #flBox li { list-style: disc; } #flBox img{ margin-bottom:-3px; } #flBox ul a, #flBox p a { color: #542c0f; text-decoration: none; } #flBox ul a:hover, #flBox p a:hover{ color: #542c0f; text-decoration: underline; }' +
'#flBox input[type=text]{ color: #542c0f; background-color: #f3edd3; border: 1px solid #542c0f; font-size: 12px; padding: 1px; width: 100px;}');
// Si la lista no existe crearla con la variable 0
if(!GM_getValue("ListaEnemigos")){
GM_setValue("ListaEnemigos", "0");
}
var ListaEnemigos = GM_getValue("ListaEnemigos");
// Funcion añadir enlace a la lista
unsafeWindow.flAddFriend = function(){
var flNuevoNombre = document.getElementById("flNuevoNombre");
var flNuevoEnlace = document.getElementById("flNuevoEnlace");
if(flNuevoNombre.value == "" || flNuevoNombre.value == flNuevoNombre.defaultValue || flNuevoEnlace.value == "" || flNuevoEnlace.value == flNuevoEnlace.defaultValue){
return alert("Error: Comprueba todas las casillas.");
}
var NuevaListaEnemigosContenido = '';
if(ListaEnemigos == "0"){
NuevaListaEnemigosContenido = flNuevoNombre.value + '|' + flNuevoEnlace.value + ';';
}
else{
NuevaListaEnemigosContenido = ListaEnemigos + flNuevoNombre.value + '|' + flNuevoEnlace.value + ';';
}
window.setTimeout(GM_setValue, 0, "ListaEnemigos", NuevaListaEnemigosContenido);
return window.location.reload();
};
// Funcion de borrar elemento de la lista
unsafeWindow.flBorrarEnemigo = function(NombreEnemigo, EnlaceEnemigo){
var flConfirm = confirm("Estás seguro de borrar " + NombreEnemigo + "?");
if(flConfirm == 1){
var NuevaListaEnemigosContenido = '';
flFiler = NombreEnemigo + '|' + EnlaceEnemigo + ';';
NuevaListaEnemigosContenido = ListaEnemigos.replace(flFiler, '');
if(NuevaListaEnemigosContenido == ""){
NuevaListaEnemigosContenido = "0";
}
window.setTimeout(GM_setValue, 0, "ListaEnemigos", NuevaListaEnemigosContenido);
return window.location.reload();
}
return;
};
// Funcion abrir/cerrar el frame (no se usa completamente)
unsafeWindow.flToggleFrame = function(nr){
if(nr == 1){
document.getElementById("flButtonArea").innerHTML = '<div id="flHeader" onClick="flToggleFrame(0);">Lista de Enlaces</div>';
document.getElementById("flContent").style.display = 'block';
document.getElementById("flFooter").style.display = 'block';
document.getElementById("flBox").style.display = 'block';
document.getElementById("flBox").style.height = '440px';
document.getElementById("flBox").style.width = '150px';
document.getElementById("flBox").style.margin = '-189px 29px -18px 821px';
}
else{
document.getElementById("flButtonArea").innerHTML = '<div id="flHeader2" onClick="flToggleFrame(1);"></div>';
document.getElementById("flContent").style.display = 'none';
document.getElementById("flFooter").style.display = 'none';
document.getElementById("flBox").style.display = 'none';
}
};
// Funcion para añadir la URL actual a la textbox de "enlace"
unsafeWindow.flInsertCurrentURL = function(){
var flNuevoEnlace = document.getElementById("flNuevoEnlace");
var flCurrentURL = window.document.location;
return flNuevoEnlace.value = flCurrentURL;
};
// Funcion "Exportar"
unsafeWindow.flExport = function(){
if(ListaEnemigos == "0"){
return alert("La lista está vacia.");
}
prompt('Copiar esta cadena de texto en "Importar".', ListaEnemigos);
}
// Funcion "importar"
unsafeWindow.flImport = function(){
var flVariableImportar = prompt('Pegar la cadena de texto en la textbox de abajo. Estar seguros de que la copiais y pegais correctamente, de lo contraria se produciran fallos.');
if(flVariableImportar){
if(ListaEnemigos == "0"){
NuevaListaEnemigosContenido = flVariableImportar;
}
else{
NuevaListaEnemigosContenido = ListaEnemigos + flVariableImportar;
}
window.setTimeout(GM_setValue, 0, "ListaEnemigos", NuevaListaEnemigosContenido);
alert("Cadena de texto aceptada");
return window.location.reload();
}else{
return alert("Error: Cadena de texto inválida.");
}
return false;
}
// Construyendo la Lista de Enlaces en HTML
var flHTML = '';
var ListaEnemigosActual = '';
if(ListaEnemigos == "0"){
flHTML += '<center>No hay nada en la lista.</center>';
}
else{
// Slice the last ; of the list
ListaEnemigosActual = ListaEnemigos.slice(0, -1);
// Split the long string up
ListaEnemigosActual = ListaEnemigosActual.split(';');
// Y ordenarlos alfabeticamente
ListaEnemigosActual.sort();
var IkariamEnemigo = '';
flHTML += '<ul id="flLista">';
for(i=0;i<=ListaEnemigosActual.length-1;i++){
IkariamEnemigo = ListaEnemigosActual[i];
// Separar el nombre y el enlace
IkariamEnemigo = IkariamEnemigo.split('|');
flNombreEnemigo = IkariamEnemigo[0];
flEnlaceEnemigo = IkariamEnemigo[1];
flHTML += '<li><a href="' + flEnlaceEnemigo + '">' + flNombreEnemigo + '</a> <a href="javascript:flBorrarEnemigo(\'' + flNombreEnemigo + '\', \'' + flEnlaceEnemigo + '\');"><img src="http://i262.photobucket.com/albums/ii105/Lordbeni/iconquickdeletech1.gif"></a></li>';
}
flHTML += '</ul>';
}
// HTML de la zona "Añadir Enlace"
flHTML += '<div style="text-align:center;"><hr>Nombre enlace<br><input type="text" name="flNuevoNombre" id="flNuevoNombre" value="Nombre" onFocus="javascript:if(this.value == this.defaultValue) this.value = \'\';" onblur="javascript:if(this.value == \'\') this.value = this.defaultValue;" /><p><a onClick="javascript:flInsertCurrentURL();" style="font-size: 10px; cursor: pointer;">Usar url actual</a></p><input type="text" name="flNuevoEnlace" id="flNuevoEnlace" value="URL" onFocus="javascript:if(this.value == this.defaultValue) this.value = \'\';" onblur="javascript:if(this.value == \'\') this.value = this.defaultValue;" /><br /><br /><a href="javascript:flAddFriend();" class="button"> Añadir </a><br><p style="padding-top: 8px;"><a href="javascript:flExport();" class="flSmall" style="font-size: 10px;">Exportar</a> | <a href="javascript:flImport();" class="flSmall" style="font-size: 10px;">Importar</a></p></div>';
// And now its time to place it in the right position, before the 'mainview' (playfield) div that is
var main, newElement;
main = document.getElementById('mainview');
if (main) {
newElement = document.createElement('div');
newElement.setAttribute('id', 'flBox');
main.parentNode.insertBefore(newElement, main);
}
// And finally put layout + friendlist HTML in it all together, we're done :)
document.getElementById("flBox").innerHTML = '<div id="flButtonArea"><div id="flHeader2" onClick="flToggleFrame(1);"></div></div><div id="flContent">' + flHTML + '</div><div id="flFooter"></div>';
//
//Implantacion de una modificación de ExtMenu
//
//Modificacion de la barra de abajo
var HTML2 = ''
HTML2 += '<span class="copyright">© 2008 by <a title="Gameforge" id="gflink" target="_blank" href="http://www.gameforge.de">Gameforge</a><a href="/index.php?view=credits" style="margin:0px;">.</a> Todos los derechos reservados.</span>'
HTML2 += document.getElementById("GF_toolbar").getElementsByTagName("li")[6].innerHTML;
//Modificacion de la barra de arriba
//
// version 0.5.7
// 2008-11-03
// Copyright (c) 2008, ImmortalNights
// Special Enhancements: wphilipw
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// Version History:
// 0.3.0: Original Public Release
// ==================================================
// 0.4.0: Island View & Bugfixes
// 0.4.1: Description change, Generals Version update
// 0.4.5: Bugfixes, Script combination (versions)
// 0.4.6: Changed the image sizes to 16x16
// 0.4.7: Implemented 'checkAlreadyShown' to prevent the icon displaying multiple times
// ==================================================
// 0.5.0: Inline Score Display Option (AJAX)
// 0.5.2: Defaults of text inline now set. Icons and text have headers. Options link always shown
// 0.5.3: Code clean up, Money Score option & Options dialog
// 0.5.4: Previous score details are saved, so that they are not updated if the same town is viewed.
// 0.5.5: BugFix for multiple scores + timeout for saved scores (10min)
// 0.5.6: BugFix: "undefined" scores (timestamp too long, now stored in string)
// 0.5.7: Options on Options page, no longer inline
//
// --------------------------------------------------------------------
//
// This script places an icon to the right of a players
// name after selecting their town on the Island overview,
// or when viewing their Town. This icon links the user to
// the scoreboard, where you can see the players score.
//
// Feel free to have a go yourself; as long as you leave
// a little credit, and of course publish for the players
// of Ikariam!
//
// This script was originally created by ImmortalNights,
// and further edited and enhanced by wphilipw.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name IkariamScoreLinker
// @namespace ikariamScript
// @description Adds a link to the Scoreboard besides a players name after selecting their town on the Island Overview or when viewing their Town.
// @include http://*.ikariam.*/*
// ==/UserScript==
/*
This function lets us access an element by it's class name
Original Author: wphilipw
For version: 0.4.0
Last changed: 0.4.0
*/
document.getElementsByClass = function(className) {
var all = document.getElementsByTagName('*');
var elements = new Array();
for (var e = 0; e < all.length; e++)
if (all[e].className == className)
elements[elements.length] = all[e];
return elements;
}
/*
This function runs when the system starts
Original Author: wphilipw
For version: 0.4.5
Last changed: 0.4.5
*/
function init() {
var cityInformation = document.getElementById('information');
if (cityInformation) {
var listElements = cityInformation.getElementsByTagName('li');
if (listElements.length > 0) {
cityInformation_fn();
}
}
var linkElements = document.getElementsByTagName('a');
for (var i = 0; i < linkElements.length; i++) {
if (linkElements[i].id.search(/city_[0-9]*/) != -1) {
linkElements[i].addEventListener('click', function() { window.setTimeout(cityInformation_fn, 1); }, false);
}
}
}
/*
runs on first run to set up default values
Original Author: ImmortalNights
For version: 0.5.2
Last changed: 0.5.3
*/
function setDefaults_fn() {
whatToShow = "7";
GM_setValue("show", "7");
GM_setValue("inline", true);
}
/*
runs on first run to set up default values
Original Author: ImmortalNights
For version: 0.5.4
Last changed: 0.5.7
*/
/*
This function saves the options chosen above
Original Author: wphilipw
For version: 0.4.5
Last changed: 0.5.7
*/
function changeShow_fn() {
var totalScore = document.getElementById('scoreTotalOption').checked;
var generalScore = document.getElementById('scoreMilOption').checked;
var goldScore = document.getElementById('scoreMonOption').checked;
inlineScore = document.getElementById('inline_score').checked;
if (totalScore == true && generalScore == true && goldScore == true) {
GM_setValue("show", "7");
whatToShow = "7";
} else if (totalScore == true && generalScore == false && goldScore == true) {
GM_setValue("show", "5");
whatToShow = "5";
} else if (totalScore == true && generalScore == true && goldScore == false) {
GM_setValue("show", "3");
whatToShow = "3";
} else if (totalScore == true && generalScore == false && goldScore == false) {
GM_setValue("show", "1");
whatToShow = "1";
} else if (totalScore == false && generalScore == true && goldScore == true) {
GM_setValue("show", "6");
whatToShow = "6";
} else if (totalScore == false && generalScore == true && goldScore == false) {
GM_setValue("show", "2");
whatToShow = "2";
} else if (totalScore == false && generalScore == true && goldScore == false) {
GM_setValue("show", "4");
whatToShow = "4";
} else {
GM_setValue("show", "0");
whatToShow = "0";
}
GM_setValue("inline", inlineScore);
document.getElementById('optionsForm').submit();
}
/*
The AJAX request system so we can display the scores inline
Original Author: wphilipw
For version: 0.5.0
Last changed: 0.5.0
*/
function requestScore(playerName, type, onload) {
GM_xmlhttpRequest({
method:'POST',
url:'http://' + gameServer + '/index.php',
data:"view=highscore&highscoreType=" + type + "&searchUser=" + playerName,
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Content-type': 'application/x-www-form-urlencoded',
'Accept': 'application/atom+xml,application/xml,text/xml',
'Referer': 'http://' + gameServer + '/index.php'
},
onload:onload
});
}
/*
The main core function <- this does the heavy lifting
Original Author: ImmortalNights & wphilipw
For version: 0.3.0
Last changed: 0.5.5
*/
//Entrada del script Kronos Utils modificado por Johan Sundström
// ==UserScript==
// name Kronos Utils
// author Merwin
// email merwinkronos@gmail.com
// namespace Kronos
// description Divers petits utilitaires.
// include http://*.ikariam.*/*
// exclude http://board.ikariam.*/
// ==/UserScript==
/*-------------------------------------
Propriétés du script
--------------------------------------*/
var DEBUT = new Date();
// En fonction du language du naviguateur on va utiliser un langage associé.
var language = 0, finished = 1, langUsed = 11, execTime = 12, wood = 14;
var researching = 16;
var langs = {
//By Levi
"hu": ["Magyar", " Befejezve ", "Bezárás", "Fejlesztés később",
"Építési lista", "Épület hozzáadása", "Építés valahol",
"óra", "perc és", "mp",
"Rendben", "Nyelv", "Végrehajtási idő",
"Nincs épület a várólistán", "Fa", "Luxusanyag",
"Kutatás"],
"en": ["English", " Finished ", "Close", "Upgrade later.",
"Building list", "Add building.", "Build at",
"hours", "minutes and", "seconds",
"confirm", "Language used", "Time of execution",
"No building in waiting.", "Wood", "Luxe",
"Researching"],
// By Tico:
/*
"pt": ["Portuguès", " acaba às ", "Fechar", "Evoluir mais tarde.",
"Lista de construção", "Adicionar edificio.", "Construir em",
"horas", "minutos e", "segundos",
"confirmar", "Lingua usada", "Tempo de execução",
"Nenhum Edificio em espera.", "Madeira", "Luxo"],
"da": ["Dansk", " Færdig kl. ", "Luk", "Opgrader senere.",
"Bygnings liste", "Tilføj bygning.", "Byg kl.",
"timer", "minutter og", "sekunder",
"bekræft", "Sprog brugt", "Udførelsestid",
"Ingen bygning venter.", "Træ", "Luxe"],
// By A.Rosemary y LordBeNi:
"sp": ["Español", " --> ", "Cerrar", "Actualizar más tarde.",
"Lista de construcción", "Añadir edificio.", "Construir en",
"horas", "minutos y", "segundos",
"confirmar", "Idioma usado", "Tiempo de carga",
"Ningún edificio en espera.", "Madera", "Lujo",
"Investigación"],
// By Johan Sundström:
"sv": ["Svenska", " Färdigt ", "Stäng", "Uppgradera senare",
"Byggnadslista", "Lägg till byggnad", "Bygg klockan",
"timmar", "minuter och", "sekunder",
"bekräfta", "Språk", "Exekveringstid",
"Inga byggnader väntar.", "Trä", "Lyx",
"Forskning"]
*/
};
var lang, regex = /Terrain|construire/;
// en fonction de l'url on prend les regex(dépend de la langue du site).
if (/org$/.test(location.hostname))
regex = /Free|build/;
if (/com.pt$/.test(location.hostname))
regex = /Livre|construir/;
var name = "Termelés és nyelv";
var version = " v0.8";
/*-------------------------------------
Création de div, br, link etc...
-------------------------------------*/
function url(query) {
return location.href.replace(/\?.*/, query||"");
}
function valueRecupJS(nameValue) {
if ($("cityResources").getElementsByTagName("script")[0]) {
var text = $("cityResources").getElementsByTagName("script")[0].innerHTML;
text = text.substr(text.indexOf(nameValue+" = "),
text.length);
text = text.substr(nameValue.length+3,
text.indexOf(";")-(nameValue.length+3));
return text;
}
}
function recupNameRess() {
var _a = $("cityResources");
if (_a.getElementsByTagName("script")[0]) {
var text = _a.getElementsByTagName("script")[0].innerHTML;
text = text.substr(text.indexOf("currTradegood"), text.length);
text = text.substr(text.indexOf("value_"),
text.indexOf(".innerHTML") -
text.indexOf("value_") - 2);
for (var i = 0; i < _a.getElementsByTagName("li").length; i++) {
var _b = _a.getElementsByTagName("li")[i].getElementsByTagName("span");
if (_b[1].id == text){
return _b[0].textContent.replace(/:\s*/, "");
}
}
}
}
// on récupére une des valeurs get d'une url(son nom est le param.
function urlParse(param, url) {
if (!url) url = location.search; // On récupére l'url du site.
var keys = {};
url.replace(/([^=&?]+)=([^&]*)/g, function(m, key, value) {
keys[decodeURIComponent(key)] = decodeURIComponent(value);
});
return param ? keys[param] : keys;
}
function createNode(id, classN, html, tag) { // On ajoute un div
var div = document.createElement(tag||"div"); // on crée le div
if (id) div.id = id; // on lui ajoute l'id
if (classN) div.className = classN; // le class
if (html)
div.appendChild(document.createTextNode(html)); // on lui ajoute du texte
return div;
}
function createLink(nom, href) {
var lien = document.createElement('a');//création d'un lien
lien.setAttribute('href', href);//On ajoute le href
lien.appendChild(document.createTextNode(nom));//On ajoute le text.
return lien;
}
function link(href) {
location.href = href;
}
function createBr() { // fonction de création saut de ligne
return document.createElement("br");
}
function levelBat() { // Ajout d'un du level sur les batiments.
function hoverHouse(e) {
var a = e.target;
if (a && a.search && a.title && a.title.match(/ Level \d+$/i)) {
var building = a.parentNode.className; //urlParse(a.search, "view");
var id = {
townHall: 0, port: 3, academy: 4, shipyard: 5, barracks: 6,
warehouse: 7, wall: 8, tavern: 9, museum: 10, palace: 11,
embassy: 12, branchOffice:13, "workshop-army": 15, safehouse: 16
}[building];
var level = parseInt(a.title.replace(/\D+/g, ""), 10);
hovering.innerHTML = visualResources(costs[id][level]);
hovering.style.top = e.clientY +"px";
hovering.style.left = e.clientX +"px";
hovering.style.display = "block";
} else
hovering.style.display = "none";
}
GM_addStyle(<><![CDATA[
.pointsLevelBat {
background-color: #FDF8C1;
-moz-border-radius: 1em;
border: 2px solid #918B69;
border-radius: 1em;
font-family: Sylfaen, "Times New Roman", sans-serif;
font-size: 12px;
font-weight: bold;
text-align: center;
position: absolute;
width: 18px;
cursor: pointer;
height: 15px;
visibility: visible;
margin-top: 10px;
margin-left: 25px;
z-index: 50;
}
.toBuild {
width: auto;
height: 23px;
white-space: pre;
margin: -120px auto -3px -50%;
padding: 3px 5px 0;
z-index: 1000;
}
]]></>.toString());
var divContent = $("locations");
if (divContent) {
var hovering = createNode("hovering", "pointsLevelBat toBuild");
divContent.appendChild(hovering);
hovering.style.display = "none";
divContent.addEventListener("mouseover", hoverHouse, false);
var href, node, title;
for (var i = 0; i < 15; i++) {
node = document.getElementById("position"+i).getElementsByTagName("a")[0];
title = node.title;
href = node.href;
if (!regex.test(title)) {
var num = /[0-9]*$/.exec(title);
var href = node.href;
div = createNode("pointLevelBat" + i, "pointsLevelBat", num);
document.getElementById("position"+i).appendChild(div);
div.setAttribute("lien", href);
div.addEventListener("click",
function() { link(this.getAttribute("lien")); },
true);
//$("Kronos").appendChild(document.createTextNode(href));
div.style.visibility = "visible";
div.title = node.title;
}
}
}
}
function levelTown() {
function level(li) {
var level = li.className.match(/\d+/)[0];
var name = $X('a[@onclick]/span/text()[preceding-sibling::span]', li);
name.nodeValue = level +":"+ name.nodeValue;
}
$x('//li[starts-with(@class,"cityLocation city level")]').forEach(level);
}
function citizens() {
function factor(what, unit, times) {
var node = $X('//li[@class="'+ what +'"]/div[@class="amount"]');
if (node) {
var count = parseInt(node.innerHTML.match(/\d+/)[0], 10);
var sum = times ? Math.floor(times * count) : "";
if (sum > 0) sum = "+"+ sum;
unit.@style = "margin-bottom: -5px;";
node.innerHTML += (sum ? " \xA0 "+ sum : " ") + (unit.toXMLString());
}
}
// wine:25x20, marble:25x19, glass:23x18, sulfur:25x19
var iconBase = "skin/resources/icon_", goods = recupNameRess().toLowerCase();
var w = goods == "glass" ? 23 : 25, h = { wine: 20, glass: 18 }[goods] || 19;
var luxe = <img src={iconBase + goods +".gif"} width={w} height={h}/>;
var wood = <img src="skin/resources/icon_wood.gif" width="25" height="20"/>;
var gold = <img src="skin/resources/icon_gold.gif" width="17" height="19"/>;
var bulb = <img src="skin/layout/bulb-on.gif" width="14" height="21"/>;
factor("citizens", gold, 4);
factor("woodWorkers", wood);
factor("luxuryWorkers", luxe, 0.5);
factor("scientists", bulb);
factor("scientists", gold, -8);
}
var costs = [
[{}, {w:68, t:"34m 48s"}, {w:96, t:"56m 24s"}, {w:63, M:16, t:"1h 24m"}, {w:126, M:27, t:"1h 58m"}, {w:231, M:64, t:"2h 40m"}, {w:393, M:93, t:"3h 29m"}, {w:582, M:152, t:"4h 25m"}, {w:832, M:238, t:"5h 30m"}, {w:1152, M:397, t:"6h 43m"}, {w:1554, M:567, t:"8h 5m"}, {w:2058, M:783, t:"9h 35m"}, {w:3214, M:1321, t:"11h 15m"}, {w:4838, M:2081, t:"13h 3m"}, {w:7027, M:2891, t:"15h 1m"}, {w:9936, M:4320, t:"17h 9m"}, {w:14246, M:6331, t:"20h 11m"}, {w:18051, M:8023, t:"22h 44m"}, {w:22438, M:9972, t:"1D 1h"}, {w:27486, M:12216, t:"1D 4h"}, {w:33255, M:14780, t:"1D 7h"}, {w:39810, M:17693, t:"1D 10h"}, {w:47144, M:20953, t:"1D 14h"}, {w:55380, M:24613, t:"1D 17h"}, {w:221523, M:98454, t:"6D 23h"}, {w:443046, M:196909, t:"13D 22h"}, {w:886092, M:393818, t:"27D 21h"}, {w:1772184, M:787637, t:"55D 19h"}, {w:3544369, M:1575275, t:"111D 15h"}, {w:7088739, M:3150551, t:"223D 6h"}, {w:14177479, M:6301102, t:"446D 12h"}, {w:28354959, M:12602204, t:"893D 19m"}],,,
[{w:17, t:"10m 48s"}, {w:30, t:"24m 29s"}, {w:43, t:"50m 24s"}, {w:85, M:32, t:"1h 26m"}, {w:152, M:47, t:"2h 18m"}, {w:260, M:91, t:"2h 58m"}, {w:416, M:123, t:"3h 41m"}, {w:639, M:210, t:"4h 52m"}, {w:943, M:337, t:"5h 37m"}, {w:1353, M:518, t:"7h 6m"}, {w:1876, M:761, t:"7h 48m"}, {w:2551, M:1078, t:"9h 30m"}, {w:3714, M:1696, t:"10h 36s"}, {w:5242, M:2254, t:"11h 53m"}, {w:7186, M:2956, t:"11h 59m"}, {w:9611, M:4179, t:"13h 56m"}, {w:38447, M:16718, t:"2D 7h"}, {w:76894, M:33437, t:"4D 15h"}, {w:153789, M:66875, t:"9D 7h"}, {w:307578, M:133750, t:"18D 14h"}, {w:615157, M:267500, t:"37D 4h"}, {w:1230315, M:535001, t:"74D 8h"}, {w:2460631, M:1070003, t:"148D 17h"}, {w:4921262, M:2140006, t:"297D 11h"}],
[{w:35, t:"14m 24s"}, {w:56, t:"28m 48s"}, {w:82, t:"48m"}, {w:77, G:29, t:"1h 19m"}, {w:155, G:71, t:"1h 57m"}, {w:295, G:205, t:"2h 48m"}, {w:524, G:279, t:"3h 52m"}, {w:871, G:457, t:"5h 6m"}, {w:1394, G:697, t:"6h 36m"}, {w:2130, G:979, t:"8h 16m"}, {w:3156, G:1280, t:"10h 16m"}, {w:4546, G:1920, t:"12h 27m"}, {w:7011, G:3201, t:"15h"}, {w:10417, G:4481, t:"17h 45m"}, {w:14919, G:6138, t:"20h 44m"}, {w:19950, G:8675, t:"1D 7m"}, {w:79803, G:34703, t:"4D 28m"}, {w:159606, G:69407, t:"8D 57m"}, {w:319213, G:138815, t:"16D 1h"}, {w:638426, G:277630, t:"32D 3h"}, {w:1276853, G:555260, t:"64D 7h"}, {w:2553707, G:1110520, t:"128D 15h"}, {w:5107415, G:2221040, t:"257D 6h"}, {w:10214830, G:4442081, t:"514D 13h"}],
[{w:37, t:"22m 41s"}, {w:65, t:"52m 49s"}, {w:94, t:"1h 50m"}, {w:148, M:55, t:"2h 31m"}, {w:266, M:81, t:"4h 1m"}, {w:380, M:132, t:"4h 20m"}, {w:596, M:176, t:"5h 17m"}, {w:793, M:260, t:"6h 2m"}, {w:1069, M:382, t:"6h 22m"}, {w:1519, M:582, t:"7h 58m"}, {w:1882, M:764, t:"7h 50m"}, {w:2548, M:1076, t:"9h 29m"}, {w:3459, M:1579, t:"9h 19m"}, {w:4463, M:1920, t:"10h 7m"}, {w:6103, M:2511, t:"10h 10m"}, {w:7547, M:3282, t:"10h 57m"}, {w:30191, M:13128, t:"1D 19h"}, {w:60383, M:26256, t:"3D 15h"}, {w:120767, M:52512, t:"7D 7h"}, {w:241534, M:105024, t:"14D 14h"}, {w:483069, M:210049, t:"29D 4h"}, {w:966138, M:420098, t:"58D 9h"}, {w:1932277, M:840197, t:"116D 19h"}, {w:3864555, M:1680394, t:"233D 14h"}, {w:7729111, M:3360788, t:"467D 4h"}, {w:15458222, M:6721576, t:"934D 9h"}, {w:30916444, M:13443153, t:"1868D 19h"}, {w:61832888, M:26886307, t:"3737D 14h"}, {w:123665776, M:53772615, t:"7475D 4h"}, {w:247331553, M:107545231, t:"14950D 9h"}, {w:494663106, M:215090462, t:"29900D 19h"}, {w:989326213, M:430180925, t:"59801D 14h"}],
[{w:34, t:"6m 58s"}, {w:44, t:"16m 12s"}, {w:66, t:"31m 12s"}, {w:74, t:"56m 24s"}, {w:65, M:21, t:"1h 39m"}, {w:74, M:23, t:"1h 44m"}, {w:121, M:45, t:"2h 3m"}, {w:179, M:54, t:"2h 15m"}, {w:230, M:80, t:"2h 23m"}, {w:329, M:98, t:"2h 55m"}, {w:445, M:147, t:"3h 23m"}, {w:603, M:215, t:"4h"}, {w:739, M:283, t:"4h 18m"}, {w:960, M:390, t:"5h"}, {w:1146, M:484, t:"4h 48m"}, {w:1447, M:637, t:"5h 29m"}, {w:1761, M:804, t:"5h 25m"}, {w:2077, M:971, t:"5h 50m"}, {w:2386, M:1027, t:"5h 24m"}, {w:2774, M:1228, t:"5h 48m"}, {w:3143, M:1293, t:"5h 14m"}, {w:3687, M:1563, t:"5h 43m"}, {w:4210, M:1831, t:"5h 5m"}, {w:4776, M:2122, t:"5h 24m"}, {w:19106, M:8490, t:"21h 39m"}, {w:38212, M:16981, t:"1D 19h"}, {w:76424, M:33962, t:"3D 14h"}, {w:152848, M:67925, t:"7D 5h"}, {w:305697, M:135851, t:"14D 10h"}, {w:611394, M:271703, t:"28D 21h"}, {w:1222789, M:543406, t:"57D 18h"}, {w:2445578, M:1086812, t:"115D 12h"}, {w:4891156, M:2173624, t:"231D 57m"}, {w:9782312, M:4347248, t:"462D 1h"}, {w:19564625, M:8694497, t:"924D 3h"}, {w:39129251, M:17388994, t:"1848D 7h"}, {w:78258503, M:34777989, t:"3696D 15h"}, {w:156517007, M:69555978, t:"7393D 6h"}, {w:313034014, M:139111956, t:"14786D 13h"}, {w:626068029, M:278223912, t:"29573D 2h"}, {w:1252136058, M:556447825, t:"59146D 5h"}, {w:2504272117, M:1112895651, t:"118292D 11h"}, {w:5008544235, M:2225791303, t:"236584D 23h"}, {w:10017088471, M:4451582607, t:"473169D 22h"}, {w:20034176942, M:8903165214, t:"946339D 20h"}, {w:40068353884, M:17806330429, t:"1892679D 16h"}, {w:80136707768, M:35612660858, t:"3785359D 8h"}, {w:160273415536, M:71225321717, t:"7570718D 17h"}, {w:320546831073, M:142450643435, t:"15141437D 10h"}, {w:641093662146, M:284901286871, t:"30282874D 21h"}, {w:1282187324293, M:569802573742, t:"60565749D 18h"}, {w:2564374648586, M:1139605147484, t:"121131499D 12h"}, {w:5128749297172, M:2279210294968, t:"242262999D 57m"}, {w:10257498594344, M:4558420589936, t:"484525998D 1h"}, {w:20514997188689, M:9116841179873, t:"969051996D 3h"}, {w:41029994377379, M:18233682359746, t:"1938103992D 7h"}],
[{w:41, t:"27m 36s"}, {w:89, t:"1h 7m"}, {w:77, M:12, t:"1h 40m"}, {w:142, M:42, t:"2h 25m"}, {w:249, M:60, t:"3h 8m"}, {w:388, M:107, t:"4h 2m"}, {w:553, M:131, t:"4h 54m"}, {w:783, M:232, t:"5h 57m"}, {w:1178, M:379, t:"7h 6m"}, {w:1586, M:546, t:"8h 24m"}, {w:2092, M:764, t:"9h 54m"}, {w:2705, M:1143, t:"11h 27m"}, {w:4114, M:1878, t:"13h 12m"}, {w:5631, M:2422, t:"15h 12m"}, {w:7501, M:3087, t:"17h 22m"}, {w:9831, M:5130, t:"19h 48m"}, {w:39325, M:20521, t:"3D 7h"}, {w:78650, M:41042, t:"6D 14h"}, {w:157301, M:82084, t:"13D 4h"}, {w:314603, M:164169, t:"26D 9h"}, {w:629207, M:328339, t:"52D 19h"}, {w:1258414, M:656678, t:"105D 15h"}, {w:2516828, M:1313356, t:"211D 7h"}, {w:5033656, M:2626713, t:"422D 14h"}, {w:10067312, M:5253427, t:"845D 5h"}, {w:20134625, M:10506854, t:"1690D 10h"}, {w:40269250, M:21013708, t:"3380D 21h"}, {w:80538501, M:42027417, t:"6761D 19h"}, {w:161077002, M:84054835, t:"13523D 15h"}, {w:322154004, M:168109670, t:"27047D 6h"}, {w:644308008, M:336219340, t:"54094D 12h"}, {w:1288616017, M:672438681, t:"108189D 19m"}],
[{w:70, t:"1h 12m"}, {w:72, M:12, t:"1h 50m"}, {w:98, M:31, t:"2h 29m"}, {w:151, M:56, t:"3h 16m"}, {w:222, M:67, t:"4h 12m"}, {w:317, M:110, t:"4h 37m"}, {w:433, M:128, t:"4h 59m"}, {w:581, M:191, t:"5h 18m"}, {w:761, M:272, t:"5h 32m"}, {w:978, M:374, t:"5h 42m"}, {w:1229, M:498, t:"6h 24m"}, {w:1532, M:647, t:"7h 8m"}, {w:2115, M:931, t:"8h 55m"}, {w:2270, M:1036, t:"8h 44m"}, {w:2728, M:1274, t:"9h 7m"}, {w:3241, M:1394, t:"9h 27m"}, {w:3823, M:1693, t:"9h 43m"}, {w:4467, M:1838, t:"9h 56m"}, {w:5190, M:2200, t:"10h 4m"}, {w:5996, M:2607, t:"10h 9m"}, {w:6879, M:3057, t:"10h 8m"}, {w:7382, M:3281, t:"10h 2m"}, {w:7903, M:3512, t:"9h 51m"}, {w:8440, M:3751, t:"9h 34m"}, {w:33762, M:15005, t:"1D 14h"}, {w:67525, M:30011, t:"3D 4h"}, {w:135051, M:60023, t:"6D 9h"}, {w:270103, M:120046, t:"12D 18h"}, {w:540207, M:240092, t:"25D 12h"}, {w:1080414, M:480184, t:"51D 57m"}, {w:2160829, M:960368, t:"102D 1h"}, {w:4321658, M:1920737, t:"204D 3h"}, {w:8643317, M:3841474, t:"408D 7h"}, {w:17286635, M:7682949, t:"816D 15h"}, {w:34573271, M:15365898, t:"1633D 6h"}, {w:69146542, M:30731796, t:"3266D 13h"}, {w:138293084, M:61463592, t:"6533D 2h"}, {w:276586168, M:122927185, t:"13066D 5h"}, {w:553172336, M:245854371, t:"26132D 11h"}, {w:1106344673, M:491708743, t:"52264D 23h"}, {w:2212689346, M:983417487, t:"104529D 22h"}, {w:4425378693, M:1966834974, t:"209059D 20h"}, {w:8850757386, M:3933669949, t:"418119D 16h"}, {w:17701514772, M:7867339898, t:"836239D 8h"}, {w:35403029544, M:15734679797, t:"1672478D 17h"}, {w:70806059089, M:31469359595, t:"3344957D 10h"}, {w:141612118179, M:62938719191, t:"6689914D 21h"}, {w:283224236359, M:125877438382, t:"13379829D 18h"}, {w:566448472719, M:251754876764, t:"26759659D 12h"}, {w:1132896945438, M:503509753528, t:"53519319D 57m"}, {w:2265793890877, M:1007019507056, t:"107038638D 1h"}, {w:4531587781754, M:2014039014113, t:"214077276D 3h"}, {w:9063175563509, M:4028078028226, t:"428154552D 7h"}, {w:18126351127019, M:8056156056453, t:"856309104D 15h"}, {w:36252702254039, M:16112312112906, t:"1712618209D 6h"}, {w:72505404508078, M:32224624225812, t:"3425236418D 13h"}],
[{w:24, t:"13m 20s"}, {w:109, M:11, t:"55m 12s"}, {w:192, M:45, t:"1h 49m"}, {w:291, M:86, t:"3h 5m"}, {w:484, M:158, t:"4h 2m"}, {w:750, M:268, t:"4h 58m"}, {w:1104, M:423, t:"5h 47m"}, {w:1556, M:631, t:"7h 17m"}, {w:2133, M:901, t:"7h 57m"}, {w:2837, M:1248, t:"9h 34m"}, {w:3680, M:1680, t:"9h 55m"}, {w:4706, M:2199, t:"11h 35m"}, {w:5909, M:2542, t:"11h 29m"}, {w:7318, M:3240, t:"13h 8m"}, {w:8934, M:3675, t:"12h 25m"}, {w:11567, M:5030, t:"13h 59m"}, {w:46271, M:20121, t:"2D 7h"}, {w:92543, M:40242, t:"4D 15h"}, {w:185086, M:80485, t:"9D 7h"}, {w:370173, M:160970, t:"18D 15h"}, {w:740346, M:321941, t:"37D 7h"}, {w:1480693, M:643883, t:"74D 14h"}, {w:2961387, M:1287767, t:"149D 4h"}, {w:5922775, M:2575534, t:"298D 8h"}],
[{w:276, M:82, t:"1h 28m"}, {w:744, M:266, t:"2h 57m"}, {w:1583, M:642, t:"4h 56m"}, {w:2936, M:1292, t:"7h 25m"}, {w:4934, M:2305, t:"8h 40m"}, {w:7742, M:3429, t:"11h 35m"}, {w:11511, M:4879, t:"14h 54m"}, {w:16440, M:7306, t:"18h 38m"}, {w:65761, M:29227, t:"3D 2h"}, {w:131523, M:58455, t:"6D 5h"}, {w:263047, M:116910, t:"12D 10h"}, {w:526095, M:233820, t:"24D 20h"}, {w:1052190, M:467640, t:"49D 16h"}, {w:2104381, M:935280, t:"99D 9h"}, {w:4208762, M:1870561, t:"198D 19h"}, {w:8417525, M:3741122, t:"397D 15h"}, {w:16835051, M:7482245, t:"795D 7h"}, {w:33670103, M:14964490, t:"1590D 14h"}, {w:67340206, M:29928980, t:"3181D 5h"}, {w:134680412, M:59857960, t:"6362D 10h"}, {w:269360824, M:119715921, t:"12724D 21h"}, {w:538721648, M:239431843, t:"25449D 19h"}, {w:1077443297, M:478863687, t:"50899D 15h"}, {w:2154886594, M:957727375, t:"101799D 6h"}],
[{w:635, t:"4h"}, {w:5488, M:525, t:"8h"}, {w:20462, M:7170, G:4780, t:"9h"}, {w:56448, W:12544, M:31360, G:25088, t:"8h"}, {w:225792, W:100352, M:150528, G:100352, t:"8h"}, {w:451584, W:200704, M:301056, G:200704, t:"8h"}, {w:903168, W:401408, M:602112, G:401408, t:"8h"}, {w:1806336, W:802816, M:1204224, G:802816, t:"8h"}, {w:3612672, W:1605632, M:2408448, G:1605632, t:"8h"}, {w:7225344, W:3211264, M:4816896, G:3211264, t:"8h"}, {w:14450688, W:6422528, M:9633792, G:6422528, t:"8h"}, {w:28901376, W:12845056, M:19267584, G:12845056, t:"8h"}],
[{w:45, M:13, t:"50m 25s"}, {w:117, M:41, t:"1h 42m"}, {w:207, M:61, t:"2h 23m"}, {w:327, M:107, t:"2h 59m"}, {w:479, M:171, t:"3h 29m"}, {w:667, M:255, t:"3h 53m"}, {w:980, M:397, t:"4h 38m"}, {w:1399, M:590, t:"5h 25m"}, {w:1927, M:848, t:"6h 15m"}, {w:2582, M:1178, t:"7h 6m"}, {w:3402, M:1589, t:"7h 58m"}, {w:4391, M:1889, t:"8h 53m"}, {w:5579, M:2470, t:"9h 49m"}, {w:6979, M:2872, t:"10h 46m"}, {w:8627, M:3657, t:"11h 45m"}, {w:10554, M:4589, t:"12h 45m"}, {w:42218, M:18357, t:"2D 3h"}, {w:84436, M:36714, t:"4D 6h"}, {w:168873, M:73429, t:"8D 12h"}, {w:337747, M:146858, t:"17D 19m"}, {w:675494, M:293717, t:"34D 38m"}, {w:1350988, M:587435, t:"68D 1h"}, {w:2701977, M:1174871, t:"136D 2h"}, {w:5403955, M:2349742, t:"272D 5h"}, {w:10807910, M:4699484, t:"544D 10h"}, {w:21615820, M:9398968, t:"1088D 20h"}, {w:43231641, M:18797936, t:"2177D 16h"}, {w:86463283, M:37595873, t:"4355D 9h"}, {w:172926566, M:75191746, t:"8710D 19h"}, {w:345853132, M:150383493, t:"17421D 15h"}, {w:691706265, M:300766986, t:"34843D 7h"}, {w:1383412531, M:601533972, t:"69686D 14h"}],
[{w:14, t:"17m 17s"}, {w:37, t:"43m 12s"}, {w:101, M:31, t:"1h 32m"}, {w:217, M:64, t:"2h 7m"}, {w:417, M:148, t:"2h 45m"}, {w:630, M:241, t:"3h 40m"}, {w:914, M:408, t:"4h 45m"}, {w:1274, M:646, t:"5h 56m"}, {w:1729, M:989, t:"7h 17m"}, {w:2270, M:1451, t:"8h 44m"}, {w:2941, M:2061, t:"10h 21m"}, {w:3723, M:2562, t:"12h 3m"}, {w:4658, M:3507, t:"13h 56m"}, {w:5722, M:4238, t:"15h 54m"}, {w:7465, M:6168, t:"18h 3m"}, {w:8948, M:7953, t:"20h 17m"}, {w:35793, M:31814, t:"3D 9h"}, {w:71587, M:63629, t:"6D 18h"}, {w:143174, M:127258, t:"13D 12h"}, {w:286348, M:254517, t:"27D 1h"}, {w:572696, M:509035, t:"54D 2h"}, {w:1145392, M:1018071, t:"108D 5h"}, {w:2290785, M:2036142, t:"216D 10h"}, {w:4581570, M:4072284, t:"432D 20h"}, {w:9163141, M:8144568, t:"865D 16h"}, {w:18326282, M:16289136, t:"1731D 9h"}, {w:36652564, M:32578273, t:"3462D 19h"}, {w:73305128, M:65156546, t:"6925D 15h"}, {w:146610257, M:130313093, t:"13851D 7h"}, {w:293220515, M:260626186, t:"27702D 14h"}, {w:586441031, M:521252372, t:"55405D 5h"}, {w:1172882063, M:1042504744, t:"110810D 10h"}],,
[{w:25, M:7, t:"18m 36s"}, {w:53, M:19, t:"33m 37s"}, {w:99, M:29, t:"52m 48s"}, {w:159, M:52, t:"1h 12m"}, {w:231, M:83, t:"1h 31m"}, {w:271, M:103, t:"1h 34m"}, {w:363, M:147, t:"1h 53m"}, {w:455, M:193, t:"2h 7m"}, {w:534, M:235, t:"2h 15m"}, {w:668, M:304, t:"2h 34m"}, {w:793, M:371, t:"2h 47m"}, {w:960, M:413, t:"3h 6m"}, {w:1016, M:450, t:"3h 2m"}, {w:1173, M:483, t:"3h 15m"}, {w:1478, M:627, t:"3h 28m"}, {w:1886, M:820, t:"3h 48m"}, {w:2304, M:1025, t:"4h 1m"}, {w:2618, M:1164, t:"4h 14m"}, {w:2825, M:1255, t:"4h 16m"}, {w:3027, M:1345, t:"4h 17m"}, {w:3238, M:1439, t:"4h 19m"}, {w:3834, M:1704, t:"4h 49m"}, {w:4148, M:1843, t:"4h 57m"}, {w:4471, M:1987, t:"5h 4m"}, {w:17886, M:7949, t:"20h 16m"}, {w:35773, M:15899, t:"1D 16h"}, {w:71547, M:31799, t:"3D 9h"}, {w:143095, M:63598, t:"6D 18h"}, {w:286191, M:127196, t:"13D 12h"}, {w:572382, M:254392, t:"27D 57m"}, {w:1144765, M:508784, t:"54D 1h"}, {w:2289530, M:1017569, t:"108D 3h"}],
[{w:19, t:"15m 8s"}, {w:48, M:9, t:"42m"}, {w:93, M:26, t:"1h 8m"}, {w:159, M:47, t:"1h 41m"}, {w:260, M:86, t:"2h 10m"}, {w:398, M:143, t:"2h 38m"}, {w:582, M:223, t:"3h 23m"}, {w:849, M:344, t:"4h 25m"}, {w:1155, M:488, t:"5h 22m"}, {w:1527, M:672, t:"6h 26m"}, {w:1971, M:900, t:"7h 12m"}, {w:2620, M:1225, t:"8h 17m"}, {w:3276, M:1409, t:"9h 1m"}, {w:4044, M:1791, t:"9h 40m"}, {w:4920, M:2024, t:"10h 15m"}, {w:6177, M:2618, t:"11h 12m"}, {w:7382, M:3210, t:"11h 36m"}, {w:8731, M:3880, t:"11h 52m"}, {w:9636, M:4282, t:"12h 1m"}, {w:11007, M:4892, t:"12h 28m"}, {w:44029, M:19568, t:"2D 1h"}, {w:88058, M:39137, t:"4D 3h"}, {w:176117, M:78274, t:"8D 7h"}, {w:352235, M:156549, t:"16D 15h"}, {w:704471, M:313098, t:"33D 6h"}, {w:1408942, M:626196, t:"66D 13h"}, {w:2817884, M:1252392, t:"133D 2h"}, {w:5635768, M:2504785, t:"266D 5h"}, {w:11271536, M:5009571, t:"532D 11h"}, {w:22543073, M:10019143, t:"1064D 23h"}, {w:45086146, M:20038287, t:"2129D 22h"}, {w:90172293, M:40076574, t:"4259D 20h"}, {w:180344586, M:80153149, t:"8519D 16h"}, {w:360689172, M:160306298, t:"17039D 8h"}, {w:721378344, M:320612597, t:"34078D 17h"}, {w:1442756689, M:641225195, t:"68157D 10h"}, {w:2885513379, M:1282450391, t:"136314D 21h"}, {w:5771026759, M:2564900782, t:"272629D 18h"}, {w:11542053519, M:5129801564, t:"545259D 12h"}, {w:23084107038, M:10259603128, t:"1090519D 57m"}]
];
function visualResources(what) {
var gold = <img src="skin/resources/icon_gold.gif" width="17" height="19"/>;
var wood = <img src="skin/resources/icon_wood.gif" width="25" height="20"/>;
var wine = <img src="skin/resources/icon_wine.gif" width="25" height="20"/>;
var glass =<img src="skin/resources/icon_glass.gif" width="23" height="18"/>;
var marble=<img src="skin/resources/icon_marble.gif" width="25" height="19"/>;
var sulfur=<img src="skin/resources/icon_sulfur.gif" width="25" height="19"/>;
var bulb = <img src="skin/layout/bulb-on.gif" width="14" height="21"/>;
function replace(m, icon) {
var margin = { glass: -3 }[icon] || -5;
icon = eval(icon);
icon.@style = "margin-bottom: "+ margin +"px";
return icon.toXMLString();
}
if (typeof what == "object") {
var name = { w:"wood", g:"gold", M:"marble", G:"glass", W:"wine" };
var html = []
for (var id in what) {
if (name[id])
html.push(what[id] +" $"+ name[id]);
else
html.push(what[id]); // (build time)
}
what = html.join(" \xA0 ");
}
return what.replace(/\$([a-z]{4,6})/g, replace);
}
/*--------------------------------------------------------
Création des fonctions de temps.
---------------------------------------------------------*/
function getServerTime(offset) {
var Y, M, D, h, m, s, t;
[D, M, Y, h, m, s] = $("servertime").textContent.split(/[. :]+/g);
t = new Date(Y, parseInt(M, 10)-1, D, h, m, s);
return offset ? new Date(t.valueOf() + offset*1e3) : t;
}
function resolveTime(seconds) { // Crée le temps de fin.
function z(t) { return (t < 10 ? "0" : "") + t; }
var t = getServerTime(seconds);
var h = z(t.getHours());
var m = z(t.getMinutes());
var s = z(t.getSeconds())
return lang[finished] + h + ":" + m + ":" + s;
}
function secondsToHours(bySeconds) {
if (!isNaN(bySeconds)) {
var byHour = Math.ceil(bySeconds*3600);
return byHour;
}
}
// input: "Nd Nh Nm Ns", output: number of seconds left
function parseTime(t) {
function parse(what, mult) {
var count = t.match(new RegExp("(\\d+)" + locale.timeunits.short[what]));
if (count)
return parseInt(count[1], 10) * mult;
return 0;
}
var locale = unsafeWindow.LocalizationStrings;
var units = { day: 86400, hour: 3600, minute: 60, second: 1 };
var s = 0;
for (var unit in units)
s += parse(unit, units[unit]);
return s;
}
function projectCompletion(id, className) {
var node = $(id);
if (node) {
// console.log("T: %x", $("servertime").textContent);
// console.log("L: %x", node.textContent);
// console.log("D: %x", parseTime(node.textContent));
// console.log("F: %x", resolveTime(parseTime(node.textContent)));
var done = resolveTime(parseTime(node.textContent));
var div = createNode("", className, done, node.nodeName.toLowerCase());
node.parentNode.insertBefore(div, node.nextSibling);
}
}
/*---------------------
Ajout du panel dans le menu
---------------------*/
function panelInfo() { // Ajoute un element en plus dans le menu.
var panel = createNode("", "dynamic");
var titre = document.createElement("h3");
titre.setAttribute("class", "header");
titre.appendChild(document.createTextNode(name + version));
var corps = createNode("Kronos", "content");
var footer = createNode("", "footer");
panel.appendChild(titre);
panel.appendChild(corps);
panel.appendChild(footer);
if ($("container2")) {
$("container2").insertBefore(panel, $("mainview"));
}
return corps;
}
function idIleRecup() {
// récupération de l'id de la ville :
if ($("cityNav")) {
var text = $("cityNav").innerHTML;
var debut = text.indexOf("view=island&id=");
if (debut != -1) {
var fin = text.length;
text = text.substr(debut, fin);
var fin = text.indexOf('" tabindex');
var href = text.substr(19, fin - 19);
}
else
var href;
return href;
}
}
function getCityId() {
return $X('//li[@class="viewCity"]/a').href.replace(/.*[?&]id=(\d+).*/, "$1");
}
/*------------------------
/ \
/ ! \ Function Principal.
-------
------------------------*/
function principal() {
recupNameRess();
var luxeByHours = secondsToHours(valueRecupJS("startTradegoodDelta"));
var woodByHours = secondsToHours(valueRecupJS("startResourcesDelta"));
var nameLuxe = recupNameRess();
var chemin = panelInfo();
var idIle = idIleRecup();
try {
switch (urlParse("view") || urlParse("action")) {
case "CityScreen": // &function=build&id=...&position=4&building=13
case "city": levelBat(); projectCompletion("cityCountdown"); break;
case "port": projectCompletion("outgoingOwnCountDown"); break;
case "island": levelTown(); break;
case "townHall": citizens(); break;
case "academy":
case "researchAdvisor":
var research = $X('//div[@class="researchName"]/a');
if (research)
config.set("research:"+location.hostname, research.title);
projectCompletion("researchCountDown"); break;
}
projectCompletion("upgradeCountDown", "time");
} catch(e) {}
var list = document.createElement("div"); // List des batiments.
var add = function(node) {
list.appendChild(node);
};
[createLink(lang[wood] + ": +" + woodByHours,
url("?view=resource&type=resource&id="+idIle)),
createBr(),
createLink(nameLuxe + ": +" +luxeByHours,
url("?view=tradegood&type=tradegood&id="+idIle))].forEach(add);
chemin.appendChild(list);
GM_addStyle(<><![CDATA[
.popup {
z-index: 1000;
position: absolute;
top: 30%;
left: 35%;
width: 400px;
height: 250px;
background-color: #DBB562;
border: 3px solid #CE9928;
}
]]></>.toString());
var research = config.get("research:"+location.hostname, "");
if (research) {
var a = document.createElement("a");
a.href = url("?view=academy&id=" + getCityId ());
a.textContent = lang[researching] + ": " + research;
chemin.appendChild(a);
chemin.appendChild(createBr());
}
var langPref = document.createTextNode(lang[langUsed] +": "+ lang[language]);
var langChoice = document.createElement("a");
langChoice.href = "#";
langChoice.appendChild(langPref);
langChoice.addEventListener("click", promptLanguage, false);
chemin.appendChild(langChoice);
var cityNav = $('cityNav');
if (cityNav) {
cityNav.addEventListener("click", function(e) {
if (e.target.id == "cityNav")
location.href = url("?view=townHall&id="+ getCityId() +"&position=0");
}, false);
}
var FIN = new Date();
chemin.appendChild(createBr());
chemin.appendChild(document.createTextNode(lang[execTime] +": "+
(FIN - DEBUT) + "ms"));
// http://gpoint.superforo.net/academia-f14/script-alianza-g8-t107.htm
//$("Kronos").appendChild(document.createTextNode(myLanguage));
}
GM_registerMenuCommand("Ikariam Kronos Tools: Your language", promptLanguage);
function promptLanguage() {
var help = [];
for (var id in langs)
help.push(id+": "+langs[id][language]);
while (!langs.hasOwnProperty(newLanguage)) {
var newLanguage = prompt("Script Alianza G8 Levi's módosításokkal: " +
"Script nyelve?\n(" +
help.join(", ") + ")", getLanguage());
if (langs.hasOwnProperty(newLanguage))
config.set("language", newLanguage);
}
location.reload();
}
function getLanguage() {
function guess() {
var guess = navigator.language.replace(/-.*/,"");
return langs.hasOwnProperty(guess) ? guess : "sp";
}
return config.get("language", guess());
}
function $(id) {
return document.getElementById(id);
}
function $x( xpath, root ) {
var doc = root ? root.evaluate ? root : root.ownerDocument : document, next;
var got = doc.evaluate( xpath, root||doc, null, 0, null ), result = [];
switch (got.resultType) {
case got.STRING_TYPE:
return got.stringValue;
case got.NUMBER_TYPE:
return got.numberValue;
case got.BOOLEAN_TYPE:
return got.booleanValue;
default:
while (next = got.iterateNext())
result.push( next );
return result;
}
}
function $X( xpath, root ) {
var got = $x( xpath, root );
return got instanceof Array ? got[0] : got;
}
// config.get() and config.set() store config data in (near-)json in prefs.js.
var config = (function(data) {
function get(name, value) {
return data.hasOwnProperty(name) ? data[name] : value;
}
function set(name, value) {
if (value === undefined)
delete data[name];
else
data[name] = value;
GM_setValue("config", uneval(data));
return value;
}
function keys(re) {
re = re || /./;
var list = [];
for (var id in data)
if (data.hasOwnProperty(id) && id.test(re))
list.push(id);
return list;
}
function remove(id) {
if (/function|object/.test(typeof id)) {
var value = [], re = id;
for (id in data)
if (data.hasOwnProperty(id) && id.test(re)) {
value.push(data[id]);
delete data[id];
}
} else {
value = data[id];
delete data[id];
}
return value;
}
return { get:get, set:set, keys:keys, remove:remove };
})(eval(GM_getValue("config", "({})")));
lang = langs[getLanguage()];
principal(); // Appel de la fonction principal.
//Modificacion de la columna "Inspeccionar Tropas"