示例#1
0
        /// <summary>
        /// Deserialization constructor for root category only.
        /// </summary>
        /// <param name="src"></param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        protected MarketGroup(SerializableBlueprintMarketGroup src)
        {
            src.ThrowIfNull(nameof(src));

            ID = src.ID;
            Name = src.Name;
        }
示例#2
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        public BlueprintMarketGroup(MarketGroup parent, SerializableBlueprintMarketGroup src)
            : base(parent, src)
        {
            src.ThrowIfNull(nameof(src));

            SubGroups = new BlueprintMarketGroupCollection(this, src.SubGroups);
            Blueprints = new BlueprintCollection(this, src.Blueprints);
        }
示例#3
0
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="parent">The Market Group this Market Group is contained within</param>
 /// <param name="src">Source Blueprint Group</param>
 protected MarketGroup(MarketGroup parent, SerializableBlueprintMarketGroup src)
     : this(src)
 {
     ParentGroup = parent;
 }
示例#4
0
        /// <summary>
        /// Creates the market groups.
        /// </summary>
        /// <param name="groups">The groups.</param>
        private static void CreateMarketGroups(IDictionary<int, SerializableBlueprintMarketGroup> groups)
        {
            foreach (InvMarketGroups marketGroup in Database.InvMarketGroupsTable.Concat(s_injectedMarketGroups))
            {
                SerializableBlueprintMarketGroup group = new SerializableBlueprintMarketGroup
                {
                    ID = marketGroup.ID,
                    Name = marketGroup.Name,
                };

                groups[marketGroup.ID] = group;

                // Add the items in this group
                List<SerializableBlueprint> blueprints = new List<SerializableBlueprint>();
                foreach (InvTypes item in Database.InvTypesTable.Where(
                    item => item.MarketGroupID.GetValueOrDefault() == marketGroup.ID &&
                            (Database.InvGroupsTable[item.GroupID].CategoryID == DBConstants.BlueprintCategoryID ||
                             Database.InvGroupsTable[item.GroupID].CategoryID == DBConstants.AncientRelicsCategoryID)))
                {
                    CreateBlueprint(item, blueprints);
                }

                // Store the items
                group.Blueprints.AddRange(blueprints.OrderBy(x => x.Name));
            }
        }