mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-17 06:04:20 +01:00
Use internal entries.
This commit is contained in:
parent
e0339160e9
commit
5ca9e63a2a
3 changed files with 48 additions and 32 deletions
|
|
@ -71,13 +71,13 @@ public readonly record struct EqdpIdentifier(PrimaryId SetId, EquipSlot Slot, Ge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly record struct InternalEqdpEntry(bool Model, bool Material)
|
public readonly record struct EqdpEntryInternal(bool Model, bool Material)
|
||||||
{
|
{
|
||||||
private InternalEqdpEntry((bool, bool) val)
|
private EqdpEntryInternal((bool, bool) val)
|
||||||
: this(val.Item1, val.Item2)
|
: this(val.Item1, val.Item2)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public InternalEqdpEntry(EqdpEntry entry, EquipSlot slot)
|
public EqdpEntryInternal(EqdpEntry entry, EquipSlot slot)
|
||||||
: this(entry.ToBits(slot))
|
: this(entry.ToBits(slot))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ namespace Penumbra.Meta.Manipulations;
|
||||||
public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
||||||
{
|
{
|
||||||
private readonly Dictionary<ImcIdentifier, ImcEntry> _imc = [];
|
private readonly Dictionary<ImcIdentifier, ImcEntry> _imc = [];
|
||||||
private readonly Dictionary<EqpIdentifier, EqpEntry> _eqp = [];
|
private readonly Dictionary<EqpIdentifier, EqpEntryInternal> _eqp = [];
|
||||||
private readonly Dictionary<EqdpIdentifier, EqdpEntry> _eqdp = [];
|
private readonly Dictionary<EqdpIdentifier, EqdpEntryInternal> _eqdp = [];
|
||||||
private readonly Dictionary<EstIdentifier, EstEntry> _est = [];
|
private readonly Dictionary<EstIdentifier, EstEntry> _est = [];
|
||||||
private readonly Dictionary<RspIdentifier, RspEntry> _rsp = [];
|
private readonly Dictionary<RspIdentifier, RspEntry> _rsp = [];
|
||||||
private readonly Dictionary<GmpIdentifier, GmpEntry> _gmp = [];
|
private readonly Dictionary<GmpIdentifier, GmpEntry> _gmp = [];
|
||||||
|
|
@ -30,10 +30,20 @@ public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
||||||
_globalEqp.Clear();
|
_globalEqp.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Equals(MetaDictionary other)
|
||||||
|
=> Count == other.Count
|
||||||
|
&& _imc.SetEquals(other._imc)
|
||||||
|
&& _eqp.SetEquals(other._eqp)
|
||||||
|
&& _eqdp.SetEquals(other._eqdp)
|
||||||
|
&& _est.SetEquals(other._est)
|
||||||
|
&& _rsp.SetEquals(other._rsp)
|
||||||
|
&& _gmp.SetEquals(other._gmp)
|
||||||
|
&& _globalEqp.SetEquals(other._globalEqp);
|
||||||
|
|
||||||
public IEnumerator<MetaManipulation> GetEnumerator()
|
public IEnumerator<MetaManipulation> GetEnumerator()
|
||||||
=> _imc.Select(kvp => new MetaManipulation(new ImcManipulation(kvp.Key, kvp.Value)))
|
=> _imc.Select(kvp => new MetaManipulation(new ImcManipulation(kvp.Key, kvp.Value)))
|
||||||
.Concat(_eqp.Select(kvp => new MetaManipulation(new EqpManipulation(kvp.Key, kvp.Value))))
|
.Concat(_eqp.Select(kvp => new MetaManipulation(new EqpManipulation(kvp.Key, kvp.Value.ToEntry(kvp.Key.Slot)))))
|
||||||
.Concat(_eqdp.Select(kvp => new MetaManipulation(new EqdpManipulation(kvp.Key, kvp.Value))))
|
.Concat(_eqdp.Select(kvp => new MetaManipulation(new EqdpManipulation(kvp.Key, kvp.Value.ToEntry(kvp.Key.Slot)))))
|
||||||
.Concat(_est.Select(kvp => new MetaManipulation(new EstManipulation(kvp.Key, kvp.Value))))
|
.Concat(_est.Select(kvp => new MetaManipulation(new EstManipulation(kvp.Key, kvp.Value))))
|
||||||
.Concat(_rsp.Select(kvp => new MetaManipulation(new RspManipulation(kvp.Key, kvp.Value))))
|
.Concat(_rsp.Select(kvp => new MetaManipulation(new RspManipulation(kvp.Key, kvp.Value))))
|
||||||
.Concat(_gmp.Select(kvp => new MetaManipulation(new GmpManipulation(kvp.Key, kvp.Value))))
|
.Concat(_gmp.Select(kvp => new MetaManipulation(new GmpManipulation(kvp.Key, kvp.Value))))
|
||||||
|
|
@ -47,8 +57,8 @@ public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
||||||
var ret = manip.ManipulationType switch
|
var ret = manip.ManipulationType switch
|
||||||
{
|
{
|
||||||
MetaManipulation.Type.Imc => _imc.TryAdd(manip.Imc.Identifier, manip.Imc.Entry),
|
MetaManipulation.Type.Imc => _imc.TryAdd(manip.Imc.Identifier, manip.Imc.Entry),
|
||||||
MetaManipulation.Type.Eqdp => _eqdp.TryAdd(manip.Eqdp.Identifier, manip.Eqdp.Entry),
|
MetaManipulation.Type.Eqdp => _eqdp.TryAdd(manip.Eqdp.Identifier, new EqdpEntryInternal(manip.Eqdp.Entry, manip.Eqdp.Slot)),
|
||||||
MetaManipulation.Type.Eqp => _eqp.TryAdd(manip.Eqp.Identifier, manip.Eqp.Entry),
|
MetaManipulation.Type.Eqp => _eqp.TryAdd(manip.Eqp.Identifier, new EqpEntryInternal(manip.Eqp.Entry, manip.Eqp.Slot)),
|
||||||
MetaManipulation.Type.Est => _est.TryAdd(manip.Est.Identifier, manip.Est.Entry),
|
MetaManipulation.Type.Est => _est.TryAdd(manip.Est.Identifier, manip.Est.Entry),
|
||||||
MetaManipulation.Type.Gmp => _gmp.TryAdd(manip.Gmp.Identifier, manip.Gmp.Entry),
|
MetaManipulation.Type.Gmp => _gmp.TryAdd(manip.Gmp.Identifier, manip.Gmp.Entry),
|
||||||
MetaManipulation.Type.Rsp => _rsp.TryAdd(manip.Rsp.Identifier, manip.Rsp.Entry),
|
MetaManipulation.Type.Rsp => _rsp.TryAdd(manip.Rsp.Identifier, manip.Rsp.Entry),
|
||||||
|
|
@ -71,22 +81,10 @@ public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryAdd(EqpIdentifier identifier, EqpEntry entry)
|
public bool TryAdd(EqpIdentifier identifier, EqpEntry entry)
|
||||||
{
|
=> TryAdd(identifier, new EqpEntryInternal(entry, identifier.Slot));
|
||||||
if (!_eqp.TryAdd(identifier, entry))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
++Count;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryAdd(EqdpIdentifier identifier, EqdpEntry entry)
|
public bool TryAdd(EqdpIdentifier identifier, EqdpEntry entry)
|
||||||
{
|
=> TryAdd(identifier, new EqdpEntryInternal(entry, identifier.Slot));
|
||||||
if (!_eqdp.TryAdd(identifier, entry))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
++Count;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryAdd(EstIdentifier identifier, EstEntry entry)
|
public bool TryAdd(EstIdentifier identifier, EstEntry entry)
|
||||||
{
|
{
|
||||||
|
|
@ -163,7 +161,7 @@ public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
||||||
case MetaManipulation.Type.Eqdp:
|
case MetaManipulation.Type.Eqdp:
|
||||||
if (_eqp.TryGetValue(identifier.Eqp.Identifier, out var oldEqdp))
|
if (_eqp.TryGetValue(identifier.Eqp.Identifier, out var oldEqdp))
|
||||||
{
|
{
|
||||||
oldValue = new MetaManipulation(new EqpManipulation(identifier.Eqp.Identifier, oldEqdp));
|
oldValue = new MetaManipulation(new EqpManipulation(identifier.Eqp.Identifier, oldEqdp.ToEntry(identifier.Eqp.Slot)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,7 +169,7 @@ public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
||||||
case MetaManipulation.Type.Eqp:
|
case MetaManipulation.Type.Eqp:
|
||||||
if (_eqdp.TryGetValue(identifier.Eqdp.Identifier, out var oldEqp))
|
if (_eqdp.TryGetValue(identifier.Eqdp.Identifier, out var oldEqp))
|
||||||
{
|
{
|
||||||
oldValue = new MetaManipulation(new EqdpManipulation(identifier.Eqdp.Identifier, oldEqp));
|
oldValue = new MetaManipulation(new EqdpManipulation(identifier.Eqdp.Identifier, oldEqp.ToEntry(identifier.Eqdp.Slot)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -355,4 +353,22 @@ public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool TryAdd(EqpIdentifier identifier, EqpEntryInternal entry)
|
||||||
|
{
|
||||||
|
if (!_eqp.TryAdd(identifier, entry))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
++Count;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryAdd(EqdpIdentifier identifier, EqdpEntryInternal entry)
|
||||||
|
{
|
||||||
|
if (!_eqdp.TryAdd(identifier, entry))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
++Count;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ public partial class ModCreator(
|
||||||
Penumbra.Log.Verbose(
|
Penumbra.Log.Verbose(
|
||||||
$"Incorporating {file} as Metadata file of {meta.MetaManipulations.Count} manipulations {deleteString}");
|
$"Incorporating {file} as Metadata file of {meta.MetaManipulations.Count} manipulations {deleteString}");
|
||||||
deleteList.Add(file.FullName);
|
deleteList.Add(file.FullName);
|
||||||
option.Manipulations.UnionWith(meta.MetaManipulations);
|
option.Manipulations.UnionWith([.. meta.MetaManipulations]);
|
||||||
}
|
}
|
||||||
else if (ext1 == ".rgsp" || ext2 == ".rgsp")
|
else if (ext1 == ".rgsp" || ext2 == ".rgsp")
|
||||||
{
|
{
|
||||||
|
|
@ -212,7 +212,7 @@ public partial class ModCreator(
|
||||||
$"Incorporating {file} as racial scaling file of {rgsp.MetaManipulations.Count} manipulations {deleteString}");
|
$"Incorporating {file} as racial scaling file of {rgsp.MetaManipulations.Count} manipulations {deleteString}");
|
||||||
deleteList.Add(file.FullName);
|
deleteList.Add(file.FullName);
|
||||||
|
|
||||||
option.Manipulations.UnionWith(rgsp.MetaManipulations);
|
option.Manipulations.UnionWith([.. rgsp.MetaManipulations]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue