Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            if ((ModifierKeys & Keys.Shift) == 0)
            {
                if (!Settings.Default.InitialSize.IsEmpty)
                {
                    Size = Settings.Default.InitialSize;
                }
                if (!Settings.Default.InitialLocation.IsEmpty)
                {
                    Location = Settings.Default.InitialLocation;
                }
            }

            Text += " " + Application.ProductVersion;
            txtInventoryRootPath.Text = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\Decal Plugins\Mag-Tools\";

            typeof(DataGridView).InvokeMember("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, equipmentGrid, new object[] { true });
            equipmentGrid.DataSource = boundList;

            DataGridViewCellStyle style = new DataGridViewCellStyle();

            style.Format = "N3";

            foreach (DataGridViewColumn col in equipmentGrid.Columns)
            {
                if (col.HeaderText == "Variance" || col.HeaderText == "DamageBonus" || col.HeaderText == "ElementalDamageVersusMonsters" || col.HeaderText == "AttackBonus" || col.HeaderText == "MeleeDefenseBonus" || col.HeaderText == "MagicDBonus" || col.HeaderText == "MissileDBonus" || col.HeaderText == "ManaCBonus" ||
                    col.HeaderText == "SalvageWorkmanship" ||
                    col.HeaderText == "CalcedBuffedTinkedDoT" || col.HeaderText == "CalcedBuffedMissileDamage" || col.HeaderText == "BuffedElementalDamageVersusMonsters" || col.HeaderText == "BuffedAttackBonus" || col.HeaderText == "BuffedMeleeDefenseBonus" || col.HeaderText == "BuffedManaCBonus")
                {
                    col.DefaultCellStyle = style;
                }
            }

            filtersControl1.FiltersChanged += () => UpdateBoundListFromTreeViewNodes(CharactersTreeView.Nodes);

            boundList.ListChanged += (s, e2) =>
            {
                foreach (var item in boundList)
                {
                    item.IsSurpassed = boundList.ItemIsSurpassed(item);
                }
                equipmentGrid.Invalidate();
            };

            base.OnLoad(e);
        }
Exemplo n.º 2
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 :;
            }
        }