// Orbit function Orbit_drawFleetSummary() {with(this){ var f = new Array(document.getElementById('fsum1'), document.getElementById('fsum2'), document.getElementById('fsum3'), document.getElementById('fsum4')); var i = 1; if ( fleets[1] == '0' && fleets[2] == '0' && fleets[3] == '0' || fleets[1] == '' && fleets[2] == '' && fleets[3] == '') { f[0].innerHTML = f[1].innerHTML = f[2].innerHTML = f[3].innerHTML = ' '; return; } var ff, ef, ffs, efs; if (fleets[0] == '0') { f[0].innerHTML = 'Local fleets'; ff = 'Defending'; ef = 'Attacking'; ffs = fleets[2]; efs = fleets[3]; } else { ff = 'Friendly'; ef = 'Enemy'; if (fleets[0] == '1') { if (fleets[3] == '0') f[0].innerHTML = 'Fleets standing by'; else f[0].innerHTML = 'Defending the planet'; ffs = fleets[2]; efs = fleets[3]; } else { f[0].innerHTML = 'Attacking the planet'; ffs = fleets[3]; efs = fleets[2]; } } if (fleets[1] != '0') { f[i].innerHTML = 'Own fleet power: ' + formatNumber(fleets[1]) + ''; i++; } if (efs != '0') { f[i].innerHTML = '' + ff + ' fleet power: ' + formatNumber(efs) + ''; i++; } if (ffs != '0') f[i].innerHTML = ''+ef+' fleet power: ' + formatNumber(ffs) + ''; }} // Nebula function Nebula_drawLayout() { var str; document.getElementById('plactions').innerHTML = 'Send Fleets - Centre Map'; document.getElementById('pimg').innerHTML = 'Nebula - Opacity '+this.opacity+''; document.getElementById('plname').innerHTML = 'Nebula ' + this.orbit.name; str = '

Details

'; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += '
 Coordinates: ('+this.orbit.drawCoords()+')  
 Opacity: '+this.opacity+'  
   
   
'; document.getElementById("pldesc").innerHTML = str; } // Remains function Remains_drawLayout() { var str; document.getElementById('plactions').innerHTML = 'Send Fleets - Centre Map'; document.getElementById('pimg').innerHTML = 'Planetary Remains'; document.getElementById('plname').innerHTML = 'Planetary Remains ' + this.orbit.name; str = '

Details

'; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += '
 Coordinates: ('+this.orbit.drawCoords()+')  
 Opacity: 1  
   
   
'; document.getElementById("pldesc").innerHTML = str; } // Planet function Planet_drawLayout() { document.getElementById('pimg').innerHTML = 'Planet'; var str = '

Planet Overview

'; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += '
 Coordinates: ('+this.orbit.drawCoords()+')   
 Alliance:    
 Population:    
 Turrets:     
 Status:    

