Skip to content

Commit

Permalink
Release v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
welles authored Dec 29, 2022
2 parents f73e362 + 19f657c commit 00989cc
Show file tree
Hide file tree
Showing 159 changed files with 3,368 additions and 1,340 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "daily"
target-branch: "stable-develop"
labels:
- "stable"
assignees:
- "welles"
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ jobs:
with:
tag_name: ${{env.tag_name}}
name: ${{env.release_title}}
draft: true
draft: false
prerelease: ${{env.prerelease}}
files: ${{env.zip_name}}.zip
13 changes: 9 additions & 4 deletions BannerlordCheats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@
<HintPath>$(GameFolder)\bin\Win64_Shipping_Client\TaleWorlds.ScreenSystem.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="TaleWorlds.Starter.DotNetCore">
<HintPath>$(GameFolder)\bin\Win64_Shipping_Client\TaleWorlds.Starter.DotNetCore.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="TaleWorlds.Starter.Library">
<HintPath>$(GameFolder)\bin\Win64_Shipping_Client\TaleWorlds.Starter.Library.dll</HintPath>
<Private>False</Private>
Expand Down Expand Up @@ -248,4 +244,13 @@
</Reference>
</ItemGroup>

<ItemGroup>
<Compile Update="Settings\Default.cs">
<DependentUpon>SettingsManager.cs</DependentUpon>
</Compile>
<Compile Update="Settings\CheatValue.cs">
<DependentUpon>SettingsManager.cs</DependentUpon>
</Compile>
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project>
<PropertyGroup>
<Version>2.13.0.0</Version>
<GameVersion>1.0.0.4407</GameVersion>
<Version>3.0.0.0</Version>
<GameVersion>1.0.2.8368</GameVersion>
<GameBranch>Stable</GameBranch>
<HarmonyVersion>2.2.2</HarmonyVersion>
<MCMVersion>5.0.4</MCMVersion>
<MCMVersion>5.5.4</MCMVersion>
<TargetFramework>net472</TargetFramework>
<LangVersion>8.0</LangVersion>
<GameFolder>C:\SteamCMD\apps\mb2b_stable</GameFolder>
Expand Down
35 changes: 35 additions & 0 deletions Extensions/EnumExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using BannerlordCheats.Localization;
using BannerlordCheats.Settings;
using MCM.Common;
using TaleWorlds.Core;

namespace BannerlordCheats.Extensions
{
public static class EnumExtensions
{
public static bool TryGetAgentState(this KnockoutOrKilled state, out AgentState result)
{
switch (state)
{
case KnockoutOrKilled.Default:
result = AgentState.None;
return false;
case KnockoutOrKilled.Knockout:
result = AgentState.Unconscious;
return true;
case KnockoutOrKilled.Killed:
result = AgentState.Killed;
return true;
default:
throw new ArgumentOutOfRangeException(nameof(state), state, null);
}
}

public static T GetValue<T>(this Dropdown<LocalizedDropdownValue<T>> dropdown)
where T : Enum
{
return (T)(object)dropdown.SelectedIndex;
}
}
}
5 changes: 5 additions & 0 deletions Extensions/HeroExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ public static bool IsPlayerCompanion(this Hero hero)
{
return hero?.IsPlayerCompanion ?? false;
}

public static bool IsPlayerClan(this Hero hero)
{
return hero?.Clan?.IsPlayerClan() ?? false;
}
}
}
127 changes: 80 additions & 47 deletions L10N.resx
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,6 @@
<data name="PartyOneHitKill_Desc" xml:space="preserve">
<value>Party members kill enemies with one hit.</value>
</data>
<data name="PartyOnlyKnockout_Name" xml:space="preserve">
<value>Party Only Knockout</value>
</data>
<data name="PartyOnlyKnockout_Desc" xml:space="preserve">
<value>Party members are never killed, only knocked unconcious.</value>
</data>
<data name="RenownRewardMultiplier_Name" xml:space="preserve">
<value>Renown Reward Multiplier</value>
</data>
Expand Down Expand Up @@ -543,12 +537,6 @@
<data name="DamageMultiplier_Name" xml:space="preserve">
<value>Damage Multiplier</value>
</data>
<data name="EnemyOnlyKnockout_Desc" xml:space="preserve">
<value>Enemies are never killed, only knocked unconcious.</value>
</data>
<data name="EnemyOnlyKnockout_Name" xml:space="preserve">
<value>Enemy Only Knockout</value>
</data>
<data name="NoFriendlyFire_Desc" xml:space="preserve">
<value>Completely disable friendly fire for the player party.</value>
</data>
Expand Down Expand Up @@ -762,18 +750,6 @@
<data name="PlayerHorseInvincible_Desc" xml:space="preserve">
<value>Disables all damage to the horse the player is currently riding.</value>
</data>
<data name="FriendlyLordCombatDeathPercentage_Name" xml:space="preserve">
<value>Friendly Lord Combat Death Percentage</value>
</data>
<data name="FriendlyLordCombatDeathPercentage_Desc" xml:space="preserve">
<value>Percentage of chance of allied lords dying during combat. 100% means default chance, 0% means lords never die.</value>
</data>
<data name="EnemyLordCombatDeathPercentage_Name" xml:space="preserve">
<value>Enemy Lord Combat Death Percentage</value>
</data>
<data name="EnemyLordCombatDeathPercentage_Desc" xml:space="preserve">
<value>Percentage of chance of enemy lords dying during combat. 100% means default chance, 0% means lords never die.</value>
</data>
<data name="AlwaysKnockDown_Name" xml:space="preserve">
<value>Always Knock Down</value>
</data>
Expand All @@ -792,12 +768,6 @@
<data name="EnableHotkeyTips_Desc" xml:space="preserve">
<value>Enable to see a list of available cheat hotkeys in every screen that has any.</value>
</data>
<data name="CompanionDeathPercentage_Name" xml:space="preserve">
<value>Player Companion Death Percentage</value>
</data>
<data name="CompanionDeathPercentage_Desc" xml:space="preserve">
<value>Percentage of chance of player companions dying during combat. 100% means default chance, 0% means companions never die.</value>
</data>
<data name="NativeItemSpawning_Name" xml:space="preserve">
<value>Spawn Items</value>
</data>
Expand Down Expand Up @@ -846,30 +816,15 @@
<data name="AdjustPregnancyDuration_Desc" xml:space="preserve">
<value>Adjust the length of pregnancies for all characters in the game. The default length of a pregnancy is 36 days.</value>
</data>
<data name="ModWarningMessage" xml:space="preserve">
<value>Thank you for using the Cheats mod!
Please remember that the cheats only show up when you have a campaign loaded.
You can access them by pressing ESC, then going to Options → Mod Options → Cheats.
Also please use the cheats responsibly and backup your save files. Some cheats might have unintended side effects or might break your game completely.
Thank you!</value>
</data>
<data name="ModWarningMessageConfirm" xml:space="preserve">
<value>I Understand</value>
</data>
<data name="ModFailedLoadWarningTitle" xml:space="preserve">
<value>Bannerlord Cheats failed to load!</value>
</data>
<data name="ModFailedLoadWarningMessage" xml:space="preserve">
<value>This is most likely due to a version mismatch between the game and the mod. Please check if you have the correct mod version for your version of the game.
If you do, please send the error information that has been generated in the file "{0}" to the mod author so that they can investigate this issue.
You can still play the game, but most cheats will not work.
Thank you!</value>
</data>
<data name="EnemyLordCombatDeathChanceMultiplier_Name" xml:space="preserve">
<value>Enemy Lord Combat Death Chance Multiplier</value>
</data>
<data name="EnemyLordCombatDeathChanceMultiplier_Desc" xml:space="preserve">
<value>Factor by which the chance of enemy lords dying in combat is multiplied. 1 means default death chance.</value>
<value>Bannerlord Cheats could not load some cheats. Do you have the correct mod version for your game version? The following cheats failed to load:
{0}</value>
</data>
<data name="NeverKnockedBackByAttacks_Desc" xml:space="preserve">
<value>If enabled the player character is never knocked back or stunned by enemy attacks.</value>
Expand Down Expand Up @@ -943,4 +898,82 @@ Thank you!</value>
<data name="ChangePlayerConfirm" xml:space="preserve">
<value>Change!</value>
</data>
<data name="IUnderstand_Name" xml:space="preserve">
<value>Load a campaign to see cheats!</value>
</data>
<data name="IUnderstand_Desc" xml:space="preserve">
<value>Cheats are saved per character! They only show up when you are in a campaign. Press ESC, then go to Options → Mod Options → Cheats while in a campaign.</value>
</data>
<data name="Understood" xml:space="preserve">
<value>Understood!</value>
</data>
<data name="ThanksForReadingMessage" xml:space="preserve">
<value>Thanks for reading and understanding!</value>
</data>
<data name="Global" xml:space="preserve">
<value>Global</value>
</data>
<data name="Enum_KnockoutOrKilled_Default" xml:space="preserve">
<value>Default</value>
</data>
<data name="Enum_KnockoutOrKilled_Knockout" xml:space="preserve">
<value>Knocked out</value>
</data>
<data name="Enum_KnockoutOrKilled_Killed" xml:space="preserve">
<value>Killed</value>
</data>
<data name="PartyKnockoutOrKilled_Name" xml:space="preserve">
<value>Party Knocked Out or Killed</value>
</data>
<data name="PartyKnockoutOrKilled_Desc" xml:space="preserve">
<value>When this is set, troops in your party are either always knocked out or always killed when defeated, depending on the setting. Default means the default chance of a knockout.</value>
</data>
<data name="CompanionsKnockoutOrKilled_Name" xml:space="preserve">
<value>Companions Knocked Out or Killed</value>
</data>
<data name="CompanionsKnockoutOrKilled_Desc" xml:space="preserve">
<value>When this is set, heroes in your party are either always knocked out or always killed when defeated, depending on the setting. Default means the default chance of a knockout.</value>
</data>
<data name="FriendlyLordsKnockoutOrKilled_Name" xml:space="preserve">
<value>Friendly Lords Knocked Out or Killed</value>
</data>
<data name="FriendlyLordsKnockoutOrKilled_Desc" xml:space="preserve">
<value>When this is set, allied lords are either always knocked out or always killed when defeated, depending on the setting. Default means the default chance of a knockout.</value>
</data>
<data name="EnemyLordsKnockoutOrKilled_Name" xml:space="preserve">
<value>Enemy Lords Knocked Out or Killed</value>
</data>
<data name="EnemyLordsKnockoutOrKilled_Desc" xml:space="preserve">
<value>When this is set, enemy lords are either always knocked out or always killed when defeated, depending on the setting. Default means the default chance of a knockout.</value>
</data>
<data name="EnemyTroopsKnockoutOrKilled_Name" xml:space="preserve">
<value>Enemy Troops Knocked Out or Killed</value>
</data>
<data name="EnemyTroopsKnockoutOrKilled_Desc" xml:space="preserve">
<value>When this is set, enemy troops are either always knocked out or always killed when defeated, depending on the setting. Default means the default chance of a knockout.</value>
</data>
<data name="CaravansInvisibleOnMap_Name" xml:space="preserve">
<value>Caravans Invisible On Map</value>
</data>
<data name="CaravansInvisibleOnMap_Desc" xml:space="preserve">
<value>Hostile parties will not track or attack player owned caravans on the map.</value>
</data>
<data name="ClanExperienceMultiplier_Name" xml:space="preserve">
<value>Clan Member Experience Multiplier</value>
</data>
<data name="ClanExperienceMultiplier_Desc" xml:space="preserve">
<value>Factor by which the experience gain of other player clan members is multiplied. A factor of 1 means default experience.</value>
</data>
<data name="RelationGainAfterBattleMultiplier_Name" xml:space="preserve">
<value>Relation Gain After Battle Multiplier</value>
</data>
<data name="RelationGainAfterBattleMultiplier_Desc" xml:space="preserve">
<value>Factor by which the relationship increase with lords you've helped in battle is multiplied. A factor of 1 means default increase.</value>
</data>
<data name="VillagesNeverRaided_Name" xml:space="preserve">
<value>Player Villages Never Raided</value>
</data>
<data name="VillagesNeverRaided_Desc" xml:space="preserve">
<value>When enabled, player owned villages can never be raided.</value>
</data>
</root>
24 changes: 24 additions & 0 deletions Localization/L10N.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,29 @@ public static string GetTextFormat(string key, params object[] formatValues)

return text;
}

public static class Keys
{
public const string Global = "Global";
public const string ModName = "ModName";
public const string CombatPlayerGroupName = "Combat_Player";
public const string CombatPartyGroupName = "Combat_Party";
public const string CombatAlliesGroupName = "Combat_Allies";
public const string CombatEnemiesGroupName = "Combat_Enemies";
public const string CombatMiscGroupName = "Combat_Misc";
public const string GeneralGroupName = "General";
public const string MapGroupName = "Map";
public const string InventoryGroupName = "Inventory";
public const string PartyGroupName = "Party";
public const string ClanGroupName = "Clan";
public const string KingdomGroupName = "Kingdom";
public const string ExperienceGroupName = "Experience";
public const string SiegesGroupName = "Sieges";
public const string ArmyGroupName = "Army";
public const string SmithingGroupName = "Smithing";
public const string SettlementsGroupName = "Settlements";
public const string CharactersGroupName = "Characters";
public const string WorkshopsGroupName = "Workshops";
}
}
}
84 changes: 84 additions & 0 deletions Localization/LocalizedDropdownValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MCM.Common;

namespace BannerlordCheats.Localization
{
public struct LocalizedDropdownValue<T> : IEquatable<LocalizedDropdownValue<T>>
where T : Enum
{
public LocalizedDropdownValue(T value)
{
Value = value;
}

public T Value { get; set; }

public string DisplayName
{
get
{
var key = $"Enum_{typeof(T).Name}_{Enum.GetName(typeof(T), this.Value)}";

return L10N.GetText(key);
}
}

public override string ToString() => this.DisplayName;

public bool Equals(T other)
{
return EqualityComparer<T>.Default.Equals(this.Value, other);
}

public bool Equals(LocalizedDropdownValue<T> other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return EqualityComparer<T>.Default.Equals(Value, other.Value);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((LocalizedDropdownValue<T>)obj);
}

public override int GetHashCode()
{
return EqualityComparer<T>.Default.GetHashCode(this.Value);
}

public static bool operator ==(LocalizedDropdownValue<T> left, T right)
{
return left.Equals(right);
}

public static bool operator !=(LocalizedDropdownValue<T> left, T right)
{
return !left.Equals(right);
}

public static bool operator ==(LocalizedDropdownValue<T> left, LocalizedDropdownValue<T> right)
{
return Equals(left, right);
}

public static bool operator !=(LocalizedDropdownValue<T> left, LocalizedDropdownValue<T> right)
{
return !Equals(left, right);
}

public static Dropdown<LocalizedDropdownValue<T>> GenerateDropdown(T selected)
{
var values = Enum.GetValues(typeof(T)).Cast<T>().Select(value => new LocalizedDropdownValue<T>(value)).ToArray();

var selectedIndex = Array.IndexOf(values, values.First(x => x.Value.Equals(selected)));

return new Dropdown<LocalizedDropdownValue<T>>(values, selectedIndex);
}
}
}
Loading

0 comments on commit 00989cc

Please sign in to comment.