contact
October 22, 2018, 06:52:19 PM

Author Topic: Eljer scripts  (Read 11836 times)

0 Members and 1 Guest are viewing this topic.

Offline rick blackford

  • Member
  • Posts: 545
  • Gone Fishing
    • View Profile
Re: Eljer scripts
« Reply #45 on: March 31, 2018, 04:13:45 PM »
I just posted this same fix yesterday!  Also on the open parser script, there are multiple places to change http to https, so look carefully.

All scripts back in working order again.

If you need any more detail, pm me.

Happy Hunting.
SFCO Uni - Rick Blackford, Leader, Valente do Moita
Uni2 - Emperor R, no longer active here
Nova Uni - Nova1, Harrasser, N:S:K, gave this one up!
SDE, Lancelot, Not playing anymore

Offline raider007

  • Member
  • Posts: 75
  • prepare to be boarded sucka's :p
    • View Profile
Re: Eljer scripts
« Reply #46 on: May 21, 2018, 06:29:07 PM »
i noticed that http://bfg.kcnetworks.biz/ is missing one of the best scripts ever.
'battle report formatter'

 included below.

thanks!



// ==UserScript==
// @name BattleReportReformatter2
// @namespace https://eljercode.com
// @description Reformats battle reports for easier posting showing only the outcome with losses
// @include https://*playstarfleet*/messages/additional_content/*
// @include https://*stardrift*/messages/additional_content/*
// @version 2.2.5
// ==/UserScript==
// 2.2   -- added sde support
// 2.2.1 -- img alts changed again, updated function
// 2.2.2 -- fixed missiles (6->16)
// 2.2.3 -- added total ship count (Lost X of Y)
// 2.2.4 -- fixed longstanding bug of report showing all defenses wiped
// 2.2.5 -- added Nova ships and Nova DSP breakouts for GA/GD.
//          courtesy of Kronin - http://hubbach.com
// 2013.05.21 - rrh - fixed for conquest

//get primary attacker, defender, defender's location, outcome summary, and round info

var vBattleLog = GetClassItem(document.getElementById('content'), 'div', 'battle_log');
var vMainParticipants = GetClassItem(vBattleLog, 'div', 'participants');
var vAttackerList = GetClassItem(vMainParticipants, 'div', 'attacker');
var vShipAlt;

var TOTAL_NUM_SHIPS = 26;
var TOTAL_NUM_DEFENSES = 11;
var TOTAL_NUM_SHIPS_AND_DEFENSES = TOTAL_NUM_SHIPS + TOTAL_NUM_DEFENSES;

var vAttackers = new Array();

var vElements = vAttackerList.getElementsByTagName('div');

for (var i = 0; i < vElements.length; i++) {
   if (typeof vElements == "object" && vElements.getAttribute('class') == 'name') {
      addPlayer(vAttackers, vElements.innerHTML);
   }
}

var vDefenderList = GetClassItem(vMainParticipants, 'div', 'defender');
var vDefenders = new Array();
var vElements = vDefenderList.getElementsByTagName('div');

for (var i = 0; i < vElements.length; i++) {
   if (typeof vElements == "object" && vElements.getAttribute('class') == 'name') {
      addPlayer(vDefenders, vElements.innerHTML);
   }
}

var vMainAttacker = vAttackers[0]['name'];
var vMainDefender = vDefenders[0]['name'];

var vLocationDiv = GetClassItem(GetClassItem(vMainParticipants, 'div', 'defender'), 'div', 'stats');
var vLocation=ReturnSystemLink(GetClassItem(vLocationDiv,'span','planet_name').innerHTML+' '+GetClassItem(vLocationDiv,'span','planet_coords').innerHTML);

var vFireFox = false;
if (vLocationDiv.innerText == null) { vFireFox = true; }
var vOutcome = GetClassItem(vBattleLog, 'div', 'outcome');

if (vFireFox == true) {
   vOutcome = vOutcome.textContent;
} else {
   vOutcome = vOutcome.innerText;
}

vOutcome = vTrim(vOutcome.replace(/\s\s/g, ' ').replace(/\s\s/g, ' ').replace(/\s\s/g, ' ').replace(/\s\s/g, ' ').replace(/\s\s/g, ' ').replace(/\s\s/g, ' ')).replace(/\.\s/g, '.<br />');

var vDivs = vBattleLog.getElementsByTagName('div');
var RountCount = ''

for (divCount = 0; divCount < vDivs.length; divCount++) {
   var div = vDivs[divCount];
      if (div.getAttribute('class') == 'round_title') {
      if (vTrim(div.innerHTML) == 'Round 1') { var vRound1 = div.parentNode; }
      if (vTrim(div.innerHTML) == 'Round 1') { RoundCount = '1'; }
      if (vTrim(div.innerHTML) == 'Round 2') { RoundCount = '2'; }
      if (vTrim(div.innerHTML) == 'Round 3') { RoundCount = '3'; }
      if (vTrim(div.innerHTML) == 'Round 4') { RoundCount = '4'; }
      if (vTrim(div.innerHTML) == 'Round 5') { RoundCount = '5'; }
      if (vTrim(div.innerHTML) == 'Round 6') { RoundCount = '6'; }
      if (vTrim(div.innerHTML) == 'Final State') { var vFinalRound = div.parentNode; }
   }
}

var currentPlayer = null;

if (vRound1 != null) {
   var vDivs = vRound1.getElementsByTagName('div');
   for (divCount = 0; divCount < vDivs.length; divCount++) {
      var div = vDivs[divCount];
      if (typeof div == "object" && div.getAttribute('class') == 'name') {
         var vData = vTrim(div.innerHTML).split(': ');
         if (vData[0] == "ATTACKER") {
            currentPlayer = findAttackingPlayer(vData[1]);
            if(currentPlayer == null) { currentPlayer = addPlayer(vAttackers, vData[1]); }
         } else {
            currentPlayer = findDefendingPlayer(vData[1]);
            if(currentPlayer == null) { currentPlayer = addPlayer(vDefenders, vData[1]); }
         }
         currentPlayer['fleetssent']++;
      }

      if (typeof div == "object" && div.getAttribute('class') == 'attacker ships') {
         var vShips = new Array();
         GetClassArray(div, 'div', 'ship', vShips);
         for (var shipCount = 0; shipCount < vShips.length; shipCount++) {
            var ship = vShips[shipCount];
            if (ship.getAttribute('class') == 'ship') {
                vShipAlt=ship.getElementsByTagName('img')[0].getAttribute('alt');
                var vShip = GetShipIndex(ship.getElementsByTagName('img')[0].getAttribute('alt').substring(((vShipAlt.substring(0,5).toLowerCase()=='icon_')?5:0)));
                var vQty = parseInt(vTrim(GetClassItem(ship, 'div', 'number').innerHTML).substr(1).replace(/,/g, ''));
                currentPlayer['initialships'][vShip] += vQty;   
            }
         }
      }

      if (typeof div == "object" && div.getAttribute('class') == 'attacker defenses') {
         var vShips = new Array();
         GetClassArray(div, 'div', 'ship', vShips);
         for (var shipCount = 0; shipCount < vShips.length; shipCount++) {
            var ship = vShips[shipCount];
            if (ship.getAttribute('class') == 'ship') {
               vShipAlt=ship.getElementsByTagName('img')[0].getAttribute('alt');
               var vShip = GetShipIndex(ship.getElementsByTagName('img')[0].getAttribute('alt').substring(((vShipAlt.substring(0,5).toLowerCase()=='icon_')?5:0)));
               var vQty = parseInt(vTrim(GetClassItem(ship, 'div', 'number').innerHTML).substr(1).replace(/,/g, ''));
               currentPlayer['initialdefenses'][vShip] += vQty;
            }
         }
      }

      if (vDivs[divCount].getAttribute('class') == 'synopsis') { break; }
   }
}

if (vFinalRound != null) {
   var vDivs = vFinalRound.getElementsByTagName('div');
   for (divCount = 0; divCount < vDivs.length; divCount++) {
      var div = vDivs[divCount];
      if (typeof div == "object" && div.getAttribute('class') == 'name') {
         var vData = vTrim(div.innerHTML).split(': ');
         if (vData[0] == "ATTACKER") {
            currentPlayer = findAttackingPlayer(vData[1]);
         } else {
            currentPlayer = findDefendingPlayer(vData[1]);
         }
      }

      if (typeof div == "object" && div.getAttribute('class') == 'destroyed') { }

      if (typeof div == "object" && div.getAttribute('class') == 'attacker ships') {
         var vShips = new Array();
         GetClassArray(div, 'div', 'ship', vShips);
         for (var shipCount = 0; shipCount < vShips.length; shipCount++) {
            var ship = vShips[shipCount];
            if (ship.getAttribute('class') == 'ship') {
               vShipAlt=ship.getElementsByTagName('img')[0].getAttribute('alt');
               var vShip = GetShipIndex(ship.getElementsByTagName('img')[0].getAttribute('alt').substring(((vShipAlt.substring(0,5).toLowerCase()=='icon_')?5:0)));
               var vQty = parseInt(vTrim(GetClassItem(ship, 'div', 'number').innerHTML).substr(1).replace(/,/g, ''));
               currentPlayer['finalships'][vShip] += vQty;
            }
         }
      }

      if (typeof div == "object" && div.getAttribute('class') == 'attacker defenses') {
         var vShips = new Array();
         GetClassArray(div, 'div', 'ship', vShips);
         for (var shipCount = 0; shipCount < vShips.length; shipCount++) {
            var ship = vShips[shipCount];
            if (ship.getAttribute('class') == 'ship') {
               vShipAlt=ship.getElementsByTagName('img')[0].getAttribute('alt');
               var vShip = GetShipIndex(ship.getElementsByTagName('img')[0].getAttribute('alt').substring(((vShipAlt.substring(0,5).toLowerCase()=='icon_')?5:0)));
               var vQty = parseInt(vTrim(GetClassItem(ship, 'div', 'number').innerHTML).substr(1).replace(/,/g, ''));
               currentPlayer['finaldefenses'][vShip] += vQty;
            }
         }
      }

      if (vDivs[divCount].getAttribute('class') == 'synopsis') { break; }
   }
}

var vNewReport = vMainAttacker + ' led an attack on ' + vMainDefender + ' at ' + vLocation + '.<br />';
vNewReport += 'The following emerged from battle after ' + RoundCount + ' Round(s)';
vNewReport += '<br />';
var vTotalAttackersShipsRSPLost = 0;
var vTotalInitialAttackerRSP = 0;
for (i = 0; i < vAttackers.length; i++) {
   //alert('vAttackers = '+vAttackers);
   vAttackers['initialrsp'] = CalcRSP(vAttackers['initialships'],TOTAL_NUM_SHIPS);
   vTotalInitialAttackerRSP += vAttackers['initialrsp'];
   vSurvived = false;
   for (var z = 0; z < TOTAL_NUM_SHIPS; z++) {
      if (vAttackers['finalships'] != null && vAttackers['finalships'][z] != null && parseInt(vAttackers['finalships'][z]) > 0) {
         vSurvived = true;
         break; 
      }
   }
   vAttackers['script'] += '<br />*****Attacker: ' + vAttackers['name'] + ' with ' + addCommas(vAttackers['initialrsp'].toString()) + ' RSP involved (initial fleet RSP) *****<br />';
   var vDmg = new Array(0, 0, 0);
   for (j = 0; j < TOTAL_NUM_SHIPS; j++) {
      initialshipCount = (vAttackers['initialships'] != null && vAttackers['initialships'][j] != null) ? vAttackers['initialships'][j] : 0;
      finalshipCount = (vAttackers['finalships'] != null && vAttackers['finalships'][j] != null) ? vAttackers['finalships'][j] : 0;
      if (initialshipCount > 0) {
         var vShipLost = '';
         if (vSurvived == false) {
            vShipLost = '0&nbsp;&nbsp;(Lost: ' + initialshipCount + ' of ' + initialshipCount + ')';
            var vLost = initialshipCount;
            vDmg[0] += (OreCost(j) * vLost);
            vDmg[1] += (CrysCost(j) * vLost);
            vDmg[2] += (HydroCost(j) * vLost);
         } else {
            if (finalshipCount > 0) {
               if (initialshipCount != finalshipCount) {
                  var vLost = initialshipCount - finalshipCount;
                  vDmg[0] += (OreCost(j) * vLost);
                  vDmg[1] += (CrysCost(j) * vLost);
                  vDmg[2] += (HydroCost(j) * vLost);
                  vShipLost = finalshipCount + '&nbsp;&nbsp;(Lost: ' + vLost + ' of ' + initialshipCount + ')';
               } else {
                  vShipLost = finalshipCount;
               }
            } else {
               vShipLost = '0&nbsp;&nbsp;(Lost: ' + initialshipCount + ' of ' + initialshipCount + ')';
               var vLost = initialshipCount;
               vDmg[0] += (OreCost(j) * vLost);
               vDmg[1] += (CrysCost(j) * vLost);
               vDmg[2] += (HydroCost(j) * vLost);
            }
         }
         vAttackers['script'] += GetShipName(j) + ': ' + vShipLost + '<br />';
      }
   }
   vTotalAttackersShipsRSPLost += (vDmg[0] + vDmg[1] + vDmg[2]);
   vAttackers['script'] += '** Resources lost: ' + addCommas(vDmg[0].toString()) + ' ore, ' + addCommas(vDmg[1].toString()) + ' crystal, and ' + addCommas(vDmg[2].toString()) + ' hydrogen.<br />';
}

var vTotalDefendersShipsRSPLost = 0;
var vTotalInitialDefenderRSP = 0;
for (i = 0; i < vDefenders.length; i++) {
   vDefenders['initialrsp'] = CalcRSP(vDefenders['initialships'],TOTAL_NUM_SHIPS);
   vTotalInitialDefenderRSP += vDefenders['initialrsp'];
   vSurvived = false;
   for (var z = 0; z < TOTAL_NUM_SHIPS_AND_DEFENSES; z++) {
      if ((vDefenders['finalships']!=null || vDefenders['finaldefenses']!=null) && (vDefenders['finalships'][z]!=null || vDefenders['finaldefenses'][z]!=null) && (parseInt(vDefenders['finalships'][z])>0 || parseInt(vDefenders['finaldefenses'][z])>0)) {
         vSurvived = true;
      }
   }
   vDefenders['script'] += '<br />*****Defender: ' + vDefenders['name'] + ' with ' + addCommas(vDefenders['initialrsp'].toString()) + ' RSP involved (initial fleet RSP) *****<br />';
   var vDmg = new Array(0, 0, 0);
   var vShipDmg = new Array(0, 0, 0);
   for (j = 0; j < TOTAL_NUM_SHIPS; j++) {
      initialshipCount = (vDefenders['initialships'] != null && vDefenders['initialships'][j] != null) ? vDefenders['initialships'][j] : 0;
      finalshipCount = (vDefenders['finalships'] != null && vDefenders['finalships'][j] != null) ? vDefenders['finalships'][j] : 0;
      if (initialshipCount > 0) {
         var vShipLost = '';
         if (vSurvived == false) {
            vShipLost = '0&nbsp;&nbsp;(Lost: ' + initialshipCount + ' of ' + initialshipCount + ')';
            var vLost = initialshipCount;
            vShipDmg[0] += (OreCost(j) * vLost);
            vShipDmg[1] += (CrysCost(j) * vLost);
            vShipDmg[2] += (HydroCost(j) * vLost);
         } else {
            if (finalshipCount > 0) {
            if (initialshipCount != finalshipCount) {
            var vLost = initialshipCount - finalshipCount;
            vShipDmg[0] += (OreCost(j) * vLost);
            vShipDmg[1] += (CrysCost(j) * vLost);
            vShipDmg[2] += (HydroCost(j) * vLost);
            vShipLost = finalshipCount + '&nbsp;&nbsp;(Lost: ' + vLost + ' of ' + initialshipCount + ')';
            } else {
            vShipLost = finalshipCount;
            }
            } else {
            vShipLost = '0&nbsp;&nbsp;(Lost: ' + initialshipCount + ' of ' + initialshipCount + ')';
            var vLost = initialshipCount;
            vShipDmg[0] += (OreCost(j) * vLost);
            vShipDmg[1] += (CrysCost(j) * vLost);
            vShipDmg[2] += (HydroCost(j) * vLost);
            }
         }
         vDefenders['script'] += GetShipName(j) + ': ' + vShipLost + '<br />';
      }
   }
   vTotalDefendersShipsRSPLost += (vShipDmg[0] + vShipDmg[1] + vShipDmg[2]);

   vDmg[0] = vShipDmg[0];
   vDmg[1] = vShipDmg[1];
   vDmg[2] = vShipDmg[2];
   for (j = TOTAL_NUM_SHIPS; j < TOTAL_NUM_SHIPS_AND_DEFENSES; j++) {
      initialshipCount = (vDefenders['initialdefenses'] != null && vDefenders['initialdefenses'][j] != null) ? vDefenders['initialdefenses'][j] : '0';
      finalshipCount = (vDefenders['finaldefenses'] != null && vDefenders['finaldefenses'][j] != null) ? vDefenders['finaldefenses'][j] : '0';
      if (initialshipCount > 0) {
         var vShipLost = '';
         if (vSurvived == false) {
            vShipLost = '0&nbsp;&nbsp;(Lost: ' + initialshipCount + ' of ' + initialshipCount + ')';
            var vLost = initialshipCount;
            vDmg[0] += (OreCost(j) * vLost);
            vDmg[1] += (CrysCost(j) * vLost);
            vDmg[2] += (HydroCost(j) * vLost);
         } else {
            if (finalshipCount > 0) {
               if (initialshipCount != finalshipCount) {
                  var vLost = initialshipCount - finalshipCount;
                  vDmg[0] += (OreCost(j) * vLost);
                  vDmg[1] += (CrysCost(j) * vLost);
                  vDmg[2] += (HydroCost(j) * vLost);
                  vShipLost = finalshipCount + '&nbsp;&nbsp;(Lost: ' + vLost + ' of ' + initialshipCount + ')';
               } else { vShipLost = finalshipCount; }
            } else {
               vShipLost = '0&nbsp;&nbsp;(Lost: ' + initialshipCount + ' of ' + initialshipCount + ')';
               var vLost = initialshipCount;
               vDmg[0] += (OreCost(j) * vLost);
               vDmg[1] += (CrysCost(j) * vLost);
               vDmg[2] += (HydroCost(j) * vLost);
            }
         }
         vDefenders['script'] += GetShipName(j) + ': ' + vShipLost + '<br />';
      }
   }

   vDefenders['script'] += '** Ship Resources lost: ' + addCommas(vShipDmg[0].toString()) + ' ore, ' + addCommas(vShipDmg[1].toString()) + ' crystal, and ' + addCommas(vShipDmg[2].toString()) + ' hydrogen.<br />';
   vDefenders['script'] += '** Total Resources lost: ' + addCommas(vDmg[0].toString()) + ' ore, ' + addCommas(vDmg[1].toString()) + ' crystal, and ' + addCommas(vDmg[2].toString()) + ' hydrogen.<br />';
}


