// Read this object from message-in internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } // TemplateId bool?isTemplateId = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isTemplateId == null) { return(NetworkError()); } if (isTemplateId.Value) { TemplateId = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); } else { TemplateId = null; } // Container Type MyMwcObjectBuilder_PrefabContainer_TypesEnum?containerType = MyMwcMessageIn.ReadObjectBuilderPrefabContainerTypesEnumEx(binaryReader, senderEndPoint); if (containerType == null) { return(NetworkError()); } ContainerType = containerType.Value; MyMwcLog.IfNetVerbose_AddToLog("ContainerType: " + ContainerType); // Faction Faction = (MyMwcObjectBuilder_FactionEnum)MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); // Faction must be defined System.Diagnostics.Debug.Assert(Enum.IsDefined(typeof(MyMwcObjectBuilder_FactionEnum), Faction)); // Prefabs int?countPrefabs = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (countPrefabs == null) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("countPrefabs: " + countPrefabs); Prefabs = new List <MyMwcObjectBuilder_PrefabBase>(countPrefabs.Value); for (int i = 0; i < countPrefabs; i++) { MyMwcObjectBuilder_PrefabBase prefab = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_PrefabBase; if (prefab == null) { return(NetworkError()); } if (prefab.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } Prefabs.Add(prefab); } // Inventory bool?isInventory = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isInventory == null) { return(NetworkError()); } if (isInventory.Value) { Inventory = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_Inventory; if (Inventory == null) { return(NetworkError()); } if (Inventory.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } } else { Inventory = null; } bool?hasDisplayName = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!hasDisplayName.HasValue) { return(NetworkError()); } if (hasDisplayName.Value) { string displayName = MyMwcMessageIn.ReadStringEx(binaryReader, senderEndPoint); if (displayName == null) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("DisplayName: " + displayName); DisplayName = displayName; } else { MyMwcLog.IfNetVerbose_AddToLog("DisplayName: " + "null"); DisplayName = null; } // Use Properties bool?hasUseProperties = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (hasUseProperties == null) { return(NetworkError()); } if (hasUseProperties.Value) { UseProperties = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_EntityUseProperties; if (UseProperties == null) { return(NetworkError()); } if (UseProperties.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } } else { UseProperties = null; } // Alarm On bool?alarmOn = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (alarmOn == null) { return(NetworkError()); } AlarmOn = alarmOn.Value; MyMwcLog.IfNetVerbose_AddToLog("AlarmOn: " + AlarmOn); // Refill time bool?refillTime = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (refillTime == null) { return(NetworkError()); } if (refillTime.Value) { RefillTime = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); } else { RefillTime = null; } return(true); }
private bool Read_01085000(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { // PrefabType int?prefabObjectBuilderId = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (prefabObjectBuilderId == null) { return(NetworkError()); } PrefabObjectBuilderId = prefabObjectBuilderId.Value; MyMwcLog.IfNetVerbose_AddToLog("PrefabObjectBuilderId: " + PrefabObjectBuilderId); // PositionInContainer MyMwcVector3Short?positionInContainer = MyMwcMessageIn.ReadVector3ShortEx(binaryReader, senderEndPoint); if (positionInContainer == null) { return(NetworkError()); } PositionInContainer = positionInContainer.Value; MyMwcLog.IfNetVerbose_AddToLog("PositionInContainer: " + PositionInContainer); // AnglesInContainer Vector3?anglesInContainer = MyMwcMessageIn.ReadVector3FloatEx(binaryReader, senderEndPoint); if (anglesInContainer == null) { return(NetworkError()); } AnglesInContainer = anglesInContainer.Value; MyMwcLog.IfNetVerbose_AddToLog("AnglesInContainer: " + AnglesInContainer.ToString()); bool?hasMaxHealth = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!hasMaxHealth.HasValue) { return(NetworkError()); } if (hasMaxHealth.Value) { // PrefabMaxHealth float?prefabMaxHealth = MyMwcMessageIn.ReadFloat(binaryReader); if (prefabMaxHealth == null) { return(NetworkError()); } PrefabMaxHealth = prefabMaxHealth.Value; MyMwcLog.IfNetVerbose_AddToLog("PrefabMaxHealth: " + PrefabMaxHealth.Value.ToString()); if (float.IsNaN(PrefabMaxHealth.Value) || float.IsInfinity(PrefabMaxHealth.Value)) { System.Diagnostics.Debug.Fail("PrefabMaxHealth is: " + PrefabMaxHealth.Value); PrefabMaxHealth = null; // MyGameplayConstants.MAX_HEALTH_MAX; } } else { MyMwcLog.IfNetVerbose_AddToLog("PrefabMaxHealth is: null"); PrefabMaxHealth = null; } // PrefabHealthRatio float?prefabHealthRatio = MyMwcMessageIn.ReadFloat(binaryReader); if (prefabHealthRatio == null) { return(NetworkError()); } PrefabHealthRatio = prefabHealthRatio.Value; MyMwcLog.IfNetVerbose_AddToLog("PrefabHealth: " + PrefabHealthRatio.ToString()); bool?hasDisplayName = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!hasDisplayName.HasValue) { return(NetworkError()); } if (hasDisplayName.Value) { string displayName = MyMwcMessageIn.ReadStringEx(binaryReader, senderEndPoint); if (displayName == null) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("DisplayName: " + displayName); DisplayName = displayName; } else { MyMwcLog.IfNetVerbose_AddToLog("DisplayName: " + "null"); DisplayName = null; } // faction appearance (texture set) short?factionAppearance = MyMwcMessageIn.ReadInt16Ex(binaryReader, senderEndPoint); if (!factionAppearance.HasValue) { return(NetworkError()); } FactionAppearance = (MyMwcObjectBuilder_Prefab_AppearanceEnum)factionAppearance.Value; MyMwcLog.IfNetVerbose_AddToLog("FactionAppearance: " + FactionAppearance); // Use Properties bool?hasUseProperties = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (hasUseProperties == null) { return(NetworkError()); } if (hasUseProperties.Value) { UseProperties = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_EntityUseProperties; if (UseProperties == null) { return(NetworkError()); } if (UseProperties.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } } else { UseProperties = null; } // Causes Alarm bool?hasCausesAlarm = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!hasCausesAlarm.HasValue) { return(NetworkError()); } if (hasCausesAlarm.Value) { bool?causesAlarm = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!causesAlarm.HasValue) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("CausesAlarm: " + CausesAlarm); CausesAlarm = causesAlarm.Value; } else { MyMwcLog.IfNetVerbose_AddToLog("CausesAlarm: " + "null"); CausesAlarm = null; } // Requires Energy bool?hasRequiresEnergy = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!hasRequiresEnergy.HasValue) { return(NetworkError()); } if (hasRequiresEnergy.Value) { bool?requiresEnergy = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!requiresEnergy.HasValue) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("RequiresEnergy: " + RequiresEnergy); RequiresEnergy = requiresEnergy.Value; } else { MyMwcLog.IfNetVerbose_AddToLog("RequiresEnergy: " + "null"); RequiresEnergy = null; } // Display HUD bool?hasDisplayHud = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!hasDisplayHud.HasValue) { return(NetworkError()); } if (hasDisplayHud.Value) { bool?displayHud = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!displayHud.HasValue) { return(NetworkError()); } if (displayHud.Value) { PersistentFlags |= MyPersistentEntityFlags.DisplayOnHud; } else { PersistentFlags &= ~MyPersistentEntityFlags.DisplayOnHud; } MyMwcLog.IfNetVerbose_AddToLog("DisplayHud: " + displayHud.Value); } else { MyMwcLog.IfNetVerbose_AddToLog("DisplayHud: " + "null"); } // AI Priority int?aiPriority = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (aiPriority == null) { return(NetworkError()); } AIPriority = aiPriority.Value; MyMwcLog.IfNetVerbose_AddToLog("AIPriority: " + AIPriority); return(true); }