NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name OGame : Available Fields (for INFINITY plugin) // @description Displays in the small list of planets the number of fields that are available. It also shows the name of the moons // @version 0.1 // @creator Hardox // @copyright 2021- Hardox // @license MIT // @updateURL https://openuserjs.org/meta/Gamer_Hardox/OGame_Available_Fields_(for_INFINITY_plugin).meta.js // @icon https://gf1.geo.gfsrv.net/cdnc2/67c1f8f4d2ba0951521c3a7cc6c41c.png // @include https://*.ogame.gameforge.com/game/index.php?page=* // @run-at document-end // @grant GM_addStyle // // Comments // // ==/UserScript== (function () { /* START SCRIPT*/ GM_addStyle('.moon-name { color: #ffffff75; position: absolute; top: 26px; left: 14px; font-size: 7px; width: 50px; height: 12px;}'); GM_addStyle('#planetbarcomponent #rechts .smallplanet.smaller {text-align: left;}'); document.querySelectorAll(".moonlink").style ="width: 85px;"; $('.smallplanet').each(function( index ) { var red_level_planet = 3; // set these values to your desire var yellow_level_planet = 6; // set these values to your desire var red_level_moon = 0; // set these values to your desire var yellow_level_moon = 1; // set these values to your desire var name_planet = ""; var fields_planet = 0; var used_planet =""; var available_planet = ""; var name_moon = ""; var fields_moon = 0; var used_moon = ""; var available_moon = ""; var newText =""; var base = $(this).html(); name_planet = $(this).find(".planet-name").text(); if (base.search("km") == -1) { return index; } else { fields_planet = (base.split("km (")[1]).split(")")[0]; used_planet = fields_planet.split("/")[1]; available_planet = fields_planet.split("/")[1] - fields_planet.split("/")[0]; /* // pendiente de confirmar si se puede dar este caso en el planeta if (fields_planet.search("overmark") != -1) { fields_planet = fields_planet.replace("<span class='overmark' >", "").replace("</span>",""); var used_planet = fields_planet.split("/")[1]; var available_planet = fields_planet.split("/")[1] - fields_planet.split("/")[0]; } */ } switch (true) { case (available_planet <= red_level_planet): newText = '<font style="color: DeepPink; font-size: 9px; position: relative; top: -2px; left:0px; display: block; width: 14px; text-align: right;">' + available_planet + '</font><span style ="color: #ffffff75; position: absolute; top: -3px; left: 16px; font-size: 7px;">' + name_planet + '</span>'; break; case (available_planet > yellow_level_planet): newText= '<font style="color: lime; font-size: 8px; position: relative; top: -2px; left:0px; display: block; width: 14px; text-align: right;">' + available_planet + '</font><span style ="color: #ffffff75; position: absolute; top: -3px; left: 16px; font-size: 7px;">' + name_planet +'</span>';; break; default: newText = '<font style="color: orange; font-size: 9px; position: relative; top: -2px; left:0px; display: block; width: 14px; text-align: right;">' + available_planet + '</font><span style ="color: #ffffff75; position: absolute; top: -3xp; left: 16px; font-size: 7px;">' + name_planet +'</span>';; } $(this).find(".planet-name ").html(newText); // moons if (base.search('moonlink') !== -1) { name_moon = base.split('title="<b>')[2].split("[")[0]; // gets moon name fields_moon = (base.split("km (")[2]).split(")")[0]; if (fields_moon.search("overmark") != -1) { fields_moon = fields_moon.replace("<span class='overmark' >", "").replace("</span>",""); } used_moon = fields_moon.split("/")[1]; available_moon = fields_moon.split("/")[1] - fields_moon.split("/")[0]; } switch (true) { case (available_moon <= red_level_moon): newText = '<span class="moon-name">' + name_moon + '<font style="color: DeepPink; font-size: 9px; position: relative; top: -10px; left: -14px; display: block; width: 12px; text-align: right;">' + available_moon + '</font><span>'; break; case (available_moon > yellow_level_moon): newText = '<span class="moon-name">' + name_moon + '<font style="color: lime; font-size: 9px; position: relative; top: -10px; left: -14px; display: block; width: 12px; text-align: right;">' + available_moon + '</font><span>'; break; default: newText = '<span class="moon-name">' + name_moon + '<font style="color: orange; font-size: 9px; position: relative; top: -10px; left: -14px; display: block; width: 12px; text-align: right;">' + available_moon + '</font><span>'; } $(this).find(".moonlink").html(newText); }); /* !SCRIPT */ })();