Beispiel #1
0
        public static SavedPetTalentSpecList SpecsFor(PETFAMILYTREE petClass)
        {
            SavedPetTalentSpecList ret = new SavedPetTalentSpecList();

            foreach (SavedPetTalentSpec sts in AllSpecs)
            {
                if (sts.Class == petClass)
                {
                    ret.Add(sts);
                }
            }
            return(ret);
        }
Beispiel #2
0
 public static void Load(TextReader reader)
 {
     try
     {
         System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(SavedPetTalentSpecList));
         AllSpecs = (SavedPetTalentSpecList)serializer.Deserialize(reader);
         reader.Close();
     }
     catch { }
     finally
     {
         reader.Close();
         if (AllSpecs == null)
         {
             AllSpecs = new SavedPetTalentSpecList();
         }
     }
 }
        public FormSavePetTalentSpec(PetTalentsBase spec, PETFAMILYTREE newClass, int tree)
        {
            InitializeComponent();
            PetTalents            = spec;
            Tree                  = tree;
            Class                 = newClass;
            CB_Trees.SelectedItem = Class;

            SavedPetTalentSpecList saved = SavedPetTalentSpec.SpecsFor(Class);

            if (saved.Count > 0)
            {
                CB_TalentSpecs.ItemsSource   = saved;
                CB_TalentSpecs.SelectedIndex = 0;
            }
            else
            {
                CB_TalentSpecs.IsEnabled = false;
            }
        }
Beispiel #4
0
        private void UpdateSavedSpecs()
        {
            SavedPetTalentSpecList savedSpecs = SavedPetTalentSpec.SpecsFor(ArmoryPet.FamilyToTree[CalcOpts.PetFamily]);
            SavedPetTalentSpec     current    = null;

            updating = true;
            foreach (SavedPetTalentSpec sts in savedSpecs)
            {
                if (sts.Equals(CalcOpts.PetTalents))
                {
                    current = sts;
                    break;
                }
            }

            if (current != null)
            {
                HasCustomSpec            = false;
                SavedCombo.ItemsSource   = savedSpecs;
                SavedCombo.SelectedItem  = current;
                SaveDeleteButton.Content = "Delete";
            }
            else
            {
                PETFAMILYTREE ftree   = ArmoryPet.FamilyToTree[CalcOpts.PetFamily];
                int           treepts = (ftree == PETFAMILYTREE.Cunning  ? Tree1.Points() :
                                         (ftree == PETFAMILYTREE.Ferocity ? Tree2.Points() :
                                          (ftree == PETFAMILYTREE.Tenacity ? Tree3.Points() :
                                           Tree1.Points() + Tree2.Points() + Tree3.Points())));
                HasCustomSpec = true;
                current       = new SavedPetTalentSpec("Custom", CalcOpts.PetTalents, ftree, treepts);
                SavedPetTalentSpecList currentList = new SavedPetTalentSpecList();
                currentList.AddRange(savedSpecs);
                currentList.Add(current);
                SavedCombo.ItemsSource   = null;
                SavedCombo.ItemsSource   = currentList;
                SavedCombo.SelectedItem  = current;
                SaveDeleteButton.Content = "Save";
            }
            updating = false;
        }