From c5268aa88d408e4bc76955a4c6c555235a5f7717 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 16:36:23 +0000 Subject: [PATCH 01/12] Bump Bannerlord.UIExtenderEx from 2.2.1 to 2.2.5 Bumps [Bannerlord.UIExtenderEx](https://github.com/BUTR/Bannerlord.UIExtenderEx) from 2.2.1 to 2.2.5. - [Release notes](https://github.com/BUTR/Bannerlord.UIExtenderEx/releases) - [Changelog](https://github.com/BUTR/Bannerlord.UIExtenderEx/blob/dev/changelog.txt) - [Commits](https://github.com/BUTR/Bannerlord.UIExtenderEx/compare/v2.2.1...v2.2.5) --- updated-dependencies: - dependency-name: Bannerlord.UIExtenderEx dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build/common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.props b/build/common.props index 0344e105..81e413fd 100644 --- a/build/common.props +++ b/build/common.props @@ -16,7 +16,7 @@ 4.7.3 - 2.2.1 + 2.2.5 2.0.0.82 From 01fa48de7ab709a9f7ace9c7bd13704d5f2ceca1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 16:36:34 +0000 Subject: [PATCH 02/12] Bump Bannerlord.MCM from 4.7.3 to 4.7.7 Bumps [Bannerlord.MCM](https://github.com/Aragas/Bannerlord.MBOptionScreen) from 4.7.3 to 4.7.7. - [Release notes](https://github.com/Aragas/Bannerlord.MBOptionScreen/releases) - [Changelog](https://github.com/Aragas/Bannerlord.MBOptionScreen/blob/dev/changelog.txt) - [Commits](https://github.com/Aragas/Bannerlord.MBOptionScreen/compare/v4.7.3...v4.7.7) --- updated-dependencies: - dependency-name: Bannerlord.MCM dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build/common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.props b/build/common.props index 0344e105..4c8d3c66 100644 --- a/build/common.props +++ b/build/common.props @@ -14,7 +14,7 @@ 2.1.5 - 4.7.3 + 4.7.7 2.2.1 From 61e165b11259e0580abba1110a760602b0d14a11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Jul 2022 16:32:39 +0000 Subject: [PATCH 03/12] Bump Nullable from 1.3.0 to 1.3.1 Bumps [Nullable](https://github.com/manuelroemer/Nullable) from 1.3.0 to 1.3.1. - [Release notes](https://github.com/manuelroemer/Nullable/releases) - [Changelog](https://github.com/manuelroemer/Nullable/blob/master/CHANGELOG.md) - [Commits](https://github.com/manuelroemer/Nullable/commits) --- updated-dependencies: - dependency-name: Nullable dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj b/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj index e2a795ad..55768eee 100644 --- a/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj +++ b/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj @@ -39,7 +39,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 35cb68bb288837cc6bf80bf18e09800d0a9dcf8a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Jul 2022 16:33:40 +0000 Subject: [PATCH 04/12] Bump Bannerlord.ButterLib from 2.1.5 to 2.1.13 Bumps [Bannerlord.ButterLib](https://github.com/BUTR/Bannerlord.ButterLib) from 2.1.5 to 2.1.13. - [Release notes](https://github.com/BUTR/Bannerlord.ButterLib/releases) - [Changelog](https://github.com/BUTR/Bannerlord.ButterLib/blob/dev/changelog.txt) - [Commits](https://github.com/BUTR/Bannerlord.ButterLib/compare/v2.1.5...v2.1.13) --- updated-dependencies: - dependency-name: Bannerlord.ButterLib dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build/common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.props b/build/common.props index 0344e105..4163bca7 100644 --- a/build/common.props +++ b/build/common.props @@ -12,7 +12,7 @@ 2.2.1 - 2.1.5 + 2.1.13 4.7.3 From bebcccc41c98f4b4989042fb6505667e37f45017 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Jul 2022 16:26:02 +0000 Subject: [PATCH 05/12] Bump Bannerlord.ModuleManager.Source from 3.0.97 to 4.0.121 Bumps [Bannerlord.ModuleManager.Source](https://github.com/BUTR/Bannerlord.ModuleManager) from 3.0.97 to 4.0.121. - [Release notes](https://github.com/BUTR/Bannerlord.ModuleManager/releases) - [Commits](https://github.com/BUTR/Bannerlord.ModuleManager/commits) --- updated-dependencies: - dependency-name: Bannerlord.ModuleManager.Source dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- build/common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.props b/build/common.props index 0344e105..3aca7d32 100644 --- a/build/common.props +++ b/build/common.props @@ -20,7 +20,7 @@ 2.0.0.82 - 3.0.97 + 4.0.121 1.0.1.36 From 36f31cf423160de9035789624e0801e0a8d57ae2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 06:38:32 +0000 Subject: [PATCH 06/12] Bump IsExternalInit from 1.0.2 to 1.0.3 Bumps [IsExternalInit](https://github.com/manuelroemer/IsExternalInit) from 1.0.2 to 1.0.3. - [Release notes](https://github.com/manuelroemer/IsExternalInit/releases) - [Changelog](https://github.com/manuelroemer/IsExternalInit/blob/master/CHANGELOG.md) - [Commits](https://github.com/manuelroemer/IsExternalInit/commits) --- updated-dependencies: - dependency-name: IsExternalInit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj b/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj index e2a795ad..e072c726 100644 --- a/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj +++ b/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj @@ -35,11 +35,11 @@ and we need to reference that old version instead of the latest. --> - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 951ff8b2607672aff00101f735e69379669a4d40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 06:38:34 +0000 Subject: [PATCH 07/12] Bump Bannerlord.BUTR.Shared from 2.0.0.82 to 2.0.0.86 Bumps [Bannerlord.BUTR.Shared](https://github.com/BUTR/Bannerlord.BUTR.Shared) from 2.0.0.82 to 2.0.0.86. - [Release notes](https://github.com/BUTR/Bannerlord.BUTR.Shared/releases) - [Commits](https://github.com/BUTR/Bannerlord.BUTR.Shared/commits) --- updated-dependencies: - dependency-name: Bannerlord.BUTR.Shared dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build/common.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/common.props b/build/common.props index 0344e105..01eb2885 100644 --- a/build/common.props +++ b/build/common.props @@ -12,15 +12,15 @@ 2.2.1 - 2.1.5 + 2.1.13 - 4.7.3 + 4.7.7 2.2.1 - 2.0.0.82 + 2.0.0.86 - 3.0.97 + 4.0.121 1.0.1.36 From be094c31bb9cf2588050e23ff8f8bd2d535d15cc Mon Sep 17 00:00:00 2001 From: Benny Zlotnik Date: Tue, 4 Oct 2022 13:22:26 +0300 Subject: [PATCH 08/12] update dependencies --- build/common.props | 1 - 1 file changed, 1 deletion(-) diff --git a/build/common.props b/build/common.props index c4b0b282..6b8b4181 100644 --- a/build/common.props +++ b/build/common.props @@ -26,7 +26,6 @@ 3.1.0.61 - net472 x64 From 5a68f85108e82519bfd53aee5cf1c576c1e33086 Mon Sep 17 00:00:00 2001 From: Benny Zlotnik Date: Tue, 4 Oct 2022 13:22:52 +0300 Subject: [PATCH 09/12] fix teleportation Fix issue where sending a messenger to settlement results in teleporting the player. This is done by essentially by removing the code that enters the settlement and instead just initiates the dialog as if there's no settlement involved --- .../Messengers/MessengerManager.cs | 32 ++++++------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs b/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs index 02447ebf..a6d67241 100644 --- a/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs +++ b/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs @@ -11,6 +11,7 @@ using TaleWorlds.CampaignSystem.Encounters; using TaleWorlds.CampaignSystem.GameState; using TaleWorlds.CampaignSystem.Party; +using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.CampaignSystem.Settlements.Locations; using TaleWorlds.Core; using TaleWorlds.Library; @@ -31,7 +32,7 @@ internal sealed class MessengerManager : IMissionListener private Messenger? _activeMessenger; private Mission? _currentMission; - [SaveableField(1)] [UsedImplicitly] private List _messengers; + [SaveableField(1)][UsedImplicitly] private List _messengers; public MBReadOnlyList Messengers { get; private set; } @@ -184,31 +185,18 @@ public void StartDialogue(Hero targetHero, Messenger messenger) else targetParty = targetHero.PartyBelongedTo?.Party ?? targetHero.BornSettlement?.Party; - var settlement = targetHero.CurrentSettlement; - PlayerEncounter.Start(); PlayerEncounter.Current.SetupFields(heroParty, targetParty ?? heroParty); Campaign.Current.CurrentConversationContext = ConversationContext.Default; - if (settlement != null) - { - PlayerEncounter.EnterSettlement(); - Location locationOfCharacter = LocationComplex.Current.GetLocationOfCharacter(targetHero); - CampaignEventDispatcher.Instance.OnPlayerStartTalkFromMenu(targetHero); - _currentMission = - (Mission) PlayerEncounter.LocationEncounter.CreateAndOpenMissionController(locationOfCharacter, null, targetHero.CharacterObject); - } - else - { - var specialScene = ""; - var sceneLevels = ""; - - _currentMission = (Mission) Campaign.Current.CampaignMissionManager.OpenConversationMission( - new ConversationCharacterData(Hero.MainHero.CharacterObject, heroParty, true), - new ConversationCharacterData(targetHero.CharacterObject, targetParty, true), - specialScene, sceneLevels); - } - + var specialScene = ""; + var sceneLevels = ""; + + // TODO: hack the scene to show the scene of the target instead of the player's + _currentMission = (Mission) Campaign.Current.CampaignMissionManager.OpenConversationMission( + new ConversationCharacterData(Hero.MainHero.CharacterObject, Hero.MainHero.PartyBelongedTo.Party, true), + new ConversationCharacterData(targetHero.CharacterObject, targetHero.PartyBelongedTo?.Party, true), + specialScene, sceneLevels); _currentMission.AddListener(this); } From cdef9a7310e94efc8ebd1a6692ac50f0073ced94 Mon Sep 17 00:00:00 2001 From: Benny Zlotnik Date: Tue, 4 Oct 2022 13:33:32 +0300 Subject: [PATCH 10/12] fix faction selection issue in the Kingdom->Diplomacy view Fix alliances/wars/pacts listings, as well as infomation in the tooltips --- .../DiplomaticAction/AbstractScoringModel.cs | 2 +- .../PatchTools/PatchManager.cs | 3 +- .../Patches/ViewModelPatch.cs | 44 +++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/Bannerlord.Diplomacy/Patches/ViewModelPatch.cs diff --git a/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs index 3fb76499..19c19d99 100644 --- a/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs @@ -19,7 +19,7 @@ namespace Diplomacy.DiplomaticAction protected AbstractScoringModel(IDiplomacyScores scores) => Scores = scores; - public virtual ExplainedNumber GetScore(Kingdom ourKingdom, Kingdom otherKingdom, bool includeDesc = false) + public virtual ExplainedNumber GetScore(Kingdom otherKingdom, Kingdom ourKingdom, bool includeDesc = false) { var explainedNum = new ExplainedNumber(Scores.Base, includeDesc); diff --git a/src/Bannerlord.Diplomacy/PatchTools/PatchManager.cs b/src/Bannerlord.Diplomacy/PatchTools/PatchManager.cs index 669db544..5beca6bb 100644 --- a/src/Bannerlord.Diplomacy/PatchTools/PatchManager.cs +++ b/src/Bannerlord.Diplomacy/PatchTools/PatchManager.cs @@ -69,7 +69,8 @@ private PatchManager(string harmonyId) new DefaultEncyclopediaFactionPagePatch(), new RebelKingdomPatches(), new KingdomManagementVMPatch(), - new MBBannerEditorGauntletScreenPatch() + new MBBannerEditorGauntletScreenPatch(), + new ViewModelPatch() // ... Only 1 class left to convert to declarative patching. }; } diff --git a/src/Bannerlord.Diplomacy/Patches/ViewModelPatch.cs b/src/Bannerlord.Diplomacy/Patches/ViewModelPatch.cs new file mode 100644 index 00000000..32e0bfa2 --- /dev/null +++ b/src/Bannerlord.Diplomacy/Patches/ViewModelPatch.cs @@ -0,0 +1,44 @@ +using TaleWorlds.Library; +using Diplomacy.PatchTools; + +using System.Collections.Generic; +using System.Reflection; +using System; +using TaleWorlds.CampaignSystem.ViewModelCollection.KingdomManagement.Diplomacy; + +namespace Diplomacy.Patches +{ + internal class ViewModelPatch : PatchClass + { + protected override IEnumerable Prepare() + { + return new Patch[] + { + new Prefix(nameof(FixInvoke), new Reflect.Method(typeof(Common), "InvokeWithLog", new Type[]{typeof(MethodInfo), typeof(object), typeof(object[])})), + }; + } + + // TODO: this is a terrible hack, hopefully I will get assitance with https://github.com/BUTR/Bannerlord.UIExtenderEx/discussions/159 + // and fix it properly + private static void FixInvoke(MethodInfo methodInfo, object obj, object[] args) + { + var instance = methodInfo.GetType().GetField("_instance", BindingFlags.NonPublic | BindingFlags.Instance); + if (instance != null && instance.GetValue(methodInfo) is ViewModelMixin.KingdomTruceItemVmMixin) + { + if (!Environment.StackTrace.Contains("OnRefresh")) + { + var MixinInstance = (ViewModelMixin.KingdomTruceItemVmMixin) instance.GetValue(methodInfo); + var BadVm = MixinInstance.GetType().BaseType.GetField("_vm", BindingFlags.Instance | BindingFlags.NonPublic); + // Replace VM with obj + BadVm.SetValue(MixinInstance, new WeakReference((KingdomTruceItemVM) obj)); + + // Replace private _factionn reference + var vm = MixinInstance.GetType().GetField("_faction2", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase); + vm.SetValue(MixinInstance, ((KingdomTruceItemVM) obj).Faction2); + MixinInstance.GetType().GetProperty("DiplomacyProperties").SetValue(MixinInstance, new ViewModel.DiplomacyPropertiesVM(((KingdomTruceItemVM) obj).Faction1, ((KingdomTruceItemVM) obj).Faction2)); + MixinInstance.OnRefresh(); + } + } + } + } +} From 6459c0b43b670294c338249fef7024bc6244d615 Mon Sep 17 00:00:00 2001 From: Benny Zlotnik Date: Tue, 4 Oct 2022 14:22:50 +0300 Subject: [PATCH 11/12] fix war selection issue --- .../Patches/ViewModelPatch.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Bannerlord.Diplomacy/Patches/ViewModelPatch.cs b/src/Bannerlord.Diplomacy/Patches/ViewModelPatch.cs index 32e0bfa2..d2705f87 100644 --- a/src/Bannerlord.Diplomacy/Patches/ViewModelPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/ViewModelPatch.cs @@ -39,6 +39,22 @@ private static void FixInvoke(MethodInfo methodInfo, object obj, object[] args) MixinInstance.OnRefresh(); } } + else if (instance != null && instance.GetValue(methodInfo) is ViewModelMixin.KingdomWarItemVMMixin) + { + if (!Environment.StackTrace.Contains("OnRefresh")) + { + var MixinInstance = (ViewModelMixin.KingdomWarItemVMMixin) instance.GetValue(methodInfo); + var BadVm = MixinInstance.GetType().BaseType.GetField("_vm", BindingFlags.Instance | BindingFlags.NonPublic); + // Replace VM with obj + BadVm.SetValue(MixinInstance, new WeakReference((KingdomWarItemVM) obj)); + + // Replace private _factionn reference + var vm = MixinInstance.GetType().GetField("_faction2", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase); + vm.SetValue(MixinInstance, ((KingdomWarItemVM) obj).Faction2); + MixinInstance.GetType().GetProperty("DiplomacyProperties").SetValue(MixinInstance, new ViewModel.DiplomacyPropertiesVM(((KingdomWarItemVM) obj).Faction1, ((KingdomWarItemVM) obj).Faction2)); + MixinInstance.OnRefresh(); + } + } } } } From 6b8e38ebc50e876e4b526a56f216232152bf030b Mon Sep 17 00:00:00 2001 From: Benny Zlotnik Date: Wed, 5 Oct 2022 18:39:16 +0300 Subject: [PATCH 12/12] update changelog --- changelog.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog.txt b/changelog.txt index 3021574c..303fb3b2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,10 @@ --------------------------------------------------------------------------------------------------- +Version: 1.1.12 +Game Versions: e1.8.1,e1.8.0 +* Update dependencies to fix 1.8.0 hotfix crash +* Fix faction selection issue in the kingdom diplomacy view +* Fix messenger teleportation issue +--------------------------------------------------------------------------------------------------- Version: 1.1.11 Game Versions: e1.8.0 * Compatibility with e1.8.0