Skip to content

Commit

Permalink
Updated for 1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jirow13 committed Aug 9, 2020
1 parent 8ececbf commit 356ae50
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 26 deletions.
1 change: 0 additions & 1 deletion BannerlordTweaks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
<Compile Include="Patches\DefaultPartySizeLimitModelPatch.cs" />
<Compile Include="Patches\DefaultCaravanPartySizeLimitModelPatch.cs" />
<Compile Include="Patches\DefaultTournamentModelPatch.cs" />
<Compile Include="Patches\DefaultTroopCountLimitModelPatch.cs" />
<Compile Include="Patches\HeroPatches.cs" />
<Compile Include="Patches\HideoutMissionControllerPatches.cs" />
<Compile Include="Patches\MapInfoVMPatch.cs" />
Expand Down
10 changes: 6 additions & 4 deletions BannerlordTweaks.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
<PropertyGroup Label="UserMacros">

<!-- Path to Mount and Blade folder -->
<MOUNT_AND_BLADE_DIR>C:\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\</MOUNT_AND_BLADE_DIR>
<MOUNT_AND_BLADE_DIR>E:\SteamLibrary\steamapps\common\Mount &amp; Blade II Bannerlord\</MOUNT_AND_BLADE_DIR>

<!-- Path to mod folder-->
<MOD_FOLDER>$(MOUNT_AND_BLADE_DIR)Modules\zzBannerlordTweaks\</MOD_FOLDER>

<!-- Path to ModLib assembly-->
<MODLIB_PATH>C:\Users\Liam\source\repos\ModLib\bin\Debug\ModLib.dll</MODLIB_PATH>
<MODLIB_PATH>E:\SteamLibrary\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\ModLib\bin\Win64_Shipping_Client\ModLib.dll</MODLIB_PATH>

<!-- Path to ModLib definitions assembly-->
<MODLIB_DEFINITIONS_PATH>C:\Users\Liam\source\repos\ModLib\ModLib.Definitions\bin\Debug\ModLib.Definitions.dll</MODLIB_DEFINITIONS_PATH>

<MODLIB_DEFINITIONS_PATH>E:\SteamLibrary\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\ModLib\bin\Win64_Shipping_Client\ModLib.Definitions.dll</MODLIB_DEFINITIONS_PATH>

<!-- Output to Modules Folder -->
<OUT_PATH>$(MOUNT_AND_BLADE_DIR)Modules\zzBannerlordTweaks\bin\Win64_Shipping_Client\</OUT_PATH>
</PropertyGroup>
</Project>
5 changes: 2 additions & 3 deletions DismembermentMissionBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public override void OnRegisterBlow(Agent attacker, Agent victim, GameEntity rea
if (attacker == null || victim == null) return;
if (attacker == victim) return;

bool isPlayerAttacker;
if (IsValidAttacker(attacker, out isPlayerAttacker) && IsValidVictim(victim))
if (IsValidAttacker(attacker, out bool isPlayerAttacker) && IsValidVictim(victim))
{
var attackDir = attacker.AttackDirection;
//Wanted to do arms as well, but currently not possible. Will have to wait until we can add custom meshes and skeletons
Expand Down Expand Up @@ -116,7 +115,7 @@ private bool IsValidAttacker(Agent attacker, out bool isPlayerAttacker)
return true;
}
//if (Settings.Instance.AICanDecapitate)
return true;
return true;
//return false;
}

Expand Down
5 changes: 0 additions & 5 deletions Patches/HideoutMissionControllerPatches.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using HarmonyLib;
using SandBox;
using SandBox.Source.Missions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TaleWorlds.Core;
using TaleWorlds.MountAndBlade;

Expand Down
4 changes: 3 additions & 1 deletion Patches/SmeltingVMPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ private static void Postfix(SmeltingVM __instance, ItemRoster ____playerItemRost
// This appears to be how the game works out if an item is locked
// From TaleWorlds.CampaignSystem.ViewModelCollection.SPInventoryVM.InitializeInventory()
IEnumerable<EquipmentElement> locks = Campaign.Current.GetCampaignBehavior<TaleWorlds.CampaignSystem.SandBox.CampaignBehaviors.IInventoryLockTracker>().GetLocks();
EquipmentElement[] locked_items = locks?.ToArray<EquipmentElement>();
// Updated line 24 to Line 25 which seems to be the updated way game works out item locks in v1.4.3 InitializeInventory()
// EquipmentElement[] locked_items = locks?.ToArray<EquipmentElement>();
EquipmentElement[] locked_items = (locks != null) ? locks.ToArray<EquipmentElement>() : null;

bool isLocked(EquipmentElement test_item)
{
Expand Down
1 change: 0 additions & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
1 change: 0 additions & 1 deletion SubModule.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using HarmonyLib;
using ModLib;
using SandBox;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
7 changes: 1 addition & 6 deletions TweakedCharacterDevelopmentModel.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaleWorlds.CampaignSystem.SandBox.GameComponents;
using TaleWorlds.CampaignSystem.SandBox.GameComponents;

namespace BannerlordTweaks
{
Expand Down
3 changes: 2 additions & 1 deletion TweakedCombatXpModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace BannerlordTweaks
{
public class TweakedCombatXpModel : DefaultCombatXpModel
{
public override void GetXpFromHit(CharacterObject attackerTroop, CharacterObject attackedTroop, int damage, bool isFatal, MissionTypeEnum missionType, out int xpAmount)
// They added PartyBase in v1.4.3. Updated method to address build error.
public override void GetXpFromHit(CharacterObject attackerTroop, CharacterObject attackedTroop, PartyBase party, int damage, bool isFatal, MissionTypeEnum missionType, out int xpAmount)
{
if (attackerTroop == null || attackedTroop == null)
{
Expand Down
4 changes: 2 additions & 2 deletions TweakedPregnancyModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Helpers;
using System;
using System.Linq;
using Helpers;
using TaleWorlds.CampaignSystem;
using TaleWorlds.CampaignSystem.SandBox.GameComponents;

Expand Down
1 change: 0 additions & 1 deletion TweakedSettlementMilitiaModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using TaleWorlds.CampaignSystem;
using TaleWorlds.CampaignSystem.SandBox.GameComponents;
using TaleWorlds.Localization;
using System.Linq;
using System.Windows.Forms;
using System;
using ModLib;
Expand Down

1 comment on commit 356ae50

@Jirow13
Copy link
Author

@Jirow13 Jirow13 commented on 356ae50 Aug 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant changes:

  1. Patches/SmeltingVMPatches.cs - I had to update the method to per the 1.4.3 changes from TW, to fix locked items not showing up in smelting menu.
  2. TweakedCombatXpModel.cs - Updated the method to get it to build again. TW added "PartyBase" args to GetXpFromHit method.
  3. BannerlordTweaks.csproj - Disabled/Removed DefaultTroopCountLimitModelPatch.cs from build as it looks like TW made changes in 1.4.3 which broke it. I'm guessing it will have to be rebuilt or discarded.

Otherwise it's just minor cleanup of includes thrown in by VS code analysis/cleanup.

Please sign in to comment.