From a367db481a736b029bbf275bb4d5218ff5a25d0b Mon Sep 17 00:00:00 2001 From: Alexey Chernyshov <65975574+artifixer@users.noreply.github.com> Date: Tue, 14 May 2024 23:52:10 +0300 Subject: [PATCH 1/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 08ca3511..c3d6e4a6 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Extension library for Mount & Blade II: Bannerlord. * [SaveSystem](https://butr.github.io/Bannerlord.ButterLib/articles/SaveSystem/Overview.html) - Provides helper methods for the game's save system. * [SubModuleWrappers](https://butr.github.io/Bannerlord.ButterLib/articles/SubModuleWrappers/Overview.html) - Wraps MBSubModulebase for easier calling of protected internal metods. * [DependencyInjection](https://butterlib.butr.link/articles/Optional/DependencyInjection/Overview.html) - Tools to work with ButterLib subsystems and services. -* [Logging]([https://butterlib.butr.link/articles/Optional/DependencyInjection/Overview.html](https://butterlib.butr.link/articles/Optional/Logging/Overview.html)) - Access to Serilog logging through ILogger Interface. +* [Logging](https://butterlib.butr.link/articles/Optional/Logging/Overview.html) - Access to Serilog logging through ILogger Interface. Check the [/Articles](https://butr.github.io/Bannerlord.ButterLib/articles/index.html) section in the documentation to see all available features! From 360b62c12f019caf595736f6b6a89f0e7cba26ee Mon Sep 17 00:00:00 2001 From: Alexey Chernyshov <65975574+artifixer@users.noreply.github.com> Date: Tue, 14 May 2024 23:52:58 +0300 Subject: [PATCH 2/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3d6e4a6..ebb22771 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Extension library for Mount & Blade II: Bannerlord. Check the [/Articles](https://butr.github.io/Bannerlord.ButterLib/articles/index.html) section in the documentation to see all available features! ### Outdated features: -* [AssemblyVerifier]([https://butr.github.io/Bannerlord.ButterLib/articles/CampaignIdentifier/Overview.html](https://butterlib.butr.link/articles/AssemblyVerifier/Overview.html)) - Basic assembly compatibility checks. +* [AssemblyVerifier](https://butterlib.butr.link/articles/AssemblyVerifier/Overview.html) - Basic assembly compatibility checks. * [CampaignIdentifier](https://butr.github.io/Bannerlord.ButterLib/articles/CampaignIdentifier/Overview.html) - Associates unique string ID with every campaign based on the initial character. ## Installation From 4bb15ac31cf6ed21944111379972e21e8dcdd38b Mon Sep 17 00:00:00 2001 From: Alexey Chernyshov <65975574+artifixer@users.noreply.github.com> Date: Wed, 15 May 2024 00:13:04 +0300 Subject: [PATCH 3/9] Update Overview.md --- docs/articles/DelayedSubModule/Overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/articles/DelayedSubModule/Overview.md b/docs/articles/DelayedSubModule/Overview.md index 140e260c..5713a83a 100644 --- a/docs/articles/DelayedSubModule/Overview.md +++ b/docs/articles/DelayedSubModule/Overview.md @@ -45,5 +45,5 @@ protected override void OnBeforeInitialModuleScreenSetAsRoot() ## Note: * If for some reason your Module will load after the Module that you subscribed to, the delegate you passed in ``Subscribe`` will be executed immediately. -* If a derived [``MBSubModuleBase``](https://apidoc.bannerlord.com/v/1.2.7/class_tale_worlds_1_1_mount_and_blade_1_1_m_b_sub_module_base.html) class overrides the method you subcsribe to and calls the base.Method(), you will get two calls, one from the override and one from calling the empty virtual method. Don't forget to filter by [``SubscriptionEventArgs.IsBase``](xref:Bannerlord.ButterLib.DelayedSubModule.SubscriptionEventArgs#collapsible-Bannerlord_ButterLib_DelayedSubModule_SubscriptionEventArgs_IsBase). +* If a derived [``MBSubModuleBase``](xref:TaleWorlds.MountAndBlade.MBSubModuleBase) class overrides the method you subcsribe to and calls the base.Method(), you will get two calls, one from the override and one from calling the empty virtual method. Don't forget to filter by [``SubscriptionEventArgs.IsBase``](xref:Bannerlord.ButterLib.DelayedSubModule.SubscriptionEventArgs#collapsible-Bannerlord_ButterLib_DelayedSubModule_SubscriptionEventArgs_IsBase). * The current implementation does not allow to subscribe to methods e.g. ``OnBeforeInitialModuleScreenSetAsRoot()`` outside the ``OnBeforeInitialModuleScreenSetAsRoot()`` override. You will not be able to subscribe to ``OnBeforeInitialModuleScreenSetAsRoot()`` in ``OnSubModuleLoad()`` override and vise-versa. From 3f203770f98751f71ad4b7f927b93a10053bc40f Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Sat, 25 May 2024 18:50:41 +0300 Subject: [PATCH 4/9] Update publish.yml --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0e246371..a722b3c5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -122,7 +122,7 @@ jobs: artifact_name: bannerlord secrets: NEXUSMODS_APIKEY: ${{ secrets.ARAGAS_NEXUSMODS_API_KEY }} - NEXUSMODS_COOKIES: ${{ secrets.ARAGAS_NEXUSMODS_COOKIE_SID_DEVELOP }} + NEXUSMOD_SESSION_COOKIE: ${{ secrets.ARAGAS_NEXUSMOD_SESSION_COOKIE }} ########################### # STEAM # From 58cf910fd223ba2b34f3f9630079b1b55a4087bd Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Sun, 26 May 2024 01:36:17 +0300 Subject: [PATCH 5/9] Update publish.yml --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a722b3c5..1f5983ed 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -122,7 +122,7 @@ jobs: artifact_name: bannerlord secrets: NEXUSMODS_APIKEY: ${{ secrets.ARAGAS_NEXUSMODS_API_KEY }} - NEXUSMOD_SESSION_COOKIE: ${{ secrets.ARAGAS_NEXUSMOD_SESSION_COOKIE }} + NEXUSMODS_SESSION_COOKIE: ${{ secrets.ARAGAS_NEXUSMODS_SESSION_COOKIE }} ########################### # STEAM # From a313b1a606afa5b39a7647a2087ffb557b8b1520 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 04:14:31 +0000 Subject: [PATCH 6/9] Bump danielpalme/ReportGenerator-GitHub-Action from 5.2.4 to 5.3.6 Bumps [danielpalme/ReportGenerator-GitHub-Action](https://github.com/danielpalme/reportgenerator-github-action) from 5.2.4 to 5.3.6. - [Release notes](https://github.com/danielpalme/reportgenerator-github-action/releases) - [Commits](https://github.com/danielpalme/reportgenerator-github-action/compare/5.2.4...5.3.6) --- updated-dependencies: - dependency-name: danielpalme/ReportGenerator-GitHub-Action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/test-full.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-full.yml b/.github/workflows/test-full.yml index 544e66f6..9ba95112 100644 --- a/.github/workflows/test-full.yml +++ b/.github/workflows/test-full.yml @@ -71,7 +71,7 @@ jobs: shell: pwsh - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4 + uses: danielpalme/ReportGenerator-GitHub-Action@5.3.6 with: reports: '*.xml' targetdir: 'coveragereport' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1debf37..a3312e8f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -77,7 +77,7 @@ jobs: shell: pwsh - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4 + uses: danielpalme/ReportGenerator-GitHub-Action@5.3.6 with: reports: 'coverage_butterlib_stable_debug.xml;coverage_butterlib_stable_release.xml;coverage_butterlib_impl_stable_debug.xml;coverage_butterlib_impl_stable_release.xml;coverage_butterlib_impl_beta_debug.xml;coverage_butterlib_impl_beta_release.xml;' targetdir: 'coveragereport' From d8616d921f879e84acc553915fedbbdbb2b67b4c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Jun 2024 04:27:41 +0000 Subject: [PATCH 7/9] Bump codecov/codecov-action from 4.3.0 to 4.5.0 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.3.0 to 4.5.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4.3.0...v4.5.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/test-full.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-full.yml b/.github/workflows/test-full.yml index 544e66f6..44d81f61 100644 --- a/.github/workflows/test-full.yml +++ b/.github/workflows/test-full.yml @@ -86,7 +86,7 @@ jobs: path: coveragereport - name: Upload ReportGenerator to CodeCov - uses: codecov/codecov-action@v4.3.0 + uses: codecov/codecov-action@v4.5.0 with: token: ${{secrets.CODECOV_TOKEN}} file: coveragereport/Cobertura.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1debf37..63f35311 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -92,7 +92,7 @@ jobs: path: coveragereport - name: Upload ReportGenerator to CodeCov - uses: codecov/codecov-action@v4.3.0 + uses: codecov/codecov-action@v4.5.0 with: token: ${{secrets.CODECOV_TOKEN}} file: coveragereport/Cobertura.xml From 700da6a68288c3994b1d84728fcf91212aa3684a Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Tue, 18 Jun 2024 14:26:33 +0300 Subject: [PATCH 8/9] Fixed SyncAsJson not serializing game types --- changelog.txt | 4 ++++ .../Patches/ModulePatch.cs | 6 ++++-- .../ObjectSystem/MBObjectFinder.cs | 21 ++++++++++++++----- .../Extensions/IDataStoreExtensions.cs | 2 +- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3a6d9f51..8d0caf23 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,8 @@ --------------------------------------------------------------------------------------------------- +Version: 2.9.9 +Game Versions: v1.0.x,v1.1.x,v1.2.x +* Fixed SyncAsJson not serializing game types +--------------------------------------------------------------------------------------------------- Version: 2.9.8 Game Versions: v1.0.x,v1.1.x,v1.2.x * Improvements to DistanceMatrix diff --git a/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/Patches/ModulePatch.cs b/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/Patches/ModulePatch.cs index 7b3eeed6..f82420e0 100644 --- a/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/Patches/ModulePatch.cs +++ b/src/Bannerlord.ButterLib.Implementation/MBSubModuleBaseExtended/Patches/ModulePatch.cs @@ -81,8 +81,10 @@ public static IEnumerable Transpiler(IEnumerable? CampaignObjectTypeObjects = + private static readonly AccessTools.FieldRef? CampaignObjectTypeObjects = AccessTools2.FieldRefAccess("_objects"); private static readonly Type? ICampaignObjectTypeType = - AccessTools2.TypeByName("TaleWorlds.CampaignSystem.CampaignObjectManager.ICampaignObjectType"); + AccessTools2.TypeByName("TaleWorlds.CampaignSystem.CampaignObjectManager+ICampaignObjectType"); private static readonly MethodInfo? ObjectClassGetter = AccessTools2.PropertyGetter(ICampaignObjectTypeType!, "ObjectClass"); private static MBObjectBase? FindCampaignObjectManager(MBGUID id, Type type) { - foreach (var cot in CampaignObjectTypeObjects?.Invoke(Campaign.Current.CampaignObjectManager) ?? Array.Empty()) + // Not sure this piece if code ever worked, but keeping it just in case of edgecases + foreach (var cot in CampaignObjectTypeObjects?.Invoke(Campaign.Current.CampaignObjectManager) ?? []) { - if (type == ObjectClassGetter?.Invoke(cot, Array.Empty()) as Type && cot is IEnumerable en && en.FirstOrDefault(o => o.Id == id) is { } result) + if (cot is null) continue; + + if (ObjectClassGetter?.Invoke(cot, []) is Type objType && objType == type && cot is IEnumerable en && en.FirstOrDefault(o => o.Id == id) is { } result) { return result; } } - return null; + + try + { + return MBObjectManager.Instance.GetObject(id); + } + catch (Exception) + { + return null; + } } public MBObjectBase? Find(MBGUID id, Type? type = null) diff --git a/src/Bannerlord.ButterLib/SaveSystem/Extensions/IDataStoreExtensions.cs b/src/Bannerlord.ButterLib/SaveSystem/Extensions/IDataStoreExtensions.cs index 46b3789c..1ce47fa4 100644 --- a/src/Bannerlord.ButterLib/SaveSystem/Extensions/IDataStoreExtensions.cs +++ b/src/Bannerlord.ButterLib/SaveSystem/Extensions/IDataStoreExtensions.cs @@ -86,7 +86,7 @@ public static bool SyncDataAsJson(this IDataStore dataStore, string key, ref var jsonDataChunks = Array.Empty(); if (dataStore.SyncData(key, ref jsonDataChunks)) { - var (format, jsonData) = JsonConvert.DeserializeObject(ChunksToString(jsonDataChunks ?? Array.Empty())) ?? new(-1, string.Empty); + var (format, jsonData) = JsonConvert.DeserializeObject(ChunksToString(jsonDataChunks ?? [])) ?? new(-1, string.Empty); data = format switch { 2 => Deserialize(jsonData, serializer), From eede47ab1db108c5b2be8b5e16bd27080cb4ec3c Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Tue, 18 Jun 2024 14:29:37 +0300 Subject: [PATCH 9/9] Release --- build/common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.props b/build/common.props index 2951849e..8880471c 100644 --- a/build/common.props +++ b/build/common.props @@ -5,7 +5,7 @@ 1.0.0 - 2.9.8 + 2.9.9 2.2.2 3.2.0.77