Exemplo n.º 1
0
        public void SetAutosplit(AutoSplit autosplit)
        {
            updating              = true;
            txtName.Text          = autosplit.Name;
            cmbType.SelectedIndex = (int)autosplit.Type;

            if (AutoSplit == null || autosplit.Type != AutoSplit.Type)
            {
                FillComboBoxes(autosplit);
            }

            cmbDifficulty.SelectedIndex = autosplit.Difficulty;

            var i = 0;

            foreach (Item item in cmbValue.Items)
            {
                if (item.Value == autosplit.Value)
                {
                    cmbValue.SelectedIndex = i;
                    break;
                }
                i++;
            }
            AutoSplit = autosplit;
            updating  = false;
        }
Exemplo n.º 2
0
 public AutoSplit(AutoSplit other)
 {
     Name       = other.Name;
     Type       = other.Type;
     Value      = other.Value;
     Difficulty = other.Difficulty;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Automatically fill in sequential quests such as Andariel to Duriel.
        /// Also handles difficulty levels.
        /// </summary>
        /// <param name="previous">The previous autosplit in the list. May be null.</param>
        /// <returns>A sequenced auto split.</returns>
        public AutoSplit CreateSequential(AutoSplit previous)
        {
            if (previous == null)
            {
                return(new AutoSplit("Game Start", AutoSplit.SplitType.Special, (short)AutoSplit.Special.GameStart, 0));
            }

            // Follow up with Andariel after game start.
            if (previous.Type == AutoSplit.SplitType.Special && previous.Value == (int)AutoSplit.Special.GameStart)
            {
                return(CreateForQuest(QuestId.Andariel, 0));
            }

            // Sequence bosses.
            if (previous.Type == AutoSplit.SplitType.Quest)
            {
                short   difficulty = previous.Difficulty;
                QuestId quest;

                switch ((QuestId)previous.Value)
                {
                case QuestId.DenOfEvil:
                    quest = QuestId.Andariel; break;

                case QuestId.Andariel:
                    quest = QuestId.Duriel; break;

                case QuestId.Duriel:
                    quest = QuestId.Mephisto; break;

                case QuestId.Mephisto:
                    quest = QuestId.Diablo; break;

                case QuestId.Diablo:
                    quest = QuestId.Baal; break;

                case QuestId.Baal:
                    // If we reached the last quest in hell, return an auto split with
                    // the default values.
                    if (++difficulty > 2)
                    {
                        return(CreateDefault());
                    }
                    quest = QuestId.Andariel;
                    break;

                // Unsequenced quest.
                default: return(CreateDefault());
                }

                return(CreateForQuest(quest, (GameDifficulty)difficulty));
            }

            return(CreateDefault());
        }
Exemplo n.º 4
0
        public Control AddAutoSplit(AutoSplit autosplit)
        {
            if (autosplit == null)
            {
                return(null);
            }

            // Operate on a copy.
            autosplit = new AutoSplit(autosplit);

            // Create and show the autosplit row.
            AutoSplitSettingsRow row = new AutoSplitSettingsRow(autosplit);

            Controls.Add(row);
            rows.Add(row);
            row.OnDelete += (item) =>
            {
                Controls.Remove(row);
                rows.Remove(row);
            };
            return(row);
        }
Exemplo n.º 5
0
        public AutoSplitSettingsRow(AutoSplit autosplit)
        {
            updating = false;
            InitializeComponent();

            cmbType.Items.Add(new Item {
                Name = LABEL_CHAR_LEVEL, Value = (int)AutoSplit.SplitType.CharLevel
            });
            cmbType.Items.Add(new Item {
                Name = LABEL_AREA, Value = (int)AutoSplit.SplitType.Area
            });
            cmbType.Items.Add(new Item {
                Name = LABEL_ITEM, Value = (int)AutoSplit.SplitType.Item
            });
            cmbType.Items.Add(new Item {
                Name = LABEL_QUEST, Value = (int)AutoSplit.SplitType.Quest
            });
            cmbType.Items.Add(new Item {
                Name = LABEL_SPECIAL, Value = (int)AutoSplit.SplitType.Special
            });
            cmbType.Items.Add(new Item {
                Name = LABEL_GEMS, Value = (int)AutoSplit.SplitType.Gems
            });

            cmbDifficulty.Items.Clear();
            cmbDifficulty.Items.Add(new Item {
                Name = LABEL_NORMAL, Value = 0
            });
            cmbDifficulty.Items.Add(new Item {
                Name = LABEL_NIGHTMARE, Value = 1
            });
            cmbDifficulty.Items.Add(new Item {
                Name = LABEL_HELL, Value = 2
            });

            SetAutosplit(autosplit);
        }
Exemplo n.º 6
0
        private void FillComboBoxes(AutoSplit autosplit)
        {
            if (autosplit.IsDifficultyIgnored())
            {
                cmbDifficulty.Hide();
            }
            else
            {
                cmbDifficulty.Show();
                cmbDifficulty.SelectedIndex = autosplit.Difficulty;
            }

            cmbValue.Items.Clear();
            switch (autosplit.Type)
            {
            case AutoSplit.SplitType.CharLevel:
                for (int i = 1; i < 100; i++)
                {
                    cmbValue.Items.Add(new Item {
                        Name = $"Lvl {i}", Value = i
                    });
                }
                break;

            case AutoSplit.SplitType.Area:
                foreach (Area area in Area.getAreaList())
                {
                    cmbValue.Items.Add(new Item {
                        Name = area.ToString(), Value = area.Id
                    });
                }
                break;

            case AutoSplit.SplitType.Item:
                cmbValue.Items.Add(new Item {
                    Name = LABEL_HORADRIC_CUBE, Value = (int)D2Data.ItemId.HORADRIC_CUBE
                });
                cmbValue.Items.Add(new Item {
                    Name = LABEL_HORADRIC_SHAFT, Value = (int)D2Data.ItemId.HORADRIC_SHAFT
                });
                cmbValue.Items.Add(new Item {
                    Name = LABEL_HORADRIC_AMULET, Value = (int)D2Data.ItemId.HORADRIC_AMULET
                });
                cmbValue.Items.Add(new Item {
                    Name = LABEL_KHALIMS_EYE, Value = (int)D2Data.ItemId.KHALIM_EYE
                });
                cmbValue.Items.Add(new Item {
                    Name = LABEL_KHALIMS_HEART, Value = (int)D2Data.ItemId.KHALIM_HEART
                });
                cmbValue.Items.Add(new Item {
                    Name = LABEL_KHALIMS_BRAIN, Value = (int)D2Data.ItemId.KHALIM_BRAIN
                });
                break;

            case AutoSplit.SplitType.Quest:
                foreach (QuestId questId in Enum.GetValues(typeof(QuestId)))
                {
                    cmbValue.Items.Add(new Item {
                        Name = QuestName(questId), Value = (int)questId
                    });
                }
                break;

            case AutoSplit.SplitType.Special:
                cmbValue.Items.Add(new Item {
                    Name = LABEL_GAME_START, Value = (int)AutoSplit.Special.GameStart
                });
                cmbValue.Items.Add(new Item {
                    Name = LABEL_CLEAR_100_PERCENT, Value = (int)AutoSplit.Special.Clear100Percent
                });
                cmbValue.Items.Add(new Item {
                    Name = LABEL_CLEAR_100_PERCENT_ALL, Value = (int)AutoSplit.Special.Clear100PercentAllDifficulties
                });
                break;

            case AutoSplit.SplitType.Gems:
                foreach (Gem gem in Enum.GetValues(typeof(Gem)))
                {
                    cmbValue.Items.Add(new Item {
                        Name = GemName(gem), Value = (int)gem
                    });
                }

                break;
            }
        }