diff --git a/build/common.props b/build/common.props
index f8b0805d..92f19e4e 100644
--- a/build/common.props
+++ b/build/common.props
@@ -2,8 +2,8 @@
- 1.1.17
- 1.0.1
+ 1.1.18
+ 1.0.0
@@ -78,7 +78,7 @@
$(SecondLine)
$(LastLine)
- e1.1.0
+ v1.0.0
$(GameMinimalVersion)
$(GameStableVersion)
$(GameBetaVersion)
diff --git a/changelog.txt b/changelog.txt
index df1375c8..57b6e735 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,4 +1,10 @@
---------------------------------------------------------------------------------------------------
+Version: 1.1.18
+Game Versions: v1.0.0,v1.0.1,v1.0.2
+* Fixed a crash that occurred when sending a Messenger to a hero in the field.
+* Fixed a rare crash that sometimes occurred in Kingdom Management.
+* Fixed a rare crash that occurred on Encyclopedia Hero page when the hero was imprisoned by leaderless party.
+---------------------------------------------------------------------------------------------------
Version: 1.1.17
Game Versions: v1.0.0,v1.0.1,v1.0.2
* Recompiled for v1.0.2.
@@ -6,7 +12,7 @@ Game Versions: v1.0.0,v1.0.1,v1.0.2
* Fixed several issues with peace and war restrictions not applying properly.
* Fixed a crash that occurred when sending a Messenger to a factionless hero.
* Fixed a crash that occurred when trying to create a caravan using a Messenger.
-* Messengers now use correct the scene for the conversation.
+* Messengers now use correct scene for the conversation.
* Messengers can no longer freely access highborn locations unless you can.
* The speed of Messengers now depends on the maximum arrival time.
* Added an explanation for why some characters may not be available to send Messengers to.
diff --git a/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs b/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs
index a3636019..08b6d2f1 100644
--- a/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs
+++ b/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs
@@ -204,8 +204,8 @@ public void StartDialogue(Hero targetHero, Messenger messenger)
PlayerEncounter.Start();
PlayerEncounter.Current.SetupFields(heroParty, targetParty ?? heroParty);
-
Campaign.Current.CurrentConversationContext = ConversationContext.Default;
+
if (targetSettlement != null)
{
_position2D = new(Hero.MainHero.GetMapPoint().Position2D);
@@ -311,28 +311,7 @@ public static bool IsTargetHeroAvailable(Hero targetHero, out TextObject excepti
if (!available)
{
exception = new("{=bLR91Eob}{REASON}The messenger won't be able to reach the addressee.");
-
- TextObject reason;
- if (targetHero.IsDead)
- reason = new("{=vhsHDMil}{HERO_NAME} is dead. ", new() { ["HERO_NAME"] = targetHero.Name });
- else if (targetHero.IsPrisoner)
- reason = new("{=CusN2JMb}{HERO_NAME} is imprisoned {?IS_MOBILE}by{?}in{\\?} {DETENTION_PLACE}. ", new()
- {
- ["HERO_NAME"] = targetHero.Name,
- ["IS_MOBILE"] = targetHero.PartyBelongedToAsPrisoner.IsSettlement ? 0 : 1,
- ["DETENTION_PLACE"] = targetHero.PartyBelongedToAsPrisoner.IsSettlement ? targetHero.PartyBelongedToAsPrisoner.Settlement.Name : targetHero.PartyBelongedToAsPrisoner.LeaderHero.Name
- });
- else if (targetHero.IsFugitive)
- reason = new("{=1BISlFYx}{HERO_NAME} is fugitive and doesn't want to be found. ", new() { ["HERO_NAME"] = targetHero.Name });
- else if (targetHero.IsReleased)
- reason = new("{=ze8KJ1oL}{HERO_NAME} has just been released from custody and is not yet ready to make appointments. ", new() { ["HERO_NAME"] = targetHero.Name });
- else if (targetHero.IsTraveling)
- reason = new("{=N5T6IXWJ}{HERO_NAME} is traveling incognito. ", new() { ["HERO_NAME"] = targetHero.Name });
- else if (targetHero.IsChild)
- reason = new("{=3lknR86H}{HERO_NAME} is too inexperienced to participate in formal meetings. ", new() { ["HERO_NAME"] = targetHero.Name });
- else
- reason = TextObject.Empty;
-
+ var reason = GetUnavailabilityReason(targetHero);
exception.SetTextVariable("REASON", reason);
return false;
}
@@ -347,6 +326,31 @@ public static bool IsTargetHeroAvailable(Hero targetHero, out TextObject excepti
return true;
}
+ private static TextObject GetUnavailabilityReason(Hero targetHero)
+ {
+ TextObject reason;
+ if (targetHero.IsDead)
+ reason = new("{=vhsHDMil}{HERO_NAME} is dead. ", new() { ["HERO_NAME"] = targetHero.Name });
+ else if (targetHero.IsPrisoner && targetHero.PartyBelongedToAsPrisoner != null)
+ reason = new("{=CusN2JMb}{HERO_NAME} is imprisoned {?IS_MOBILE}by{?}in{\\?} {DETENTION_PLACE}. ", new()
+ {
+ ["HERO_NAME"] = targetHero.Name,
+ ["IS_MOBILE"] = targetHero.PartyBelongedToAsPrisoner.IsSettlement ? 0 : 1,
+ ["DETENTION_PLACE"] = targetHero.PartyBelongedToAsPrisoner.IsSettlement ? targetHero.PartyBelongedToAsPrisoner.Settlement.Name : ((targetHero.PartyBelongedToAsPrisoner.LeaderHero?.Name ?? targetHero.PartyBelongedToAsPrisoner.Name) ?? TextObject.Empty)
+ });
+ else if (targetHero.IsFugitive)
+ reason = new("{=1BISlFYx}{HERO_NAME} is fugitive and doesn't want to be found. ", new() { ["HERO_NAME"] = targetHero.Name });
+ else if (targetHero.IsReleased)
+ reason = new("{=ze8KJ1oL}{HERO_NAME} has just been released from custody and is not yet ready to make appointments. ", new() { ["HERO_NAME"] = targetHero.Name });
+ else if (targetHero.IsTraveling)
+ reason = new("{=N5T6IXWJ}{HERO_NAME} is traveling incognito. ", new() { ["HERO_NAME"] = targetHero.Name });
+ else if (targetHero.IsChild)
+ reason = new("{=3lknR86H}{HERO_NAME} is too inexperienced to participate in formal meetings. ", new() { ["HERO_NAME"] = targetHero.Name });
+ else
+ reason = TextObject.Empty;
+ return reason;
+ }
+
public static bool IsTargetHeroAvailableNow(Hero targetHero)
{
return IsTargetHeroAvailable(targetHero) && targetHero.PartyBelongedTo?.MapEvent == null;
@@ -374,7 +378,7 @@ private void CleanUpSettlementEncounter(float obj)
{
PlayerEncounter.Finish();
- if (_position2D != Vec2.Invalid)
+ if (_position2D.IsValid)
{
MobileParty.MainParty.Position2D = _position2D;
}
diff --git a/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomDiplomacyVMMixin.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomDiplomacyVMMixin.cs
index 96813d1d..e9aa8c5c 100644
--- a/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomDiplomacyVMMixin.cs
+++ b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomDiplomacyVMMixin.cs
@@ -5,12 +5,8 @@
using Diplomacy.Event;
using Diplomacy.Extensions;
-using HarmonyLib;
-using HarmonyLib.BUTR.Extensions;
-
using JetBrains.Annotations;
-using System;
using System.Collections.Generic;
using System.Linq;
@@ -26,24 +22,6 @@ namespace Diplomacy.ViewModelMixin
[UsedImplicitly]
internal sealed class KingdomDiplomacyVMMixin : BaseViewModelMixin
{
- static KingdomDiplomacyVMMixin()
- {
- var harmony = new Harmony("Diplomacy.ViewModelMixin.KingdomDiplomacyVMMixin");
-
- harmony.Patch(
- AccessTools2.Method(typeof(KingdomDiplomacyVM), "OnDiplomacyItemSelection"),
- postfix: new HarmonyMethod(typeof(KingdomDiplomacyVMMixin), nameof(OnDiplomacyItemSelectionPostfix)));
- }
-
- private static void OnDiplomacyItemSelectionPostfix(KingdomDiplomacyVM __instance, KingdomDiplomacyItemVM item)
- {
- if (__instance.GetPropertyValue(nameof(Mixin)) is WeakReference weakReference && weakReference.TryGetTarget(out var mixin))
- {
- mixin.OnDiplomacyItemSelection(item);
- }
- }
-
-
private static readonly TextObject _TAlliances = new("{=zpNalMeA}Alliances");
private static readonly TextObject _TStats = new("{=1occw3EF}Stats");
private static readonly TextObject _TOverview = new("{=OvbY5qxL}Overview");
@@ -57,9 +35,6 @@ private static void OnDiplomacyItemSelectionPostfix(KingdomDiplomacyVM __instanc
private bool _showOverview;
private bool _showStats;
- [DataSourceProperty]
- public WeakReference Mixin => new(this);
-
[DataSourceProperty]
public bool ShowOverview { get => _showOverview; set => SetField(ref _showOverview, value, nameof(ShowOverview)); }
@@ -126,17 +101,6 @@ public void ExecuteShowOverview()
ShowStats = false;
}
- public void ExecuteShowStatComparison()
- {
- ViewModel!.IsDisplayingStatComparisons = true;
- ViewModel!.IsDisplayingWarLogs = false;
- }
-
- private void OnDiplomacyItemSelection(KingdomDiplomacyItemVM item)
- {
- ExecuteShowStatComparison();
- }
-
public override void OnRefresh()
{
ExecuteShowOverview();