Skip to content

Commit

Permalink
Merge branch 'master' into mapping-countries-by-name-support
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains committed Jan 22, 2025
2 parents 16e5cd8 + 2515e0a commit de2d8e7
Show file tree
Hide file tree
Showing 17 changed files with 833 additions and 396 deletions.
4 changes: 2 additions & 2 deletions ImperatorToCK3.UnitTests/ImperatorToCK3.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.3">
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand All @@ -23,7 +23,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.3">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
6 changes: 5 additions & 1 deletion ImperatorToCK3/CK3/Religions/Faith.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ public string Serialize(string indent, bool withBraces) {
}

public OrderedSet<string> GetDoctrineIdsForDoctrineCategoryId(string doctrineCategoryId) {
var category = Religion.ReligionCollection.DoctrineCategories[doctrineCategoryId];
if (!Religion.ReligionCollection.DoctrineCategories.TryGetValue(doctrineCategoryId, out var category)) {
Logger.Warn($"Doctrine category {doctrineCategoryId} not found.");
return [];
}

return GetDoctrineIdsForDoctrineCategory(category);
}

Expand Down
21 changes: 21 additions & 0 deletions ImperatorToCK3/CK3/Religions/ReligionCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ public void LoadReligions(ModFilesystem ck3ModFS, ColorFactory colorFactory) {
}

public void LoadConverterFaiths(string converterFaithsPath, ColorFactory colorFactory) {
OrderedSet<Faith> loadedConverterFaiths = [];

var parser = new Parser();
parser.RegisterRegex(CommonRegexes.String, (religionReader, religionId) => {
var optReligion = new Religion(religionId, religionReader, this, colorFactory);

// For validation, store all faiths loaded inside the converter religion.
loadedConverterFaiths.UnionWith(optReligion.Faiths);

// Check if religion already exists. If it does, add converter faiths to it.
// Otherwise, add the converter faith's religion.
Expand All @@ -55,6 +60,22 @@ public void LoadConverterFaiths(string converterFaithsPath, ColorFactory colorFa
});
parser.RegisterRegex(CommonRegexes.Catchall, ParserHelpers.IgnoreAndLogItem);
parser.ParseFile(converterFaithsPath);

// Validation: every faith should have a pilgrimage doctrine.
string? pilgrimageFallback = DoctrineCategories.TryGetValue("doctrine_pilgrimage", out var pilgrimageCategory)
? pilgrimageCategory.DoctrineIds.FirstOrDefault(d => d == "doctrine_pilgrimage_encouraged")
: null;
foreach (var converterFaith in loadedConverterFaiths) {
var pilgrimageDoctrine = converterFaith.GetDoctrineIdsForDoctrineCategoryId("doctrine_pilgrimage");
if (pilgrimageDoctrine.Count == 0) {
if (pilgrimageFallback is not null) {
Logger.Warn($"Faith {converterFaith.Id} has no pilgrimage doctrine! Setting {pilgrimageFallback}");
converterFaith.DoctrineIds.Add(pilgrimageFallback);
} else {
Logger.Warn($"Faith {converterFaith.Id} has no pilgrimage doctrine!");
}
}
}
}

private void RegisterHolySitesKeywords(Parser parser, bool areSitesFromConverter) {
Expand Down
15 changes: 12 additions & 3 deletions ImperatorToCK3/CK3/Titles/LandedTitles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,18 @@ public void LoadTitles(ModFilesystem ck3ModFS, CK3LocDB ck3LocDB) {
continue;
}
// Try to use the first valid capital of a de jure vassal.
var newCapitalId = title.DeJureVassals
.Select(v => v.CapitalCountyId)
.FirstOrDefault(vassalCapitalId => vassalCapitalId is not null && validTitleIds.Contains(vassalCapitalId));
string? newCapitalId;
if (title.Rank >= TitleRank.kingdom) {
newCapitalId = title.DeJureVassals
.Select(v => v.CapitalCountyId)
.FirstOrDefault(vassalCapitalId => vassalCapitalId is not null && validTitleIds.Contains(vassalCapitalId));
} else {
newCapitalId = title.DeJureVassals
.Where(v => v.Rank == TitleRank.county)
.Select(c => c.Id)
.FirstOrDefault();
}

// If not found, for landless titles try using capital of de jure liege.
if (newCapitalId is null && title.Landless) {
newCapitalId = title.DeJureLiege?.CapitalCountyId;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Called from code after history generation
# Empty scope
on_game_start = {
on_actions = {
cretan_to_neo_minoan_on_game_start
}
}


cretan_to_neo_minoan_on_game_start = {
effect = {
# Make Neo-Minoan culture only appear in provinces where the holder is of Cretan culture and is of kingdom or empire tier.
every_ruler = {
limit = {
highest_held_title_tier >= tier_kingdom
culture = culture:cretan
any_sub_realm_county = {
culture = culture:cretan
duchy = title:d_krete
}
}

# Convert the character and his entire realm from Cretan to Neo-Minoan.
set_culture = culture:neo_minoan
every_realm_county = {
limit = {
culture = culture:cretan
}
set_county_culture = culture:neo_minoan
}
every_vassal_or_below = {
limit = {
culture = culture:cretan
}
set_culture = culture:neo_minoan
}
every_close_or_extended_family_member = {
limit = {
culture = culture:cretan
}
set_culture = culture:neo_minoan
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@
unlock_final_hasan_decisions_1_tt: ""
unlock_final_hasan_decisions_2_tt: ""
unlock_final_hasan_decisions_3_tt: ""

# "Ancient Egyptian" is weird as a name for a culture that exists in the megacampaign timeline.
ancient_egyptian: "Kemetic"
ancient_egyptian_collective_noun: "Kemetics"
ancient_egyptian_prefix: "Egypto"
# "Egyptian" should not be used for the later Arabic-speaking population of Egypt.
# Instead, base the name on "Misr", the Arabic name for Egypt.
egyptian: "Misri"
egyptian_collective_noun: "Misris"
egyptian_prefix: "Egypto"
161 changes: 161 additions & 0 deletions ImperatorToCK3/Data_Files/configurables/converter_cultures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,167 @@
# vanilla = { gallic }
# }

gelonian = {

color = { 179 255 102 }

heritage = heritage_byzantine
language = language_scythian
parents = { hellenistic scythian }
created = -600.1.1 #needs to be BC
ethos = ethos_bellicose

name_list = name_list_scythian #might consider adding in ancient greek well)
martial_custom = marital_custom_male_only

traditions = {
tradition_artisans
tradition_swords_for_hire
tradition_culture_blending
tradition_maritime_mercantilism
tradition_horse_breeder
tradition_pastoralists
}

ethnicities = {
6 = mediterranean
4 = arab
}

coa_gfx = {
steppe_coa_gfx
}
building_gfx = {
steppe_building_gfx

}
clothing_gfx = {
mongol_clothing_gfx
byzantine_clothing_gfx
}
unit_gfx = {
mongol_unit_gfx
eastern_unit_gfx
}
}

#For this culture double check everything outside of traditions. I do not know if any of them are correct. So feel free to fix them if necessary.
qin = {

color = { 153 238 255 }

heritage = heritage_chinese
language = language_chinese
ethos = ethos_bureaucratic

name_list = name_list_han
martial_custom = marital_custom_male_only

traditions = {
tradition_artisans
tradition_legalistic
tradition_warriors_by_merit
tradition_recognition_of_talent
tradition_palace_politics
}

ethnicities = {
10 = chinese
}

coa_gfx = {
chinese_group_coa_gfx
}
building_gfx = {
chinese_building_gfx
}
clothing_gfx = {
chinese_clothing_gfx
}
unit_gfx = { chinese_unit_gfx }
}

neo_minoan = { # Other names can be neo_mycanaean or posiedian. This culture should only be be able to trigger in the converter if the holder of the culture has a kingdom or empire tier title. Otherwise, cretan should take place over it

color = { 0.7 0.6 0.95 }

heritage = heritage_ancient_greek
language = language_ancient_greek
ethos = ethos_bureaucratic

name_list = name_list_ancient_greek
martial_custom = marital_custom_male_only

traditions = {
tradition_culture_blending # Greek empires or kingdoms would usually try to integrate conquered cultures, look at alexander the great's empire as an example
tradition_maritime_mercantilism # Cretans were heavy on trade within the mediterranean due to location of crete
tradition_seafarers
tradition_artisans # Would become known for different goods due to control of surrounding territories of middle # east and asia outside of greece
tradition_ep3_imperial_tagmata # Greek culture was based around honor and disciple, example is alexander's empire
tradition_beacon_of_learning # One of the first cultures to be well known for philosiphy, math, etc.
}

ethnicities = {
10 = mediterranean_byzantine
}

coa_gfx = {
byzantine_group_coa_gfx
}
building_gfx = {
mediterranean_building_gfx
}
clothing_gfx = {
byzantine_clothing_gfx
}
unit_gfx = { eastern_unit_gfx }
}


cretan = {
INVALIDATED_BY = {
vanilla = { cretan } # In vanilla the cretan culture is a divergence from Greek, done through a descision
}

color = { 0.7 0.6 0.95 }

heritage = heritage_byzantine
MOD_DEPENDENT = {
IF wtwsms = {
language = language_doric # Doric was used for everyday life while the main greek language at the time (Koine Greek) was used for governance and other matters of administration. The language could be switched to language_ancient_greek depending on specificity or simplicity needed.
} ELSE = {
language = language_greek
}
}
ethos = ethos_bellicose

name_list = name_list_ancient_greek
martial_custom = marital_custom_male_only

traditions = {
tradition_swords_for_hire
tradition_legalistic
tradition_maritime_mercantilism
tradition_mountain_homes
tradition_highland_warriors
tradition_seafarers # Can be switched out with tradition_warrior_culture or tradition_ritualized_friendship.
}

ethnicities = {
10 = mediterranean_byzantine
}

coa_gfx = {
byzantine_group_coa_gfx
}
building_gfx = {
mediterranean_building_gfx
}
clothing_gfx = {
byzantine_clothing_gfx
}
unit_gfx = { eastern_unit_gfx }
}

khasi = {
INVALIDATED_BY = {
Expand Down
Loading

0 comments on commit de2d8e7

Please sign in to comment.