Skip to content

Commit fdaa98b

Browse files
Fix IMC group disable options...
1 parent beef0d9 commit fdaa98b

File tree

2 files changed

+15
-31
lines changed

2 files changed

+15
-31
lines changed

xivModdingFramework/Mods/FileTypes/PMP.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,14 @@ private static void ValidateOption(PmpStandardOptionJson op)
401401
var value = 1UL << i;
402402
if ((selected & value) > 0)
403403
{
404-
var disableOpt = group.Options[i] as PmpDisableImcOptionJson;
405-
if (disableOpt != null)
404+
var opt = group.Options[i] as PmpImcOptionJson;
405+
if (opt.IsDisableSubMod)
406406
{
407407
// No options allowed >:|
408408
disabled = true;
409409
break;
410410
}
411411

412-
var opt = group.Options[i] as PmpImcOptionJson;
413412
optionIdx++;
414413

415414
xivImc.AttributeMask |= opt.AttributeMask;
@@ -1479,16 +1478,13 @@ public class PmpMultiOptionJson : PmpStandardOptionJson
14791478
public int Priority = 0;
14801479
}
14811480

1482-
public class PmpDisableImcOptionJson : PMPOptionJson
1483-
{
1484-
public bool IsDisableSubMod = true;
1485-
}
1486-
1487-
[JsonConverter(typeof(JsonSubtypes))]
1488-
[JsonSubtypes.KnownSubTypeWithProperty(typeof(PmpDisableImcOptionJson), "IsDisableSubMod")]
14891481
public class PmpImcOptionJson : PMPOptionJson
14901482
{
1491-
public ushort AttributeMask;
1483+
public bool IsDisableSubMod = false;
1484+
public ushort AttributeMask = 0;
1485+
1486+
public bool ShouldSerializeIsDisableSubMod() { return IsDisableSubMod; }
1487+
public bool ShouldSerializeAttributeMask() { return !IsDisableSubMod; }
14921488
}
14931489

14941490
#endregion

xivModdingFramework/Mods/WizardData.cs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -514,17 +514,12 @@ public async Task<PMPOptionJson> ToPmpOption(string tempFolder, IEnumerable<File
514514
PMPOptionJson op;
515515
if (GroupType == EGroupType.Imc)
516516
{
517-
if (ImcData.IsDisableOption)
518-
{
519-
var io = new PmpDisableImcOptionJson();
520-
op = io;
521-
}
522-
else
523-
{
524-
var io = new PmpImcOptionJson();
525-
op = io;
517+
var io = new PmpImcOptionJson();
518+
op = io;
519+
if (!ImcData.IsDisableOption)
526520
io.AttributeMask = ImcData.AttributeMask;
527-
}
521+
else
522+
io.IsDisableSubMod = true;
528523
}
529524
else
530525
{
@@ -831,17 +826,10 @@ public static async Task<WizardGroupEntry> FromPMPGroup(PMPGroupJson pGroup, str
831826
{
832827
var imcData = new WizardImcOptionData();
833828
var imcOp = o as PmpImcOptionJson;
834-
if (imcOp != null)
835-
{
836-
imcData.IsDisableOption = false;
829+
if (!imcOp.IsDisableSubMod)
837830
imcData.AttributeMask = imcOp.AttributeMask;
838-
}
839-
var defOp = o as PmpDisableImcOptionJson;
840-
if (defOp != null)
841-
{
842-
imcData.IsDisableOption = defOp.IsDisableSubMod;
843-
imcData.AttributeMask = 0;
844-
}
831+
else
832+
imcData.IsDisableOption = imcOp.IsDisableSubMod;
845833
wizOp.ImcData = imcData;
846834
}
847835

0 commit comments

Comments
 (0)