Source for "Ogame Ultra"

By mohace
Has 3 other scripts.


Add Syntax Highlighting (this will take a few seconds, probably freezing your browser while it works)

// ==UserScript==
// @name           Ogame Ultra
// @description    Llama a varias funciones de o-calc desde la vision general y el menu flota.
// @description    Llama al simulador de misiles de toolsforogame.com y al SpeedSim Online desde los informes de espionaje individuales.
// @author	   mohace
// @date           20-09-2007
// @version        0.3
// @include        http://*.ogame.*/game/index.php?page=overview*
// @include        http://*.ogame.*/game/index.php?page=flotten1*
// @include        http://*o-calc.com/*
// @include        http://*.ogame.*/game/index.php?page=bericht*
// @include        http://www.toolsforogame.com/misiles/misiles.aspx?*
// @include        http://websim.speedsim.net/index.php?*
// ==/UserScript==

/* CONFIGURACION PERSONAL */
/* PARA HABILITAR EN PONER 1, PARA DESHABILITAR PONER 0 */
var hab_flo = 0 // Para habilitar el script en VG y Flotas.
var hab_esp = 1 // Para habilitar el script en espionajes.

/* FLOTA */
var cmenos = 1000; // Nave pequenia de carga
var cmas =   1000; // Nave grande de carga
var cl =     1000; // Cazador ligero
var cp =     2000; // Cazador pesado
var cz =     1000; // Crucero
var nb =     2000; // Nave de batalla
var co =       20; // Colonizador
var rc =     1230; // Reciclador
var se =     1000; // Sonda de espionaje
var bb =     1000; // Bombardero
var dt =      704; // Destructor
var em =      100; // Estrella de la muerte
var ac =      100; // Acorazado

/* MOTORES */
var comb = 12 // Motor de combustion
var imp =  11 // Motor de impulso
var hip =   8 // Propulsor Hiperespacial

/* TECNOLOGIAS */
var mil =  14 
var def =  13
var bli =  14

/* PANTALLA - OPTIMIZADO PARA RESOLUCION 1024 x 768 Y PARA FUENTE TIMES NEW ROMAN 16 DE FIREFOX */
var ancho = 750    // Predeterminada = 750
var alto = 430     // Predeterminada = 430
var derecha = 200   // Predeterminada = 200
var arriba = 290  // Predeterminada = 290

/* FIN DE LA CONFIGURACION PERSONAL */


/* VERIFICA Y EJECUTA EN VISION GENERAL Y EN FLOTAS */
if(hab_flo == 1)
{
	if(document.baseURI.indexOf("page=overview") || document.baseURI.indexOf("page=flotten1") != -1)
	{
		function CrearBoton0()
		{
			var botao = '';
			botao += '<table cellspacing=5>';
			botao += '<tr><td width="95" align=center><a href="http://www.o-calc.com/?sec=_timer&lang=es" target="atqfull"> ATQ TODO </a></td>';
			botao += '<td width="95" align=center><a href="http://www.o-calc.com/?sec=_timer&lang=es" target="atqheavy"> PESADA </a></td>';
			botao += '<td width="95" align=center><a href="http://www.o-calc.com/?sec=_timer&lang=es" target="atqbbdt"> BB DT </a></td>';
			botao += '<td width="95" align=center><a href="http://www.o-calc.com/?sec=_timer&lang=es" target="atqclcpcz"> CL CP CZ </a></td>';
			botao += '<td width="95" align=center><a href="http://www.o-calc.com/?sec=_timer&lang=es" target="atqnbac"> NB AC </a></td></tr>';
			botao += '<tr><td width="95" align=center><a href="http://www.o-calc.com/?sec=_timer&lang=es" target="todo"> TODO </a></td>';

			botao += '<td width="95" align=center><a href="http://www.o-calc.com/?sec=_timer&lang=es" target="nada"> NADA </a></td>';	

			botao += '<td width="95" align=center><a href="http://www.o-calc.com/?sec=_fleet&lang=es" target="cflota"> C. DE FLOTA </a></td>';

			botao += '<td width="95" align=center><a href="http://www.o-calc.com/?sec=_inter&lang=es" target="amisiles"> ALC.MISILES </a></td></tr>';
			botao += '</table>';
			return botao;
		}

		function InsertarBoton0()
		{
			// Busca todos los links de la pagina
			var a_links = document.getElementsByTagName('a');

			// Para cada link
			for (i in a_links)
			{
				var link = a_links[i];

				// Verifica si posee el atributo href	
				if (link.href)
				{
					// Si lo tiene, chequea si es el link para renombrar al planeta
					if (link.href.indexOf('renameplanet') != -1)
					{
						var itemlink = document.createElement('a');
						itemlink.appendChild(document.createTextNode('o-calc'));
						var td = document.createElement('td');
						link.parentNode.appendChild(td).appendChild(itemlink);

						// Tomado de oGame Calculador
						var html = link.parentNode.innerHTML;

						// Agrega los botones
						html += CrearBoton0();

						// Inserta el codigo en el HTML
						link.parentNode.innerHTML = html;
					}
				}

				if (link.href)
				{
					if (link.href.indexOf('fleet_templates') != -1)
					{
						var itemlink1 = document.createElement('a');
						itemlink1.appendChild(document.createTextNode('o-calc'));
						var td = document.createElement('td');
						link.parentNode.appendChild(td).appendChild(itemlink1);
						// Tomado de oGame Calculador
						var html = link.parentNode.innerHTML;

						// Agrega los botones
						html += CrearBoton0();

						// Inserta el codigo en el HTML
						link.parentNode.innerHTML = html;
					}
				}
			}		
		}

		InsertarBoton0();
	}
}

/* VERIFICA Y EJECUTA EN o-calc.com */
if (window.name == "atqfull") {
   document.body.onload = resizeTo(ancho,alto) & moveTo(derecha, arriba);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   
   //document.getElementById("i201").setAttribute('value',cmenos);
   //document.getElementById("i202").setAttribute('value',cmas);
   document.getElementById("i203").setAttribute('value',cl);
   document.getElementById("i204").setAttribute('value',cp);
   document.getElementById("i205").setAttribute('value',cz);
   document.getElementById("i206").setAttribute('value',nb);
   //document.getElementById("i207").setAttribute('value',co);
   //document.getElementById("i208").setAttribute('value',rc);
   //document.getElementById("i209").setAttribute('value',se);
   document.getElementById("i211").setAttribute('value',bb);
   document.getElementById("i212").setAttribute('value',dt);
   //document.getElementById("i213").setAttribute('value',em);
   document.getElementById("i214").setAttribute('value',ac);
   
   /* MOTORES */
   document.getElementById("vbt").setAttribute('value',comb);
   document.getElementById("imp").setAttribute('value',imp);
   document.getElementById("ha").setAttribute('value',hip);
}

if (window.name == "atqheavy") {
   document.body.onload = resizeTo(ancho,alto) & moveTo(derecha, arriba);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   
   //document.getElementById("i201").setAttribute('value',cmenos);
   //document.getElementById("i202").setAttribute('value',cmas);
   //document.getElementById("i203").setAttribute('value',cl);
   //document.getElementById("i204").setAttribute('value',cp);
   //document.getElementById("i205").setAttribute('value',cz);
   document.getElementById("i206").setAttribute('value',nb);
   //document.getElementById("i207").setAttribute('value',co);
   //document.getElementById("i208").setAttribute('value',rc);
   //document.getElementById("i209").setAttribute('value',se);
   document.getElementById("i211").setAttribute('value',bb);
   document.getElementById("i212").setAttribute('value',dt);
   //document.getElementById("i213").setAttribute('value',em);
   document.getElementById("i214").setAttribute('value',ac);
   
   /* MOTORES */
   document.getElementById("vbt").setAttribute('value',comb);
   document.getElementById("imp").setAttribute('value',imp);
   document.getElementById("ha").setAttribute('value',hip);
}

if (window.name == "atqbbdt") {
   document.body.onload = resizeTo(ancho,alto) & moveTo(derecha, arriba);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   
   //document.getElementById("i201").setAttribute('value',cmenos);
   //document.getElementById("i202").setAttribute('value',cmas);
   //document.getElementById("i203").setAttribute('value',cl);
   //document.getElementById("i204").setAttribute('value',cp);
   //document.getElementById("i205").setAttribute('value',cz);
   //document.getElementById("i206").setAttribute('value',nb);
   //document.getElementById("i207").setAttribute('value',co);
   //document.getElementById("i208").setAttribute('value',rc);
   //document.getElementById("i209").setAttribute('value',se);
   document.getElementById("i211").setAttribute('value',bb);
   document.getElementById("i212").setAttribute('value',dt);
   //document.getElementById("i213").setAttribute('value',em);
   //document.getElementById("i214").setAttribute('value',ac);
   
   /* MOTORES */
   document.getElementById("vbt").setAttribute('value',comb);
   document.getElementById("imp").setAttribute('value',imp);
   document.getElementById("ha").setAttribute('value',hip);
}

