mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 08:17:59 +01:00
Make IMC handling even better.
This commit is contained in:
parent
65627b5002
commit
4743acf767
15 changed files with 437 additions and 459 deletions
|
|
@ -5,7 +5,6 @@ using Penumbra.Api.Enums;
|
|||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.Meta;
|
||||
using Penumbra.Meta.Files;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Mods.Manager;
|
||||
|
|
@ -17,20 +16,20 @@ namespace Penumbra.UI.ModsTab.Groups;
|
|||
public class AddGroupDrawer : IUiService
|
||||
{
|
||||
private string _groupName = string.Empty;
|
||||
private bool _groupNameValid = false;
|
||||
private bool _groupNameValid;
|
||||
|
||||
private ImcManipulation _imcManip = new(EquipSlot.Head, 1, 1, new ImcEntry());
|
||||
private ImcEntry _defaultEntry;
|
||||
private bool _imcFileExists;
|
||||
private bool _entryExists;
|
||||
private bool _entryInvalid;
|
||||
private readonly MetaFileManager _metaManager;
|
||||
private readonly ModManager _modManager;
|
||||
private ImcIdentifier _imcIdentifier = ImcIdentifier.Default;
|
||||
private ImcEntry _defaultEntry;
|
||||
private bool _imcFileExists;
|
||||
private bool _entryExists;
|
||||
private bool _entryInvalid;
|
||||
private readonly ImcChecker _imcChecker;
|
||||
private readonly ModManager _modManager;
|
||||
|
||||
public AddGroupDrawer(MetaFileManager metaManager, ModManager modManager)
|
||||
public AddGroupDrawer(ModManager modManager, ImcChecker imcChecker)
|
||||
{
|
||||
_metaManager = metaManager;
|
||||
_modManager = modManager;
|
||||
_imcChecker = imcChecker;
|
||||
UpdateEntry();
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +60,7 @@ public class AddGroupDrawer : IUiService
|
|||
return;
|
||||
|
||||
_modManager.OptionEditor.AddModGroup(mod, GroupType.Single, _groupName);
|
||||
_groupName = string.Empty;
|
||||
_groupName = string.Empty;
|
||||
_groupNameValid = false;
|
||||
}
|
||||
|
||||
|
|
@ -74,35 +73,35 @@ public class AddGroupDrawer : IUiService
|
|||
return;
|
||||
|
||||
_modManager.OptionEditor.AddModGroup(mod, GroupType.Multi, _groupName);
|
||||
_groupName = string.Empty;
|
||||
_groupName = string.Empty;
|
||||
_groupNameValid = false;
|
||||
}
|
||||
|
||||
private void DrawImcInput(float width)
|
||||
{
|
||||
var change = ImcManipulationDrawer.DrawObjectType(ref _imcManip, width);
|
||||
var change = ImcManipulationDrawer.DrawObjectType(ref _imcIdentifier, width);
|
||||
ImUtf8.SameLineInner();
|
||||
change |= ImcManipulationDrawer.DrawPrimaryId(ref _imcManip, width);
|
||||
if (_imcManip.ObjectType is ObjectType.Weapon or ObjectType.Monster)
|
||||
change |= ImcManipulationDrawer.DrawPrimaryId(ref _imcIdentifier, width);
|
||||
if (_imcIdentifier.ObjectType is ObjectType.Weapon or ObjectType.Monster)
|
||||
{
|
||||
change |= ImcManipulationDrawer.DrawSecondaryId(ref _imcManip, width);
|
||||
change |= ImcManipulationDrawer.DrawSecondaryId(ref _imcIdentifier, width);
|
||||
ImUtf8.SameLineInner();
|
||||
change |= ImcManipulationDrawer.DrawVariant(ref _imcManip, width);
|
||||
change |= ImcManipulationDrawer.DrawVariant(ref _imcIdentifier, width);
|
||||
}
|
||||
else if (_imcManip.ObjectType is ObjectType.DemiHuman)
|
||||
else if (_imcIdentifier.ObjectType is ObjectType.DemiHuman)
|
||||
{
|
||||
var quarterWidth = (width - ImUtf8.ItemInnerSpacing.X / ImUtf8.GlobalScale) / 2;
|
||||
change |= ImcManipulationDrawer.DrawSecondaryId(ref _imcManip, width);
|
||||
change |= ImcManipulationDrawer.DrawSecondaryId(ref _imcIdentifier, width);
|
||||
ImUtf8.SameLineInner();
|
||||
change |= ImcManipulationDrawer.DrawSlot(ref _imcManip, quarterWidth);
|
||||
change |= ImcManipulationDrawer.DrawSlot(ref _imcIdentifier, quarterWidth);
|
||||
ImUtf8.SameLineInner();
|
||||
change |= ImcManipulationDrawer.DrawVariant(ref _imcManip, quarterWidth);
|
||||
change |= ImcManipulationDrawer.DrawVariant(ref _imcIdentifier, quarterWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
change |= ImcManipulationDrawer.DrawSlot(ref _imcManip, width);
|
||||
change |= ImcManipulationDrawer.DrawSlot(ref _imcIdentifier, width);
|
||||
ImUtf8.SameLineInner();
|
||||
change |= ImcManipulationDrawer.DrawVariant(ref _imcManip, width);
|
||||
change |= ImcManipulationDrawer.DrawVariant(ref _imcIdentifier, width);
|
||||
}
|
||||
|
||||
if (change)
|
||||
|
|
@ -125,8 +124,8 @@ public class AddGroupDrawer : IUiService
|
|||
: "Add a new multi selection option group to this mod."u8,
|
||||
width, !_groupNameValid || _entryInvalid))
|
||||
{
|
||||
_modManager.OptionEditor.ImcEditor.AddModGroup(mod, _groupName, _imcManip);
|
||||
_groupName = string.Empty;
|
||||
_modManager.OptionEditor.ImcEditor.AddModGroup(mod, _groupName, _imcIdentifier, _defaultEntry);
|
||||
_groupName = string.Empty;
|
||||
_groupNameValid = false;
|
||||
}
|
||||
|
||||
|
|
@ -142,20 +141,7 @@ public class AddGroupDrawer : IUiService
|
|||
|
||||
private void UpdateEntry()
|
||||
{
|
||||
try
|
||||
{
|
||||
_defaultEntry = ImcFile.GetDefault(_metaManager, _imcManip.GamePath(), _imcManip.EquipSlot, _imcManip.Variant,
|
||||
out _entryExists);
|
||||
_imcFileExists = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_defaultEntry = new ImcEntry();
|
||||
_imcFileExists = false;
|
||||
_entryExists = false;
|
||||
}
|
||||
|
||||
_imcManip = _imcManip.Copy(_entryExists ? _defaultEntry : new ImcEntry());
|
||||
_entryInvalid = !_imcManip.Validate(true);
|
||||
(_defaultEntry, _imcFileExists, _entryExists) = _imcChecker.GetDefaultEntry(_imcIdentifier, false);
|
||||
_entryInvalid = !_imcIdentifier.Validate() || _defaultEntry.MaterialId == 0 || !_entryExists;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
using Dalamud.Interface;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Manager.OptionEditor;
|
||||
|
|
@ -16,59 +14,75 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr
|
|||
{
|
||||
public void Draw()
|
||||
{
|
||||
var identifier = group.Identifier;
|
||||
var defaultEntry = editor.ImcChecker.GetDefaultEntry(identifier, true).Entry;
|
||||
var entry = group.DefaultEntry;
|
||||
var changes = false;
|
||||
|
||||
ImUtf8.TextFramed(identifier.ToString(), 0, editor.AvailableWidth, borderColor: ImGui.GetColorU32(ImGuiCol.Border));
|
||||
|
||||
using (ImUtf8.Group())
|
||||
{
|
||||
ImUtf8.Text("Object Type"u8);
|
||||
if (group.ObjectType is ObjectType.Equipment or ObjectType.Accessory or ObjectType.DemiHuman)
|
||||
ImUtf8.Text("Slot"u8);
|
||||
ImUtf8.Text("Primary ID");
|
||||
if (group.ObjectType is not ObjectType.Equipment and not ObjectType.Accessory)
|
||||
ImUtf8.Text("Secondary ID");
|
||||
ImUtf8.Text("Variant"u8);
|
||||
|
||||
ImUtf8.TextFrameAligned("Material ID"u8);
|
||||
ImUtf8.TextFrameAligned("Material Animation ID"u8);
|
||||
ImUtf8.TextFrameAligned("Decal ID"u8);
|
||||
ImUtf8.TextFrameAligned("VFX ID"u8);
|
||||
ImUtf8.TextFrameAligned("Decal ID"u8);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
using (ImUtf8.Group())
|
||||
{
|
||||
changes |= ImcManipulationDrawer.DrawMaterialId(defaultEntry, ref entry, true);
|
||||
changes |= ImcManipulationDrawer.DrawVfxId(defaultEntry, ref entry, true);
|
||||
changes |= ImcManipulationDrawer.DrawDecalId(defaultEntry, ref entry, true);
|
||||
}
|
||||
|
||||
ImGui.SameLine(0, editor.PriorityWidth);
|
||||
using (ImUtf8.Group())
|
||||
{
|
||||
ImUtf8.TextFrameAligned("Material Animation ID"u8);
|
||||
ImUtf8.TextFrameAligned("Sound ID"u8);
|
||||
ImUtf8.TextFrameAligned("Can Be Disabled"u8);
|
||||
ImUtf8.TextFrameAligned("Default Attributes"u8);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
using (ImUtf8.Group())
|
||||
{
|
||||
changes |= ImcManipulationDrawer.DrawMaterialAnimationId(defaultEntry, ref entry, true);
|
||||
changes |= ImcManipulationDrawer.DrawSoundId(defaultEntry, ref entry, true);
|
||||
var canBeDisabled = group.CanBeDisabled;
|
||||
if (ImUtf8.Checkbox("##disabled"u8, ref canBeDisabled))
|
||||
editor.ModManager.OptionEditor.ImcEditor.ChangeCanBeDisabled(group, canBeDisabled);
|
||||
}
|
||||
|
||||
if (changes)
|
||||
editor.ModManager.OptionEditor.ImcEditor.ChangeDefaultEntry(group, entry);
|
||||
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
DrawOptions();
|
||||
var attributeCache = new ImcAttributeCache(group);
|
||||
DrawNewOption(attributeCache);
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
|
||||
|
||||
using (ImUtf8.Group())
|
||||
{
|
||||
ImUtf8.Text(group.ObjectType.ToName());
|
||||
if (group.ObjectType is ObjectType.Equipment or ObjectType.Accessory or ObjectType.DemiHuman)
|
||||
ImUtf8.Text(group.EquipSlot.ToName());
|
||||
ImUtf8.Text($"{group.PrimaryId.Id}");
|
||||
if (group.ObjectType is not ObjectType.Equipment and not ObjectType.Accessory)
|
||||
ImUtf8.Text($"{group.SecondaryId.Id}");
|
||||
ImUtf8.Text($"{group.Variant.Id}");
|
||||
|
||||
ImUtf8.TextFrameAligned($"{group.DefaultEntry.MaterialId}");
|
||||
ImUtf8.TextFrameAligned($"{group.DefaultEntry.MaterialAnimationId}");
|
||||
ImUtf8.TextFrameAligned($"{group.DefaultEntry.DecalId}");
|
||||
ImUtf8.TextFrameAligned($"{group.DefaultEntry.VfxId}");
|
||||
ImUtf8.TextFrameAligned($"{group.DefaultEntry.SoundId}");
|
||||
|
||||
var canBeDisabled = group.CanBeDisabled;
|
||||
if (ImUtf8.Checkbox("##disabled"u8, ref canBeDisabled))
|
||||
editor.ModManager.OptionEditor.ImcEditor.ChangeCanBeDisabled(group, canBeDisabled, SaveType.Queue);
|
||||
|
||||
var defaultDisabled = group.DefaultDisabled;
|
||||
ImUtf8.SameLineInner();
|
||||
if (ImUtf8.Checkbox("##defaultDisabled"u8, ref defaultDisabled))
|
||||
editor.ModManager.OptionEditor.ChangeModGroupDefaultOption(group,
|
||||
group.DefaultSettings.SetBit(ImcModGroup.DisabledIndex, defaultDisabled));
|
||||
|
||||
DrawAttributes(editor.ModManager.OptionEditor.ImcEditor, attributeCache, group.DefaultEntry.AttributeMask, group);
|
||||
ImUtf8.TextFrameAligned("Default Attributes"u8);
|
||||
foreach (var option in group.OptionData.Where(o => !o.IsDisableSubMod))
|
||||
ImUtf8.TextFrameAligned(option.Name);
|
||||
}
|
||||
|
||||
ImUtf8.SameLineInner();
|
||||
using (ImUtf8.Group())
|
||||
{
|
||||
DrawAttributes(editor.ModManager.OptionEditor.ImcEditor, attributeCache, group.DefaultEntry.AttributeMask, group);
|
||||
foreach (var option in group.OptionData.Where(o => !o.IsDisableSubMod))
|
||||
DrawAttributes(editor.ModManager.OptionEditor.ImcEditor, attributeCache, option.AttributeMask, option);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawOptions()
|
||||
{
|
||||
foreach (var (option, optionIdx) in group.OptionData.WithIndex())
|
||||
{
|
||||
using var id = ImRaii.PushId(optionIdx);
|
||||
|
|
@ -83,56 +97,51 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr
|
|||
ImUtf8.SameLineInner();
|
||||
editor.DrawOptionDescription(option);
|
||||
|
||||
ImUtf8.SameLineInner();
|
||||
editor.DrawOptionDelete(option);
|
||||
|
||||
ImUtf8.SameLineInner();
|
||||
ImGui.Dummy(new Vector2(editor.PriorityWidth, 0));
|
||||
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + editor.OptionIdxSelectable.X + ImUtf8.ItemInnerSpacing.X * 2 + ImUtf8.FrameHeight);
|
||||
DrawAttributes(editor.ModManager.OptionEditor.ImcEditor, attributeCache, option.AttributeMask, option);
|
||||
}
|
||||
|
||||
DrawNewOption(attributeCache);
|
||||
return;
|
||||
|
||||
static void DrawAttributes(ImcModGroupEditor editor, in ImcAttributeCache cache, ushort mask, object data)
|
||||
{
|
||||
for (var i = 0; i < ImcEntry.NumAttributes; ++i)
|
||||
if (!option.IsDisableSubMod)
|
||||
{
|
||||
using var id = ImRaii.PushId(i);
|
||||
var value = (mask & 1 << i) != 0;
|
||||
using (ImRaii.Disabled(!cache.CanChange(i)))
|
||||
{
|
||||
if (ImUtf8.Checkbox(TerminatedByteString.Empty, ref value))
|
||||
{
|
||||
if (data is ImcModGroup g)
|
||||
editor.ChangeDefaultAttribute(g, cache, i, value);
|
||||
else
|
||||
editor.ChangeOptionAttribute((ImcSubMod)data, cache, i, value);
|
||||
}
|
||||
}
|
||||
|
||||
ImUtf8.HoverTooltip($"{(char)('A' + i)}");
|
||||
if (i != 9)
|
||||
ImUtf8.SameLineInner();
|
||||
ImUtf8.SameLineInner();
|
||||
editor.DrawOptionDelete(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawNewOption(in ImcAttributeCache cache)
|
||||
{
|
||||
if (cache.LowestUnsetMask == 0)
|
||||
return;
|
||||
|
||||
var name = editor.DrawNewOptionBase(group, group.Options.Count);
|
||||
var dis = cache.LowestUnsetMask == 0;
|
||||
var name = editor.DrawNewOptionBase(group, group.Options.Count);
|
||||
var validName = name.Length > 0;
|
||||
if (ImUtf8.IconButton(FontAwesomeIcon.Plus, validName
|
||||
var tt = dis
|
||||
? "No Free Attribute Slots for New Options..."u8
|
||||
: validName
|
||||
? "Add a new option to this group."u8
|
||||
: "Please enter a name for the new option."u8, !validName))
|
||||
: "Please enter a name for the new option."u8;
|
||||
if (ImUtf8.IconButton(FontAwesomeIcon.Plus, tt, !validName || dis))
|
||||
{
|
||||
editor.ModManager.OptionEditor.ImcEditor.AddOption(group, cache, name);
|
||||
editor.NewOptionName = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawAttributes(ImcModGroupEditor editor, in ImcAttributeCache cache, ushort mask, object data)
|
||||
{
|
||||
for (var i = 0; i < ImcEntry.NumAttributes; ++i)
|
||||
{
|
||||
using var id = ImRaii.PushId(i);
|
||||
var value = (mask & (1 << i)) != 0;
|
||||
using (ImRaii.Disabled(!cache.CanChange(i)))
|
||||
{
|
||||
if (ImUtf8.Checkbox(TerminatedByteString.Empty, ref value))
|
||||
{
|
||||
if (data is ImcModGroup g)
|
||||
editor.ChangeDefaultAttribute(g, cache, i, value);
|
||||
else
|
||||
editor.ChangeOptionAttribute((ImcSubMod)data, cache, i, value);
|
||||
}
|
||||
}
|
||||
|
||||
ImUtf8.HoverTooltip("ABCDEFGHIJ"u8.Slice(i, 1));
|
||||
if (i != 9)
|
||||
ImUtf8.SameLineInner();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using OtterGui.Raii;
|
|||
using OtterGui.Services;
|
||||
using OtterGui.Text;
|
||||
using OtterGui.Text.EndObjects;
|
||||
using Penumbra.Meta;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Mods.Groups;
|
||||
using Penumbra.Mods.Manager;
|
||||
|
|
@ -22,11 +23,16 @@ public sealed class ModGroupEditDrawer(
|
|||
ModManager modManager,
|
||||
Configuration config,
|
||||
FilenameService filenames,
|
||||
DescriptionEditPopup descriptionPopup) : IUiService
|
||||
DescriptionEditPopup descriptionPopup,
|
||||
ImcChecker imcChecker) : IUiService
|
||||
{
|
||||
private static ReadOnlySpan<byte> DragDropLabel
|
||||
=> "##DragOption"u8;
|
||||
private static ReadOnlySpan<byte> AcrossGroupsLabel
|
||||
=> "##DragOptionAcross"u8;
|
||||
|
||||
private static ReadOnlySpan<byte> InsideGroupLabel
|
||||
=> "##DragOptionInside"u8;
|
||||
|
||||
internal readonly ImcChecker ImcChecker = imcChecker;
|
||||
internal readonly ModManager ModManager = modManager;
|
||||
internal readonly Queue<Action> ActionQueue = new();
|
||||
|
||||
|
|
@ -50,6 +56,7 @@ public sealed class ModGroupEditDrawer(
|
|||
|
||||
private IModGroup? _dragDropGroup;
|
||||
private IModOption? _dragDropOption;
|
||||
private bool _draggingAcross;
|
||||
|
||||
public void Draw(Mod mod)
|
||||
{
|
||||
|
|
@ -292,32 +299,30 @@ public sealed class ModGroupEditDrawer(
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void Source(IModOption option)
|
||||
{
|
||||
if (option.Group is not ITexToolsGroup)
|
||||
return;
|
||||
|
||||
using var source = ImUtf8.DragDropSource();
|
||||
if (!source)
|
||||
return;
|
||||
|
||||
if (!DragDropSource.SetPayload(DragDropLabel))
|
||||
var across = option.Group is ITexToolsGroup;
|
||||
|
||||
if (!DragDropSource.SetPayload(across ? AcrossGroupsLabel : InsideGroupLabel))
|
||||
{
|
||||
_dragDropGroup = option.Group;
|
||||
_dragDropOption = option;
|
||||
_draggingAcross = across;
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted($"Dragging option {option.Name} from group {option.Group.Name}...");
|
||||
ImUtf8.Text($"Dragging option {option.Name} from group {option.Group.Name}...");
|
||||
}
|
||||
|
||||
private void Target(IModGroup group, int optionIdx)
|
||||
{
|
||||
if (group is not ITexToolsGroup)
|
||||
return;
|
||||
|
||||
if (_dragDropGroup != group && _dragDropGroup != null && group is MultiModGroup { Options.Count: >= IModGroup.MaxMultiOptions })
|
||||
if (_dragDropGroup != group
|
||||
&& (!_draggingAcross || (_dragDropGroup != null && group is MultiModGroup { Options.Count: >= IModGroup.MaxMultiOptions })))
|
||||
return;
|
||||
|
||||
using var target = ImRaii.DragDropTarget();
|
||||
if (!target.Success || !DragDropTarget.CheckPayload(DragDropLabel))
|
||||
if (!target.Success || !DragDropTarget.CheckPayload(_draggingAcross ? AcrossGroupsLabel : InsideGroupLabel))
|
||||
return;
|
||||
|
||||
if (_dragDropGroup != null && _dragDropOption != null)
|
||||
|
|
@ -342,6 +347,7 @@ public sealed class ModGroupEditDrawer(
|
|||
|
||||
_dragDropGroup = null;
|
||||
_dragDropOption = null;
|
||||
_draggingAcross = false;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
using OtterGui.Text.HelperObjects;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
|
|
@ -12,79 +10,78 @@ namespace Penumbra.UI.ModsTab;
|
|||
|
||||
public static class ImcManipulationDrawer
|
||||
{
|
||||
public static bool DrawObjectType(ref ImcManipulation manip, float width = 110)
|
||||
public static bool DrawObjectType(ref ImcIdentifier identifier, float width = 110)
|
||||
{
|
||||
var ret = Combos.ImcType("##imcType", manip.ObjectType, out var type, width);
|
||||
var ret = Combos.ImcType("##imcType", identifier.ObjectType, out var type, width);
|
||||
ImUtf8.HoverTooltip("Object Type"u8);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
var equipSlot = type switch
|
||||
{
|
||||
ObjectType.Equipment => manip.EquipSlot.IsEquipment() ? manip.EquipSlot : EquipSlot.Head,
|
||||
ObjectType.DemiHuman => manip.EquipSlot.IsEquipment() ? manip.EquipSlot : EquipSlot.Head,
|
||||
ObjectType.Accessory => manip.EquipSlot.IsAccessory() ? manip.EquipSlot : EquipSlot.Ears,
|
||||
ObjectType.Equipment => identifier.EquipSlot.IsEquipment() ? identifier.EquipSlot : EquipSlot.Head,
|
||||
ObjectType.DemiHuman => identifier.EquipSlot.IsEquipment() ? identifier.EquipSlot : EquipSlot.Head,
|
||||
ObjectType.Accessory => identifier.EquipSlot.IsAccessory() ? identifier.EquipSlot : EquipSlot.Ears,
|
||||
_ => EquipSlot.Unknown,
|
||||
};
|
||||
manip = new ImcManipulation(type, manip.BodySlot, manip.PrimaryId, manip.SecondaryId == 0 ? 1 : manip.SecondaryId,
|
||||
manip.Variant.Id, equipSlot, manip.Entry);
|
||||
identifier = identifier with
|
||||
{
|
||||
EquipSlot = equipSlot,
|
||||
SecondaryId = identifier.SecondaryId == 0 ? 1 : identifier.SecondaryId,
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static bool DrawPrimaryId(ref ImcManipulation manip, float unscaledWidth = 80)
|
||||
public static bool DrawPrimaryId(ref ImcIdentifier identifier, float unscaledWidth = 80)
|
||||
{
|
||||
var ret = IdInput("##imcPrimaryId"u8, unscaledWidth, manip.PrimaryId.Id, out var newId, 0, ushort.MaxValue,
|
||||
manip.PrimaryId.Id <= 1);
|
||||
var ret = IdInput("##imcPrimaryId"u8, unscaledWidth, identifier.PrimaryId.Id, out var newId, 0, ushort.MaxValue,
|
||||
identifier.PrimaryId.Id <= 1);
|
||||
ImUtf8.HoverTooltip("Primary ID - You can usually find this as the 'x####' part of an item path.\n"u8
|
||||
+ "This should generally not be left <= 1 unless you explicitly want that."u8);
|
||||
if (ret)
|
||||
manip = new ImcManipulation(manip.ObjectType, manip.BodySlot, newId, manip.SecondaryId, manip.Variant.Id, manip.EquipSlot,
|
||||
manip.Entry);
|
||||
identifier = identifier with { PrimaryId = newId };
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static bool DrawSecondaryId(ref ImcManipulation manip, float unscaledWidth = 100)
|
||||
public static bool DrawSecondaryId(ref ImcIdentifier identifier, float unscaledWidth = 100)
|
||||
{
|
||||
var ret = IdInput("##imcSecondaryId"u8, unscaledWidth, manip.SecondaryId.Id, out var newId, 0, ushort.MaxValue, false);
|
||||
var ret = IdInput("##imcSecondaryId"u8, unscaledWidth, identifier.SecondaryId.Id, out var newId, 0, ushort.MaxValue, false);
|
||||
ImUtf8.HoverTooltip("Secondary ID"u8);
|
||||
if (ret)
|
||||
manip = new ImcManipulation(manip.ObjectType, manip.BodySlot, manip.PrimaryId, newId, manip.Variant.Id, manip.EquipSlot,
|
||||
manip.Entry);
|
||||
identifier = identifier with { SecondaryId = newId };
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static bool DrawVariant(ref ImcManipulation manip, float unscaledWidth = 45)
|
||||
public static bool DrawVariant(ref ImcIdentifier identifier, float unscaledWidth = 45)
|
||||
{
|
||||
var ret = IdInput("##imcVariant"u8, unscaledWidth, manip.Variant.Id, out var newId, 0, byte.MaxValue, false);
|
||||
var ret = IdInput("##imcVariant"u8, unscaledWidth, identifier.Variant.Id, out var newId, 0, byte.MaxValue, false);
|
||||
ImUtf8.HoverTooltip("Variant ID"u8);
|
||||
if (ret)
|
||||
manip = new ImcManipulation(manip.ObjectType, manip.BodySlot, manip.PrimaryId, manip.SecondaryId, (byte)newId, manip.EquipSlot,
|
||||
manip.Entry);
|
||||
identifier = identifier with { Variant = (byte)newId };
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static bool DrawSlot(ref ImcManipulation manip, float unscaledWidth = 100)
|
||||
public static bool DrawSlot(ref ImcIdentifier identifier, float unscaledWidth = 100)
|
||||
{
|
||||
bool ret;
|
||||
EquipSlot slot;
|
||||
switch (manip.ObjectType)
|
||||
switch (identifier.ObjectType)
|
||||
{
|
||||
case ObjectType.Equipment:
|
||||
case ObjectType.DemiHuman:
|
||||
ret = Combos.EqpEquipSlot("##slot", manip.EquipSlot, out slot, unscaledWidth);
|
||||
ret = Combos.EqpEquipSlot("##slot", identifier.EquipSlot, out slot, unscaledWidth);
|
||||
break;
|
||||
case ObjectType.Accessory:
|
||||
ret = Combos.AccessorySlot("##slot", manip.EquipSlot, out slot, unscaledWidth);
|
||||
ret = Combos.AccessorySlot("##slot", identifier.EquipSlot, out slot, unscaledWidth);
|
||||
break;
|
||||
default: return false;
|
||||
}
|
||||
|
||||
ImUtf8.HoverTooltip("Equip Slot"u8);
|
||||
if (ret)
|
||||
manip = new ImcManipulation(manip.ObjectType, manip.BodySlot, manip.PrimaryId, manip.SecondaryId, manip.Variant.Id, slot,
|
||||
manip.Entry);
|
||||
identifier = identifier with { EquipSlot = slot };
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue