[HarmonyPatch(typeof(CraftingCampaignBehavior), "AddItemToHistory")]
public class Patch_CraftingCampaignBehavior_AddItemToHistory
{
private static void Prefix(CraftingCampaignBehavior __instance, WeaponDesign design)
{
if (__instance != null)
{
FieldInfo field_craftingHistory = typeof(CraftingCampaignBehavior).GetField("_craftingHistory", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
List<WeaponDesign> _craftingHistory = (List<WeaponDesign>)field_craftingHistory.GetValue(__instance);
_craftingHistory.Reverse();
List<WeaponDesign> TempList = new List<WeaponDesign>();
List<WeaponDesign> toRemove = new List<WeaponDesign>();
foreach (WeaponDesign weaponDesign in _craftingHistory)
{
bool duplicatefound = false;
foreach (WeaponDesign weaponDesign2 in TempList)
{
if (weaponDesign.WeaponName.ToString() == weaponDesign2.WeaponName.ToString()||weaponDesign.WeaponName.ToString() == design.WeaponName.ToString())
{
duplicatefound = true;
}
}
if (!duplicatefound)
{
TempList.Add(weaponDesign);
}else
{
toRemove.Add(weaponDesign);
}
}
_craftingHistory.RemoveAll(x => toRemove.Contains(x));
}
}
}
I rewrited this mod with C# that fixed all problem
dotnet new --install Bannerlord.Templates
https://github.com/BUTR/Bannerlord.Module.Template[Environment]::SetEnvironmentVariable('BANNERLORD_GAME_DIR', 'C:\games\Steam\steamapps\common\Mount & Blade II Bannerlord', 'User')
https://github.com/BUTR/Bannerlord.Module.TemplateCampaign.Current.Models.PartySpeedCalculatingModel.CalculateFinalSpeed(p, p._pureSpeedExplainer);
TaleWorlds.CampaignSystem.Campaign.RealTick(float)
Campaign.Current.MapSceneWrapper.GetPathBetweenAIFaces(this.CurrentNavigationFace, this._targetAiFaceIndex, position2D, newTargetPosition, 0.1f, this.Path);