mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Add support for Global EQP Changes.
This commit is contained in:
parent
f9527970cb
commit
ed083f2a4c
15 changed files with 471 additions and 133 deletions
|
|
@ -6,19 +6,21 @@ namespace Penumbra.Mods.Editor;
|
|||
|
||||
public class ModMetaEditor(ModManager modManager)
|
||||
{
|
||||
private readonly HashSet<ImcManipulation> _imc = [];
|
||||
private readonly HashSet<EqpManipulation> _eqp = [];
|
||||
private readonly HashSet<EqdpManipulation> _eqdp = [];
|
||||
private readonly HashSet<GmpManipulation> _gmp = [];
|
||||
private readonly HashSet<EstManipulation> _est = [];
|
||||
private readonly HashSet<RspManipulation> _rsp = [];
|
||||
private readonly HashSet<ImcManipulation> _imc = [];
|
||||
private readonly HashSet<EqpManipulation> _eqp = [];
|
||||
private readonly HashSet<EqdpManipulation> _eqdp = [];
|
||||
private readonly HashSet<GmpManipulation> _gmp = [];
|
||||
private readonly HashSet<EstManipulation> _est = [];
|
||||
private readonly HashSet<RspManipulation> _rsp = [];
|
||||
private readonly HashSet<GlobalEqpManipulation> _globalEqp = [];
|
||||
|
||||
public int OtherImcCount { get; private set; }
|
||||
public int OtherEqpCount { get; private set; }
|
||||
public int OtherEqdpCount { get; private set; }
|
||||
public int OtherGmpCount { get; private set; }
|
||||
public int OtherEstCount { get; private set; }
|
||||
public int OtherRspCount { get; private set; }
|
||||
public int OtherImcCount { get; private set; }
|
||||
public int OtherEqpCount { get; private set; }
|
||||
public int OtherEqdpCount { get; private set; }
|
||||
public int OtherGmpCount { get; private set; }
|
||||
public int OtherEstCount { get; private set; }
|
||||
public int OtherRspCount { get; private set; }
|
||||
public int OtherGlobalEqpCount { get; private set; }
|
||||
|
||||
public bool Changes { get; private set; }
|
||||
|
||||
|
|
@ -40,17 +42,21 @@ public class ModMetaEditor(ModManager modManager)
|
|||
public IReadOnlySet<RspManipulation> Rsp
|
||||
=> _rsp;
|
||||
|
||||
public IReadOnlySet<GlobalEqpManipulation> GlobalEqp
|
||||
=> _globalEqp;
|
||||
|
||||
public bool CanAdd(MetaManipulation m)
|
||||
{
|
||||
return m.ManipulationType switch
|
||||
{
|
||||
MetaManipulation.Type.Imc => !_imc.Contains(m.Imc),
|
||||
MetaManipulation.Type.Eqdp => !_eqdp.Contains(m.Eqdp),
|
||||
MetaManipulation.Type.Eqp => !_eqp.Contains(m.Eqp),
|
||||
MetaManipulation.Type.Est => !_est.Contains(m.Est),
|
||||
MetaManipulation.Type.Gmp => !_gmp.Contains(m.Gmp),
|
||||
MetaManipulation.Type.Rsp => !_rsp.Contains(m.Rsp),
|
||||
_ => false,
|
||||
MetaManipulation.Type.Imc => !_imc.Contains(m.Imc),
|
||||
MetaManipulation.Type.Eqdp => !_eqdp.Contains(m.Eqdp),
|
||||
MetaManipulation.Type.Eqp => !_eqp.Contains(m.Eqp),
|
||||
MetaManipulation.Type.Est => !_est.Contains(m.Est),
|
||||
MetaManipulation.Type.Gmp => !_gmp.Contains(m.Gmp),
|
||||
MetaManipulation.Type.Rsp => !_rsp.Contains(m.Rsp),
|
||||
MetaManipulation.Type.GlobalEqp => !_globalEqp.Contains(m.GlobalEqp),
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -58,13 +64,14 @@ public class ModMetaEditor(ModManager modManager)
|
|||
{
|
||||
var added = m.ManipulationType switch
|
||||
{
|
||||
MetaManipulation.Type.Imc => _imc.Add(m.Imc),
|
||||
MetaManipulation.Type.Eqdp => _eqdp.Add(m.Eqdp),
|
||||
MetaManipulation.Type.Eqp => _eqp.Add(m.Eqp),
|
||||
MetaManipulation.Type.Est => _est.Add(m.Est),
|
||||
MetaManipulation.Type.Gmp => _gmp.Add(m.Gmp),
|
||||
MetaManipulation.Type.Rsp => _rsp.Add(m.Rsp),
|
||||
_ => false,
|
||||
MetaManipulation.Type.Imc => _imc.Add(m.Imc),
|
||||
MetaManipulation.Type.Eqdp => _eqdp.Add(m.Eqdp),
|
||||
MetaManipulation.Type.Eqp => _eqp.Add(m.Eqp),
|
||||
MetaManipulation.Type.Est => _est.Add(m.Est),
|
||||
MetaManipulation.Type.Gmp => _gmp.Add(m.Gmp),
|
||||
MetaManipulation.Type.Rsp => _rsp.Add(m.Rsp),
|
||||
MetaManipulation.Type.GlobalEqp => _globalEqp.Add(m.GlobalEqp),
|
||||
_ => false,
|
||||
};
|
||||
Changes |= added;
|
||||
return added;
|
||||
|
|
@ -74,13 +81,14 @@ public class ModMetaEditor(ModManager modManager)
|
|||
{
|
||||
var deleted = m.ManipulationType switch
|
||||
{
|
||||
MetaManipulation.Type.Imc => _imc.Remove(m.Imc),
|
||||
MetaManipulation.Type.Eqdp => _eqdp.Remove(m.Eqdp),
|
||||
MetaManipulation.Type.Eqp => _eqp.Remove(m.Eqp),
|
||||
MetaManipulation.Type.Est => _est.Remove(m.Est),
|
||||
MetaManipulation.Type.Gmp => _gmp.Remove(m.Gmp),
|
||||
MetaManipulation.Type.Rsp => _rsp.Remove(m.Rsp),
|
||||
_ => false,
|
||||
MetaManipulation.Type.Imc => _imc.Remove(m.Imc),
|
||||
MetaManipulation.Type.Eqdp => _eqdp.Remove(m.Eqdp),
|
||||
MetaManipulation.Type.Eqp => _eqp.Remove(m.Eqp),
|
||||
MetaManipulation.Type.Est => _est.Remove(m.Est),
|
||||
MetaManipulation.Type.Gmp => _gmp.Remove(m.Gmp),
|
||||
MetaManipulation.Type.Rsp => _rsp.Remove(m.Rsp),
|
||||
MetaManipulation.Type.GlobalEqp => _globalEqp.Remove(m.GlobalEqp),
|
||||
_ => false,
|
||||
};
|
||||
Changes |= deleted;
|
||||
return deleted;
|
||||
|
|
@ -100,17 +108,19 @@ public class ModMetaEditor(ModManager modManager)
|
|||
_gmp.Clear();
|
||||
_est.Clear();
|
||||
_rsp.Clear();
|
||||
_globalEqp.Clear();
|
||||
Changes = true;
|
||||
}
|
||||
|
||||
public void Load(Mod mod, IModDataContainer currentOption)
|
||||
{
|
||||
OtherImcCount = 0;
|
||||
OtherEqpCount = 0;
|
||||
OtherEqdpCount = 0;
|
||||
OtherGmpCount = 0;
|
||||
OtherEstCount = 0;
|
||||
OtherRspCount = 0;
|
||||
OtherImcCount = 0;
|
||||
OtherEqpCount = 0;
|
||||
OtherEqdpCount = 0;
|
||||
OtherGmpCount = 0;
|
||||
OtherEstCount = 0;
|
||||
OtherRspCount = 0;
|
||||
OtherGlobalEqpCount = 0;
|
||||
foreach (var option in mod.AllDataContainers)
|
||||
{
|
||||
if (option == currentOption)
|
||||
|
|
@ -138,6 +148,9 @@ public class ModMetaEditor(ModManager modManager)
|
|||
case MetaManipulation.Type.Rsp:
|
||||
++OtherRspCount;
|
||||
break;
|
||||
case MetaManipulation.Type.GlobalEqp:
|
||||
++OtherGlobalEqpCount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -179,6 +192,9 @@ public class ModMetaEditor(ModManager modManager)
|
|||
case MetaManipulation.Type.Rsp:
|
||||
_rsp.Add(manip.Rsp);
|
||||
break;
|
||||
case MetaManipulation.Type.GlobalEqp:
|
||||
_globalEqp.Add(manip.GlobalEqp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -191,5 +207,6 @@ public class ModMetaEditor(ModManager modManager)
|
|||
.Concat(_eqp.Select(m => (MetaManipulation)m))
|
||||
.Concat(_est.Select(m => (MetaManipulation)m))
|
||||
.Concat(_gmp.Select(m => (MetaManipulation)m))
|
||||
.Concat(_rsp.Select(m => (MetaManipulation)m));
|
||||
.Concat(_rsp.Select(m => (MetaManipulation)m))
|
||||
.Concat(_globalEqp.Select(m => (MetaManipulation)m));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue