Skip to content

Commit

Permalink
Merge branch 'master' into feature/rajas-of-asia-support
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains committed Jan 5, 2025
2 parents a6c17d8 + 61b1b8d commit 383762f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
27 changes: 19 additions & 8 deletions ImperatorToCK3/CK3/Characters/DNAFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ internal DNA GenerateDNA(Imperator.Characters.Character irCharacter, PortraitDat
}

// Convert eye accessories.
const string blindfoldGeneId = "special_headgear_blindfold";
const string blindfoldTemplateId = "blindfold";
var irEyeAccessoryGeneTemplateName = irPortraitData.AccessoryGenesDict["eye_accessory"].GeneTemplate;
switch (irEyeAccessoryGeneTemplateName) {
case "normal_eyes":
Expand All @@ -171,11 +173,18 @@ internal DNA GenerateDNA(Imperator.Characters.Character irCharacter, PortraitDat

break;
case "blindfold_1": // TODO: check if this is correctly added to portrait modifiers if needed
var blindfoldTemplate = ck3GenesDB.SpecialAccessoryGenes["special_headgear_blindfold"]
.GeneTemplates["blindfold"];
if (!ck3GenesDB.SpecialAccessoryGenes.TryGetValue(blindfoldGeneId, out var blindfoldGene)) {
Logger.Warn($"{blindfoldGeneId} not found in CK3 special accessory genes!");
break;
}
if (!blindfoldGene.GeneTemplates.TryGetValue(blindfoldTemplateId, out var blindfoldTemplate)) {
Logger.Warn($"{blindfoldTemplateId} not found in CK3 special accessory genes!");
break;
}

if (blindfoldTemplate.AgeSexWeightBlocks.TryGetValue(irCharacter.AgeSex, out WeightBlock? blindfoldWeightBlock)) {
var blindfoldObjectName = blindfoldWeightBlock.GetMatchingObject(1) ?? blindfoldWeightBlock.ObjectNames.Last();
accessoryDNAValues["special_headgear_blindfold"] = new(blindfoldTemplate.Id, blindfoldObjectName, blindfoldWeightBlock);
accessoryDNAValues[blindfoldGeneId] = new(blindfoldTemplate.Id, blindfoldObjectName, blindfoldWeightBlock);
}

break;
Expand Down Expand Up @@ -206,12 +215,14 @@ internal DNA GenerateDNA(Imperator.Characters.Character irCharacter, PortraitDat
var blindEyesObjectName = blindEyesWeighBlock.GetMatchingObject(1) ?? blindEyesWeighBlock.ObjectNames.Last();
accessoryDNAValues["eye_accessory"] = new(blindEyesTemplate.Id, blindEyesObjectName, blindEyesWeighBlock); // TODO: check if this is correctly added to portrait modifiers if needed
}

var blindfoldTemplate = ck3GenesDB.SpecialAccessoryGenes["special_headgear_blindfold"]
.GeneTemplates["blindfold"];
if (blindfoldTemplate.AgeSexWeightBlocks.TryGetValue(irCharacter.AgeSex, out WeightBlock? blindfoldWeighBlock)) {

if (!ck3GenesDB.SpecialAccessoryGenes.TryGetValue(blindfoldGeneId, out var blindfoldGene)) {
Logger.Warn($"{blindfoldGeneId} not found in CK3 special accessory genes!");
} else if (!blindfoldGene.GeneTemplates.TryGetValue(blindfoldTemplateId, out var blindfoldTemplate)) {
Logger.Warn($"{blindfoldTemplateId} not found in CK3 special accessory genes!");
} else if (blindfoldTemplate.AgeSexWeightBlocks.TryGetValue(irCharacter.AgeSex, out WeightBlock? blindfoldWeighBlock)) {
var blindfoldObjectName = blindfoldWeighBlock.GetMatchingObject(1) ?? blindfoldWeighBlock.ObjectNames.Last();
accessoryDNAValues["special_headgear_blindfold"] = new(blindfoldTemplate.Id, blindfoldObjectName, blindfoldWeighBlock); // TODO: check if this is correctly added to portrait modifiers if needed
accessoryDNAValues[blindfoldGeneId] = new(blindfoldTemplate.Id, blindfoldObjectName, blindfoldWeighBlock); // TODO: check if this is correctly added to portrait modifiers if needed
}
} else if (irCharacter.Traits.Contains("one_eyed")) {
var eyePatchTemplate = ck3GenesDB.SpecialAccessoryGenes["special_headgear_eye_patch"]
Expand Down
2 changes: 1 addition & 1 deletion ImperatorToCK3/ImperatorToCK3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<PackageReference Include="CWTools" Version="0.5.0-alpha" />
<PackageReference Include="DotLiquid" Version="2.3.0" />
<PackageReference Include="FSharp.Core" Version="9.0.100" /> <!-- Needed for CWTools -->
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.3.0"/>
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.4.0"/>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.184">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down

0 comments on commit 383762f

Please sign in to comment.