示例#1
0
        /// <summary>
        /// Base deserialization constructor.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <param name="src">The source.</param>
        internal Item(MarketGroup group, SerializableItem src)
            : this(src.ID, src.Name)
        {
            MarketGroup = group;
            Icon = src.Icon;
            Race = src.Race;
            FittingSlot = src.Slot == ItemSlot.None ? ItemSlot.NoSlot : src.Slot;
            Family = src.Family;
            Description = src.Description;
            CategoryName = src.Category;
            GroupName = src.Group;

            PortionSize = src.PortionSize;
            MetaLevel = src.MetaLevel;
            MetaGroup = src.MetaGroup;

            Properties = new EvePropertyCollection(src.Properties);
            ReactionMaterial = new ReactionMaterialCollection(src.ReactionInfo);
            ControlTowerFuel = new ControlTowerFuelCollection(src.ControlTowerFuelInfo);

            // Skills prerequisites
            m_prerequisites = new FastList<StaticSkillLevel>(src.PrerequisiteSkills?.Count ?? 0);
            if (src.PrerequisiteSkills == null)
                return;

            foreach (SerializablePrerequisiteSkill prereq in src.PrerequisiteSkills)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level));
            }
        }
示例#2
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="group">Market Group for the item</param>
        /// <param name="src">One or more source serializable items</param>
        internal ItemCollection(MarketGroup group, ICollection <SerializableItem> src)
            : base(src?.Count ?? 0)
        {
            if (src == null)
            {
                return;
            }

            foreach (SerializableItem item in src)
            {
                switch (item.Family)
                {
                default:
                    Items.Add(new Item(group, item));
                    break;

                case ItemFamily.Implant:
                    Items.Add(new Implant(group, item));
                    break;

                case ItemFamily.Ship:
                    Items.Add(new Ship(group, item));
                    break;
                }
            }
        }
示例#3
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="group">Market Group the Blueprint will be a member of.</param>
        /// <param name="src">Source serializable blueprint.</param>
        internal Blueprint(MarketGroup group, SerializableBlueprint src)
            : base(group, src)
        {
            RunsPerCopy = src.MaxProductionLimit;
            ProducesItem = StaticItems.GetItemByID(src.ProduceItemID);
            ProductionTime = src.ProductionTime;
            ResearchCopyTime = src.ResearchCopyTime;
            ResearchMaterialTime = src.ResearchMaterialTime;
            ResearchProductivityTime = src.ResearchProductivityTime;
            ResearchInventionTime = src.InventionTime;
            ReverseEngineeringTime = src.ReverseEngineeringTime;

            // Invented blueprints
            m_inventBlueprints = new Dictionary<int, double>(src.InventionTypeIDs?.Count ?? 0);
            if (src.InventionTypeIDs != null && src.InventionTypeIDs.Any())
            {
                m_inventBlueprints.AddRange(src.InventionTypeIDs);
            }

            // Materials prerequisites
            m_materialRequirements =
                new FastList<StaticRequiredMaterial>(src.ReqMaterial?.Count ?? 0);
            if (src.ReqMaterial == null)
                return;

            foreach (SerializableRequiredMaterial prereq in src.ReqMaterial)
            {
                m_materialRequirements.Add(new StaticRequiredMaterial(prereq));
            }
        }
示例#4
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="group">Market Group the Blueprint will be a member of.</param>
        /// <param name="src">Source serializable blueprint.</param>
        internal Blueprint(MarketGroup group, SerializableBlueprint src)
            : base(group, src)
        {
            RunsPerCopy              = src.MaxProductionLimit;
            ProducesItem             = StaticItems.GetItemByID(src.ProduceItemID);
            ProductionTime           = src.ProductionTime;
            ResearchCopyTime         = src.ResearchCopyTime;
            ResearchMaterialTime     = src.ResearchMaterialTime;
            ResearchProductivityTime = src.ResearchProductivityTime;
            ResearchInventionTime    = src.InventionTime;
            ReverseEngineeringTime   = src.ReverseEngineeringTime;

            // Invented blueprints
            m_inventBlueprints = new Dictionary <int, double>(src.InventionTypeIDs?.Count ?? 0);
            if (src.InventionTypeIDs != null && src.InventionTypeIDs.Any())
            {
                m_inventBlueprints.AddRange(src.InventionTypeIDs);
            }

            // Materials prerequisites
            m_materialRequirements =
                new FastList <StaticRequiredMaterial>(src.ReqMaterial?.Count ?? 0);
            if (src.ReqMaterial == null)
            {
                return;
            }

            foreach (SerializableRequiredMaterial prereq in src.ReqMaterial)
            {
                m_materialRequirements.Add(new StaticRequiredMaterial(prereq));
            }
        }
示例#5
0
        /// <summary>
        /// Base deserialization constructor.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <param name="src">The source.</param>
        internal Item(MarketGroup group, SerializableItem src)
            : this(src.ID, src.Name)
        {
            MarketGroup  = group;
            Icon         = src.Icon;
            Race         = src.Race;
            FittingSlot  = src.Slot == ItemSlot.None ? ItemSlot.NoSlot : src.Slot;
            Family       = src.Family;
            Description  = src.Description;
            CategoryName = src.Category;
            GroupName    = src.Group;

            PortionSize = src.PortionSize;
            MetaLevel   = src.MetaLevel;
            MetaGroup   = src.MetaGroup;

            Properties       = new EvePropertyCollection(src.Properties);
            ReactionMaterial = new ReactionMaterialCollection(src.ReactionInfo);
            ControlTowerFuel = new ControlTowerFuelCollection(src.ControlTowerFuelInfo);

            // Skills prerequisites
            m_prerequisites = new FastList <StaticSkillLevel>(src.PrerequisiteSkills?.Count ?? 0);
            if (src.PrerequisiteSkills == null)
            {
                return;
            }

            foreach (SerializablePrerequisiteSkill prereq in src.PrerequisiteSkills)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level));
            }
        }
示例#6
0
        /// <summary>
        /// Base deserialization constructor.
        /// </summary>
        /// <param name="src"></param>
        internal Item(MarketGroup group, SerializableItem src)
            : this(src.ID, src.Name)
        {
            m_marketGroup = group;

            m_icon = src.Icon;
            m_race = src.Race;
            m_slot = src.Slot;
            m_family = src.Family;
            m_description = src.Description;

            m_metaLevel = src.MetaLevel;
            m_metaGroup = src.MetaGroup;

            m_reprocessing = new FastList<Material>(0);
            m_properties = new PropertiesCollection(src.Properties);

            // Skills prerequisites
            m_prerequisites = new FastList<StaticSkillLevel>((src.Prereqs != null ? src.Prereqs.Length : 0));
            if (src.Prereqs == null)
                return;

            foreach (var prereq in src.Prereqs)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level));
            }
        }
示例#7
0
        /// <summary>
        /// Deserialization constructor
        /// </summary>
        /// <param name="group">Market Group for the item</param>
        /// <param name="src">One or more source serializable items</param>
        internal ItemCollection(MarketGroup group, SerializableItem[] src)
            : base(src == null ? 0 : src.Length)
        {
            if (src == null)
            {
                return;
            }

            foreach (var item in src)
            {
                switch (item.Family)
                {
                default:
                    m_items.Add(new Item(group, item));
                    break;

                case ItemFamily.Implant:
                    m_items.Add(new Implant(group, item));
                    break;

                case ItemFamily.Ship:
                    m_items.Add(new Ship(group, item));
                    break;
                }
            }
        }
示例#8
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="src"></param>
        internal Implant(MarketGroup group, SerializableItem src)
            : base(group, src)
        {
            // Gets the slot
            var slotProperty = this.Properties[DBConstants.ImplantSlotPropertyID];
            m_implantSlot = (slotProperty == null ? ImplantSlots.None : (ImplantSlots)(slotProperty.Value.IValue - 1));

            // Get the bonus
            switch (m_implantSlot)
            {
                case ImplantSlots.Charisma:
                    m_bonus = this.Properties[DBConstants.CharismaModifierPropertyID].Value.IValue;
                    break;
                case ImplantSlots.Intelligence:
                    m_bonus = this.Properties[DBConstants.IntelligenceModifierPropertyID].Value.IValue;
                    break;
                case ImplantSlots.Memory:
                    m_bonus = this.Properties[DBConstants.MemoryModifierPropertyID].Value.IValue;
                    break;
                case ImplantSlots.Perception:
                    m_bonus = this.Properties[DBConstants.PerceptionModifierPropertyID].Value.IValue;
                    break;
                case ImplantSlots.Willpower:
                    m_bonus = this.Properties[DBConstants.WillpowerModifierPropertyID].Value.IValue;
                    break;
                default:
                    break;
            }

            // Adds itself to the implants slot
            StaticItems.GetImplants(m_implantSlot).Add(this);
        }
示例#9
0
        /// <summary>
        /// Base deserialization constructor.
        /// </summary>
        /// <param name="src"></param>
        internal Item(MarketGroup group, SerializableItem src)
            : this(src.ID, src.Name)
        {
            m_marketGroup = group;

            m_icon        = src.Icon;
            m_race        = src.Race;
            m_slot        = src.Slot;
            m_family      = src.Family;
            m_description = src.Description;

            m_metaLevel = src.MetaLevel;
            m_metaGroup = src.MetaGroup;

            m_reprocessing = new FastList <Material>(0);
            m_properties   = new PropertiesCollection(src.Properties);

            // Skills prerequisites
            m_prerequisites = new FastList <StaticSkillLevel>((src.Prereqs != null ? src.Prereqs.Length : 0));
            if (src.Prereqs == null)
            {
                return;
            }

            foreach (var prereq in src.Prereqs)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level));
            }
        }
示例#10
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);
        }
示例#11
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);
        }
示例#12
0
        /// <summary>
        /// Gets true if the item's market group belongs to the questioned group.
        /// </summary>
        public static bool BelongsIn(this MarketGroup marketGroup, IList <int> group)
        {
            while (marketGroup != null)
            {
                if (group.Any(x => x == marketGroup.ID))
                {
                    return(true);
                }

                marketGroup = marketGroup.ParentGroup;
            }

            return(false);
        }
示例#13
0
        /// <summary>
        /// Gets the category path of this item
        /// </summary>
        /// <returns></returns>
        public string GetCategoryPath()
        {
            StringBuilder sb  = new StringBuilder();
            MarketGroup   cat = m_marketGroup;

            while (cat != null)
            {
                sb.Insert(0, cat.Name);
                cat = cat.ParentGroup;
                if (cat != null)
                {
                    sb.Insert(0, " > ");
                }
            }
            return(sb.ToString());
        }
示例#14
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="src"></param>
        internal Implant(MarketGroup group, SerializableItem src)
            : base(group, src)
        {
            // Gets the slot
            EvePropertyValue? slotProperty = Properties[DBConstants.ImplantSlotPropertyID];

            if (slotProperty == null)
                return;

            Slot = (ImplantSlots)(slotProperty.Value.Int64Value - 1);

            // Sets the implant bonus
            SetImplantBonus();

            // Adds itself to the implants slot
            StaticItems.GetImplants(Slot).Add(this);
        }
示例#15
0
        /// <summary>
        /// Base constructor for blueprints.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        internal Item(BlueprintMarketGroup group, SerializableBlueprint src)
            : this(src.ID, src.Name)
        {
            m_icon = src.Icon;
            m_metaGroup = src.MetaGroup;
            m_marketGroup = group;
            m_family = ItemFamily.Bpo;

            m_prerequisites = new FastList<StaticSkillLevel>(src.PrereqSkill != null ? src.PrereqSkill.Length : 0);
            if (src.PrereqSkill == null)
                return;

            foreach (var prereq in src.PrereqSkill)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level, prereq.Activity));
            }
        }
        /// <summary>
        /// Gets true if the item's market group belongs to the questioned group.
        /// </summary>
        public static bool BelongsIn(this MarketGroup marketGroup, IEnumerable <int> group)
        {
            while (marketGroup != null)
            {
                foreach (var groupID in group)
                {
                    if (marketGroup.ID == groupID)
                    {
                        return(true);
                    }
                }

                marketGroup = marketGroup.ParentGroup;
            }

            return(false);
        }
