Time left to fill up storage

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Time left to fill up storage

      Name
      • Info :How much time left to fill up magazines on current production and how many LC or SC need to transport all resources from planet
      • Author :krzysiej
      • Website :userscripts.org/scripts/show/108188
      • Support :userscripts.org/scripts/show/108188
      • Download :userscripts.org/scripts/source/108188.user.js
      • Screenshot :
      • Browser :Firefox with GM, Google chrome with Tampermonkey and Opera
      • Languages : All


        This script takes current ammount of metal/crystal/deuterium on the
        planet and count for how long the magazines on the planet will be full.
        So you will know if you wake up after 8 you will meet the magazines full
        or not. In newest version author added features: number of large cargo and small cargo ships
        required to take all resources from planet (DT is large cargo and MT is
        small cargo you can change this to LC and SM in code: "var text"). And script now
        counts sum of the resources through all your planets. All theis
        information are abowe the resources icons.

    • Install link is broken

      Display Spoiler
      // ==UserScript==
      // @name Ogame - how much time left to fill up magazines on current production
      // @version 1.02
      // @namespace ogameresourcesproductiontime
      // @description Wyswietla ile jeszcze zostało czasu do zapełnienia magazykow przy aktualnej produkcji
      // @include http://*.ogame.*/game/index.php*
      // ==/UserScript==

      function getinfo(type)
      {
      var patt1=/\">(.*?)<\/span/gi;
      var xxx = document.getElementById(type+'_box').title.match(patt1);
      xxx[0] = document.getElementById('resources_'+type).innerHTML;
      for(i in xxx)
      xxx = xxx[i].replace(/[^0-9]+/g, '');
      if(document.getElementById(type+'hours'))
      {
      if(xxx[2]> 0 )
      time = ((xxx[1]-xxx[0])/xxx[2]).toFixed(2);
      else
      time = 0;
      var linklist = document.getElementById(type+'hours');
      linklist.innerHTML = time+'h';
      }
      else
      {
      var linklist = document.getElementById(type+'_box').childNodes[3];
      if(xxx[2]> 0 )
      time = ((xxx[1]-xxx[0])/xxx[2]).toFixed(2);
      else
      time = 0;
      var newlink = document.createElement('div');
      newlink.style.color = '#0b0';
      newlink.id = type+'hours';
      newlink.innerHTML = time+'h';
      linklist.appendChild(newlink);
      }
      }
      setInterval(getinfo, 10000, 'metal');
      setInterval(getinfo, 10000, 'crystal');
      setInterval(getinfo, 10000, 'deuterium');
      getinfo('metal');
      getinfo('crystal');
      getinfo('deuterium');
      shipeneededtotakeallsura();
      allsura();
      function allsura()
      {
      var res = planetsura();
      var text = document.documentElement.innerHTML;
      var reg =/ogame-planet-id" content="([\d]*)/g;
      match = reg.exec(text);
      localStorage['i'+parseInt(match[1])] = JSON.stringify(res);
      var meta = 0;
      var kris = 0;
      var dex = 0;
      for(i in localStorage)
      {
      if(i[0] == 'i')
      {
      sura = JSON.parse(localStorage[i]);
      meta += sura[0];
      kris += sura[1];
      dex += sura[2];
      }
      }
      var topInfoxxx = document.getElementById('topInfoxxx');
      topInfoxxx.innerHTML = topInfoxxx.innerHTML+"&nbsp;&nbsp;&nbsp;M:"+addCommas(meta)+'&nbsp;&nbsp;K:'+addCommas(kris)+'&nbsp;&nbsp;D:'+addCommas(dex)+'<span title="set all resourcess to 0. click then refresh page." style="cursor: pointer; float: right" onclick="localStorage.clear();" >reset</span>';
      }



      function addCommas(nStr)
      {
      nStr += '';
      x = nStr.split('.');
      x1 = x[0];
      x2 = x.length > 1 ? '.' + x[1] : '';
      var rgx = /(\d+)(\d{3})/;
      while (rgx.test(x1)) {
      x1 = x1.replace(rgx, '$1' + '.' + '$2');
      }
      return x1 + x2;
      }



      function planetsura()
      {
      var resources = [];
      resources.push(document.getElementById('resources_metal').innerHTML,
      document.getElementById('resources_crystal').innerHTML,
      document.getElementById('resources_deuterium').innerHTML);
      for(i in resources)
      resources[i] = parseInt(resources[i].replace(/[^0-9]+/g, ''));
      return resources;

      }
      function shipeneededtotakeallsura()
      {

      var helper = document.getElementById('helper');
      var resources = [];
      resources.push(document.getElementById('resources_metal').innerHTML,
      document.getElementById('resources_crystal').innerHTML,
      document.getElementById('resources_deuterium').innerHTML);
      for(i in resources)
      resources[i] = parseInt(resources[i].replace(/[^0-9]+/g, ''));
      var neededships = document.createElement('div');
      neededships.id = 'topInfoxxx';
      neededships.style.color = '#6F9FC8';
      neededships.style.backgroundColor = '#0D1014';
      neededships.style.paddingTop = '4px';
      neededships.style.height = '18px';
      neededships.style.fontSize = '11px';
      neededships.style.fontWeight = 900;
      neededships.style.textAlign = 'center';
      neededships.style.position = 'relative';
      neededships.style.top = '-20px';
      var allsura = resources[0]+resources[1]+resources[2];
      var text = 'DT: '+addCommas((allsura/25000).toFixed(0))+'&nbsp;&nbsp;'+'MT: '+addCommas((allsura/5000).toFixed(0));
      neededships.innerHTML = text;
      helper.appendChild(neededships,helper.firstChild);

      }