Greasy Fork is available in English.

C&C Tiberium Alliances CENTER DRIVEN CDSIM Combat Simulator

CENTER DRIVEN's Combat Simulator and Combat Stats

Bu script silinmiş.

// ==UserScript==
// @name           C&C Tiberium Alliances  CENTER DRIVEN CDSIM Combat Simulator
// @description     CENTER DRIVEN's Combat Simulator and Combat Stats
// @author          XDAAST.XDaast.daltondaast.KingCrimson
// @version         4.0.1
// @namespace      https://prodgame*.alliances.commandandconquer.com/*/index.aspx*
// @include         https://prodgame*.alliances.commandandconquer.com/*/index.aspx*
// @icon            http://i.imgur.com/qSgClQp.png
// @grant           GM_getValue
// @grant           GM_log
// @grant           GM_openInTab
// @grant           GM_registerMenuCommand
// @grant           GM_setValue
// @grant           GM_xmlhttpRequest
// ==/UserScript==
(function(){var r=document.createElement("script");r.innerHTML="("+function(){function r(){qx.Class.define("Simulator",{type:"singleton",extend:qx.core.Object,construct:function(){try{this.armyBar=qx.core.Init.getApplication().getArmySetupAttackBar();this.playArea=qx.core.Init.getApplication().getMainOverlay();this.replayBar=qx.core.Init.getApplication().getReportReplayOverlay();this.isSimButtonDisabled=!1;this.armyTempFormations=[];this.armyTempIdx=0;this.isSimulation=!1;this.hideArmyTooltips();
var b;this.simBtn=(new qx.ui.form.Button("","http://i.imgur.com/P7hf5CG.png")).set({toolTipText:"SIMULATE BATTLE!",width:72,height:56,alignY:"middle",appearance:"button-text-small"});this.simBtn.addListener("click",function(){this.__openSimulatorWindow()},this);this.simBtn.getChildControl("icon").set({width:45,height:45,scale:!0});this.simBtn.hide();this.playArea.add(this.simBtn,{left:null,right:3,bottom:161});this.statBtn=(new qx.ui.form.Button("","http://icons.iconarchive.com/icons/kyo-tux/phuzion/16/Misc-Stats-icon.png")).set({toolTipText:"STATS MENU OF GLORY",
width:25,height:25,alignY:"middle",appearance:"button-text-small"});this.statBtn.getChildControl("icon").set({width:15,height:15,scale:!0});this.statBtn.addListener("click",function(){this.__openStatWindow()},this);this.statBtn.hide();this.playArea.add(this.statBtn,{left:null,right:34,bottom:368});this.optionBtn=(new qx.ui.form.Button("","http://files.softicons.com/download/folder-icons/classy-folder-icons-by-gurato/png/48/Black%20Grey%20Options.png")).set({toolTipText:"THE OPTIONS BRO",width:45,
height:45,alignY:"middle",appearance:"button-text-small"});this.optionBtn.addListener("click",function(){this.__openOptionWindow()},this);this.optionBtn.getChildControl("icon").set({width:45,height:45,scale:!0});this.optionBtn.hide();this.playArea.add(this.optionBtn,{left:null,right:3,bottom:321});this.layoutBtn=(new qx.ui.form.Button("","http://www.bridge4events.com/img/icon_save_small.png")).set({toolTipText:"YOUR PRETTY LAYOUTS, GET 'em SAVED",width:25,height:25,alignY:"middle",appearance:"button-text-small"});
this.layoutBtn.getChildControl("icon").set({width:15,height:15,scale:!0});this.layoutBtn.addListener("click",function(){this.__openLayoutWindow()},this);this.layoutBtn.hide();this.playArea.add(this.layoutBtn,{left:null,right:3,bottom:368});this.unlockCmtBtn=(new qx.ui.form.Button("Unlock")).set({toolTipText:"UNLOCK MOFO!",width:50,height:50,opacity:0.7,alignY:"middle",appearance:"button-text-small"});this.unlockCmtBtn.addListener("click",function(){this.timeoutCmtBtn()},this);this.armyBar.add(this.unlockCmtBtn,
{left:null,right:7,bottom:5});this.unlockRTBtn=(new qx.ui.form.Button("Unlock")).set({toolTipText:"REPAIR YOUR SH!T",width:50,height:50,opacity:0.7,alignY:"middle",appearance:"button-text-small"});this.unlockRTBtn.addListener("click",function(){this.timeoutRTBtn()},this);this.armyBar.add(this.unlockRTBtn,{left:null,right:7,bottom:97});this.shiftUpBtn=(new qx.ui.form.Button("","http://i.imgur.com/szCZWiX.png")).set({toolTipText:"Shifts all units one space up",width:20,height:20,alignY:"middle",appearance:"button-text-small",
gap:0,iconPosition:"top",show:"icon"});this.shiftUpBtn.addListener("click",function(){this.shiftFormation("u",0)},this);this.shiftUpBtn.hide();this.playArea.add(this.shiftUpBtn,{left:null,right:13,bottom:253});this.shiftDownBtn=(new qx.ui.form.Button("","http://i.imgur.com/l8QEk8v.png")).set({toolTipText:"Shifts all units one space down",width:20,height:20,alignY:"middle",appearance:"button-text-small",gap:0,iconPosition:"top",show:"icon"});this.shiftDownBtn.addListener("click",function(){this.shiftFormation("d",
0)},this);this.shiftDownBtn.hide();this.playArea.add(this.shiftDownBtn,{left:null,right:13,bottom:217});this.shiftLeftBtn=(new qx.ui.form.Button("","http://i.imgur.com/M8WP7gO.png")).set({toolTipText:"Shifts all units one space left",width:20,height:20,alignY:"middle",appearance:"button-text-small",gap:0,iconPosition:"top",show:"icon"});this.shiftLeftBtn.addListener("click",function(){this.shiftFormation("l",0)},this);this.shiftLeftBtn.hide();this.playArea.add(this.shiftLeftBtn,{left:null,right:28,
bottom:235});this.shiftRightBtn=(new qx.ui.form.Button("","http://i.imgur.com/tWbWFx5.png")).set({toolTipText:"Shifts all units one space right",width:20,height:20,alignY:"middle",appearance:"button-text-small",gap:0,iconPosition:"top",show:"icon"});this.shiftRightBtn.addListener("click",function(){this.shiftFormation("r",0)},this);this.shiftRightBtn.hide();this.playArea.add(this.shiftRightBtn,{left:null,right:3,bottom:235});for(b=0;b<ClientLib.Base.Util.get_ArmyMaxSlotCountY();b++){var a=(new qx.ui.form.Button(b+
1,"http://i.imgur.com/M8WP7gO.png")).set({toolTipText:"Shifts units one space left",width:25,maxHeight:25,alignY:"middle",show:"icon",iconPosition:"top"});a.addListener("click",function(a){this.shiftFormation("l",parseInt(a.getTarget().getLabel(),10))},this);var c=(new qx.ui.form.Button(b+1,"http://i.imgur.com/tWbWFx5.png")).set({toolTipText:"Shifts units one space right",width:30,maxHeight:25,alignY:"middle",show:"icon",iconPosition:"top"});c.addListener("click",function(a){this.shiftFormation("r",
parseInt(a.getTarget().getLabel(),10))},this);var e=this.armyBar.getChildren()[1].getChildren()[b+4];e.removeAll();e.setLayout(new qx.ui.layout.HBox);e.add(new qx.ui.core.Spacer,{flex:1});e.add(a);e.add(c);e.add(new qx.ui.core.Spacer,{flex:1})}this.mirrorBtnH=(new qx.ui.form.Button("","http://i.imgur.com/C4lkEXo.png")).set({toolTipText:"FLIP",show:"icon",width:25,height:25,center:!0,alignY:"middle",appearance:"button-text-small"});this.mirrorBtnH.getChildControl("icon").set({width:15,height:15,scale:!0});
this.mirrorBtnH.addListener("click",function(){this.mirrorFormation("h")},this);this.mirrorBtnH.hide();this.playArea.add(this.mirrorBtnH,{left:null,right:3,bottom:272});this.mirrorBtnV=(new qx.ui.form.Button("","http://i.imgur.com/BVv4yNC.png")).set({toolTipText:"MIRROR",show:"icon",width:25,height:25,center:!0,alignY:"middle",appearance:"button-text-small"});this.mirrorBtnV.getChildControl("icon").set({width:15,height:15,scale:!0});this.mirrorBtnV.addListener("click",function(){this.mirrorFormation("v")},
this);this.mirrorBtnV.hide();this.playArea.add(this.mirrorBtnV,{left:null,right:30,bottom:272});this.disableAllUnitsBtn=(new qx.ui.form.Button("","http://i.imgur.com/wx8hitZ.png")).set({toolTipText:"ENABLE/DISABLE ALL",show:"icon",width:25,height:25,center:!0,alignY:"middle",appearance:"button-text-small"});this.disableAllUnitsBtn.getChildControl("icon").set({width:15,height:15,scale:!0});this.disableAllUnitsBtn.addListener("click",function(){this.shiftFormation("n",0)},this);this.disableAllUnitsBtn.hide();
this.playArea.add(this.disableAllUnitsBtn,{left:null,right:30,bottom:296});this.armyUndoBtn=(new qx.ui.form.Button("","FactionUI/icons/icon_refresh_funds.png")).set({toolTipText:"Undo's formation to previous saved formation.<br>Save formations by hitting<br>the Update or Simulate button.",show:"icon",width:25,height:25,center:!0,alignY:"middle",appearance:"button-text-small"});this.armyUndoBtn.getChildControl("icon").set({width:15,height:15,scale:!0});this.armyUndoBtn.addListener("click",function(){this.undoCurrentFormation()},
this);this.armyUndoBtn.setEnabled(!1);this.armyUndoBtn.hide();this.playArea.add(this.armyUndoBtn,{left:null,right:3,bottom:296});this.quickSaveBtn=(new qx.ui.form.Button("","http://www.iconattitude.com/icons/open_icon_library/actions/png/16/document-save-3.png")).set({toolTipText:"Saves the current layout<br>without having to open<br>the Formation Saver window.<br>Does not make persistent.",width:15,height:25,alignY:"middle",appearance:"button-text-small"});this.quickSaveBtn.getChildControl("icon").set({width:15,
height:15,scale:!0});this.quickSaveBtn.addListener("click",function(){Simulator.LayoutWindow.getInstance().saveNewLayout(!0)},this);this.quickSaveBtn.hide();this.playArea.add(this.quickSaveBtn,{left:null,right:3,bottom:136});this.backBtn=(new qx.ui.form.Button("Back")).set({toolTipText:"Return to Combat Setup",width:50,height:24,appearance:"button-text-small"});this.backBtn.addListener("click",function(){this.backToCombatSetup()},this);this.replayBar.add(this.backBtn,{top:37,left:255});this.replayStatBtn=
(new qx.ui.form.Button("Stats")).set({toolTipText:"Return to Combat Setup",width:50,height:24,appearance:"button-text-small"});this.replayStatBtn.addListener("click",function(){this.__openStatWindow()},this);this.replayBar.add(this.replayStatBtn,{top:7,left:255})}catch(d){console.log("Error setting up Simulator Constructor: "),console.log(d.toString())}},destruct:function(){},members:{armyBar:null,playArea:null,replayBar:null,isSimButtonDisabled:null,armyTempFormations:null,armyTempIdx:null,isSimulation:null,
simBtn:null,optionBtn:null,statBtn:null,layoutBtn:null,unlockCmtBtn:null,unlockRTBtn:null,shiftUpBtn:null,shiftDownBtn:null,shiftLeftBtn:null,shiftRightBtn:null,disableAllUnitsBtn:null,armyUndoBtn:null,quickSaveBtn:null,backBtn:null,replayStatBtn:null,__openSimulatorWindow:function(){var b=ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentCity();if(null!=b){var a=ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentOwnCity();this.isSimulation=!0;this.saveTempFormation();localStorage.ta_sim_last_city=
b.get_Id();a.get_CityArmyFormationsManager().set_CurrentTargetBaseId(b.get_Id());ClientLib.API.Battleground.GetInstance().SimulateBattle();qx.core.Init.getApplication().getPlayArea().setView(ClientLib.Data.PlayerAreaViewMode.pavmCombatReplay,b.get_Id(),0,0);b=localStorage.autoSimulate;if(void 0!==b&&"yes"==b){var c=localStorage.simulateSpeed;setTimeout(function(){var a=ClientLib.Vis.VisMain.GetInstance().get_Battleground();a.RestartReplay();a.set_ReplaySpeed(parseInt(c,10))},1E3)}!1==this.isSimButtonDisabled&&
(this.disableSimulateButtonTimer(1E4),"function"===typeof Simulator.StatWindow.getInstance().disableSimulateStatButtonTimer&&Simulator.StatWindow.getInstance().disableSimulateStatButtonTimer(1E4));setTimeout(function(){var a=ClientLib.Vis.VisMain.GetInstance().get_Battleground().get_BattleDuration(),a=phe.cnc.Util.getTimespanString(a);Simulator.StatWindow.getInstance().sim[Simulator.StatWindow.getInstance().simSelected].Label.Battle.Duration.setValue(a)},10);!1==Simulator.StatWindow.getInstance().simReplayBtn.getEnabled()&&
Simulator.StatWindow.getInstance().simReplayBtn.setEnabled(!0)}},__openOptionWindow:function(){try{Simulator.OptionWindow.getInstance().isVisible()?(console.log("Closing Option Window"),Simulator.OptionWindow.getInstance().close()):(console.log("Opening Option Window"),Simulator.OptionWindow.getInstance().open())}catch(b){console.log("Error Opening or Closing Option Window"),console.log(b.toString())}},__openStatWindow:function(){try{Simulator.StatWindow.getInstance().isVisible()?(console.log("Closing Stat Window"),
Simulator.StatWindow.getInstance().close()):(console.log("Opening Stat Window"),Simulator.StatWindow.getInstance().open(),Simulator.StatWindow.getInstance().calcResources())}catch(b){console.log("Error Opening or Closing Stat Window"),console.log(b.toString())}},__openLayoutWindow:function(){try{Simulator.LayoutWindow.getInstance().isVisible()?(console.log("Closing Layout Window"),Simulator.LayoutWindow.getInstance().close()):(console.log("Opening LayoutWindow"),Simulator.LayoutWindow.getInstance().updateLayoutList(),
Simulator.LayoutWindow.getInstance().layoutTextBox.setValue(""),Simulator.LayoutWindow.getInstance().persistentCheck.setValue(!1),Simulator.LayoutWindow.getInstance().open())}catch(b){console.log("Error Opening or Closing Layout Window"),console.log(b.toString())}},saveTempFormation:function(){try{var b=this.getCityPreArmyUnits().get_ArmyUnits().l;if(0!=this.armyTempFormations.length)for(var a=0;a<b.length;a++){var c=this.armyTempFormations[this.armyTempIdx][a];if(b[a].get_CoordX()!=c.x||b[a].get_CoordY()!=
c.y)break;else if(a+1==b.length)return}c=[];for(a=0;a<b.length;a++){var e=b[a],d={};d.x=e.get_CoordX();d.y=e.get_CoordY();d.id=e.get_Id();d.enabled=e.get_Enabled();c.push(d)}this.armyTempFormations.push(c);this.armyTempIdx=this.armyTempFormations.length-1;1<this.armyTempFormations.length&&this.armyUndoBtn.setEnabled(!0)}catch(f){console.log("Error Saving Temp Formation"),console.log(f.toString())}},undoCurrentFormation:function(){try{this.restoreFormation(this.armyTempFormations[this.armyTempIdx-
1]),this.armyTempFormations.splice(this.armyTempIdx,1),this.armyTempIdx--,1==this.armyTempFormations.length&&this.armyUndoBtn.setEnabled(!1)}catch(b){console.log("Error undoing formation"),console.log(b.toString())}},mirrorFormation:function(b){try{console.log("Shifting Unit Formation");for(var a=this.getCityPreArmyUnits().get_ArmyUnits().l,c=[],e=0;e<a.length;e++){var d=a[e],f={},h=d.get_CoordX(),g=d.get_CoordY();"h"==b&&(h=Math.abs(h-8));"v"==b&&(g=Math.abs(g-3));f.x=h;f.y=g;f.id=d.get_Id();f.enabled=
d.get_Enabled();c.push(f)}this.restoreFormation(c)}catch(k){console.log("Error Mirroring Formation"),console.log(k.toString())}},shiftFormation:function(b,a){try{console.log("Shifting Unit Formation: direction:"+b+", sel:"+a);var c=0,e=0;"u"==b&&(c=-1);"d"==b&&(c=1);"l"==b&&(e=-1);"r"==b&&(e=1);if(0!=c||0!=e||"n"==b){for(var d=this.getCityPreArmyUnits().get_ArmyUnits().l,f=[],h=0;h<d.length;h++){var g=d[h],k={},q=g.get_CoordX()+e;switch(q){case 9:q=0;break;case -1:q=8}var p=g.get_CoordY()+c;switch(p){case 4:p=
0;break;case -1:p=3}0==a||g.get_CoordX()==a-1||"u"!=b&&"d"!=b?k.y=p:k.y=g.get_CoordY();0==a||g.get_CoordY()==a-1||"l"!=b&&"r"!=b?k.x=q:k.x=g.get_CoordX();k.id=g.get_Id();"n"==b&&(k.enabled=void 0!==localStorage.allUnitsDisabled?"yes"==localStorage.allUnitsDisabled?g.set_Enabled(!0):g.set_Enabled(!1):g.set_Enabled(!1));k.enabled=g.get_Enabled();f.push(k)}"n"==b&&(localStorage.allUnitsDisabled="yes"==localStorage.allUnitsDisabled?"no":"yes");this.restoreFormation(f)}}catch(l){console.log("Error Shifting Units"),
console.log(l.toString())}},restoreFormation:function(b){try{for(var a=this.getCityPreArmyUnits(),c=a.get_ArmyUnits().l,e=0;e<b.length;e++)for(var d=b[e],f=d.id,h=0;h<c.length;h++)c[h].get_Id()===f&&(c[h].MoveBattleUnit(d.x,d.y),void 0===d.enabled?c[h].set_Enabled(!0):c[h].set_Enabled(d.enabled));a.UpdateFormation(!0)}catch(g){console.log("Error Restoring Formation"),console.log(g.toString())}},getCityPreArmyUnits:function(){var b=ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentCity(),
a=ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentOwnCity(),c=a.get_CityArmyFormationsManager();a.get_CityArmyFormationsManager().set_CurrentTargetBaseId(b.get_Id());return c.GetFormationByTargetBaseId(c.get_CurrentTargetBaseId())},timeoutCmtBtn:function(){this.armyBar.remove(this.unlockCmtBtn);setTimeout(function(){Simulator.getInstance().armyBar.add(Simulator.getInstance().unlockCmtBtn,{left:null,right:7,bottom:5})},2E3)},timeoutRTBtn:function(){this.armyBar.remove(this.unlockRTBtn);
setTimeout(function(){Simulator.getInstance().armyBar.add(Simulator.getInstance().unlockRTBtn,{left:null,right:7,bottom:97})},2E3)},backToCombatSetup:function(){try{var b=ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentCity();null!=b&&qx.core.Init.getApplication().getPlayArea().setView(ClientLib.Data.PlayerAreaViewMode.pavmCombatSetupDefense,b.get_Id(),0,0)}catch(a){console.log("Error closing Simulation Window"),console.log(a.toString())}},disableSimulateButtonTimer:function(b){try{1E3<=
b?(this.isSimButtonDisabled=!0,this.simBtn.setEnabled(!1),this.simBtn.setLabel(Math.floor(b/1E3)),b-=1E3,setTimeout(function(){Simulator.getInstance().disableSimulateButtonTimer(b)},1E3)):(setTimeout(function(){Simulator.getInstance().simBtn.setEnabled(!0);Simulator.OptionWindow.getInstance()._buttonSizeCB.getValue()?Simulator.getInstance().simBtn.setLabel("Simulate"):Simulator.getInstance().simBtn.setLabel("S")},b),this.isSimButtonDisabled=!1)}catch(a){console.log("Error disabling simulator button"),
console.log(a.toString())}},hideArmyTooltips:function(){try{void 0===localStorage.ArmyUnitTooltipDisabled&&(localStorage.ArmyUnitTooltipDisabled="yes");for(var b in ClientLib.Vis.BaseView.BaseView.prototype)if("function"===typeof ClientLib.Vis.BaseView.BaseView.prototype[b]&&-1<ClientLib.Vis.BaseView.BaseView.prototype[b].toString().indexOf(ClientLib.Vis.BaseView.BaseView.prototype.ShowToolTip.toString())){Function("","ClientLib.Vis.BaseView.BaseView.prototype.ShowToolTip_Original = ClientLib.Vis.BaseView.BaseView.prototype."+
b)();Function("","ClientLib.Vis.BaseView.BaseView.prototype."+b+" = function (a) { if(ClientLib.Vis.VisMain.GetInstance().get_Mode()==7 && localStorage['ArmyUnitTooltipDisabled']=='yes') { return; } else { this.ShowToolTip_Original(a); } };")();break}qx.core.Init.getApplication().getArmyUnitTooltipOverlay().setVisibility_Original=qx.core.Init.getApplication().getArmyUnitTooltipOverlay().setVisibility;qx.core.Init.getApplication().getArmyUnitTooltipOverlay().setVisibility=function(a){"yes"==localStorage.ArmyUnitTooltipDisabled?
qx.core.Init.getApplication().getArmyUnitTooltipOverlay().setVisibility_Original(!1):qx.core.Init.getApplication().getArmyUnitTooltipOverlay().setVisibility_Original(a)}}catch(a){console.log("Error hideArmyUnitTooltips()"),console.log(a.toString())}}}});qx.Class.define("Simulator.StatWindow",{type:"singleton",extend:qx.ui.window.Window,construct:function(){try{this.base(arguments);this.set({layout:(new qx.ui.layout.VBox).set({spacing:0}),caption:"Simulator Stats",icon:"FactionUI/icons/icon_res_plinfo_command_points.png",
contentPadding:5,contentPaddingTop:0,allowMaximize:!1,showMaximize:!1,allowMinimize:!1,showMinimize:!1,resizable:!0,resizableTop:!1,resizableBottom:!1});this.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});if(void 0!==localStorage.statWindowPosLeft){var b=parseInt(localStorage.statWindowPosLeft,10),a=parseInt(localStorage.statWindowPosTop,10);this.moveTo(b,a)}else this.moveTo(124,31);this.simViews=void 0!==localStorage.simViews?parseInt(localStorage.simViews,10):2;var c=
qx.core.Init.getApplication();this.isSimStatButtonDisabled=!1;this.Battle=(new qx.ui.container.Composite(new qx.ui.layout.HBox(-3))).set({decorator:"pane-light-plain",allowGrowX:!0,marginLeft:0,marginRight:0});var e=(new qx.ui.container.Composite(new qx.ui.layout.VBox)).set({width:29,padding:5,allowGrowX:!0,marginLeft:0,marginRight:0}),d=(new qx.ui.basic.Label("O")).set({toolTipText:c.tr("tnf:combat report"),alignX:"center",alignY:"middle"}),f=(new qx.ui.basic.Label("D")).set({toolTipText:c.tr("tnf:combat timer npc: %1",
""),alignX:"center",alignY:"middle"}),h=(new qx.ui.basic.Label("B")).set({toolTipText:c.tr("tnf:base"),alignX:"center",alignY:"middle"});e.add(d);e.add(f);e.add(h);this.Battle.add(e);this.add(this.Battle);var g=(new qx.ui.container.Composite(new qx.ui.layout.VBox(5))).set({decorator:"pane-light-opaque"});g.add((new qx.ui.basic.Label(c.tr("tnf:combat target"))).set({alignX:"center",alignY:"middle",paddingBottom:5,font:"font_size_13_bold"}));this.add(g);this.EnemyHealth=(new qx.ui.container.Composite(new qx.ui.layout.HBox(-3))).set({decorator:"pane-light-plain",
allowGrowX:!0,marginLeft:0,marginRight:0});var k=(new qx.ui.container.Composite(new qx.ui.layout.VBox)).set({width:29,padding:5,allowGrowX:!0,marginLeft:0,marginRight:0}),q=(new qx.ui.basic.Atom(null,"FactionUI/icons/icon_arsnl_show_all.png")).set({toolTipText:c.tr("tnf:total"),toolTipIcon:"FactionUI/icons/icon_arsnl_show_all.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),p=(new qx.ui.basic.Atom(null,"FactionUI/icons/icon_arsnl_base_buildings.png")).set({toolTipText:c.tr("tnf:base"),
toolTipIcon:"FactionUI/icons/icon_arsnl_base_buildings.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),l=(new qx.ui.basic.Atom(null,"FactionUI/icons/icon_def_army_points.png")).set({toolTipText:c.tr("tnf:defense"),toolTipIcon:"FactionUI/icons/icon_def_army_points.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),m=(new qx.ui.basic.Label("CY")).set({toolTipText:GAMEDATA.Tech[1].dn,alignX:"center",alignY:"middle"}),n=(new qx.ui.basic.Label("DF")).set({toolTipText:GAMEDATA.Tech[42].dn,
alignX:"center",alignY:"middle"}),t=(new qx.ui.basic.Label("CC")).set({toolTipText:GAMEDATA.Tech[24].dn,alignX:"center",alignY:"middle"});q.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});p.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});l.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});k.add(q);k.add(p);k.add(l);k.add(m);k.add(n);k.add(t);this.EnemyHealth.add(k);this.add(this.EnemyHealth);var x=(new qx.ui.container.Composite(new qx.ui.layout.VBox(5))).set({decorator:"pane-light-opaque"});
x.add((new qx.ui.basic.Label(c.tr("tnf:own repair cost"))).set({alignX:"center",alignY:"middle",paddingBottom:5,font:"font_size_13_bold"}));this.add(x);this.Repair=(new qx.ui.container.Composite(new qx.ui.layout.HBox(-3))).set({decorator:"pane-light-plain",allowGrowX:!0,marginLeft:0,marginRight:0});var s=(new qx.ui.container.Composite(new qx.ui.layout.VBox)).set({width:29,padding:5,allowGrowX:!0,marginLeft:0,marginRight:0}),E=(new qx.ui.basic.Atom(null,"webfrontend/ui/icons/icn_repair_points.png")).set({toolTipText:c.tr("tnf:offense repair time"),
toolTipIcon:"webfrontend/ui/icons/icn_repair_points.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),u=(new qx.ui.basic.Atom(null,"webfrontend/ui/icons/icn_repair_off_points.png")).set({toolTipText:c.tr("tnf:repair points"),toolTipIcon:"webfrontend/ui/icons/icn_repair_off_points.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),y=(new qx.ui.basic.Atom(null,"webfrontend/ui/icons/icon_res_repair_inf.png")).set({toolTipText:c.tr("tnf:infantry repair title"),toolTipIcon:"webfrontend/ui/icons/icon_res_repair_inf.png",
alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),F=(new qx.ui.basic.Atom(null,"webfrontend/ui/icons/icon_res_repair_tnk.png")).set({toolTipText:c.tr("tnf:vehicle repair title"),toolTipIcon:"webfrontend/ui/icons/icon_res_repair_tnk.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),z=(new qx.ui.basic.Atom(null,"webfrontend/ui/icons/icon_res_repair_air.png")).set({toolTipText:c.tr("tnf:aircraft repair title"),toolTipIcon:"webfrontend/ui/icons/icon_res_repair_air.png",alignX:"center",
alignY:"middle",gap:0,iconPosition:"top"});E.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});u.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});y.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});F.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});z.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});s.add(E);s.add(u);s.add(y);s.add(F);s.add(z);this.Repair.add(s);this.add(this.Repair);
var A=(new qx.ui.container.Composite(new qx.ui.layout.VBox(5))).set({decorator:"pane-light-opaque"});A.add((new qx.ui.basic.Label(c.tr("tnf:lootable resources:"))).set({alignX:"center",alignY:"middle",paddingBottom:5,font:"font_size_13_bold"}));this.add(A);this.Loot=(new qx.ui.container.Composite(new qx.ui.layout.HBox(-3))).set({decorator:"pane-light-plain",allowGrowX:!0,marginLeft:0,marginRight:0});var v=(new qx.ui.container.Composite(new qx.ui.layout.VBox)).set({width:29,padding:5,allowGrowX:!0,
marginLeft:0,marginRight:0}),r=(new qx.ui.basic.Atom(null,"webfrontend/ui/common/icn_res_tiberium.png")).set({toolTipText:c.tr("tnf:tiberium"),toolTipIcon:"webfrontend/ui/common/icn_res_tiberium.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),B=(new qx.ui.basic.Atom(null,"webfrontend/ui/common/icn_res_chrystal.png")).set({toolTipText:c.tr("tnf:crystals"),toolTipIcon:"webfrontend/ui/common/icn_res_chrystal.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),w=(new qx.ui.basic.Atom(null,
"webfrontend/ui/common/icn_res_dollar.png")).set({toolTipText:c.tr("tnf:credits"),toolTipIcon:"webfrontend/ui/common/icn_res_dollar.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),G=(new qx.ui.basic.Atom(null,"webfrontend/ui/common/icn_res_research_mission.png")).set({toolTipText:c.tr("tnf:research points"),toolTipIcon:"webfrontend/ui/common/icn_res_research_mission.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"}),H=(new qx.ui.basic.Atom(null,"FactionUI/icons/icon_transfer_resource.png")).set({toolTipText:c.tr("tnf:total")+
" "+c.tr("tnf:loot"),toolTipIcon:"FactionUI/icons/icon_transfer_resource.png",alignX:"center",alignY:"middle",gap:0,iconPosition:"top"});r.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});B.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});w.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});G.getChildControl("icon").set({width:18,height:18,scale:!0,alignY:"middle"});H.getChildControl("icon").set({width:18,height:18,scale:!0,
alignY:"middle"});v.add(r);v.add(B);v.add(w);v.add(G);v.add(H);this.Loot.add(v);this.add(this.Loot);var D=(new qx.ui.container.Composite(new qx.ui.layout.HBox(5))).set({decorator:"pane-light-opaque",allowGrowX:!0,marginLeft:0,marginRight:0,padding:5});this.add(D);this.simStatBtn=(new qx.ui.form.Button(c.tr("tnf:update"))).set({allowGrowX:!1});this.simStatBtn.setToolTipText("Updates Simulation Stats");this.simStatBtn.addListener("click",this.simulateStats,this);this.simReplayBtn=(new qx.ui.form.Button(c.tr("tnf:show combat"))).set({allowGrowX:!1});
this.simReplayBtn.setToolTipText(c.tr("tnf:show battle replay"));this.simReplayBtn.addListener("click",this.doSimReplay,this);this.simReplayBtn.setEnabled(!1);D.add(this.simStatBtn,{width:"50%"});D.add(this.simReplayBtn,{width:"50%"});g.addListener("click",function(){this.EnemyHealth.isVisible()?this.EnemyHealth.exclude():this.EnemyHealth.show()},this);x.addListener("click",function(){this.Repair.isVisible()?this.Repair.exclude():this.Repair.show()},this);A.addListener("click",function(){this.Loot.isVisible()?
this.Loot.exclude():this.Loot.show()},this);void 0!==localStorage.hideHealth&&"yes"==localStorage.hideHealth&&this.EnemyHealth.exclude();void 0!==localStorage.hideRepair&&"yes"==localStorage.hideRepair&&this.Repair.exclude();void 0!==localStorage.hideLoot&&"yes"==localStorage.hideLoot&&this.Loot.exclude();for(b=0;b<this.simViews;b++)this.sim[b]=new this.Simulation(b),this.sim[b].Select(this.simSelected),this.Battle.add(this.sim[b].Label.Battle.container,{flex:1}),this.EnemyHealth.add(this.sim[b].Label.EnemyHealth.container,
{flex:1}),this.Repair.add(this.sim[b].Label.Repair.container,{flex:1}),this.Loot.add(this.sim[b].Label.Loot.container,{flex:1});phe.cnc.Util.attachNetEvent(ClientLib.API.Battleground.GetInstance(),"OnSimulateBattleFinished",ClientLib.API.OnSimulateBattleFinished,this,this.__OnSimulateBattleFinished);phe.cnc.base.Timer.getInstance().addListener("uiTick",this._onTick,this)}catch(C){console.log("Error setting up Simulator.StatWindow Constructor: "),console.log(C.toString())}},destruct:function(){},members:{Battle:null,
EnemyHealth:null,Repair:null,Loot:null,simStatBtn:null,simReplayBtn:null,isSimStatButtonDisabled:null,simSelected:0,simViews:3,sim:[],Simulation:function(b){try{var a=!1,c=this.OwnCity=this.TargetCity=null,e=null;this.Label={Battle:{container:(new qx.ui.container.Composite(new qx.ui.layout.VBox)).set({width:65,padding:5,allowGrowX:!0,marginLeft:0,marginRight:0,decorator:"pane-light-opaque"}),Outcome:(new qx.ui.basic.Atom("-",null)).set({alignX:"center",alignY:"middle",gap:0,iconPosition:"top",show:"label"}),
Duration:(new qx.ui.basic.Label("-:--")).set({alignX:"center",alignY:"middle"}),OwnCity:(new qx.ui.basic.Label("-")).set({alignX:"center",alignY:"middle"})},EnemyHealth:{container:(new qx.ui.container.Composite(new qx.ui.layout.VBox)).set({width:6