'; str += ''; str += ''; document.getElementById("pldesc").innerHTML = str; } function Planet_draw() { var e, str; document.getElementById('plname').innerHTML = 'Planet ' + this.orbit.name; str = 'Send Fleets - Centre Map'; if (this.isOwn) { if (this.sellForm) { str = 'Confirm Sale - '; str += 'Cancel'; } else if (this.cAction == '0') { if (this.canRename) str += ' - Rename'; if (this.canAbandon) str += ' - Abandon'; if (this.canSell) str += ' - Sell/Give'; if (this.canDestroy) str += ' - Blow it up!'; } else if (this.cAction == '1') { if (this.time == 0) { if (this.sellId == '') str += ' - Planet is for sale (Cancel)'; else { str += ' - Planet offered to ' + this.sellName + ' '; str += '(Cancel)'; } } else { str += ' - ' + this.sellName + ' taking control in '; str += this.time + 'h (Cancel)'; } } else if (this.cAction == '2') { str += ' - Wormhole Super Nova in ' + this.time + ' hour' + (this.time > 1 ? 's' : '') + ' (Cancel)'; } else if (this.cAction == '3') { str += ' - Abandoning the planet in ' + this.time + ' hour tick' + (this.time > 1 ? 's' : '') + ' (Cancel)'; } } else str += ' - Message'; document.getElementById('plactions').innerHTML = str; // Planet overview document.getElementById('ptag').innerHTML = (this.tag == '') ? '-' : ('['+this.tag+']'); document.getElementById('ptur').innerHTML = (this.turrets == '') ? '?' : (''+formatNumber(this.turrets)+''); document.getElementById('pstat').innerHTML = this.protection ? "protected" : ( this.vacation ? "on vacation" : "normal" ); document.getElementById('ppop').innerHTML = (this.population == '') ? '?' : (''+formatNumber(this.population)+''); if (this.isOwn) { str = 'Happiness: ' + this.happiness + '%'; document.getElementById('phap').innerHTML = str; str = 'Corruption: ' + this.corruption + '%'; document.getElementById('pcor').innerHTML = str; document.getElementById('pprof').innerHTML = 'Planet Income: €' + formatNumber(this.profit) + ''; } else document.getElementById('pcor').innerHTML = document.getElementById('phap').innerHTML = document.getElementById('pprof').innerHTML = ' '; if (this.tFactories != '') { document.getElementById('pfact1').innerHTML = 'Total factories: ' + formatNumber(this.tFactories) + ''; document.getElementById('pfact2').innerHTML = ' ' } else if (this.iFactories != '') { document.getElementById('pfact1').innerHTML = 'Industrial factories: ' + formatNumber(this.iFactories) + ''; document.getElementById('pfact2').innerHTML = 'Military factories: ' + formatNumber(this.mFactories) + ''; } if (!this.isOwn || this.sellForm) { e = document.getElementById('pcontrol'); if (e.style) e = e.style; e.display = 'none'; if (!this.isOwn) return; } // "Sell" form e = document.getElementById('psale'); if (e.style) e = e.style; if (this.sellForm) { e.display = 'block'; document.getElementById('sm'+this.sellForm.mode).checked = true; drawSaleForm(this.sellForm); return; } else e.display = 'none'; e = document.getElementById('pcontrol'); if (e.style) e = e.style; e.display = 'block'; document.getElementById('ifc2').innerHTML = formatNumber(this.iFactories); document.getElementById('ifcc').innerHTML = '€' + formatNumber(this.caps[1]); document.getElementById('mfc2').innerHTML = formatNumber(this.mFactories); document.getElementById('mfcc').innerHTML = '€' + formatNumber(this.caps[2]); var i, ml = parseInt(this.caps[0], 10); str = ''; for (i=0;i' + getBQItemName(i, true) + ' (€'; str += formatNumber(this.caps[i+4]) + ')
'; } document.getElementById('bqstuff').innerHTML = str; document.getElementById('bqueue').innerHTML = this.drawBuildQueue(); document.getElementById('bqbut').innerHTML = drawBQButtons(this); document.getElementById('dtur').innerHTML = ' (Destroy)'; } function drawSaleForm() { var i,e = document.getElementById('psexp'); for (i=0;i 1) { orbit.spec.sellForm.player = e.value; document.getElementById('pstarl').innerHTML = document.getElementById('pstar').innerHTML = ' '; } else if (!e && orbit.spec.sellForm.mode <= 1) { document.getElementById('pstar').innerHTML = ''; document.getElementById('pstarl').innerHTML = ''; document.getElementById('pstarget').value = orbit.spec.sellForm.player; } e = document.getElementById('psprice'); if (e && orbit.spec.sellForm.mode < 1) { orbit.spec.sellForm.player = e.value; document.getElementById('pspril').innerHTML = document.getElementById('pspri').innerHTML = ' '; } else if (!e && orbit.spec.sellForm.mode >= 1) { document.getElementById('pspri').innerHTML = ''; document.getElementById('psprice').value = orbit.spec.sellForm.player; } if (orbit.spec.sellForm.mode == 0) document.getElementById('pspril').innerHTML = ' '; else if (orbit.spec.sellForm.mode == 3) document.getElementById('pspril').innerHTML = ''; else document.getElementById('pspril').innerHTML = ''; if (orbit.spec.sellForm.fleets.length == 0) document.getElementById('bndflt').innerHTML = '

No fleets are available.

'; else {with(orbit.spec.sellForm){ var str; str = '' + '' + ''; for (i=0;i'; str += '
 NameG.A. ShipsFightersCruisersBattle CruisersPower
' + fleets[i][6] + '' + formatNumber(fleets[i][1]) + '' + formatNumber(fleets[i][2]) + '' + formatNumber(fleets[i][3]) + '' + formatNumber(fleets[i][4]) + '' + formatNumber(fleets[i][5]) + '
'; document.getElementById('bndflt').innerHTML = str; }} } function getBQItemName(id, pl) { var names = ['Turret', 'GA Ship', 'Fighter', 'Cruiser', 'Battle Cruiser']; return names[id] + (pl ? 's' : ''); } function drawBQHeader() { var str; str = ''; str += ' '; str += ' '; str += 'Time to build'; str += ''; str += ''; str += ' '; str += 'Qty'; str += 'Type'; str += 'Ind.'; str += 'Cum.'; str += ''; return str; } function getEmptyBQ() { return '

The Build Queue is empty

