mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-15 05:04:16 +01:00
.
This commit is contained in:
parent
65ce391051
commit
5e6f797af4
3 changed files with 69 additions and 8 deletions
|
|
@ -35,6 +35,46 @@ public class Design : ISavable
|
||||||
|
|
||||||
internal DesignData DesignData;
|
internal DesignData DesignData;
|
||||||
|
|
||||||
|
/// <summary> Unconditionally apply a design to a designdata. </summary>
|
||||||
|
/// <returns>Whether a redraw is required for the changes to take effect.</returns>
|
||||||
|
public bool ApplyDesign(ref DesignData data)
|
||||||
|
{
|
||||||
|
var modelChanged = data.ModelId != DesignData.ModelId;
|
||||||
|
data.ModelId = DesignData.ModelId;
|
||||||
|
|
||||||
|
CustomizeFlag customizeFlags = 0;
|
||||||
|
foreach (var index in Enum.GetValues<CustomizeIndex>())
|
||||||
|
{
|
||||||
|
if (!DoApplyCustomize(index))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (data.Customize.Set(index, DesignData.Customize[index]))
|
||||||
|
customizeFlags |= index.ToFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var slot in EquipSlotExtensions.EqdpSlots.Append(EquipSlot.MainHand).Append(EquipSlot.OffHand))
|
||||||
|
{
|
||||||
|
if (DoApplyEquip(slot))
|
||||||
|
data.SetItem(slot, DesignData.Item(slot));
|
||||||
|
|
||||||
|
if (DoApplyStain(slot))
|
||||||
|
data.SetStain(slot, DesignData.Stain(slot));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DoApplyHatVisible())
|
||||||
|
data.SetHatVisible(DesignData.IsHatVisible());
|
||||||
|
|
||||||
|
if (DoApplyVisorToggle())
|
||||||
|
data.SetVisor(DesignData.IsVisorToggled());
|
||||||
|
|
||||||
|
if (DoApplyWeaponVisible())
|
||||||
|
data.SetWeaponVisible(DesignData.IsWeaponVisible());
|
||||||
|
|
||||||
|
if (DoApplyWetness())
|
||||||
|
data.SetIsWet(DesignData.IsWet());
|
||||||
|
return modelChanged || customizeFlags.RequiresRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Application Data
|
#region Application Data
|
||||||
|
|
@ -45,7 +85,8 @@ public class Design : ISavable
|
||||||
ApplyHatVisible = 0x01,
|
ApplyHatVisible = 0x01,
|
||||||
ApplyVisorState = 0x02,
|
ApplyVisorState = 0x02,
|
||||||
ApplyWeaponVisible = 0x04,
|
ApplyWeaponVisible = 0x04,
|
||||||
WriteProtected = 0x08,
|
ApplyWetness = 0x08,
|
||||||
|
WriteProtected = 0x10,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal CustomizeFlag ApplyCustomize = CustomizeFlagExtensions.All;
|
internal CustomizeFlag ApplyCustomize = CustomizeFlagExtensions.All;
|
||||||
|
|
@ -61,6 +102,9 @@ public class Design : ISavable
|
||||||
public bool DoApplyWeaponVisible()
|
public bool DoApplyWeaponVisible()
|
||||||
=> _designFlags.HasFlag(DesignFlags.ApplyWeaponVisible);
|
=> _designFlags.HasFlag(DesignFlags.ApplyWeaponVisible);
|
||||||
|
|
||||||
|
public bool DoApplyWetness()
|
||||||
|
=> _designFlags.HasFlag(DesignFlags.ApplyWetness);
|
||||||
|
|
||||||
public bool WriteProtected()
|
public bool WriteProtected()
|
||||||
=> _designFlags.HasFlag(DesignFlags.WriteProtected);
|
=> _designFlags.HasFlag(DesignFlags.WriteProtected);
|
||||||
|
|
||||||
|
|
@ -94,6 +138,16 @@ public class Design : ISavable
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SetApplyWetness(bool value)
|
||||||
|
{
|
||||||
|
var newFlag = value ? _designFlags | DesignFlags.ApplyWetness : _designFlags & ~DesignFlags.ApplyWetness;
|
||||||
|
if (newFlag == _designFlags)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
_designFlags = newFlag;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool SetWriteProtected(bool value)
|
public bool SetWriteProtected(bool value)
|
||||||
{
|
{
|
||||||
var newFlag = value ? _designFlags | DesignFlags.WriteProtected : _designFlags & ~DesignFlags.WriteProtected;
|
var newFlag = value ? _designFlags | DesignFlags.WriteProtected : _designFlags & ~DesignFlags.WriteProtected;
|
||||||
|
|
@ -209,7 +263,12 @@ public class Design : ISavable
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ret["IsWet"] = DesignData.IsWet();
|
ret["Wetness"] = new JObject()
|
||||||
|
{
|
||||||
|
["Value"] = DesignData.IsWet(),
|
||||||
|
["Apply"] = DoApplyWetness(),
|
||||||
|
};
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -368,7 +427,9 @@ public class Design : ISavable
|
||||||
design.SetApplyCustomize(idx, apply);
|
design.SetApplyCustomize(idx, apply);
|
||||||
}
|
}
|
||||||
|
|
||||||
design.DesignData.SetIsWet(json["IsWet"]?.ToObject<bool>() ?? false);
|
var wetness = QuadBool.FromJObject(json["Wetness"], "Value", "Apply", QuadBool.NullFalse);
|
||||||
|
design.DesignData.SetIsWet(wetness.ForcedValue);
|
||||||
|
design.SetApplyWetness(wetness.Enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -403,6 +464,7 @@ public class Design : ISavable
|
||||||
SetApplyHatVisible(applyHat);
|
SetApplyHatVisible(applyHat);
|
||||||
SetApplyVisorToggle(applyVisor);
|
SetApplyVisorToggle(applyVisor);
|
||||||
SetApplyWeaponVisible(applyWeapon);
|
SetApplyWeaponVisible(applyWeapon);
|
||||||
|
SetApplyWetness(DesignData.IsWet());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ public static class DesignBase64Migration
|
||||||
byte applicationFlags;
|
byte applicationFlags;
|
||||||
ushort equipFlagsS;
|
ushort equipFlagsS;
|
||||||
var bytes = Convert.FromBase64String(base64);
|
var bytes = Convert.FromBase64String(base64);
|
||||||
applyHat = false;
|
applyHat = false;
|
||||||
applyVisor = false;
|
applyVisor = false;
|
||||||
applyWeapon = false;
|
applyWeapon = false;
|
||||||
var data = new DesignData();
|
var data = new DesignData();
|
||||||
switch (bytes[0])
|
switch (bytes[0])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ using Glamourer.Interop;
|
||||||
using Glamourer.Interop.Penumbra;
|
using Glamourer.Interop.Penumbra;
|
||||||
using Glamourer.Interop.Structs;
|
using Glamourer.Interop.Structs;
|
||||||
using Glamourer.Services;
|
using Glamourer.Services;
|
||||||
using OtterGui.Classes;
|
using Glamourer.Structs;
|
||||||
using Penumbra.GameData.Actors;
|
using Penumbra.GameData.Actors;
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
using Penumbra.GameData.Structs;
|
using Penumbra.GameData.Structs;
|
||||||
|
|
@ -29,7 +29,6 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
|
||||||
|
|
||||||
private readonly Dictionary<ActorIdentifier, ActorState> _states = new();
|
private readonly Dictionary<ActorIdentifier, ActorState> _states = new();
|
||||||
|
|
||||||
|
|
||||||
public StateManager(ActorService actors, ItemManager items, CustomizationService customizations, VisorService visor, StateChanged @event,
|
public StateManager(ActorService actors, ItemManager items, CustomizationService customizations, VisorService visor, StateChanged @event,
|
||||||
PenumbraService penumbra)
|
PenumbraService penumbra)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue