in this Thread you will find all the information that we can give you as well as a kind of FAQ. We will try to keep it as up to date as possible, but we can’t update it daily, so bear with us.
This is our official API:
var city = ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentCity();
var ownCity = ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentOwnCity();
var app = qx.core.Init.getApplication();
app.getPlayArea().setView(webfrontend.gui.PlayArea.PlayArea.modes.EMode_CombatReplay, city.get_Id(), 0, 0);
var curCity = ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentCity();
curCity.get_CityBuildingsData ().GetUniqueBuildingByTechName (ClientLib.Base.ETechName techName);
This code is done when inside an enemy base.
It returns null always!
Even though I used instead of techName - Construction_Yard or Defense_Facility for example.
It currently works only with GDI and NOD, because it uses the Faction from the current City and for forgotten there are special faction for Camps, Outposts and Bases and these Factions weren’t taken in account in this function.
I fixed it so it will return for Camps, Outposts and bases the right building too, will be available in the next patch.
var battleground = ClientLib.Vis.VisMain.GetInstance().get_Battleground();
The code is done when inside an enemy base.
returns null always!
get_Replay() should only work if you are watching a Replay from a Combat Report or a simulated Battle. And only if you watch a Replay from a Combat Report there should be a Report.
If you only watching the city there isn’t anything in this variable.
The Constructors of things like ClientLib.Vis.ViewModeChange & ClientLib.Data.CityPreArmyUnitsChanged on the API shows the following: System.Void .ctor (System.Object object ,System.IntPtr method).
However it doesn't work as System.Void remove_ArmyChanged (ClientLib.Data.CityPreArmyUnitsChanged value) & System.Void add_ViewModeChange (ClientLib.Vis.ViewModeChange value) will not accept them.
var add_ViewModeChange = new ClientLib.Vis.ViewModeChange(this, onViewChange);
I managed to bypass it by using:
var add_ViewModeChange = new ClientLib.Vis.ViewModeChange();
Please check if something is wrong there, or maybe I am doing something wront?
For this events we use a helper function:
webfrontend.Util.attachNetEvent(ClientLib.Vis.VisMain.GetInstance(), "MouseToolChange", ClientLib.Vis.MouseToolChange, this, this._onMouseToolChange);
webfrontend.Util.attachNetEvent(/*instance of object which calls the event*/, /*name of the event*/, /*type of the event*/, /*context object*/, /*callback function*/);
In General, I am lookin for a way to get buildings data from battleground after simulating.
In older versions of the scripts we took data from entities within the battleground, however since the update they are nowhere to be found.
Please point me to the right direction.
This will be supported in the next patch.