Permalink
Browse files

Added preliminary code to handle the Dillon Forge

Added code to manage the new Trade Ministry trade-by-distance API
  • Loading branch information...
1 parent 5dfe663 commit 35301d43ea1c0e5a93bb18970f2771a9faf25d05 ian docherty committed Jan 22, 2012
Showing with 36 additions and 17 deletions.
  1. +31 −12 buildingTheDillonForge.js
  2. +5 −5 buildingTradeMinistry.js
View
@@ -19,21 +19,40 @@ if (typeof YAHOO.lacuna.buildings.TheDillonForge == "undefined" || !YAHOO.lacuna
Lang.extend(TheDillonForge, Lacuna.buildings.Building, {
getChildTabs : function() {
- return [this._getTab()];
+ return [this._getSplitTab(), this._getMakeTab()];
},
- _getTab : function() {
- this.tab = new YAHOO.widget.Tab({ label: "Operations", content: [
- '<div id="TheDillonForge" style="display:none;">',
- ' Time left on current operations: <span id="TheDillonForge"></span>',
- '</div>',
- '<div id="TheDillonForgeMessage" style="margin-top:5px;"></div>',
- '<div id="TheDillonForgeDisplay" style="display:none;margin:5px 0;">',
- ' <button type="button" id="Operate">Open The Dillon Forge</button>',
- '</div>'
+ _getSplitTab : function() {
+ this.splitTab = new YAHOO.widget.Tab({ label: "Split Plans", content: [
+ '<div id="forgeSplitReadyContainer">',
+ ' Ready to split a plan',
+ ' <button id="forgeSplitButton">Split</button>',
+ '</div>',
+ '<div id="forgeSplitWorkingContainer">',
+ ' Forge is busy splitting a plan',
+ '</div>',
].join('')});
- return this.tab;
- }
+ return this.splitTab;
+ },
+ _getMakeTab : function() {
+ this.makeTab = new YAHOO.widget.Tab({ label: "Combine Plans", content: [
+ '<div id="TheDillonForge_make">',
+ ' Combine level 1 plans into higher level plans.',
+ '</div>'
+ ].join('')});
+ return this.makeTab;
+ },
+ checkIfWorking : function() {
+ if(this.result.tasks.can && this.result.tasks.seconds_remaining) {
+ Dom.setStyle("forgeSplitReadyContainer", "display", "none");
+ Dom.setStyle("forgeSplitWorkingContainer", "display", "");
+ }
+ else {
+ Dom.setStyle("forgeSplitReadyContainer", "display", "");
+ Dom.setStyle("forgeSplitWorkingContainer", "display", "none");
+ }
+ }
+
});
YAHOO.lacuna.buildings.TheDillonForge = TheDillonForge;
View
@@ -238,7 +238,7 @@ _getAvailTab : function() {
' <option value="ship">Ship</option><option value="plan">Plan</option></select></div>',
' <ul class="tradeHeader tradeInfo clearafter">',
' <li class="tradeEmpire">Empire</li>',
- ' <li class="tradeOfferedDate">Offered Date</li>',
+ ' <li class="tradeOfferedDate">Travel Time</li>',
' <li class="tradeAsking">Cost</li>',
' <li class="tradeOffer">Offering</li>',
' <li class="tradeAction"></li>',
@@ -462,10 +462,10 @@ _getAddTab : function() {
Event.on(nLi, "click", this.EmpireProfile, trade.empire);
nUl.appendChild(nLi);
- nLi = li.cloneNode(false);
- Dom.addClass(nLi,"tradeOfferedDate");
- nLi.innerHTML = Lib.formatServerDateTimeShort(trade.date_offered);
- nUl.appendChild(nLi);
+ nLi = li.cloneNode(false);
+ Dom.addClass(nLi,"tradeOfferedDate");
+ nLi.innerHTML = Lib.formatTime(Math.round(trade.delivery.duration));
+ nUl.appendChild(nLi);
nLi = li.cloneNode(false);
Dom.addClass(nLi,"tradeAsking");

0 comments on commit 35301d4

Please sign in to comment.