public SlayerTask(SlayerMonsters mType, uint amount, bool hasBoss = false, uint?bosskills = null, BossSlayerMonsters?bType = null, bool iscancelled = false, bool isextended = false, params string[] notes) { this.AdditionalNotes = new List <string>(); this.MonsterType = mType; this.Amount = amount; this.HasBossCounterpart = hasBoss; this.BossKills = bosskills; this.BossMonsterType = bType; this.IsCancelled = iscancelled; this.IsExtended = isextended; if (this.MonsterType != SlayerMonsters.None) { this.MonsterName = Slayer.SlayerLookUpTable[this.MonsterType].Key; } else { throw new InvalidOperationException("No monster type chosen"); } if (this.HasBossCounterpart && this.BossMonsterType != null && this.BossMonsterType != BossSlayerMonsters.None) { this.BossMonsterName = Slayer.BossSlayerLookUpTable[(BossSlayerMonsters)this.BossMonsterType].Key; } if (notes != null && notes.Length > 0) { this.AdditionalNotes.AddRange(notes); } this.TotalKills = this.Amount + (this.BossKills ?? 0); }
private void FindMatchingBosses() { string monsterName = MonsterListView.SelectedItem as string; SlayerMonsters monsterType = Slayer.SlayerLookUpTable.Where(entry => entry.Value.Key == monsterName).ToArray()[0].Key; var bossTypes = Slayer.BossMonsterGroups.Where(entry => entry.Value.Contains(monsterType)).Select(en => en.Key); string[] bossNames = bossTypes.Select(entry => Slayer.BossSlayerLookUpTable[entry].Key).ToArray(); BossListView.ItemsSource = bossNames; BossListView.UpdateLayout(); BossListView.Items.Refresh(); }
private void ValidateContract() { string monsterName = MonsterListView.SelectedItem as string; SlayerMonsters monsterType = Slayer.SlayerLookUpTable.Where(entry => entry.Value.Key == monsterName).ElementAt(0).Key; if (Slayer.SlayerMonstersWithContractAvailableLookUpTable.Contains(monsterType)) { ContractCheckBox.Visibility = Visibility.Visible; } else { ContractCheckBox.Visibility = Visibility.Hidden; ContractCheckBox.IsChecked = false; } }
private SlayerTask CreateSlayerTask() { SlayerTask s = null; string monsterName = (string)MonsterListView.SelectedItem; SlayerMonsters monsterType = Slayer.SlayerLookUpTable.Where(entry => entry.Value.Key == monsterName).ElementAt(0).Key; UInt32.TryParse(MonstersKilledTextBox.Text, out uint amount); bool killedBoss = BossCheckBox.IsChecked ?? false; uint?bossKills = null; BossSlayerMonsters?bType = null; if (killedBoss) { UInt32.TryParse(BossKillsAmountTextBox.Text, out uint bossAmount); bossKills = bossAmount; bType = Slayer.BossMonsterTypesLookUpTable.Where(entry => entry.Value == monsterType).ElementAt(0).Key; } bool iscancelled, isextended; iscancelled = CancelledCheckbox.IsChecked ?? false; isextended = ExtendedCheckBox.IsChecked ?? false; SlayerBonuses codexBonus; codexBonus = (SlayerBonuses)Enum.Parse(typeof(SlayerBonuses), (string)CodexBonuses.SelectedItem); s = new SlayerTask(monsterType, amount, killedBoss, bossKills, bType, iscancelled, isextended, notes); if (ContractCheckBox.IsChecked ?? false) { s.InitExp(codexBonus, SlayerBonuses.SlayerContract); } else { s.InitExp(codexBonus); } return(s); }