예제 #1
0
파일: Items.cs 프로젝트: RapidFiring/evemon
        /// <summary>
        /// Add properties to an item.
        /// </summary>
        /// <param name="srcItem"></param>
        /// <param name="groupItems"></param>
        /// <returns></returns>
        private static void CreateItem(InvTypes srcItem, ICollection<SerializableItem> groupItems)
        {
            Util.UpdatePercentDone(Database.ItemsTotalCount);

            srcItem.Generated = true;

            InvGroups itemGroup = Database.InvGroupsTable[srcItem.GroupID];

            // Creates the item with base informations
            SerializableItem item = new SerializableItem
            {
                ID = srcItem.ID,
                Name = srcItem.Name,
                Description = srcItem.Description ?? String.Empty,
                Icon = srcItem.IconID.HasValue
                    ? Database.EveIconsTable[srcItem.IconID.Value].Icon
                    : String.Empty,
                PortionSize = srcItem.PortionSize,
                MetaGroup = ItemMetaGroup.None,
                Group = itemGroup.Name,
                Category = Database.InvCategoriesTable[itemGroup.CategoryID].Name,
                Race = (Race)Enum.ToObject(typeof(Race), srcItem.RaceID ?? 0)
            };

            // Set race to Faction if item race is Jovian or belongs to a Faction market group
            if (item.Race == Race.Jove ||
                Database.InvMarketGroupsTable.Any(group => srcItem.MarketGroupID == group.ID
                                                           && (DBConstants.FactionMarketGroupIDs.Any(id => id == group.ID) ||
                                                               DBConstants.FactionMarketGroupIDs.Any(id => id == group.ParentID))))
            {
                item.Race = Race.Faction;
            }

            // Add traits
            AddTraits(srcItem, item);

            // Add the properties and prereqs
            AddItemPropsAndPrereq(srcItem, item);

            // Metagroup
            AddMetaGroup(srcItem, item);

            // Look for slots
            if (Database.DgmTypeEffectsTable.Contains(srcItem.ID, 0, DBConstants.LowSlotEffectID))
                item.Slot = ItemSlot.Low;
            else if (Database.DgmTypeEffectsTable.Contains(srcItem.ID, 0, DBConstants.MedSlotEffectID))
                item.Slot = ItemSlot.Medium;
            else if (Database.DgmTypeEffectsTable.Contains(srcItem.ID, 0, DBConstants.HiSlotEffectID))
                item.Slot = ItemSlot.High;
            else
                item.Slot = ItemSlot.NoSlot;

            // Add reaction info for reactions
            if (Database.InvGroupsTable[srcItem.GroupID].CategoryID == DBConstants.ReactionCategoryID)
                AddReactionInfo(srcItem, item);

            // Add fuel info for control towers
            if (srcItem.GroupID == DBConstants.ControlTowerGroupID)
                AddControlTowerFuelInfo(srcItem, item);

            // Add this item
            groupItems.Add(item);

            // If the current item isn't in a market group then we are done
            if (srcItem.MarketGroupID == DBConstants.RootNonMarketGroupID)
                return;

            // Look for variations which are not in any market group
            foreach (InvTypes srcVariationItem in Database.InvMetaTypesTable.Where(x => x.ParentItemID == srcItem.ID).Select(
                variation => Database.InvTypesTable[variation.ItemID]).Where(
                    srcVariationItem => srcVariationItem.Published &&
                                        srcVariationItem.MarketGroupID == DBConstants.RootNonMarketGroupID))
            {
                srcVariationItem.RaceID = (int)Race.Faction;
                CreateItem(srcVariationItem, groupItems);
            }
        }
예제 #2
0
파일: Items.cs 프로젝트: RapidFiring/evemon
        /// <summary>
        /// Adds the traits.
        /// </summary>
        /// <param name="srcItem">The source item.</param>
        /// <param name="item">The item.</param>
        private static void AddTraits(InvTypes srcItem, SerializableItem item)
        {
            if (Database.InvGroupsTable[srcItem.GroupID].CategoryID != DBConstants.ShipCategoryID)
                return;

            string skillBonusesText = String.Empty;
            string roleBonusesText = String.Empty;
            string miscBonusesText = String.Empty;

            // Find the skill bonuses
            foreach (IGrouping<int, DgmTypeTraits> bonuses in Database.DgmTypeTraitsTable
                .Where(x => x.ItemID == srcItem.ID && x.ParentItemID > 0)
                .GroupBy(x => x.ParentItemID))
            {
                skillBonusesText += $"{Database.InvTypesTable[bonuses.Key].Name} bonuses (per skill level):{Environment.NewLine}";

                foreach (DgmTypeTraits bonus in bonuses)
                {
                    DgmTraits trait = Database.DgmTraitsTable[bonus.TraitID];

                    skillBonusesText += $"{(bonus.Bonus.HasValue ? bonus.Bonus.ToString() : String.Empty)}" +
                                        $"{(trait.UnitID.HasValue ? Database.EveUnitsTable[trait.UnitID.Value].DisplayName : String.Empty)} " +
                                        $"{Database.DgmTraitsTable[trait.ID].BonusText}{Environment.NewLine}"
                                            .TrimStart();
                }
                skillBonusesText += Environment.NewLine;
            }

            // Find the role bonuses
            foreach (IGrouping<int, DgmTypeTraits> bonuses in Database.DgmTypeTraitsTable
                .Where(x => x.ItemID == srcItem.ID && x.ParentItemID == -1)
                .GroupBy(x => x.ParentItemID))
            {
                roleBonusesText += $"Role bonus:{Environment.NewLine}";

                foreach (DgmTypeTraits bonus in bonuses)
                {
                    DgmTraits trait = Database.DgmTraitsTable[bonus.TraitID];

                    roleBonusesText += $"{(bonus.Bonus.HasValue ? bonus.Bonus.ToString() : String.Empty)}" +
                                       $"{(trait.UnitID.HasValue ? Database.EveUnitsTable[trait.UnitID.Value].DisplayName : String.Empty)} " +
                                       $"{Database.DgmTraitsTable[trait.ID].BonusText}{Environment.NewLine}"
                                           .TrimStart();
                }
            }

            // Find the misc bonuses
            foreach (IGrouping<int, DgmTypeTraits> bonuses in Database.DgmTypeTraitsTable
                .Where(x => x.ItemID == srcItem.ID && x.ParentItemID == -2)
                .GroupBy(x => x.ParentItemID))
            {
                miscBonusesText += $"Misc bonus:{Environment.NewLine}";

                foreach (DgmTypeTraits bonus in bonuses)
                {
                    DgmTraits trait = Database.DgmTraitsTable[bonus.TraitID];

                    miscBonusesText += $"{(bonus.Bonus.HasValue ? bonus.Bonus.ToString() : String.Empty)}" +
                                       $"{(trait.UnitID.HasValue ? Database.EveUnitsTable[trait.UnitID.Value].DisplayName : String.Empty)} " +
                                       $"{Database.DgmTraitsTable[trait.ID].BonusText}{Environment.NewLine}"
                                           .TrimStart();
                }
            }

            // Skip if no bonuses
            if (String.IsNullOrWhiteSpace(skillBonusesText) && String.IsNullOrWhiteSpace(roleBonusesText) &&
                String.IsNullOrWhiteSpace(miscBonusesText))
            {
                return;
            }

            StringBuilder sb = new StringBuilder();
            sb.AppendLine().AppendLine();
            sb.AppendLine("Traits");
            sb.Append(skillBonusesText);
            sb.Append(roleBonusesText);
            sb.Append(miscBonusesText);

            // Add to item description
            item.Description += sb.ToString();
        }
예제 #3
0
파일: Items.cs 프로젝트: RapidFiring/evemon
        /// <summary>
        /// Completes the item properties addition.
        /// </summary>
        /// <param name="srcItem">The SRC item.</param>
        /// <param name="props">The props.</param>
        private static void CompleteItemPropertiesAddition(InvTypes srcItem, ICollection<SerializablePropertyValue> props)
        {
            // Ensures there is a mass and add it to prop
            if (Math.Abs(srcItem.Mass) > double.Epsilon)
            {
                props.Add(new SerializablePropertyValue
                {
                    ID = DBConstants.MassPropertyID,
                    Value = srcItem.Mass.ToString(CultureConstants.InvariantCulture)
                });
            }

            // Ensures there is a cargo capacity and add it to prop
            if (Math.Abs(srcItem.Capacity) > double.Epsilon)
            {
                props.Add(new SerializablePropertyValue
                {
                    ID = DBConstants.CargoCapacityPropertyID,
                    Value = srcItem.Capacity.ToString(CultureConstants.InvariantCulture)
                });
            }

            // Ensures there is a volume and add it to prop
            if (Math.Abs(srcItem.Volume) > double.Epsilon)
            {
                props.Add(new SerializablePropertyValue
                {
                    ID = DBConstants.VolumePropertyID,
                    Value = srcItem.Volume.ToString(CultureConstants.InvariantCulture)
                });
            }

            // Add unit to refine prop where applicable
            if (Database.InvGroupsTable[srcItem.GroupID].CategoryID == DBConstants.AsteroidCategoryID)
            {
                props.Add(new SerializablePropertyValue
                {
                    ID = Properties.UnitsToRefinePropertyID,
                    Value = srcItem.PortionSize.ToString(CultureInfo.InvariantCulture)
                });
            }

            // Add base price as a prop
            props.Add(new SerializablePropertyValue
            {
                ID = Properties.BasePricePropertyID,
                Value = srcItem.BasePrice.FormatDecimal()
            });
        }
예제 #4
0
        /// <summary>
        /// Sets the market group.
        /// </summary>
        /// <param name="item">The item.</param>
        private static void SetMarketGroupManually(InvTypes item)
        {
            switch (item.ID)
            {
                case DBConstants.WildMinerIBlueprintID:
                case DBConstants.AlphaDataAnalyzerIBlueprintID:
                case DBConstants.DaemonDataAnalyzerIBlueprintID:
                case DBConstants.CodexDataAnalyzerIBlueprintID:
                case DBConstants.CropGasCloudHarvesterBlueprintID:
                case DBConstants.Dual1000mmScoutIAcceleratorCannonBlueprintID:
                case DBConstants.HabitatMinerIBlueprintID:
                case DBConstants.LibramDataAnalyzerIBlueprintID:
                case DBConstants.LimosCitadelCruiseLauncherIBlueprintID:
                case DBConstants.MagpieMobileTractorUnitBlueprintID:
                case DBConstants.PackratMobileTractorUnitBlueprintID:
                case DBConstants.PlowGascloudHarvesterBlueprintID:
                case DBConstants.ShockLimosCitadelTorpedoBayIBlueprintID:
                case DBConstants.WetuMobileDepotBlueprintID:
                case DBConstants.YurtMobileDepotBlueprintID:
                    item.MarketGroupID = DBConstants.BlueprintStorylineNonMarketGroupID;
                    break;

                case DBConstants.AsteroBlueprintID:
                case DBConstants.BarghestBlueprintID:
                case DBConstants.CambionBlueprintID:
                case DBConstants.ChremoasBlueprintID:
                case DBConstants.EtanaBlueprintID:
                case DBConstants.GarmurBlueprintID:
                case DBConstants.MaliceBlueprintID:
                case DBConstants.MorachaBlueprintID:
                case DBConstants.NestorBlueprintID:
                case DBConstants.OrthrusBlueprintID:
                case DBConstants.PolicePursuitCometBlueprintID:
                case DBConstants.ScorpionIshukoneWatchBlueprintID:
                case DBConstants.ShadowBlueprintID:
                case DBConstants.StratiosBlueprintID:
                case DBConstants.StratiosEmergencyResponderBlueprintID:
                case DBConstants.UtuBlueprintID:
                case DBConstants.VangelBlueprintID:
                case DBConstants.WhiptailBlueprintID:
                case DBConstants.AdrestiaBlueprintID:
                case DBConstants.EchelonBlueprintID:
                case DBConstants.ImperialNavySlicerBlueprintID:
                case DBConstants.CaldariNavyHookbillBlueprintID:
                case DBConstants.FederationNavyCometBlueprintID:
                case DBConstants.RepublicFleetFiretailBlueprintID:
                case DBConstants.NightmareBlueprintID:
                case DBConstants.MacharielBlueprintID:
                case DBConstants.DramielBlueprintID:
                case DBConstants.CruorBlueprintID:
                case DBConstants.SuccubusBlueprintID:
                case DBConstants.DaredevilBlueprintID:
                case DBConstants.CynabalBlueprintID:
                case DBConstants.AshimmuBlueprintID:
                case DBConstants.PhantasmBlueprintID:
                case DBConstants.GorusShuttleBlueprintID:
                case DBConstants.GuristasShuttleBlueprintID:
                case DBConstants.GallenteMiningLaserBlueprintID:
                case DBConstants.InterbusShuttleBlueprintID:
                case DBConstants.FrekiBlueprintID:
                case DBConstants.MimirBlueprintID:
                    item.MarketGroupID = DBConstants.BlueprintFactionNonMarketGroupID;
                    break;

                case DBConstants.BladeBlueprintID:
                case DBConstants.BlazeLBlueprintID:
                case DBConstants.BlazeMBlueprintID:
                case DBConstants.BlazeSBlueprintID:
                case DBConstants.BoltLBlueprintID:
                case DBConstants.BoltMBlueprintID:
                case DBConstants.BoltSBlueprintID:
                case DBConstants.CapitalRemoteCapacitorTransmitterIIBlueprintID:
                case DBConstants.CapitalRemoteShieldBoosterIIBlueprintID:
                case DBConstants.ChameleonBlueprintID:
                case DBConstants.DaggerBlueprintID:
                case DBConstants.DesolationLBlueprintID:
                case DBConstants.DesolationMBlueprintID:
                case DBConstants.DesolationSBlueprintID:
                case DBConstants.DroneDamageRigIIBlueprintID:
                case DBConstants.ErinyeBlueprintID:
                case DBConstants.GathererBlueprintID:
                case DBConstants.HighGradeAscendancyAlphaBlueprintID:
                case DBConstants.HighGradeAscendancyBetaBlueprintID:
                case DBConstants.HighGradeAscendancyGammaBlueprintID:
                case DBConstants.HighGradeAscendancyDeltaBlueprintID:
                case DBConstants.HighGradeAscendancyEpsilonBlueprintID:
                case DBConstants.HighGradeAscendancyOmegaBlueprintID:
                case DBConstants.KisharBlueprintID:
                case DBConstants.LuxLBlueprintID:
                case DBConstants.LuxMBlueprintID:
                case DBConstants.LuxSBlueprintID:
                case DBConstants.MackinawOREDevelopmentEditionBlueprintID:
                case DBConstants.MediumEWDroneRangeAugmentorIIBlueprintID:
                case DBConstants.MidGradeAscenancyAlphaBlueprintID:
                case DBConstants.MidGradeAscenancyBetaBlueprintID:
                case DBConstants.MidGradeAscenancyGammaBlueprintID:
                case DBConstants.MidGradeAscenancyDeltaBlueprintID:
                case DBConstants.MidGradeAscenancyEpsilonBlueprintID:
                case DBConstants.MidGradeAscenancyOmegaBlueprintID:
                case DBConstants.MinerIIChinaBlueprintID:
                case DBConstants.MiningLaserOptimizationIIBlueprintID:
                case DBConstants.MiningLaserRangeIIBlueprintID:
                case DBConstants.ReconProbeLauncherIIBlueprintID:
                case DBConstants.ScanProbeLauncherIIBlueprintID:
                case DBConstants.ShieldTransporterRigIIBlueprintID:
                case DBConstants.ShockLBlueprintID:
                case DBConstants.ShockMBlueprintID:
                case DBConstants.ShockSBlueprintID:
                case DBConstants.SmallEWDroneRangeAugmentorIIBlueprintID:
                case DBConstants.StormLBlueprintID:
                case DBConstants.StormMBlueprintID:
                case DBConstants.StormSBlueprintID:
                case DBConstants.TalismanAlphaBlueprintID:
                    item.MarketGroupID = DBConstants.BlueprintTechIINonMarketGroupID;
                    break;

                case DBConstants.LegionBlueprintID:
                case DBConstants.LegionDefensiveAdaptiveAugmenterBlueprintID:
                case DBConstants.LegionElectronicsEnergyParasiticComplexBlueprintID:
                case DBConstants.LegionEngineeringPowerCoreMultiplierBlueprintID:
                case DBConstants.LegionOffensiveDroneSynthesisProjectorBlueprintID:
                case DBConstants.LegionPropulsionChassisOptimizationBlueprintID:
                case DBConstants.LokiBlueprintID:
                case DBConstants.LokiDefensiveAdaptiveShieldingBlueprintID:
                case DBConstants.LokiElectronicsImmobilityDriversBlueprintID:
                case DBConstants.LokiEngineeringPowerCoreMultiplierBlueprintID:
                case DBConstants.LokiOffensiveTurretConcurrenceRegistryBlueprintID:
                case DBConstants.LokiPropulsionChassisOptimizationBlueprintID:
                case DBConstants.ProteusBlueprintID:
                case DBConstants.ProteusDefensiveAdaptiveAugmenterBlueprintID:
                case DBConstants.ProteusElectronicsFrictionExtensionProcessorBlueprintID:
                case DBConstants.ProteusEngineeringPowerCoreMultiplierBlueprintID:
                case DBConstants.ProteusOffensiveDissonicEncodingPlatformBlueprintID:
                case DBConstants.ProteusPropulsionWakeLimiterBlueprintID:
                case DBConstants.TenguBlueprintID:
                case DBConstants.TenguDefensiveAdaptiveShieldingBlueprintID:
                case DBConstants.TenguElectronicsObfuscationManifoldBlueprintID:
                case DBConstants.TenguEngineeringPowerCoreMultiplierBlueprintID:
                case DBConstants.TenguOffensiveAcceleratedEjectionBayBlueprintID:
                case DBConstants.TenguPropulsionIntercalatedNanofibersBlueprintID:
                    item.MarketGroupID = DBConstants.BlueprintTechIIINonMarketGroupID;
                    break;
            }
        }