示例#17
0
        /// <summary>
        /// Recursively collect the items within all groups and stores them in the dictionaries.
        /// </summary>
        /// <param name="marketGroup"></param>
        private static void InitializeDictionaries(MarketGroup marketGroup)
        {
            // Special groups
            if (marketGroup.ID == DBConstants.ShipsMarketGroupID)
                ShipsMarketGroup = marketGroup;

            s_marketGroupsByID[marketGroup.ID] = marketGroup;

            foreach (Item item in marketGroup.Items)
            {
                s_itemsByID[item.ID] = item;
            }

            foreach (MarketGroup childGroup in marketGroup.SubGroups)
            {
                InitializeDictionaries(childGroup);
            }
        }
示例#18
0
        /// <summary>
        /// Recursively collect the items within all groups and stores them in the dictionaries.
        /// </summary>
        /// <param name="group"></param>
        private static void InitializeDictionaries(MarketGroup group)
        {
            // Special groups
            if (group.ID == DBConstants.ShipsGroupID)
            {
                s_shipsGroup = group;
            }

            foreach (var item in group.Items)
            {
                s_itemsByID[item.ID] = item;
            }

            foreach (var childGroup in group.SubGroups)
            {
                InitializeDictionaries(childGroup);
            }
        }
示例#19
0
        /// <summary>
        /// Base constructor for blueprints.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <param name="src">The source.</param>
        internal Item(MarketGroup group, SerializableBlueprint src)
            : this(src.ID, src.Name)
        {
            Icon = src.Icon;
            MetaGroup = src.MetaGroup;
            MarketGroup = group;
            Family = ItemFamily.Blueprint;

            // Skills prerequisites
            m_prerequisites = new FastList<StaticSkillLevel>(src.PrereqSkill?.Count ?? 0);
            if (src.PrereqSkill == null)
                return;

            foreach (SerializablePrereqSkill prereq in src.PrereqSkill)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level, prereq.Activity));
            }
        }
示例#20
0
        /// <summary>
        /// Base constructor for blueprints.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        internal Item(BlueprintMarketGroup group, SerializableBlueprint src)
            : this(src.ID, src.Name)
        {
            m_icon        = src.Icon;
            m_metaGroup   = src.MetaGroup;
            m_marketGroup = group;
            m_family      = ItemFamily.Bpo;

            m_prerequisites = new FastList <StaticSkillLevel>(src.PrereqSkill != null ? src.PrereqSkill.Length : 0);
            if (src.PrereqSkill == null)
            {
                return;
            }

            foreach (var prereq in src.PrereqSkill)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level, prereq.Activity));
            }
        }
示例#21
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="src"></param>
        internal Implant(MarketGroup group, SerializableItem src)
            : base(group, src)
        {
            // Gets the slot
            EvePropertyValue?slotProperty = Properties[DBConstants.ImplantSlotPropertyID];

            if (slotProperty == null)
            {
                return;
            }

            Slot = (ImplantSlots)(slotProperty.Value.Int64Value - 1);

            // Sets the implant bonus
            SetImplantBonus();

            // Adds itself to the implants slot
            StaticItems.GetImplants(Slot).Add(this);
        }
示例#22
0
        /// <summary>
        /// Recursively collect the items within all groups and stores them in the dictionaries.
        /// </summary>
        /// <param name="marketGroup"></param>
        private static void InitializeDictionaries(MarketGroup marketGroup)
        {
            // Special groups
            if (marketGroup.ID == DBConstants.ShipsMarketGroupID)
            {
                ShipsMarketGroup = marketGroup;
            }

            s_marketGroupsByID[marketGroup.ID] = marketGroup;

            foreach (Item item in marketGroup.Items)
            {
                s_itemsByID[item.ID] = item;
            }

            foreach (MarketGroup childGroup in marketGroup.SubGroups)
            {
                InitializeDictionaries(childGroup);
            }
        }