if(/nova/i.test(document.location.href) || /conquest/i.test(document.location.href)) {
   for (i = 0; i < vAttackers.length; i++) {
      var dsp = Math.floor(Math.floor(vTotalDefendersShipsRSPLost / 1000) * (vAttackers['initialrsp'] / vTotalInitialAttackerRSP) );
      vNewReport += vAttackers['script'] + '** Destroyed Ship Points Base (multiply by Defender RSP / Attacker RSP * 0.5): '+addCommas(dsp.toString())+'<br/>';
      vNewReport += '** Max DSP: ' + addCommas(dsp.toString()) + ' ** Min DSP: ' + addCommas(Math.floor(dsp*0.1).toString()) + '<br />';
   }
   for (i = 0; i < vDefenders.length; i++) {
      var dsp = Math.floor(Math.floor(vTotalAttackersShipsRSPLost / 1000) * (vDefenders['initialrsp'] / vTotalInitialDefenderRSP) );
      vNewReport += vDefenders['script'] + '** Destroyed Ship Points Base (multiply by Attacker RSP / Defender RSP * 0.5): max '+addCommas(dsp.toString())+'<br/>';
      vNewReport += '** Max DSP: ' + addCommas(dsp.toString()) + ' ** Min DSP: ' + addCommas(Math.floor(dsp*0.1).toString()) + '<br />';
   }
} else {
   var vAttackerDSPGained = Math.floor(Math.floor(vTotalDefendersShipsRSPLost / 1000) / vAttackers.length);
   for (i = 0; i < vAttackers.length; i++) { vNewReport += vAttackers['script'] + '** Destroyed Ship Points Gained: ' + addCommas(Math.floor(vAttackerDSPGained).toString()) + '<br />'; }
   var vDefenderDSPGained = Math.floor(Math.floor(vTotalAttackersShipsRSPLost / 1000) / vDefenders.length);
   for (i = 0; i < vDefenders.length; i++) { vNewReport += vDefenders['script'] + '** Destroyed Ship Points Gained: ' + addCommas(Math.floor(vDefenderDSPGained).toString()) + '<br />'; }
}

vNewReport += '<br />' + vOutcome;
AddStickyNotice(vNewReport);

function calculateArrayedNumberOf( vSource, vIndex ) {
   var vReturn = 0;
   for(var i = 0; i < vSource.length; i++) {
      vReturn += vSource[vIndex];
   }
   return vReturn;
}

function addPlayer( vArray, vName ) {
   var nextindex = vArray.length;
   vArray[nextindex] = new Array();
   vArray[nextindex]['name'] = vTrim(vName);
   vArray[nextindex]['initialdefenses'] = new Array(TOTAL_NUM_SHIPS_AND_DEFENSES);
   vArray[nextindex]['initialships'] = new Array(TOTAL_NUM_SHIPS_AND_DEFENSES);
   vArray[nextindex]['finalships'] = new Array(TOTAL_NUM_SHIPS_AND_DEFENSES);
   vArray[nextindex]['finaldefenses'] = new Array(TOTAL_NUM_SHIPS_AND_DEFENSES);
   vArray[nextindex]['script'] = '';
   vArray[nextindex]['fleetssent'] = 0;
   vArray[nextindex]['initialrsp'] = 0;
   for (var k = 0; k < TOTAL_NUM_SHIPS_AND_DEFENSES; k++) {
      vArray[nextindex]['initialdefenses'][k] = 0;
      vArray[nextindex]['initialships'][k] = 0;
      vArray[nextindex]['finalships'][k] = 0;
      vArray[nextindex]['finaldefenses'][k] = 0;
   }
   return vArray[nextindex];
}

