Change phyb and sklb resolving for item swap.

This commit is contained in:
Ottermandias 2023-03-03 13:43:20 +01:00
parent 1f942491ac
commit cdc4ee6991
3 changed files with 17 additions and 16 deletions

View file

@ -64,6 +64,12 @@ public static class EquipmentSwap
var imcFileTo = new ImcFile( imcManip);
var isAccessory = slot.IsAccessory();
var estType = slot switch
{
EquipSlot.Head => EstManipulation.EstType.Head,
EquipSlot.Body => EstManipulation.EstType.Body,
_ => ( EstManipulation.EstType )0,
};
var skipFemale = false;
var skipMale = false;
@ -83,6 +89,7 @@ public static class EquipmentSwap
continue;
}
try
{
var eqdp = CreateEqdp( redirections, manips, slot, gr, idFrom, idTo, mtrlVariantTo );
@ -90,6 +97,13 @@ public static class EquipmentSwap
{
swaps.Add( eqdp );
}
var ownMdl = eqdp?.SwapApplied.Eqdp.Entry.ToBits( slot ).Item2 ?? false;
var est = ItemSwap.CreateEst( redirections, manips, estType, gr, idFrom, idTo, ownMdl );
if( est != null )
{
swaps.Add( est );
}
}
catch( ItemSwap.MissingFileException e )
{
@ -128,19 +142,6 @@ public static class EquipmentSwap
{
var mdl = CreateMdl( redirections, slot, gr, idFrom, idTo, mtrlTo );
meta.ChildSwaps.Add( mdl );
var estType = slot switch
{
EquipSlot.Head => EstManipulation.EstType.Head,
EquipSlot.Body => EstManipulation.EstType.Body,
_ => ( EstManipulation.EstType )0,
};
var est = ItemSwap.CreateEst( redirections, manips, estType, gr, idFrom, idTo );
if( est != null )
{
meta.ChildSwaps.Add( est );
}
}
else if( !ownMtrl && meta.SwapAppliedIsDefault )
{

View file

@ -159,7 +159,7 @@ public static class ItemSwap
/// <remarks> metaChanges is not manipulated, but IReadOnlySet does not support TryGetValue. </remarks>
public static MetaSwap? CreateEst( Func< Utf8GamePath, FullPath > redirections, Func< MetaManipulation, MetaManipulation > manips, EstManipulation.EstType type,
GenderRace genderRace, SetId idFrom, SetId idTo )
GenderRace genderRace, SetId idFrom, SetId idTo, bool ownMdl )
{
if( type == 0 )
{
@ -171,7 +171,7 @@ public static class ItemSwap
var toDefault = new EstManipulation( gender, race, type, idTo.Value, EstFile.GetDefault( type, genderRace, idTo.Value ) );
var est = new MetaSwap( manips, fromDefault, toDefault );
if( est.SwapApplied.Est.Entry >= 2 )
if( ownMdl && est.SwapApplied.Est.Entry >= 2 )
{
var phyb = CreatePhyb( redirections, type, genderRace, est.SwapApplied.Est.Entry );
est.ChildSwaps.Add( phyb );

View file

@ -145,7 +145,7 @@ public class ItemSwapContainer
};
var metaResolver = MetaResolver( collection );
var est = ItemSwap.CreateEst( pathResolver, metaResolver, type, race, from, to );
var est = ItemSwap.CreateEst( pathResolver, metaResolver, type, race, from, to, true );
Swaps.Add( mdl );
if( est != null )