예제 #5
0
파일: Items.cs 프로젝트: RapidFiring/evemon
        /// <summary>
        /// Adds the item properties and prerequisites.
        /// </summary>
        /// <param name="srcItem">The source item.</param>
        /// <param name="item">The serializable item.</param>
        /// <returns></returns>
        private static void AddItemPropsAndPrereq(InvTypes srcItem, SerializableItem item)
        {
            Int64[] prereqSkills = new Int64[DBConstants.RequiredSkillPropertyIDs.Count];
            Int64[] prereqLevels = new Int64[DBConstants.RequiredSkillPropertyIDs.Count];
            List<SerializablePropertyValue> props = new List<SerializablePropertyValue>();
            double warpSpeedMultiplier = 1;
            foreach (DgmTypeAttributes srcProp in Database.DgmTypeAttributesTable.Where(x => x.ItemID == srcItem.ID))
            {
                Int64 propInt64Value = srcProp.GetInt64Value;

                // Is it a prereq skill ?
                int prereqIndex = DBConstants.RequiredSkillPropertyIDs.IndexOf(srcProp.AttributeID);
                if (prereqIndex > -1)
                {
                    prereqSkills[prereqIndex] = propInt64Value;
                    continue;
                }

                // Is it a prereq level ?
                prereqIndex = DBConstants.RequiredSkillLevelPropertyIDs.IndexOf(srcProp.AttributeID);
                if (prereqIndex > -1)
                {
                    prereqLevels[prereqIndex] = propInt64Value;
                    continue;
                }

                // Launcher group ?
                int launcherIndex = DBConstants.LauncherGroupPropertyIDs.IndexOf(srcProp.AttributeID);
                if (launcherIndex > -1)
                {
                    props.Add(new SerializablePropertyValue
                    {
                        ID = srcProp.AttributeID,
                        Value = Database.InvGroupsTable.HasValue(propInt64Value)
                            ? Database.InvGroupsTable[propInt64Value].Name
                            : String.Empty
                    });
                    continue;
                }

                // Charge group ?
                int chargeIndex = DBConstants.ChargeGroupPropertyIDs.IndexOf(srcProp.AttributeID);
                if (chargeIndex > -1)
                {
                    props.Add(new SerializablePropertyValue
                    {
                        ID = srcProp.AttributeID,
                        Value = Database.InvGroupsTable.HasValue(propInt64Value)
                            ? Database.InvGroupsTable[propInt64Value].Name
                            : String.Empty
                    });
                    continue;
                }

                // CanFitShip group ?
                int canFitShipIndex = DBConstants.CanFitShipGroupPropertyIDs.IndexOf(srcProp.AttributeID);
                if (canFitShipIndex > -1)
                {
                    props.Add(new SerializablePropertyValue
                    {
                        ID = srcProp.AttributeID,
                        Value = Database.InvGroupsTable.HasValue(propInt64Value)
                            ? Database.InvGroupsTable[propInt64Value].Name
                            : String.Empty
                    });
                    continue;
                }

                // ModuleShip group ?
                int moduleShipIndex = DBConstants.ModuleShipGroupPropertyIDs.IndexOf(srcProp.AttributeID);
                if (moduleShipIndex > -1)
                {
                    props.Add(new SerializablePropertyValue
                    {
                        ID = srcProp.AttributeID,
                        Value = Database.InvGroupsTable.HasValue(propInt64Value)
                            ? Database.InvGroupsTable[propInt64Value].Name
                            : String.Empty
                    });
                    continue;
                }

                // SpecialisationAsteroid group ?
                int specialisationAsteroidIndex = DBConstants.SpecialisationAsteroidGroupPropertyIDs.IndexOf(srcProp.AttributeID);
                if (specialisationAsteroidIndex > -1)
                {
                    props.Add(new SerializablePropertyValue
                    {
                        ID = srcProp.AttributeID,
                        Value = Database.InvGroupsTable.HasValue(propInt64Value)
                            ? Database.InvGroupsTable[propInt64Value].Name
                            : String.Empty
                    });
                    continue;
                }

                // Reaction group ?
                int reactionIndex = DBConstants.ReactionGroupPropertyIDs.IndexOf(srcProp.AttributeID);
                if (reactionIndex > -1)
                {
                    props.Add(new SerializablePropertyValue
                    {
                        ID = srcProp.AttributeID,
                        Value = Database.InvGroupsTable.HasValue(propInt64Value)
                            ? Database.InvGroupsTable[propInt64Value].Name
                            : String.Empty
                    });
                    continue;
                }

                // PosCargobayAccept group ?
                int posCargobayAcceptIndex = DBConstants.PosCargobayAcceptGroupPropertyIDs.IndexOf(srcProp.AttributeID);
                if (posCargobayAcceptIndex > -1)
                {
                    props.Add(new SerializablePropertyValue
                    {
                        ID = srcProp.AttributeID,
                        Value = Database.InvGroupsTable.HasValue(propInt64Value)
                            ? Database.InvGroupsTable[propInt64Value].Name
                            : String.Empty
                    });
                    continue;
                }

                // Get the warp speed multiplier
                if (srcProp.AttributeID == DBConstants.WarpSpeedMultiplierPropertyID && srcProp.ValueFloat != null)
                    warpSpeedMultiplier = srcProp.ValueFloat.Value;

                // We calculate and add the ships warp speed
                if (srcProp.AttributeID == DBConstants.ShipWarpSpeedPropertyID)
                {
                    props.Add(new SerializablePropertyValue
                    {
                        ID = srcProp.AttributeID,
                        Value = warpSpeedMultiplier.ToString(CultureConstants.InvariantCulture)
                    });

                    // Also add packaged volume as a prop as only ships have 'ship warp speed' attribute
                    props.Add(new SerializablePropertyValue
                    {
                        ID = Properties.PackagedVolumePropertyID,
                        Value = GetPackagedVolume(srcItem.GroupID).ToString(CultureConstants.InvariantCulture)
                    });
                }

                // Other props
                props.Add(new SerializablePropertyValue { ID = srcProp.AttributeID, Value = srcProp.FormatPropertyValue() });

                AddMetaData(item, propInt64Value, srcProp);
            }

            CompleteItemPropertiesAddition(srcItem, props);

            // Add properties info to item
            item.Properties.AddRange(props);

            // Prerequisites completion
            List<SerializablePrerequisiteSkill> prereqs = new List<SerializablePrerequisiteSkill>();
            for (int i = 0; i < prereqSkills.Length; i++)
            {
                if (prereqSkills[i] != 0)
                    prereqs.Add(new SerializablePrerequisiteSkill { ID = prereqSkills[i], Level = prereqLevels[i] });
            }

            // Add prerequisite skills info to item
            item.PrerequisiteSkills.AddRange(prereqs);
        }
예제 #6
0
        /// <summary>
        /// Sets the market group from meta group.
        /// </summary>
        /// <param name="item">The item.</param>
        private static void SetMarketGroupFromMetaGroup(InvTypes item)
        {
            // Guard in case an item of blueprint type is not contained in the blueprints table (glorious CCP)
            if (Database.InvBlueprintTypesTable.All(x => x.ID != item.ID))
                return;

            int relation = Database.InvMetaTypesTable.Where(
                x => x.ItemID == Database.InvBlueprintTypesTable[item.ID].ProductTypeID).Select(
                    x => x.MetaGroupID).FirstOrDefault();

            switch (relation)
            {
                case DBConstants.TechIIMetaGroupID:
                    item.MarketGroupID = DBConstants.BlueprintTechIINonMarketGroupID;
                    break;
                case DBConstants.StorylineMetaGroupID:
                    item.MarketGroupID = DBConstants.BlueprintStorylineNonMarketGroupID;
                    break;
                case DBConstants.FactionMetaGroupID:
                    item.MarketGroupID = DBConstants.BlueprintFactionNonMarketGroupID;
                    break;
                case DBConstants.OfficerMetaGroupID:
                    item.MarketGroupID = DBConstants.BlueprintOfficerNonMarketGroupID;
                    break;
                case DBConstants.TechIIIMetaGroupID:
                    item.MarketGroupID = DBConstants.BlueprintTechIIINonMarketGroupID;
                    break;
            }
        }
예제 #7
0
        /// <summary>
        /// Sets the blueprint meta group.
        /// </summary>
        /// <param name="srcBlueprint">The SRC blueprint.</param>
        /// <param name="blueprint">The blueprint.</param>
        private static void SetBlueprintMetaGroup(InvTypes srcBlueprint, SerializableBlueprint blueprint)
        {
            foreach (InvMetaTypes relation in Database.InvMetaTypesTable.Where(
                x => x.ItemID == Database.InvBlueprintTypesTable[srcBlueprint.ID].ProductTypeID))
            {
                switch (relation.MetaGroupID)
                {
                    default:
                        blueprint.MetaGroup = ItemMetaGroup.T1;
                        break;
                    case DBConstants.TechIIMetaGroupID:
                        blueprint.MetaGroup = ItemMetaGroup.T2;
                        break;
                    case DBConstants.StorylineMetaGroupID:
                        blueprint.MetaGroup = ItemMetaGroup.Storyline;
                        break;
                    case DBConstants.FactionMetaGroupID:
                        blueprint.MetaGroup = ItemMetaGroup.Faction;
                        break;
                    case DBConstants.OfficerMetaGroupID:
                        blueprint.MetaGroup = ItemMetaGroup.Officer;
                        break;
                    case DBConstants.DeadspaceMetaGroupID:
                        blueprint.MetaGroup = ItemMetaGroup.Deadspace;
                        break;
                    case DBConstants.TechIIIMetaGroupID:
                        blueprint.MetaGroup = ItemMetaGroup.T3;
                        break;
                }
            }

            // Metagroup for the custom market groups
            switch (srcBlueprint.MarketGroupID)
            {
                case DBConstants.BlueprintStorylineNonMarketGroupID:
                    blueprint.MetaGroup = ItemMetaGroup.Storyline;
                    break;
                case DBConstants.BlueprintFactionNonMarketGroupID:
                    blueprint.MetaGroup = ItemMetaGroup.Faction;
                    break;
                case DBConstants.BlueprintOfficerNonMarketGroupID:
                    blueprint.MetaGroup = ItemMetaGroup.Officer;
                    break;
                case DBConstants.BlueprintTechIIINonMarketGroupID:
                    blueprint.MetaGroup = ItemMetaGroup.T3;
                    break;
                case DBConstants.BlueprintTechIINonMarketGroupID:
                    blueprint.MetaGroup = ItemMetaGroup.T2;
                    break;
            }

            if (blueprint.MetaGroup == ItemMetaGroup.None)
                blueprint.MetaGroup = ItemMetaGroup.T1;
        }
예제 #8
0
 /// <summary>
 /// Gets the inventing items.
 /// </summary>
 /// <param name="srcBlueprint">The source blueprint.</param>
 /// <param name="blueprint">The blueprint.</param>
 private static void GetInventingItems(InvTypes srcBlueprint, SerializableBlueprint blueprint)
 {
     foreach (RamTypeRequirements requirement in Database.RamTypeRequirementsTable
         .Where(requirement => requirement.ID == srcBlueprint.ID &&
                               Database.InvBlueprintTypesTable.Any(x => x.ID == requirement.RequiredTypeID) &&
                               (requirement.ActivityID == (int)BlueprintActivity.Invention ||
                                requirement.ActivityID == (int)BlueprintActivity.ReverseEngineering)))
     {
         blueprint.InventionTypeIDs.Add(requirement.RequiredTypeID, requirement.Probability.GetValueOrDefault());
     }
 }
예제 #9
0
        /// <summary>
        /// Add properties to a blueprint.
        /// </summary>
        /// <param name="srcBlueprint"></param>
        /// <param name="blueprintsGroup"></param>
        /// <returns></returns>
        private static void CreateBlueprint(InvTypes srcBlueprint, ICollection<SerializableBlueprint> blueprintsGroup)
        {
            Util.UpdatePercentDone(Database.BlueprintsTotalCount);

            // Guard in case an item of blueprint type is not contained in the blueprints table (glorious CCP)
            if (Database.InvBlueprintTypesTable.All(x => x.ID != srcBlueprint.ID))
                return;

            InvBlueprintTypes blueprintType = Database.InvBlueprintTypesTable[srcBlueprint.ID];

            // Creates the blueprint with base informations
            SerializableBlueprint blueprint = new SerializableBlueprint
            {
                ID = srcBlueprint.ID,
                Name = srcBlueprint.Name,
                Icon = srcBlueprint.IconID.HasValue
                    ? Database.EveIconsTable[srcBlueprint.IconID.Value].Icon
                    : String.Empty,
                ProduceItemID = blueprintType.ProductTypeID,
                ProductionTime = blueprintType.ProductionTime,
                ResearchProductivityTime = blueprintType.ResearchProductivityTime,
                ResearchMaterialTime = blueprintType.ResearchMaterialTime,
                ResearchCopyTime = blueprintType.ResearchCopyTime,
                InventionTime = blueprintType.InventionTime,
                ReverseEngineeringTime = blueprintType.ReverseEngineeringTime,
                MaxProductionLimit = blueprintType.MaxProductionLimit,
            };

            // Metagroup
            SetBlueprintMetaGroup(srcBlueprint, blueprint);

            // Export item requirements
            GetRequirements(srcBlueprint, blueprint);

            // Look for the tech 2 or tech 3 variations that this blueprint invents
            GetInventingItems(srcBlueprint, blueprint);

            // Add this item
            blueprintsGroup.Add(blueprint);
        }
예제 #10
0
        /// <summary>
        /// Inventory Types.
        /// </summary>
        /// <returns><c>BagCollection</c> of items from the Inventory.</returns>
        private static BagCollection<InvTypes> Types()
        {
            IndexedCollection<InvTypes> collection = new IndexedCollection<InvTypes>();

            foreach (invTypes type in s_context.invTypes)
            {
                InvTypes item = new InvTypes
                {
                    ID = type.typeID,
                    Description = type.description,
                    MarketGroupID = type.marketGroupID,
                    Name = type.typeName,
                    RaceID = type.raceID
                };
                item.Description = item.Description.Clean();

                if (type.basePrice.HasValue)
                    item.BasePrice = type.basePrice.Value;

                if (type.capacity.HasValue)
                    item.Capacity = type.capacity.Value;

                if (type.groupID.HasValue)
                    item.GroupID = type.groupID.Value;

                if (type.mass.HasValue)
                    item.Mass = type.mass.Value;

                if (type.published.HasValue)
                    item.Published = type.published.Value;

                if (type.volume.HasValue)
                    item.Volume = type.volume.Value;

                if (type.portionSize.HasValue)
                    item.PortionSize = type.portionSize.Value;

                collection.Items.Add(item);
            }

            // Set items total count
            ItemsTotalCount = ReprocessingTotalCount = collection.Items.Count;

            // Set skills total count
            SkillsTotalCount = collection.Items.Count(
                item => item.GroupID != DBConstants.FakeSkillsGroupID &&
                        InvGroupsTable[item.GroupID].CategoryID == DBConstants.SkillCategoryID);

            return collection.ToBag();
        }