Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DNA and DNAFactory internal, reduce interface use #2360

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ImperatorToCK3/CK3/Characters/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@

public IDictionary<string, string> PrisonerIds { get; } = new Dictionary<string, string>(); // <prisoner id, imprisonment type>

public DNA? DNA { get; set; }
internal DNA? DNA { get; set; }

public Imperator.Characters.Character? ImperatorCharacter { get; set; }

Expand Down Expand Up @@ -355,174 +355,174 @@
}
}

public Character(
internal Character(
Imperator.Characters.Character impCharacter,
CharacterCollection characters,
ReligionMapper religionMapper,
CultureMapper cultureMapper,
TraitMapper traitMapper,
NicknameMapper nicknameMapper,
LocDB irLocDB,
CK3LocDB ck3LocDB,
MapData irMapData,
ProvinceMapper provinceMapper, // used to determine ck3 province for religion mapper
DeathReasonMapper deathReasonMapper,
DNAFactory dnaFactory,
Date dateOnConversion,
Configuration config,
ISet<string> unlocalizedImperatorNames
) {
this.characters = characters;

ImperatorCharacter = impCharacter;
ImperatorCharacter.CK3Character = this;
Id = "imperator" + ImperatorCharacter.Id;
FromImperator = true;

if (!string.IsNullOrEmpty(ImperatorCharacter.CustomName)) {
var loc = ImperatorCharacter.CustomName;
var locKey = CommonFunctions.NormalizeUTF8Path(loc.FoldToASCII().Replace(' ', '_'));
var name = $"IRTOCK3_CUSTOM_NAME_{locKey}";
SetName(name, null);

var ck3NameLocBlock = ck3LocDB.GetOrCreateLocBlock(name);
foreach (var language in ConverterGlobals.SupportedLanguages) {
ck3NameLocBlock[language] = loc;
}
} else {
var nameLoc = ImperatorCharacter.Name;
var name = nameLoc.Replace(' ', '_');
SetName(name, null);
if (!string.IsNullOrEmpty(name)) {
var ck3NameLocBlock = ck3LocDB.GetOrCreateLocBlock(name);
var matchedLocBlock = irLocDB.GetLocBlockForKey(name);
if (matchedLocBlock is not null) {
ck3NameLocBlock.CopyFrom(matchedLocBlock);
} else { // fallback: use unlocalized name as displayed name
unlocalizedImperatorNames.Add(name);
ck3NameLocBlock[ConverterGlobals.PrimaryLanguage] = nameLoc;
}
}
}

Female = ImperatorCharacter.Female;

// Determine valid (not dropped in province mappings) "source I:R province" and "source CK3 province"
// to be used by religion mapper. Don't give up without a fight.
ulong? irProvinceId = ImperatorCharacter.GetSourceLandProvince(irMapData);

var impProvForProvinceMapper = irProvinceId;
if ((!impProvForProvinceMapper.HasValue || provinceMapper.GetCK3ProvinceNumbers(impProvForProvinceMapper.Value).Count == 0) && ImperatorCharacter.Father is not null) {
impProvForProvinceMapper = ImperatorCharacter.Father.ProvinceId;
}
if ((!impProvForProvinceMapper.HasValue || provinceMapper.GetCK3ProvinceNumbers(impProvForProvinceMapper.Value).Count == 0) && ImperatorCharacter.Mother is not null) {
impProvForProvinceMapper = ImperatorCharacter.Mother.ProvinceId;
}
if ((!impProvForProvinceMapper.HasValue || provinceMapper.GetCK3ProvinceNumbers(impProvForProvinceMapper.Value).Count == 0) && ImperatorCharacter.Spouses.Count > 0) {
var firstSpouse = ImperatorCharacter.Spouses.First().Value;
impProvForProvinceMapper = firstSpouse.ProvinceId;
}

var ck3ProvinceNumbers = impProvForProvinceMapper.HasValue ? provinceMapper.GetCK3ProvinceNumbers(impProvForProvinceMapper.Value) : [];
ulong? ck3ProvinceId = ck3ProvinceNumbers.Count > 0 ? ck3ProvinceNumbers[0] : null;

var cultureMatch = cultureMapper.Match(
ImperatorCharacter.Culture,
ck3ProvinceId,
irProvinceId,
ImperatorCharacter.Country?.HistoricalTag
);
if (cultureMatch is null) {
Logger.Warn($"Could not determine CK3 culture for Imperator character {ImperatorCharacter.Id}" +
$" with culture {ImperatorCharacter.Culture}!");
} else {
SetCultureId(cultureMatch, null);
}

var faithMatch = religionMapper.Match(
ImperatorCharacter.Religion,
GetCultureId(dateOnConversion),
ck3ProvinceId,
irProvinceId,
ImperatorCharacter.HomeCountry?.HistoricalTag,
config
);
if (faithMatch is not null) {
SetFaithId(faithMatch, null);
}

// Determine character attributes.
History.AddFieldValue(null, "diplomacy", "diplomacy", ImperatorCharacter.Attributes.Charisma);
History.AddFieldValue(null, "martial", "martial", ImperatorCharacter.Attributes.Martial);
History.AddFieldValue(null, "stewardship", "stewardship", ImperatorCharacter.Attributes.Finesse);
var intrigue = (ImperatorCharacter.Attributes.Finesse + ImperatorCharacter.Attributes.Charisma) / 2;
History.AddFieldValue(null, "intrigue", "intrigue", intrigue);
History.AddFieldValue(null, "learning", "learning", ImperatorCharacter.Attributes.Zeal);

if (impCharacter.Fertility.HasValue) {
History.AddFieldValue(null, "fertility", "fertility", impCharacter.Fertility.Value);
}

if (impCharacter.Health is not null) {
// In I:R, health is a value between 0 and 100, with 100 being the best.
// In CK3, 0 means near death, ≥ 7 means excellent health.
// https://imperator.paradoxwikis.com/Characters#Secondary
// https://ck3.paradoxwikis.com/Attributes#Health
var ck3Health = impCharacter.Health.Value / 10;
History.AddFieldValue(null, "health", "health", ck3Health);
}

foreach (var traitId in traitMapper.GetCK3TraitsForImperatorTraits(ImperatorCharacter.Traits)) {
AddBaseTrait(traitId);
}

BirthDate = ImperatorCharacter.BirthDate;
DeathDate = ImperatorCharacter.DeathDate;
var impDeathReason = ImperatorCharacter.DeathReason;
if (impDeathReason is not null) {
DeathReason = deathReasonMapper.GetCK3ReasonForImperatorReason(impDeathReason);
}

var nicknameMatch = nicknameMapper.GetCK3NicknameForImperatorNickname(ImperatorCharacter.Nickname);
if (nicknameMatch is not null) {
var nicknameDate = ImperatorCharacter.DeathDate ?? dateOnConversion;
SetNickname(nicknameMatch, nicknameDate);
}

if (ImperatorCharacter.Wealth != 0) {
Gold = ImperatorCharacter.Wealth * config.ImperatorCurrencyRate;
}

// If character is imprisoned, set jailor.
SetJailor();
SetEmployerFromImperator();

void SetJailor() {
if (ImperatorCharacter.PrisonerHome is null) {
return;
}

var prisonCountry = ImperatorCharacter.Country;
if (prisonCountry is null) {
Logger.Warn($"Imperator character {ImperatorCharacter.Id} is imprisoned but has no country!");
} else if (prisonCountry.CK3Title is null) {
Logger.Debug($"Imperator character {ImperatorCharacter.Id}'s prison country does not exist in CK3!");
} else {
jailorId = prisonCountry.CK3Title.GetHolderId(dateOnConversion);
}
}

void SetEmployerFromImperator() {
var prisonerHome = ImperatorCharacter.PrisonerHome;
var homeCountry = ImperatorCharacter.HomeCountry;
if (prisonerHome?.CK3Title is not null) { // is imprisoned
SetEmployerId(prisonerHome.CK3Title.GetHolderId(dateOnConversion), null);
} else if (homeCountry?.CK3Title is not null) {
SetEmployerId(homeCountry.CK3Title.GetHolderId(dateOnConversion), null);
}
}
}

Check notice on line 525 in ImperatorToCK3/CK3/Characters/Character.cs

View check run for this annotation

codefactor.io / CodeFactor

ImperatorToCK3/CK3/Characters/Character.cs#L358-L525

Complex Method
public void SetCultureId(string cultureId, Date? date) {
History.AddFieldValue(date, "culture", "culture", cultureId);
}
Expand Down
4 changes: 2 additions & 2 deletions ImperatorToCK3/CK3/Characters/CharacterCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace ImperatorToCK3.CK3.Characters;

public sealed partial class CharacterCollection : ConcurrentIdObjectCollection<string, Character> {
public void ImportImperatorCharacters(
internal void ImportImperatorCharacters(
Imperator.World impWorld,
ReligionMapper religionMapper,
CultureMapper cultureMapper,
Expand Down Expand Up @@ -811,7 +811,7 @@ public void GenerateSuccessorsForOldCharacters(Title.LandedTitles titles, Cultur
});
}

public void ConvertImperatorCharacterDNA(DNAFactory dnaFactory) {
internal void ConvertImperatorCharacterDNA(DNAFactory dnaFactory) {
Logger.Info("Converting Imperator character DNA to CK3...");
foreach (var character in this) {
if (character.ImperatorCharacter is null) {
Expand Down
10 changes: 5 additions & 5 deletions ImperatorToCK3/CK3/Characters/DNA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace ImperatorToCK3.CK3.Characters;

public sealed class DNA {
public sealed class PaletteCoordinates {
internal sealed class DNA {
internal sealed class PaletteCoordinates {
// hair, skin and eye color palettes are 256x256
public int X { get; init; } = 128;
public int Y { get; init; } = 128;
Expand All @@ -32,9 +32,9 @@ public IEnumerable<string> DNALines {

public DNA(
string id,
IDictionary<string, DNAColorGeneValue> colorDNAValues,
IDictionary<string, DNAGeneValue> morphDNAValues,
IDictionary<string, DNAAccessoryGeneValue> accessoryDNAValues
Dictionary<string, DNAColorGeneValue> colorDNAValues,
Dictionary<string, DNAGeneValue> morphDNAValues,
Dictionary<string, DNAAccessoryGeneValue> accessoryDNAValues
) {
Id = id;
this.colorDNAValues = new(colorDNAValues);
Expand Down
6 changes: 3 additions & 3 deletions ImperatorToCK3/CK3/Characters/DNAFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace ImperatorToCK3.CK3.Characters;

public sealed class DNAFactory {
internal sealed class DNAFactory {
private readonly IPixelCollection<ushort> irHairPalettePixels;
private readonly IPixelCollection<ushort> irSkinPalettePixels;
private readonly IPixelCollection<ushort> irEyePalettePixels;
Expand Down Expand Up @@ -69,7 +69,7 @@
BuildColorConversionCaches(ck3HairPalettePixels, ck3SkinPalettePixels, ck3EyePalettePixels);
}

public DNA GenerateDNA(Imperator.Characters.Character irCharacter, PortraitData irPortraitData) {
internal DNA GenerateDNA(Imperator.Characters.Character irCharacter, PortraitData irPortraitData) {
var id = $"dna_{irCharacter.Id}";

var colorDNAValues = new Dictionary<string, DNAColorGeneValue>();
Expand Down Expand Up @@ -161,7 +161,7 @@
case "normal_eyes":
break;
case "eyepatch_1":
case "eyepatch_2": // TODO: check if this is correctly added to portrait modifiers if needed

Check warning on line 164 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 164 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (linux-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 164 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 164 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (win-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 164 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 164 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 164 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, linux)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 164 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test_and_check_coverage

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)
var eyePatchTemplate = ck3GenesDB.SpecialAccessoryGenes["special_headgear_eye_patch"]
.GeneTemplates["eye_patch"];
if (eyePatchTemplate.AgeSexWeightBlocks.TryGetValue(irCharacter.AgeSex, out WeightBlock? eyePatchWeightBlock)) {
Expand All @@ -170,7 +170,7 @@
}

break;
case "blindfold_1": // TODO: check if this is correctly added to portrait modifiers if needed

Check warning on line 173 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 173 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (linux-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 173 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 173 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (win-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 173 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 173 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 173 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, linux)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 173 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test_and_check_coverage

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)
var blindfoldTemplate = ck3GenesDB.SpecialAccessoryGenes["special_headgear_blindfold"]
.GeneTemplates["blindfold"];
if (blindfoldTemplate.AgeSexWeightBlocks.TryGetValue(irCharacter.AgeSex, out WeightBlock? blindfoldWeightBlock)) {
Expand All @@ -179,7 +179,7 @@
}

break;
case "blind_eyes": // TODO: check if this is correctly added to portrait modifiers if needed

Check warning on line 182 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 182 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (linux-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 182 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 182 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (win-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 182 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 182 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 182 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, linux)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 182 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test_and_check_coverage

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)
var blindEyesTemplate = ck3GenesDB.AccessoryGenes["eye_accessory"]
.GeneTemplates["blind_eyes"];
if (blindEyesTemplate.AgeSexWeightBlocks.TryGetValue(irCharacter.AgeSex, out WeightBlock? blindEyesWeightBlock)) {
Expand All @@ -188,7 +188,7 @@
}

break;
case "red_eyes": // TODO: check if this is correctly converted

Check warning on line 191 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-14)

Check warning on line 191 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (linux-x64)

Check warning on line 191 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (macos-14)

Check warning on line 191 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (win-x64)

Check warning on line 191 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, windows)

Check warning on line 191 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (self-hosted, windows)

Check warning on line 191 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, linux)

Check warning on line 191 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test_and_check_coverage

var magickRed = new MagickColor("#ff0000");
var redEyeCoordinates = GetCoordinatesOfClosestCK3Color(magickRed, ck3EyeColorToPaletteCoordinatesDict);
colorDNAValues["eye_color"] = colorDNAValues["eye_color"] with {
Expand All @@ -204,21 +204,21 @@
var blindEyesTemplate = ck3GenesDB.AccessoryGenes["eye_accessory"].GeneTemplates["blind_eyes"];
if (blindEyesTemplate.AgeSexWeightBlocks.TryGetValue(irCharacter.AgeSex, out WeightBlock? blindEyesWeighBlock)) {
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

Check warning on line 207 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 207 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (linux-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 207 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 207 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (win-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 207 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 207 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 207 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, linux)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 207 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test_and_check_coverage

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)
}

var blindfoldTemplate = ck3GenesDB.SpecialAccessoryGenes["special_headgear_blindfold"]
.GeneTemplates["blindfold"];
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

Check warning on line 214 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 214 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (linux-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 214 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 214 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (win-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 214 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 214 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 214 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, linux)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 214 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test_and_check_coverage

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)
}
} else if (irCharacter.Traits.Contains("one_eyed")) {
var eyePatchTemplate = ck3GenesDB.SpecialAccessoryGenes["special_headgear_eye_patch"]
.GeneTemplates["eye_patch"];
if (eyePatchTemplate.AgeSexWeightBlocks.TryGetValue(irCharacter.AgeSex, out WeightBlock? eyePatchWeighBlock)) {
var eyePatchObjectName = eyePatchWeighBlock.GetMatchingObject(1) ?? eyePatchWeighBlock.ObjectNames.Last();
accessoryDNAValues["special_headgear_eye_patch"] = new(eyePatchTemplate.Id, eyePatchObjectName, eyePatchWeighBlock); // TODO: check if this is correctly added to portrait modifiers if needed

Check warning on line 221 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 221 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (linux-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 221 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (macos-14)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 221 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (win-x64)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 221 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 221 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (self-hosted, windows)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 221 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, linux)

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 221 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test_and_check_coverage

TODO check if this is correctly added to portrait modifiers if needed (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)
}
}

Expand Down Expand Up @@ -319,7 +319,7 @@
}

private void ConvertBaldness(Imperator.Characters.Character irCharacter, Dictionary<string, DNAGeneValue> morphDNAValues, Dictionary<string, DNAAccessoryGeneValue> accessoryDNAValues) {
if (irCharacter.IsBald) { // TODO: CHECK IF BALD CHARACTERS STILL CORRECTLY APPEAR BALD IN CK3

Check warning on line 322 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (macos-14)

TODO CHECK IF BALD CHARACTERS STILL CORRECTLY APPEAR BALD IN CK3 (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 322 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (linux-x64)

TODO CHECK IF BALD CHARACTERS STILL CORRECTLY APPEAR BALD IN CK3 (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 322 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (macos-14)

TODO CHECK IF BALD CHARACTERS STILL CORRECTLY APPEAR BALD IN CK3 (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 322 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / Upload development build (win-x64)

TODO CHECK IF BALD CHARACTERS STILL CORRECTLY APPEAR BALD IN CK3 (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 322 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, windows)

TODO CHECK IF BALD CHARACTERS STILL CORRECTLY APPEAR BALD IN CK3 (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 322 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test (self-hosted, windows)

TODO CHECK IF BALD CHARACTERS STILL CORRECTLY APPEAR BALD IN CK3 (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 322 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / build (self-hosted, linux)

TODO CHECK IF BALD CHARACTERS STILL CORRECTLY APPEAR BALD IN CK3 (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)

Check warning on line 322 in ImperatorToCK3/CK3/Characters/DNAFactory.cs

View workflow job for this annotation

GitHub Actions / test_and_check_coverage

TODO CHECK IF BALD CHARACTERS STILL CORRECTLY APPEAR BALD IN CK3 (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md)
morphDNAValues["gene_baldness"] = new DNAGeneValue {
TemplateName = "male_pattern_baldness",
IntSliderValue = 127,
Expand Down Expand Up @@ -463,7 +463,7 @@

private static void BuildColorConversionCache(
IPixelCollection<ushort> ck3PalettePixels,
IDictionary<IMagickColor<ushort>, DNA.PaletteCoordinates> ck3ColorToCoordinatesDict
ConcurrentDictionary<IMagickColor<ushort>, DNA.PaletteCoordinates> ck3ColorToCoordinatesDict
) {
foreach (var pixel in ck3PalettePixels) {
var color = pixel.ToColor();
Expand Down
Loading