Skip to content

Commit

Permalink
Added preliminary code to handle the Dillon Forge
Browse files Browse the repository at this point in the history
Added code to manage the new Trade Ministry trade-by-distance API
  • Loading branch information
ian docherty committed Jan 22, 2012
1 parent 5dfe663 commit 35301d4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
43 changes: 31 additions & 12 deletions buildingTheDillonForge.js
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions buildingTradeMinistry.js
Expand Up @@ -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>',
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 35301d4

Please sign in to comment.