function GetShipIndex(ShipName) {
   switch (ShipName.toLowerCase()) {
      case 'shadow_probe': return 0; break;
      case 'genesis_solar_satellite': return 1; break;
      case 'hermes_class_probe': return 2; break;
      case 'hermes_probe': return 2; break;
      case 'hermes_class': return 2; break;
      case 'helios_class_solar_satellite': return 3; break;
      case 'helios_solar_satellite': return 3; break;
      case 'solar_satellite': return 3; break;
      case 'artemis_class_fighter': return 4; break;
      case 'artemis_fighter': return 4; break;
      case 'artemis_class': return 4; break;

      // rrh: added 2 new ship types
      case 'erebus_class': return 5; break;

      case 'atlas_class_cargo': return 6; break;
      case 'atlas_cargo': return 6; break;
      case 'atlas_class': return 6; break;
      case 'apollo_class_fighter': return 7; break;
      case 'apollo_fighter': return 7; break;
      case 'apollo_class': return 7; break;
      case 'zagreus_class': return 8; break;
      case 'charon_class_transport': return 9; break;
      case 'charon_transport': return 9; break;
      case 'charon_class': return 9; break;
      case 'hercules_class_cargo': return 10; break;
      case 'hercules_cargo': return 10; break;
      case 'hercules_class': return 10; break;
      case 'empusa_class': return 11;
      case 'dionysus_class_recycler': return 12; break;
      case 'dionysus_recycler': return 12; break;
      case 'dionysus_class': return 12; break;
      case 'curetes_class': return 13; break;
      case 'poseidon_class_cruiser': return 14; break;
      case 'poseidon_cruiser': return 14; break;
      case 'poseidon_class': return 14; break;
      case 'carmanor_class': return 15; break;

      // rrh: added 2 new ship types
      case 'moros_class': return 16; break;
      
      case 'pallas_class': return 17; break;
      case 'gaia_class_colony_ship': return 18; break;
      case 'gaia_colony_ship': return 18; break;
      case 'gaia_class': return 18; break;
      case 'athena_class_battleship': return 19; break;
      case 'athena_battleship': return 19; break;
      case 'athena_class': return 19; break;
      case 'ares_class_bomber': return 20; break;
      case 'ares_bomber': return 20; break;
      case 'ares_class': return 20; break;
      case 'hades_class_battleship': return 21; break;
      case 'hades_battleship': return 21; break;
      case 'hades_class': return 21; break;
      case 'prometheus_class_destroyer': return 22; break;
      case 'prometheus_destroyer': return 22; break;
      case 'prometheus_class': return 22; break;
      case 'thanatos_class': return 23; break;
      case 'zeus_class': return 24; break;
      case 'zeus': return 24; break;
      case 'hephaestus_class_attack_platform': return 25; break;
      case 'titan_attack_platform': return 25; break;
      case 'roaming_planet': return 25; break;
      case 'missile_battery': return 26; break;
      case 'missile_turret': return 26; break;
      case 'laser_cannon': return 27; break;
      case 'laser_turret': return 27; break;
      case 'space_mine': return 28; break;
      case 'pulse_cannon': return 29; break;
      case 'particle_cannon': return 30; break;
      case 'anti-ballistic_missile': return 31; break;
      case 'antiballistic_missile': return 31; break;
      case 'decoy': return 32; break;
      case 'interplanetary_ballistic_missile': return 33; break;
      case 'interplanetary_missile': return 33; break;
      case 'gauss_cannon': return 34; break;
      case 'large_decoy': return 35; break;
      case 'plasma_cannon': return 36; break;
      case 'plasma_turret': return 36; break;
   }
}

function GetShipName(ShipIndex) {
   switch (ShipIndex) {
      case 0: return 'Shadow '; break;
      case 1: return 'Genesis '; break;
      case 2: return 'Hermes '; break;
      case 3: return 'Helios '; break;
      case 4: return 'Artemis '; break;
      
      case 5: return 'Erebus '; break;

      case 6: return 'Atlas '; break;
      case 7: return 'Apollo '; break;
      case 8: return 'Zagreus '; break;
      case 9: return 'Charon '; break;
      case 10: return 'Hercules '; break;
      case 11: return 'Empusa '; break;
      case 12: return 'Dionysus '; break;
      case 13: return 'Curetes '; break;
      case 14: return 'Poseidon '; break;
      case 15: return 'Carmanor '; break;

      case 16: return 'Moros '; break;
      
      case 17: return 'Pallas '; break;
      case 18: return 'Gaia '; break;
      case 19: return 'Athena '; break;
      case 20: return 'Ares '; break;
      case 21: return 'Hades '; break;
      case 22: return 'Prometheus '; break;
      case 23: return 'Thanatos '; break;
      case 24: return 'Zeus '; break;
      case 25:
         if(/stardrift/i.test(document.location.href)) {
            return 'Titan ';
         } else {
            return 'Hephaestus ';
         }
         break;
      case 26: return 'Missile '; break;
      case 27: return 'Laser '; break;
      case 28: return 'Space mine '; break;
      case 29: return 'Pulse '; break;
      case 30: return 'Particle '; break;
      case 31: return 'ABM '; break;
      case 32: return 'Decoy '; break;
      case 33: return 'IPBM '; break;
      case 34: return 'Gauss '; break;
      case 35: return 'Large decoy'; break;
      case 36: return 'Plasma '; break;

   }
}

