11package de .peeeq .wurstio .jassinterpreter .providers ;
22
3+ import de .peeeq .wurstio .objectreader .ObjectHelper ;
34import de .peeeq .wurstio .jassinterpreter .mocks .UnitMock ;
5+ import de .peeeq .wurstscript .intermediatelang .ILconstBool ;
46import de .peeeq .wurstscript .intermediatelang .ILconstInt ;
57import de .peeeq .wurstscript .intermediatelang .ILconstReal ;
8+ import de .peeeq .wurstscript .intermediatelang .ILconstString ;
69import de .peeeq .wurstscript .intermediatelang .IlConstHandle ;
710import de .peeeq .wurstscript .intermediatelang .interpreter .AbstractInterpreter ;
811
@@ -23,11 +26,58 @@ public ILconstInt GetUnitTypeId(IlConstHandle unit) {
2326 return ((UnitMock )unit .getObj ()).unitid ;
2427 }
2528
29+ public ILconstString GetUnitName (IlConstHandle unit ) {
30+ if (unit == null ) {
31+ return new ILconstString ("" );
32+ }
33+ UnitMock unitMock = (UnitMock ) unit .getObj ();
34+ return new ILconstString (ObjectHelper .objectIdIntToString (unitMock .unitid .getVal ()));
35+ }
36+
37+ public ILconstInt GetUnitGoldCost (ILconstInt unitid ) {
38+ return ILconstInt .create (0 );
39+ }
40+
41+ public ILconstInt GetUnitWoodCost (ILconstInt unitid ) {
42+ return ILconstInt .create (0 );
43+ }
44+
45+ public ILconstInt GetUnitPointValueByType (ILconstInt unitid ) {
46+ return ILconstInt .create (0 );
47+ }
48+
49+ public ILconstInt GetFoodUsed (ILconstInt unitid ) {
50+ return ILconstInt .create (0 );
51+ }
52+
53+ public ILconstInt GetUnitBuildTime (ILconstInt unitid ) {
54+ return ILconstInt .create (0 );
55+ }
56+
57+ public ILconstInt BlzGetUnitIntegerField (IlConstHandle whichUnit , IlConstHandle whichField ) {
58+ return ILconstInt .create (0 );
59+ }
60+
61+ public ILconstInt BlzGetUnitWeaponIntegerField (IlConstHandle whichUnit , IlConstHandle whichField , ILconstInt index ) {
62+ return ILconstInt .create (0 );
63+ }
64+
65+ public ILconstBool IsUnitType (IlConstHandle whichUnit , IlConstHandle whichUnitType ) {
66+ return ILconstBool .FALSE ;
67+ }
68+
69+ public void RemoveUnit (IlConstHandle unit ) {
70+ userDataMap .remove (unit );
71+ }
72+
2673 public ILconstInt GetUnitUserData (IlConstHandle unit ) {
27- return userDataMap .get (unit );
74+ return unit == null ? ILconstInt . create ( 0 ) : userDataMap .getOrDefault (unit , ILconstInt . create ( 0 ) );
2875 }
2976
3077 public void SetUnitUserData (IlConstHandle unit , ILconstInt userData ) {
78+ if (unit == null ) {
79+ return ;
80+ }
3181 userDataMap .put (unit , userData );
3282 }
3383}
0 commit comments