Fix swapping universal hairstyles for midlanders breaking them for others.

This commit is contained in:
Ottermandias 2023-01-01 13:55:23 +01:00
parent 6493394256
commit 29d01e698b
2 changed files with 6 additions and 5 deletions

View file

@ -22,10 +22,11 @@ public static class MaterialHandling
// All hairstyles above 116 are shared except for Hrothgar
if (hairId.Value is >= 116 and <= 200)
{
return actualGr.Split().Item1 == Gender.Female ? GenderRace.MidlanderFemale : GenderRace.MidlanderMale;
}
return actualGr;
}
public static bool IsSpecialCase(GenderRace gr, SetId hairId)
=> gr is GenderRace.MidlanderMale or GenderRace.MidlanderFemale && hairId.Value is >= 101 and <= 200;
}

View file

@ -60,9 +60,9 @@ public static class CustomizationSwap
var mtrlToPath = GamePaths.Character.Mtrl.Path( race, slot, idTo, fileName, out var gameRaceTo, out var gameSetIdTo, variant );
var newFileName = fileName;
newFileName = ItemSwap.ReplaceRace( newFileName, gameRaceTo, race, gameRaceTo != race );
newFileName = ItemSwap.ReplaceBody( newFileName, slot, idTo, idFrom, idFrom.Value != idTo.Value );
newFileName = ItemSwap.AddSuffix( newFileName, ".mtrl", $"_c{race.ToRaceCode()}", gameRaceFrom != race );
newFileName = ItemSwap.ReplaceRace( newFileName, gameRaceTo, race, gameRaceTo != race );
newFileName = ItemSwap.ReplaceBody( newFileName, slot, idTo, idFrom, idFrom.Value != idTo.Value );
newFileName = ItemSwap.AddSuffix( newFileName, ".mtrl", $"_c{race.ToRaceCode()}", gameRaceFrom != race || MaterialHandling.IsSpecialCase( race, idFrom ) );
newFileName = ItemSwap.AddSuffix( newFileName, ".mtrl", $"_{slot.ToAbbreviation()}{idFrom.Value:D4}", gameSetIdFrom.Value != idFrom.Value );
var actualMtrlFromPath = mtrlFromPath;