Exemple #1
0
        public void postDeserializeInitialization()
        {
            for (int i = this.RunestoneInstances.Count - 1; i >= 0; i--)
            {
                if (((this.RunestoneInstances[i] == null) || string.IsNullOrEmpty(this.RunestoneInstances[i].Id)) || (ConfigRunestones.GetRunestoneData(this.RunestoneInstances[i].Id) == null))
                {
                    this.RunestoneInstances.RemoveAt(i);
                }
            }
            IEnumerator enumerator = Enum.GetValues(typeof(RunestoneSelectionSource)).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    RunestoneSelectionSource current = (RunestoneSelectionSource)((int)enumerator.Current);
                    if (current != RunestoneSelectionSource.None)
                    {
                        for (int m = 0; m < ConfigSkills.ACTIVE_HERO_SKILLS.Count; m++)
                        {
                            bool      flag = false;
                            SkillType type = ConfigSkills.ACTIVE_HERO_SKILLS[m];
                            for (int n = this.SelectedRunestones.Count - 1; n >= 0; n--)
                            {
                                RunestoneSelection selection = this.SelectedRunestones[n];
                                if ((type == ConfigRunestones.GetSkillTypeForRunestone(selection.Id)) && (current == selection.Source))
                                {
                                    if (flag)
                                    {
                                        this.SelectedRunestones.RemoveAt(n);
                                    }
                                    flag = true;
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable == null)
                {
                }
                disposable.Dispose();
            }
            this.refreshRunestoneSelections();
            for (int j = 0; j < this.RunestoneInstances.Count; j++)
            {
                this.RunestoneInstances[j].postDeserializeInitialization();
            }
            for (int k = 0; k < this.SelectedRunestones.Count; k++)
            {
                this.SelectedRunestones[k].postDeserializeInitialization();
            }
        }
Exemple #2
0
 public bool isRunestoneSelected(string runestoneId, RunestoneSelectionSource source)
 {
     for (int i = 0; i < this.SelectedRunestones.Count; i++)
     {
         RunestoneSelection selection = this.SelectedRunestones[i];
         if ((selection.Id == runestoneId) && (selection.Source == source))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #3
0
 public string getSelectedRunestoneId(SkillType skillType, RunestoneSelectionSource source)
 {
     if (skillType != SkillType.NONE)
     {
         for (int i = 0; i < this.SelectedRunestones.Count; i++)
         {
             RunestoneSelection selection = this.SelectedRunestones[i];
             if ((skillType == ConfigRunestones.GetSkillTypeForRunestone(selection.Id)) && (source == selection.Source))
             {
                 return(selection.Id);
             }
         }
     }
     return(null);
 }
Exemple #4
0
 public List <RunestoneSelection> getRunestoneSelectionsForSkillType(SkillType skillType, [Optional, DefaultParameterValue(0)] RunestoneSelectionSource source)
 {
     sm_tempList.Clear();
     if (skillType != SkillType.NONE)
     {
         for (int i = 0; i < this.SelectedRunestones.Count; i++)
         {
             RunestoneSelection item = this.SelectedRunestones[i];
             if (((source == RunestoneSelectionSource.None) || (item.Source == source)) && (skillType == ConfigRunestones.GetSkillTypeForRunestone(item.Id)))
             {
                 sm_tempList.Add(item);
             }
         }
     }
     return(sm_tempList);
 }
Exemple #5
0
 private static void PlayerMigrate_v6_to_v7(Player player)
 {
     if (player.HasPurchasedStarterBundle)
     {
         PetInstance item = new PetInstance();
         item.CharacterId = "Pet001";
         item.Level       = 1;
         player.Pets.Instances.Add(item);
     }
     for (int i = 0; i < player.Runestones.SelectedRunestoneIds.Count; i++)
     {
         RunestoneSelection selection = new RunestoneSelection();
         selection.Id     = player.Runestones.SelectedRunestoneIds[i];
         selection.Source = RunestoneSelectionSource.Player;
         player.Runestones.SelectedRunestones.Add(selection);
     }
     player.Runestones.SelectedRunestoneIds.Clear();
 }
Exemple #6
0
        public void refreshRunestoneSelections()
        {
            PetInstance instance = this.Player.Pets.getSelectedPetInstance();

            if (instance == null)
            {
                for (int i = this.SelectedRunestones.Count - 1; i >= 0; i--)
                {
                    if (this.SelectedRunestones[i].Source == RunestoneSelectionSource.Pet)
                    {
                        this.SelectedRunestones.RemoveAt(i);
                    }
                }
            }
            else
            {
                GatedPerkContainer fixedPerks = GameLogic.Binder.CharacterResources.getResource(instance.CharacterId).FixedPerks;
                for (int j = 0; j < ConfigSkills.ACTIVE_HERO_SKILLS.Count; j++)
                {
                    SkillType skillType         = ConfigSkills.ACTIVE_HERO_SKILLS[j];
                    string    runestoneId       = this.getSelectedRunestoneId(skillType, RunestoneSelectionSource.Pet);
                    string    linkedToRunestone = null;
                    for (int m = 0; m < fixedPerks.Entries.Count; m++)
                    {
                        if (fixedPerks.isPerkUnlocked(instance.Level, m))
                        {
                            PerkType type = fixedPerks.getPerkInstanceAtIndex(m).Type;
                            ConfigPerks.SharedData data = ConfigPerks.SHARED_DATA[type];
                            if ((data.LinkedToSkill == skillType) && (data.LinkedToRunestone != null))
                            {
                                linkedToRunestone = data.LinkedToRunestone;
                                break;
                            }
                        }
                    }
                    if (runestoneId != linkedToRunestone)
                    {
                        this.SelectedRunestones.Remove(this.getRunestoneSelection(runestoneId));
                        if (linkedToRunestone != null)
                        {
                            RunestoneSelection item = new RunestoneSelection();
                            item.Id     = linkedToRunestone;
                            item.Source = RunestoneSelectionSource.Pet;
                            this.SelectedRunestones.Add(item);
                        }
                    }
                }
                for (int k = 0; k < ConfigSkills.ACTIVE_HERO_SKILLS.Count; k++)
                {
                    SkillType type3 = ConfigSkills.ACTIVE_HERO_SKILLS[k];
                    string    str3  = this.getSelectedRunestoneId(type3, RunestoneSelectionSource.Player);
                    if (str3 != null)
                    {
                        string str4 = this.getSelectedRunestoneId(type3, RunestoneSelectionSource.Pet);
                        if (str3 == str4)
                        {
                            RunestoneSelection selection         = this.getRunestoneSelection(str3);
                            int runestoneOrderNumberForSkillType = ConfigRunestones.GetRunestoneOrderNumberForSkillType(str3, type3);
                            selection.Id = ConfigRunestones.GetRunestoneId(type3, runestoneOrderNumberForSkillType + 1);
                        }
                    }
                }
            }
        }
Exemple #7
0
        public RunestoneSelectionSource getRunestoneSelectionSource(string runestoneId)
        {
            RunestoneSelection selection = this.getRunestoneSelection(runestoneId);

            return((selection == null) ? RunestoneSelectionSource.None : selection.Source);
        }