-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
206 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>2.2.0.0</Version> | ||
<GameVersion>1.5.9</GameVersion> | ||
<GameBranch>Stable</GameBranch> | ||
<Version>2.3.0.0</Version> | ||
<GameVersion>1.6.0</GameVersion> | ||
<GameBranch>Beta</GameBranch> | ||
<AdditionalInfo></AdditionalInfo> | ||
<HarmonyVersion>2.0.4</HarmonyVersion> | ||
<MCMVersion>4.3</MCMVersion> | ||
<TargetFramework>net472</TargetFramework> | ||
<LangVersion>8.0</LangVersion> | ||
<GameFolder>C:\SteamCMD\mb2b_stable</GameFolder> | ||
<GameFolder>C:\SteamCMD\mb2b_beta</GameFolder> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
using TaleWorlds.CampaignSystem; | ||
using System.Linq; | ||
using TaleWorlds.CampaignSystem; | ||
|
||
namespace BannerlordCheats.Extensions | ||
{ | ||
public static class SiegeExtensions | ||
{ | ||
public static bool IsPlayerSiege(this SiegeEvent siege) | ||
public static bool IsPlayerSide(this ISiegeEventSide side) | ||
{ | ||
return siege?.IsPlayerSiegeEvent ?? false; | ||
return side?.SiegeParties?.Any(x => x.IsPlayerParty()) ?? false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,43 @@ | ||
using BannerlordCheats.Settings; | ||
using BannerlordCheats.Extensions; | ||
using BannerlordCheats.Settings; | ||
using HarmonyLib; | ||
using TaleWorlds.Core; | ||
using TaleWorlds.Library; | ||
using TaleWorlds.MountAndBlade; | ||
|
||
namespace BannerlordCheats.Patches.Combat | ||
{ | ||
// [HarmonyPatch(typeof(Agent), "OnWeaponAmountChange")] | ||
// public static class PartyInfiniteAmmo | ||
// { | ||
// [HarmonyPrefix] | ||
// public static void OnWeaponAmountChange(EquipmentIndex slotIndex, short amount, ref Agent __instance) | ||
// { | ||
// if (__instance != null | ||
// && (Mission.Current?.PlayerTeam?.ActiveAgents.Contains(__instance) ?? false) | ||
// && BannerlordCheatsSettings.Instance.PartyInfiniteAmmo) | ||
// { | ||
// var fullAmount = __instance.Equipment[slotIndex].MaxAmmo; | ||
// | ||
// if (amount < fullAmount) | ||
// { | ||
// __instance.SetWeaponAmountInSlot(slotIndex, fullAmount, false); | ||
// } | ||
// } | ||
// } | ||
// } | ||
[HarmonyPatch(typeof(Mission), "OnAgentShootMissile")] | ||
public static class PartyInfiniteAmmo | ||
{ | ||
[HarmonyPostfix] | ||
public static void OnAgentShootMissile( | ||
ref Agent shooterAgent, | ||
ref EquipmentIndex weaponIndex, | ||
ref Vec3 position, | ||
ref Vec3 velocity, | ||
ref Mat3 orientation, | ||
ref bool hasRigidBody, | ||
ref bool isPrimaryWeaponShot, | ||
ref int forcedMissileIndex) | ||
{ | ||
if (!shooterAgent.IsPlayer() | ||
&& shooterAgent.Origin.TryGetParty(out var party) | ||
&& party.IsPlayerParty() | ||
&& BannerlordCheatsSettings.TryGetModifiedValue(x => x.PartyInfiniteAmmo, out var partyInfiniteAmmo) | ||
&& partyInfiniteAmmo) | ||
{ | ||
for (var index = EquipmentIndex.WeaponItemBeginSlot; index < EquipmentIndex.NumAllWeaponSlots; ++index) | ||
{ | ||
var missionWeapon = shooterAgent.Equipment[index]; | ||
|
||
if (missionWeapon.IsAnyConsumable(out _) | ||
&& missionWeapon.Amount <= missionWeapon.ModifiedMaxAmount) | ||
{ | ||
shooterAgent.SetWeaponAmountInSlot(index, missionWeapon.ModifiedMaxAmount, true); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.