protected virtual void SetItemValue(MyDefinitionId id, decimal value) { var definition = _definitionManager.GetDefinition(id); if (definition.Id.TypeId.IsNull || string.IsNullOrEmpty(definition.Id.SubtypeName)) { return; // Skip this entry. It's useless. } if (String.IsNullOrEmpty(definition.DisplayNameText)) { return; // Skip this entry. No friendly name. } _definitionResolver.Register(definition.DisplayNameText, id); var industryTypes = new ConcurrentDictionary <IndustryTypeEnum, MarketAffinity>(); var subtype = id.SubtypeId.ToString(); if (subtype.StartsWith("Industrial_", StringComparison.InvariantCultureIgnoreCase)) { industryTypes[IndustryTypeEnum.Military] = MarketAffinity.Sell; industryTypes[IndustryTypeEnum.Industrial] = MarketAffinity.Buy; } else if (definition is MyAmmoMagazineDefinition) { industryTypes[IndustryTypeEnum.Military] = MarketAffinity.AmbivalentSell; } else if (subtype.StartsWith("Research_", StringComparison.InvariantCultureIgnoreCase)) { industryTypes[IndustryTypeEnum.Research] = MarketAffinity.Sell; industryTypes[IndustryTypeEnum.Military] = MarketAffinity.Buy; } else if (id.TypeId.ToString() .Equals("MyObjectBuilder_Ore", StringComparison.InvariantCultureIgnoreCase)) { industryTypes[IndustryTypeEnum.Industrial] = MarketAffinity.AmbivalentBuy; } else if (id.TypeId.ToString() .Equals("MyObjectBuilder_Ingot", StringComparison.InvariantCultureIgnoreCase)) { industryTypes[IndustryTypeEnum.Industrial] = MarketAffinity.Sell; industryTypes[IndustryTypeEnum.Consumer] = MarketAffinity.Buy; } else if (id.TypeId.ToString() .Equals("MyObjectBuilder_Component", StringComparison.InvariantCultureIgnoreCase)) { industryTypes[IndustryTypeEnum.Consumer] = MarketAffinity.Sell; industryTypes[IndustryTypeEnum.Research] = MarketAffinity.Buy; } _itemValues[id] = new MarketValueItem(definition, value, industryTypes); }