static void Postfix(LevelUpState __instance, UnitDescriptor unit, LevelUpState.CharBuildMode mode) { if (IsAvailable() && Core.Mod.IsLevelLocked) { //__instance.SetFieldValue(nameof(LevelUpState.NextLevel), unit.Progression.CharacterLevel); __instance.AttributePoints = 0; } }
public static void Postfix(UnitDescriptor unit, LevelUpState.CharBuildMode mode, ref LevelUpState __instance) { if (__instance.IsFirstCharacterLevel) { if (mode != CharBuildMode.PreGen) { // Kludge - there is some wierdness where the unit in the character generator does not return IsCustomCharacter() as true during character creation so I have to check the blueprint. The thing is if I actually try to get the blueprint name the game crashes so I do this kludge calling unit.Blueprint.ToString() bool isCustom = unit.Blueprint.ToString() == "CustomCompanion"; //Logger.Log($"unit.Blueprint: {unit.Blueprint.ToString()}"); //Logger.Log($"not pregen - isCust: {isCustom}"); int pointCount = Math.Max(0, isCustom ? settings.characterCreationAbilityPointsMerc : settings.characterCreationAbilityPointsPlayer); //Logger.Log($"points: {pointCount}"); __instance.StatsDistribution.Start(pointCount); } } }
static void Prefix(LevelUpController __instance, UnitDescriptor unit, bool autoCommit, LevelUpState.CharBuildMode mode) { if (IsAvailable() && unit.Progression.CharacterLevel > 0 && unit.IsPlayerFaction && !unit.IsPet && !autoCommit && mode != LevelUpState.CharBuildMode.PreGen) { Core.Mod.IsLevelLocked = true; } else if (Core.Enabled) { Core.Mod.IsLevelLocked = false; } }
private TestLevelUpController([NotNull] UnitDescriptor unit, bool autoCommit, [CanBeNull] JToken unitJson, LevelUpState.CharBuildMode mode) { this.LevelUpActions = new List <ILevelUpAction>(); this.Unit = unit; this.AutoCommit = autoCommit; if (this.AutoCommit) { this.Preview = unit; } else { this.StartPreviewThread(unitJson); this.Preview = this.RequestPreview(); } this.State = new LevelUpState(this.Preview, mode); if ((this.State.Mode == LevelUpState.CharBuildMode.CharGen && !this.AutoCommit) || this.State.Mode == LevelUpState.CharBuildMode.Respec) { this.Doll = new DollState(); } this.ApplyLevelUpPlan(false); }
public static TestLevelUpController Start([NotNull] UnitDescriptor unit, bool instantCommit = false, [CanBeNull] JToken unitJson = null, Action onSuccess = null, LevelUpState.CharBuildMode mode = LevelUpState.CharBuildMode.LevelUp) { return(new TestLevelUpController(unit, instantCommit, unitJson, mode) { m_OnSuccess = onSuccess }); }
static void Prefix(LevelUpController __instance, UnitDescriptor unit, bool autoCommit, JToken unitJson, LevelUpState.CharBuildMode mode) { if (Core.Enabled) { Core.Debug($"{nameof(LevelUpController)}..ctor({unit}, {(autoCommit ? "isAutoCommit" : "notAutoCommit")}, {unitJson?.Type}, {mode})"); } }
public void HandleLevelUpStart(UnitDescriptor unit, [CanBeNull] JToken unitJson = null, Action onSuccess = null, LevelUpState.CharBuildMode mode = LevelUpState.CharBuildMode.LevelUp) { #if (DEBUG) Mod.Debug(MethodBase.GetCurrentMethod()); Mod.Debug(mode.ToString()); #endif if (mode == LevelUpState.CharBuildMode.CharGen || mode == LevelUpState.CharBuildMode.Respec) { Attach(); } }