From 63c4c9616f3580071671cac4755b5397f0e8abac Mon Sep 17 00:00:00 2001 From: IhateTrains Date: Sun, 22 Sep 2024 11:59:39 +0100 Subject: [PATCH] Remove unneeded `holder = 0` entries from title history, readd missing governments file (#2216) #patch --- .../CK3/Characters/CharacterCollection.cs | 3 - ImperatorToCK3/CK3/Titles/LandedTitles.cs | 22 +++++++ ImperatorToCK3/CK3/World.cs | 3 + .../coat_of_arms/IRToCK3_dynasties.txt | 31 ++++++++++ .../governments/IRToCK3_governments.liquid | 57 +++++++++++++++++++ 5 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 ImperatorToCK3/Data_Files/blankMod/output/common/coat_of_arms/coat_of_arms/IRToCK3_dynasties.txt create mode 100644 ImperatorToCK3/Data_Files/blankMod/output/common/governments/IRToCK3_governments.liquid diff --git a/ImperatorToCK3/CK3/Characters/CharacterCollection.cs b/ImperatorToCK3/CK3/Characters/CharacterCollection.cs index 2a6f40c5a..30c87a38b 100644 --- a/ImperatorToCK3/CK3/Characters/CharacterCollection.cs +++ b/ImperatorToCK3/CK3/Characters/CharacterCollection.cs @@ -553,9 +553,6 @@ public void PurgeUnneededCharacters(Title.LandedTitles titles, DynastyCollection houses.PurgeUnneededHouses(this, ck3BookmarkDate); dynasties.PurgeUnneededDynasties(this, houses, ck3BookmarkDate); dynasties.FlattenDynastiesWithNoFounders(this, houses, ck3BookmarkDate); - - // Clean up title history. - titles.CleanUpHistory(this, ck3BookmarkDate); } public void RemoveEmployerIdFromLandedCharacters(Title.LandedTitles titles, Date conversionDate) { diff --git a/ImperatorToCK3/CK3/Titles/LandedTitles.cs b/ImperatorToCK3/CK3/Titles/LandedTitles.cs index 415e59144..9ff71f92d 100644 --- a/ImperatorToCK3/CK3/Titles/LandedTitles.cs +++ b/ImperatorToCK3/CK3/Titles/LandedTitles.cs @@ -271,6 +271,28 @@ public void CleanUpHistory(CharacterCollection characters, Date ck3BookmarkDate) ); } + // For counties, remove holder = 0 entries that precede a holder = entry + // that's before or at the bookmark date. + foreach (var county in Counties) { + if (!county.History.Fields.TryGetValue("holder", out var holderField)) { + continue; + } + + var holderIdAtBookmark = county.GetHolderId(ck3BookmarkDate); + if (holderIdAtBookmark == "0") { + continue; + } + + // If we have a holder at the bookmark date, remove all holder = 0 entries that precede it. + var entryDatesToRemove = holderField.DateToEntriesDict + .Where(pair => pair.Key < ck3BookmarkDate && pair.Value.Any(v => v.Value.ToString() == "0")) + .Select(pair => pair.Key) + .ToArray(); + foreach (var date in entryDatesToRemove) { + holderField.DateToEntriesDict.Remove(date); + } + } + // Remove liege entries that are not valid (liege title is not held at the entry date). foreach (var title in this) { if (!title.History.Fields.TryGetValue("liege", out var liegeField)) { diff --git a/ImperatorToCK3/CK3/World.cs b/ImperatorToCK3/CK3/World.cs index 2cf7d0811..ec69ae254 100644 --- a/ImperatorToCK3/CK3/World.cs +++ b/ImperatorToCK3/CK3/World.cs @@ -338,6 +338,9 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac Characters.RemoveEmployerIdFromLandedCharacters(LandedTitles, CorrectedDate); Characters.PurgeUnneededCharacters(LandedTitles, Dynasties, DynastyHouses, config.CK3BookmarkDate); + // After the purging of unneeded characters, we should clean up the title history. + LandedTitles.CleanUpHistory(Characters, config.CK3BookmarkDate); + // Now that the title history is basically done, convert officials as council members and courtiers. LandedTitles.ImportImperatorGovernmentOffices(impWorld.JobsDB.OfficeJobs, Religions, config.CK3BookmarkDate); diff --git a/ImperatorToCK3/Data_Files/blankMod/output/common/coat_of_arms/coat_of_arms/IRToCK3_dynasties.txt b/ImperatorToCK3/Data_Files/blankMod/output/common/coat_of_arms/coat_of_arms/IRToCK3_dynasties.txt new file mode 100644 index 000000000..6e263cc01 --- /dev/null +++ b/ImperatorToCK3/Data_Files/blankMod/output/common/coat_of_arms/coat_of_arms/IRToCK3_dynasties.txt @@ -0,0 +1,31 @@ +# The vanilla CK3 Oghuz dynasty needs a CoA because we preserve the Seljuk cadet house. +7327 = k_oghuz_il +100721 = { # Abbasid + pattern = "pattern_solid.dds" + color1 = "black" + color2 = "white" + colored_emblem = { + texture = "ce_block_02.dds" + color1 = "black" + color2 = "black" + instance = { position = { 0.5 0.5 } scale = { 1.0 1.0 } } + } + colored_emblem = { + texture = "ce_block_02.dds" + color1 = "black" + color2 = "black" + instance = { position = { 0.5 0.48 } scale = { 0.70 0.70 } } + } + colored_emblem = { + texture = "ce_border_circle_fimbriated.dds" + color1 = "black" + color2 = "white" + instance = { position = { 0.5 0.48 } scale = { 0.75 0.75 } } + } + colored_emblem = { + texture = "ce_arabic_basmala_kufic.dds" + color1 = "white" + color2 = "white" + instance = { position = { 0.5 0.48 } scale = { 0.64 0.64 } } + } +} \ No newline at end of file diff --git a/ImperatorToCK3/Data_Files/blankMod/output/common/governments/IRToCK3_governments.liquid b/ImperatorToCK3/Data_Files/blankMod/output/common/governments/IRToCK3_governments.liquid new file mode 100644 index 000000000..6ad016e05 --- /dev/null +++ b/ImperatorToCK3/Data_Files/blankMod/output/common/governments/IRToCK3_governments.liquid @@ -0,0 +1,57 @@ +eremitic_government = { + create_cadet_branches = no + religious = yes + rulers_should_have_dynasty = no + council = yes + primary_holding = church_holding + valid_holdings = { church_holding } + required_county_holdings = { church_holding } + preferred_religions = { christianity_religion } + court_generate_spouses = no + court_generate_commanders = no + royal_court = no + supply_limit_mult_for_others = 0 + affected_by_development = no + + can_get_government = { + OR = { + has_government = eremitic_government + has_variable = IRToCK3_eremite_flag + } + current_date <= 900.1.1 + OR = { + {% unless tfe %} + AND = { # Capital in Iceland + exists = title:d_iceland + capital_county = { + target_is_de_jure_liege_or_above = title:d_iceland + } + } + {% endunless %} + AND = { # Capital in Faroe Islands + exists = title:c_faereyar + capital_county = title:c_faereyar + } + } + + } + + ai = { + use_lifestyle = yes + imprison = no # Imprison & release from prison + arrange_marriage = no # Actively arrange marriages. Can still receive marriage requests if disabled. + use_goals = no # Use longterm goals (build holdings, perform major decisions, ...) + use_decisions = no # Use minor decisions + use_scripted_guis = no # Will evaluate using scripted guis + perform_religious_reformation = no + } + + character_modifier = { + development_growth_factor = -1000 + levy_size = -1000 + levy_reinforcement_rate = -1000 + tax_mult = -1000 + } + + color = rgb { 153 204 0 } +} \ No newline at end of file