Пример #1
0
        private void ShowEquipmentUpgradesMenuItem_Click(object sender, EventArgs e)
        {
            if (CharactersTreeView.SelectedNode == null)
            {
                return;
            }

            EquipmentGroup characterEquipment = new EquipmentGroup();
            EquipmentGroup muleEquipment      = new EquipmentGroup();

            foreach (var item in boundList)
            {
                if (item.Owner == CharactersTreeView.SelectedNode.Text && item.EquippedSlot != 0)
                {
                    characterEquipment.Add(item);
                }

                if (item.Owner != CharactersTreeView.SelectedNode.Text && item.EquippedSlot == 0)
                {
                    muleEquipment.Add(item);
                }
            }

            var upgrades = characterEquipment.GetUpgradeOptions(muleEquipment);

            EquipmentUpgradesForm equipmentUpgradesForm = new EquipmentUpgradesForm();

            equipmentUpgradesForm.Owner = this;

            equipmentUpgradesForm.Show();

            equipmentUpgradesForm.Update(upgrades);
        }
Пример #2
0
        void UpdateBoundListFromTreeViewNodes(TreeNodeCollection nodes, bool clear = true)
        {
            if (clear)
            {
                boundList.RaiseListChangedEvents = false;
                boundList.Clear();
            }

            foreach (TreeNode node in nodes)
            {
                if (node.Tag is List <SuitBuildableMyWorldObject> )
                {
                    foreach (SuitBuildableMyWorldObject piece in (node.Tag as List <SuitBuildableMyWorldObject>))
                    {
                        if (node.Checked && (piece.Locked || filtersControl1.ItemPassesFilters(piece)))
                        {
                            boundList.Add(piece);
                        }
                    }
                }

                UpdateBoundListFromTreeViewNodes(node.Nodes, false);
            }

            if (clear)
            {
                boundList.RaiseListChangedEvents = true;
                boundList.ResetBindings();
            }
        }
Пример #3
0
		public void Update(Dictionary<SuitBuildableMyWorldObject, List<SuitBuildableMyWorldObject>> upgrades)
		{
			EquipmentGroup obsoleteEquipment = new EquipmentGroup();
			EquipmentGroup upgradeEquipment = new EquipmentGroup();

			foreach (var kvp in upgrades)
			{
				obsoleteEquipment.Add(kvp.Key);

				foreach (var v in kvp.Value)
					upgradeEquipment.Add(v);
			}

			Update(obsoleteEquipment, upgradeEquipment);
		}
        public void Update(Dictionary <SuitBuildableMyWorldObject, List <SuitBuildableMyWorldObject> > upgrades)
        {
            EquipmentGroup obsoleteEquipment = new EquipmentGroup();
            EquipmentGroup upgradeEquipment  = new EquipmentGroup();

            foreach (var kvp in upgrades)
            {
                obsoleteEquipment.Add(kvp.Key);

                foreach (var v in kvp.Value)
                {
                    upgradeEquipment.Add(v);
                }
            }

            Update(obsoleteEquipment, upgradeEquipment);
        }
Пример #5
0
		private void ShowEquipmentUpgradesMenuItem_Click(object sender, EventArgs e)
		{
			if (CharactersTreeView.SelectedNode == null)
				return;

			EquipmentGroup characterEquipment = new EquipmentGroup();
			EquipmentGroup muleEquipment = new EquipmentGroup();

			foreach (var item in boundList)
			{
				if (item.Owner == CharactersTreeView.SelectedNode.Text && item.EquippedSlot != 0)
					characterEquipment.Add(item);

				if (item.Owner != CharactersTreeView.SelectedNode.Text && item.EquippedSlot == 0)
					muleEquipment.Add(item);
			}

			var upgrades = characterEquipment.GetUpgradeOptions(muleEquipment);

			EquipmentUpgradesForm equipmentUpgradesForm = new EquipmentUpgradesForm();
			equipmentUpgradesForm.Owner = this;

			equipmentUpgradesForm.Show();

			equipmentUpgradesForm.Update(upgrades);
		}
