mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Fix metadata conflicts causing problems.
This commit is contained in:
parent
4c90cc84f1
commit
50d042c104
2 changed files with 34 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
|
@ -109,7 +110,7 @@ public unsafe class ExpandedEqpGmpBase : MetaBaseFile
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class ExpandedEqpFile : ExpandedEqpGmpBase
|
||||
public sealed class ExpandedEqpFile : ExpandedEqpGmpBase, IEnumerable<EqpEntry>
|
||||
{
|
||||
public ExpandedEqpFile()
|
||||
: base( false )
|
||||
|
|
@ -121,6 +122,7 @@ public sealed class ExpandedEqpFile : ExpandedEqpGmpBase
|
|||
set => SetInternal( idx, ( ulong )value );
|
||||
}
|
||||
|
||||
|
||||
public static EqpEntry GetDefault( int setIdx )
|
||||
=> ( EqpEntry )GetDefaultInternal( CharacterUtility.EqpIdx, setIdx, ( ulong )Eqp.DefaultEntry );
|
||||
|
||||
|
|
@ -141,9 +143,18 @@ public sealed class ExpandedEqpFile : ExpandedEqpGmpBase
|
|||
this[ entry ] = GetDefault( entry );
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator< EqpEntry > GetEnumerator()
|
||||
{
|
||||
for( var idx = 1; idx < Count; ++idx )
|
||||
yield return this[ idx ];
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
=> GetEnumerator();
|
||||
}
|
||||
|
||||
public sealed class ExpandedGmpFile : ExpandedEqpGmpBase
|
||||
public sealed class ExpandedGmpFile : ExpandedEqpGmpBase, IEnumerable<GmpEntry>
|
||||
{
|
||||
public ExpandedGmpFile()
|
||||
: base( true )
|
||||
|
|
@ -165,4 +176,13 @@ public sealed class ExpandedGmpFile : ExpandedEqpGmpBase
|
|||
this[ entry ] = GetDefault( entry );
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator<GmpEntry> GetEnumerator()
|
||||
{
|
||||
for( var idx = 1; idx < Count; ++idx )
|
||||
yield return this[idx];
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
=> GetEnumerator();
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Dalamud.Logging;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.Meta.Files;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
|
|
@ -76,6 +77,11 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
|
|||
|
||||
public bool ApplyMod( MetaManipulation manip, IMod mod )
|
||||
{
|
||||
if( _manipulations.ContainsKey( manip ) )
|
||||
{
|
||||
_manipulations.Remove( manip );
|
||||
}
|
||||
|
||||
_manipulations[ manip ] = mod;
|
||||
// Imc manipulations do not require character utility.
|
||||
if( manip.ManipulationType == MetaManipulation.Type.Imc )
|
||||
|
|
@ -134,9 +140,10 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
|
|||
return;
|
||||
}
|
||||
|
||||
var loaded = 0;
|
||||
foreach( var manip in Manipulations.Where( m => m.ManipulationType != MetaManipulation.Type.Imc ) )
|
||||
{
|
||||
var _ = manip.ManipulationType switch
|
||||
loaded += manip.ManipulationType switch
|
||||
{
|
||||
MetaManipulation.Type.Eqp => ApplyMod( manip.Eqp ),
|
||||
MetaManipulation.Type.Gmp => ApplyMod( manip.Gmp ),
|
||||
|
|
@ -145,7 +152,9 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
|
|||
MetaManipulation.Type.Rsp => ApplyMod( manip.Rsp ),
|
||||
MetaManipulation.Type.Unknown => false,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
? 1
|
||||
: 0;
|
||||
}
|
||||
|
||||
if( Penumbra.CollectionManager.Default == _collection )
|
||||
|
|
@ -155,6 +164,7 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
|
|||
}
|
||||
|
||||
Penumbra.CharacterUtility.LoadingFinished -= ApplyStoredManipulations;
|
||||
PluginLog.Debug( "{Collection}: Loaded {Num} delayed meta manipulations.", _collection.Name, loaded );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization )]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue