public void loadProperties(ArkArchive archive, GameObject next, long propertiesBlockOffset, int?nextGameObjectPropertiesOffset = null) { var offset = propertiesBlockOffset + _propertiesOffset; var nextOffset = nextGameObjectPropertiesOffset != null ? propertiesBlockOffset + nextGameObjectPropertiesOffset.Value : (next != null) ? propertiesBlockOffset + next._propertiesOffset : archive.Size - 1; archive.Position = offset; properties.Clear(); try { var property = PropertyRegistry.readProperty(archive, null); while (property != null) { if (property != ExcludedProperty.Instance) { properties.Add(_arkNameCache.Create(property.Name.Token, property.Index), property); } property = PropertyRegistry.readProperty(archive, archive.ExclusivePropertyNameTree); } } catch (UnreadablePropertyException) { // Stop reading and ignore possible extra data for now, needs a new field in ExtraDataHandler return; } finally { //these are in order of most common to least common to keep lookups at a minimum if (Properties.ContainsKey(_ownerName) || Properties.ContainsKey(_bHasResetDecayTime) || ClassName.Name == "CherufeNest_C") { if (ClassName.Token.StartsWith("DeathItemCache_")) { _isFlags |= GameObjectIs.IsDeathItemCache; goto SkipRest; } _isFlags |= GameObjectIs.IsStructure; goto SkipRest; } if (Properties.ContainsKey(_dinoId1)) { _isFlags |= GameObjectIs.IsCreature; } int tamingTeamID = 0; int targetingTeamId = 0; if (IsCreature) { if (Properties.ContainsKey(_tamingTeamID)) { PropertyInt32 tamingTeam = (PropertyInt32)Properties[_tamingTeamID]; tamingTeamID = tamingTeam.Value.GetValueOrDefault(0); } if (Properties.ContainsKey(_targetTeamID)) { PropertyInt32 targetingTeam = (PropertyInt32)Properties[_targetTeamID]; targetingTeamId = targetingTeam.Value.GetValueOrDefault(0); } if (targetingTeamId > 1000000000) { if ((tamingTeamID > 0 && tamingTeamID < 1000000000) & !Properties.ContainsKey(_imprinterName)) { } else { _isFlags |= GameObjectIs.IsTamedCreature; } } } if (IsCreature && !IsTamedCreature) { _isFlags |= GameObjectIs.IsWildCreature; } if (IsTamedCreature && (ClassName.Equals(_raft_bp_c) || ClassName.Equals(_motorraft_bp_c))) { _isFlags |= GameObjectIs.IsRaftCreature; } if (Properties.ContainsKey(_currentStatusValues)) { _isFlags |= GameObjectIs.IsStatusComponent; } if (IsStatusComponent && ClassName.Token.StartsWith("DinoCharacterStatusComponent_")) { _isFlags |= GameObjectIs.IsDinoStatusComponent; } if (IsStatusComponent && !IsDinoStatusComponent && ClassName.Token.StartsWith("PlayerCharacterStatusComponent_")) { _isFlags |= GameObjectIs.IsPlayerCharacterStatusComponent; } if (ClassName.Token.StartsWith("DroppedItemGeneric_") & !ClassName.Name.Contains("NoPhysics")) { if (Properties.ContainsKey(_droppedByPlayerId)) { PropertyInt64 selectedPlayerId = (PropertyInt64)Properties[_droppedByPlayerId]; if (selectedPlayerId.Value != 0) { _isFlags |= GameObjectIs.IsDroppedItem; } } } if (IsItem) { goto SkipRest; } if (IsCreature) { goto SkipRest; } if (IsStatusComponent) { goto SkipRest; } if (Properties.ContainsKey(_bInitializedMe)) { _isFlags |= GameObjectIs.IsInventory; } if (IsInventory && ClassName.Token.StartsWith("PrimalInventoryBP_")) { _isFlags |= GameObjectIs.IsStructureInventory; } if (IsInventory && !IsStructureInventory && ClassName.Token.StartsWith("DinoTamedInventoryComponent_")) { _isFlags |= GameObjectIs.IsTamedCreatureInventory; } if (IsInventory && !(IsStructureInventory || IsTamedCreatureInventory) && ClassName.Token.StartsWith("PrimalInventoryComponent")) { _isFlags |= GameObjectIs.IsPlayerCharacterInventory; } if (IsInventory && !(IsStructureInventory || IsTamedCreatureInventory || IsPlayerCharacterInventory) && ClassName.Token.StartsWith("DinoWildInventoryComponent_")) { _isFlags |= GameObjectIs.IsWildCreatureInventory; } if (IsInventory) { goto SkipRest; } if (ClassName.Equals(_structurePaintingComponent)) { _isFlags |= GameObjectIs.IsStructurePaintingComponent; goto SkipRest; } if (ClassName.Equals(_droppedItem)) { _isFlags |= GameObjectIs.IsDroppedItem; goto SkipRest; } if (ClassName.Equals(_male) || ClassName.Equals(_female)) { _isFlags |= GameObjectIs.IsPlayerCharacter; goto SkipRest; } _isFlags |= GameObjectIs.IsSomethingElse; //IsStructure = (Properties.ContainsKey(_ownerName) || Properties.ContainsKey(_bHasResetDecayTime)); //if (IsStructure) goto SkipRest; //IsCreature = Properties.ContainsKey(_dinoId1); //IsTamedCreature = IsCreature && (Properties.ContainsKey(_tamerString) || Properties.ContainsKey(_tamingTeamID)); //IsWildCreature = IsCreature && !IsTamedCreature; //IsRaftCreature = IsTamedCreature && ClassName.Equals(_raft_bp_c); //if (IsCreature) goto SkipRest; //IsStatusComponent = Properties.ContainsKey(_currentStatusValues); //IsDinoStatusComponent = IsStatusComponent && ClassName.Token.StartsWith("DinoCharacterStatusComponent_"); //IsPlayerCharacterStatusComponent = IsStatusComponent && !IsDinoStatusComponent && ClassName.Token.StartsWith("PlayerCharacterStatusComponent_"); //if (IsStatusComponent) goto SkipRest; //IsInventory = Properties.ContainsKey(_bInitializedMe); //IsStructureInventory = IsInventory && ClassName.Token.StartsWith("PrimalInventoryBP_"); //IsTamedCreatureInventory = IsInventory && !IsStructureInventory && ClassName.Token.StartsWith("DinoTamedInventoryComponent_"); //IsPlayerCharacterInventory = IsInventory && !(IsStructureInventory || IsTamedCreatureInventory) && ClassName.Token.StartsWith("PrimalInventoryComponent"); //IsWildCreatureInventory = IsInventory && !(IsStructureInventory || IsTamedCreatureInventory || IsPlayerCharacterInventory) && ClassName.Token.StartsWith("DinoWildInventoryComponent_"); //if (IsInventory) goto SkipRest; //IsStructurePaintingComponent = ClassName.Equals(_structurePaintingComponent); //if (IsStructurePaintingComponent) goto SkipRest; //IsDroppedItem = ClassName.Equals(_droppedItem); //if (IsDroppedItem) goto SkipRest; //IsPlayerCharacter = ClassName.Equals(_male) || ClassName.Equals(_female); //if (IsPlayerCharacter) goto SkipRest; //IsSomethingElse = true; SkipRest :; } var distance = nextOffset - archive.Position; if (distance > 0) { ExtraData = ExtraDataRegistry.getExtraData(this, archive, distance); } else { ExtraData = null; } }
public void loadProperties(ArkArchive archive, GameObject next, long propertiesBlockOffset, int?nextGameObjectPropertiesOffset = null) { var offset = propertiesBlockOffset + _propertiesOffset; var nextOffset = nextGameObjectPropertiesOffset != null ? propertiesBlockOffset + nextGameObjectPropertiesOffset.Value : (next != null) ? propertiesBlockOffset + next._propertiesOffset : archive.Size - 1; archive.Position = offset; properties.Clear(); try { var property = PropertyRegistry.readProperty(archive); while (property != null) { properties.Add(_arkNameCache.Create(property.Name.Token, property.Index), property); property = PropertyRegistry.readProperty(archive); } } catch (UnreadablePropertyException) { // Stop reading and ignore possible extra data for now, needs a new field in ExtraDataHandler return; } finally { //these are in order of most common to least common to keep lookups at a minimum if (IsItem) { goto SkipRest; } IsStructure = (Properties.ContainsKey(_ownerName) || Properties.ContainsKey(_bHasResetDecayTime)); if (IsStructure) { goto SkipRest; } IsCreature = Properties.ContainsKey(_dinoId1); IsTamedCreature = IsCreature && (Properties.ContainsKey(_tamerString) || Properties.ContainsKey(_tamingTeamID)); IsWildCreature = IsCreature && !IsTamedCreature; IsRaftCreature = IsTamedCreature && ClassName.Equals(_raft_bp_c); if (IsCreature) { goto SkipRest; } IsStatusComponent = Properties.ContainsKey(_currentStatusValues); IsDinoStatusComponent = IsStatusComponent && ClassName.Token.StartsWith("DinoCharacterStatusComponent_"); IsPlayerCharacterStatusComponent = IsStatusComponent && !IsDinoStatusComponent && ClassName.Token.StartsWith("PlayerCharacterStatusComponent_"); if (IsStatusComponent) { goto SkipRest; } IsInventory = Properties.ContainsKey(_bInitializedMe); IsStructureInventory = IsInventory && ClassName.Token.StartsWith("PrimalInventoryBP_"); IsTamedCreatureInventory = IsInventory && !IsStructureInventory && ClassName.Token.StartsWith("DinoTamedInventoryComponent_"); IsPlayerCharacterInventory = IsInventory && !(IsStructureInventory || IsTamedCreatureInventory) && ClassName.Token.StartsWith("PrimalInventoryComponent"); IsWildCreatureInventory = IsInventory && !(IsStructureInventory || IsTamedCreatureInventory || IsPlayerCharacterInventory) && ClassName.Token.StartsWith("DinoWildInventoryComponent_"); if (IsInventory) { goto SkipRest; } IsStructurePaintingComponent = ClassName.Equals(_structurePaintingComponent); if (IsStructurePaintingComponent) { goto SkipRest; } IsDroppedItem = ClassName.Equals(_droppedItem); if (IsDroppedItem) { goto SkipRest; } IsPlayerCharacter = ClassName.Equals(_male) || ClassName.Equals(_female); if (IsPlayerCharacter) { goto SkipRest; } IsSomethingElse = true; SkipRest :; } var distance = nextOffset - archive.Position; if (distance > 0) { ExtraData = ExtraDataRegistry.getExtraData(this, archive, distance); } else { ExtraData = null; } }