function ReturnSystemLink(PlanetInBrackets) {
var PlanetMatch = PlanetInBrackets.match(/\[(\d{1,2}):(\d{1,3}):\d{1,2}m?\]/im);
var PlanetLink = '';
var currPlanet = '';
var vURLTest = document.location.href.match(/_planet=(\d+)/i);
if (vURLTest != null) { currPlanet = vURLTest[1]; }
if (PlanetMatch != null) { PlanetLink = '<a href="/galaxy/show?current_planet=' + currPlanet + '&amp;galaxy=' + PlanetMatch[1] + '&amp;solar_system=' + PlanetMatch[2] + '">' + PlanetInBrackets + '</a>'; }
return PlanetLink;
}

function GetTableItem(vTable, vPrevious) {
var vReturn = null;
var vElements = vTable.getElementsByTagName('tr');
if (vPrevious == null) {
vReturn = vElements[0];
}
else {
var i = 0;

for (i = 0; i < vElements.length; i++) {
if (vElements == vPrevious) {
i++;
break;
}
}

if (i < vElements.length)
vReturn = vElements;
}
return vReturn;
}

function GetClassItem(vSource, vTagname, vClass) {
var vReturn = null;
var vElements = vSource.getElementsByTagName(vTagname);
for (var i = 0; i < vElements.length; i++) {
if (typeof vElements == "object" && vElements.getAttribute('class') == vClass) {
vReturn = vElements;
}
}
return vReturn;
}

function GetClassArray(vSource, vTagname, vClass, vReturn) {
var vElements = vSource.getElementsByTagName(vTagname);
var j = 0;
for (var i = 0; i < vElements.length; i++) {
if (typeof vElements == "object" && vElements.getAttribute('class') == vClass) {
vReturn[j] = vElements;
j++;
}
}
}

function vTrim(vInString) { return vInString.replace(/^\s+|\s+$/g, ""); };

function findAttackingPlayer(vName) {
for (var i = 0; i < vAttackers.length; i++) {
if (vName == vAttackers['name']) {
return vAttackers;
}
}
return null;
}

function findDefendingPlayer(vName) {
for (var i = 0; i < vDefenders.length; i++) {
if (vName == vDefenders['name']) {
return vDefenders;
}
}
return null;
}

function AddStickyNotice(StickyNotice) {
   var stickyNotices = document.getElementById('sticky_notices');
   if (vTrim(stickyNotices.innerHTML).length > 0) { stickyNotices.innerHTML += '<br/>'; }
   //var closeMessages = new Array('(close)', '(OK OK!)', '(OKAY)', '(roger)', '(go away)');
   var closeMessage = '(close)'//closeMessages[Math.round(Math.random() * (closeMessages.length - 1))];
   var stickyText = ' <div class="notice">';
   stickyText += ' <div class="close"><span class="ajax_link"><span class="active"><span class="enabled"><a href="#" onclick="disable_ajax_links();; new Ajax.Request('/stickies/close/7&amp;klass=GlobalSticky', {asynchronous:true, evalScripts:true, method:'post'}); return false;">' + closeMessage + '</a></span></span></span></div>';
   stickyText += ' <div class="message">' + StickyNotice + '</div>';
   stickyText += ' </div>';
   stickyNotices.innerHTML += vTrim(stickyText);
}

function OreCost(ShipIndex) {
   switch (ShipIndex) {
      case 0: return 0; break; //shadow
      case 1: return 0; break; //genesis
      case 2: return 0; break; //hermes
      case 3: return 0; break; //helios
      case 4: return 3000; break; //arty

      case 5: return 4000; break; //Erebus

      case 6: return 2000; break; //atlas
      case 7: return 6000; break; //apollo
      case 8: return 5000; break; //zagreus
      case 9: return 4000; break; //charon
      case 10: return 6000; break; //herc
      case 11: return 500; break; //empusa
      case 12: return 10000; break; //dion
      case 13: return 2000; break; //curetes
      case 14: return 20000; break; //pos
      case 15: return 18000; break; //carmanor
      
      case 16: return 28000; break; //Moros
      
      case 17: return 25000; break; //pallas
      case 18: return 10000; break; //gaia
      case 19: return 45000; break; //athena
      case 20: return 50000; break; //ares
      case 21: return 30000; break; //hades
      case 22: return 60000; break; //prom
      case 23: return 1750000; break; //thanatos
      case 24: return 5000000; break; //zeus
      case 25: return 20000000; break; //heph
      case 26: return 2000; break; //missile batt
      case 27: return 1500; break; //laser
      case 28: return 500; break; //space mine
      case 29: return 6000; break; //pulse
      case 30: return 2000; break; //particle
      case 31: return 8000; break; //ABM
      case 32: return 10000; break; //decoy
      case 33: return 12500; break; //IPBM
      case 34: return 20000; break; //gauss
      case 35: return 50000; break; //large decoy
      case 36: return 50000; break; //plasma
   }
}

