private static bool Prefix(CharGenClassPhaseVM __instance, BlueprintArchetype archetype) { if (!settings.toggleMultiArchetype) { return(true); } __instance.UpdateTooltipTemplate(false); if (__instance.LevelUpController.State.SelectedClass == null) { return(false); } var Progression = __instance.LevelUpController.Preview.Progression; var classData = __instance.LevelUpController.Preview .Progression.GetClassData(__instance.LevelUpController.State.SelectedClass); if (classData != null && (archetype == null || !Progression.CanAddArchetype(classData.CharacterClass, archetype))) { classData.Archetypes.ForEach(delegate(BlueprintArchetype a) { __instance.LevelUpController.RemoveArchetype(a); }); } if (archetype != null) { __instance.LevelUpController.RemoveArchetype(archetype); if (!__instance.LevelUpController.AddArchetype(archetype)) { MainThreadDispatcher.Post(delegate(object _) { __instance.SelectedArchetypeVM.Value = null; }, null); } } __instance.UpdateClassInformation(); return(false); }
private static void Postfix(CharGenClassPhaseVM __instance) { if (!settings.toggleMultiArchetype) { return; } Mod.Debug("CharGenClassPhaseVM::UpdateClassInformation"); var controller = Game.Instance?.LevelUpController; if (controller == null) { return; } var classData = controller.Preview?.Progression?.GetClassData(__instance.SelectedClassVM.Value?.Class); if (classData == null) { return; } Mod.Debug("Made it to override"); var classSkills = classData.Archetypes.SelectMany(a => a.ClassSkills) .Concat(classData.CharacterClass.ClassSkills).Distinct().ToArray(); //this.SelectedClassVM.Value.Class.Name + " — " + this.SelectedArchetypeVM.Value.Archetype.Name; var archetypeName = classData.ArchetypesName(); if (!string.IsNullOrEmpty(archetypeName)) { __instance.ClassDisplayName.Value = string.Join(" ", classData.CharacterClass.Name, $"({archetypeName})"); } var archetypeDrescription = string.Join("\n\n", classData.Archetypes.Select(a => a.Description)); if (!string.IsNullOrEmpty(archetypeName)) { __instance.ClassDescription.Value = archetypeDrescription; } return; }