'; } function drawBQButtons(planet) { var str; if (!planet.bq.length) return " "; str = ''; str += ''; str += ''; str += ''; return str; } function alertFlush() { return confirm('Are you sure you want to flush the build queue?'); } function plError(en) { var str; switch (en) { case -1: str = 'You are no longer the owner of this planet.'; break; case 0: case 24: str = 'You don\'t have enough money for this operation.'; break; case 1: str = 'You must select the type of items to build.'; break; case 2: str = 'Please specify the quantity of items to add to the build queues.'; break; case 3: str = 'Please specify the quantity of factories to build or destroy.'; break; case 4: str = 'Please specify the quantity of replacement items.'; break; case 5: str = 'You must select at least one item in the queue.'; break; case 6: str = 'You can\'t move up the first item of the build queue.'; break; case 7: str = 'You can\'t move down the last item of the build queue.'; break; case 8: str = 'The number of factories to destroy exceed the planet\'s quantity of factories.'; break; case 9: str = 'Your planet must keep a minimum of 1 military factory.'; break; case 10: str = 'You can\'t destroy more than 10% of a planet\'s factories in 24h.'; break; case 11: str = 'Control over this planet is being transfered.'; break; case 12: str = 'This planet is under siege.'; break; case 13: str = 'This planet name is too long (maximum 15 characters).'; break; case 14: str = 'This planet name is incorrect (letters, numbers, spaces and _.@-+\'/ only).'; break; case 15: str = 'Multiple spaces are not allowed.'; break; case 16: str = 'This planet name is too short (minimum 2 characters).'; break; case 17: str = 'Planet names must contain at least one letter'; break; case 18: str = 'Impossible to cancel the transfer, you do not have enough cash for a refund.'; break; case 19: str = 'Please specify a valid amount of turrets to destroy.'; break; case 20: str = 'Please specify a number of turrets that\'s actually inferior to the amount\nof turrets on the planet ...'; break; case 21: str = 'You can\'t destroy more than 20% of a planet\'s turrets in 24h.'; break; case 22: str = 'You can\'t destroy turrets while the planet is being transferred\nto another player.'; break; case 23: str = 'You can\'t destroy turrets while the planet is under siege.'; break; case 25: str = 'You can\'t build factories while the planet is being transferred\nto another player.'; break; case 26: str = 'Your population is too low, you can\'t build that many factories.'; break; case 37: str = 'You can\'t destroy factories so soon after building them.\nYou have to wait for two hours after you last built factories.'; break; case 38: str = 'This planet name is unavailable.'; break; case 200: str = 'You can\'t do anything while in vacation mode.'; break; default: str = 'An unkown error has occured: ' + en; break; } alert('Planet Manager: error\n\n' + str); } function factoryConfirm(act, ft, qt) { var str; if (act == 0) { var c = qt; str = 'You are about to build '; str += formatNumber(qt.toString()) + ' ' + (ft == '1' ? 'military' : 'industrial') + ' factor' + (qt > 1 ? 'ies' : 'y'); str += '.\nThis operation will cost you '; c *= parseInt(orbit.spec.caps[ft == '1' ? 2 : 1], 10); str += formatNumber(c.toString()) + ' euros.\nPlease confirm.'; } else { str = 'You are about to destroy ' + qt + ' '; str += (ft == '1' ? 'military' : 'industrial') + ' factor' + (qt > 1 ? 'ies' : 'y'); str += '.\nPlease note that your factories will not be refunded.\nPlease confirm this operation.'; } return confirm(str); } function promptNewName() { return prompt('Please type in the new name for this planet:', ''); } function promptDestroyTurrets() { return prompt('How many turrets do you wish to destroy?', '1'); } function saleError(e) { var str; switch (e) { case 1: str = 'You must indicate a player to give / sale the planet to.'; break; case 2: str = 'Please specify a price.'; break; case 3: str = 'Auction sales must have an expiration date. Please select one.'; break; case 4: str = 'Target player not found.'; break; case 5: str = 'Target player is under Peacekeeper protection.'; break; case 6: str = 'Unable to sell something to yourself.'; break; case 7: str = 'Fleet not found.'; break; case 200: str = 'You can\'t do anything while in vacation mode.'; break; case 201: str = 'You can\'t sell planets while under Peacekeeper protection.'; break; default: str = 'An unknown error has occured.'; break; } alert('Planet Sale - Error\n' + str); } function userConfirmSale() { return confirm("Please confirm that you really want to give / sell this planet."); } function confirmAbandon() { return confirm('You are about the abandon this planet.\nPlease confirm.'); } function confirmCancelAbandon() { return confirm('You were about the abandon this planet.\nPlease confirm you want to cancel this action.'); } function confirmCancelSale() { return confirm('You are about to cancel the sale of this planet.\nPlease confirm.'); } function confirmDestroy() { return confirm( 'You are about to make this planet\'s wormhole go supernova.\n' + 'The planet will be destroyed, and the people under your rule will be scared to\n' + 'death because of it.\n' + 'It will take the wormhole 4 hours to reach the point where it actually explodes.\n' + 'Please confirm.' ); } function confirmCancelDestruction() { return confirm('You are about to cancel the planet\'s destruction\nPlease confirm.'); }