mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-01-03 06:13:45 +01:00
Start removing MetaManipulation functions.
This commit is contained in:
parent
13156a58e9
commit
e0339160e9
2 changed files with 21 additions and 22 deletions
|
|
@ -124,28 +124,28 @@ public sealed class MetaDictionary : IEnumerable<MetaManipulation>
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Remove(MetaManipulation manip)
|
public void UnionWith(MetaDictionary manips)
|
||||||
{
|
{
|
||||||
var ret = manip.ManipulationType switch
|
foreach (var (identifier, entry) in manips._imc)
|
||||||
{
|
TryAdd(identifier, entry);
|
||||||
MetaManipulation.Type.Imc => _imc.Remove(manip.Imc.Identifier),
|
|
||||||
MetaManipulation.Type.Eqdp => _eqdp.Remove(manip.Eqdp.Identifier),
|
|
||||||
MetaManipulation.Type.Eqp => _eqp.Remove(manip.Eqp.Identifier),
|
|
||||||
MetaManipulation.Type.Est => _est.Remove(manip.Est.Identifier),
|
|
||||||
MetaManipulation.Type.Gmp => _gmp.Remove(manip.Gmp.Identifier),
|
|
||||||
MetaManipulation.Type.Rsp => _rsp.Remove(manip.Rsp.Identifier),
|
|
||||||
MetaManipulation.Type.GlobalEqp => _globalEqp.Remove(manip.GlobalEqp),
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
if (ret)
|
|
||||||
--Count;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UnionWith(IEnumerable<MetaManipulation> manips)
|
foreach (var (identifier, entry) in manips._eqp)
|
||||||
{
|
TryAdd(identifier, entry);
|
||||||
foreach (var manip in manips)
|
|
||||||
Add(manip);
|
foreach (var (identifier, entry) in manips._eqdp)
|
||||||
|
TryAdd(identifier, entry);
|
||||||
|
|
||||||
|
foreach (var (identifier, entry) in manips._gmp)
|
||||||
|
TryAdd(identifier, entry);
|
||||||
|
|
||||||
|
foreach (var (identifier, entry) in manips._rsp)
|
||||||
|
TryAdd(identifier, entry);
|
||||||
|
|
||||||
|
foreach (var (identifier, entry) in manips._est)
|
||||||
|
TryAdd(identifier, entry);
|
||||||
|
|
||||||
|
foreach (var identifier in manips._globalEqp)
|
||||||
|
TryAdd(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetValue(MetaManipulation identifier, out MetaManipulation oldValue)
|
public bool TryGetValue(MetaManipulation identifier, out MetaManipulation oldValue)
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,7 @@ public class ModGroupEditor(
|
||||||
/// <summary> Set the meta manipulations for a given option. Replaces existing manipulations. </summary>
|
/// <summary> Set the meta manipulations for a given option. Replaces existing manipulations. </summary>
|
||||||
public void SetManipulations(IModDataContainer subMod, MetaDictionary manipulations, SaveType saveType = SaveType.Queue)
|
public void SetManipulations(IModDataContainer subMod, MetaDictionary manipulations, SaveType saveType = SaveType.Queue)
|
||||||
{
|
{
|
||||||
if (subMod.Manipulations.Count == manipulations.Count
|
if (subMod.Manipulations.Equals(manipulations))
|
||||||
&& subMod.Manipulations.All(m => manipulations.TryGetValue(m, out var old) && old.EntryEquals(m)))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
communicator.ModOptionChanged.Invoke(ModOptionChangeType.PrepareChange, (Mod)subMod.Mod, subMod.Group, null, subMod, -1);
|
communicator.ModOptionChanged.Invoke(ModOptionChangeType.PrepareChange, (Mod)subMod.Mod, subMod.Group, null, subMod, -1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue