Esempio n. 1
0
            public static bool Prefix([NotNull] LevelUpState state, [NotNull] UnitDescriptor unit, [NotNull] BlueprintProgression progression)
            {
                if (!settings.toggleMulticlass)
                {
                    return(false);
                }
                ProgressionData progressionData = unit.Progression.SureProgressionData(progression);
                int             level           = progressionData.Level;
                int             nextLevel       = progressionData.Blueprint.CalcLevel(unit);

                // TODO - this is from the mod but we need to figure out if max level 20 still makes sense with mythic levels
                // int maxLevel = 20 // unit.Progression.CharacterLevel;
                // if (nextLevel > maxLevel)
                //     nextLevel = maxLevel;
                progressionData.Level = nextLevel;
                if (level >= nextLevel || (UnityEngine.Object)progression.ExclusiveProgression != (UnityEngine.Object)null && (UnityEngine.Object)state.SelectedClass != (UnityEngine.Object)progression.ExclusiveProgression)
                {
                    return(false);
                }
                if (!progression.GiveFeaturesForPreviousLevels)
                {
                    level = nextLevel - 1;
                }
                for (int i = level + 1; i <= nextLevel; ++i)
                {
                    if (!AllowProceed(progression))
                    {
                        break;
                    }
                    LevelEntry levelEntry = progressionData.GetLevelEntry(i);
                    LevelUpHelper.AddFeaturesFromProgression(state, unit, levelEntry.Features, (FeatureSource)progression, i);
                }
                return(false);
            }
Esempio n. 2
0
            public static bool Prefix([NotNull] LevelUpState state, [NotNull] UnitDescriptor unit, [NotNull] BlueprintProgression progression)
            {
                if (!settings.toggleMulticlass)
                {
                    return(true);
                }
                var progressionData = unit.Progression.SureProgressionData(progression);
                var level           = progressionData.Level;
                var nextLevel       = progressionData.Blueprint.CalcLevel(unit);

                progressionData.Level = nextLevel;
                // TODO - this is from the mod but we need to figure out if max level 20 still makes sense with mythic levels
                // int maxLevel = 20 // unit.Progression.CharacterLevel;
                // if (nextLevel > maxLevel)
                //     nextLevel = maxLevel;
                Mod.Debug($"LevelUpHelper_UpdateProgression_Patch - {unit.CharacterName.orange()} - class: {state.SelectedClass} level: {level} nextLvl: {nextLevel}");
                if (level >= nextLevel || progression.ExclusiveProgression != null && state.SelectedClass != progression.ExclusiveProgression)
                {
                    return(false);
                }
                if (!progression.GiveFeaturesForPreviousLevels)
                {
                    level = nextLevel - 1;
                }
                for (var lvl = level + 1; lvl <= nextLevel; ++lvl)
                {
                    //                    if (!AllowProceed(progression)) break;
                    var levelEntry = progressionData.GetLevelEntry(lvl);
                    Mod.Debug($"    LevelUpHelper_UpdateProgression_Patch - {string.Join(", ", levelEntry.Features.Select(f => f.name.yellow()))}");

                    LevelUpHelper.AddFeaturesFromProgression(state, unit, levelEntry.Features, (FeatureSource)progression, lvl);
                }
                return(false);
            }