From 5b4f8f5dba1557f4f12319cd418676596a737a8a Mon Sep 17 00:00:00 2001 From: ThyWoof Date: Wed, 18 May 2022 09:21:22 -0700 Subject: [PATCH 1/3] fix witch not offering ritual spells --- .../RitualAndAutoPreparedSpells/RulesetCharacterHeroPatcher.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/SolastaCommunityExpansion/Patches/CustomFeatures/RitualAndAutoPreparedSpells/RulesetCharacterHeroPatcher.cs b/SolastaCommunityExpansion/Patches/CustomFeatures/RitualAndAutoPreparedSpells/RulesetCharacterHeroPatcher.cs index d2e63723f1..6a67362ce7 100644 --- a/SolastaCommunityExpansion/Patches/CustomFeatures/RitualAndAutoPreparedSpells/RulesetCharacterHeroPatcher.cs +++ b/SolastaCommunityExpansion/Patches/CustomFeatures/RitualAndAutoPreparedSpells/RulesetCharacterHeroPatcher.cs @@ -21,6 +21,7 @@ internal static void Postfix(RulesetCharacterHero __instance, RuleDefinitions.Ri } var spellRepertoire = __instance.SpellRepertoires + .Where(r => r.SpellCastingFeature.SpellCastingOrigin != FeatureDefinitionCastSpell.CastingOrigin.Race) .Where(r => r.SpellCastingFeature.SpellReadyness == RuleDefinitions.SpellReadyness.AllKnown) .FirstOrDefault(r => r.SpellCastingFeature.SpellKnowledge == RuleDefinitions.SpellKnowledge.Selection); From fa5bcfa7123a8440e5239845a767333cbf36846d Mon Sep 17 00:00:00 2001 From: ThyWoof Date: Wed, 18 May 2022 12:14:02 -0700 Subject: [PATCH 2/3] fix char creation getting level 2 features --- SolastaCommunityExpansion/Info.json | 2 +- .../CharacterStageClassSelectionPanelPatcher.cs | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/SolastaCommunityExpansion/Info.json b/SolastaCommunityExpansion/Info.json index ef4b3d308f..dd72d594da 100644 --- a/SolastaCommunityExpansion/Info.json +++ b/SolastaCommunityExpansion/Info.json @@ -2,7 +2,7 @@ "Id": "SolastaCommunityExpansion", "DisplayName": "Community Expansion", "Author": "SolastaMods", - "Version": "1.3.55.1", + "Version": "1.3.55.2", "GameVersion": "1.3.55", "ManagerVersion": "0.23.4", "AssemblyName": "SolastaCommunityExpansion.dll", diff --git a/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/CharacterStageClassSelectionPanelPatcher.cs b/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/CharacterStageClassSelectionPanelPatcher.cs index a953ab2a82..62044f51c2 100644 --- a/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/CharacterStageClassSelectionPanelPatcher.cs +++ b/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/CharacterStageClassSelectionPanelPatcher.cs @@ -74,14 +74,20 @@ public static int Level(FeatureUnlockByLevel featureUnlockByLevel, RulesetCharac var isLevelingUp = LevelUpContext.IsLevelingUp(hero); var selectedClass = LevelUpContext.GetSelectedClass(hero); - if (isLevelingUp - && hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels) - && featureUnlockByLevel.Level != (levels + 1)) + if (isLevelingUp) { - return int.MaxValue; + if (hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels) + && featureUnlockByLevel.Level != (levels + 1)) + { + return int.MaxValue; + } + else + { + return featureUnlockByLevel.Level - 1; + } } - return featureUnlockByLevel.Level - 1; + return featureUnlockByLevel.Level; } internal static IEnumerable Transpiler(IEnumerable instructions) From 7f4a86495467c107630a94553942503c57ebf689 Mon Sep 17 00:00:00 2001 From: ThyWoof Date: Wed, 18 May 2022 16:11:06 -0700 Subject: [PATCH 3/3] fix glitches on char panel UI and creation UI --- .../CharacterInspectionScreenPatcher.cs | 15 +++++++++++++-- .../LevelUp/ArchetypesPreviewModalPatcher.cs | 3 ++- .../LevelUp/HigherLevelFeaturesModalPatcher.cs | 9 ++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/SolastaCommunityExpansion/Patches/GameUi/CharacterInspection/CharacterInspectionScreenPatcher.cs b/SolastaCommunityExpansion/Patches/GameUi/CharacterInspection/CharacterInspectionScreenPatcher.cs index 60681664dc..5e544d3910 100644 --- a/SolastaCommunityExpansion/Patches/GameUi/CharacterInspection/CharacterInspectionScreenPatcher.cs +++ b/SolastaCommunityExpansion/Patches/GameUi/CharacterInspection/CharacterInspectionScreenPatcher.cs @@ -25,7 +25,7 @@ internal static void Prefix() [SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Patch")] internal static class CharacterInspectionScreen_Bind { - internal static void Postfix( + internal static void Prefix( RulesetCharacterHero heroCharacter, CharacterPlateDetailed ___characterPlate, ToggleGroup ___toggleGroup) @@ -43,7 +43,18 @@ internal static void Postfix( [SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Patch")] internal static class CharacterInspectionScreen_Unbind { - internal static void Postfix() + internal static void Prefix() + { + Global.InspectedHero = null; + } + } + + // reset the inspection context for MC heroes + [HarmonyPatch(typeof(CharacterInspectionScreen), "DoClose")] + [SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Patch")] + internal static class CharacterInspectionScreen_DoClose + { + internal static void Prefix() { Global.InspectedHero = null; } diff --git a/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/ArchetypesPreviewModalPatcher.cs b/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/ArchetypesPreviewModalPatcher.cs index c2a3efe9aa..9eb28c3b3b 100644 --- a/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/ArchetypesPreviewModalPatcher.cs +++ b/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/ArchetypesPreviewModalPatcher.cs @@ -17,7 +17,8 @@ public static int Level(FeatureUnlockByLevel featureUnlockByLevel) var isLevelingUp = LevelUpContext.IsLevelingUp(hero); var selectedClass = LevelUpContext.GetSelectedClass(hero); - if (isLevelingUp && hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels) + if (isLevelingUp + && hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels) && featureUnlockByLevel.Level <= levels + 1) { return int.MaxValue; diff --git a/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/HigherLevelFeaturesModalPatcher.cs b/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/HigherLevelFeaturesModalPatcher.cs index 81e17aa6fd..4030ea035d 100644 --- a/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/HigherLevelFeaturesModalPatcher.cs +++ b/SolastaCommunityExpansion/Patches/Multiclass/LevelUp/HigherLevelFeaturesModalPatcher.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using HarmonyLib; +using SolastaCommunityExpansion.Models; namespace SolastaCommunityExpansion.Patches.Multiclass.LevelUp { @@ -10,10 +11,12 @@ internal static class HigherLevelFeaturesModal_Bind { internal static void Prefix(ref int achievementLevel) { - var hero = Models.Global.ActiveLevelUpHero; - var selectedClass = Models.LevelUpContext.GetSelectedClass(hero); + var hero = Global.ActiveLevelUpHero; + var isLevelingUp = LevelUpContext.IsLevelingUp(hero); + var selectedClass = LevelUpContext.GetSelectedClass(hero); - if (hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels)) + if (isLevelingUp + && hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels)) { achievementLevel = levels + 1; }