diff --git a/Glamourer/Designs/DesignBase.cs b/Glamourer/Designs/DesignBase.cs
index 1e45052..135c858 100644
--- a/Glamourer/Designs/DesignBase.cs
+++ b/Glamourer/Designs/DesignBase.cs
@@ -170,7 +170,7 @@ public class DesignBase
=> ApplyCustomize.HasFlag(idx.ToFlag());
public bool DoApplyCrest(EquipSlot slot)
- => ApplyCrest.HasFlag(slot.ToFlag());
+ => ApplyCrest.HasFlag(slot.ToCrestFlag());
internal bool SetApplyEquip(EquipSlot slot, bool value)
{
diff --git a/Glamourer/Designs/DesignManager.cs b/Glamourer/Designs/DesignManager.cs
index 7a0f500..7159bac 100644
--- a/Glamourer/Designs/DesignManager.cs
+++ b/Glamourer/Designs/DesignManager.cs
@@ -446,6 +446,31 @@ public class DesignManager
_event.Invoke(DesignChanged.Type.ApplyStain, design, slot);
}
+ /// Change the crest visibility for any equipment piece.
+ public void ChangeCrest(Design design, EquipSlot slot, bool crest)
+ {
+ var oldCrest = design.DesignData.Crest(slot);
+ if (!design.GetDesignDataRef().SetCrest(slot, crest))
+ return;
+
+ design.LastEdit = DateTimeOffset.UtcNow;
+ _saveService.QueueSave(design);
+ Glamourer.Log.Debug($"Set crest visibility of {slot} equipment piece to {crest}.");
+ _event.Invoke(DesignChanged.Type.Crest, design, (oldCrest, crest, slot));
+ }
+
+ /// Change whether to apply a specific crest visibility.
+ public void ChangeApplyCrest(Design design, EquipSlot slot, bool value)
+ {
+ if (!design.SetApplyCrest(slot, value))
+ return;
+
+ design.LastEdit = DateTimeOffset.UtcNow;
+ _saveService.QueueSave(design);
+ Glamourer.Log.Debug($"Set applying of crest visibility of {slot} equipment piece to {value}.");
+ _event.Invoke(DesignChanged.Type.ApplyCrest, design, slot);
+ }
+
/// Change the bool value of one of the meta flags.
public void ChangeMeta(Design design, ActorState.MetaIndex metaIndex, bool value)
{
@@ -514,6 +539,9 @@ public class DesignManager
if (other.DoApplyStain(slot))
ChangeStain(design, slot, other.DesignData.Stain(slot));
+
+ if (other.DoApplyCrest(slot))
+ ChangeCrest(design, slot, other.DesignData.Crest(slot));
}
}
@@ -528,6 +556,12 @@ public class DesignManager
if (other.DoApplyStain(EquipSlot.OffHand))
ChangeStain(design, EquipSlot.OffHand, other.DesignData.Stain(EquipSlot.OffHand));
+
+ if (other.DoApplyCrest(EquipSlot.MainHand))
+ ChangeCrest(design, EquipSlot.MainHand, other.DesignData.Crest(EquipSlot.MainHand));
+
+ if (other.DoApplyCrest(EquipSlot.OffHand))
+ ChangeCrest(design, EquipSlot.OffHand, other.DesignData.Crest(EquipSlot.OffHand));
}
public void UndoDesignChange(Design design)
diff --git a/Glamourer/Events/DesignChanged.cs b/Glamourer/Events/DesignChanged.cs
index 55956f0..c528fde 100644
--- a/Glamourer/Events/DesignChanged.cs
+++ b/Glamourer/Events/DesignChanged.cs
@@ -62,6 +62,9 @@ public sealed class DesignChanged : EventWrapper An existing design had a stain changed. Data is the old stain id, the new stain id and the slot [(StainId, StainId, EquipSlot)].
Stain,
+ /// An existing design had a crest visibility changed. Data is the old crest visibility, the new crest visibility and the slot [(bool, bool, EquipSlot)].
+ Crest,
+
/// An existing design changed whether a specific customization is applied. Data is the type of customization [CustomizeIndex].
ApplyCustomize,
@@ -71,6 +74,9 @@ public sealed class DesignChanged : EventWrapper An existing design changed whether a specific stain is applied. Data is the slot of the equipment [EquipSlot].
ApplyStain,
+ /// An existing design changed whether a specific crest visibility is applied. Data is the slot of the equipment [EquipSlot].
+ ApplyCrest,
+
/// An existing design changed its write protection status. Data is the new value [bool].
WriteProtection,
diff --git a/Glamourer/Events/StateChanged.cs b/Glamourer/Events/StateChanged.cs
index 2c5c5c8..e02a6d9 100644
--- a/Glamourer/Events/StateChanged.cs
+++ b/Glamourer/Events/StateChanged.cs
@@ -37,6 +37,9 @@ public sealed class StateChanged : EventWrapper A characters saved state had a stain changed. Data is the old stain id, the new stain id and the slot [(StainId, StainId, EquipSlot)].
Stain,
+ /// A characters saved state had a crest visibility changed. Data is the old crest visibility, the new crest visibility and the slot [(bool, bool, EquipSlot)].
+ Crest,
+
/// A characters saved state had a design applied. This means everything may have changed. Data is the applied design. [DesignBase]
Design,