DROID_SUPERTRANSPORTER — A heavy transport unit, capable of airlifting any type of droid (including VTOLs) to some other location on the map...
DROID_TRANSPORTER — A cyborg transporter (or possibly a super transporter in Warzone 3.1 Beta 4 and earlier), capable of airlifting droids to some other location on the map.
DROID_WEAPON — A droid capable of attacking other droids.
If you are unable to determine the droid type, return DROID_ANY.
Notes
The results of the function are cached externally – so there's generally no need to build any additional caching in to your function.
This function is used to guess the droid type for the buildDroid() and addDroid() JS API functions, which in Warzone 3.2 do not use the droidType parameter.
The Warzone 3.1 bug with cyborg engineers and mechanics is dealt with externally to this function (your function should not return types 10 or 11).
Example
The API provides a default version of this function that is based on standard game stats...
go.guessDroidTypeFromStats = function(factoryType, body, prop, reserved, t1, t2, t3) {
if (isDefined(factoryType)) { // simplifies things a little
switch (factoryType) {
case CYBORG_FACTORY: {
// check for non-weapon droids first
if (t1.contains("Spade" )) return DROID_CONSTRUCT;
if (t1.contains("Repair")) return DROID_REPAIR;
// failing that, check if it's a person or cyborg
return body.contains("Person") || prop.contains("BaBa")
? DROID_PERSON
: DROID_CYBORG
;
}
case VTOL_FACTORY: {
switch (body) {
case "TransporterBody" : return DROID_TRANSPORTER;
case "SuperTransportBody": return DROID_SUPERTRANSPORTER;
default: return DROID_WEAPON;
}
}
case FACTORY: {
if (t1.contains("Spade")) return DROID_CONSTRUCT;
if (t1.contains("epair")) return DROID_REPAIR;
if (t1.contains("ECM")) return DROID_ECM;
if (t1.contains("Sensor")
|| t1.contains("Radar")
|| t1.contains("CB")
|| t1.contains("rike")) return DROID_SENSOR
;
if (t1.contains("Brain")
|| t1.contains("Command")) return DROID_COMMAND
;
return DROID_WEAPON;
}
}
} else switch (prop) { // work out what factory would be required and try again
case "V-Tol" : {
arguments[0] = VTOL_FACTORY;
return arguments.callee.apply(go, arguments);
}
case "BaBaLegs" :
case "CyborgLegs": {
arguments[0] = CYBORG_FACTORY;
return arguments.callee.apply(go, arguments);
}
case "BaBaProp" :
case "wheeled01" :
case "HalfTrack" :
case "tracked01" :
case "hover01" : {
arguments[0] = FACTORY;
return arguments.callee.apply(go, arguments);
}
}
return DROID_ANY;
}