if (window.name == "atqclcpcz") {
   document.body.onload = resizeTo(ancho,alto) & moveTo(derecha, arriba);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   
   //document.getElementById("i201").setAttribute('value',cmenos);
   //document.getElementById("i202").setAttribute('value',cmas);
   document.getElementById("i203").setAttribute('value',cl);
   document.getElementById("i204").setAttribute('value',cp);
   document.getElementById("i205").setAttribute('value',cz);
   //document.getElementById("i206").setAttribute('value',nb);
   //document.getElementById("i207").setAttribute('value',co);
   //document.getElementById("i208").setAttribute('value',rc);
   //document.getElementById("i209").setAttribute('value',se);
   //document.getElementById("i211").setAttribute('value',bb);
   //document.getElementById("i212").setAttribute('value',dt);
   //document.getElementById("i213").setAttribute('value',em);
   //document.getElementById("i214").setAttribute('value',ac);
   
   /* MOTORES */
   document.getElementById("vbt").setAttribute('value',comb);
   document.getElementById("imp").setAttribute('value',imp);
   document.getElementById("ha").setAttribute('value',hip);
}

if (window.name == "atqnbac") {
   document.body.onload = resizeTo(ancho,alto) & moveTo(derecha, arriba);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   
   //document.getElementById("i201").setAttribute('value',cmenos);
   //document.getElementById("i202").setAttribute('value',cmas);
   //document.getElementById("i203").setAttribute('value',cl);
   //document.getElementById("i204").setAttribute('value',cp);
   //document.getElementById("i205").setAttribute('value',cz);
   document.getElementById("i206").setAttribute('value',nb);
   //document.getElementById("i207").setAttribute('value',co);
   //document.getElementById("i208").setAttribute('value',rc);
   //document.getElementById("i209").setAttribute('value',se);
   //document.getElementById("i211").setAttribute('value',bb);
   //document.getElementById("i212").setAttribute('value',dt);
   //document.getElementById("i213").setAttribute('value',em);
   document.getElementById("i214").setAttribute('value',ac);
   
   /* MOTORES */
   document.getElementById("vbt").setAttribute('value',comb);
   document.getElementById("imp").setAttribute('value',imp);
   document.getElementById("ha").setAttribute('value',hip);
}

if (window.name == "todo") {
   document.body.onload = resizeTo(ancho,alto) & moveTo(derecha, arriba);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   
   document.getElementById("i201").setAttribute('value',cmenos);
   document.getElementById("i202").setAttribute('value',cmas);
   document.getElementById("i203").setAttribute('value',cl);
   document.getElementById("i204").setAttribute('value',cp);
   document.getElementById("i205").setAttribute('value',cz);
   document.getElementById("i206").setAttribute('value',nb);
   document.getElementById("i207").setAttribute('value',co);
   document.getElementById("i208").setAttribute('value',rc);
   document.getElementById("i209").setAttribute('value',se);
   document.getElementById("i211").setAttribute('value',bb);
   document.getElementById("i212").setAttribute('value',dt);
   document.getElementById("i213").setAttribute('value',em);
   document.getElementById("i214").setAttribute('value',ac);
   
   /* MOTORES */
   document.getElementById("vbt").setAttribute('value',comb);
   document.getElementById("imp").setAttribute('value',imp);
   document.getElementById("ha").setAttribute('value',hip);
}

if (window.name == "nada") {
   document.body.onload = resizeTo(ancho,alto) & moveTo(derecha, arriba);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   
   //document.getElementById("i201").setAttribute('value',cmenos);
   //document.getElementById("i202").setAttribute('value',cmas);
   //document.getElementById("i203").setAttribute('value',cl);
   //document.getElementById("i204").setAttribute('value',cp);
   //document.getElementById("i205").setAttribute('value',cz);
   //document.getElementById("i206").setAttribute('value',nb);
   //document.getElementById("i207").setAttribute('value',co);
   //document.getElementById("i208").setAttribute('value',rc);
   //document.getElementById("i209").setAttribute('value',se);
   //document.getElementById("i211").setAttribute('value',bb);
   //document.getElementById("i212").setAttribute('value',dt);
   //document.getElementById("i213").setAttribute('value',em);
   //document.getElementById("i214").setAttribute('value',ac);
   
   /* MOTORES */
   document.getElementById("vbt").setAttribute('value',comb);
   document.getElementById("imp").setAttribute('value',imp);
   document.getElementById("ha").setAttribute('value',hip);
}

