diff --git a/build/common.props b/build/common.props
index 0344e105..6b8b4181 100644
--- a/build/common.props
+++ b/build/common.props
@@ -12,21 +12,20 @@
2.2.1
- 2.1.5
+ 2.1.13
- 4.7.3
+ 4.7.7
- 2.2.1
+ 2.2.5
- 2.0.0.82
+ 2.0.0.86
- 3.0.97
+ 4.0.121
1.0.1.36
3.1.0.61
-
net472
x64
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
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
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/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);
}
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..d2705f87
--- /dev/null
+++ b/src/Bannerlord.Diplomacy/Patches/ViewModelPatch.cs
@@ -0,0 +1,60 @@
+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();
+ }
+ }
+ 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();
+ }
+ }
+ }
+ }
+}