Пример #6
0
        protected Searcher(SearcherConfiguration config, IEnumerable <SuitBuildableMyWorldObject> equipment, CompletedSuit startingSuit = null)
        {
            Config = config;

            foreach (var piece in equipment)
            {
                if (!piece.Exclude)
                {
                    Equipment.Add(piece);
                }
            }

            // Remove pieces that don't meet our minimum requirements
            for (int i = Equipment.Count - 1; i >= 0; i--)
            {
                if (!config.ItemPassesRules(Equipment[i]))
                {
                    Equipment.RemoveAt(i);
                }
            }

            // Remove surpassed pieces
            for (int i = Equipment.Count - 1; i >= 0; i--)
            {
                if (Equipment.ItemIsSurpassed(Equipment[i]))
                {
                    Equipment.RemoveAt(i);
                }
            }

            // If we were given a starting suit, lets start our SuitBuilder off with all those items
            if (startingSuit != null)
            {
                foreach (var o in startingSuit)
                {
                    SuitBuilder.Push(o.Value, o.Key);
                }
            }

            // Remove pieces that can provide no beneficial spell
            for (int i = Equipment.Count - 1; i >= 0; i--)
            {
                if (!SuitBuilder.CanGetBeneficialSpellFrom(Equipment[i]))
                {
                    Equipment.RemoveAt(i);
                }
            }

            // Remove pieces we can't add to our base suit
            for (int i = Equipment.Count - 1; i >= 0; i--)
            {
                if (!SuitBuilder.SlotIsOpen(Equipment[i].EquippableSlots))
                {
                    if (Equipment[i].EquippableSlots.GetTotalBitsSet() == 1)
                    {
                        Equipment.RemoveAt(i);
                    }
                    else
                    {
                        if (Equipment[i].EquippableSlots.IsBodyArmor())
                        {
                            var reductionOptions = Equipment[i].Coverage.ReductionOptions();

                            foreach (var option in reductionOptions)
                            {
                                if (option == CoverageFlags.Chest && SuitBuilder.SlotIsOpen(EquippableSlotFlags.Chest))
                                {
                                    goto end;
                                }
                                if (option == CoverageFlags.UpperArms && SuitBuilder.SlotIsOpen(EquippableSlotFlags.UpperArms))
                                {
                                    goto end;
                                }
                                if (option == CoverageFlags.LowerArms && SuitBuilder.SlotIsOpen(EquippableSlotFlags.LowerArms))
                                {
                                    goto end;
                                }
                                if (option == CoverageFlags.Abdomen && SuitBuilder.SlotIsOpen(EquippableSlotFlags.Abdomen))
                                {
                                    goto end;
                                }
                                if (option == CoverageFlags.UpperLegs && SuitBuilder.SlotIsOpen(EquippableSlotFlags.UpperLegs))
                                {
                                    goto end;
                                }
                                if (option == CoverageFlags.LowerLegs && SuitBuilder.SlotIsOpen(EquippableSlotFlags.LowerLegs))
                                {
                                    goto end;
                                }
                            }

                            Equipment.RemoveAt(i);
                        }
                        else
                        {
                            if ((Equipment[i].EquippableSlots.HasFlag(EquippableSlotFlags.LeftRing) || Equipment[i].EquippableSlots.HasFlag(EquippableSlotFlags.RightRing)) && !SuitBuilder.SlotIsOpen(EquippableSlotFlags.LeftRing) && !SuitBuilder.SlotIsOpen(EquippableSlotFlags.RightRing))
                            {
                                Equipment.RemoveAt(i); goto end;
                            }
                            if ((Equipment[i].EquippableSlots.HasFlag(EquippableSlotFlags.LeftBracelet) || Equipment[i].EquippableSlots.HasFlag(EquippableSlotFlags.RightBracelet)) && !SuitBuilder.SlotIsOpen(EquippableSlotFlags.LeftBracelet) && !SuitBuilder.SlotIsOpen(EquippableSlotFlags.RightBracelet))
                            {
                                Equipment.RemoveAt(i); goto end;
                            }
                        }
                    }
                }

                end :;
            }
        }