From 074fb60e5e147a46192ca8a983b33c3234041e67 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 6 Aug 2023 17:56:17 +0200
Subject: [PATCH 01/10] Bump Fronter.NET from `7901c61` to `37d6437` (#1458)
Bumps
[Fronter.NET](https://github.com/ParadoxGameConverters/Fronter.NET) from
`7901c61` to `37d6437`.
Commits
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
Fronter.NET | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Fronter.NET b/Fronter.NET
index 7901c61f1..37d6437f8 160000
--- a/Fronter.NET
+++ b/Fronter.NET
@@ -1 +1 @@
-Subproject commit 7901c61f17aa77eb727ad574a07944d7e81867c0
+Subproject commit 37d6437f8c9c4456bdcdc23b7fecd7e7eab5a4a4
From b7b80d05de97a95f66daf82d55994755d17ae595 Mon Sep 17 00:00:00 2001
From: IhateTrains
Date: Sun, 6 Aug 2023 18:05:18 +0200
Subject: [PATCH 02/10] Fix env variables being added to wrong step of dev
version build job (#1459)
---
.github/workflows/build_dev_version.yml | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/build_dev_version.yml b/.github/workflows/build_dev_version.yml
index f15cf7327..c110617a4 100644
--- a/.github/workflows/build_dev_version.yml
+++ b/.github/workflows/build_dev_version.yml
@@ -15,7 +15,6 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 0
-
upload_dev_build_artifact:
name: Upload development build
needs: remove_old_artifacts
@@ -44,10 +43,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
global-json-file: Fronter.NET/global.json
- env:
- BACKBLAZE_KEY_ID: ${{ secrets.BACKBLAZE_KEY_ID }}
- BACKBLAZE_APPLICATION_KEY: ${{ secrets.BACKBLAZE_APPLICATION_KEY }}
- BACKBLAZE_BUCKET_ID: ${{ secrets.BACKBLAZE_BUCKET_ID }}
- name: "Replace frontend background image"
run: |
rm Fronter.NET/Fronter.NET/Assets/Images/background.png
@@ -57,6 +52,10 @@ jobs:
with:
fronter_dir: 'Fronter.NET'
release_dir: 'Publish'
+ env:
+ BACKBLAZE_KEY_ID: ${{ secrets.BACKBLAZE_KEY_ID }}
+ BACKBLAZE_APPLICATION_KEY: ${{ secrets.BACKBLAZE_APPLICATION_KEY }}
+ BACKBLAZE_BUCKET_ID: ${{ secrets.BACKBLAZE_BUCKET_ID }}
- name: Setup Dotnet for use with actions
uses: actions/setup-dotnet@v3
with:
From e9d241fa2e5493cee8a7cb3543dc793b5d2c1aba Mon Sep 17 00:00:00 2001
From: IhateTrains
Date: Sun, 6 Aug 2023 19:21:02 +0200
Subject: [PATCH 03/10] Don't throw exceptions on CK3 regions referencing
missing duchies (#1460) #patch
This prevents exception caused by error in latest TFE mod version.
---
ImperatorToCK3/Mappers/Region/CK3Region.cs | 8 ++++----
ImperatorToCK3/Mappers/Region/CK3RegionMapper.cs | 2 +-
ImperatorToCK3/Mappers/Region/ImperatorRegion.cs | 2 +-
ImperatorToCK3/Mappers/Region/ImperatorRegionMapper.cs | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/ImperatorToCK3/Mappers/Region/CK3Region.cs b/ImperatorToCK3/Mappers/Region/CK3Region.cs
index 7797434bd..c5b108da5 100644
--- a/ImperatorToCK3/Mappers/Region/CK3Region.cs
+++ b/ImperatorToCK3/Mappers/Region/CK3Region.cs
@@ -5,7 +5,7 @@
namespace ImperatorToCK3.Mappers.Region;
-public class CK3Region {
+public sealed class CK3Region {
public string Name { get; }
private readonly HashSet parsedRegionIds = new();
public Dictionary Regions { get; } = new();
@@ -23,7 +23,7 @@ public void LinkRegions(Dictionary regions, Dictionary regions, Dictionary regions, Dictionary {
+public sealed class ImperatorRegion : IIdentifiable {
public IdObjectCollection Areas { get; } = new();
public string Id { get; }
public Color? Color { get; private set; }
diff --git a/ImperatorToCK3/Mappers/Region/ImperatorRegionMapper.cs b/ImperatorToCK3/Mappers/Region/ImperatorRegionMapper.cs
index e47a24226..43595367b 100644
--- a/ImperatorToCK3/Mappers/Region/ImperatorRegionMapper.cs
+++ b/ImperatorToCK3/Mappers/Region/ImperatorRegionMapper.cs
@@ -6,7 +6,7 @@
namespace ImperatorToCK3.Mappers.Region;
-public class ImperatorRegionMapper {
+public sealed class ImperatorRegionMapper {
public IdObjectCollection Regions { get; } = new();
private readonly AreaCollection areas;
From 1caa5215a6b1c9851bc339d9a27216e50fc96989 Mon Sep 17 00:00:00 2001
From: IhateTrains
Date: Sun, 6 Aug 2023 19:48:50 +0200
Subject: [PATCH 04/10] Update tests (#1463)
---
.../Mappers/Region/CK3RegionMapperTests.cs | 25 ++++++++++++-------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs b/ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs
index 69c980d2f..25d1f16e6 100644
--- a/ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs
+++ b/ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs
@@ -2,6 +2,7 @@
using commonItems.Mods;
using ImperatorToCK3.CK3.Titles;
using ImperatorToCK3.Mappers.Region;
+using System;
using System.Collections.Generic;
using System.IO;
using Xunit;
@@ -38,9 +39,11 @@ public void LoadingBrokenRegionWillThrowException() {
const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenRegionWillThrowException";
var ck3Root = Path.Combine(ck3Path, "game");
var ck3ModFS = new ModFilesystem(ck3Root, new List());
- void action() => mapper.LoadRegions(ck3ModFS, landedTitles);
- KeyNotFoundException exception = Assert.Throws(action);
- Assert.Equal("Region's test_region2 region test_region does not exist!", exception.Message);
+
+ var output = new StringWriter();
+ Console.SetOut(output);
+ mapper.LoadRegions(ck3ModFS, landedTitles);
+ Assert.Contains("Region's test_region2 region test_region does not exist!", output.ToString());
}
[Fact]
public void LoadingBrokenDuchyWillThrowException() {
@@ -53,9 +56,11 @@ public void LoadingBrokenDuchyWillThrowException() {
const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenDuchyWillThrowException";
var ck3Root = Path.Combine(ck3Path, "game");
var ck3ModFS = new ModFilesystem(ck3Root, new List());
- void action() => mapper.LoadRegions(ck3ModFS, landedTitles);
- KeyNotFoundException exception = Assert.Throws(action);
- Assert.Equal("Region's test_region duchy d_aquitane does not exist!", exception.Message);
+
+ var output = new StringWriter();
+ Console.SetOut(output);
+ mapper.LoadRegions(ck3ModFS, landedTitles);
+ Assert.Contains("Region's test_region duchy d_aquitane does not exist!", output.ToString());
}
[Fact]
public void LoadingBrokenCountyWillThrowException() {
@@ -68,9 +73,11 @@ public void LoadingBrokenCountyWillThrowException() {
const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenCountyWillThrowException";
var ck3Root = Path.Combine(ck3Path, "game");
var ck3ModFS = new ModFilesystem(ck3Root, new List());
- void Action() => mapper.LoadRegions(ck3ModFS, landedTitles);
- KeyNotFoundException exception = Assert.Throws(Action);
- Assert.Equal("Region's test_region county c_mers does not exist!", exception.Message);
+
+ var output = new StringWriter();
+ Console.SetOut(output);
+ mapper.LoadRegions(ck3ModFS, landedTitles);
+ Assert.Contains("Region's test_region county c_mers does not exist!", output.ToString());
}
[Fact]
From e72e3269f4c58643a5b2cd59c99317e9a3ee315a Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 6 Aug 2023 19:55:56 +0200
Subject: [PATCH 05/10] Bump Fronter.NET from `37d6437` to `0c2f645` (#1461)
Bumps
[Fronter.NET](https://github.com/ParadoxGameConverters/Fronter.NET) from
`37d6437` to `0c2f645`.
Commits
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: IhateTrains
---
Fronter.NET | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Fronter.NET b/Fronter.NET
index 37d6437f8..0c2f645f6 160000
--- a/Fronter.NET
+++ b/Fronter.NET
@@ -1 +1 @@
-Subproject commit 37d6437f8c9c4456bdcdc23b7fecd7e7eab5a4a4
+Subproject commit 0c2f645f6662afda080b4b2c9a48ccdd5d5f3e88
From fd1aa7ebf4a5529223cf808b4ca4cb02616eabc4 Mon Sep 17 00:00:00 2001
From: IhateTrains
Date: Sun, 6 Aug 2023 19:56:29 +0200
Subject: [PATCH 06/10] Use Meziantou.Analyzer to enforce good practices
(#1462)
---
.../CK3/Characters/CharacterCollectionTests.cs | 4 ++--
.../CK3/Titles/LandedTitlesTests.cs | 2 +-
.../Imperator/Diplomacy/DiplomacyTests.cs | 2 +-
ImperatorToCK3.UnitTests/Imperator/Jobs/JobsTests.cs | 6 +++---
.../Mappers/TagTitle/MappingTests.cs | 2 +-
ImperatorToCK3/CK3/Titles/LandedTitles.cs | 2 +-
ImperatorToCK3/CK3/World.cs | 2 +-
.../Diplomacy/{Diplomacy.cs => DiplomacyDB.cs} | 6 +++---
ImperatorToCK3/Imperator/Jobs/{Jobs.cs => JobsDB.cs} | 8 ++++----
ImperatorToCK3/Imperator/World.cs | 10 +++++-----
ImperatorToCK3/ImperatorToCK3.csproj | 5 ++++-
11 files changed, 26 insertions(+), 23 deletions(-)
rename ImperatorToCK3/Imperator/Diplomacy/{Diplomacy.cs => DiplomacyDB.cs} (92%)
rename ImperatorToCK3/Imperator/Jobs/{Jobs.cs => JobsDB.cs} (74%)
diff --git a/ImperatorToCK3.UnitTests/CK3/Characters/CharacterCollectionTests.cs b/ImperatorToCK3.UnitTests/CK3/Characters/CharacterCollectionTests.cs
index 02f381346..f4d46149a 100644
--- a/ImperatorToCK3.UnitTests/CK3/Characters/CharacterCollectionTests.cs
+++ b/ImperatorToCK3.UnitTests/CK3/Characters/CharacterCollectionTests.cs
@@ -263,8 +263,8 @@ public void ImperatorCountriesGoldCanBeDistributedAmongRulerAndVassals() {
);
var governorship1 = new Governorship(governorshipReader1, imperatorWorld.Countries, imperatorWorld.ImperatorRegionMapper);
var governorship2 = new Governorship(governorshipReader2, imperatorWorld.Countries, imperatorWorld.ImperatorRegionMapper);
- imperatorWorld.Jobs.Governorships.Add(governorship1);
- imperatorWorld.Jobs.Governorships.Add(governorship2);
+ imperatorWorld.JobsDB.Governorships.Add(governorship1);
+ imperatorWorld.JobsDB.Governorships.Add(governorship2);
var titles = new Title.LandedTitles();
titles.LoadTitles(new BufferedReader(@"
diff --git a/ImperatorToCK3.UnitTests/CK3/Titles/LandedTitlesTests.cs b/ImperatorToCK3.UnitTests/CK3/Titles/LandedTitlesTests.cs
index e77e91698..dbdd12916 100644
--- a/ImperatorToCK3.UnitTests/CK3/Titles/LandedTitlesTests.cs
+++ b/ImperatorToCK3.UnitTests/CK3/Titles/LandedTitlesTests.cs
@@ -251,7 +251,7 @@ public void GovernorshipsCanBeRecognizedAsCountyLevel() {
"governorship = \"galatia_region\""
);
var governorship1 = new Governorship(reader, imperatorWorld.Countries, impRegionMapper);
- imperatorWorld.Jobs.Governorships.Add(governorship1);
+ imperatorWorld.JobsDB.Governorships.Add(governorship1);
var titles = new Title.LandedTitles();
titles.LoadTitles(new BufferedReader(
"c_county1 = { b_barony1={province=1} } " +
diff --git a/ImperatorToCK3.UnitTests/Imperator/Diplomacy/DiplomacyTests.cs b/ImperatorToCK3.UnitTests/Imperator/Diplomacy/DiplomacyTests.cs
index 454a814b3..9acf888de 100644
--- a/ImperatorToCK3.UnitTests/Imperator/Diplomacy/DiplomacyTests.cs
+++ b/ImperatorToCK3.UnitTests/Imperator/Diplomacy/DiplomacyTests.cs
@@ -20,7 +20,7 @@ public void WarWithNoDefendersIsSkipped() {
3 = { previous=no defender=1 }
}
""");
- var diplomacy = new ImperatorToCK3.Imperator.Diplomacy.Diplomacy(reader);
+ var diplomacy = new ImperatorToCK3.Imperator.Diplomacy.DiplomacyDB(reader);
Assert.Empty(diplomacy.Wars);
var logStr = output.ToString();
diff --git a/ImperatorToCK3.UnitTests/Imperator/Jobs/JobsTests.cs b/ImperatorToCK3.UnitTests/Imperator/Jobs/JobsTests.cs
index 325d388e3..57dae5b5e 100644
--- a/ImperatorToCK3.UnitTests/Imperator/Jobs/JobsTests.cs
+++ b/ImperatorToCK3.UnitTests/Imperator/Jobs/JobsTests.cs
@@ -28,7 +28,7 @@ public JobsTests() {
}
[Fact]
public void GovernorshipsDefaultToEmpty() {
- var jobs = new ImperatorToCK3.Imperator.Jobs.Jobs();
+ var jobs = new ImperatorToCK3.Imperator.Jobs.JobsDB();
Assert.Empty(jobs.Governorships);
}
[Fact]
@@ -36,7 +36,7 @@ public void GovernorshipsCanBeRead() {
var reader = new BufferedReader(
"province_job={who=1 governorship=galatia_region} province_job={who=2 governorship=galatia_region}"
);
- var jobs = new ImperatorToCK3.Imperator.Jobs.Jobs(reader, countryCollection, irRegionMapper);
+ var jobs = new ImperatorToCK3.Imperator.Jobs.JobsDB(reader, countryCollection, irRegionMapper);
Assert.Collection(jobs.Governorships,
item1 => Assert.Equal((ulong)1, item1.Country.Id),
item2 => Assert.Equal((ulong)2, item2.Country.Id)
@@ -50,7 +50,7 @@ public void IgnoredTokensAreLogged() {
var reader = new BufferedReader(
"useless_job = {}"
);
- _ = new ImperatorToCK3.Imperator.Jobs.Jobs(reader, countryCollection, irRegionMapper);
+ _ = new ImperatorToCK3.Imperator.Jobs.JobsDB(reader, countryCollection, irRegionMapper);
Assert.Contains("Ignored Jobs tokens: useless_job", output.ToString());
}
diff --git a/ImperatorToCK3.UnitTests/Mappers/TagTitle/MappingTests.cs b/ImperatorToCK3.UnitTests/Mappers/TagTitle/MappingTests.cs
index c99e4ca64..33c1d3dae 100644
--- a/ImperatorToCK3.UnitTests/Mappers/TagTitle/MappingTests.cs
+++ b/ImperatorToCK3.UnitTests/Mappers/TagTitle/MappingTests.cs
@@ -113,7 +113,7 @@ public void GovernorshipToDeJureDuchyMappingFailsIfDuchyIsNot60PercentControlled
var irGovernorship = new Governorship(governorshipReader, irCountries, irRegionMapper);
Assert.Equal(irRegionId, irGovernorship.Region.Id);
Assert.Equal(irCountryId, irGovernorship.Country.Id);
- var jobs = new Jobs();
+ var jobs = new JobsDB();
jobs.Governorships.Add(irGovernorship);
const string duchyId = "d_galatia";
diff --git a/ImperatorToCK3/CK3/Titles/LandedTitles.cs b/ImperatorToCK3/CK3/Titles/LandedTitles.cs
index 2e115abbd..eb793b18d 100644
--- a/ImperatorToCK3/CK3/Titles/LandedTitles.cs
+++ b/ImperatorToCK3/CK3/Titles/LandedTitles.cs
@@ -353,7 +353,7 @@ List countryLevelGovernorships
) {
Logger.Info("Importing Imperator Governorships...");
- var governorships = irWorld.Jobs.Governorships;
+ var governorships = irWorld.JobsDB.Governorships;
var governorshipsPerRegion = governorships.GroupBy(g => g.Region.Id)
.ToDictionary(g => g.Key, g => g.Count());
diff --git a/ImperatorToCK3/CK3/World.cs b/ImperatorToCK3/CK3/World.cs
index f5a221e78..4ae11fd04 100644
--- a/ImperatorToCK3/CK3/World.cs
+++ b/ImperatorToCK3/CK3/World.cs
@@ -241,7 +241,7 @@ public World(Imperator.World impWorld, Configuration config) {
);
// Give counties to rulers and governors.
- OverwriteCountiesHistory(impWorld.Jobs.Governorships, countyLevelGovernorships, impWorld.Characters, impWorld.Provinces, CorrectedDate);
+ OverwriteCountiesHistory(impWorld.JobsDB.Governorships, countyLevelGovernorships, impWorld.Characters, impWorld.Provinces, CorrectedDate);
// Import holding owners as barons and counts.
LandedTitles.ImportImperatorHoldings(Provinces, impWorld.Characters, CorrectedDate);
diff --git a/ImperatorToCK3/Imperator/Diplomacy/Diplomacy.cs b/ImperatorToCK3/Imperator/Diplomacy/DiplomacyDB.cs
similarity index 92%
rename from ImperatorToCK3/Imperator/Diplomacy/Diplomacy.cs
rename to ImperatorToCK3/Imperator/Diplomacy/DiplomacyDB.cs
index 89edfbb55..deb05e901 100644
--- a/ImperatorToCK3/Imperator/Diplomacy/Diplomacy.cs
+++ b/ImperatorToCK3/Imperator/Diplomacy/DiplomacyDB.cs
@@ -5,9 +5,9 @@
namespace ImperatorToCK3.Imperator.Diplomacy;
-public class Diplomacy {
- public List Wars { get; } = new();
- public Diplomacy(BufferedReader reader) {
+public class DiplomacyDB {
+ public IList Wars { get; } = new List();
+ public DiplomacyDB(BufferedReader reader) {
var parser = new Parser();
parser.RegisterKeyword("database", databaseReader => {
var databaseParser = new Parser();
diff --git a/ImperatorToCK3/Imperator/Jobs/Jobs.cs b/ImperatorToCK3/Imperator/Jobs/JobsDB.cs
similarity index 74%
rename from ImperatorToCK3/Imperator/Jobs/Jobs.cs
rename to ImperatorToCK3/Imperator/Jobs/JobsDB.cs
index 523905991..e81a904ba 100644
--- a/ImperatorToCK3/Imperator/Jobs/Jobs.cs
+++ b/ImperatorToCK3/Imperator/Jobs/JobsDB.cs
@@ -6,11 +6,11 @@
namespace ImperatorToCK3.Imperator.Jobs;
-public class Jobs {
- public List Governorships { get; } = new();
+public class JobsDB {
+ public IList Governorships { get; } = new List();
- public Jobs() { }
- public Jobs(BufferedReader jobsReader, CountryCollection countries, ImperatorRegionMapper irRegionMapper) {
+ public JobsDB() { }
+ public JobsDB(BufferedReader jobsReader, CountryCollection countries, ImperatorRegionMapper irRegionMapper) {
var ignoredTokens = new IgnoredKeywordsSet();
var parser = new Parser();
parser.RegisterKeyword("province_job", reader => {
diff --git a/ImperatorToCK3/Imperator/World.cs b/ImperatorToCK3/Imperator/World.cs
index c0d94128a..c7009a283 100644
--- a/ImperatorToCK3/Imperator/World.cs
+++ b/ImperatorToCK3/Imperator/World.cs
@@ -46,8 +46,8 @@ public class World : Parser {
public AreaCollection Areas { get; } = new();
public ImperatorRegionMapper ImperatorRegionMapper { get; }
public StateCollection States { get; } = new();
- public List Wars { get; private set; } = new();
- public Jobs.Jobs Jobs { get; private set; } = new();
+ public IList Wars { get; private set; } = new List();
+ public Jobs.JobsDB JobsDB { get; private set; } = new();
public UnitCollection Units { get; } = new();
public CulturesDB CulturesDB { get; } = new();
public ReligionCollection Religions { get; private set; }
@@ -193,14 +193,14 @@ public World(Configuration config, ConverterVersion converterVersion): this(conf
});
RegisterKeyword("diplomacy", reader => {
Logger.Info("Loading diplomacy...");
- var diplomacy = new Diplomacy.Diplomacy(reader);
+ var diplomacy = new Diplomacy.DiplomacyDB(reader);
Wars = diplomacy.Wars;
Logger.IncrementProgress();
});
RegisterKeyword("jobs", reader => {
Logger.Info("Loading Jobs...");
- Jobs = new Jobs.Jobs(reader, Countries, ImperatorRegionMapper);
- Logger.Info($"Loaded {Jobs.Governorships.Capacity} governorships.");
+ JobsDB = new Jobs.JobsDB(reader, Countries, ImperatorRegionMapper);
+ Logger.Info($"Loaded {JobsDB.Governorships.Count} governorships.");
Logger.IncrementProgress();
});
RegisterKeyword("deity_manager", reader => {
diff --git a/ImperatorToCK3/ImperatorToCK3.csproj b/ImperatorToCK3/ImperatorToCK3.csproj
index 6740079e0..225065c77 100644
--- a/ImperatorToCK3/ImperatorToCK3.csproj
+++ b/ImperatorToCK3/ImperatorToCK3.csproj
@@ -16,7 +16,6 @@
..\Debug\ImperatorToCK3\
true
- true
@@ -30,6 +29,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
From aae538d8e0d062c50fbb4f95611ee51d704fc608 Mon Sep 17 00:00:00 2001
From: IhateTrains
Date: Mon, 7 Aug 2023 01:54:49 +0200
Subject: [PATCH 07/10] Convert major powers with at least 300 territories to
empires (#1464)
---
ImperatorToCK3/Imperator/Countries/Country.cs | 26 +++++++------------
.../Mappers/TagTitle/TagTitleMapper.cs | 7 ++++-
2 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/ImperatorToCK3/Imperator/Countries/Country.cs b/ImperatorToCK3/Imperator/Countries/Country.cs
index 3ac4b04a4..8c5c0a0cb 100644
--- a/ImperatorToCK3/Imperator/Countries/Country.cs
+++ b/ImperatorToCK3/Imperator/Countries/Country.cs
@@ -60,25 +60,17 @@ public SortedSet GetLaws() {
_ => monarchyLaws,
};
}
+ public int TerritoriesCount => ownedProvinces.Count;
public CountryRank Rank {
get {
- var provCount = ownedProvinces.Count;
- if (provCount == 0) {
- return CountryRank.migrantHorde;
- }
- if (provCount == 1) {
- return CountryRank.cityState;
- }
- if (provCount <= 24) {
- return CountryRank.localPower;
- }
- if (provCount <= 99) {
- return CountryRank.regionalPower;
- }
- if (provCount <= 499) {
- return CountryRank.majorPower;
- }
- return CountryRank.greatPower;
+ return TerritoriesCount switch {
+ 0 => CountryRank.migrantHorde,
+ 1 => CountryRank.cityState,
+ <= 24 => CountryRank.localPower,
+ <= 99 => CountryRank.regionalPower,
+ <= 499 => CountryRank.majorPower,
+ _ => CountryRank.greatPower
+ };
}
}
public void RegisterProvince(Province province) {
diff --git a/ImperatorToCK3/Mappers/TagTitle/TagTitleMapper.cs b/ImperatorToCK3/Mappers/TagTitle/TagTitleMapper.cs
index 941d735fa..c7f5e5f9b 100644
--- a/ImperatorToCK3/Mappers/TagTitle/TagTitleMapper.cs
+++ b/ImperatorToCK3/Mappers/TagTitle/TagTitleMapper.cs
@@ -161,7 +161,12 @@ private static string GetCK3TitleRank(Country country, string localizedTitleName
if (localizedTitleName.Contains("Kingdom", System.StringComparison.Ordinal)) {
return "k";
}
-
+
+ // Major power rank is very broad (from 100 to 499 territories). Consider 300+ territories as empire material.
+ if (country is {Rank: CountryRank.majorPower, TerritoriesCount: >= 300}) {
+ return "e";
+ }
+
switch (country.Rank) {
case CountryRank.migrantHorde:
case CountryRank.cityState:
From 4127a4df7c046ae46b70701a3f23d3bd0a81d6a0 Mon Sep 17 00:00:00 2001
From: IhateTrains
Date: Mon, 7 Aug 2023 03:50:21 +0200
Subject: [PATCH 08/10] Tweaks suggested by Meziantou.Analyzer (#1466) #patch
---
ImperatorToCK3/CK3/Provinces/ProvinceCollection.cs | 2 +-
ImperatorToCK3/CK3/Religions/ReligionCollection.cs | 7 ++++---
ImperatorToCK3/CK3/Titles/Title.cs | 4 ++--
ImperatorToCK3/CK3/Wars/War.cs | 4 ++--
ImperatorToCK3/Imperator/Diplomacy/War.cs | 4 ++--
ImperatorToCK3/Imperator/Provinces/Province.cs | 6 +++---
ImperatorToCK3/Mappers/Province/ProvinceMapper.cs | 8 ++++----
ImperatorToCK3/Mappers/Province/ProvinceMapping.cs | 4 ++--
.../Mappers/Province/ProvinceMappingsVersion.cs | 2 +-
ImperatorToCK3/Mappers/Trait/TraitMapper.cs | 2 +-
ImperatorToCK3/Outputter/WarsOutputter.cs | 4 ++--
11 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/ImperatorToCK3/CK3/Provinces/ProvinceCollection.cs b/ImperatorToCK3/CK3/Provinces/ProvinceCollection.cs
index c69ee92ce..9db111515 100644
--- a/ImperatorToCK3/CK3/Provinces/ProvinceCollection.cs
+++ b/ImperatorToCK3/CK3/Provinces/ProvinceCollection.cs
@@ -146,7 +146,7 @@ public void LoadPrehistory() {
}
private static Imperator.Provinces.Province? DeterminePrimarySourceProvince(
- List impProvinceNumbers,
+ IEnumerable impProvinceNumbers,
Imperator.World irWorld
) {
// determine ownership by province development.
diff --git a/ImperatorToCK3/CK3/Religions/ReligionCollection.cs b/ImperatorToCK3/CK3/Religions/ReligionCollection.cs
index c41eaab0b..6a75150a6 100644
--- a/ImperatorToCK3/CK3/Religions/ReligionCollection.cs
+++ b/ImperatorToCK3/CK3/Religions/ReligionCollection.cs
@@ -16,7 +16,8 @@
namespace ImperatorToCK3.CK3.Religions;
public class ReligionCollection : IdObjectCollection {
- public Dictionary> ReplaceableHolySitesByFaith { get; } = new();
+ private readonly Dictionary> replaceableHolySitesByFaith = new();
+ public IReadOnlyDictionary> ReplaceableHolySitesByFaith => replaceableHolySitesByFaith;
public IdObjectCollection HolySites { get; } = new();
public IdObjectCollection DoctrineCategories { get; } = new();
@@ -82,9 +83,9 @@ public void LoadReplaceableHolySites(string filePath) {
var valueStr = value.ToString();
if (value.IsArrayOrObject()) {
- ReplaceableHolySitesByFaith[faithId] = new OrderedSet(new BufferedReader(valueStr).GetStrings());
+ replaceableHolySitesByFaith[faithId] = new OrderedSet(new BufferedReader(valueStr).GetStrings());
} else if (valueStr == "all") {
- ReplaceableHolySitesByFaith[faithId] = new OrderedSet(faith.HolySiteIds);
+ replaceableHolySitesByFaith[faithId] = new OrderedSet(faith.HolySiteIds);
} else {
Logger.Warn($"Unexpected value: {valueStr}");
}
diff --git a/ImperatorToCK3/CK3/Titles/Title.cs b/ImperatorToCK3/CK3/Titles/Title.cs
index ce9250b64..9fa1a316e 100644
--- a/ImperatorToCK3/CK3/Titles/Title.cs
+++ b/ImperatorToCK3/CK3/Titles/Title.cs
@@ -918,9 +918,9 @@ public Dictionary GetDeFactoVassalsAndBelow(Date date, string ran
[SerializedName("always_follows_primary_heir")] public bool? AlwaysFollowsPrimaryHeir { get; set; }
[SerializedName("de_jure_drift_disabled")] public bool? DeJureDriftDisabled { get; set; }
[SerializedName("can_be_named_after_dynasty")] public bool? CanBeNamedAfterDynasty { get; set; }
- [SerializedName("male_names")] public List? MaleNames { get; private set; }
+ [SerializedName("male_names")] public IList? MaleNames { get; private set; }
//
- [SerializedName("cultural_names")] public Dictionary? CulturalNames { get; private set; }
+ [SerializedName("cultural_names")] public IDictionary? CulturalNames { get; private set; }
public int? GetOwnOrInheritedDevelopmentLevel(Date date) {
var ownDev = GetDevelopmentLevel(date);
diff --git a/ImperatorToCK3/CK3/Wars/War.cs b/ImperatorToCK3/CK3/Wars/War.cs
index 37e5105e8..4497fd448 100644
--- a/ImperatorToCK3/CK3/Wars/War.cs
+++ b/ImperatorToCK3/CK3/Wars/War.cs
@@ -15,8 +15,8 @@ public class War {
public Date EndDate { get; }
public OrderedSet TargetedTitles { get; } = new();
public string? CasusBelli { get; }
- public List Attackers { get; } = new();
- public List Defenders { get; } = new();
+ public IList Attackers { get; } = new List();
+ public IList Defenders { get; } = new List();
public string Claimant { get; }
public War(Imperator.Diplomacy.War irWar, Mappers.War.WarMapper warMapper, ProvinceMapper provinceMapper, Imperator.Countries.CountryCollection impCountries, StateCollection irStates, ProvinceCollection ck3Provinces, Title.LandedTitles titles, Date ck3BookmarkDate) {
diff --git a/ImperatorToCK3/Imperator/Diplomacy/War.cs b/ImperatorToCK3/Imperator/Diplomacy/War.cs
index 5aedf2f04..3f77dcf3d 100644
--- a/ImperatorToCK3/Imperator/Diplomacy/War.cs
+++ b/ImperatorToCK3/Imperator/Diplomacy/War.cs
@@ -7,8 +7,8 @@ namespace ImperatorToCK3.Imperator.Diplomacy;
public class War {
public Date StartDate { get; private set; } = new(1, 1, 1);
public bool Previous { get; private set; }
- public List AttackerCountryIds { get; } = new();
- public List DefenderCountryIds { get; } = new();
+ public IList AttackerCountryIds { get; } = new List();
+ public IList DefenderCountryIds { get; } = new List();
public string? WarGoal { get; private set; }
public ulong? TargetedStateId { get; private set; }
diff --git a/ImperatorToCK3/Imperator/Provinces/Province.cs b/ImperatorToCK3/Imperator/Provinces/Province.cs
index 8517fa547..9515ec32a 100644
--- a/ImperatorToCK3/Imperator/Provinces/Province.cs
+++ b/ImperatorToCK3/Imperator/Provinces/Province.cs
@@ -17,7 +17,7 @@ public partial class Province : IIdentifiable {
public State? State { get; private set; } = null;
public Country? OwnerCountry { get; set; }
public ulong Controller { get; set; } = 0;
- public Dictionary Pops { get; set; } = new();
+ public IDictionary Pops { get; } = new Dictionary();
public ProvinceRank ProvinceRank { get; set; } = ProvinceRank.settlement;
public bool Fort { get; set; } = false;
public bool IsHolySite => HolySiteId is not null;
@@ -43,10 +43,10 @@ public int GetPopCount() {
}
// Returns a count of linked pops
- public int LinkPops(PopCollection pops) {
+ public int LinkPops(PopCollection popCollection) {
int counter = 0;
foreach (var popId in parsedPopIds) {
- if (pops.TryGetValue(popId, out var popToLink)) {
+ if (popCollection.TryGetValue(popId, out var popToLink)) {
Pops.Add(popId, popToLink);
++counter;
} else {
diff --git a/ImperatorToCK3/Mappers/Province/ProvinceMapper.cs b/ImperatorToCK3/Mappers/Province/ProvinceMapper.cs
index 27a920a55..6b41a4f93 100644
--- a/ImperatorToCK3/Mappers/Province/ProvinceMapper.cs
+++ b/ImperatorToCK3/Mappers/Province/ProvinceMapper.cs
@@ -5,8 +5,8 @@
namespace ImperatorToCK3.Mappers.Province;
public class ProvinceMapper {
- private readonly Dictionary> imperatorToCK3ProvinceMap = new();
- private readonly Dictionary> ck3ToImperatorProvinceMap = new();
+ private readonly Dictionary> imperatorToCK3ProvinceMap = new();
+ private readonly Dictionary> ck3ToImperatorProvinceMap = new();
public void LoadMappings(string mappingsPath, string mappingsVersionName) {
Logger.Info("Loading province mappings...");
@@ -49,14 +49,14 @@ private void CreateMappings(ProvinceMappingsVersion mappingsVersion) {
}
}
- public List GetImperatorProvinceNumbers(ulong ck3ProvinceNumber) {
+ public IList GetImperatorProvinceNumbers(ulong ck3ProvinceNumber) {
if (ck3ToImperatorProvinceMap.TryGetValue(ck3ProvinceNumber, out var impProvs)) {
return impProvs;
}
return new List();
}
- public List GetCK3ProvinceNumbers(ulong impProvinceNumber) {
+ public IList GetCK3ProvinceNumbers(ulong impProvinceNumber) {
if (imperatorToCK3ProvinceMap.TryGetValue(impProvinceNumber, out var ck3Provs)) {
return ck3Provs;
}
diff --git a/ImperatorToCK3/Mappers/Province/ProvinceMapping.cs b/ImperatorToCK3/Mappers/Province/ProvinceMapping.cs
index 5724a5bab..82705b9bd 100644
--- a/ImperatorToCK3/Mappers/Province/ProvinceMapping.cs
+++ b/ImperatorToCK3/Mappers/Province/ProvinceMapping.cs
@@ -4,8 +4,8 @@
namespace ImperatorToCK3.Mappers.Province;
public class ProvinceMapping {
- public List CK3Provinces { get; } = new();
- public List ImperatorProvinces { get; } = new();
+ public IList CK3Provinces { get; } = new List();
+ public IList ImperatorProvinces { get; } = new List();
private static readonly Parser parser = new();
private static ProvinceMapping tempMapping = new();
diff --git a/ImperatorToCK3/Mappers/Province/ProvinceMappingsVersion.cs b/ImperatorToCK3/Mappers/Province/ProvinceMappingsVersion.cs
index 7cb27e7e0..891f7379f 100644
--- a/ImperatorToCK3/Mappers/Province/ProvinceMappingsVersion.cs
+++ b/ImperatorToCK3/Mappers/Province/ProvinceMappingsVersion.cs
@@ -5,7 +5,7 @@
namespace ImperatorToCK3.Mappers.Province;
public class ProvinceMappingsVersion {
- public List Mappings { get; } = new();
+ public IList Mappings { get; } = new List();
public ProvinceMappingsVersion() { }
public ProvinceMappingsVersion(BufferedReader reader) {
var referencedImperatorProvs = new HashSet();
diff --git a/ImperatorToCK3/Mappers/Trait/TraitMapper.cs b/ImperatorToCK3/Mappers/Trait/TraitMapper.cs
index c9612cc2b..16b2bdd86 100644
--- a/ImperatorToCK3/Mappers/Trait/TraitMapper.cs
+++ b/ImperatorToCK3/Mappers/Trait/TraitMapper.cs
@@ -7,7 +7,7 @@
namespace ImperatorToCK3.Mappers.Trait;
public class TraitMapper {
- protected Dictionary ImperatorToCK3TraitMap = new();
+ protected IDictionary ImperatorToCK3TraitMap = new Dictionary();
protected IdObjectCollection CK3Traits = new();
public TraitMapper() { }
diff --git a/ImperatorToCK3/Outputter/WarsOutputter.cs b/ImperatorToCK3/Outputter/WarsOutputter.cs
index d9c23e721..abe40f6dd 100644
--- a/ImperatorToCK3/Outputter/WarsOutputter.cs
+++ b/ImperatorToCK3/Outputter/WarsOutputter.cs
@@ -7,7 +7,7 @@
namespace ImperatorToCK3.Outputter;
public static class WarsOutputter {
- public static void OutputWars(string outputModName, List wars) {
+ public static void OutputWars(string outputModName, IList wars) {
Logger.Info("Writing wars...");
// dumping all into one file
var path = Path.Combine("output",outputModName, "history/wars/fromImperator.txt");
@@ -23,7 +23,7 @@ private static void OutputWar(TextWriter output, War war) {
output.WriteLine($"\tstart_date = {war.StartDate}");
output.WriteLine($"\tend_date = {war.EndDate}");
- output.WriteLine($"\ttargeted_titles={{ {string.Join(" ", war.TargetedTitles)} }}");
+ output.WriteLine($"\ttargeted_titles={{ {string.Join(' ', war.TargetedTitles)} }}");
if (war.CasusBelli is not null) {
output.WriteLine($"\tcasus_belli = {war.CasusBelli}");
}
From 3ec40d405bd8e7ca76c71a61290ea9a0e913d879 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 8 Aug 2023 23:12:15 +0200
Subject: [PATCH 09/10] Bump Fronter.NET from `0c2f645` to `81a66e5` (#1465)
Bumps
[Fronter.NET](https://github.com/ParadoxGameConverters/Fronter.NET) from
`0c2f645` to `81a66e5`.
Commits
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
Fronter.NET | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Fronter.NET b/Fronter.NET
index 0c2f645f6..81a66e5e2 160000
--- a/Fronter.NET
+++ b/Fronter.NET
@@ -1 +1 @@
-Subproject commit 0c2f645f6662afda080b4b2c9a48ccdd5d5f3e88
+Subproject commit 81a66e5e24d3157e78cdb519cdf4bb9ab72a3500
From a9dc2a57448ad55472007c705f07d7c0e0f6ea57 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 8 Aug 2023 23:12:44 +0200
Subject: [PATCH 10/10] Bump PGCG.commonItems from 8.2.0 to 8.3.0 (#1469)
Bumps
[PGCG.commonItems](https://github.com/ParadoxGameConverters/commonItems.NET)
from 8.2.0 to 8.3.0.
Commits
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
ImperatorToCK3/ImperatorToCK3.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ImperatorToCK3/ImperatorToCK3.csproj b/ImperatorToCK3/ImperatorToCK3.csproj
index 225065c77..3641d889e 100644
--- a/ImperatorToCK3/ImperatorToCK3.csproj
+++ b/ImperatorToCK3/ImperatorToCK3.csproj
@@ -35,7 +35,7 @@
-
+