function CrysCost(ShipIndex) {
   switch (ShipIndex) {
      case 0: return 0; break; //shadow
      case 1: return 0; break; //genesis
      case 2: return 1000; break; //hermes
      case 3: return 2000; break; //helios
      case 4: return 1000; break; //arty

      case 5: return 2250; break; //Erebus

      case 6: return 2000; break; //atlas
      case 7: return 2500; break; //apollo
      case 8: return 3000; break; //zagreus
      case 9: return 4000; break; //charon
      case 10: return 6000; break; //herc
      case 11: return 0; break; //empusa
      case 12: return 6000; break; //dion
      case 13: return 2000; break; //curetes
      case 14: return 7000; break; //pos
      case 15: return 18000; break; //carmanor

      case 16: return 17000; break; //Moros

      case 17: return 12500; break; //pallas
      case 18: return 20000; break; //gaia
      case 19: return 15000; break; //athena
      case 20: return 25000; break; //ares
      case 21: return 40000; break; //hades
      case 22: return 50000; break; //prom
      case 23: return 800000; break; //thanatos
      case 24: return 4000000; break; //zeus
      case 25: return 20000000; break; //heph
      case 26: return 0; break; //missile batt
      case 27: return 500; break; //laser
      case 28: return 0; break; //space mine
      case 29: return 2000; break; //pulse
      case 30: return 6000; break; //particle
      case 31: return 0; break; //ABM
      case 32: return 10000; break; //decoy
      case 33: return 2500; break; //IPBM
      case 34: return 15000; break; //gauss
      case 35: return 50000; break; //large decoy
      case 36: return 50000; break; //plasma
   }
}

function HydroCost(ShipIndex) {
   switch (ShipIndex) {
      case 0: return 0; break; //shadow
      case 1: return 0; break; //genesis
      case 2: return 0; break; //hermes
      case 3: return 500; break; //helios
      case 4: return 0; break; //arty

      case 5: return 500; break; //Erebus

      case 6: return 0; break; //atlas
      case 7: return 0; break; //apollo
      case 8: return 1000; break; //zagreus
      case 9: return 1000; break; //charon
      case 10: return 0; break; //herc
      case 11: return 7500; break; //empusa
      case 12: return 2000; break; //dion
      case 13: return 10000; break; //curetes
      case 14: return 2000; break; //pos
      case 15: return 0; break; //carmanor

      case 16: return 3500; break; //Moros

      case 17: return 7500; break; //pallas
      case 18: return 10000; break; //gaia
      case 19: return 0; break; //athena
      case 20: return 15000; break; //ares
      case 21: return 15000; break; //hades
      case 22: return 15000; break; //prom
      case 23: return 100000; break; //thanatos
      case 24: return 1000000; break; //zeus
      case 25: return 10000000; break; //heph
      case 26: return 0; break; //missile batt
      case 27: return 0; break; //laser
      case 28: return 3000; break; //space mine
      case 29: return 0; break; //pulse
      case 30: return 0; break; //particle
      case 31: return 2000; break; //ABM
      case 32: return 0; break; //decoy
      case 33: return 10000; break; //IPBM
      case 34: return 2000; break; //gauss
      case 35: return 0; break; //large decoy
      case 36: return 30000; break; //plasma
   }
}

function GetRSP(ShipIndex) {
   return OreCost(ShipIndex) + CrysCost(ShipIndex) + HydroCost(ShipIndex);
}

function CalcRSP(shipArray,max_index) {
   var RSP = 0;
   if(shipArray != null) {
      for(var i = 0; i < max_index; i++) {
         if(shipArray != null) {
            RSP += shipArray * GetRSP(i);
         }   
      }
   }
   return RSP;
}

function addCommas(vNumber) {
   while (/(\d+)(\d{3})/.test(vNumber)) { vNumber = vNumber.replace(/(\d+)(\d{3})/, '$1' + ',' + '$2'); }
   return vNumber;
}

Offline Locutus

  • Member
  • Posts: 9
    • View Profile
Re: Eljer scripts
« Reply #47 on: May 29, 2018, 03:30:42 PM »
Added, I'm honestly not sure how i missed that one as I used it all the time when I played.  I have added the script as well as updated removetrailingspace which I missed updating on april 1st.  Added autoupdate url and changed version numbers to my format to make future updates easier for any updates to the scripts.  Enjoy.  Thanks for the user that e-mailed it to me.

Offline renykeny

  • Member
  • Posts: 1502
    • View Profile
Re: Eljer scripts
« Reply #48 on: May 30, 2018, 04:00:43 AM »
Anyone know why parser not working.....says under construction
suck it up monkey boy!

Offline Locutus

  • Member
  • Posts: 9
    • View Profile
Re: Eljer scripts
« Reply #49 on: June 05, 2018, 02:18:11 PM »
Openparser uses their site to populate data, so if they go to maintenance, then their scripts may quit working as well since it's querying their database stored on their server.