From 0c7cd6f0af14b432b6a634813f815546bb5dadcf Mon Sep 17 00:00:00 2001 From: Sean Petrie Date: Fri, 28 Jun 2024 21:44:29 -0500 Subject: [PATCH] Updated DLC handling --- CHANGELOG.md | 3 +++ Repository.json | 2 +- TabletopTweaks-Core/Info.json | 2 +- TabletopTweaks-Core/Utilities/DLCTools.cs | 22 +++++++++++++--------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8f25dd..00f0384 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## Version 0.7.6 +* Updates to DLC handling + ## Version 0.7.5 * RuleCalculateArmorAC introduced diff --git a/Repository.json b/Repository.json index 2bfc3fa..2a17c2b 100644 --- a/Repository.json +++ b/Repository.json @@ -2,7 +2,7 @@ "Releases": [ { "Id": "TabletopTweaks-Core", - "Version": "0.7.5" + "Version": "0.7.6" } ] } diff --git a/TabletopTweaks-Core/Info.json b/TabletopTweaks-Core/Info.json index 73a9cc8..51461f3 100644 --- a/TabletopTweaks-Core/Info.json +++ b/TabletopTweaks-Core/Info.json @@ -10,5 +10,5 @@ "Repository": "https://raw.githubusercontent.com/Vek17/TabletopTweaks-Core/master/Repository.json", "Requirements": [], "LoadAfter": [ "MewsiferConsole.Mod" ], - "Version": "0.7.5" + "Version": "0.7.6" } \ No newline at end of file diff --git a/TabletopTweaks-Core/Utilities/DLCTools.cs b/TabletopTweaks-Core/Utilities/DLCTools.cs index 8074be1..5956849 100644 --- a/TabletopTweaks-Core/Utilities/DLCTools.cs +++ b/TabletopTweaks-Core/Utilities/DLCTools.cs @@ -1,4 +1,5 @@ using Kingmaker.DLC; +using Kingmaker.Stores; namespace TabletopTweaks.Core.Utilities { public static class DLCTools { @@ -11,15 +12,18 @@ public static class DLCTools { private static BlueprintDlc Dlc6 = BlueprintTools.GetBlueprint("c2340df3fdaf403baffe824ae7a0a547"); public static bool HasDLC(int number) { - switch (number) { - case 1: return Dlc1.IsAvailable; - case 2: return Dlc2.IsAvailable; - case 3: return Dlc3.IsAvailable; - case 4: return Dlc4.IsAvailable; - case 5: return Dlc5.IsAvailable; - case 6: return Dlc6.IsAvailable; - default: return false; - } + var DLC = number switch { + 1 => Dlc1, + 2 => Dlc2, + 3 => Dlc3, + 4 => Dlc4, + 5 => Dlc5, + 6 => Dlc6, + _ => null + }; + if(DLC == null) { return false; } + StoreManager.RefreshDLCs(new BlueprintDlc[] { DLC }); + return DLC.IsAvailable; } } }