diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..f0b40750 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,73 @@ +# To learn more about .editorconfig see https://aka.ms/editorconfigdocs +############################### +# Core EditorConfig Options # +############################### + +# All files +[*] +indent_style = space + +# Code files +[*.{cs,vb}] +indent_size = 4 +insert_final_newline = false +charset = utf-8-bom + +# .NET formatting rules +[*.{cs,vb}] +dotnet_sort_system_directives_first = false +dotnet_separate_import_directive_groups = true + + +# CSharp formatting rules: +[*.cs] +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# CSharp formatting rules: +[*.cs] +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = one_less_than_current +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents_when_block = false + +# CSharp formatting rules: +[*.cs] +csharp_space_after_cast = true +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_between_parentheses = +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_around_binary_operators = before_and_after +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_after_comma = true +csharp_space_before_comma = false +csharp_space_after_dot = false +csharp_space_before_dot = false +csharp_space_after_semicolon_in_for_statement = true +csharp_space_before_semicolon_in_for_statement = false +csharp_space_around_declaration_statements = false +csharp_space_before_open_square_brackets = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_square_brackets = false + +# CSharp formatting rules: +[*.cs] +csharp_preserve_single_line_statements = true +csharp_preserve_single_line_blocks = true + +# 'using' directive preferences +[*.cs] +csharp_using_directive_placement = outside_namespace diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..047864cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: "nuget" + directory: "/" + schedule: + interval: "daily" + ignore: + - dependency-name: "Newtonsoft.Json" + - dependency-name: "Bannerlord.ReferenceAssemblies.*" + - dependency-name: "Lib.Harmony" + - dependency-name: "Microsoft.Extensions.*" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/TestBuild.yml b/.github/workflows/TestBuild.yml index ec4a1772..d6a3d764 100644 --- a/.github/workflows/TestBuild.yml +++ b/.github/workflows/TestBuild.yml @@ -2,8 +2,15 @@ name: TestBuild on: push: + branches-ignore: + - main + pull_request: branches: + - main - dev + # hopefully will be triggered more often + types: [assigned, opened, edited, reopened, review_requested, ready_for_review] + workflow_dispatch: env: # Disable the .NET logo in the console output. @@ -20,27 +27,26 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup .NET Core uses: actions/setup-dotnet@master with: dotnet-version: 5.0.x - - name: Build Diplomacy Module + - name: Build Diplomacy Module for testing run: | $impl = $PWD.Path + '/bannerlord-implementations'; $path = $PWD.Path + '/bannerlord'; $final = $path + '/Modules/Bannerlord.Diplomacy/bin/Win64_Shipping_Client/'; - $proj = 'src/Bannerlord.Diplomacy.csproj'; + $proj = 'src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj'; $pdll = $path + '/Modules/Bannerlord.Diplomacy/bin/Win64_Shipping_Client/Bannerlord.Diplomacy*.dll'; $ppdb = $path + '/Modules/Bannerlord.Diplomacy/bin/Win64_Shipping_Client/Bannerlord.Diplomacy*.pdb'; # The folders are required to be created before executing the script New-Item -ItemType directory -Force -Path $impl; New-Item -ItemType directory -Force -Path $path; - $gameversions = Get-Content -Path supported-game-versions.txt; - # Get all implementations except the minimal version (last element) - # Last entry is the Minimal version. We will use Bannerlord.Diplomacy.dll from there + [string[]]$gameversions = Get-Content -Path supported-game-versions.txt; + # Process all implementations For ($i = 0; $i -le $gameversions.Length - 1; $i++) { $gameversion = $gameversions[$i]; diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5641c2c..f9084987 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v3.0.2 - name: Setup .NET Core uses: actions/setup-dotnet@master @@ -32,15 +32,14 @@ jobs: $impl = $PWD.Path + '/bannerlord-implementations'; $path = $PWD.Path + '/bannerlord'; $final = $path + '/Modules/Bannerlord.Diplomacy/bin/Win64_Shipping_Client/'; - $proj = 'src/Bannerlord.Diplomacy.csproj'; + $proj = 'src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj'; $pdll = $path + '/Modules/Bannerlord.Diplomacy/bin/Win64_Shipping_Client/Bannerlord.Diplomacy*.dll'; $ppdb = $path + '/Modules/Bannerlord.Diplomacy/bin/Win64_Shipping_Client/Bannerlord.Diplomacy*.pdb'; # The folders are required to be created before executing the script New-Item -ItemType directory -Force -Path $impl; New-Item -ItemType directory -Force -Path $path; - $gameversions = Get-Content -Path supported-game-versions.txt; - # Get all implementations except the minimal version (last element) - # Last entry is the Minimal version. We will use Bannerlord.Diplomacy.dll from there + [string[]]$gameversions = Get-Content -Path supported-game-versions.txt; + # Process all implementations For ($i = 0; $i -le $gameversions.Length - 1; $i++) { $gameversion = $gameversions[$i]; @@ -62,7 +61,7 @@ jobs: shell: pwsh - name: Upload bannerlord folder - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3.1.0 with: name: Bannerlord.Diplomacy path: ./bannerlord/Modules/ @@ -81,7 +80,7 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} - name: Download stable bannerlord folder - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: Bannerlord.Diplomacy path: ./bannerlord/Modules/ diff --git a/.github/workflows/dotnet-format-daily.yml b/.github/workflows/dotnet-format-daily.yml new file mode 100644 index 00000000..867e9a8f --- /dev/null +++ b/.github/workflows/dotnet-format-daily.yml @@ -0,0 +1,18 @@ +name: Daily Code Format Check + +on: + schedule: + - cron: 0 0 * * * # Every day at midnight (UTC) + workflow_dispatch: + +jobs: + dotnet-format: + runs-on: ubuntu-latest + steps: + - name: Code Formatting + uses: butr/actions-code-format-setup@v1.5 + with: + workspace: "src/Bannerlord.Diplomacy.sln" + github-token: ${{ secrets.GITHUB_TOKEN }} + assignees: 'artifixer, Katarn2000x, zijistark' + reviewers: 'artifixer, Katarn2000x, zijistark' \ No newline at end of file diff --git a/Bannerlord.Diplomacy.ImplementationLoader/Bannerlord.Diplomacy.ImplementationLoader.csproj b/Bannerlord.Diplomacy.ImplementationLoader/Bannerlord.Diplomacy.ImplementationLoader.csproj deleted file mode 100644 index bd56b881..00000000 --- a/Bannerlord.Diplomacy.ImplementationLoader/Bannerlord.Diplomacy.ImplementationLoader.csproj +++ /dev/null @@ -1,78 +0,0 @@ - - - - net472 - x64 - 9.0 - enable - Stable_Debug;Stable_Release;Beta_Debug;Beta_Release - $(DisplayName) - - - - Bannerlord.Diplomacy - Diplomacy - $(ModuleName) - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - \$displayname\$ - $(DisplayName) - - - \$mcmversion\$ - $(MCMVersion) - - - \$gameversionflat\$ - $(GameVersionFlat) - - - - - - - diff --git a/Bannerlord.Diplomacy.ImplementationLoader/Directory.Build.props b/Bannerlord.Diplomacy.ImplementationLoader/Directory.Build.props deleted file mode 100644 index ba3f4c92..00000000 --- a/Bannerlord.Diplomacy.ImplementationLoader/Directory.Build.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Bannerlord.Diplomacy.ImplementationLoader/ImplementationLoaderSubModule.cs b/Bannerlord.Diplomacy.ImplementationLoader/ImplementationLoaderSubModule.cs deleted file mode 100644 index ea641549..00000000 --- a/Bannerlord.Diplomacy.ImplementationLoader/ImplementationLoaderSubModule.cs +++ /dev/null @@ -1,251 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Reflection.Metadata; -using System.Reflection.PortableExecutable; - -using Bannerlord.BUTR.Shared.Helpers; - -using Bannerlord.ButterLib.Common.Extensions; -using Bannerlord.ButterLib.Common.Helpers; -using Bannerlord.ButterLib.SubModuleWrappers; - -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; - -using TaleWorlds.Core; -using TaleWorlds.Library; -using TaleWorlds.MountAndBlade; - -using AccessTools2 = HarmonyLib.BUTR.Extensions.AccessTools2; - -namespace Diplomacy -{ - /// - /// Loads all ButterLib's implementation libraries that are supported by the game. - /// - public sealed class ImplementationLoaderSubModule : MBSubModuleBaseListWrapper - { - private delegate MBSubModuleBase ConstructorDelegate(); - - private static IEnumerable LoadAllImplementations(ILogger? logger) - { - logger?.LogInformation("Loading implementations..."); - - var implementationAssemblies = new List(); - - var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic).ToList(); - - var thisAssembly = typeof(ImplementationLoaderSubModule).Assembly; - - var assemblyFile = new FileInfo(thisAssembly.Location); - if (!assemblyFile.Exists) - { - logger?.LogError("Assembly file does not exists!"); - yield break; - } - - var assemblyDirectory = assemblyFile.Directory; - if (assemblyDirectory?.Exists != true) - { - logger?.LogError("Assembly directory does not exists!"); - yield break; - } - - var implementations = assemblyDirectory.GetFiles("Bannerlord.Diplomacy.*.dll"); - if (implementations.Length == 0) - { - logger?.LogError("No implementations found."); - yield break; - } - - var gameVersion = ApplicationVersionHelper.GameVersion(); - if (gameVersion is null) - { - logger?.LogError("Failed to get Game version!"); - yield break; - } - - - var implementationsFiles = implementations.Where(x => assemblies.All(a => Path.GetFileNameWithoutExtension(a.Location) != Path.GetFileNameWithoutExtension(x.Name))); - var implementationsWithVersions = GetImplementations(implementationsFiles, logger).ToList(); - if (implementationsWithVersions.Count == 0) - { - logger?.LogError("No compatible implementations were found!"); - yield break; - } - - var implementationsForGameVersion = ImplementationForGameVersion(gameVersion.Value, implementationsWithVersions).ToList(); - switch (implementationsForGameVersion.Count) - { - case > 1: - { - logger?.LogInformation("Found multiple matching implementations:"); - foreach (var (implementation1, version1) in implementationsForGameVersion) - logger?.LogInformation("Implementation {name} for game {gameVersion}.", implementation1.Name, version1); - - - logger?.LogInformation("Loading the latest available."); - - var (implementation, version) = ImplementationLatest(implementationsForGameVersion); - logger?.LogInformation("Implementation {name} for game {gameVersion} is loaded.", implementation.Name, version); - implementationAssemblies.Add(Assembly.LoadFrom(implementation.FullName)); - break; - } - - case 1: - { - logger?.LogInformation("Found matching implementation. Loading it."); - - var (implementation, version) = implementationsForGameVersion[0]; - logger?.LogInformation("Implementation {name} for game {gameVersion} is loaded.", implementation.Name, version); - implementationAssemblies.Add(Assembly.LoadFrom(implementation.FullName)); - break; - } - - case 0: - { - logger?.LogInformation("Found no matching implementations. Loading the latest available."); - - var (implementation, version) = ImplementationLatest(implementationsWithVersions); - logger?.LogInformation("Implementation {name} for game {gameVersion} is loaded.", implementation.Name, version); - implementationAssemblies.Add(Assembly.LoadFrom(implementation.FullName)); - break; - } - } - - var subModules = implementationAssemblies.SelectMany(a => - { - try - { - return a.GetTypes().Where(t => typeof(MBSubModuleBase).IsAssignableFrom(t)); - } - catch (Exception e) when (e is ReflectionTypeLoadException) - { - logger?.LogError(e, "Implementation {name} is not compatible with the current game!", Path.GetFileName(a.Location)); - return Enumerable.Empty(); - } - - }).ToList(); - - if (subModules.Count == 0) - logger?.LogError("No implementation was initialized!"); - - foreach (var subModuleType in subModules) - { - var constructor = subModuleType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, Type.EmptyTypes, null); - if (constructor is null) - { - logger?.LogError("SubModule {subModuleType} is missing a default constructor!", subModuleType); - continue; - } - - var constructorFunc = AccessTools2.GetDelegate(constructor); - if (constructorFunc is null) - { - logger?.LogError("SubModule {subModuleType}'s default constructor could not be converted to a delegate!", subModuleType); - continue; - } - - yield return constructorFunc(); - } - - logger?.LogInformation("Finished loading implementations."); - } - - private static IEnumerable<(FileInfo Implementation, ApplicationVersion Version)> GetImplementations(IEnumerable implementations, ILogger? logger = null) - { - foreach (var implementation in implementations) - { - bool found = false; - logger?.LogInformation("Found implementation {name}.", implementation.Name); - - using var fs = File.OpenRead(implementation.FullName); - using var peReader = new PEReader(fs); - var mdReader = peReader.GetMetadataReader(MetadataReaderOptions.None); - foreach (var attr in mdReader.GetAssemblyDefinition().GetCustomAttributes().Select(ah => mdReader.GetCustomAttribute(ah))) - { - var ctorHandle = attr.Constructor; - if (ctorHandle.Kind != HandleKind.MemberReference) continue; - - var container = mdReader.GetMemberReference((MemberReferenceHandle)ctorHandle).Parent; - var name = mdReader.GetTypeReference((TypeReferenceHandle)container).Name; - if (!string.Equals(mdReader.GetString(name), "AssemblyMetadataAttribute")) continue; - - var attributeReader = mdReader.GetBlobReader(attr.Value); - attributeReader.ReadByte(); - attributeReader.ReadByte(); - var key = attributeReader.ReadSerializedString(); - var value = attributeReader.ReadSerializedString(); - if (string.Equals(key, "GameVersion")) - { - if (!ApplicationVersionHelper.TryParse(value, out var implementationGameVersion)) - { - logger?.LogError("Implementation {name} has invalid GameVersion AssemblyMetadataAttribute!", implementation.Name); - continue; - } - - found = true; - yield return (implementation, implementationGameVersion); - break; - } - } - - if (!found) - logger?.LogError("Implementation {name} is missing GameVersion AssemblyMetadataAttribute!", implementation.Name); - } - } - - private static IEnumerable<(FileInfo Implementation, ApplicationVersion Version)> ImplementationForGameVersion(ApplicationVersion gameVersion, IEnumerable<(FileInfo Implementation, ApplicationVersion Verion)> implementations) - { - foreach (var (implementation, version) in implementations) - { - if (version.Revision == -1) // Implementation does not specify the revision - { - if (gameVersion.IsSameWithoutRevision(version)) - { - yield return (implementation, version); - } - } - else // Implementation specified the revision - { - if (gameVersion.IsSameWithRevision(version)) - { - yield return (implementation, version); - } - } - } - } - private static (FileInfo Implementation, ApplicationVersion Version) ImplementationLatest(IEnumerable<(FileInfo Implementation, ApplicationVersion Version)> implementations) - { - return implementations.MaxBy(x => x.Version, new ApplicationVersionComparer(), out _); - } - - - private bool ServiceRegistrationWasCalled { get; set; } - - public override void OnServiceRegistration() - { - ServiceRegistrationWasCalled = true; - - var logger = this.GetTempServiceProvider()?.GetRequiredService>() ?? NullLogger.Instance; - SubModules.AddRange(LoadAllImplementations(logger).Select(x => new MBSubModuleBaseWrapper(x)).ToList()); - - base.OnServiceRegistration(); - } - - protected override void OnSubModuleLoad() - { - if (!ServiceRegistrationWasCalled) - { - var logger = this.GetTempServiceProvider()?.GetRequiredService>() ?? NullLogger.Instance; - SubModules.AddRange(LoadAllImplementations(logger).Select(x => new MBSubModuleBaseWrapper(x)).ToList()); - } - - base.OnSubModuleLoad(); - } - } -} \ No newline at end of file diff --git a/Bannerlord.Diplomacy.ImplementationLoader/Properties/launchSettings.json b/Bannerlord.Diplomacy.ImplementationLoader/Properties/launchSettings.json deleted file mode 100644 index dab18cb7..00000000 --- a/Bannerlord.Diplomacy.ImplementationLoader/Properties/launchSettings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "profiles": { - "Bannerlord.Diplomacy.ImplementationLoader": { - "commandName": "Executable", - "executablePath": "$(GameFolder)\\bin\\Win64_Shipping_Client\\Bannerlord.exe", - "commandLineArgs": "/singleplayer _MODULES_*Bannerlord.Harmony*Bannerlord.ButterLib*Bannerlord.UIExtenderEx*Bannerlord.MBOptionScreen*Native*SandBoxCore*Sandbox*StoryMode*CustomBattle*QuickStart*$(ModuleName)*_MODULES_", - "workingDirectory": "$(GameFolder)\\bin\\Win64_Shipping_Client", - "nativeDebugging": true - } - } -} \ No newline at end of file diff --git a/LICENSE b/LICENSE index 1f6b7991..e8de31fd 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,21 @@ -Copyright © 2020 Katarn2000x -Copyright © 2020-2021 Matthew D. Hall (zijistark) +MIT License -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Copyright © 2020-2022 Diplomacy Team -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 199a3d35..74bbce65 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ Diplomacy is a fork of a popular, now defunct Bannerlord mod called DiplomacyFix Authors: -- **Katarn2000x** -- Matthew D. Hall (**zijistark**), +- **Katarn2000x**, +- Matthew D. Hall (**zijistark**), +- Alexey Chernyshov (**artifixer**) License: [MIT License](LICENSE) diff --git a/build/common.props b/build/common.props index 617c42d0..64f66231 100644 --- a/build/common.props +++ b/build/common.props @@ -1,90 +1,120 @@ - - 1.1.9 - + + + 1.1.10 + - - - 1.0.0.33 - 1.0.31 - 2.1.1 - 4.3.10 - 2.0.0.10 - 2.1.6 - 1.6.1.61 - - - - true - true - false - true - false - true - + + + + 1.0.1.68 + + 2.2.1 + + 2.1.2 + + 4.6.0 + + 2.1.13 + + 2.0.0.82 + + 3.0.94 + + 1.0.1.24 + + 2.0.0.56 + - - $([System.IO.File]::ReadAllText($(MSBuildThisFileDirectory)/../supported-game-versions.txt)) - - - - + + net472 + x64 + 9.0 + enable + Bannerlord.Diplomacy + $(ModuleId) + Diplomacy + $(DisplayName) + - - - $([System.Text.RegularExpressions.Regex]::Split($(SGVFile), `\r\n|\r|\n`).Length) - $([MSBuild]::Subtract($(SGVLineCount), 1)) - - $([System.Text.RegularExpressions.Regex]::Split($(SGVFile), `\r\n|\r|\n`)[0]) - $([System.Text.RegularExpressions.Regex]::Split($(SGVFile), `\r\n|\r|\n`)[1]) - $([System.Text.RegularExpressions.Regex]::Split($(SGVFile), `\r\n|\r|\n`)[$(SGVLastEntryIndex)]) - - e1.1.0 - - $(GameStableVersion) - $(GameBetaVersion) - - $(GameVersionWithPrefix.Substring(1)) - + + Diplomacy Team + Diplomacy Library mod for Bannerlord + false + Copyright © 2020-2022 Diplomacy Team + Diplomacy system overhaul for Mount & Blade II: Bannerlord + - - $(OverrideGameVersion) - $(GameVersionWithPrefix.Substring(1)) - - - $([System.String]::Copy('$(GameVersionWithPrefix)').Replace('.','')) - + + true + true + false + true + false + true + - - - $([System.String]::Copy('$(GameVersion)').Replace('.','')) - e$(GameVersionFlat) - $(DefineConstants);$(GameVersionConstant) - + + $([System.IO.File]::ReadAllText($(MSBuildThisFileDirectory)/../supported-game-versions.txt)) + + + + - - - - $(BANNERLORD_STABLE_DIR) - $(BANNERLORD_BETA_DIR) - $(BANNERLORD_GAME_DIR) - + + + $([System.Text.RegularExpressions.Regex]::Split($(SGVFile), `\r\n|\r|\n`).Length) + $([MSBuild]::Subtract($(SGVLineCount), 1)) + + $([System.Text.RegularExpressions.Regex]::Split($(SGVFile), `\r\n|\r|\n`)[0]) + $([System.Text.RegularExpressions.Regex]::Split($(SGVFile), `\r\n|\r|\n`)[1]) + $([System.Text.RegularExpressions.Regex]::Split($(SGVFile), `\r\n|\r|\n`)[$(SGVLastEntryIndex)]) + + $(FirstLine) + $(SecondLine) + + $(FirstLine) + $(SecondLine) + $(LastLine) + + e1.1.0 + $(GameMinimalVersion) + $(GameStableVersion) + $(GameBetaVersion) + + $(GameVersionWithPrefix.Substring(1)) + + + $(OverrideGameVersion) + $(GameVersionWithPrefix.Substring(1)) + - - - - - $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 261550@InstallLocation) - - C:\Program Files (x86)\Steam\steamapps\common\Mount & Blade II Bannerlord - - ~/.steam/root/steamapps/common/Mount & Blade II Bannerlord - + + + + $(BANNERLORD_STABLE_DIR) + $(BANNERLORD_BETA_DIR) + $(BANNERLORD_GAME_DIR) + - \ No newline at end of file + + + + + $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 261550@InstallLocation) + + C:\Program Files (x86)\Steam\steamapps\common\Mount & Blade II Bannerlord + + ~/.steam/root/steamapps/common/Mount & Blade II Bannerlord + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/build/common.targets b/build/common.targets new file mode 100644 index 00000000..e4e3f3c8 --- /dev/null +++ b/build/common.targets @@ -0,0 +1,19 @@ + + + + + + + + + + + + + <_Parameter1>GameVersion + <_Parameter2>$(GameVersionWithPrefix) + + + + + diff --git a/changelog.txt b/changelog.txt index cf4e5192..07189d54 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,8 @@ --------------------------------------------------------------------------------------------------- +Version: 1.1.10 +Game Versions: e1.7.2 +* Compatibility with e1.7.2 +--------------------------------------------------------------------------------------------------- Version: 1.1.9 Game Versions: e1.5.9,e1.5.10,e1.6.0,e1.6.1,e1.6.2,e1.6.3,e1.6.4,e1.6.5,e1.7.0 * Compatibility with e1.7.0 diff --git a/src/Bannerlord.Diplomacy.csproj b/src/Bannerlord.Diplomacy.csproj deleted file mode 100644 index 12173fed..00000000 --- a/src/Bannerlord.Diplomacy.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - $(MSBuildProjectName) - Diplomacy - $(ModuleName).$(GameVersion) - - - - net472 - x64 - 9.0 - enable - Stable_Debug;Stable_Release;Beta_Debug;Beta_Release - $(DisplayName) - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - diff --git a/Bannerlord.Diplomacy.sln b/src/Bannerlord.Diplomacy.sln old mode 100755 new mode 100644 similarity index 62% rename from Bannerlord.Diplomacy.sln rename to src/Bannerlord.Diplomacy.sln index 34b63680..9bdbf4b9 --- a/Bannerlord.Diplomacy.sln +++ b/src/Bannerlord.Diplomacy.sln @@ -3,32 +3,38 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31005.135 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bannerlord.Diplomacy", "src\Bannerlord.Diplomacy.csproj", "{AD3695A8-2BDD-44AF-A115-54F839A9EC2A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bannerlord.Diplomacy.ImplementationLoader", "Bannerlord.Diplomacy.ImplementationLoader\Bannerlord.Diplomacy.ImplementationLoader.csproj", "{F8659754-47D5-472D-8939-666874D8C9B9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bannerlord.Diplomacy", "Bannerlord.Diplomacy\Bannerlord.Diplomacy.csproj", "{AD3695A8-2BDD-44AF-A115-54F839A9EC2A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{12CCA2B5-A874-47B3-BB43-799275014D7B}" ProjectSection(SolutionItems) = preProject - changelog.txt = changelog.txt - supported-game-versions.txt = supported-game-versions.txt + ..\changelog.txt = ..\changelog.txt + ..\supported-game-versions.txt = ..\supported-game-versions.txt EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{CB20C6C8-2857-4B1E-9C00-265893C094E3}" ProjectSection(SolutionItems) = preProject - build\common.props = build\common.props + ..\build\common.props = ..\build\common.props + ..\build\common.targets = ..\build\common.targets EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{AE56FFC8-0129-4E0F-83C0-D00011A2B127}" + ProjectSection(SolutionItems) = preProject + ..\.github\dependabot.yml = ..\.github\dependabot.yml + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{8CBC023C-EB40-415D-8A78-B6B7F82523E9}" ProjectSection(SolutionItems) = preProject - .github\workflows\build.yml = .github\workflows\build.yml + ..\.github\workflows\build.yml = ..\.github\workflows\build.yml + ..\.github\workflows\dotnet-format-daily.yml = ..\.github\workflows\dotnet-format-daily.yml + ..\.github\workflows\TestBuild.yml = ..\.github\workflows\TestBuild.yml EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Beta_Debug|x64 = Beta_Debug|x64 Beta_Release|x64 = Beta_Release|x64 + Minimal_Debug|x64 = Minimal_Debug|x64 + Minimal_Release|x64 = Minimal_Release|x64 Stable_Debug|x64 = Stable_Debug|x64 Stable_Release|x64 = Stable_Release|x64 EndGlobalSection @@ -37,25 +43,19 @@ Global {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Beta_Debug|x64.Build.0 = Beta_Debug|x64 {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Beta_Release|x64.ActiveCfg = Beta_Release|x64 {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Beta_Release|x64.Build.0 = Beta_Release|x64 + {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Minimal_Debug|x64.ActiveCfg = Stable_Debug|x64 + {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Minimal_Debug|x64.Build.0 = Stable_Debug|x64 + {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Minimal_Release|x64.ActiveCfg = Stable_Release|x64 + {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Minimal_Release|x64.Build.0 = Stable_Release|x64 {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Stable_Debug|x64.ActiveCfg = Stable_Debug|x64 {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Stable_Debug|x64.Build.0 = Stable_Debug|x64 {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Stable_Release|x64.ActiveCfg = Stable_Release|x64 {AD3695A8-2BDD-44AF-A115-54F839A9EC2A}.Stable_Release|x64.Build.0 = Stable_Release|x64 - {F8659754-47D5-472D-8939-666874D8C9B9}.Beta_Debug|x64.ActiveCfg = Beta_Debug|x64 - {F8659754-47D5-472D-8939-666874D8C9B9}.Beta_Debug|x64.Build.0 = Beta_Debug|x64 - {F8659754-47D5-472D-8939-666874D8C9B9}.Beta_Release|x64.ActiveCfg = Beta_Release|x64 - {F8659754-47D5-472D-8939-666874D8C9B9}.Beta_Release|x64.Build.0 = Beta_Release|x64 - {F8659754-47D5-472D-8939-666874D8C9B9}.Stable_Debug|x64.ActiveCfg = Stable_Debug|x64 - {F8659754-47D5-472D-8939-666874D8C9B9}.Stable_Debug|x64.Build.0 = Stable_Debug|x64 - {F8659754-47D5-472D-8939-666874D8C9B9}.Stable_Release|x64.ActiveCfg = Stable_Release|x64 - {F8659754-47D5-472D-8939-666874D8C9B9}.Stable_Release|x64.Build.0 = Stable_Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {CB20C6C8-2857-4B1E-9C00-265893C094E3} = {12CCA2B5-A874-47B3-BB43-799275014D7B} - {AE56FFC8-0129-4E0F-83C0-D00011A2B127} = {12CCA2B5-A874-47B3-BB43-799275014D7B} {8CBC023C-EB40-415D-8A78-B6B7F82523E9} = {AE56FFC8-0129-4E0F-83C0-D00011A2B127} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj b/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj new file mode 100644 index 00000000..e2a795ad --- /dev/null +++ b/src/Bannerlord.Diplomacy/Bannerlord.Diplomacy.csproj @@ -0,0 +1,69 @@ + + + + $(ModuleName).$(GameVersion) + Stable_Debug;Stable_Release;Beta_Debug;Beta_Release + + + + + $([System.String]::Copy('$(GameVersion)').Replace('.','')) + e$(GameVersionFlat) + $(DefineConstants);$(GameVersionConstant) + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + \$displayname\$ + $(DisplayName) + + + \$mcmversion\$ + $(MCMVersion) + + + + diff --git a/src/CampaignBehaviors/AllianceBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/AllianceBehavior.cs similarity index 99% rename from src/CampaignBehaviors/AllianceBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/AllianceBehavior.cs index 022a1d08..a07dd990 100644 --- a/src/CampaignBehaviors/AllianceBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/AllianceBehavior.cs @@ -135,4 +135,4 @@ private static void BreakAllAlliances(Clan clan) BreakAllianceAction.Apply(kingdom, alliedKingdom); } } -} +} \ No newline at end of file diff --git a/src/CampaignBehaviors/CivilWarBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/CivilWarBehavior.cs similarity index 99% rename from src/CampaignBehaviors/CivilWarBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/CivilWarBehavior.cs index bc61b87b..b9d904c2 100644 --- a/src/CampaignBehaviors/CivilWarBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/CivilWarBehavior.cs @@ -1,13 +1,15 @@  -using System; -using System.Collections.Generic; -using System.Linq; using Diplomacy.CivilWar; using Diplomacy.CivilWar.Actions; using Diplomacy.CivilWar.Factions; using Diplomacy.CivilWar.Scoring; using Diplomacy.DiplomaticAction.WarPeace; using Diplomacy.Extensions; + +using System; +using System.Collections.Generic; +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Election; using TaleWorlds.Core; @@ -216,4 +218,4 @@ public override void SyncData(IDataStore dataStore) } } } -} +} \ No newline at end of file diff --git a/src/CampaignBehaviors/CooldownBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/CooldownBehavior.cs similarity index 99% rename from src/CampaignBehaviors/CooldownBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/CooldownBehavior.cs index 05b8037f..da0c22ac 100644 --- a/src/CampaignBehaviors/CooldownBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/CooldownBehavior.cs @@ -3,7 +3,9 @@ using Diplomacy.DiplomaticAction.NonAggressionPact; using Diplomacy.Event; using Diplomacy.Extensions; + using Microsoft.Extensions.Logging; + using TaleWorlds.CampaignSystem; namespace Diplomacy.CampaignBehaviors @@ -55,7 +57,7 @@ private void RegisterPeaceProposalCooldown(Kingdom kingdom) { LogFactory.Get() .LogTrace($"[{CampaignTime.Now}] {kingdom.Name} sent a peace proposal."); - + _cooldownManager.UpdateLastPeaceProposalTime(kingdom, CampaignTime.Now); } @@ -70,4 +72,4 @@ public override void SyncData(IDataStore dataStore) } } } -} +} \ No newline at end of file diff --git a/src/CampaignBehaviors/DiplomaticAgreementBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/DiplomaticAgreementBehavior.cs similarity index 98% rename from src/CampaignBehaviors/DiplomaticAgreementBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/DiplomaticAgreementBehavior.cs index d0c64d1e..8d220b0b 100644 --- a/src/CampaignBehaviors/DiplomaticAgreementBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/DiplomaticAgreementBehavior.cs @@ -9,6 +9,7 @@ using System.Linq; using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.CharacterDevelopment; using TaleWorlds.Core; namespace Diplomacy.CampaignBehaviors @@ -86,4 +87,4 @@ public override void SyncData(IDataStore dataStore) } } } -} +} \ No newline at end of file diff --git a/src/CampaignBehaviors/ExpansionismBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/ExpansionismBehavior.cs similarity index 97% rename from src/CampaignBehaviors/ExpansionismBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/ExpansionismBehavior.cs index e2a899d9..0ae34ea4 100644 --- a/src/CampaignBehaviors/ExpansionismBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/ExpansionismBehavior.cs @@ -1,5 +1,6 @@ using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; +using TaleWorlds.CampaignSystem.Settlements; namespace Diplomacy.CampaignBehaviors { @@ -47,4 +48,4 @@ private void OnSettlementOwnerChanged(Settlement settlement, } } } -} +} \ No newline at end of file diff --git a/src/CampaignBehaviors/KeepFiefAfterSiegeBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/KeepFiefAfterSiegeBehavior.cs similarity index 98% rename from src/CampaignBehaviors/KeepFiefAfterSiegeBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/KeepFiefAfterSiegeBehavior.cs index 94a412f8..1416bece 100644 --- a/src/CampaignBehaviors/KeepFiefAfterSiegeBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/KeepFiefAfterSiegeBehavior.cs @@ -3,6 +3,7 @@ using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; +using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.Core; using TaleWorlds.Library; using TaleWorlds.Localization; @@ -58,4 +59,4 @@ private TextObject GetKeepFiefText(Settlement settlement) return txt; } } -} +} \ No newline at end of file diff --git a/src/CampaignBehaviors/MaintainInfluenceBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/MaintainInfluenceBehavior.cs similarity index 88% rename from src/CampaignBehaviors/MaintainInfluenceBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/MaintainInfluenceBehavior.cs index c9969eca..5c34a88a 100644 --- a/src/CampaignBehaviors/MaintainInfluenceBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/MaintainInfluenceBehavior.cs @@ -1,8 +1,11 @@ using Diplomacy.Extensions; + using System; using System.Linq; + using TaleWorlds.CampaignSystem; -using TaleWorlds.CampaignSystem.Barterables; +using TaleWorlds.CampaignSystem.BarterSystem.Barterables; +using TaleWorlds.CampaignSystem.Settlements; namespace Diplomacy.CampaignBehaviors { @@ -45,7 +48,7 @@ private void ReduceCorruption(Clan clan) if (settlementToTrade is null) return default; - var targetClan = ((Kingdom)ownerClan.MapFaction).Clans + var targetClan = ((Kingdom) ownerClan.MapFaction).Clans .Where(c => c != ownerClan && !c.HasMaximumFiefs() && !c.IsUnderMercenaryService && c != Clan.PlayerClan) .OrderByDescending(c => GetGoldValueForFief(c, settlementToTrade)) .FirstOrDefault(); @@ -60,8 +63,8 @@ private void ReduceCorruption(Clan clan) private static int GetGoldValueForFief(Clan buyerClan, Settlement settlement) { - return (int)Math.Min(Campaign.Current.Models.SettlementValueModel.CalculateValueForFaction(settlement, buyerClan), + return (int) Math.Min(Campaign.Current.Models.SettlementValueModel.CalculateSettlementValueForFaction(settlement, buyerClan), buyerClan.Gold * 0.8); } } -} +} \ No newline at end of file diff --git a/src/CampaignBehaviors/MessengerBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/MessengerBehavior.cs similarity index 91% rename from src/CampaignBehaviors/MessengerBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/MessengerBehavior.cs index 5015e671..6b76f9f1 100644 --- a/src/CampaignBehaviors/MessengerBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/MessengerBehavior.cs @@ -15,11 +15,7 @@ internal sealed class MessengerBehavior : CampaignBehaviorBase public override void RegisterEvents() { Events.MessengerSent.AddNonSerializedListener(this, OnMessengerSent); -#if e165 || e170 CampaignEvents.OnAfterSessionLaunchedEvent.AddNonSerializedListener(this, OnAfterSessionLaunched); -#else - CampaignEvents.OnSessionLaunchedEvent.AddNonSerializedListener(this, OnAfterSessionLaunched); -#endif CampaignEvents.HourlyTickEvent.AddNonSerializedListener(this, HasMessengerArrivedHourlyTick); } @@ -44,4 +40,4 @@ public void OnAfterSessionLaunched(CampaignGameStarter game) CampaignEvents.TickEvent.AddNonSerializedListener(_messengerManager, _messengerManager.CleanUpAfterLoad); } } -} +} \ No newline at end of file diff --git a/src/CampaignBehaviors/UIBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/UIBehavior.cs similarity index 93% rename from src/CampaignBehaviors/UIBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/UIBehavior.cs index f8201fd7..7bc95520 100644 --- a/src/CampaignBehaviors/UIBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/UIBehavior.cs @@ -1,6 +1,9 @@ using Diplomacy.Views; + using SandBox.View.Map; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.GameState; using TaleWorlds.Core; namespace Diplomacy.CampaignBehaviors @@ -18,7 +21,7 @@ private void AddUIElements(float obj) if (!Settings.Instance!.EnableWarExhaustion) { CampaignEvents.TickEvent.ClearListeners(this); - } + } else if (Game.Current.GameStateManager.ActiveState is MapState) { MapScreen.Instance.AddMapView(); @@ -30,4 +33,4 @@ public override void SyncData(IDataStore dataStore) { } } -} +} \ No newline at end of file diff --git a/src/CampaignBehaviors/WarExhaustionBehavior.cs b/src/Bannerlord.Diplomacy/CampaignBehaviors/WarExhaustionBehavior.cs similarity index 98% rename from src/CampaignBehaviors/WarExhaustionBehavior.cs rename to src/Bannerlord.Diplomacy/CampaignBehaviors/WarExhaustionBehavior.cs index 516ff61e..7b4351d4 100644 --- a/src/CampaignBehaviors/WarExhaustionBehavior.cs +++ b/src/Bannerlord.Diplomacy/CampaignBehaviors/WarExhaustionBehavior.cs @@ -6,6 +6,8 @@ using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; +using TaleWorlds.CampaignSystem.MapEvents; +using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.Core; namespace Diplomacy.CampaignBehaviors @@ -142,16 +144,12 @@ private void ConsiderPeaceActions(Kingdom kingdom) private bool IsValidQuestState(Kingdom kingdom1, Kingdom kingdom2) { -#if e170 var currentStoryMode = StoryMode.StoryModeManager.Current; -#else - var currentStoryMode = StoryMode.StoryMode.Current; -#endif // not in story mode if (currentStoryMode == null) { return true; - } + } var isValidQuestState = true; var opposingKingdom = PlayerHelpers.GetOpposingKingdomIfPlayerKingdomProvided(kingdom1, kingdom2); @@ -165,4 +163,4 @@ private bool IsValidQuestState(Kingdom kingdom1, Kingdom kingdom2) return isValidQuestState; } } -} +} \ No newline at end of file diff --git a/src/Character/PlayerCharacterTraitEventExperience.cs b/src/Bannerlord.Diplomacy/Character/PlayerCharacterTraitEventExperience.cs similarity index 83% rename from src/Character/PlayerCharacterTraitEventExperience.cs rename to src/Bannerlord.Diplomacy/Character/PlayerCharacterTraitEventExperience.cs index 630269e9..511626f4 100644 --- a/src/Character/PlayerCharacterTraitEventExperience.cs +++ b/src/Bannerlord.Diplomacy/Character/PlayerCharacterTraitEventExperience.cs @@ -1,5 +1,6 @@ using System; -using TaleWorlds.CampaignSystem; + +using TaleWorlds.CampaignSystem.CharacterDevelopment; namespace Diplomacy.Character { @@ -19,10 +20,10 @@ public void Apply() PlayerCharacterTraitHelper.UpdateTrait(this); } - private static readonly Func Create = (a,b) => new PlayerCharacterTraitEventExperience(a, b); + private static readonly Func Create = (a, b) => new PlayerCharacterTraitEventExperience(a, b); public static readonly PlayerCharacterTraitEventExperience FiefGranted = Create(50, DefaultTraits.Generosity); public static readonly PlayerCharacterTraitEventExperience FiefClaimed = Create(-50, DefaultTraits.Generosity); } -} +} \ No newline at end of file diff --git a/src/Character/PlayerCharacterTraitHelper.cs b/src/Bannerlord.Diplomacy/Character/PlayerCharacterTraitHelper.cs similarity index 92% rename from src/Character/PlayerCharacterTraitHelper.cs rename to src/Bannerlord.Diplomacy/Character/PlayerCharacterTraitHelper.cs index 81682831..9da0860e 100644 --- a/src/Character/PlayerCharacterTraitHelper.cs +++ b/src/Bannerlord.Diplomacy/Character/PlayerCharacterTraitHelper.cs @@ -1,11 +1,13 @@ using HarmonyLib; + using System; + using TaleWorlds.CampaignSystem; -using TaleWorlds.CampaignSystem.CharacterDevelopment.Managers; +using TaleWorlds.CampaignSystem.CharacterDevelopment; namespace Diplomacy.Character { - + internal class PlayerCharacterTraitHelper { private static readonly Action AddPlayerTraitXPAndLogEntry = @@ -21,4 +23,4 @@ public static void UpdateTrait(PlayerCharacterTraitEventExperience eventExperien UpdateTrait(eventExperience.Trait, eventExperience.Experience); } } -} +} \ No newline at end of file diff --git a/src/Cheats.cs b/src/Bannerlord.Diplomacy/Cheats.cs similarity index 97% rename from src/Cheats.cs rename to src/Bannerlord.Diplomacy/Cheats.cs index 582b8501..e725ade6 100644 --- a/src/Cheats.cs +++ b/src/Bannerlord.Diplomacy/Cheats.cs @@ -1,8 +1,11 @@ -using System.Collections.Generic; -using Diplomacy.CivilWar.Actions; +using Diplomacy.CivilWar.Actions; using Diplomacy.DiplomaticAction.Alliance; using Diplomacy.Extensions; + using JetBrains.Annotations; + +using System.Collections.Generic; + using TaleWorlds.CampaignSystem; using TaleWorlds.Engine.GauntletUI; using TaleWorlds.Library; @@ -93,7 +96,7 @@ private static string SetWarExhaustion(List strings) var current = WarExhaustionManager.Instance.GetWarExhaustion(kingdom1, kingdom2); var toAdd = (warExhaustion - current) / Settings.Instance!.WarExhaustionPerCasualty; - WarExhaustionManager.Instance.AddCasualtyWarExhaustion(kingdom1, kingdom2, (int)toAdd); + WarExhaustionManager.Instance.AddCasualtyWarExhaustion(kingdom1, kingdom2, (int) toAdd); return "done!"; } @@ -139,4 +142,4 @@ public static string ReloadUI(List strings) return "Reloaded"; } } -} +} \ No newline at end of file diff --git a/src/CivilWar/Actions/ChangeKingdomBannerAction.cs b/src/Bannerlord.Diplomacy/CivilWar/Actions/ChangeKingdomBannerAction.cs similarity index 94% rename from src/CivilWar/Actions/ChangeKingdomBannerAction.cs rename to src/Bannerlord.Diplomacy/CivilWar/Actions/ChangeKingdomBannerAction.cs index dc38d247..5c69421f 100644 --- a/src/CivilWar/Actions/ChangeKingdomBannerAction.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Actions/ChangeKingdomBannerAction.cs @@ -1,12 +1,18 @@ -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using ColorMine.ColorSpaces; +using ColorMine.ColorSpaces; using ColorMine.ColorSpaces.Comparisons; + using Diplomacy.Event; using Diplomacy.Extensions; + using HarmonyLib; + +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.Party; +using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.Core; namespace Diplomacy.CivilWar.Actions @@ -89,7 +95,7 @@ public static void Apply(Kingdom kingdom, bool isRebelKingdom = false) else { // choose random unused color from the palette - List currentBackgroundColors = Kingdom.All.Where(x => !x.IsEliminated).Select(x => (uint)PrimaryBannerColorProp.GetValue(x)).ToList(); + List currentBackgroundColors = Kingdom.All.Where(x => !x.IsEliminated).Select(x => (uint) PrimaryBannerColorProp.GetValue(x)).ToList(); backgroundColor = BannerManager.ColorPalette.Where(x => !currentBackgroundColors.Contains(x.Value.Color)).GetRandomElementInefficiently().Value.Color; sigilColor = GetUniqueSigilColor(backgroundColor); } @@ -105,7 +111,7 @@ private static uint GetUniqueSigilColor(uint backgroundColor) uint selectedColor = BannerManager.ColorPalette.Where(x => background.Compare(GetRgb(x.Value.Color), new Cie1976Comparison()) > 40).GetRandomElementInefficiently().Value.Color; if (backgroundColor == RebelBackgroundColor) { - List currentSigilColors = Kingdom.All.Where(x => !x.IsEliminated && x.IsRebelKingdom()).Select(x => (uint)SecondaryBannerColorProp.GetValue(x)).ToList(); + List currentSigilColors = Kingdom.All.Where(x => !x.IsEliminated && x.IsRebelKingdom()).Select(x => (uint) SecondaryBannerColorProp.GetValue(x)).ToList(); var colors = BannerManager.ColorPalette.Select(x => x.Value.Color) .Where(x => background.Compare(GetRgb(x), new Cie1976Comparison()) > 40) .Where(x => !currentSigilColors.Contains(x)) @@ -128,4 +134,4 @@ private static Rgb GetRgb(uint color) return rgb; } } -} +} \ No newline at end of file diff --git a/src/CivilWar/Actions/ConsolidateKingdomsAction.cs b/src/Bannerlord.Diplomacy/CivilWar/Actions/ConsolidateKingdomsAction.cs similarity index 92% rename from src/CivilWar/Actions/ConsolidateKingdomsAction.cs rename to src/Bannerlord.Diplomacy/CivilWar/Actions/ConsolidateKingdomsAction.cs index 7ff6f24a..368f20b3 100644 --- a/src/CivilWar/Actions/ConsolidateKingdomsAction.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Actions/ConsolidateKingdomsAction.cs @@ -1,7 +1,10 @@ -using System.Collections.Generic; -using Diplomacy.CivilWar.Factions; +using Diplomacy.CivilWar.Factions; + +using System.Collections.Generic; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; +using TaleWorlds.CampaignSystem.Settlements; namespace Diplomacy.CivilWar.Actions { @@ -47,4 +50,4 @@ public static void Apply(RebelFaction rebelFaction) } } -} +} \ No newline at end of file diff --git a/src/CivilWar/Actions/CreateFactionAction.cs b/src/Bannerlord.Diplomacy/CivilWar/Actions/CreateFactionAction.cs similarity index 98% rename from src/CivilWar/Actions/CreateFactionAction.cs rename to src/Bannerlord.Diplomacy/CivilWar/Actions/CreateFactionAction.cs index 8c4ac625..8c1264f9 100644 --- a/src/CivilWar/Actions/CreateFactionAction.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Actions/CreateFactionAction.cs @@ -1,11 +1,11 @@ -using System.Collections.Generic; -using System.Linq; - -using Diplomacy.CivilWar.Factions; +using Diplomacy.CivilWar.Factions; using Diplomacy.CivilWar.Scoring; using Diplomacy.Costs; using Diplomacy.Extensions; +using System.Collections.Generic; +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.Core; using TaleWorlds.Library; @@ -74,7 +74,7 @@ public static IEnumerable CanApply(Clan clan, RebelDemandType? deman { yield return new TextObject("{=luvsD6Zn}Cannot create a faction in a rebel kingdom."); } - + // ruling clan can't create factions if (clan == clan.Kingdom!.RulingClan) { @@ -137,4 +137,4 @@ public static IEnumerable CanApply(Clan clan, RebelDemandType? deman } } } -} +} \ No newline at end of file diff --git a/src/CivilWar/Actions/JoinFactionAction.cs b/src/Bannerlord.Diplomacy/CivilWar/Actions/JoinFactionAction.cs similarity index 97% rename from src/CivilWar/Actions/JoinFactionAction.cs rename to src/Bannerlord.Diplomacy/CivilWar/Actions/JoinFactionAction.cs index d5590c3e..3e19ffb3 100644 --- a/src/CivilWar/Actions/JoinFactionAction.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Actions/JoinFactionAction.cs @@ -1,8 +1,10 @@ -using System.Collections.Generic; -using System.Linq; -using Diplomacy.CivilWar.Factions; +using Diplomacy.CivilWar.Factions; using Diplomacy.CivilWar.Scoring; using Diplomacy.Extensions; + +using System.Collections.Generic; +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.Localization; @@ -10,12 +12,12 @@ namespace Diplomacy.CivilWar.Actions { public class JoinFactionAction { - public static void Apply(Clan clan, RebelFaction rebelFaction) + public static void Apply(Clan clan, RebelFaction rebelFaction) { rebelFaction.AddClan(clan); } - public static bool ShouldApply(Clan clan, RebelFaction rebelFaction) + public static bool ShouldApply(Clan clan, RebelFaction rebelFaction) { if (!CanApply(clan, rebelFaction, out _)) return false; @@ -92,4 +94,4 @@ public static IEnumerable CanApply(Clan clan, RebelFaction rebelFact } } } -} +} \ No newline at end of file diff --git a/src/CivilWar/Actions/LeaveFactionAction.cs b/src/Bannerlord.Diplomacy/CivilWar/Actions/LeaveFactionAction.cs similarity index 99% rename from src/CivilWar/Actions/LeaveFactionAction.cs rename to src/Bannerlord.Diplomacy/CivilWar/Actions/LeaveFactionAction.cs index 5e9a8274..59867774 100644 --- a/src/CivilWar/Actions/LeaveFactionAction.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Actions/LeaveFactionAction.cs @@ -1,4 +1,5 @@ using Diplomacy.CivilWar.Factions; + using TaleWorlds.CampaignSystem; namespace Diplomacy.CivilWar.Actions @@ -10,4 +11,4 @@ public static void Apply(Clan clan, RebelFaction rebelFaction) rebelFaction.RemoveClan(clan); } } -} +} \ No newline at end of file diff --git a/src/CivilWar/Actions/StartRebellionAction.cs b/src/Bannerlord.Diplomacy/CivilWar/Actions/StartRebellionAction.cs similarity index 97% rename from src/CivilWar/Actions/StartRebellionAction.cs rename to src/Bannerlord.Diplomacy/CivilWar/Actions/StartRebellionAction.cs index 39263139..dc2c57ec 100644 --- a/src/CivilWar/Actions/StartRebellionAction.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Actions/StartRebellionAction.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; -using System.Linq; +using Diplomacy.CivilWar.Factions; -using Diplomacy.CivilWar.Factions; +using System.Collections.Generic; +using System.Linq; using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; diff --git a/src/CivilWar/FactionNameGenerator.cs b/src/Bannerlord.Diplomacy/CivilWar/FactionNameGenerator.cs similarity index 90% rename from src/CivilWar/FactionNameGenerator.cs rename to src/Bannerlord.Diplomacy/CivilWar/FactionNameGenerator.cs index 71574736..912ee85c 100644 --- a/src/CivilWar/FactionNameGenerator.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/FactionNameGenerator.cs @@ -1,6 +1,8 @@ -using System.Collections.Generic; +using Diplomacy.CivilWar.Factions; + +using System.Collections.Generic; using System.Linq; -using Diplomacy.CivilWar.Factions; + using TaleWorlds.CampaignSystem; using TaleWorlds.Core; using TaleWorlds.Localization; @@ -12,31 +14,46 @@ internal class FactionNameGenerator private static Dictionary> CultureToKingdomTitles { get; } = new() { // {"empire", new() { } }, - {"aserai", new() { - new("{=iLMqCvmk}Sultanate of {CLAN_NAME}"), - new("{=EnpnMNRH}Emirate of {CLAN_NAME}"), - new("{=uzd9mxIC}Banu {CLAN_NAME}"), - new("{=NTFz3B56}Sharifate of {CLAN_NAME}") - } }, - {"battania", new() + "aserai", + new() + { + new("{=iLMqCvmk}Sultanate of {CLAN_NAME}"), + new("{=EnpnMNRH}Emirate of {CLAN_NAME}"), + new("{=uzd9mxIC}Banu {CLAN_NAME}"), + new("{=NTFz3B56}Sharifate of {CLAN_NAME}") + } + }, { - new(StringConstants.FactionConfederation), - } }, - {"khuzait", new() + "battania", + new() + { + new(StringConstants.FactionConfederation), + } + }, { - new("{=mEHufuep}Khaganate of {CLAN_NAME}", 0.5f), - new("{=DTBaowBi}{CLAN_NAME} Khaganate", 0.5f), - new("{=pRgQF4WY}{CLAN_NAME} Dynasty") - } }, - {"sturgia", new() + "khuzait", + new() + { + new("{=mEHufuep}Khaganate of {CLAN_NAME}", 0.5f), + new("{=DTBaowBi}{CLAN_NAME} Khaganate", 0.5f), + new("{=pRgQF4WY}{CLAN_NAME} Dynasty") + } + }, { - new("{=z5VPFrfh}Earldom of {CLAN_NAME}") - } }, - {"vlandia", new() + "sturgia", + new() + { + new("{=z5VPFrfh}Earldom of {CLAN_NAME}") + } + }, { - new("{=A4zT7H5g}Grand Duchy of {CLAN_NAME}") - } }, + "vlandia", + new() + { + new("{=A4zT7H5g}Grand Duchy of {CLAN_NAME}") + } + }, }; private static readonly List CommonKingdomTitles = new() diff --git a/src/CivilWar/Factions/AbdicationFaction.cs b/src/Bannerlord.Diplomacy/CivilWar/Factions/AbdicationFaction.cs similarity index 97% rename from src/CivilWar/Factions/AbdicationFaction.cs rename to src/Bannerlord.Diplomacy/CivilWar/Factions/AbdicationFaction.cs index 334d1aed..7dd0b86b 100644 --- a/src/CivilWar/Factions/AbdicationFaction.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Factions/AbdicationFaction.cs @@ -1,6 +1,6 @@ -using System.Collections.Generic; +using Diplomacy.CivilWar.Actions; -using Diplomacy.CivilWar.Actions; +using System.Collections.Generic; using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Election; @@ -55,7 +55,7 @@ public void DestroyFactionBecauseDemandSatisfied() { RebelFactionManager.DestroyRebelFaction(this); - var strVars = new Dictionary { { "PARENT_KINGDOM", this.ParentKingdom.Name }, { "REBELS", this.Name }}; + var strVars = new Dictionary { { "PARENT_KINGDOM", this.ParentKingdom.Name }, { "REBELS", this.Name } }; InformationManager.ShowInquiry( new InquiryData( _TAbdicateTitle.ToString(), @@ -68,4 +68,4 @@ public void DestroyFactionBecauseDemandSatisfied() null), true); } } -} +} \ No newline at end of file diff --git a/src/CivilWar/Factions/RebelDemandType.cs b/src/Bannerlord.Diplomacy/CivilWar/Factions/RebelDemandType.cs similarity index 100% rename from src/CivilWar/Factions/RebelDemandType.cs rename to src/Bannerlord.Diplomacy/CivilWar/Factions/RebelDemandType.cs diff --git a/src/CivilWar/Factions/RebelFaction.cs b/src/Bannerlord.Diplomacy/CivilWar/Factions/RebelFaction.cs similarity index 90% rename from src/CivilWar/Factions/RebelFaction.cs rename to src/Bannerlord.Diplomacy/CivilWar/Factions/RebelFaction.cs index 658e5e76..725e8030 100644 --- a/src/CivilWar/Factions/RebelFaction.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Factions/RebelFaction.cs @@ -1,10 +1,15 @@ -using System; +using Diplomacy.CivilWar.Actions; + +using JetBrains.Annotations; + +using System; using System.Collections.Generic; using System.Linq; -using Diplomacy.CivilWar.Actions; -using JetBrains.Annotations; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; +using TaleWorlds.CampaignSystem.CharacterDevelopment; +using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.Core; using TaleWorlds.Library; using TaleWorlds.Localization; @@ -16,19 +21,19 @@ public abstract class RebelFaction { [SaveableProperty(1)] public Clan SponsorClan { get; private set; } - [SaveableField(2)] [UsedImplicitly] private List _participatingClans; + [SaveableField(2)][UsedImplicitly] private List _participatingClans; - [SaveableProperty(3)] [UsedImplicitly] public Kingdom ParentKingdom { get; private set; } + [SaveableProperty(3)][UsedImplicitly] public Kingdom ParentKingdom { get; private set; } [SaveableProperty(4)] public Kingdom? RebelKingdom { get; private set; } [SaveableProperty(5)] public bool AtWar { get; set; } - [SaveableProperty(6)] [UsedImplicitly] public CampaignTime DateStarted { get; private set; } + [SaveableProperty(6)][UsedImplicitly] public CampaignTime DateStarted { get; private set; } [SaveableProperty(7)] public TextObject Name { get; private set; } - [SaveableProperty(8)] [UsedImplicitly] public Dictionary OriginalFiefOwners { get; private set; } + [SaveableProperty(8)][UsedImplicitly] public Dictionary OriginalFiefOwners { get; private set; } public abstract RebelDemandType RebelDemandType { get; } @@ -169,18 +174,18 @@ private void ApplyInfluenceAndReputationChanges(bool success) private void ApplyReputationChanges() { var loyalistCombinations = from clan in ParentKingdom.Clans - from otherClan in ParentKingdom.Clans - where clan.Id < otherClan.Id - select Tuple.Create(clan, otherClan); + from otherClan in ParentKingdom.Clans + where clan.Id < otherClan.Id + select Tuple.Create(clan, otherClan); var rebelCombinations = from clan in Clans - from otherClan in Clans - where clan.Id < otherClan.Id - select Tuple.Create(clan, otherClan); + from otherClan in Clans + where clan.Id < otherClan.Id + select Tuple.Create(clan, otherClan); var opposingCombinations = from clan in ParentKingdom.Clans - from otherClan in Clans - select Tuple.Create(clan, otherClan); + from otherClan in Clans + select Tuple.Create(clan, otherClan); foreach (Tuple tuple in loyalistCombinations) ChangeRelationAction.ApplyRelationChangeBetweenHeroes(tuple.Item1.Leader, tuple.Item2.Leader, diff --git a/src/CivilWar/Factions/SecessionFaction.cs b/src/Bannerlord.Diplomacy/CivilWar/Factions/SecessionFaction.cs similarity index 96% rename from src/CivilWar/Factions/SecessionFaction.cs rename to src/Bannerlord.Diplomacy/CivilWar/Factions/SecessionFaction.cs index 44f309af..70e1abad 100644 --- a/src/CivilWar/Factions/SecessionFaction.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Factions/SecessionFaction.cs @@ -1,6 +1,6 @@ -using System.Collections.Generic; +using Diplomacy.CivilWar.Actions; -using Diplomacy.CivilWar.Actions; +using System.Collections.Generic; using TaleWorlds.CampaignSystem; using TaleWorlds.Core; @@ -51,4 +51,4 @@ protected override void ApplyDemand() null), true); } } -} +} \ No newline at end of file diff --git a/src/CivilWar/RebelFactionManager.cs b/src/Bannerlord.Diplomacy/CivilWar/RebelFactionManager.cs similarity index 93% rename from src/CivilWar/RebelFactionManager.cs rename to src/Bannerlord.Diplomacy/CivilWar/RebelFactionManager.cs index 6d9c6ff8..4c263a70 100644 --- a/src/CivilWar/RebelFactionManager.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/RebelFactionManager.cs @@ -1,7 +1,10 @@ -using System.Collections.Generic; -using System.Linq; -using Diplomacy.CivilWar.Factions; +using Diplomacy.CivilWar.Factions; + using JetBrains.Annotations; + +using System.Collections.Generic; +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.SaveSystem; @@ -11,11 +14,14 @@ internal sealed class RebelFactionManager { public static RebelFactionManager? Instance { get; private set; } - [SaveableProperty(1)] [UsedImplicitly] + [SaveableProperty(1)] + [UsedImplicitly] public Dictionary> RebelFactions { get; private set; } - [SaveableProperty(2)] [UsedImplicitly] + [SaveableProperty(2)] + [UsedImplicitly] public List DeadRebelKingdoms { get; private set; } - [SaveableProperty(3)] [UsedImplicitly] + [SaveableProperty(3)] + [UsedImplicitly] public Dictionary LastCivilWar { get; private set; } public RebelFactionManager() diff --git a/src/CivilWar/Scoring/AbdicationDemandScore.cs b/src/Bannerlord.Diplomacy/CivilWar/Scoring/AbdicationDemandScore.cs similarity index 93% rename from src/CivilWar/Scoring/AbdicationDemandScore.cs rename to src/Bannerlord.Diplomacy/CivilWar/Scoring/AbdicationDemandScore.cs index 065e666a..f446ca07 100644 --- a/src/CivilWar/Scoring/AbdicationDemandScore.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Scoring/AbdicationDemandScore.cs @@ -1,8 +1,11 @@ -using System; +using Diplomacy.CivilWar.Factions; + +using System; using System.Collections.Generic; using System.Linq; -using Diplomacy.CivilWar.Factions; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.CharacterDevelopment; using TaleWorlds.Localization; namespace Diplomacy.CivilWar.Scoring @@ -18,7 +21,7 @@ protected override List GetPossibleFactions(Clan clan) protected override IEnumerable> GetMemberScore(Clan clan, RebelFaction rebelFaction) { - List> memberScores = new() {CalculateFiefDeficitScore(clan)}; + List> memberScores = new() { CalculateFiefDeficitScore(clan) }; memberScores.AddRange(CalculateTraitScore(clan, rebelFaction, rebelFaction.ParentKingdom.Leader, DefaultTraits.Honor)); memberScores.AddRange(CalculateTraitScore(clan, rebelFaction, rebelFaction.ParentKingdom.Leader, DefaultTraits.Valor)); diff --git a/src/CivilWar/Scoring/AbstractFactionDemandScoringModel.cs b/src/Bannerlord.Diplomacy/CivilWar/Scoring/AbstractFactionDemandScoringModel.cs similarity index 98% rename from src/CivilWar/Scoring/AbstractFactionDemandScoringModel.cs rename to src/Bannerlord.Diplomacy/CivilWar/Scoring/AbstractFactionDemandScoringModel.cs index da2d8734..ed9359a2 100644 --- a/src/CivilWar/Scoring/AbstractFactionDemandScoringModel.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Scoring/AbstractFactionDemandScoringModel.cs @@ -1,8 +1,11 @@ -using System; +using Diplomacy.CivilWar.Factions; + +using System; using System.Collections.Generic; using System.Linq; -using Diplomacy.CivilWar.Factions; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.CharacterDevelopment; using TaleWorlds.Core; using TaleWorlds.Library; using TaleWorlds.Localization; @@ -116,4 +119,4 @@ protected virtual IEnumerable> GetRelationshipScores(Cl protected abstract Tuple GetRelationshipScoreWithTarget(Clan clan, RebelFaction rebelFaction); } -} +} \ No newline at end of file diff --git a/src/CivilWar/Scoring/ChangeRulerFactionScoreBase.cs b/src/Bannerlord.Diplomacy/CivilWar/Scoring/ChangeRulerFactionScoreBase.cs similarity index 96% rename from src/CivilWar/Scoring/ChangeRulerFactionScoreBase.cs rename to src/Bannerlord.Diplomacy/CivilWar/Scoring/ChangeRulerFactionScoreBase.cs index 8124cd89..be53d894 100644 --- a/src/CivilWar/Scoring/ChangeRulerFactionScoreBase.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Scoring/ChangeRulerFactionScoreBase.cs @@ -1,7 +1,10 @@ -using System; +using Diplomacy.CivilWar.Factions; + +using System; using System.Collections.Generic; -using Diplomacy.CivilWar.Factions; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.CharacterDevelopment; using TaleWorlds.Core; using TaleWorlds.Library; using TaleWorlds.Localization; diff --git a/src/CivilWar/Scoring/RebelFactionScoringModel.cs b/src/Bannerlord.Diplomacy/CivilWar/Scoring/RebelFactionScoringModel.cs similarity index 94% rename from src/CivilWar/Scoring/RebelFactionScoringModel.cs rename to src/Bannerlord.Diplomacy/CivilWar/Scoring/RebelFactionScoringModel.cs index 9e2020e9..e6d6a9d3 100644 --- a/src/CivilWar/Scoring/RebelFactionScoringModel.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Scoring/RebelFactionScoringModel.cs @@ -1,5 +1,7 @@ -using System.Collections.Generic; -using Diplomacy.CivilWar.Factions; +using Diplomacy.CivilWar.Factions; + +using System.Collections.Generic; + using TaleWorlds.CampaignSystem; namespace Diplomacy.CivilWar.Scoring @@ -32,4 +34,4 @@ public static ExplainedNumber GetDemandScore(Clan clan, RebelFaction rebelFactio return DemandScoreCalculators[rebelFaction.RebelDemandType].GetScore(clan, rebelFaction); } } -} +} \ No newline at end of file diff --git a/src/CivilWar/Scoring/SecessionDemandScore.cs b/src/Bannerlord.Diplomacy/CivilWar/Scoring/SecessionDemandScore.cs similarity index 94% rename from src/CivilWar/Scoring/SecessionDemandScore.cs rename to src/Bannerlord.Diplomacy/CivilWar/Scoring/SecessionDemandScore.cs index 3acef2cd..2ca10c35 100644 --- a/src/CivilWar/Scoring/SecessionDemandScore.cs +++ b/src/Bannerlord.Diplomacy/CivilWar/Scoring/SecessionDemandScore.cs @@ -1,8 +1,11 @@ -using System; +using Diplomacy.CivilWar.Factions; + +using System; using System.Collections.Generic; using System.Linq; -using Diplomacy.CivilWar.Factions; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.CharacterDevelopment; using TaleWorlds.Localization; namespace Diplomacy.CivilWar.Scoring @@ -23,7 +26,7 @@ protected override List GetPossibleFactions(Clan clan) protected override IEnumerable> GetMemberScore(Clan clan, RebelFaction rebelFaction) { - List> memberScores = new() {CalculateFiefDeficitScore(clan)}; + List> memberScores = new() { CalculateFiefDeficitScore(clan) }; memberScores.AddRange(CalculateTraitScore(clan, rebelFaction, rebelFaction.ParentKingdom.Leader, DefaultTraits.Honor)); memberScores.AddRange(CalculateTraitScore(clan, rebelFaction, rebelFaction.ParentKingdom.Leader, DefaultTraits.Valor)); @@ -38,7 +41,7 @@ protected override IEnumerable> GetMemberScore(Clan cla protected override IEnumerable> GetLeaderOnlyScore(Clan clan, RebelFaction rebelFaction) { // ambition of faction sponsor - yield return new Tuple(_TCalculating ,clan.Leader.GetTraitLevel(DefaultTraits.Calculating) * 20); + yield return new Tuple(_TCalculating, clan.Leader.GetTraitLevel(DefaultTraits.Calculating) * 20); // must be clan tier 4+ if (clan.Tier < 4) @@ -82,4 +85,4 @@ public class SecessionScores : IFactionDemandScores public float KingdomSizeTownScore => 2; } } -} +} \ No newline at end of file diff --git a/src/Compat.cs b/src/Bannerlord.Diplomacy/Compat.cs similarity index 99% rename from src/Compat.cs rename to src/Bannerlord.Diplomacy/Compat.cs index 2fc2c54f..f942f764 100644 --- a/src/Compat.cs +++ b/src/Bannerlord.Diplomacy/Compat.cs @@ -12,4 +12,4 @@ public static TaleWorlds.Core.ViewModelCollection.HintViewModel Create(TextObjec } } } -} +} \ No newline at end of file diff --git a/src/CooldownManager.cs b/src/Bannerlord.Diplomacy/CooldownManager.cs similarity index 95% rename from src/CooldownManager.cs rename to src/Bannerlord.Diplomacy/CooldownManager.cs index 90d09f2e..9dd47b80 100644 --- a/src/CooldownManager.cs +++ b/src/Bannerlord.Diplomacy/CooldownManager.cs @@ -1,6 +1,8 @@ -using System.Collections.Generic; +using JetBrains.Annotations; + +using System.Collections.Generic; using System.Linq; -using JetBrains.Annotations; + using TaleWorlds.CampaignSystem; using TaleWorlds.SaveSystem; @@ -14,13 +16,16 @@ internal sealed class CooldownManager internal static Dictionary LastPeaceProposalTime => Instance!._lastPeaceProposalTime; internal static Dictionary LastAllianceFormedTime => Instance!._lastAllianceFormedTime; - [SaveableField(1)] [UsedImplicitly] + [SaveableField(1)] + [UsedImplicitly] private Dictionary _lastWarTime; - [SaveableField(2)] [UsedImplicitly] + [SaveableField(2)] + [UsedImplicitly] private Dictionary _lastPeaceProposalTime; - [SaveableField(3)] [UsedImplicitly] + [SaveableField(3)] + [UsedImplicitly] private Dictionary _lastAllianceFormedTime; private static float MinimumDaysBetweenPeaceProposals => 5f; @@ -71,7 +76,7 @@ public static CampaignTime GetLastWarTimeBetweenFactions(IFaction faction1, IFac if (LastWarTime.TryGetValue(CreateKey(faction1, faction2), out var value)) { return value; - } + } else { return CampaignTime.Zero; @@ -128,4 +133,4 @@ internal void Sync() Instance = this; } } -} +} \ No newline at end of file diff --git a/src/Costs/DiplomacyCost.cs b/src/Bannerlord.Diplomacy/Costs/DiplomacyCost.cs similarity index 99% rename from src/Costs/DiplomacyCost.cs rename to src/Bannerlord.Diplomacy/Costs/DiplomacyCost.cs index 45ee34bd..1a395dca 100644 --- a/src/Costs/DiplomacyCost.cs +++ b/src/Bannerlord.Diplomacy/Costs/DiplomacyCost.cs @@ -12,4 +12,4 @@ protected DiplomacyCost(float value) public abstract void ApplyCost(); public abstract bool CanPayCost(); } -} +} \ No newline at end of file diff --git a/src/Costs/DiplomacyCostCalculator.cs b/src/Bannerlord.Diplomacy/Costs/DiplomacyCostCalculator.cs similarity index 91% rename from src/Costs/DiplomacyCostCalculator.cs rename to src/Bannerlord.Diplomacy/Costs/DiplomacyCostCalculator.cs index b00529ed..272faa39 100644 --- a/src/Costs/DiplomacyCostCalculator.cs +++ b/src/Bannerlord.Diplomacy/Costs/DiplomacyCostCalculator.cs @@ -1,5 +1,6 @@ using System; using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.Library; @@ -18,7 +19,7 @@ public static DiplomacyCost DetermineCostForDeclaringWar(Kingdom kingdom, bool f if (!Settings.Instance!.ScalingInfluenceCosts) return new InfluenceCost(clanPayingInfluence, Settings.Instance!.DeclareWarInfluenceCost); - return new InfluenceCost(clanPayingInfluence, (float)Math.Floor(GetKingdomTierCount(kingdom) * Settings.Instance!.ScalingInfluenceCostMultiplier)); + return new InfluenceCost(clanPayingInfluence, (float) Math.Floor(GetKingdomTierCount(kingdom) * Settings.Instance!.ScalingInfluenceCostMultiplier)); } public static HybridCost DetermineCostForMakingPeace(Kingdom kingdom, Kingdom otherKingdom, bool forcePlayerCharacterCosts = false) @@ -50,7 +51,7 @@ private static InfluenceCost DetermineInfluenceCostForMakingPeace(Kingdom kingdo private static float GetKingdomScalingFactor(Kingdom kingdom) { - return (float)Math.Floor(GetKingdomTierCount(kingdom) * Settings.Instance!.ScalingInfluenceCostMultiplier); + return (float) Math.Floor(GetKingdomTierCount(kingdom) * Settings.Instance!.ScalingInfluenceCostMultiplier); } public static HybridCost DetermineCostForFormingNonAggressionPact(Kingdom kingdom, Kingdom otherKingdom, bool forcePlayerCharacterCosts = false) @@ -79,7 +80,7 @@ private static GoldCost DetermineGoldCostForFormingNonAggressionPact(Kingdom kin var baseGoldCost = 500; var goldCostFactor = 100; - var goldCost = (int)((MBMath.ClampFloat((1 / otherKingdomWarLoad), 0f, 1f) * GetKingdomScalingFactor(kingdom) * goldCostFactor) + baseGoldCost); + var goldCost = (int) ((MBMath.ClampFloat((1 / otherKingdomWarLoad), 0f, 1f) * GetKingdomScalingFactor(kingdom) * goldCostFactor) + baseGoldCost); return new GoldCost(giver, otherKingdom.Leader, goldCost); } @@ -113,7 +114,7 @@ private static GoldCost DetermineGoldCostForMakingPeace(Kingdom kingdomMakingPea var relativeWarExhaustion = (kingdomMakingPeaceWarExhaustion + 1f) / (otherKingdomWarExhaustion + 1f) - 1f; warExhaustionMultiplier = MBMath.ClampFloat(relativeWarExhaustion, 0, ((1f / 20f) * kingdomMakingPeaceWarExhaustion) - 1f); } - goldCost = Math.Min((int)(GetKingdomScalingFactor(kingdomMakingPeace) * warExhaustionMultiplier), kingdomMakingPeace.Leader.Gold / 2); + goldCost = Math.Min((int) (GetKingdomScalingFactor(kingdomMakingPeace) * warExhaustionMultiplier), kingdomMakingPeace.Leader.Gold / 2); } return new GoldCost(giver, otherKingdom.Leader, goldCost); @@ -155,9 +156,9 @@ private static GoldCost DetermineGoldCostForFormingAlliance(Kingdom kingdom, Kin var baseGoldCost = 500; var goldCostFactor = 100; - var goldCost = (int)((MBMath.ClampFloat((1 / otherKingdomWarLoad), 0f, 1f) * GetKingdomScalingFactor(kingdom) * AllianceFactor * goldCostFactor) + baseGoldCost); + var goldCost = (int) ((MBMath.ClampFloat((1 / otherKingdomWarLoad), 0f, 1f) * GetKingdomScalingFactor(kingdom) * AllianceFactor * goldCostFactor) + baseGoldCost); return new GoldCost(giver, otherKingdom.Leader, goldCost); } } -} +} \ No newline at end of file diff --git a/src/Costs/GoldCost.cs b/src/Bannerlord.Diplomacy/Costs/GoldCost.cs similarity index 84% rename from src/Costs/GoldCost.cs rename to src/Bannerlord.Diplomacy/Costs/GoldCost.cs index fe3685e3..e16aa971 100644 --- a/src/Costs/GoldCost.cs +++ b/src/Bannerlord.Diplomacy/Costs/GoldCost.cs @@ -18,18 +18,18 @@ public override void ApplyCost() { if (_receiver is not null) { - GiveGoldAction.ApplyBetweenCharacters(_giver, _receiver, (int)Value); + GiveGoldAction.ApplyBetweenCharacters(_giver, _receiver, (int) Value); } else { - _giver.ChangeHeroGold(-(int)Value); + _giver.ChangeHeroGold(-(int) Value); } } public override bool CanPayCost() { - return _giver.Gold >= (int)Value; + return _giver.Gold >= (int) Value; } } -} +} \ No newline at end of file diff --git a/src/Costs/HybridCost.cs b/src/Bannerlord.Diplomacy/Costs/HybridCost.cs similarity index 99% rename from src/Costs/HybridCost.cs rename to src/Bannerlord.Diplomacy/Costs/HybridCost.cs index 188bc296..d3505b22 100644 --- a/src/Costs/HybridCost.cs +++ b/src/Bannerlord.Diplomacy/Costs/HybridCost.cs @@ -27,4 +27,4 @@ public override bool CanPayCost() return _diplomacyCosts.All(x => x.CanPayCost()); } } -} +} \ No newline at end of file diff --git a/src/Costs/InfluenceCost.cs b/src/Bannerlord.Diplomacy/Costs/InfluenceCost.cs similarity index 99% rename from src/Costs/InfluenceCost.cs rename to src/Bannerlord.Diplomacy/Costs/InfluenceCost.cs index aed76a68..6d60fbc1 100644 --- a/src/Costs/InfluenceCost.cs +++ b/src/Bannerlord.Diplomacy/Costs/InfluenceCost.cs @@ -22,4 +22,4 @@ public override bool CanPayCost() return _clan.Influence >= Value; } } -} +} \ No newline at end of file diff --git a/src/CustomSavedTypeDefiner.cs b/src/Bannerlord.Diplomacy/CustomSavedTypeDefiner.cs similarity index 97% rename from src/CustomSavedTypeDefiner.cs rename to src/Bannerlord.Diplomacy/CustomSavedTypeDefiner.cs index 1c0910a4..13d23b38 100644 --- a/src/CustomSavedTypeDefiner.cs +++ b/src/Bannerlord.Diplomacy/CustomSavedTypeDefiner.cs @@ -3,9 +3,12 @@ using Diplomacy.DiplomaticAction; using Diplomacy.Messengers; -using System.Collections.Generic; using JetBrains.Annotations; + +using System.Collections.Generic; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.SaveSystem; namespace Diplomacy @@ -51,4 +54,4 @@ protected override void DefineContainerDefinitions() ConstructContainerDefinition(typeof(Dictionary)); } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/AbstractConditionEvaluator.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractConditionEvaluator.cs similarity index 93% rename from src/DiplomaticAction/AbstractConditionEvaluator.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/AbstractConditionEvaluator.cs index 73f86dd0..0344d64e 100644 --- a/src/DiplomaticAction/AbstractConditionEvaluator.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractConditionEvaluator.cs @@ -38,11 +38,11 @@ public List CanApplyExceptions(KingdomDiplomacyItemVM item, return Conditions .Select(c => { - c.ApplyCondition((Kingdom)item.Faction1, (Kingdom)item.Faction2, out var txt, forcePlayerCosts, bypassCosts); + c.ApplyCondition((Kingdom) item.Faction1, (Kingdom) item.Faction2, out var txt, forcePlayerCosts, bypassCosts); return txt; }) .OfType() .ToList(); } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/AbstractCostCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractCostCondition.cs similarity index 99% rename from src/DiplomaticAction/AbstractCostCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/AbstractCostCondition.cs index 3caefebe..6be294b5 100644 --- a/src/DiplomaticAction/AbstractCostCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractCostCondition.cs @@ -22,4 +22,4 @@ public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject protected abstract bool ApplyConditionInternal(Kingdom kingdom, Kingdom otherKingdom, ref TextObject? textObject, bool forcePlayerCharacterCosts = false); } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/AbstractDiplomaticAction.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractDiplomaticAction.cs similarity index 99% rename from src/DiplomaticAction/AbstractDiplomaticAction.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/AbstractDiplomaticAction.cs index 24f56a5e..9bb64d5c 100644 --- a/src/DiplomaticAction/AbstractDiplomaticAction.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractDiplomaticAction.cs @@ -1,5 +1,6 @@  using System; + using TaleWorlds.CampaignSystem; namespace Diplomacy.DiplomaticAction @@ -43,4 +44,4 @@ protected void ApplyInternalWithCosts(Kingdom proposingKingdom, Kingdom otherKin } protected abstract void AssessCosts(Kingdom proposingKingdom, Kingdom otherKingdom, bool forcePlayerCharacterCosts); } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/AbstractScoringModel.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs similarity index 96% rename from src/DiplomaticAction/AbstractScoringModel.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs index 6df6023e..3fb76499 100644 --- a/src/DiplomaticAction/AbstractScoringModel.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs @@ -85,7 +85,7 @@ public virtual ExplainedNumber GetScore(Kingdom ourKingdom, Kingdom otherKingdom // Relationship - var relationMult = MBMath.ClampFloat((float)Math.Log((ourKingdom.Leader.GetRelation(otherKingdom.Leader) + 100f) / 100f, 1.5), + var relationMult = MBMath.ClampFloat((float) Math.Log((ourKingdom.Leader.GetRelation(otherKingdom.Leader) + 100f) / 100f, 1.5), -1f, +1f); @@ -98,7 +98,7 @@ public virtual ExplainedNumber GetScore(Kingdom ourKingdom, Kingdom otherKingdom explainedNum.Add(expansionismPenalty, _TExpansionism); // Tendency - explainedNum.Add(Scores.Tendency, _TTendency); + explainedNum.Add(Scores.Tendency, _TTendency); return explainedNum; } diff --git a/src/DiplomaticAction/Alliance/AllianceEvent.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceEvent.cs similarity index 99% rename from src/DiplomaticAction/Alliance/AllianceEvent.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceEvent.cs index 2e4fc507..be096d2a 100644 --- a/src/DiplomaticAction/Alliance/AllianceEvent.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceEvent.cs @@ -13,4 +13,4 @@ public AllianceEvent(Kingdom kingdom, Kingdom otherKingdom) public Kingdom Kingdom { get; } public Kingdom OtherKingdom { get; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/Alliance/AllianceScoringModel.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceScoringModel.cs similarity index 99% rename from src/DiplomaticAction/Alliance/AllianceScoringModel.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceScoringModel.cs index d7bf2b87..2ff15609 100644 --- a/src/DiplomaticAction/Alliance/AllianceScoringModel.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceScoringModel.cs @@ -24,4 +24,4 @@ public class AllianceScores : IDiplomacyScores public int NonAggressionPactWithNeutral => -10; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/Alliance/BreakAllianceAction.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/BreakAllianceAction.cs similarity index 99% rename from src/DiplomaticAction/Alliance/BreakAllianceAction.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/BreakAllianceAction.cs index e7b60fc5..d735a42c 100644 --- a/src/DiplomaticAction/Alliance/BreakAllianceAction.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/BreakAllianceAction.cs @@ -46,4 +46,4 @@ protected override void ShowPlayerInquiry(Kingdom proposingKingdom, Action accep null), true); } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/Alliance/BreakAllianceConditions.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/BreakAllianceConditions.cs similarity index 99% rename from src/DiplomaticAction/Alliance/BreakAllianceConditions.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/BreakAllianceConditions.cs index f9875b1b..a22aeb5e 100644 --- a/src/DiplomaticAction/Alliance/BreakAllianceConditions.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/BreakAllianceConditions.cs @@ -1,4 +1,5 @@ using Diplomacy.DiplomaticAction.Alliance.Conditions; + using System.Collections.Generic; namespace Diplomacy.DiplomaticAction.Alliance @@ -11,4 +12,4 @@ class BreakAllianceConditions : AbstractConditionEvaluator> _agreements; public DiplomaticAgreementManager() @@ -53,4 +56,4 @@ public void Sync() Instance = this; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/GenericConditions/AtPeaceCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/AtPeaceCondition.cs similarity index 99% rename from src/DiplomaticAction/GenericConditions/AtPeaceCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/AtPeaceCondition.cs index c01eb610..faacedb5 100644 --- a/src/DiplomaticAction/GenericConditions/AtPeaceCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/AtPeaceCondition.cs @@ -16,4 +16,4 @@ public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject return !atWar; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/GenericConditions/HasAuthorityCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/HasAuthorityCondition.cs similarity index 99% rename from src/DiplomaticAction/GenericConditions/HasAuthorityCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/HasAuthorityCondition.cs index 2fb70635..97fcf20b 100644 --- a/src/DiplomaticAction/GenericConditions/HasAuthorityCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/HasAuthorityCondition.cs @@ -24,4 +24,4 @@ public bool ApplyCondition(Kingdom kingdom, return authority; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/GenericConditions/NotInAllianceCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/NotInAllianceCondition.cs similarity index 98% rename from src/DiplomaticAction/GenericConditions/NotInAllianceCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/NotInAllianceCondition.cs index 4ab865aa..7aa5f550 100644 --- a/src/DiplomaticAction/GenericConditions/NotInAllianceCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/NotInAllianceCondition.cs @@ -17,8 +17,8 @@ public bool ApplyCondition(Kingdom kingdom, if (alreadyInAlliance) textObject = new TextObject(StringConstants.InAlliance); - + return !alreadyInAlliance; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/GenericConditions/NotRebelKingdomCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/NotRebelKingdomCondition.cs similarity index 99% rename from src/DiplomaticAction/GenericConditions/NotRebelKingdomCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/NotRebelKingdomCondition.cs index 0d9b9952..aacbe9cc 100644 --- a/src/DiplomaticAction/GenericConditions/NotRebelKingdomCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/GenericConditions/NotRebelKingdomCondition.cs @@ -1,4 +1,5 @@ using Diplomacy.Extensions; + using TaleWorlds.CampaignSystem; using TaleWorlds.Localization; diff --git a/src/DiplomaticAction/NonAggressionPact/FormNonAggressionPactAction.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/FormNonAggressionPactAction.cs similarity index 99% rename from src/DiplomaticAction/NonAggressionPact/FormNonAggressionPactAction.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/FormNonAggressionPactAction.cs index 3fba3d63..8a36963c 100644 --- a/src/DiplomaticAction/NonAggressionPact/FormNonAggressionPactAction.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/FormNonAggressionPactAction.cs @@ -6,8 +6,8 @@ using TaleWorlds.CampaignSystem; using TaleWorlds.Core; -using TaleWorlds.Localization; using TaleWorlds.Library; +using TaleWorlds.Localization; namespace Diplomacy.DiplomaticAction.NonAggressionPact { @@ -53,4 +53,4 @@ protected override void ShowPlayerInquiry(Kingdom proposingKingdom, Action apply null), true); } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/NonAggressionPact/HasEnoughGoldCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/HasEnoughGoldCondition.cs similarity index 99% rename from src/DiplomaticAction/NonAggressionPact/HasEnoughGoldCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/HasEnoughGoldCondition.cs index f2a027c3..4b038081 100644 --- a/src/DiplomaticAction/NonAggressionPact/HasEnoughGoldCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/HasEnoughGoldCondition.cs @@ -1,4 +1,5 @@ using Diplomacy.Costs; + using TaleWorlds.CampaignSystem; using TaleWorlds.Localization; @@ -18,4 +19,4 @@ protected override bool ApplyConditionInternal(Kingdom kingdom, Kingdom otherKin return hasEnoughGold; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/NonAggressionPact/HasEnoughInfluenceCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/HasEnoughInfluenceCondition.cs similarity index 99% rename from src/DiplomaticAction/NonAggressionPact/HasEnoughInfluenceCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/HasEnoughInfluenceCondition.cs index 49c86d9c..b0892825 100644 --- a/src/DiplomaticAction/NonAggressionPact/HasEnoughInfluenceCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/HasEnoughInfluenceCondition.cs @@ -1,4 +1,5 @@ using Diplomacy.Costs; + using TaleWorlds.CampaignSystem; using TaleWorlds.Localization; @@ -21,4 +22,4 @@ protected override bool ApplyConditionInternal(Kingdom kingdom, Kingdom otherKin return hasEnoughInfluence; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/NonAggressionPact/HasEnoughScoreCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/HasEnoughScoreCondition.cs similarity index 99% rename from src/DiplomaticAction/NonAggressionPact/HasEnoughScoreCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/HasEnoughScoreCondition.cs index 4af1fb6a..c604be32 100644 --- a/src/DiplomaticAction/NonAggressionPact/HasEnoughScoreCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/HasEnoughScoreCondition.cs @@ -18,4 +18,4 @@ public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject return !scoreTooLow; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/NonAggressionPact/NoNonAggressionPactCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NoNonAggressionPactCondition.cs similarity index 99% rename from src/DiplomaticAction/NonAggressionPact/NoNonAggressionPactCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NoNonAggressionPactCondition.cs index 3b46daf5..2335f3c6 100644 --- a/src/DiplomaticAction/NonAggressionPact/NoNonAggressionPactCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NoNonAggressionPactCondition.cs @@ -19,4 +19,4 @@ public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject return !hasNonAggressionPact; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/NonAggressionPact/NonAggressionPactConditions.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NonAggressionPactConditions.cs similarity index 99% rename from src/DiplomaticAction/NonAggressionPact/NonAggressionPactConditions.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NonAggressionPactConditions.cs index 2417a423..8ef4c8a9 100644 --- a/src/DiplomaticAction/NonAggressionPact/NonAggressionPactConditions.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NonAggressionPactConditions.cs @@ -1,4 +1,5 @@ using Diplomacy.DiplomaticAction.GenericConditions; + using System.Collections.Generic; namespace Diplomacy.DiplomaticAction.NonAggressionPact @@ -18,4 +19,4 @@ internal class NonAggressionPactConditions : AbstractConditionEvaluator -10; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/NonAggressionPactAgreement.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPactAgreement.cs similarity index 99% rename from src/DiplomaticAction/NonAggressionPactAgreement.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPactAgreement.cs index ea50cf42..1c2ad0a3 100644 --- a/src/DiplomaticAction/NonAggressionPactAgreement.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPactAgreement.cs @@ -36,4 +36,4 @@ public override void NotifyExpired() InformationManager.DisplayMessage(new InformationMessage(txtRendered)); } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/WarPeace/Conditions/HasEnoughGoldForPeaceCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughGoldForPeaceCondition.cs similarity index 99% rename from src/DiplomaticAction/WarPeace/Conditions/HasEnoughGoldForPeaceCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughGoldForPeaceCondition.cs index 67b27690..9591e257 100644 --- a/src/DiplomaticAction/WarPeace/Conditions/HasEnoughGoldForPeaceCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughGoldForPeaceCondition.cs @@ -1,4 +1,5 @@ using Diplomacy.Costs; + using TaleWorlds.CampaignSystem; using TaleWorlds.Localization; @@ -18,4 +19,4 @@ protected override bool ApplyConditionInternal(Kingdom kingdom, Kingdom otherKin return hasEnoughGold; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForPeaceCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForPeaceCondition.cs similarity index 99% rename from src/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForPeaceCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForPeaceCondition.cs index cbabd751..a95dd351 100644 --- a/src/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForPeaceCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForPeaceCondition.cs @@ -1,4 +1,5 @@ using Diplomacy.Costs; + using TaleWorlds.CampaignSystem; using TaleWorlds.Localization; @@ -18,4 +19,4 @@ protected override bool ApplyConditionInternal(Kingdom kingdom, Kingdom otherKin return hasEnoughInfluence; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForWarCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForWarCondition.cs similarity index 99% rename from src/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForWarCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForWarCondition.cs index d32cc8dd..b16b40eb 100644 --- a/src/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForWarCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughInfluenceForWarCondition.cs @@ -1,4 +1,5 @@ using Diplomacy.Costs; + using TaleWorlds.CampaignSystem; using TaleWorlds.Localization; @@ -18,4 +19,4 @@ protected override bool ApplyConditionInternal(Kingdom kingdom, Kingdom otherKin return hasEnoughInfluence; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/WarPeace/Conditions/HasEnoughTimeElapsedForPeaceCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughTimeElapsedForPeaceCondition.cs similarity index 96% rename from src/DiplomaticAction/WarPeace/Conditions/HasEnoughTimeElapsedForPeaceCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughTimeElapsedForPeaceCondition.cs index 05e93a9e..dfd2045d 100644 --- a/src/DiplomaticAction/WarPeace/Conditions/HasEnoughTimeElapsedForPeaceCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/HasEnoughTimeElapsedForPeaceCondition.cs @@ -1,4 +1,5 @@ using System; + using TaleWorlds.CampaignSystem; using TaleWorlds.Localization; @@ -15,10 +16,10 @@ public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject if (!hasEnoughTimeElapsed) { textObject = _TTooSoon.CopyTextObject(); - textObject.SetTextVariable("ELAPSED_DAYS", (float)Math.Floor(elapsedDaysUntilNow)); + textObject.SetTextVariable("ELAPSED_DAYS", (float) Math.Floor(elapsedDaysUntilNow)); textObject.SetTextVariable("REQUIRED_DAYS", Settings.Instance!.MinimumWarDurationInDays); } return hasEnoughTimeElapsed; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/WarPeace/Conditions/NoSiegeCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/NoSiegeCondition.cs similarity index 96% rename from src/DiplomaticAction/WarPeace/Conditions/NoSiegeCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/NoSiegeCondition.cs index 1fe48419..49838ea8 100644 --- a/src/DiplomaticAction/WarPeace/Conditions/NoSiegeCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/NoSiegeCondition.cs @@ -1,4 +1,5 @@ using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.Siege; using TaleWorlds.Localization; namespace Diplomacy.DiplomaticAction.WarPeace.Conditions @@ -26,4 +27,4 @@ public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject return true; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/WarPeace/Conditions/SatisfiesQuestConditionsForPeaceCondition.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/SatisfiesQuestConditionsForPeaceCondition.cs similarity index 92% rename from src/DiplomaticAction/WarPeace/Conditions/SatisfiesQuestConditionsForPeaceCondition.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/SatisfiesQuestConditionsForPeaceCondition.cs index 55008613..5f32633c 100644 --- a/src/DiplomaticAction/WarPeace/Conditions/SatisfiesQuestConditionsForPeaceCondition.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/Conditions/SatisfiesQuestConditionsForPeaceCondition.cs @@ -9,11 +9,7 @@ internal class SatisfiesQuestConditionsForPeaceCondition : IDiplomacyCondition public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject? textObject, bool forcePlayerCharacterCosts = false, bool bypassCosts = false) { textObject = null; -#if e170 var currentStoryMode = StoryMode.StoryModeManager.Current; -#else - var currentStoryMode = StoryMode.StoryMode.Current; -#endif // not in story mode if (currentStoryMode == null) { @@ -29,4 +25,4 @@ public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject return isValidQuestState; } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/WarPeace/DeclareWarConditions.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/DeclareWarConditions.cs similarity index 99% rename from src/DiplomaticAction/WarPeace/DeclareWarConditions.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/DeclareWarConditions.cs index 1712321f..9cbe7a15 100644 --- a/src/DiplomaticAction/WarPeace/DeclareWarConditions.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/DeclareWarConditions.cs @@ -19,4 +19,4 @@ internal sealed class DeclareWarConditions : AbstractConditionEvaluator { AcceptPeace(kingdom, faction, diplomacyCost); @@ -87,7 +87,7 @@ public static void ApplyPeace(Kingdom kingdomMakingPeace, Kingdom otherKingdom, false, GameTexts.FindText("str_ok").ToString(), null, - () => KingdomPeaceAction.ApplyPeace(kingdomMakingPeace, otherKingdom, skipPlayerPrompts:true), + () => KingdomPeaceAction.ApplyPeace(kingdomMakingPeace, otherKingdom, skipPlayerPrompts: true), null), true); } else @@ -113,4 +113,4 @@ public static void ApplyPeace(Kingdom kingdomMakingPeace, Kingdom otherKingdom, } } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/WarPeace/MakePeaceConditions.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/MakePeaceConditions.cs similarity index 99% rename from src/DiplomaticAction/WarPeace/MakePeaceConditions.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/MakePeaceConditions.cs index fbb679bc..f580742c 100644 --- a/src/DiplomaticAction/WarPeace/MakePeaceConditions.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/MakePeaceConditions.cs @@ -1,5 +1,6 @@ using Diplomacy.DiplomaticAction.GenericConditions; using Diplomacy.DiplomaticAction.WarPeace.Conditions; + using System.Collections.Generic; namespace Diplomacy.DiplomaticAction.WarPeace @@ -18,4 +19,4 @@ class MakePeaceConditions : AbstractConditionEvaluator public MakePeaceConditions() : base(Conditions) { } } -} +} \ No newline at end of file diff --git a/src/DiplomaticAction/WarPeace/WarDeclaredEvent.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/WarDeclaredEvent.cs similarity index 97% rename from src/DiplomaticAction/WarPeace/WarDeclaredEvent.cs rename to src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/WarDeclaredEvent.cs index 2272b68b..82c6a323 100644 --- a/src/DiplomaticAction/WarPeace/WarDeclaredEvent.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/WarPeace/WarDeclaredEvent.cs @@ -5,7 +5,7 @@ namespace Diplomacy.DiplomaticAction.WarPeace internal sealed class WarDeclaredEvent { public IFaction Faction { get; } - + public IFaction ProvocatorFaction { get; } public bool IsProvoked { get; } @@ -17,4 +17,4 @@ public WarDeclaredEvent(IFaction faction, IFaction provocatorFaction, bool isPro IsProvoked = isProvoked; } } -} +} \ No newline at end of file diff --git a/src/Event/Events.cs b/src/Bannerlord.Diplomacy/Event/Events.cs similarity index 96% rename from src/Event/Events.cs rename to src/Bannerlord.Diplomacy/Event/Events.cs index 5d70c027..3f62c478 100644 --- a/src/Event/Events.cs +++ b/src/Bannerlord.Diplomacy/Event/Events.cs @@ -1,7 +1,10 @@ -using System.Collections.Generic; -using Diplomacy.DiplomaticAction.Alliance; +using Diplomacy.DiplomaticAction.Alliance; using Diplomacy.DiplomaticAction.WarPeace; + +using System.Collections.Generic; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.Settlements; namespace Diplomacy.Event { diff --git a/src/Event/WarExhaustionEvent.cs b/src/Bannerlord.Diplomacy/Event/WarExhaustionEvent.cs similarity index 99% rename from src/Event/WarExhaustionEvent.cs rename to src/Bannerlord.Diplomacy/Event/WarExhaustionEvent.cs index 64f4e7a3..ec20df8f 100644 --- a/src/Event/WarExhaustionEvent.cs +++ b/src/Bannerlord.Diplomacy/Event/WarExhaustionEvent.cs @@ -17,4 +17,4 @@ public WarExhaustionEvent(Kingdom kingdom, Kingdom otherKingdom, WarExhaustionMa public WarExhaustionManager.WarExhaustionType WarExhaustionType { get; } public float WarExhaustionToAdd { get; } } -} +} \ No newline at end of file diff --git a/src/ExpansionismManager.cs b/src/Bannerlord.Diplomacy/ExpansionismManager.cs similarity index 93% rename from src/ExpansionismManager.cs rename to src/Bannerlord.Diplomacy/ExpansionismManager.cs index 950c79aa..99bf8e1f 100644 --- a/src/ExpansionismManager.cs +++ b/src/Bannerlord.Diplomacy/ExpansionismManager.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using Diplomacy.Extensions; +using Diplomacy.Extensions; + using JetBrains.Annotations; + +using System; +using System.Collections.Generic; + using TaleWorlds.CampaignSystem; using TaleWorlds.SaveSystem; @@ -9,7 +12,7 @@ namespace Diplomacy { internal sealed class ExpansionismManager { - [SaveableField(1)] [UsedImplicitly] private Dictionary _expansionism; + [SaveableField(1)][UsedImplicitly] private Dictionary _expansionism; public static ExpansionismManager? Instance { get; private set; } public float SiegeExpansionism => Settings.Instance!.ExpanisonismPerSiege; diff --git a/src/Extensions/ClanExtensions.cs b/src/Bannerlord.Diplomacy/Extensions/ClanExtensions.cs similarity index 91% rename from src/Extensions/ClanExtensions.cs rename to src/Bannerlord.Diplomacy/Extensions/ClanExtensions.cs index 820281f2..0d689667 100644 --- a/src/Extensions/ClanExtensions.cs +++ b/src/Bannerlord.Diplomacy/Extensions/ClanExtensions.cs @@ -1,8 +1,11 @@ using Diplomacy.CivilWar; +using Diplomacy.CivilWar.Factions; + using System.Collections.Generic; using System.Linq; -using Diplomacy.CivilWar.Factions; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.Settlements; namespace Diplomacy.Extensions { @@ -37,7 +40,7 @@ public static IEnumerable GetRebelFactions(this Clan clan) yield break; } - foreach(RebelFaction faction in RebelFactionManager.GetRebelFaction(clan.Kingdom)) + foreach (RebelFaction faction in RebelFactionManager.GetRebelFaction(clan.Kingdom)) { if (faction.Clans.Contains(clan)) yield return faction; @@ -56,4 +59,4 @@ public static IEnumerable GetRebelFactions(this Clan clan) } } } -} +} \ No newline at end of file diff --git a/src/Extensions/HeroExtensions.cs b/src/Bannerlord.Diplomacy/Extensions/HeroExtensions.cs similarity index 89% rename from src/Extensions/HeroExtensions.cs rename to src/Bannerlord.Diplomacy/Extensions/HeroExtensions.cs index 832d0a6f..6bae39cb 100644 --- a/src/Extensions/HeroExtensions.cs +++ b/src/Bannerlord.Diplomacy/Extensions/HeroExtensions.cs @@ -1,5 +1,7 @@ using System; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.CharacterDevelopment; namespace Diplomacy.Extensions { @@ -12,4 +14,4 @@ public static float GetNormalizedTraitValue(this Hero hero, TraitObject trait) return zeroMinTraitLevel / zeroMinMaxTraitLevel; } } -} +} \ No newline at end of file diff --git a/src/Extensions/KingdomExtensions.cs b/src/Bannerlord.Diplomacy/Extensions/KingdomExtensions.cs similarity index 99% rename from src/Extensions/KingdomExtensions.cs rename to src/Bannerlord.Diplomacy/Extensions/KingdomExtensions.cs index 3f17ee6f..b1aaa336 100644 --- a/src/Extensions/KingdomExtensions.cs +++ b/src/Bannerlord.Diplomacy/Extensions/KingdomExtensions.cs @@ -1,8 +1,10 @@ using Diplomacy.CivilWar; +using Diplomacy.CivilWar.Factions; + using System; using System.Collections.Generic; using System.Linq; -using Diplomacy.CivilWar.Factions; + using TaleWorlds.CampaignSystem; namespace Diplomacy.Extensions @@ -101,4 +103,4 @@ public static IEnumerable GetRebelFactions(this Kingdom kingdom) return RebelFactionManager.GetRebelFaction(kingdom); } } -} +} \ No newline at end of file diff --git a/src/FactionPair.cs b/src/Bannerlord.Diplomacy/FactionPair.cs similarity index 99% rename from src/FactionPair.cs rename to src/Bannerlord.Diplomacy/FactionPair.cs index ffde7dff..c7a0945d 100644 --- a/src/FactionPair.cs +++ b/src/Bannerlord.Diplomacy/FactionPair.cs @@ -63,4 +63,4 @@ private static int CalculateHash(string s) public override int GetHashCode() => _hashCode; } -} +} \ No newline at end of file diff --git a/src/FieldAccessHelper.cs b/src/Bannerlord.Diplomacy/FieldAccessHelper.cs similarity index 83% rename from src/FieldAccessHelper.cs rename to src/Bannerlord.Diplomacy/FieldAccessHelper.cs index 10b29e18..086c95a8 100644 --- a/src/FieldAccessHelper.cs +++ b/src/Bannerlord.Diplomacy/FieldAccessHelper.cs @@ -1,4 +1,5 @@ -using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.Encounters; +using TaleWorlds.CampaignSystem.Party; using static HarmonyLib.AccessTools; @@ -9,4 +10,4 @@ public static class FieldAccessHelper public static readonly FieldRef PlayerEncounterAttackerPartyByRef = FieldRefAccess("_attackerParty"); public static readonly FieldRef PlayerEncounterDefenderPartyByRef = FieldRefAccess("_defenderParty"); } -} +} \ No newline at end of file diff --git a/src/GauntletInterfaces/DetailWarViewInterface.cs b/src/Bannerlord.Diplomacy/GauntletInterfaces/DetailWarViewInterface.cs similarity index 97% rename from src/GauntletInterfaces/DetailWarViewInterface.cs rename to src/Bannerlord.Diplomacy/GauntletInterfaces/DetailWarViewInterface.cs index 9b2180e4..fb4da6bf 100644 --- a/src/GauntletInterfaces/DetailWarViewInterface.cs +++ b/src/Bannerlord.Diplomacy/GauntletInterfaces/DetailWarViewInterface.cs @@ -1,9 +1,11 @@ using Diplomacy.ViewModel; + using JetBrains.Annotations; + using TaleWorlds.CampaignSystem; using TaleWorlds.Engine.GauntletUI; -using TaleWorlds.Engine.Screens; using TaleWorlds.InputSystem; +using TaleWorlds.ScreenSystem; namespace Diplomacy.GauntletInterfaces { diff --git a/src/GauntletInterfaces/DonateGoldInterface.cs b/src/Bannerlord.Diplomacy/GauntletInterfaces/DonateGoldInterface.cs similarity index 97% rename from src/GauntletInterfaces/DonateGoldInterface.cs rename to src/Bannerlord.Diplomacy/GauntletInterfaces/DonateGoldInterface.cs index 04a955b4..7fb4c040 100644 --- a/src/GauntletInterfaces/DonateGoldInterface.cs +++ b/src/Bannerlord.Diplomacy/GauntletInterfaces/DonateGoldInterface.cs @@ -1,8 +1,9 @@ using Diplomacy.ViewModel; + using TaleWorlds.CampaignSystem; using TaleWorlds.Engine.GauntletUI; -using TaleWorlds.Engine.Screens; using TaleWorlds.InputSystem; +using TaleWorlds.ScreenSystem; namespace Diplomacy.GauntletInterfaces { diff --git a/src/GauntletInterfaces/GenericInterface.cs b/src/Bannerlord.Diplomacy/GauntletInterfaces/GenericInterface.cs similarity index 97% rename from src/GauntletInterfaces/GenericInterface.cs rename to src/Bannerlord.Diplomacy/GauntletInterfaces/GenericInterface.cs index de58a045..9c93ae95 100644 --- a/src/GauntletInterfaces/GenericInterface.cs +++ b/src/Bannerlord.Diplomacy/GauntletInterfaces/GenericInterface.cs @@ -1,7 +1,8 @@ using HarmonyLib; using HarmonyLib.BUTR.Extensions; + using TaleWorlds.Engine.GauntletUI; -using TaleWorlds.Engine.Screens; +using TaleWorlds.ScreenSystem; namespace Diplomacy.GauntletInterfaces { diff --git a/src/GauntletInterfaces/GrantFiefInterface.cs b/src/Bannerlord.Diplomacy/GauntletInterfaces/GrantFiefInterface.cs similarity index 95% rename from src/GauntletInterfaces/GrantFiefInterface.cs rename to src/Bannerlord.Diplomacy/GauntletInterfaces/GrantFiefInterface.cs index 8048f6d4..e0b5c101 100644 --- a/src/GauntletInterfaces/GrantFiefInterface.cs +++ b/src/Bannerlord.Diplomacy/GauntletInterfaces/GrantFiefInterface.cs @@ -1,9 +1,11 @@ -using System; -using Diplomacy.ViewModel; +using Diplomacy.ViewModel; + +using System; + using TaleWorlds.CampaignSystem; using TaleWorlds.Engine.GauntletUI; -using TaleWorlds.Engine.Screens; using TaleWorlds.InputSystem; +using TaleWorlds.ScreenSystem; namespace Diplomacy.GauntletInterfaces { diff --git a/src/GauntletInterfaces/RebelFactionsInterface.cs b/src/Bannerlord.Diplomacy/GauntletInterfaces/RebelFactionsInterface.cs similarity index 97% rename from src/GauntletInterfaces/RebelFactionsInterface.cs rename to src/Bannerlord.Diplomacy/GauntletInterfaces/RebelFactionsInterface.cs index be15b1d0..a87568ad 100644 --- a/src/GauntletInterfaces/RebelFactionsInterface.cs +++ b/src/Bannerlord.Diplomacy/GauntletInterfaces/RebelFactionsInterface.cs @@ -1,8 +1,9 @@ using Diplomacy.ViewModel; + using TaleWorlds.CampaignSystem; using TaleWorlds.Engine.GauntletUI; -using TaleWorlds.Engine.Screens; using TaleWorlds.InputSystem; +using TaleWorlds.ScreenSystem; namespace Diplomacy.GauntletInterfaces { diff --git a/src/GrantFief/GrantFiefAction.cs b/src/Bannerlord.Diplomacy/GrantFief/GrantFiefAction.cs similarity index 97% rename from src/GrantFief/GrantFiefAction.cs rename to src/Bannerlord.Diplomacy/GrantFief/GrantFiefAction.cs index 42cefdd6..b28f1ffe 100644 --- a/src/GrantFief/GrantFiefAction.cs +++ b/src/Bannerlord.Diplomacy/GrantFief/GrantFiefAction.cs @@ -1,10 +1,13 @@ -using System; -using System.Linq; -using Diplomacy.Character; +using Diplomacy.Character; using Diplomacy.Event; using Diplomacy.Extensions; + +using System; +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; +using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.Localization; namespace Diplomacy.GrantFief diff --git a/src/IDiplomacyCondition.cs b/src/Bannerlord.Diplomacy/IDiplomacyCondition.cs similarity index 99% rename from src/IDiplomacyCondition.cs rename to src/Bannerlord.Diplomacy/IDiplomacyCondition.cs index 99072ef7..9ff4d26b 100644 --- a/src/IDiplomacyCondition.cs +++ b/src/Bannerlord.Diplomacy/IDiplomacyCondition.cs @@ -7,4 +7,4 @@ interface IDiplomacyCondition { bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject? textObject, bool forcePlayerCharacterCosts = false, bool bypassCosts = false); } -} +} \ No newline at end of file diff --git a/src/LogFactory.cs b/src/Bannerlord.Diplomacy/LogFactory.cs similarity index 99% rename from src/LogFactory.cs rename to src/Bannerlord.Diplomacy/LogFactory.cs index 70ab45c7..43398905 100644 --- a/src/LogFactory.cs +++ b/src/Bannerlord.Diplomacy/LogFactory.cs @@ -17,4 +17,4 @@ internal static ILogger Get() ?? NullLogger.Instance; } } -} +} \ No newline at end of file diff --git a/src/MessageHelper.cs b/src/Bannerlord.Diplomacy/MessageHelper.cs similarity index 99% rename from src/MessageHelper.cs rename to src/Bannerlord.Diplomacy/MessageHelper.cs index bd5c9aa3..15e38255 100644 --- a/src/MessageHelper.cs +++ b/src/Bannerlord.Diplomacy/MessageHelper.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; + using TaleWorlds.Core; using TaleWorlds.Localization; @@ -26,4 +27,4 @@ public static void SendFailedActionMessage(string action, List excep InformationManager.DisplayMessage(new InformationMessage(sb.ToString())); } } -} +} \ No newline at end of file diff --git a/src/Messengers/Messenger.cs b/src/Bannerlord.Diplomacy/Messengers/Messenger.cs similarity index 75% rename from src/Messengers/Messenger.cs rename to src/Bannerlord.Diplomacy/Messengers/Messenger.cs index 45619ddf..2058e777 100644 --- a/src/Messengers/Messenger.cs +++ b/src/Bannerlord.Diplomacy/Messengers/Messenger.cs @@ -1,4 +1,5 @@ using JetBrains.Annotations; + using TaleWorlds.CampaignSystem; using TaleWorlds.Library; using TaleWorlds.SaveSystem; @@ -7,9 +8,9 @@ namespace Diplomacy.Messengers { internal class Messenger { - [SaveableProperty(1)] [UsedImplicitly] public CampaignTime DispatchTime { get; private set; } + [SaveableProperty(1)][UsedImplicitly] public CampaignTime DispatchTime { get; private set; } - [SaveableProperty(2)] [UsedImplicitly] public Hero TargetHero { get; private set; } + [SaveableProperty(2)][UsedImplicitly] public Hero TargetHero { get; private set; } [SaveableProperty(3)] public Vec2 CurrentPosition { get; set; } diff --git a/src/Messengers/MessengerManager.cs b/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs similarity index 96% rename from src/Messengers/MessengerManager.cs rename to src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs index 559aa5b9..e11a89e0 100644 --- a/src/Messengers/MessengerManager.cs +++ b/src/Bannerlord.Diplomacy/Messengers/MessengerManager.cs @@ -1,9 +1,17 @@ -using System.Collections.Generic; -using System.Linq; -using Diplomacy.Costs; +using Diplomacy.Costs; + using JetBrains.Annotations; + +using System.Collections.Generic; +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; +using TaleWorlds.CampaignSystem.Conversation; +using TaleWorlds.CampaignSystem.Encounters; +using TaleWorlds.CampaignSystem.GameState; +using TaleWorlds.CampaignSystem.Party; +using TaleWorlds.CampaignSystem.Settlements.Locations; using TaleWorlds.Core; using TaleWorlds.Library; using TaleWorlds.Localization; @@ -16,14 +24,14 @@ internal sealed class MessengerManager : IMissionListener { private const float MessengerHourlySpeed = 20f; - private static readonly List AllowedMissionModes = new() {MissionMode.Conversation, MissionMode.Barter}; + private static readonly List AllowedMissionModes = new() { MissionMode.Conversation, MissionMode.Barter }; private static readonly TextObject _TMessengerSent = new("{=zv12jjyW}Messenger Sent"); private Messenger? _activeMessenger; private Mission? _currentMission; - [SaveableField(1)] [UsedImplicitly] private List _messengers; + [SaveableField(1)][UsedImplicitly] private List _messengers; public MBReadOnlyList Messengers { get; private set; } @@ -152,7 +160,7 @@ private static bool IsPlayerHeroAvailable() { return PartyBase.MainParty is not null && PlayerEncounter.Current is null - && GameStateManager.Current.ActiveState is MapState {AtMenu: false}; + && GameStateManager.Current.ActiveState is MapState { AtMenu: false }; } internal void Sync() @@ -268,16 +276,9 @@ internal void CleanUpAfterLoad(float obj) private void RemoveThisFromListeners() { -#if e159 || e1510 - CampaignEvents.RemoveListeners(this); -#else CampaignEventDispatcher.Instance.RemoveListeners(this); -#endif } -#if e170 public void OnDeploymentPlanMade(BattleSideEnum battleSide, bool isFirstPlan) { } -#else -#endif } } \ No newline at end of file diff --git a/src/PatchTools/PatchClass.cs b/src/Bannerlord.Diplomacy/PatchTools/PatchClass.cs similarity index 99% rename from src/PatchTools/PatchClass.cs rename to src/Bannerlord.Diplomacy/PatchTools/PatchClass.cs index 8d2b5330..b1899fda 100644 --- a/src/PatchTools/PatchClass.cs +++ b/src/Bannerlord.Diplomacy/PatchTools/PatchClass.cs @@ -172,4 +172,4 @@ public Finalizer(string patchMethodName, string targetMethodName, int priority = : base(HarmonyPatchType.Finalizer, new(typeof(TPatch), patchMethodName), new Reflect.Method(typeof(TTarget), targetMethodName), priority) { } } } -} +} \ No newline at end of file diff --git a/src/PatchTools/PatchManager.cs b/src/Bannerlord.Diplomacy/PatchTools/PatchManager.cs similarity index 99% rename from src/PatchTools/PatchManager.cs rename to src/Bannerlord.Diplomacy/PatchTools/PatchManager.cs index 3065605d..7e3d4e96 100644 --- a/src/PatchTools/PatchManager.cs +++ b/src/Bannerlord.Diplomacy/PatchTools/PatchManager.cs @@ -40,7 +40,7 @@ private PatchManager(string harmonyId) { var log = LogFactory.Get(); log.LogDebug($"Applying unannotated Harmony patches (domain: {harmonyId})..."); - + Harmony = new(harmonyId); _patches = _PatchClasses.SelectMany(pc => pc.Patches).ToArray(); @@ -74,4 +74,4 @@ private PatchManager(string harmonyId) // ... Only 1 class left to convert to declarative patching. }; } -} +} \ No newline at end of file diff --git a/src/Bannerlord.Diplomacy/PatchTools/Priority.cs b/src/Bannerlord.Diplomacy/PatchTools/Priority.cs new file mode 100644 index 00000000..3add6c91 --- /dev/null +++ b/src/Bannerlord.Diplomacy/PatchTools/Priority.cs @@ -0,0 +1,43 @@ +namespace Diplomacy.PatchTools +{ + /// A patch priority + /// + public static class Priority + { + /// Patch last (the lowest priority) + /// + public const int Last = 0; + + /// Patch with very low priority + /// + public const int VeryLow = 100; + + /// Patch with low priority + /// + public const int Low = 200; + + /// Patch with lower than normal priority + /// + public const int LowerThanNormal = 300; + + /// Patch with normal priority + /// + public const int Normal = 400; + + /// Patch with higher than normal priority + /// + public const int HigherThanNormal = 500; + + /// Patch with high priority + /// + public const int High = 600; + + /// Patch with very high priority + /// + public const int VeryHigh = 700; + + /// Patch first (the highest priority) + /// + public const int First = 800; + } +} \ No newline at end of file diff --git a/src/Patches/DeclareWarActionPatch.cs b/src/Bannerlord.Diplomacy/Patches/DeclareWarActionPatch.cs similarity index 99% rename from src/Patches/DeclareWarActionPatch.cs rename to src/Bannerlord.Diplomacy/Patches/DeclareWarActionPatch.cs index 084bf313..4a71b62a 100644 --- a/src/Patches/DeclareWarActionPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/DeclareWarActionPatch.cs @@ -30,5 +30,5 @@ private static void ApplyDeclareWarOverProvocationPostfix(IFaction faction, IFac => Events.Instance.OnWarDeclared(new WarDeclaredEvent(faction, provocatorFaction, true)); // FIXME: LO-PRIO: There are two other types of Apply* methods; they should probably also fire the event. - } -} + } +} \ No newline at end of file diff --git a/src/Patches/DefaultClanPoliticsModelPatch.cs b/src/Bannerlord.Diplomacy/Patches/DefaultClanPoliticsModelPatch.cs similarity index 91% rename from src/Patches/DefaultClanPoliticsModelPatch.cs rename to src/Bannerlord.Diplomacy/Patches/DefaultClanPoliticsModelPatch.cs index b18a46a8..ac54cf1a 100644 --- a/src/Patches/DefaultClanPoliticsModelPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/DefaultClanPoliticsModelPatch.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using TaleWorlds.CampaignSystem; -using TaleWorlds.CampaignSystem.SandBox.GameComponents; +using TaleWorlds.CampaignSystem.GameComponents; using TaleWorlds.Localization; namespace Diplomacy.Patches @@ -38,7 +38,7 @@ private static void CalculateInfluenceChangePostfix(Clan clan, ref ExplainedNumb if (Settings.Instance!.EnableInfluenceDecay && clan.Influence > Settings.Instance!.InfluenceDecayThreshold) { float decayFactor = Settings.Instance!.InfluenceDecayPercentage / 100f; - int decay = (int)(decayFactor * (clan.Influence - Settings.Instance!.InfluenceDecayThreshold)); + int decay = (int) (decayFactor * (clan.Influence - Settings.Instance!.InfluenceDecayThreshold)); if (decay > 0) __result.Add(-decay, _TInfluenceDecay); @@ -51,4 +51,4 @@ private static void CalculateInfluenceChangePostfix(Clan clan, ref ExplainedNumb private static readonly TextObject _TCorruption = new("{=dUCOV7km}Corruption: Too Many Fiefs"); private static readonly TextObject _TInfluenceDecay = new("{=koTNaZUX}Decay of High Influence"); } -} +} \ No newline at end of file diff --git a/src/Patches/DefaultEncyclopediaFactionPagePatch.cs b/src/Bannerlord.Diplomacy/Patches/DefaultEncyclopediaFactionPagePatch.cs similarity index 53% rename from src/Patches/DefaultEncyclopediaFactionPagePatch.cs rename to src/Bannerlord.Diplomacy/Patches/DefaultEncyclopediaFactionPagePatch.cs index 8231d878..7ad1c81b 100644 --- a/src/Patches/DefaultEncyclopediaFactionPagePatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/DefaultEncyclopediaFactionPagePatch.cs @@ -12,7 +12,6 @@ namespace Diplomacy.Patches { internal sealed class DefaultEncyclopediaFactionPagePatch : PatchClass { -#if e165 || e170 protected override IEnumerable Prepare() => new Patch[] { new Postfix(nameof(PassThroughPostfix), "InitializeListItems"), @@ -23,7 +22,7 @@ private static IEnumerable PassThroughPostfix(IEnumerable< { foreach (var item in values.ToList()) { - var kingdom = (Kingdom)item.Object; + var kingdom = (Kingdom) item.Object; if (kingdom.IsRebelKingdom() && kingdom.IsEliminated) { continue; @@ -31,27 +30,5 @@ private static IEnumerable PassThroughPostfix(IEnumerable< yield return item; } } -#else - protected override IEnumerable Prepare() => new Patch[] - { - new Postfix(nameof(ApplyPostfix), nameof(DefaultEncyclopediaFactionPage.GetListItems)), - }; - - // ReSharper disable once RedundantAssignment - private static void ApplyPostfix(ref IEnumerable __result, ref IEnumerable ____items) - { - var listItems = ____items.ToList(); - foreach (var item in listItems.ToList()) - { - var kingdom = (Kingdom)item.Object; - if (kingdom.IsRebelKingdom() && kingdom.IsEliminated) - { - listItems.Remove(item); - } - } - ____items = listItems; - __result = ____items; - } -#endif } -} +} \ No newline at end of file diff --git a/src/Patches/DiplomaticBartersBehaviorPatch.cs b/src/Bannerlord.Diplomacy/Patches/DiplomaticBartersBehaviorPatch.cs similarity index 94% rename from src/Patches/DiplomaticBartersBehaviorPatch.cs rename to src/Bannerlord.Diplomacy/Patches/DiplomaticBartersBehaviorPatch.cs index 8a31b956..8a7e8759 100644 --- a/src/Patches/DiplomaticBartersBehaviorPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/DiplomaticBartersBehaviorPatch.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using TaleWorlds.CampaignSystem; -using TaleWorlds.CampaignSystem.SandBox.CampaignBehaviors.BarterBehaviors; +using TaleWorlds.CampaignSystem.CampaignBehaviors.BarterBehaviors; namespace Diplomacy.Patches { @@ -42,4 +42,4 @@ private static bool ConsiderWarPrefix(Clan clan, IFaction otherMapFaction) return true; } } -} +} \ No newline at end of file diff --git a/src/Patches/EncyclopediaDataPatch.cs b/src/Bannerlord.Diplomacy/Patches/EncyclopediaDataPatch.cs similarity index 82% rename from src/Patches/EncyclopediaDataPatch.cs rename to src/Bannerlord.Diplomacy/Patches/EncyclopediaDataPatch.cs index c7ad78e3..4b60f3d2 100644 --- a/src/Patches/EncyclopediaDataPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/EncyclopediaDataPatch.cs @@ -1,5 +1,5 @@ -using Diplomacy.ViewModel; -using Diplomacy.PatchTools; +using Diplomacy.PatchTools; +using Diplomacy.ViewModel; using HarmonyLib; @@ -20,7 +20,7 @@ internal sealed class EncyclopediaDataPatch : PatchClass SetStance = new Reflect.Method("SetStance").GetDelegate>(); + private static readonly Func SetStance = new Reflect.Method("SetStance").GetDelegate>(); } -} +} \ No newline at end of file diff --git a/src/Patches/GameMenusCallbacksPatch.cs b/src/Bannerlord.Diplomacy/Patches/GameMenusCallbacksPatch.cs similarity index 87% rename from src/Patches/GameMenusCallbacksPatch.cs rename to src/Bannerlord.Diplomacy/Patches/GameMenusCallbacksPatch.cs index 6766e7d1..826156ae 100644 --- a/src/Patches/GameMenusCallbacksPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/GameMenusCallbacksPatch.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; -using TaleWorlds.CampaignSystem; -using TaleWorlds.CampaignSystem.SandBox.CampaignBehaviors; +using TaleWorlds.CampaignSystem.CampaignBehaviors; +using TaleWorlds.CampaignSystem.Settlements; namespace Diplomacy.Patches { @@ -20,4 +20,4 @@ protected override IEnumerable Prepare() private static void menu_settlement_taken_on_init_Postfix() => Events.Instance.OnPlayerSettlementTaken(Settlement.CurrentSettlement); } -} +} \ No newline at end of file diff --git a/src/Patches/GiveGoldToClanActionPatch.cs b/src/Bannerlord.Diplomacy/Patches/GiveGoldToClanActionPatch.cs similarity index 99% rename from src/Patches/GiveGoldToClanActionPatch.cs rename to src/Bannerlord.Diplomacy/Patches/GiveGoldToClanActionPatch.cs index ac397cdb..426f23cb 100644 --- a/src/Patches/GiveGoldToClanActionPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/GiveGoldToClanActionPatch.cs @@ -26,4 +26,4 @@ private static bool ApplyFromHeroToClanReplaced(Hero giverHero, Clan clan, int a return false; } } -} +} \ No newline at end of file diff --git a/src/Patches/KingdomDecisionProposalBehaviorPatch.cs b/src/Bannerlord.Diplomacy/Patches/KingdomDecisionProposalBehaviorPatch.cs similarity index 96% rename from src/Patches/KingdomDecisionProposalBehaviorPatch.cs rename to src/Bannerlord.Diplomacy/Patches/KingdomDecisionProposalBehaviorPatch.cs index 31a0d4c1..8045e4ff 100644 --- a/src/Patches/KingdomDecisionProposalBehaviorPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/KingdomDecisionProposalBehaviorPatch.cs @@ -5,8 +5,8 @@ using System.Collections.Generic; using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.CampaignBehaviors; using TaleWorlds.CampaignSystem.Election; -using TaleWorlds.CampaignSystem.SandBox.CampaignBehaviors; namespace Diplomacy.Patches { @@ -54,4 +54,4 @@ private static bool ConsiderPeacePrefix(Clan clan, Clan otherClan, Kingdom kingd return true; } } -} +} \ No newline at end of file diff --git a/src/Patches/KingdomManagementVMPatch.cs b/src/Bannerlord.Diplomacy/Patches/KingdomManagementVMPatch.cs similarity index 99% rename from src/Patches/KingdomManagementVMPatch.cs rename to src/Bannerlord.Diplomacy/Patches/KingdomManagementVMPatch.cs index 06297c5a..7c00f40f 100644 --- a/src/Patches/KingdomManagementVMPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/KingdomManagementVMPatch.cs @@ -21,4 +21,4 @@ private static void FinalizeFix(KingdomManagementVM __instance) __instance.Diplomacy.OnFinalize(); } } -} +} \ No newline at end of file diff --git a/src/Patches/MBBannerEditorGauntletScreenPatch.cs b/src/Bannerlord.Diplomacy/Patches/MBBannerEditorGauntletScreenPatch.cs similarity index 100% rename from src/Patches/MBBannerEditorGauntletScreenPatch.cs rename to src/Bannerlord.Diplomacy/Patches/MBBannerEditorGauntletScreenPatch.cs diff --git a/src/Patches/RebelKingdomPatches.cs b/src/Bannerlord.Diplomacy/Patches/RebelKingdomPatches.cs similarity index 93% rename from src/Patches/RebelKingdomPatches.cs rename to src/Bannerlord.Diplomacy/Patches/RebelKingdomPatches.cs index eb2c2e40..7785823e 100644 --- a/src/Patches/RebelKingdomPatches.cs +++ b/src/Bannerlord.Diplomacy/Patches/RebelKingdomPatches.cs @@ -7,9 +7,9 @@ using System.Linq; using TaleWorlds.CampaignSystem; -using TaleWorlds.CampaignSystem.SandBox.CampaignBehaviors; -using TaleWorlds.CampaignSystem.SandBox.CampaignBehaviors.Towns; -using TaleWorlds.CampaignSystem.SandBox.CampaignBehaviors.VillageBehaviors; +using TaleWorlds.CampaignSystem.CampaignBehaviors; +using TaleWorlds.CampaignSystem.Party; +using TaleWorlds.CampaignSystem.Settlements; namespace Diplomacy.Patches { @@ -17,7 +17,7 @@ internal sealed class RebelKingdomPatches : PatchClass { protected override IEnumerable Prepare() { - Type conversationBehaviorType = Type.GetType("SandBox.LordConversationsCampaignBehavior, SandBox, Version=1.0.0.0, Culture=neutral")!; + Type conversationBehaviorType = Type.GetType("SandBox.CampaignBehaviors.LordConversationsCampaignBehavior, SandBox, Version=1.0.0.0, Culture=neutral")!; return new Patch[] { new Postfix(nameof(PreventOtherActionsConversation), conversationBehaviorType, "conversation_lord_request_mission_ask_on_condition"), @@ -27,9 +27,7 @@ protected override IEnumerable Prepare() new Postfix(nameof(PreventHostileActionsConversation), typeof(VillagerCampaignBehavior), "village_farmer_loot_on_condition"), new Postfix(nameof(PreventHostileActionsConversation), typeof(CaravansCampaignBehavior), "caravan_loot_on_condition"), new Postfix(nameof(PreventHostileActionsMenu), typeof(PlayerTownVisitCampaignBehavior), "game_menu_village_hostile_action_on_condition"), -#if !e159 new Prefix(nameof(HandleThroneAbdication), typeof(KingdomManager), "AbdicateTheThrone"), -#endif }; } @@ -88,7 +86,7 @@ private static bool ShouldPreventHostileAction(IFaction otherFaction) playerFaction is Kingdom playerKingdom && playerKingdom.IsRebelKingdom() && !playerKingdom.IsAtWarWith(otherFaction); return shouldPreventAction1 || shouldPreventAction2; } -#if !e159 + private static void HandleThroneAbdication(Kingdom kingdom) { if (kingdom.Clans.Count <= 1 && kingdom.HasRebellion()) @@ -101,6 +99,5 @@ private static void HandleThroneAbdication(Kingdom kingdom) kingdom.GetRebelFactions().First().EnforceSuccess(); } } -#endif } -} +} \ No newline at end of file diff --git a/src/Patches/SupportKingdomQuestPatch.cs b/src/Bannerlord.Diplomacy/Patches/SupportKingdomQuestPatch.cs similarity index 72% rename from src/Patches/SupportKingdomQuestPatch.cs rename to src/Bannerlord.Diplomacy/Patches/SupportKingdomQuestPatch.cs index 6ec7e2da..8fc93a24 100644 --- a/src/Patches/SupportKingdomQuestPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/SupportKingdomQuestPatch.cs @@ -1,10 +1,9 @@ using Diplomacy.PatchTools; +using StoryMode.Quests.FirstPhase; + using System; using System.Collections.Generic; -using System.Reflection; - -using StoryMode.Behaviors.Quests; using TaleWorlds.CampaignSystem; @@ -17,22 +16,17 @@ internal sealed class SupportKingdomQuestPatch : PatchClass CompleteQuestWithSuccess = new Reflect.Method("CompleteQuestWithSuccess") .GetOpenDelegate>(); private static void MainStoryLineChosenPostfix(object __instance) { - var quest = (QuestBase)__instance; + var quest = (QuestBase) __instance; if (!quest.IsFinalized) CompleteQuestWithSuccess(quest); } } -} +} \ No newline at end of file diff --git a/src/Patches/UrbanCharactersCampaignBehaviorPatch.cs b/src/Bannerlord.Diplomacy/Patches/UrbanCharactersCampaignBehaviorPatch.cs similarity index 82% rename from src/Patches/UrbanCharactersCampaignBehaviorPatch.cs rename to src/Bannerlord.Diplomacy/Patches/UrbanCharactersCampaignBehaviorPatch.cs index ca32f1d6..693043ca 100644 --- a/src/Patches/UrbanCharactersCampaignBehaviorPatch.cs +++ b/src/Bannerlord.Diplomacy/Patches/UrbanCharactersCampaignBehaviorPatch.cs @@ -1,30 +1,34 @@ -using JetBrains.Annotations; - +/* using HarmonyLib; +using JetBrains.Annotations; + using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using TaleWorlds.CampaignSystem; -using TaleWorlds.CampaignSystem.SandBox.CampaignBehaviors; +using TaleWorlds.CampaignSystem.CampaignBehaviors; +*/ +// Outdated since e1.7.2? namespace Diplomacy.Patches { + /* [HarmonyPatch(typeof(UrbanCharactersCampaignBehavior))] [UsedImplicitly] internal sealed class UrbanCharactersCampaignBehaviorPatch { private static readonly FieldInfo CompanionsFieldInfo = AccessTools.Field(typeof(UrbanCharactersCampaignBehavior), "_companions"); + private static readonly Action ActivateCharacter = (hero, __instance) => { hero.ChangeState(Hero.CharacterStates.Active); - var companionsList = (List)CompanionsFieldInfo.GetValue(__instance); + var companionsList = (List) CompanionsFieldInfo.GetValue(__instance); companionsList.Remove(hero); }; - [HarmonyPostfix, HarmonyPatch("RegisterEvents")] [UsedImplicitly] public static void RegisterEventsPatch(UrbanCharactersCampaignBehavior __instance) @@ -32,8 +36,6 @@ public static void RegisterEventsPatch(UrbanCharactersCampaignBehavior __instanc CampaignEvents.NewCompanionAdded.AddNonSerializedListener(__instance, hero => ActivateCharacter(hero, __instance)); } -// It Seems they changed this to "DailyTickHero" in 1.5.0 - //[HarmonyPostfix, HarmonyPatch("DailyTick")] [HarmonyPostfix, HarmonyPatch("DailyTickHero")] [UsedImplicitly] public static void HourlyTickPatch(UrbanCharactersCampaignBehavior __instance) @@ -41,4 +43,5 @@ public static void HourlyTickPatch(UrbanCharactersCampaignBehavior __instance) Hero.MainHero.CompanionsInParty.Where(companion => companion.HeroState == Hero.CharacterStates.NotSpawned).Do(hero => ActivateCharacter(hero, __instance)); } } -} + */ +} \ No newline at end of file diff --git a/src/PlayerHelpers.cs b/src/Bannerlord.Diplomacy/PlayerHelpers.cs similarity index 99% rename from src/PlayerHelpers.cs rename to src/Bannerlord.Diplomacy/PlayerHelpers.cs index 0afd1922..569d5e00 100644 --- a/src/PlayerHelpers.cs +++ b/src/Bannerlord.Diplomacy/PlayerHelpers.cs @@ -11,4 +11,4 @@ internal sealed class PlayerHelpers : default; } } -} +} \ No newline at end of file diff --git a/src/Properties/launchSettings.json b/src/Bannerlord.Diplomacy/Properties/launchSettings.json similarity index 100% rename from src/Properties/launchSettings.json rename to src/Bannerlord.Diplomacy/Properties/launchSettings.json diff --git a/src/Reflect.cs b/src/Bannerlord.Diplomacy/Reflect.cs similarity index 97% rename from src/Reflect.cs rename to src/Bannerlord.Diplomacy/Reflect.cs index afadcf15..4b67e739 100644 --- a/src/Reflect.cs +++ b/src/Bannerlord.Diplomacy/Reflect.cs @@ -1,9 +1,9 @@ -using System; +using HarmonyLib; + +using System; using System.Linq; using System.Reflection; -using HarmonyLib; - namespace Diplomacy { internal static class Reflect @@ -11,16 +11,16 @@ internal static class Reflect public class Method { public Type RequestedType { get; init; } - + public string Name { get; init; } - + public Type[]? Parameters { get; init; } - + public Type[]? Generics { get; init; } public MethodInfo MethodInfo { get; init; } - public Type Type => MethodInfo is {DeclaringType: { } dt} ? dt : RequestedType; + public Type Type => MethodInfo is { DeclaringType: { } dt } ? dt : RequestedType; protected virtual string MethodType => "method"; @@ -135,4 +135,4 @@ public sealed class DeclaredSetter : DeclaredSetter public DeclaredSetter(string name) : base(typeof(T), name) { } } } -} +} \ No newline at end of file diff --git a/src/Settings.cs b/src/Bannerlord.Diplomacy/Settings.cs similarity index 99% rename from src/Settings.cs rename to src/Bannerlord.Diplomacy/Settings.cs index 3d69da81..2f362737 100644 --- a/src/Settings.cs +++ b/src/Bannerlord.Diplomacy/Settings.cs @@ -116,7 +116,7 @@ class Settings : AttributeGlobalSettings public int GrantFiefRelationPenalty { get; set; } = -2; // Costs - + [SettingPropertyFloatingInteger(displayName: "{=HFtZsD6v}Scaling War Reparations Gold Cost Multiplier", 0, 10000, Order = 0, RequireRestart = false, HintText = "{=MIhbrqbr}Multiplier for the scaling of war reparations gold costs. Default value is 100.")] [SettingPropertyGroup(HeadingGoldCosts)] public float ScalingWarReparationsGoldCostMultiplier { get; set; } = 100.0f; @@ -140,7 +140,7 @@ class Settings : AttributeGlobalSettings [SettingPropertyFloatingInteger(displayName: "{=TvAYJv5Q}Scaling Influence Cost Multiplier", 0, 100, Order = 1, RequireRestart = false, HintText = "{=AQ5gRYN6}Multiplier for the scaling influence costs. Default value is 5.")] [SettingPropertyGroup(HeadingInfluenceCosts)] public float ScalingInfluenceCostMultiplier { get; set; } = 5.0f; - + // Influence [SettingPropertyBool("{=4jlYRUdZ}Enable Influence Balancing", RequireRestart = false, HintText = "{=tOMN9DQD}Enables influence balancing. May need to be disabled for mod compatibility.")] @@ -234,4 +234,4 @@ class Settings : AttributeGlobalSettings public float CoalitionChancePercentage { get; set; } = 5.0f; */ } -} +} \ No newline at end of file diff --git a/src/StringConstants.cs b/src/Bannerlord.Diplomacy/StringConstants.cs similarity index 99% rename from src/StringConstants.cs rename to src/Bannerlord.Diplomacy/StringConstants.cs index b1c8b8e0..b8a892b7 100644 --- a/src/StringConstants.cs +++ b/src/Bannerlord.Diplomacy/StringConstants.cs @@ -20,4 +20,4 @@ internal sealed class StringConstants public const string FactionLeague = "{=LUzfk4tb}{CLAN_NAME} League"; public const string FactionConspiracy = "{=MXAsjFdI}{CLAN_NAME} Conspiracy"; } -} +} \ No newline at end of file diff --git a/src/SubModule.cs b/src/Bannerlord.Diplomacy/SubModule.cs similarity index 92% rename from src/SubModule.cs rename to src/Bannerlord.Diplomacy/SubModule.cs index 483d2ec0..71818cf6 100644 --- a/src/SubModule.cs +++ b/src/Bannerlord.Diplomacy/SubModule.cs @@ -1,9 +1,9 @@ -using Diplomacy.CampaignBehaviors; -using Diplomacy.PatchTools; - -using Bannerlord.ButterLib.Common.Extensions; +using Bannerlord.ButterLib.Common.Extensions; +using Bannerlord.UIExtenderEx; -using HarmonyLib; +using Diplomacy.CampaignBehaviors; +using Diplomacy.Event; +using Diplomacy.PatchTools; using Microsoft.Extensions.Logging; @@ -12,10 +12,8 @@ using TaleWorlds.CampaignSystem; using TaleWorlds.Core; using TaleWorlds.Library; -using TaleWorlds.MountAndBlade; -using Bannerlord.UIExtenderEx; -using Diplomacy.Event; using TaleWorlds.ModuleManager; +using TaleWorlds.MountAndBlade; namespace Diplomacy { @@ -51,7 +49,6 @@ protected override void OnSubModuleLoad() Log = LogFactory.Get(); PatchManager.PatchAll(HarmonyDomain); - new Harmony(HarmonyDomain).PatchAll(); // Will only keep this around while I convert all the remaining annotated patches. } protected override void OnSubModuleUnloaded() @@ -82,7 +79,7 @@ protected override void OnGameStart(Game game, IGameStarter gameStarterObject) if (game.GameType is Campaign) { Events.Instance = new Events(); - var gameStarter = (CampaignGameStarter)gameStarterObject; + var gameStarter = (CampaignGameStarter) gameStarterObject; gameStarter.AddBehavior(new DiplomaticAgreementBehavior()); gameStarter.AddBehavior(new CooldownBehavior()); @@ -120,4 +117,4 @@ public override void OnGameEnd(Game game) Log.LogDebug("Campaign session ended."); } } -} +} \ No newline at end of file diff --git a/src/ViewModel/DetailWarStatsVM.cs b/src/Bannerlord.Diplomacy/ViewModel/DetailWarStatsVM.cs similarity index 99% rename from src/ViewModel/DetailWarStatsVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/DetailWarStatsVM.cs index d399dd01..a0807c52 100644 --- a/src/ViewModel/DetailWarStatsVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/DetailWarStatsVM.cs @@ -1,4 +1,5 @@ using System; + using TaleWorlds.CampaignSystem; using TaleWorlds.Core; using TaleWorlds.Library; @@ -24,4 +25,4 @@ public DetailWarStatsVM(Kingdom kingdom) FiefsLabel = GameTexts.FindText("str_fiefs").ToString(); } } -} +} \ No newline at end of file diff --git a/src/ViewModel/DetailWarVM.cs b/src/Bannerlord.Diplomacy/ViewModel/DetailWarVM.cs similarity index 99% rename from src/ViewModel/DetailWarVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/DetailWarVM.cs index e2b752af..d5945ec5 100644 --- a/src/ViewModel/DetailWarVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/DetailWarVM.cs @@ -1,11 +1,14 @@ -using System; -using JetBrains.Annotations; +using JetBrains.Annotations; + +using System; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.ViewModelCollection; using TaleWorlds.Core; using TaleWorlds.Core.ViewModelCollection; using TaleWorlds.Library; using TaleWorlds.Localization; + using static Diplomacy.WarExhaustionManager; namespace Diplomacy.ViewModel diff --git a/src/ViewModel/DiplomacyFactionRelationshipVM.cs b/src/Bannerlord.Diplomacy/ViewModel/DiplomacyFactionRelationshipVM.cs similarity index 95% rename from src/ViewModel/DiplomacyFactionRelationshipVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/DiplomacyFactionRelationshipVM.cs index 199eb25d..6853ab7d 100644 --- a/src/ViewModel/DiplomacyFactionRelationshipVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/DiplomacyFactionRelationshipVM.cs @@ -1,5 +1,7 @@ -using System.Collections.Generic; -using JetBrains.Annotations; +using JetBrains.Annotations; + +using System.Collections.Generic; + using TaleWorlds.CampaignSystem; using TaleWorlds.Core; using TaleWorlds.Core.ViewModelCollection; @@ -9,7 +11,7 @@ namespace Diplomacy.ViewModel { public sealed class DiplomacyFactionRelationshipVM : TaleWorlds.Library.ViewModel { - public IFaction Faction { get; init; } + public IFaction Faction { get; init; } public DiplomacyFactionRelationshipVM(IFaction faction, HintViewModel? hint = null) { @@ -75,4 +77,4 @@ public HintViewModel Hint private string _nameText; private HintViewModel _hint; } -} +} \ No newline at end of file diff --git a/src/ViewModel/DiplomacyPropertiesVM.cs b/src/Bannerlord.Diplomacy/ViewModel/DiplomacyPropertiesVM.cs similarity index 93% rename from src/ViewModel/DiplomacyPropertiesVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/DiplomacyPropertiesVM.cs index f47347c4..aa685dff 100644 --- a/src/ViewModel/DiplomacyPropertiesVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/DiplomacyPropertiesVM.cs @@ -75,7 +75,7 @@ private HintViewModel CreateAllianceHint(Kingdom kingdom1, Kingdom kingdom2) { textObject = _TDaysRemaining.CopyTextObject(); var remaining = Settings.Instance!.MinimumAllianceDuration - elapsedDaysUntilNow; - textObject.SetTextVariable("DAYS_LEFT", (int)Math.Round(remaining)); + textObject.SetTextVariable("DAYS_LEFT", (int) Math.Round(remaining)); } else { @@ -87,10 +87,10 @@ private HintViewModel CreateAllianceHint(Kingdom kingdom1, Kingdom kingdom2) private void AddNonAggressionPactRelationships(Kingdom kingdom, IFaction faction, MBBindingList factionPacts) { - if (DiplomaticAgreementManager.HasNonAggressionPact(kingdom, (Kingdom)faction, out var pact)) + if (DiplomaticAgreementManager.HasNonAggressionPact(kingdom, (Kingdom) faction, out var pact)) { var textObject = _TDaysRemaining.CopyTextObject(); - textObject.SetTextVariable("DAYS_LEFT", (int)Math.Round(pact!.EndDate.RemainingDaysFromNow)); + textObject.SetTextVariable("DAYS_LEFT", (int) Math.Round(pact!.EndDate.RemainingDaysFromNow)); factionPacts.Add(new DiplomacyFactionRelationshipVM(kingdom, Compat.HintViewModel.Create(textObject))); } } @@ -98,10 +98,10 @@ private void AddNonAggressionPactRelationships(Kingdom kingdom, IFaction faction private void AddWarRelationships(IEnumerable stances) { foreach (var stance in from x in stances - where x.IsAtWar - select x into w - orderby w.Faction1.Name.ToString() + w.Faction2.Name.ToString() - select w) + where x.IsAtWar + select x into w + orderby w.Faction1.Name.ToString() + w.Faction2.Name.ToString() + select w) { var (f1, f2) = (stance.Faction1, stance.Faction2); @@ -206,4 +206,4 @@ public MBBindingList Faction2Pacts } } -} +} \ No newline at end of file diff --git a/src/ViewModel/DonateGoldVM.cs b/src/Bannerlord.Diplomacy/ViewModel/DonateGoldVM.cs similarity index 86% rename from src/ViewModel/DonateGoldVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/DonateGoldVM.cs index ef1d8163..97f305d7 100644 --- a/src/ViewModel/DonateGoldVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/DonateGoldVM.cs @@ -1,6 +1,8 @@ -using System; +using JetBrains.Annotations; + +using System; using System.ComponentModel; -using JetBrains.Annotations; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; using TaleWorlds.Core; @@ -62,7 +64,7 @@ public string RelationGain } } - [DataSourceProperty] [UsedImplicitly] public float MinValue { get; } + [DataSourceProperty][UsedImplicitly] public float MinValue { get; } [DataSourceProperty] public int IntValue @@ -78,11 +80,11 @@ public int IntValue } } - [DataSourceProperty] [UsedImplicitly] public string AcceptText { get; } = new TextObject(StringConstants.Accept).ToString(); + [DataSourceProperty][UsedImplicitly] public string AcceptText { get; } = new TextObject(StringConstants.Accept).ToString(); - [DataSourceProperty] [UsedImplicitly] public string CancelText { get; } = GameTexts.FindText("str_cancel").ToString(); + [DataSourceProperty][UsedImplicitly] public string CancelText { get; } = GameTexts.FindText("str_cancel").ToString(); - [DataSourceProperty] [UsedImplicitly] public string TitleText { get; } = new TextObject("{=Gzq6VHPt}Donate Gold").ToString(); + [DataSourceProperty][UsedImplicitly] public string TitleText { get; } = new TextObject("{=Gzq6VHPt}Donate Gold").ToString(); public DonateGoldVM(Clan clan, Action onFinalize) { @@ -139,14 +141,14 @@ private int GetBaseRelationValueOfCurrentGoldCost() var relationValuePerInfluence = (float) Campaign.Current.Models.DiplomacyModel.GetRelationValueOfSupportingClan() / Campaign.Current.Models.DiplomacyModel.GetInfluenceCostOfSupportingClan(); - return (int)Math.Round(influenceValue * relationValuePerInfluence); + return (int) Math.Round(influenceValue * relationValuePerInfluence); } private int GetEstimatedRelationValue() { var baseRelation = GetBaseRelationValueOfCurrentGoldCost(); var adjustedRelation = Campaign.Current.Models.DiplomacyModel.GetRelationIncreaseFactor(Hero.MainHero, _clan.Leader, baseRelation); - return (int)Math.Floor(adjustedRelation); + return (int) Math.Floor(adjustedRelation); } } } \ No newline at end of file diff --git a/src/ViewModel/EncyclopediaFactionPageVMExtensionVM.cs b/src/Bannerlord.Diplomacy/ViewModel/EncyclopediaFactionPageVMExtensionVM.cs similarity index 95% rename from src/ViewModel/EncyclopediaFactionPageVMExtensionVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/EncyclopediaFactionPageVMExtensionVM.cs index 314c7507..21109581 100644 --- a/src/ViewModel/EncyclopediaFactionPageVMExtensionVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/EncyclopediaFactionPageVMExtensionVM.cs @@ -1,13 +1,16 @@ using Diplomacy.DiplomaticAction; using Diplomacy.GauntletInterfaces; -using System.Linq; + using JetBrains.Annotations; + +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.ViewModelCollection.Encyclopedia; using TaleWorlds.CampaignSystem.ViewModelCollection.Encyclopedia.EncyclopediaItems; -using TaleWorlds.Engine.Screens; using TaleWorlds.Library; using TaleWorlds.Localization; +using TaleWorlds.ScreenSystem; namespace Diplomacy.ViewModel { @@ -25,7 +28,7 @@ class EncyclopediaFactionPageVMExtensionVM : EncyclopediaFactionPageVM public EncyclopediaFactionPageVMExtensionVM(EncyclopediaPageArgs args) : base(args) { - _faction = (IFaction)Obj; + _faction = (IFaction) Obj; _alliesText = _TAllies.ToString(); _nonAggressionPactsText = _TNonAggressionPacts.ToString(); FactionsText = _TFactions.ToString(); @@ -33,7 +36,7 @@ public EncyclopediaFactionPageVMExtensionVM(EncyclopediaPageArgs args) : base(ar public override void RefreshValues() { - _faction = (IFaction)Obj; + _faction = (IFaction) Obj; _allies = new(); _nonAggressionPacts = new(); base.RefreshValues(); @@ -53,7 +56,7 @@ public override void Refresh() if (_faction.IsKingdomFaction) foreach (var f in Kingdom.All.Cast().Where(f => f != _faction).OrderBy(f => f.Name.ToString())) - if (clanPages.IsValidEncyclopediaItem(f) && DiplomaticAgreementManager.HasNonAggressionPact((Kingdom)_faction, (Kingdom)f, out _)) + if (clanPages.IsValidEncyclopediaItem(f) && DiplomaticAgreementManager.HasNonAggressionPact((Kingdom) _faction, (Kingdom) f, out _)) _nonAggressionPacts.Add(new EncyclopediaFactionVM(f)); base.Refresh(); @@ -124,4 +127,4 @@ public MBBindingList? NonAggressionPacts } } } -} +} \ No newline at end of file diff --git a/src/ViewModel/EncyclopediaHeroPageVMExtensionVM.cs b/src/Bannerlord.Diplomacy/ViewModel/EncyclopediaHeroPageVMExtensionVM.cs similarity index 97% rename from src/ViewModel/EncyclopediaHeroPageVMExtensionVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/EncyclopediaHeroPageVMExtensionVM.cs index 28645b58..61d0acbd 100644 --- a/src/ViewModel/EncyclopediaHeroPageVMExtensionVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/EncyclopediaHeroPageVMExtensionVM.cs @@ -3,12 +3,14 @@ using Diplomacy.GauntletInterfaces; using Diplomacy.GrantFief; using Diplomacy.Messengers; + using JetBrains.Annotations; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.ViewModelCollection.Encyclopedia; -using TaleWorlds.Engine.Screens; using TaleWorlds.Library; using TaleWorlds.Localization; +using TaleWorlds.ScreenSystem; namespace Diplomacy.ViewModel { @@ -28,7 +30,7 @@ public EncyclopediaHeroPageVMExtensionVM(EncyclopediaPageArgs args) : base(args) _grantFiefInterface = new GrantFiefInterface(); _hero = (Obj as Hero)!; _sendMessengerCost = DiplomacyCostCalculator.DetermineCostForSendingMessenger(); - SendMessengerCost = (int)_sendMessengerCost.Value; + SendMessengerCost = (int) _sendMessengerCost.Value; SendMessengerActionName = _TSendMessengerText.ToString(); GrantFiefActionName = _TGrantFiefText.ToString(); RefreshValues(); @@ -37,7 +39,7 @@ public EncyclopediaHeroPageVMExtensionVM(EncyclopediaPageArgs args) : base(args) public sealed override void RefreshValues() { base.RefreshValues(); - + // this is called before the constructor the first time // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (_hero is null) @@ -114,4 +116,4 @@ private void UpdateIsMessengerAvailable() [DataSourceProperty] public string GrantFiefActionName { get; } } -} +} \ No newline at end of file diff --git a/src/ViewModel/GrantFiefItemVM.cs b/src/Bannerlord.Diplomacy/ViewModel/GrantFiefItemVM.cs similarity index 92% rename from src/ViewModel/GrantFiefItemVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/GrantFiefItemVM.cs index 875341dc..7040ecd3 100644 --- a/src/ViewModel/GrantFiefItemVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/GrantFiefItemVM.cs @@ -1,7 +1,11 @@ using Diplomacy.GrantFief; -using System; + using JetBrains.Annotations; + +using System; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.Library; namespace Diplomacy.ViewModel @@ -21,12 +25,12 @@ public GrantFiefItemVM(Settlement settlement, Hero targetHero, Action(); if (component2 is not null) { - Prosperity = (int)Math.Round(component2.Prosperity); + Prosperity = (int) Math.Round(component2.Prosperity); IconPath = component2.BackgroundMeshName; } else if (settlement.IsCastle) { - Prosperity = (int)Math.Round(settlement.Prosperity); + Prosperity = (int) Math.Round(settlement.Prosperity); IconPath = ""; } Garrison = Settlement.Town.GarrisonParty?.Party.NumberOfAllMembers ?? 0; @@ -78,4 +82,4 @@ public bool IsSelected [DataSourceProperty] public string RelationBonus { get; } } -} +} \ No newline at end of file diff --git a/src/ViewModel/GrantFiefSortControllerVM.cs b/src/Bannerlord.Diplomacy/ViewModel/GrantFiefSortControllerVM.cs similarity index 98% rename from src/ViewModel/GrantFiefSortControllerVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/GrantFiefSortControllerVM.cs index c8384768..2d24e0ad 100644 --- a/src/ViewModel/GrantFiefSortControllerVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/GrantFiefSortControllerVM.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; + using TaleWorlds.Library; namespace Diplomacy.ViewModel @@ -89,11 +90,11 @@ private void ExecuteSortByDefenders() private void SetAllStates(SortState state) { - TypeState = (int)state; - NameState = (int)state; - ProsperityState = (int)state; - DefendersState = (int)state; - RelationState = (int)state; + TypeState = (int) state; + NameState = (int) state; + ProsperityState = (int) state; + DefendersState = (int) state; + RelationState = (int) state; IsTypeSelected = false; IsNameSelected = false; IsProsperitySelected = false; @@ -390,4 +391,4 @@ public override int Compare(GrantFiefItemVM x, GrantFiefItemVM y) } } } -} +} \ No newline at end of file diff --git a/src/ViewModel/GrantFiefVM.cs b/src/Bannerlord.Diplomacy/ViewModel/GrantFiefVM.cs similarity index 98% rename from src/ViewModel/GrantFiefVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/GrantFiefVM.cs index cf16bee8..a2198f6f 100644 --- a/src/ViewModel/GrantFiefVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/GrantFiefVM.cs @@ -1,8 +1,11 @@ -using System; -using System.Linq; -using Diplomacy.Extensions; +using Diplomacy.Extensions; using Diplomacy.GrantFief; + using JetBrains.Annotations; + +using System; +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.Core; using TaleWorlds.Core.ViewModelCollection; diff --git a/src/ViewModel/RebelFactionItemVM.cs b/src/Bannerlord.Diplomacy/ViewModel/RebelFactionItemVM.cs similarity index 98% rename from src/ViewModel/RebelFactionItemVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/RebelFactionItemVM.cs index feb5cce1..9696dd3c 100644 --- a/src/ViewModel/RebelFactionItemVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/RebelFactionItemVM.cs @@ -1,8 +1,12 @@ -using System; -using Diplomacy.CivilWar.Actions; +using Diplomacy.CivilWar.Actions; using Diplomacy.CivilWar.Factions; + using JetBrains.Annotations; + +using System; + using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.GameState; using TaleWorlds.Core; using TaleWorlds.Library; using TaleWorlds.Localization; diff --git a/src/ViewModel/RebelFactionParticipantVM.cs b/src/Bannerlord.Diplomacy/ViewModel/RebelFactionParticipantVM.cs similarity index 97% rename from src/ViewModel/RebelFactionParticipantVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/RebelFactionParticipantVM.cs index 5b9857dd..1695c343 100644 --- a/src/ViewModel/RebelFactionParticipantVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/RebelFactionParticipantVM.cs @@ -1,8 +1,11 @@ -using System; -using System.Collections.Generic; -using Diplomacy.CivilWar.Factions; +using Diplomacy.CivilWar.Factions; using Diplomacy.CivilWar.Scoring; + using JetBrains.Annotations; + +using System; +using System.Collections.Generic; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.ViewModelCollection.Encyclopedia.EncyclopediaItems; using TaleWorlds.Core; diff --git a/src/ViewModel/RebelFactionsVM.cs b/src/Bannerlord.Diplomacy/ViewModel/RebelFactionsVM.cs similarity index 99% rename from src/ViewModel/RebelFactionsVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/RebelFactionsVM.cs index 711ea359..6f86a442 100644 --- a/src/ViewModel/RebelFactionsVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/RebelFactionsVM.cs @@ -1,11 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Diplomacy.CivilWar; +using Diplomacy.CivilWar; using Diplomacy.CivilWar.Actions; using Diplomacy.CivilWar.Factions; using Diplomacy.Extensions; + using JetBrains.Annotations; + +using System; +using System.Collections.Generic; +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.ViewModelCollection.Encyclopedia.EncyclopediaItems; using TaleWorlds.Core; diff --git a/src/ViewModel/WarExhaustionBreakdownVM.cs b/src/Bannerlord.Diplomacy/ViewModel/WarExhaustionBreakdownVM.cs similarity index 99% rename from src/ViewModel/WarExhaustionBreakdownVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/WarExhaustionBreakdownVM.cs index 7a221169..c590c101 100644 --- a/src/ViewModel/WarExhaustionBreakdownVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/WarExhaustionBreakdownVM.cs @@ -1,5 +1,6 @@ using TaleWorlds.Library; using TaleWorlds.Localization; + using static Diplomacy.WarExhaustionManager; namespace Diplomacy.ViewModel diff --git a/src/ViewModel/WarExhaustionMapIndicatorItemVM.cs b/src/Bannerlord.Diplomacy/ViewModel/WarExhaustionMapIndicatorItemVM.cs similarity index 98% rename from src/ViewModel/WarExhaustionMapIndicatorItemVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/WarExhaustionMapIndicatorItemVM.cs index f61f8f69..ceea5dc0 100644 --- a/src/ViewModel/WarExhaustionMapIndicatorItemVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/WarExhaustionMapIndicatorItemVM.cs @@ -1,9 +1,11 @@ using Diplomacy.GauntletInterfaces; + using JetBrains.Annotations; + using TaleWorlds.CampaignSystem; using TaleWorlds.Core; -using TaleWorlds.Engine.Screens; using TaleWorlds.Library; +using TaleWorlds.ScreenSystem; namespace Diplomacy.ViewModel { @@ -55,7 +57,7 @@ public ImageIdentifierVM Faction1Visual public ImageIdentifierVM Faction2Visual { get => _faction2Visual; - set { _faction2Visual = value; OnPropertyChanged(nameof(Faction2Visual));} + set { _faction2Visual = value; OnPropertyChanged(nameof(Faction2Visual)); } } [DataSourceProperty] diff --git a/src/ViewModel/WarExhaustionMapIndicatorVM.cs b/src/Bannerlord.Diplomacy/ViewModel/WarExhaustionMapIndicatorVM.cs similarity index 95% rename from src/ViewModel/WarExhaustionMapIndicatorVM.cs rename to src/Bannerlord.Diplomacy/ViewModel/WarExhaustionMapIndicatorVM.cs index f43b771c..19a4a9a7 100644 --- a/src/ViewModel/WarExhaustionMapIndicatorVM.cs +++ b/src/Bannerlord.Diplomacy/ViewModel/WarExhaustionMapIndicatorVM.cs @@ -1,4 +1,5 @@ using Diplomacy.Event; + using TaleWorlds.CampaignSystem; using TaleWorlds.Library; @@ -29,9 +30,6 @@ public WarExhaustionMapIndicatorVM() CampaignEvents.WarDeclared.AddNonSerializedListener(this, HandleStanceChange); CampaignEvents.MakePeace.AddNonSerializedListener(this, HandleStanceChange); CampaignEvents.ClanChangedKingdom.AddNonSerializedListener(this, (x, _, _, _, _) => HandleClanChangedKingdom(x)); -#if e159 || e1510 - CampaignEvents.MercenaryClanChangedKingdom.AddNonSerializedListener(this, (x, y, z) => HandleClanChangedKingdom(x)); -#endif Events.WarExhaustionAdded.AddNonSerializedListener(this, HandleWarExhaustionChange); } diff --git a/src/ViewModelMixin/DiplomacyPanelPrefabExtension.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/DiplomacyPanelPrefabExtension.cs similarity index 99% rename from src/ViewModelMixin/DiplomacyPanelPrefabExtension.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/DiplomacyPanelPrefabExtension.cs index 34762cdf..964f53d7 100644 --- a/src/ViewModelMixin/DiplomacyPanelPrefabExtension.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/DiplomacyPanelPrefabExtension.cs @@ -1,12 +1,11 @@ using Bannerlord.BUTR.Shared.Helpers; - using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.Prefabs2; -using System.Xml; - using JetBrains.Annotations; +using System.Xml; + namespace Diplomacy.ViewModelMixin { [PrefabExtension("DiplomacyPanel", "descendant::Widget[@IsVisible='@Show']")] @@ -40,4 +39,4 @@ public DiplomacyPanelPrefabExtension() public XmlDocument GetPrefabExtension() => _document; } -} +} \ No newline at end of file diff --git a/src/ViewModelMixin/EncyclopediaFactionPagePrefabExtension.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/EncyclopediaFactionPagePrefabExtension.cs similarity index 99% rename from src/ViewModelMixin/EncyclopediaFactionPagePrefabExtension.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/EncyclopediaFactionPagePrefabExtension.cs index e8ddf695..7e045044 100644 --- a/src/ViewModelMixin/EncyclopediaFactionPagePrefabExtension.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/EncyclopediaFactionPagePrefabExtension.cs @@ -1,8 +1,10 @@ using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.Prefabs2; -using System.Xml; + using JetBrains.Annotations; +using System.Xml; + namespace Diplomacy.ViewModelMixin { [PrefabExtension("EncyclopediaFactionPage", "descendant::GridWidget[@Id='EnemiesGrid']")] @@ -42,4 +44,4 @@ public FactionsButtonExtension() [UsedImplicitly] public XmlDocument GetPrefabExtension() => _document; } -} +} \ No newline at end of file diff --git a/src/ViewModelMixin/EncyclopediaHeroPagePrefabExtension.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/EncyclopediaHeroPagePrefabExtension.cs similarity index 99% rename from src/ViewModelMixin/EncyclopediaHeroPagePrefabExtension.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/EncyclopediaHeroPagePrefabExtension.cs index 2cb232cf..9f749392 100644 --- a/src/ViewModelMixin/EncyclopediaHeroPagePrefabExtension.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/EncyclopediaHeroPagePrefabExtension.cs @@ -1,8 +1,10 @@ using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.Prefabs2; -using System.Xml; + using JetBrains.Annotations; +using System.Xml; + namespace Diplomacy.ViewModelMixin { [PrefabExtension("EncyclopediaHeroPage", "descendant::RichTextWidget[@Text='@InformationText']")] @@ -23,4 +25,4 @@ public EncyclopediaHeroPagePrefabExtension() [UsedImplicitly] public XmlDocument GetPrefabExtension() => _document; } -} +} \ No newline at end of file diff --git a/src/ViewModelMixin/KingdomClanVMMixin.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomClanVMMixin.cs similarity index 98% rename from src/ViewModelMixin/KingdomClanVMMixin.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/KingdomClanVMMixin.cs index aaadc5b6..1ff1abfe 100644 --- a/src/ViewModelMixin/KingdomClanVMMixin.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomClanVMMixin.cs @@ -1,15 +1,18 @@ using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.ViewModels; + using Diplomacy.Event; using Diplomacy.GauntletInterfaces; using Diplomacy.GrantFief; + using JetBrains.Annotations; -using TaleWorlds.CampaignSystem; + +using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.CampaignSystem.ViewModelCollection.KingdomManagement.KingdomClan; using TaleWorlds.Core.ViewModelCollection; -using TaleWorlds.Engine.Screens; using TaleWorlds.Library; using TaleWorlds.Localization; +using TaleWorlds.ScreenSystem; namespace Diplomacy.ViewModelMixin { @@ -117,4 +120,4 @@ public HintViewModel GrantFiefHint [DataSourceProperty] public string DonateGoldExplanationText { get; } } -} +} \ No newline at end of file diff --git a/src/ViewModelMixin/KingdomDiplomacyVMMixin.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomDiplomacyVMMixin.cs similarity index 96% rename from src/ViewModelMixin/KingdomDiplomacyVMMixin.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/KingdomDiplomacyVMMixin.cs index 73dfad36..bf71d32a 100644 --- a/src/ViewModelMixin/KingdomDiplomacyVMMixin.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomDiplomacyVMMixin.cs @@ -1,13 +1,18 @@ -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Bannerlord.UIExtenderEx.Attributes; +using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.ViewModels; + using Diplomacy.DiplomaticAction.Alliance; using Diplomacy.Event; using Diplomacy.Extensions; + using HarmonyLib; + using JetBrains.Annotations; + +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.ViewModelCollection.KingdomManagement.KingdomDiplomacy; using TaleWorlds.Core; @@ -131,9 +136,7 @@ private void OnPropertyChangedWithValue(object sender, PropertyChangedWithValueE { if (e.PropertyName == nameof(ViewModel.CurrentSelectedDiplomacyItem)) { -#if !(e159 || e1510) OnDiplomacyItemSelection(ViewModel!.CurrentSelectedDiplomacyItem); -#endif } } @@ -141,11 +144,7 @@ public override void OnFinalize() { Events.RemoveListeners(this); ViewModel!.PropertyChangedWithValue -= _eventHandler; -#if e159 || e1510 - CampaignEvents.RemoveListeners(this); -#else CampaignEventDispatcher.Instance.RemoveListeners(this); -#endif } [DataSourceMethod] @@ -163,20 +162,16 @@ public void ExecuteShowOverview() ShowStats = false; } -#if !(e159 || e1510) public void ExecuteShowStatComparison() { ViewModel!.IsDisplayingStatComparisons = true; ViewModel!.IsDisplayingWarLogs = false; } -#endif private void OnDiplomacyItemSelection(KingdomDiplomacyItemVM item) { - OnDiplomacyItemSelectionMethod.Invoke(ViewModel, new object[] {item}); -#if !(e159 || e1510) + OnDiplomacyItemSelectionMethod.Invoke(ViewModel, new object[] { item }); ExecuteShowStatComparison(); -#endif } public override void OnRefresh() diff --git a/src/ViewModelMixin/KingdomManagementPrefabExtension.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomManagementPrefabExtension.cs similarity index 99% rename from src/ViewModelMixin/KingdomManagementPrefabExtension.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/KingdomManagementPrefabExtension.cs index 236774cd..8c75f52b 100644 --- a/src/ViewModelMixin/KingdomManagementPrefabExtension.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomManagementPrefabExtension.cs @@ -1,8 +1,10 @@ using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.Prefabs2; + +using JetBrains.Annotations; + using System.Collections.Generic; using System.Xml; -using JetBrains.Annotations; namespace Diplomacy.ViewModelMixin { @@ -40,4 +42,4 @@ internal sealed class KingdomManagementScalingPatch : PrefabExtensionSetAttribut new Attribute("MultiplyResult", "0.60") }; } -} +} \ No newline at end of file diff --git a/src/ViewModelMixin/KingdomManagementVMMixin.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomManagementVMMixin.cs similarity index 94% rename from src/ViewModelMixin/KingdomManagementVMMixin.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/KingdomManagementVMMixin.cs index b42827b7..bbc5e819 100644 --- a/src/ViewModelMixin/KingdomManagementVMMixin.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomManagementVMMixin.cs @@ -1,11 +1,14 @@ using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.ViewModels; + using Diplomacy.GauntletInterfaces; + using JetBrains.Annotations; + using TaleWorlds.CampaignSystem.ViewModelCollection; -using TaleWorlds.Engine.Screens; using TaleWorlds.Library; using TaleWorlds.Localization; +using TaleWorlds.ScreenSystem; namespace Diplomacy.ViewModelMixin { @@ -21,12 +24,10 @@ public KingdomManagementVMMixin(KingdomManagementVM vm) : base(vm) FactionsLabel = new TextObject("{=gypPPxUJ}Factions").ToString(); } -#if !(e159 || e1510) public override void OnFinalize() { ViewModel!.Diplomacy.OnFinalize(); } -#endif [DataSourceMethod] [UsedImplicitly] @@ -35,4 +36,4 @@ public void ExecuteShowFactions() new RebelFactionsInterface().ShowInterface(ScreenManager.TopScreen, ViewModel!.Kingdom); } } -} +} \ No newline at end of file diff --git a/src/ViewModelMixin/KingdomTruceItemVmMixin.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomTruceItemVmMixin.cs similarity index 98% rename from src/ViewModelMixin/KingdomTruceItemVmMixin.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/KingdomTruceItemVmMixin.cs index 1b550ad6..76e08d03 100644 --- a/src/ViewModelMixin/KingdomTruceItemVmMixin.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomTruceItemVmMixin.cs @@ -1,13 +1,17 @@ -using System.Collections.Generic; -using System.Linq; -using Bannerlord.UIExtenderEx.Attributes; +using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.ViewModels; + using Diplomacy.Costs; using Diplomacy.DiplomaticAction.Alliance; using Diplomacy.DiplomaticAction.NonAggressionPact; using Diplomacy.DiplomaticAction.WarPeace; using Diplomacy.ViewModel; + using JetBrains.Annotations; + +using System.Collections.Generic; +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.Actions; using TaleWorlds.CampaignSystem.ViewModelCollection.KingdomManagement.KingdomDiplomacy; @@ -247,7 +251,7 @@ public BasicTooltipViewModel? NonAggressionPactScoreHint [DataSourceProperty] public string AllianceActionName { get; } - [DataSourceProperty] [UsedImplicitly] public bool IsGoldCostVisible { get; } + [DataSourceProperty][UsedImplicitly] public bool IsGoldCostVisible { get; } [DataSourceProperty] public string NonAggressionPactHelpText { get; } diff --git a/src/ViewModelMixin/KingdomWarItemVMMixin.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomWarItemVMMixin.cs similarity index 96% rename from src/ViewModelMixin/KingdomWarItemVMMixin.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/KingdomWarItemVMMixin.cs index 0809dc87..a9821c10 100644 --- a/src/ViewModelMixin/KingdomWarItemVMMixin.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/KingdomWarItemVMMixin.cs @@ -1,10 +1,14 @@ -using System.Linq; -using Bannerlord.UIExtenderEx.Attributes; +using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.ViewModels; + using Diplomacy.Costs; using Diplomacy.DiplomaticAction.WarPeace; using Diplomacy.ViewModel; + using JetBrains.Annotations; + +using System.Linq; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.ViewModelCollection.KingdomManagement.KingdomDiplomacy; using TaleWorlds.Core; @@ -56,7 +60,7 @@ public int GoldCost } } - [DataSourceProperty] [UsedImplicitly] public bool IsGoldCostVisible { get; } = true; + [DataSourceProperty][UsedImplicitly] public bool IsGoldCostVisible { get; } = true; [DataSourceProperty] public bool IsOptionAvailable diff --git a/src/ViewModelMixin/MapNavigationVMMixin.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/MapNavigationVMMixin.cs similarity index 99% rename from src/ViewModelMixin/MapNavigationVMMixin.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/MapNavigationVMMixin.cs index 54d45242..71a4bc10 100644 --- a/src/ViewModelMixin/MapNavigationVMMixin.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/MapNavigationVMMixin.cs @@ -1,7 +1,10 @@ using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.ViewModels; + using Diplomacy.Extensions; + using JetBrains.Annotations; + using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.ViewModelCollection.Map; using TaleWorlds.Localization; @@ -25,4 +28,4 @@ public override void OnRefresh() } } } -} +} \ No newline at end of file diff --git a/src/ViewModelMixin/PartyNameplateVMMixin.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/PartyNameplateVMMixin.cs similarity index 99% rename from src/ViewModelMixin/PartyNameplateVMMixin.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/PartyNameplateVMMixin.cs index 75d90cbf..9a66f40e 100644 --- a/src/ViewModelMixin/PartyNameplateVMMixin.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/PartyNameplateVMMixin.cs @@ -1,8 +1,12 @@ using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.ViewModels; + using Diplomacy.Event; + using JetBrains.Annotations; + using SandBox.ViewModelCollection.Nameplate; + using TaleWorlds.CampaignSystem; namespace Diplomacy.ViewModelMixin @@ -26,4 +30,4 @@ public override void OnFinalize() Events.RemoveListeners(this); } } -} +} \ No newline at end of file diff --git a/src/ViewModelMixin/SettlementNameplatesVMMixin.cs b/src/Bannerlord.Diplomacy/ViewModelMixin/SettlementNameplatesVMMixin.cs similarity index 99% rename from src/ViewModelMixin/SettlementNameplatesVMMixin.cs rename to src/Bannerlord.Diplomacy/ViewModelMixin/SettlementNameplatesVMMixin.cs index a4dc2759..f77c49af 100644 --- a/src/ViewModelMixin/SettlementNameplatesVMMixin.cs +++ b/src/Bannerlord.Diplomacy/ViewModelMixin/SettlementNameplatesVMMixin.cs @@ -1,8 +1,12 @@ using Bannerlord.UIExtenderEx.Attributes; using Bannerlord.UIExtenderEx.ViewModels; + using Diplomacy.Event; + using JetBrains.Annotations; + using SandBox.ViewModelCollection.Nameplate; + using TaleWorlds.CampaignSystem; namespace Diplomacy.ViewModelMixin @@ -26,4 +30,4 @@ public override void OnFinalize() Events.RemoveListeners(this); } } -} +} \ No newline at end of file diff --git a/src/Views/GauntletWarExhaustionIndicator.cs b/src/Bannerlord.Diplomacy/Views/GauntletWarExhaustionIndicator.cs similarity index 99% rename from src/Views/GauntletWarExhaustionIndicator.cs rename to src/Bannerlord.Diplomacy/Views/GauntletWarExhaustionIndicator.cs index 9d722355..0516a493 100644 --- a/src/Views/GauntletWarExhaustionIndicator.cs +++ b/src/Bannerlord.Diplomacy/Views/GauntletWarExhaustionIndicator.cs @@ -1,6 +1,9 @@ using Diplomacy.ViewModel; + using JetBrains.Annotations; + using SandBox.View.Map; + using TaleWorlds.Engine.GauntletUI; using TaleWorlds.Library; using TaleWorlds.MountAndBlade; diff --git a/src/Views/WarExhaustionIndicatorView.cs b/src/Bannerlord.Diplomacy/Views/WarExhaustionIndicatorView.cs similarity index 98% rename from src/Views/WarExhaustionIndicatorView.cs rename to src/Bannerlord.Diplomacy/Views/WarExhaustionIndicatorView.cs index 2f6ed5c7..8c5dc5e5 100644 --- a/src/Views/WarExhaustionIndicatorView.cs +++ b/src/Bannerlord.Diplomacy/Views/WarExhaustionIndicatorView.cs @@ -5,4 +5,4 @@ namespace Diplomacy.Views public class MapWarExhaustionIndicatorView : MapView { } -} +} \ No newline at end of file diff --git a/src/WarExhaustionManager.cs b/src/Bannerlord.Diplomacy/WarExhaustionManager.cs similarity index 99% rename from src/WarExhaustionManager.cs rename to src/Bannerlord.Diplomacy/WarExhaustionManager.cs index 74c190ea..d33be526 100644 --- a/src/WarExhaustionManager.cs +++ b/src/Bannerlord.Diplomacy/WarExhaustionManager.cs @@ -1,6 +1,8 @@ using Diplomacy.Event; + using System; using System.Collections.Generic; + using TaleWorlds.CampaignSystem; using TaleWorlds.Core; using TaleWorlds.Library; diff --git a/Bannerlord.Diplomacy.ImplementationLoader/Widgets/CriticalThresholdTextWidget.cs b/src/Bannerlord.Diplomacy/Widgets/CriticalThresholdTextWidget.cs similarity index 99% rename from Bannerlord.Diplomacy.ImplementationLoader/Widgets/CriticalThresholdTextWidget.cs rename to src/Bannerlord.Diplomacy/Widgets/CriticalThresholdTextWidget.cs index db31d4d3..feac9dfc 100644 --- a/Bannerlord.Diplomacy.ImplementationLoader/Widgets/CriticalThresholdTextWidget.cs +++ b/src/Bannerlord.Diplomacy/Widgets/CriticalThresholdTextWidget.cs @@ -1,4 +1,5 @@ using JetBrains.Annotations; + using TaleWorlds.GauntletUI; namespace Diplomacy.Widgets @@ -33,4 +34,4 @@ public bool IsCritical } } } -} +} \ No newline at end of file diff --git a/Bannerlord.Diplomacy.ImplementationLoader/Widgets/HoveredBrushWidget.cs b/src/Bannerlord.Diplomacy/Widgets/HoveredBrushWidget.cs similarity index 99% rename from Bannerlord.Diplomacy.ImplementationLoader/Widgets/HoveredBrushWidget.cs rename to src/Bannerlord.Diplomacy/Widgets/HoveredBrushWidget.cs index b4f52559..21507d9b 100644 --- a/Bannerlord.Diplomacy.ImplementationLoader/Widgets/HoveredBrushWidget.cs +++ b/src/Bannerlord.Diplomacy/Widgets/HoveredBrushWidget.cs @@ -1,4 +1,5 @@ using JetBrains.Annotations; + using TaleWorlds.GauntletUI; namespace Diplomacy.Widgets diff --git a/Bannerlord.Diplomacy.ImplementationLoader/Widgets/KingdomDiplomacyPanelTabControlWidget.cs b/src/Bannerlord.Diplomacy/Widgets/KingdomDiplomacyPanelTabControlWidget.cs similarity index 99% rename from Bannerlord.Diplomacy.ImplementationLoader/Widgets/KingdomDiplomacyPanelTabControlWidget.cs rename to src/Bannerlord.Diplomacy/Widgets/KingdomDiplomacyPanelTabControlWidget.cs index b673fdd0..010b098f 100644 --- a/Bannerlord.Diplomacy.ImplementationLoader/Widgets/KingdomDiplomacyPanelTabControlWidget.cs +++ b/src/Bannerlord.Diplomacy/Widgets/KingdomDiplomacyPanelTabControlWidget.cs @@ -1,4 +1,5 @@ using JetBrains.Annotations; + using TaleWorlds.GauntletUI; namespace Diplomacy.Widgets @@ -78,4 +79,4 @@ public Widget StatsPanel } } } -} +} \ No newline at end of file diff --git a/src/_Module/GUI/Brushes/Diplomacy.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Brushes/Diplomacy.xml similarity index 100% rename from src/_Module/GUI/Brushes/Diplomacy.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Brushes/Diplomacy.xml diff --git a/src/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/EncyclopediaFactionPageInject.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/EncyclopediaFactionPageInject.xml similarity index 100% rename from src/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/EncyclopediaFactionPageInject.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/EncyclopediaFactionPageInject.xml diff --git a/src/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/EncyclopediaHeroPageInject.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/EncyclopediaHeroPageInject.xml similarity index 100% rename from src/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/EncyclopediaHeroPageInject.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/EncyclopediaHeroPageInject.xml diff --git a/src/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/FactionButtonInject.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/FactionButtonInject.xml similarity index 100% rename from src/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/FactionButtonInject.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Encyclopedia/EncyclopediaSubPages/FactionButtonInject.xml diff --git a/src/_Module/GUI/Prefabs/GrantFief/GrantFief.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/GrantFief/GrantFief.xml similarity index 100% rename from src/_Module/GUI/Prefabs/GrantFief/GrantFief.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/GrantFief/GrantFief.xml diff --git a/src/_Module/GUI/Prefabs/GrantFief/GrantFiefTuple.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/GrantFief/GrantFiefTuple.xml similarity index 100% rename from src/_Module/GUI/Prefabs/GrantFief/GrantFiefTuple.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/GrantFief/GrantFiefTuple.xml diff --git a/src/_Module/GUI/Prefabs/KingdomManagement/Clan/ClansPanel.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Clan/ClansPanel.xml similarity index 100% rename from src/_Module/GUI/Prefabs/KingdomManagement/Clan/ClansPanel.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Clan/ClansPanel.xml diff --git a/src/_Module/GUI/Prefabs/KingdomManagement/Clan/DonateGold.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Clan/DonateGold.xml similarity index 100% rename from src/_Module/GUI/Prefabs/KingdomManagement/Clan/DonateGold.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Clan/DonateGold.xml diff --git a/src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanelButtons.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanelButtons.xml similarity index 100% rename from src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanelButtons.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanelButtons.xml diff --git a/src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanel_1510.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanel_1510.xml similarity index 100% rename from src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanel_1510.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanel_1510.xml diff --git a/src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanel_159.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanel_159.xml similarity index 100% rename from src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanel_159.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/DiplomacyPanel_159.xml diff --git a/src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/OverviewTab.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/OverviewTab.xml similarity index 100% rename from src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/OverviewTab.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/OverviewTab.xml diff --git a/src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/Relationship.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/Relationship.xml similarity index 100% rename from src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/Relationship.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/Relationship.xml diff --git a/src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/StatsTab.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/StatsTab.xml similarity index 100% rename from src/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/StatsTab.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/KingdomManagement/Diplomacy/StatsTab.xml diff --git a/src/_Module/GUI/Prefabs/RebelFactions/RebelFactionDivider.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/RebelFactions/RebelFactionDivider.xml similarity index 100% rename from src/_Module/GUI/Prefabs/RebelFactions/RebelFactionDivider.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/RebelFactions/RebelFactionDivider.xml diff --git a/src/_Module/GUI/Prefabs/RebelFactions/RebelFactionParticipant.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/RebelFactions/RebelFactionParticipant.xml similarity index 100% rename from src/_Module/GUI/Prefabs/RebelFactions/RebelFactionParticipant.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/RebelFactions/RebelFactionParticipant.xml diff --git a/src/_Module/GUI/Prefabs/RebelFactions/RebelFactions.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/RebelFactions/RebelFactions.xml similarity index 100% rename from src/_Module/GUI/Prefabs/RebelFactions/RebelFactions.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/RebelFactions/RebelFactions.xml diff --git a/src/_Module/GUI/Prefabs/RebelFactions/RebelFactionsItem.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/RebelFactions/RebelFactionsItem.xml similarity index 100% rename from src/_Module/GUI/Prefabs/RebelFactions/RebelFactionsItem.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/RebelFactions/RebelFactionsItem.xml diff --git a/src/_Module/GUI/Prefabs/Standard/BasicDiplomacyButton.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Standard/BasicDiplomacyButton.xml similarity index 100% rename from src/_Module/GUI/Prefabs/Standard/BasicDiplomacyButton.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Standard/BasicDiplomacyButton.xml diff --git a/src/_Module/GUI/Prefabs/Standard/StaticDiplomacyButton.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Standard/StaticDiplomacyButton.xml similarity index 100% rename from src/_Module/GUI/Prefabs/Standard/StaticDiplomacyButton.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/Standard/StaticDiplomacyButton.xml diff --git a/src/_Module/GUI/Prefabs/WarExhaustion/DetailWarView.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/WarExhaustion/DetailWarView.xml similarity index 100% rename from src/_Module/GUI/Prefabs/WarExhaustion/DetailWarView.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/WarExhaustion/DetailWarView.xml diff --git a/src/_Module/GUI/Prefabs/WarExhaustion/WarExhaustionMapIndicator.xml b/src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/WarExhaustion/WarExhaustionMapIndicator.xml similarity index 100% rename from src/_Module/GUI/Prefabs/WarExhaustion/WarExhaustionMapIndicator.xml rename to src/Bannerlord.Diplomacy/_Module/GUI/Prefabs/WarExhaustion/WarExhaustionMapIndicator.xml diff --git a/src/_Module/ModuleData/civil_war_strings_xml.xml b/src/Bannerlord.Diplomacy/_Module/ModuleData/civil_war_strings_xml.xml similarity index 100% rename from src/_Module/ModuleData/civil_war_strings_xml.xml rename to src/Bannerlord.Diplomacy/_Module/ModuleData/civil_war_strings_xml.xml diff --git a/src/_Module/ModuleData/faction_names_xml.xml b/src/Bannerlord.Diplomacy/_Module/ModuleData/faction_names_xml.xml similarity index 100% rename from src/_Module/ModuleData/faction_names_xml.xml rename to src/Bannerlord.Diplomacy/_Module/ModuleData/faction_names_xml.xml diff --git a/src/_Module/ModuleData/gt_common.xml b/src/Bannerlord.Diplomacy/_Module/ModuleData/gt_common.xml similarity index 100% rename from src/_Module/ModuleData/gt_common.xml rename to src/Bannerlord.Diplomacy/_Module/ModuleData/gt_common.xml diff --git a/src/_Module/ModuleData/gt_help.xml b/src/Bannerlord.Diplomacy/_Module/ModuleData/gt_help.xml similarity index 100% rename from src/_Module/ModuleData/gt_help.xml rename to src/Bannerlord.Diplomacy/_Module/ModuleData/gt_help.xml diff --git a/src/_Module/ModuleData/help_strings_xml.xml b/src/Bannerlord.Diplomacy/_Module/ModuleData/help_strings_xml.xml similarity index 100% rename from src/_Module/ModuleData/help_strings_xml.xml rename to src/Bannerlord.Diplomacy/_Module/ModuleData/help_strings_xml.xml diff --git a/src/_Module/ModuleData/std_module_strings_xml.xml b/src/Bannerlord.Diplomacy/_Module/ModuleData/std_module_strings_xml.xml similarity index 100% rename from src/_Module/ModuleData/std_module_strings_xml.xml rename to src/Bannerlord.Diplomacy/_Module/ModuleData/std_module_strings_xml.xml diff --git a/Bannerlord.Diplomacy.ImplementationLoader/_Module/SubModule.xml b/src/Bannerlord.Diplomacy/_Module/SubModule.xml similarity index 80% rename from Bannerlord.Diplomacy.ImplementationLoader/_Module/SubModule.xml rename to src/Bannerlord.Diplomacy/_Module/SubModule.xml index a9f100c7..1f30668e 100644 --- a/Bannerlord.Diplomacy.ImplementationLoader/_Module/SubModule.xml +++ b/src/Bannerlord.Diplomacy/_Module/SubModule.xml @@ -7,6 +7,7 @@ + @@ -29,11 +30,14 @@ + - - - - + + + + + + diff --git a/src/Diplomacy.sln b/src/Diplomacy.sln deleted file mode 100644 index e9a4ecc7..00000000 --- a/src/Diplomacy.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30907.101 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Diplomacy", "Diplomacy.csproj", "{23764F91-DA63-4FDF-BF3E-1434878066E6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Beta_Debug|x64 = Beta_Debug|x64 - Beta_Release|x64 = Beta_Release|x64 - Stable_Debug|x64 = Stable_Debug|x64 - Stable_Release|x64 = Stable_Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {23764F91-DA63-4FDF-BF3E-1434878066E6}.Beta_Debug|x64.ActiveCfg = Beta_Debug|x64 - {23764F91-DA63-4FDF-BF3E-1434878066E6}.Beta_Debug|x64.Build.0 = Beta_Debug|x64 - {23764F91-DA63-4FDF-BF3E-1434878066E6}.Beta_Release|x64.ActiveCfg = Beta_Release|x64 - {23764F91-DA63-4FDF-BF3E-1434878066E6}.Beta_Release|x64.Build.0 = Beta_Release|x64 - {23764F91-DA63-4FDF-BF3E-1434878066E6}.Stable_Debug|x64.ActiveCfg = Stable_Debug|x64 - {23764F91-DA63-4FDF-BF3E-1434878066E6}.Stable_Debug|x64.Build.0 = Stable_Debug|x64 - {23764F91-DA63-4FDF-BF3E-1434878066E6}.Stable_Release|x64.ActiveCfg = Stable_Release|x64 - {23764F91-DA63-4FDF-BF3E-1434878066E6}.Stable_Release|x64.Build.0 = Stable_Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {2BE25DC4-AE62-4753-BD96-C6DC6D35537F} - EndGlobalSection -EndGlobal diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ba3f4c92..d90cfc00 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,6 +1,7 @@ - - - - - \ No newline at end of file + + + + + + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets new file mode 100644 index 00000000..1ff7af51 --- /dev/null +++ b/src/Directory.Build.targets @@ -0,0 +1,3 @@ + + + diff --git a/src/PatchTools/Priority.cs b/src/PatchTools/Priority.cs deleted file mode 100644 index 8fe18353..00000000 --- a/src/PatchTools/Priority.cs +++ /dev/null @@ -1,43 +0,0 @@ -namespace Diplomacy.PatchTools -{ - /// A patch priority - /// - public static class Priority - { - /// Patch last (the lowest priority) - /// - public const int Last = 0; - - /// Patch with very low priority - /// - public const int VeryLow = 100; - - /// Patch with low priority - /// - public const int Low = 200; - - /// Patch with lower than normal priority - /// - public const int LowerThanNormal = 300; - - /// Patch with normal priority - /// - public const int Normal = 400; - - /// Patch with higher than normal priority - /// - public const int HigherThanNormal = 500; - - /// Patch with high priority - /// - public const int High = 600; - - /// Patch with very high priority - /// - public const int VeryHigh = 700; - - /// Patch first (the highest priority) - /// - public const int First = 800; - } -} diff --git a/supported-game-versions.txt b/supported-game-versions.txt index 1a719c22..02a9ef57 100644 --- a/supported-game-versions.txt +++ b/supported-game-versions.txt @@ -1,9 +1 @@ -e1.7.0 -e1.6.5 -e1.6.4 -e1.6.3 -e1.6.2 -e1.6.1 -e1.6.0 -e1.5.10 -e1.5.9 \ No newline at end of file +e1.7.2 \ No newline at end of file