if (window.name == "cflota") {
   document.body.onload = resizeTo(ancho + 120 ,alto + 240) & moveTo(derecha, arriba);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
}

if (window.name == "amisiles") {
   document.body.onload = resizeTo(ancho,alto + 10) & moveTo(derecha,arriba + 200);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td/table", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);
   var nodo = document.evaluate("/html/body/table/tbody/tr/td/table/tbody/tr/td", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
   nodo.parentNode.removeChild(nodo);

   /* MOTOR DE IMPULSO */
   document.getElementById("stufe").setAttribute('value',imp);
}

/* VERIFICA Y EJECUTA EN EL INFORME DE ESPIONAJE INDIVIDUAL */
if(document.baseURI.indexOf("bericht") != -1)
{
	function CrearBoton1 ()
	{
		var botao = '';
		botao += '<table cellspacing=5><tr>';
		botao += '<td width="105" align=center><a href="http://www.toolsforogame.com/misiles/misiles.aspx?idi=es-es" target="simis"> Simulador de misiles </a></td>';
		botao += '<td width="105" align=center><a href="http://websim.speedsim.net/index.php?lang=sp" target="spdsim"> Speedsim </a></td>';
		botao += '<td width="105" align=center><a href="http://drago-sim.com/index.php?lang=spanish" target="dgsim"> Drago-sim </a></td>';
		botao += '</tr></table>';
		return botao;
	}

	function InsertarBoton1()
	{
		// Busca todos las tablas
		var a_table = document.getElementsByTagName('table');

		// Para cada tabla
		for (i in a_table)
		{
			var nodo = a_table[i];

			// Verifica si posee el atributo width 99%
			if (nodo.width == '99%')
			{
				var itemlink2 = document.createElement('a');
				//itemlink2.appendChild(document.createTextNode('toolsforoogame'));
				var itemlink3 = document.createElement('a');
				//itemlink3.appendChild(document.createTextNode('          SpeedSim Online'));

				var td = document.createElement('td');
				nodo.appendChild(td).appendChild(itemlink2);
				nodo.appendChild(td).appendChild(itemlink3)

				// Tomado de oGame Calculador
				var html = nodo.innerHTML;

				// Agrega los botones
				html += CrearBoton1();
		
				// Inserta el codigo en el HTML
				nodo.innerHTML = html;
			}
		}		
	}

	function datos()
	{
		var tds = document.getElementsByTagName('td');	
		for ( var i=1 ; i < tds.length; i++ )
		{	
			texto += tds[i].textContent;
			texto += ' ';

		}
	}
	var texto = ''
	datos();
	GM_setValue("texto1", texto);
	InsertarBoton1();
}

/* VERIFICA Y EJECUTA EN EL SIMULADOR DE MISILES DE toolsforogame.com */
if (window.name == "simis") {
   document.getElementById("ctl00_cntContenido_txtInforme").textContent = GM_getValue("texto1", "error");
   document.getElementById("ctl00_cntContenido_txtMilitar").setAttribute('value',mil);
}

/* VERIFICA Y EJECUTA EN EL SIMULADOR DE BATALLAS SpeedSim Online */
if (window.name == "spdsim") {
   document.getElementById("read_field").textContent = GM_getValue("texto1", "error");
   var tech_a_0 = document.getElementsByName("tech_a_0");
   tech_a_0[0].setAttribute('value',mil);
   var tech_a_1 = document.getElementsByName("tech_a_1");
   tech_a_1[0].setAttribute('value',def);
   var tech_a_2 = document.getElementsByName("tech_a_2");
   tech_a_2[0].setAttribute('value',bli);
   var engine_0 = document.getElementsByName("engine_0");
   engine_0[0].setAttribute('value',comb);
   var engine_1 = document.getElementsByName("engine_1");
   engine_1[0].setAttribute('value',imp);
   var engine_2 = document.getElementsByName("engine_2");
   engine_2[0].setAttribute('value',hip);
}