LWWidget.Beta5.Fleets = LWWidget.Game.Page.inherits({ setData: function (data) { var _d = data.getChildren('Empire')[0].getChildren('Fleets')[0]; this.fleets = parseInt(_d.getAttribute('count'), 10); if (this.fleets) { // Fleets in battle this.inBattle = parseInt(_d.getAttribute('inBattle'), 10); // Total fleet power this.power = parseInt(_d.getAttribute('power'), 10); // Ships types this.gaships = parseInt(_d.getAttribute('gaships'), 10); this.fighters = parseInt(_d.getAttribute('fighters'), 10); this.cruisers = parseInt(_d.getAttribute('cruisers'), 10); this.bcruisers = parseInt(_d.getAttribute('bcruisers'), 10); // Upkeep _d = data.getChildren('Empire')[0].getChildren('Budget')[0]; this.upkeep = parseInt(_d.getAttribute('upkeep'), 10); } }, draw: function (_e) { if (this.fleets == 0) { _e.innerHTML = '
No fleets
'; return; } var _s = '' + Base.Util.formatNumber(this.fleets)
+ ' fleet' + (this.fleets > 1 ? 's' : '');
if (this.inBattle) {
_s += ' (' + Base.Util.formatNumber(this.inBattle) + ' engaged in battle!)';
}
_s += '
Total fleet power: ' + Base.Util.formatNumber(this.power)
+ '
Upkeep: €' + Base.Util.formatNumber(this.upkeep)
+ '
Ship types
';
if (this.gaships) {
_s += 'G.A. ships: ' + Base.Util.formatNumber(this.gaships) + '
';
}
if (this.fighters) {
_s += 'Fighters: ' + Base.Util.formatNumber(this.fighters) + '
';
}
if (this.cruisers) {
_s += 'Cruisers: ' + Base.Util.formatNumber(this.cruisers) + '
';
}
if (this.bcruisers) {
_s += 'Battle Cruisers: ' + Base.Util.formatNumber(this.bcruisers) + '
';
}
_s += '