private bool Read_01085002(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { // Ship Type byte?objectBuilderID = MyMwcMessageIn.ReadByteEx(binaryReader, senderEndPoint); if (objectBuilderID == null) { return(NetworkError()); } SetObjectBuilderId(objectBuilderID.Value); MyMwcLog.IfNetVerbose_AddToLog("ShipType: " + objectBuilderID.Value); // Weapons And Devices int?countWeapons = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (countWeapons == null) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("countWeaponsAndDevices: " + countWeapons); Weapons = new List <MyMwcObjectBuilder_SmallShip_Weapon>(countWeapons.Value); for (int i = 0; i < countWeapons; i++) { MyMwcObjectBuilder_SmallShip_Weapon newWAD = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_SmallShip_Weapon; if (newWAD == null) { return(NetworkError()); } if (newWAD.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } Weapons.Add(newWAD); } // Assignment of ammo int?countAssignAmmo = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (countAssignAmmo == null) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("countAssignAmmo: " + countAssignAmmo); AssignmentOfAmmo = new List <MyMwcObjectBuilder_AssignmentOfAmmo>(countAssignAmmo.Value); for (int i = 0; i < countAssignAmmo; i++) { MyMwcObjectBuilder_AssignmentOfAmmo newAssignAmmo = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_AssignmentOfAmmo; if (newAssignAmmo == null) { return(NetworkError()); } if (newAssignAmmo.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } AssignmentOfAmmo.Add(newAssignAmmo); } // Engine bool?isEngine = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isEngine == null) { return(NetworkError()); } if (isEngine.Value) { Engine = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_SmallShip_Engine; if (Engine == null) { return(NetworkError()); } if (Engine.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } } else { Engine = null; } // Armor bool?isArmor = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isArmor == null) { return(NetworkError()); } if (isArmor.Value) { Armor = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_SmallShip_Armor; if (Armor == null) { return(NetworkError()); } if (Armor.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } } else { Armor = null; } // Radar bool?isRadar = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isRadar == null) { return(NetworkError()); } if (isRadar.Value) { Radar = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_SmallShip_Radar; if (Radar == null) { return(NetworkError()); } if (Radar.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } } else { Radar = null; } bool?hasMaxHealth = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!hasMaxHealth.HasValue) { return(NetworkError()); } if (hasMaxHealth.Value) { // Ship max health float?shipMaxHealth = MyMwcMessageIn.ReadFloat(binaryReader); if (shipMaxHealth == null) { return(NetworkError()); } ShipMaxHealth = shipMaxHealth.Value; MyMwcLog.IfNetVerbose_AddToLog("ShipMaxHealth: " + ShipMaxHealth.Value); if (float.IsNaN(ShipMaxHealth.Value) || float.IsInfinity(ShipMaxHealth.Value)) { System.Diagnostics.Debug.Fail("ShipMaxHealth is: " + ShipMaxHealth.Value); ShipMaxHealth = null; // MyGameplayConstants.MAX_HEALTH_MAX; } } else { MyMwcLog.IfNetVerbose_AddToLog("ShipMaxHealth is: null"); ShipMaxHealth = null; } // Ship health ratio float?shipHealthRatio = MyMwcMessageIn.ReadFloat(binaryReader); if (shipHealthRatio == null) { return(NetworkError()); } ShipHealthRatio = shipHealthRatio.Value; MyMwcLog.IfNetVerbose_AddToLog("ShipHealthRatio: " + ShipHealthRatio); // Armor health float?armorHealth = MyMwcMessageIn.ReadFloat(binaryReader); if (armorHealth == null) { return(NetworkError()); } ArmorHealth = armorHealth.Value; MyMwcLog.IfNetVerbose_AddToLog("ArmorHealth: " + ArmorHealth); // Oxygen float?oxygen = MyMwcMessageIn.ReadFloat(binaryReader); if (oxygen == null) { return(NetworkError()); } Oxygen = oxygen.Value; MyMwcLog.IfNetVerbose_AddToLog("Oxygen: " + Oxygen); // Fuel float?fuel = MyMwcMessageIn.ReadFloat(binaryReader); if (fuel == null) { return(NetworkError()); } Fuel = fuel.Value; MyMwcLog.IfNetVerbose_AddToLog("Fuel: " + Fuel); // Reflector light bool?reflectorLight = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (reflectorLight == null) { return(NetworkError()); } ReflectorLight = reflectorLight.Value; MyMwcLog.IfNetVerbose_AddToLog("ReflectorLight: " + ReflectorLight); // Reflector long range bool?reflectorLongRange = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (reflectorLongRange == null) { return(NetworkError()); } ReflectorLongRange = reflectorLongRange.Value; MyMwcLog.IfNetVerbose_AddToLog("ReflectorLongRange: " + ReflectorLongRange); // ReflectorShadowDistance float?reflectorShadowDistance = MyMwcMessageIn.ReadFloat(binaryReader); if (reflectorShadowDistance == null) { return(NetworkError()); } ReflectorShadowDistance = reflectorShadowDistance.Value; MyMwcLog.IfNetVerbose_AddToLog("ReflectorShadowDistance: " + ReflectorShadowDistance); // AI Priority int?aiPriority = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (aiPriority == null) { return(NetworkError()); } AIPriority = aiPriority.Value; MyMwcLog.IfNetVerbose_AddToLog("AIPriority: " + AIPriority); return(true); }
/// <summary> /// Creates new instance of ammo assignment /// </summary> /// <param name="assignmentOfAmmo">Assignment of ammo object builder</param> public MyAmmoAssignment(MyMwcObjectBuilder_AssignmentOfAmmo assignmentOfAmmo) : this(assignmentOfAmmo.FireKey, assignmentOfAmmo.Group, assignmentOfAmmo.AmmoType) { }