public SaveTalentSpecDialog(TalentsBase spec, int tree1, int tree2, int tree3) { InitializeComponent(); #if !SILVERLIGHT this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; this.WindowState = System.Windows.WindowState.Normal; #endif Talents = spec; Tree1 = tree1; Tree2 = tree2; Tree3 = tree3; SavedTalentSpecList saved = SavedTalentSpec.SpecsFor(spec.GetClass()); if (saved.Count > 0) { UpdateCombo.ItemsSource = saved; UpdateCombo.SelectedIndex = 0; } else { UpdateCombo.IsEnabled = false; } }
private List <TalentsBase> GetOptimizeTalentSpecs() { List <TalentsBase> talentSpecs = null; if (CK_Talents_Points.IsChecked.GetValueOrDefault(false) || CK_Talents_Glyphs.IsChecked.GetValueOrDefault(false) || CK_Talents_Specs.IsChecked.GetValueOrDefault(false)) { talentSpecs = new List <TalentsBase>(); foreach (SavedTalentSpec spec in SavedTalentSpec.SpecsFor(character.Class)) { TalentsBase talents = spec.TalentSpec(); int totalPoints = 0; for (int i = 0; i < talents.Data.Length; i++) { totalPoints += talents.Data[i]; } if (totalPoints == 41 /*character.Level - 9*/)//that's the old method { talentSpecs.Add(talents); } } } return(talentSpecs); }
private void SavedCombo_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!updating) { SavedTalentSpec newSpec = SavedCombo.SelectedItem as SavedTalentSpec; Character.CurrentTalents = newSpec.TalentSpec(); Character.OnTalentChange(); character_ClassChanged(this, EventArgs.Empty); Character.OnCalculationsInvalidated(); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { if (UpdateCombo.SelectedIndex >= 0) { SavedTalentSpec spec = UpdateCombo.SelectedItem as SavedTalentSpec; spec.Spec = Talents.ToString(); spec.Tree1 = Tree1; spec.Tree2 = Tree2; spec.Tree3 = Tree3; } else { SavedTalentSpec.AllSpecs.Add(new SavedTalentSpec(NewText.Text, Talents, Tree1, Tree2, Tree3)); } this.DialogResult = true; }
private void SaveDelete_Click(object sender, System.Windows.RoutedEventArgs e) { SavedTalentSpec currentSpec = SavedCombo.SelectedItem as SavedTalentSpec; if (HasCustomSpec) { SaveTalentSpecDialog dialog = new SaveTalentSpecDialog(currentSpec.TalentSpec(), currentSpec.Tree1, currentSpec.Tree2, currentSpec.Tree3); dialog.Closed += new EventHandler(dialog_Closed); dialog.Show(); } else { SavedTalentSpec.AllSpecs.Remove(currentSpec); UpdateSavedSpecs(); } }
public SaveTalentSpecDialog(TalentsBase spec, int tree1, int tree2, int tree3) { InitializeComponent(); Talents = spec; Tree1 = tree1; Tree2 = tree2; Tree3 = tree3; SavedTalentSpecList saved = SavedTalentSpec.SpecsFor(spec.GetClass()); if (saved.Count > 0) { UpdateCombo.ItemsSource = saved; UpdateCombo.SelectedIndex = 0; } else { UpdateCombo.IsEnabled = false; } }
private List <TalentsBase> GetOptimizeTalentSpecs() { List <TalentsBase> talentSpecs = null; if (TalentsCheck.IsChecked.GetValueOrDefault(false) || TalentSpecsCheck.IsChecked.GetValueOrDefault(false)) { talentSpecs = new List <TalentsBase>(); foreach (SavedTalentSpec spec in SavedTalentSpec.SpecsFor(character.Class)) { TalentsBase talents = spec.TalentSpec(); int totalPoints = 0; for (int i = 0; i < talents.Data.Length; i++) { totalPoints += talents.Data[i]; } if (totalPoints == character.Level - 9) { talentSpecs.Add(talents); } } } return(talentSpecs); }
private void UpdateSavedSpecs() { SavedTalentSpecList savedSpecs = SavedTalentSpec.SpecsFor(Character.Class); SavedTalentSpec current = null; updating = true; foreach (SavedTalentSpec sts in savedSpecs) { if (sts.Equals(Character.CurrentTalents)) { current = sts; break; } } if (current != null) { HasCustomSpec = false; SavedCombo.ItemsSource = savedSpecs; SavedCombo.SelectedItem = current; SaveDeleteButton.Content = "Delete"; } else { HasCustomSpec = true; current = new SavedTalentSpec("Custom", Character.CurrentTalents, Tree1.Points(), Tree2.Points(), Tree3.Points()); SavedTalentSpecList currentList = new SavedTalentSpecList(); currentList.AddRange(savedSpecs); currentList.Add(current); SavedCombo.ItemsSource = null; SavedCombo.ItemsSource = currentList; SavedCombo.SelectedItem = current; SaveDeleteButton.Content = "Save"; } updating = false; }