示例#23
0
        /// <summary>
        /// Base constructor for blueprints.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <param name="src">The source.</param>
        internal Item(MarketGroup group, SerializableBlueprint src)
            : this(src.ID, src.Name)
        {
            Icon        = src.Icon;
            MetaGroup   = src.MetaGroup;
            MarketGroup = group;
            Family      = ItemFamily.Blueprint;

            // Skills prerequisites
            m_prerequisites = new FastList <StaticSkillLevel>(src.PrereqSkill?.Count ?? 0);
            if (src.PrereqSkill == null)
            {
                return;
            }

            foreach (SerializablePrereqSkill prereq in src.PrereqSkill)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level, prereq.Activity));
            }
        }
示例#24
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="src"></param>
        internal Implant(MarketGroup group, SerializableItem src)
            : base(group, src)
        {
            // Gets the slot
            var slotProperty = this.Properties[DBConstants.ImplantSlotPropertyID];

            m_implantSlot = (slotProperty == null ? ImplantSlots.None : (ImplantSlots)(slotProperty.Value.IValue - 1));

            // Get the bonus
            switch (m_implantSlot)
            {
            case ImplantSlots.Charisma:
                m_bonus = this.Properties[DBConstants.CharismaModifierPropertyID].Value.IValue;
                break;

            case ImplantSlots.Intelligence:
                m_bonus = this.Properties[DBConstants.IntelligenceModifierPropertyID].Value.IValue;
                break;

            case ImplantSlots.Memory:
                m_bonus = this.Properties[DBConstants.MemoryModifierPropertyID].Value.IValue;
                break;

            case ImplantSlots.Perception:
                m_bonus = this.Properties[DBConstants.PerceptionModifierPropertyID].Value.IValue;
                break;

            case ImplantSlots.Willpower:
                m_bonus = this.Properties[DBConstants.WillpowerModifierPropertyID].Value.IValue;
                break;

            default:
                break;
            }

            // Adds itself to the implants slot
            StaticItems.GetImplants(m_implantSlot).Add(this);
        }
示例#25
0
        /// <summary>
        /// Recursively collect the items within all groups and stores them in the dictionaries.
        /// </summary>
        /// <param name="group"></param>
        private static void InitializeDictionaries(MarketGroup group)
        {
            // Special groups
            if (group.ID == DBConstants.ShipsGroupID)
                s_shipsGroup = group;
            
            s_groupsByID[group.ID] = group;
            
            foreach (var item in group.Items)
            {
                s_itemsByID[item.ID] = item;
            }

            foreach (var childGroup in group.SubGroups)
            {
                InitializeDictionaries(childGroup);
            }
        }
示例#26
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ship"></param>
        internal Ship(MarketGroup group, SerializableItem src)
            : base(group, src)
        {

        }
示例#27
0
        /// <summary>
        /// Recursively creates tree nodes for the children market groups of the given group.
        /// The added items will be the ones which require the current skill (<see cref="m_skill"/>) at the specified level.
        /// </summary>
        /// <param name="marketGroup">The market group.</param>
        /// <param name="items">The items.</param>
        /// <returns></returns>
        private IEnumerable<TreeNode> CreateMarketGroupsNode(MarketGroup marketGroup, IEnumerable<Item> items)
        {
            // Add categories
            foreach (MarketGroup category in marketGroup.SubGroups)
            {
                IEnumerable<TreeNode> children = CreateMarketGroupsNode(category, items);
                if (children.IsEmpty())
                    continue;

                TreeNode node = new TreeNode(category.Name);
                node.Nodes.AddRange(children.ToArray());
                yield return node;
            }

            // Add items
            foreach (Item item in items.Where(x => x.MarketGroup == marketGroup))
            {
                yield return CreateNode(item, item.Prerequisites.ToCharacter(m_character));
            }
        }
示例#28
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;
 }
示例#29
0
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="parent">The Market Group this Market Group is contained within</param>
 /// <param name="src">Source Serializable Market Group</param>
 public MarketGroup(MarketGroup parent, SerializableMarketGroup src)
     : this(src)
 {
     ParentGroup = parent;
 }
示例#30
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="group">The group.</param>
 /// <param name="src">The source.</param>
 internal Ship(MarketGroup group, SerializableItem src)
     : base(group, src)
 {
     Recommendations = new StaticRecommendations<StaticCertificate>();
 }
示例#31
0
文件: Ship.cs 项目: Almamu/evemon
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ship"></param>
 internal Ship(MarketGroup group, SerializableItem src)
     : base(group, src)
 {
 }
示例#32
0
        /// <summary>
        /// Create the tree nodes for the given category and add them to the given nodes collection.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="nodeCollection"></param>
        /// <returns></returns>
        private int BuildSubtree(MarketGroup group, TreeNodeCollection nodeCollection)
        {
            // Total items count in this category and its subcategories
            int result = 0;

            // Add all subcategories
            foreach (MarketGroup childGroup in group.SubGroups)
            {
                TreeNode node = new TreeNode
                {
                    Text = childGroup.Name,
                    Tag = childGroup
                };

                // Add this subcategory's items count
                result += BuildSubtree(childGroup, node.Nodes);

                // Only add if this subcategory has children
                if (node.GetNodeCount(true) > 0)
                    nodeCollection.Add(node);
            }

            // Add all items
            foreach (TreeNode node in group.Items
                .Where(x => UsabilityPredicate(x)
                            && m_slotPredicate(x)
                            && m_metaGroupPredicate(x)
                            && m_fittingPredicate(x))
                .Select(childItem =>
                    new TreeNode
                    {
                        Text = childItem.Name,
                        Tag = childItem
                    }))
            {
                nodeCollection.Add(node);
                result++;
            }

            return result;
        }
示例#33
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>
 public MarketGroup(MarketGroup parent, SerializableBlueprintGroup src)
     :this (src)
 {
     m_parent = parent;
 }
示例#34
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>
 public MarketGroup(MarketGroup parent, SerializableBlueprintGroup src)
     : this(src)
 {
     m_parent = parent;
 }
示例#35
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;
 }
示例#36
0
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="parent">The Market Group this Market Group is contained within</param>
 /// <param name="src">Source Serializable Market Group</param>
 public MarketGroup(MarketGroup parent, SerializableMarketGroup src)
     : this(src)
 {
     ParentGroup = parent;
 }
示例#37
0
        /// <summary>
        /// Create the tree nodes for the given group and add them to the given nodes collection
        /// </summary>
        /// <param name="group"></param>
        /// <param name="nodeCollection"></param>
        /// <returns></returns>
        private int BuildSubtree(MarketGroup group, TreeNodeCollection nodeCollection)
        {
            // Total items count in this category and its subcategories
            int result = 0;

            // Add all subcategories
            foreach (MarketGroup childGroup in group.SubGroups)
            {
                TreeNode node = new TreeNode()
                {
                    Text = childGroup.Name
                };

                // Add this subcategory's items count
                result += BuildSubtree(childGroup, node.Nodes);

                // Only add if this subcategory has children
                if (node.GetNodeCount(true) > 0)
                    nodeCollection.Add(node);
            }

            // Add all items
            foreach (Item childItem in group.Items.Where(m_usabilityPredicate).Where(m_racePredicate))
            {
                TreeNode node = new TreeNode()
                {
                    Text = childItem.Name,
                    Tag = childItem
                };

                nodeCollection.Add(node);
                result++;
            }
            return result;
        }
示例#38
0
 /// <summary>
 /// Gets true if the item's market group belongs to the questioned group.
 /// </summary>
 public static bool BelongsIn(this MarketGroup marketGroup, int group)
 => marketGroup.BelongsIn(new[] { group });