Switch services.

This commit is contained in:
Ottermandias 2026-01-24 16:52:22 +01:00
parent 1c360d026b
commit 2d8d6fa75f
79 changed files with 487 additions and 503 deletions

View file

@ -1,9 +1,9 @@
using Glamourer.Api.Enums; using Glamourer.Api.Enums;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.State; using Glamourer.State;
using Luna;
using OtterGui.Extensions; using OtterGui.Extensions;
using OtterGui.Log; using OtterGui.Log;
using OtterGui.Services;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
@ -84,9 +84,8 @@ public class ApiHelpers(ActorObjectManager objects, StateManager stateManager, A
return []; return [];
return stateManager.Values.Where(state => state.Identifier.Type is IdentifierType.Player && state.Identifier.PlayerName == byteString) return stateManager.Values.Where(state => state.Identifier.Type is IdentifierType.Player && state.Identifier.PlayerName == byteString)
.Concat(objects .Concat(ArrayExtensions.SelectWhere(objects
.Where(kvp => kvp.Key is { IsValid: true, Type: IdentifierType.Player } && kvp.Key.PlayerName == byteString) .Where(kvp => kvp.Key is { IsValid: true, Type: IdentifierType.Player } && kvp.Key.PlayerName == byteString), kvp =>
.SelectWhere(kvp =>
{ {
if (stateManager.ContainsKey(kvp.Key)) if (stateManager.ContainsKey(kvp.Key))
return (false, null); return (false, null);

View file

@ -2,8 +2,8 @@
using Glamourer.Api.Enums; using Glamourer.Api.Enums;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.State; using Glamourer.State;
using Luna;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui.Services;
namespace Glamourer.Api; namespace Glamourer.Api;

View file

@ -1,5 +1,5 @@
using Glamourer.Api.Api; using Glamourer.Api.Api;
using OtterGui.Services; using Luna;
namespace Glamourer.Api; namespace Glamourer.Api;

View file

@ -1,8 +1,8 @@
using Dalamud.Plugin; using Dalamud.Plugin;
using Glamourer.Api.Api; using Glamourer.Api.Api;
using Glamourer.Api.Helpers; using Glamourer.Api.Helpers;
using OtterGui.Services;
using Glamourer.Api.Enums; using Glamourer.Api.Enums;
using Luna;
namespace Glamourer.Api; namespace Glamourer.Api;

View file

@ -3,7 +3,7 @@ using Glamourer.Api.Enums;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -67,7 +67,7 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args); return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args);
return ApiHelpers.Return(GlamourerApiEc.Success, args); return ApiHelpers.Return(GlamourerApiEc.Success, args);
} }
public GlamourerApiEc SetBonusItem(int objectIndex, ApiBonusSlot slot, ulong bonusItemId, uint key, ApplyFlag flags) public GlamourerApiEc SetBonusItem(int objectIndex, ApiBonusSlot slot, ulong bonusItemId, uint key, ApplyFlag flags)
{ {
@ -125,8 +125,8 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args); return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args);
return ApiHelpers.Return(GlamourerApiEc.Success, args); return ApiHelpers.Return(GlamourerApiEc.Success, args);
} }
public GlamourerApiEc SetMetaState(int objectIndex, MetaFlag types, bool newValue, uint key, ApplyFlag flags) public GlamourerApiEc SetMetaState(int objectIndex, MetaFlag types, bool newValue, uint key, ApplyFlag flags)
{ {
var args = ApiHelpers.Args("Index", objectIndex, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags); var args = ApiHelpers.Args("Index", objectIndex, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags);
@ -144,10 +144,10 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
// Grab MetaIndices from attached flags, and update the states. // Grab MetaIndices from attached flags, and update the states.
var indices = types.ToIndices(); var indices = types.ToIndices();
foreach (var index in indices) foreach (var index in indices)
{ {
stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual); stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual);
ApiHelpers.Lock(state, key, flags); ApiHelpers.Lock(state, key, flags);
} }
return GlamourerApiEc.Success; return GlamourerApiEc.Success;
@ -155,7 +155,7 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
public GlamourerApiEc SetMetaStateName(string playerName, MetaFlag types, bool newValue, uint key, ApplyFlag flags) public GlamourerApiEc SetMetaStateName(string playerName, MetaFlag types, bool newValue, uint key, ApplyFlag flags)
{ {
var args = ApiHelpers.Args("Name", playerName, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags); var args = ApiHelpers.Args("Name", playerName, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags);
if (types == 0) if (types == 0)
return ApiHelpers.Return(GlamourerApiEc.ItemInvalid, args); return ApiHelpers.Return(GlamourerApiEc.ItemInvalid, args);
@ -174,10 +174,10 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
anyUnlocked = true; anyUnlocked = true;
// update all MetaStates for this ActorState // update all MetaStates for this ActorState
foreach (var index in types.ToIndices()) foreach (var index in types.ToIndices())
{ {
stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual); stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual);
ApiHelpers.Lock(state, key, flags); ApiHelpers.Lock(state, key, flags);
} }
} }

View file

@ -5,10 +5,9 @@ using Glamourer.Designs;
using Glamourer.Designs.History; using Glamourer.Designs.History;
using Glamourer.Events; using Glamourer.Events;
using Glamourer.State; using Glamourer.State;
using Luna;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui.Services;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
using Penumbra.GameData.Structs;
using StateChanged = Glamourer.Events.StateChanged; using StateChanged = Glamourer.Events.StateChanged;
namespace Glamourer.Api; namespace Glamourer.Api;

View file

@ -1,4 +1,4 @@
using OtterGui.Services; using Luna;
namespace Glamourer.Designs; namespace Glamourer.Designs;

View file

@ -1,7 +1,7 @@
using Glamourer.Api.Enums; using Glamourer.Api.Enums;
using Glamourer.Events; using Glamourer.Events;
using Glamourer.State; using Glamourer.State;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
namespace Glamourer.Designs.History; namespace Glamourer.Designs.History;

View file

@ -1,7 +1,8 @@
using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification;
using Luna;
using OtterGui.Classes; using OtterGui.Classes;
using OtterGui.Extensions; using OtterGui.Extensions;
using OtterGui.Services; using MessageService = OtterGui.Classes.MessageService;
using Notification = OtterGui.Classes.Notification; using Notification = OtterGui.Classes.Notification;
namespace Glamourer.Designs.Links; namespace Glamourer.Designs.Links;
@ -10,7 +11,7 @@ public sealed class DesignLinkLoader(DesignStorage designStorage, MessageService
: DelayedReferenceLoader<Design, LinkData>(messager), IService : DelayedReferenceLoader<Design, LinkData>(messager), IService
{ {
protected override bool TryGetObject(LinkData data, [NotNullWhen(true)] out Design? obj) protected override bool TryGetObject(LinkData data, [NotNullWhen(true)] out Design? obj)
=> designStorage.FindFirst(d => d.Identifier == data.Identity, out obj); => ArrayExtensions.FindFirst(designStorage, d => d.Identifier == data.Identity, out obj);
protected override bool SetObject(Design parent, Design child, LinkData data, out string error) protected override bool SetObject(Design parent, Design child, LinkData data, out string error)
=> LinkContainer.AddLink(parent, child, data.Type, data.Order, out error); => LinkContainer.AddLink(parent, child, data.Type, data.Order, out error);

View file

@ -2,7 +2,7 @@
using Glamourer.Designs.History; using Glamourer.Designs.History;
using Glamourer.Events; using Glamourer.Events;
using Glamourer.Services; using Glamourer.Services;
using OtterGui.Services; using Luna;
namespace Glamourer.Designs.Links; namespace Glamourer.Designs.Links;

View file

@ -1,12 +1,11 @@
using Glamourer.Api.Enums; using Glamourer.Api.Enums;
using Glamourer.Automation; using Glamourer.Automation;
using Glamourer.Designs.Special;
using Glamourer.GameData; using Glamourer.GameData;
using Glamourer.Interop.Material; using Glamourer.Interop.Material;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using Glamourer.Unlocks; using Glamourer.Unlocks;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -14,10 +13,10 @@ namespace Glamourer.Designs.Links;
public class DesignMerger( public class DesignMerger(
DesignManager designManager, DesignManager designManager,
CustomizeService _customize, CustomizeService customizeService,
Configuration _config, Configuration config,
ItemUnlockManager _itemUnlocks, ItemUnlockManager itemUnlocks,
CustomizeUnlockManager _customizeUnlocks) : IService CustomizeUnlockManager customizeUnlocks) : IService
{ {
public MergedDesign Merge(LinkContainer designs, in CustomizeArray currentCustomize, in DesignData baseRef, bool respectOwnership, public MergedDesign Merge(LinkContainer designs, in CustomizeArray currentCustomize, in DesignData baseRef, bool respectOwnership,
bool modAssociations) bool modAssociations)
@ -28,10 +27,10 @@ public class DesignMerger(
in DesignData baseRef, bool respectOwnership, bool modAssociations) in DesignData baseRef, bool respectOwnership, bool modAssociations)
{ {
var ret = new MergedDesign(designManager); var ret = new MergedDesign(designManager);
ret.Design.SetCustomize(_customize, currentCustomize); ret.Design.SetCustomize(customizeService, currentCustomize);
var startBodyType = currentCustomize.BodyType; var startBodyType = currentCustomize.BodyType;
CustomizeFlag fixFlags = 0; CustomizeFlag fixFlags = 0;
respectOwnership &= _config.UnlockedItemMode; respectOwnership &= config.UnlockedItemMode;
foreach (var (design, type, jobs) in designs) foreach (var (design, type, jobs) in designs)
{ {
if (type is 0) if (type is 0)
@ -153,7 +152,7 @@ public class DesignMerger(
if (equipFlags.HasFlag(flag)) if (equipFlags.HasFlag(flag))
{ {
var item = design.Item(slot); var item = design.Item(slot);
if (!respectOwnership || _itemUnlocks.IsUnlocked(item.Id, out _)) if (!respectOwnership || itemUnlocks.IsUnlocked(item.Id, out _))
ret.Design.GetDesignDataRef().SetItem(slot, item); ret.Design.GetDesignDataRef().SetItem(slot, item);
ret.Design.SetApplyEquip(slot, true); ret.Design.SetApplyEquip(slot, true);
ret.Sources[slot, false] = source; ret.Sources[slot, false] = source;
@ -203,7 +202,7 @@ public class DesignMerger(
return; return;
var weapon = design.Item(EquipSlot.MainHand); var weapon = design.Item(EquipSlot.MainHand);
if (respectOwnership && !_itemUnlocks.IsUnlocked(weapon.Id, out _)) if (respectOwnership && !itemUnlocks.IsUnlocked(weapon.Id, out _))
return; return;
if (!ret.Design.DoApplyEquip(EquipSlot.MainHand)) if (!ret.Design.DoApplyEquip(EquipSlot.MainHand))
@ -222,7 +221,7 @@ public class DesignMerger(
return; return;
var weapon = design.Item(EquipSlot.OffHand); var weapon = design.Item(EquipSlot.OffHand);
if (respectOwnership && !_itemUnlocks.IsUnlocked(weapon.Id, out _)) if (respectOwnership && !itemUnlocks.IsUnlocked(weapon.Id, out _))
return; return;
if (!ret.Design.DoApplyEquip(EquipSlot.OffHand)) if (!ret.Design.DoApplyEquip(EquipSlot.OffHand))
@ -252,7 +251,7 @@ public class DesignMerger(
var customize = ret.Design.DesignData.Customize; var customize = ret.Design.DesignData.Customize;
if (customizeFlags.HasFlag(CustomizeFlag.Clan)) if (customizeFlags.HasFlag(CustomizeFlag.Clan))
{ {
fixFlags |= _customize.ChangeClan(ref customize, design.Customize.Clan); fixFlags |= customizeService.ChangeClan(ref customize, design.Customize.Clan);
ret.Design.SetApplyCustomize(CustomizeIndex.Clan, true); ret.Design.SetApplyCustomize(CustomizeIndex.Clan, true);
ret.Design.SetApplyCustomize(CustomizeIndex.Race, true); ret.Design.SetApplyCustomize(CustomizeIndex.Race, true);
customizeFlags &= ~(CustomizeFlag.Clan | CustomizeFlag.Race); customizeFlags &= ~(CustomizeFlag.Clan | CustomizeFlag.Race);
@ -262,7 +261,7 @@ public class DesignMerger(
if (customizeFlags.HasFlag(CustomizeFlag.Gender)) if (customizeFlags.HasFlag(CustomizeFlag.Gender))
{ {
fixFlags |= _customize.ChangeGender(ref customize, design.Customize.Gender); fixFlags |= customizeService.ChangeGender(ref customize, design.Customize.Gender);
ret.Design.SetApplyCustomize(CustomizeIndex.Gender, true); ret.Design.SetApplyCustomize(CustomizeIndex.Gender, true);
customizeFlags &= ~CustomizeFlag.Gender; customizeFlags &= ~CustomizeFlag.Gender;
ret.Sources[CustomizeIndex.Gender] = source; ret.Sources[CustomizeIndex.Gender] = source;
@ -283,7 +282,7 @@ public class DesignMerger(
ret.Sources[CustomizeIndex.BodyType] = source; ret.Sources[CustomizeIndex.BodyType] = source;
} }
var set = _customize.Manager.GetSet(customize.Clan, customize.Gender); var set = customizeService.Manager.GetSet(customize.Clan, customize.Gender);
var face = customize.Face; var face = customize.Face;
foreach (var index in Enum.GetValues<CustomizeIndex>()) foreach (var index in Enum.GetValues<CustomizeIndex>())
{ {
@ -295,7 +294,7 @@ public class DesignMerger(
if (!CustomizeService.IsCustomizationValid(set, face, index, value, out var data)) if (!CustomizeService.IsCustomizationValid(set, face, index, value, out var data))
continue; continue;
if (data.HasValue && respectOwnership && !_customizeUnlocks.IsUnlocked(data.Value, out _)) if (data.HasValue && respectOwnership && !customizeUnlocks.IsUnlocked(data.Value, out _))
continue; continue;
customize[index] = data?.Value ?? value; customize[index] = data?.Value ?? value;
@ -304,7 +303,7 @@ public class DesignMerger(
fixFlags &= ~flag; fixFlags &= ~flag;
} }
ret.Design.SetCustomize(_customize, customize); ret.Design.SetCustomize(customizeService, customize);
} }
private static void ApplyFixFlags(MergedDesign ret, CustomizeFlag fixFlags) private static void ApplyFixFlags(MergedDesign ret, CustomizeFlag fixFlags)

View file

@ -2,8 +2,8 @@
using Glamourer.Gui; using Glamourer.Gui;
using Glamourer.Interop.Material; using Glamourer.Interop.Material;
using Glamourer.State; using Glamourer.State;
using Luna;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui.Services;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
namespace Glamourer.Designs.Special; namespace Glamourer.Designs.Special;

View file

@ -1,5 +1,5 @@
using OtterGui; 
using OtterGui.Services; using Luna;
namespace Glamourer.Designs.Special; namespace Glamourer.Designs.Special;

View file

@ -1,7 +1,7 @@
using Dalamud.Interface.Textures; using Dalamud.Interface.Textures;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Luna;
using OtterGui.Classes; using OtterGui.Classes;
using OtterGui.Services;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Race = Penumbra.GameData.Enums.Race; using Race = Penumbra.GameData.Enums.Race;

View file

@ -2,7 +2,7 @@
using Dalamud.Utility; using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Game.Object; using FFXIVClientStructs.FFXIV.Client.Game.Object;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Data; using Penumbra.GameData.Data;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;

View file

@ -6,10 +6,10 @@ using Glamourer.Gui;
using Glamourer.Interop; using Glamourer.Interop;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using OtterGui.Classes; using Luna;
using OtterGui.Log;
using OtterGui.Services;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
using Logger = OtterGui.Log.Logger;
using MessageService = OtterGui.Classes.MessageService;
namespace Glamourer; namespace Glamourer;

View file

@ -4,9 +4,9 @@ using Glamourer.GameData;
using Glamourer.Interop.PalettePlus; using Glamourer.Interop.PalettePlus;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
namespace Glamourer.Gui.Customization; namespace Glamourer.Gui.Customization;

View file

@ -1,13 +1,12 @@
using Glamourer.Services; using Glamourer.Services;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using OtterGui.Services;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Equipment; namespace Glamourer.Gui.Equipment;
public class ItemCopyService(ItemManager items, DictStain stainData) : IUiService public class ItemCopyService(ItemManager items, DictStain stainData) : Luna.IUiService
{ {
public EquipItem? Item { get; private set; } public EquipItem? Item { get; private set; }
public Stain? Stain { get; private set; } public Stain? Stain { get; private set; }

View file

@ -1,5 +1,4 @@
using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin; using Dalamud.Plugin;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.Events; using Glamourer.Events;
@ -13,13 +12,16 @@ using Glamourer.Gui.Tabs.SettingsTab;
using Glamourer.Gui.Tabs.UnlocksTab; using Glamourer.Gui.Tabs.UnlocksTab;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui; using OtterGui;
using OtterGui.Classes; using OtterGui.Classes;
using OtterGui.Custom; using OtterGui.Custom;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Text; using OtterGui.Text;
using OtterGui.Widgets; using OtterGui.Widgets;
using Changelog = OtterGui.Widgets.Changelog;
using ITab = OtterGui.Widgets.ITab;
using Window = Dalamud.Interface.Windowing.Window;
namespace Glamourer.Gui; namespace Glamourer.Gui;

View file

@ -9,8 +9,8 @@ using Glamourer.Designs;
using Glamourer.Interop.Material; using Glamourer.Interop.Material;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Text; using OtterGui.Text;
using OtterGui.Widgets; using OtterGui.Widgets;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;

View file

@ -4,16 +4,15 @@ using Dalamud.Interface.Utility.Raii;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.Interop.Material; using Glamourer.Interop.Material;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui; using OtterGui;
using OtterGui.Services;
using OtterGui.Text; using OtterGui.Text;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Files.MaterialStructs; using Penumbra.GameData.Files.MaterialStructs;
using Penumbra.GameData.Gui;
namespace Glamourer.Gui.Materials; namespace Glamourer.Gui.Materials;
public class MaterialDrawer(DesignManager _designManager, Configuration _config) : IService public class MaterialDrawer(DesignManager designManager, Configuration config) : IService
{ {
public const float GlossWidth = 100; public const float GlossWidth = 100;
public const float SpecularStrengthWidth = 125; public const float SpecularStrengthWidth = 125;
@ -48,34 +47,34 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config)
private void DrawMultiButtons(Design design) private void DrawMultiButtons(Design design)
{ {
var any = design.Materials.Count > 0; var any = design.Materials.Count > 0;
var disabled = !_config.DeleteDesignModifier.IsActive(); var disabled = !config.DeleteDesignModifier.IsActive();
var size = new Vector2(200 * ImUtf8.GlobalScale, 0); var size = new Vector2(200 * ImUtf8.GlobalScale, 0);
if (ImUtf8.ButtonEx("Enable All Advanced Dyes"u8, if (ImUtf8.ButtonEx("Enable All Advanced Dyes"u8,
any any
? "Enable the application of all contained advanced dyes without deleting them."u8 ? "Enable the application of all contained advanced dyes without deleting them."u8
: "This design does not contain any advanced dyes."u8, size, : "This design does not contain any advanced dyes."u8, size,
!any || disabled)) !any || disabled))
_designManager.ChangeApplyMulti(design, null, null, null, null, null, null, true, null); designManager.ChangeApplyMulti(design, null, null, null, null, null, null, true, null);
; ;
if (disabled && any) if (disabled && any)
ImUtf8.HoverTooltip($"Hold {_config.DeleteDesignModifier} while clicking to enable."); ImUtf8.HoverTooltip($"Hold {config.DeleteDesignModifier} while clicking to enable.");
ImGui.SameLine(); ImGui.SameLine();
if (ImUtf8.ButtonEx("Disable All Advanced Dyes"u8, if (ImUtf8.ButtonEx("Disable All Advanced Dyes"u8,
any any
? "Disable the application of all contained advanced dyes without deleting them."u8 ? "Disable the application of all contained advanced dyes without deleting them."u8
: "This design does not contain any advanced dyes."u8, size, : "This design does not contain any advanced dyes."u8, size,
!any || disabled)) !any || disabled))
_designManager.ChangeApplyMulti(design, null, null, null, null, null, null, false, null); designManager.ChangeApplyMulti(design, null, null, null, null, null, null, false, null);
if (disabled && any) if (disabled && any)
ImUtf8.HoverTooltip($"Hold {_config.DeleteDesignModifier} while clicking to disable."); ImUtf8.HoverTooltip($"Hold {config.DeleteDesignModifier} while clicking to disable.");
if (ImUtf8.ButtonEx("Delete All Advanced Dyes"u8, any ? ""u8 : "This design does not contain any advanced dyes."u8, size, if (ImUtf8.ButtonEx("Delete All Advanced Dyes"u8, any ? ""u8 : "This design does not contain any advanced dyes."u8, size,
!any || disabled)) !any || disabled))
while (design.Materials.Count > 0) while (design.Materials.Count > 0)
_designManager.ChangeMaterialValue(design, MaterialValueIndex.FromKey(design.Materials[0].Item1), null); designManager.ChangeMaterialValue(design, MaterialValueIndex.FromKey(design.Materials[0].Item1), null);
if (disabled && any) if (disabled && any)
ImUtf8.HoverTooltip($"Hold {_config.DeleteDesignModifier} while clicking to delete."); ImUtf8.HoverTooltip($"Hold {config.DeleteDesignModifier} while clicking to delete.");
} }
private void DrawName(MaterialValueIndex index) private void DrawName(MaterialValueIndex index)
@ -138,13 +137,13 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config)
private void DeleteButton(Design design, MaterialValueIndex index, ref int idx) private void DeleteButton(Design design, MaterialValueIndex index, ref int idx)
{ {
var deleteEnabled = _config.DeleteDesignModifier.IsActive(); var deleteEnabled = config.DeleteDesignModifier.IsActive();
if (!ImUtf8.IconButton(FontAwesomeIcon.Trash, if (!ImUtf8.IconButton(FontAwesomeIcon.Trash,
$"Delete this color row.{(deleteEnabled ? string.Empty : $"\nHold {_config.DeleteDesignModifier} to delete.")}", disabled: $"Delete this color row.{(deleteEnabled ? string.Empty : $"\nHold {config.DeleteDesignModifier} to delete.")}", disabled:
!deleteEnabled || design.WriteProtected())) !deleteEnabled || design.WriteProtected()))
return; return;
_designManager.ChangeMaterialValue(design, index, null); designManager.ChangeMaterialValue(design, index, null);
--idx; --idx;
} }
@ -158,19 +157,19 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config)
{ {
if (ImUtf8.IconButton(FontAwesomeIcon.Paste, "Import an exported row from your clipboard onto this row."u8, if (ImUtf8.IconButton(FontAwesomeIcon.Paste, "Import an exported row from your clipboard onto this row."u8,
disabled: !ColorRowClipboard.IsSet || design.WriteProtected())) disabled: !ColorRowClipboard.IsSet || design.WriteProtected()))
_designManager.ChangeMaterialValue(design, index, ColorRowClipboard.Row); designManager.ChangeMaterialValue(design, index, ColorRowClipboard.Row);
} }
private void EnabledToggle(Design design, MaterialValueIndex index, bool enabled) private void EnabledToggle(Design design, MaterialValueIndex index, bool enabled)
{ {
if (ImUtf8.Checkbox("Enabled"u8, ref enabled)) if (ImUtf8.Checkbox("Enabled"u8, ref enabled))
_designManager.ChangeApplyMaterialValue(design, index, enabled); designManager.ChangeApplyMaterialValue(design, index, enabled);
} }
private void RevertToggle(Design design, MaterialValueIndex index, bool revert) private void RevertToggle(Design design, MaterialValueIndex index, bool revert)
{ {
if (ImUtf8.Checkbox("Revert"u8, ref revert)) if (ImUtf8.Checkbox("Revert"u8, ref revert))
_designManager.ChangeMaterialRevert(design, index, revert); designManager.ChangeMaterialRevert(design, index, revert);
ImUtf8.HoverTooltip( ImUtf8.HoverTooltip(
"If this is checked, Glamourer will try to revert the advanced dye row to its game state instead of applying a specific row."u8); "If this is checked, Glamourer will try to revert the advanced dye row to its game state instead of applying a specific row."u8);
} }
@ -222,7 +221,7 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config)
if (ImUtf8.ButtonEx("Add New Row"u8, if (ImUtf8.ButtonEx("Add New Row"u8,
exists ? "The selected advanced dye row already exists."u8 : "Add the selected advanced dye row."u8, Vector2.Zero, exists ? "The selected advanced dye row already exists."u8 : "Add the selected advanced dye row."u8, Vector2.Zero,
exists || design.WriteProtected())) exists || design.WriteProtected()))
_designManager.ChangeMaterialValue(design, _newKey, ColorRow.Empty); designManager.ChangeMaterialValue(design, _newKey, ColorRow.Empty);
} }
private void DrawMaterialIdxDrag() private void DrawMaterialIdxDrag()
@ -270,6 +269,6 @@ public class MaterialDrawer(DesignManager _designManager, Configuration _config)
applied |= AdvancedDyePopup.DragSpecularStrength(ref tmp.SpecularStrength); applied |= AdvancedDyePopup.DragSpecularStrength(ref tmp.SpecularStrength);
ImUtf8.HoverTooltip("Change the specular strength for this row."u8); ImUtf8.HoverTooltip("Change the specular strength for this row."u8);
if (applied) if (applied)
_designManager.ChangeMaterialValue(design, index, tmp); designManager.ChangeMaterialValue(design, index, tmp);
} }
} }

View file

@ -26,7 +26,7 @@ public class IdentifierDrawer
HumanModelList humans) HumanModelList humans)
{ {
_actors = actors; _actors = actors;
_worldCombo = new WorldCombo(dictWorld, Glamourer.Log); _worldCombo = new WorldCombo(dictWorld);
_humanNpcCombo = new HumanNpcCombo("##npcs", dictModelChara, bNpcNames, bNpc, humans, Glamourer.Log); _humanNpcCombo = new HumanNpcCombo("##npcs", dictModelChara, bNpcNames, bNpc, humans, Glamourer.Log);
} }
@ -68,12 +68,12 @@ public class IdentifierDrawer
{ {
if (ByteString.FromString(_characterName, out var byteName)) if (ByteString.FromString(_characterName, out var byteName))
{ {
PlayerIdentifier = _actors.CreatePlayer(byteName, _worldCombo.CurrentSelection.Key); PlayerIdentifier = _actors.CreatePlayer(byteName, _worldCombo.Selected.Key);
RetainerIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Bell); RetainerIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Bell);
MannequinIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Mannequin); MannequinIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Mannequin);
if (_humanNpcCombo.CurrentSelection.Kind is ObjectKind.EventNpc or ObjectKind.BattleNpc) if (_humanNpcCombo.CurrentSelection.Kind is ObjectKind.EventNpc or ObjectKind.BattleNpc)
OwnedIdentifier = _actors.CreateOwned(byteName, _worldCombo.CurrentSelection.Key, _humanNpcCombo.CurrentSelection.Kind, _humanNpcCombo.CurrentSelection.Ids[0]); OwnedIdentifier = _actors.CreateOwned(byteName, _worldCombo.Selected.Key, _humanNpcCombo.CurrentSelection.Kind, _humanNpcCombo.CurrentSelection.Ids[0]);
else else
OwnedIdentifier = ActorIdentifier.Invalid; OwnedIdentifier = ActorIdentifier.Invalid;
} }

View file

@ -5,9 +5,9 @@ using Glamourer.Designs;
using Glamourer.Designs.Special; using Glamourer.Designs.Special;
using Glamourer.Events; using Glamourer.Events;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Text; using OtterGui.Text;
namespace Glamourer.Gui.Tabs.AutomationTab; namespace Glamourer.Gui.Tabs.AutomationTab;

View file

@ -20,26 +20,26 @@ using Action = System.Action;
namespace Glamourer.Gui.Tabs.AutomationTab; namespace Glamourer.Gui.Tabs.AutomationTab;
public class SetPanel( public class SetPanel(
SetSelector _selector, SetSelector selector,
AutoDesignManager _manager, AutoDesignManager manager,
JobService _jobs, JobService jobs,
ItemUnlockManager _itemUnlocks, ItemUnlockManager itemUnlocks,
SpecialDesignCombo _designCombo, SpecialDesignCombo designCombo,
CustomizeUnlockManager _customizeUnlocks, CustomizeUnlockManager customizeUnlocks,
CustomizeService _customizations, CustomizeService customizations,
IdentifierDrawer _identifierDrawer, IdentifierDrawer identifierDrawer,
Configuration _config, Configuration config,
RandomRestrictionDrawer _randomDrawer) RandomRestrictionDrawer randomDrawer)
{ {
private readonly JobGroupCombo _jobGroupCombo = new(_manager, _jobs, Glamourer.Log); private readonly JobGroupCombo _jobGroupCombo = new(manager, jobs, Glamourer.Log);
private readonly HeaderDrawer.Button[] _rightButtons = [new HeaderDrawer.IncognitoButton(_config)]; private readonly HeaderDrawer.Button[] _rightButtons = [new HeaderDrawer.IncognitoButton(config)];
private string? _tempName; private string? _tempName;
private int _dragIndex = -1; private int _dragIndex = -1;
private Action? _endAction; private Action? _endAction;
private AutoDesignSet Selection private AutoDesignSet Selection
=> _selector.Selection!; => selector.Selection!;
public void Draw() public void Draw()
{ {
@ -49,12 +49,12 @@ public class SetPanel(
} }
private void DrawHeader() private void DrawHeader()
=> HeaderDrawer.Draw(_selector.SelectionName, 0, ImGui.GetColorU32(ImGuiCol.FrameBg), [], _rightButtons); => HeaderDrawer.Draw(selector.SelectionName, 0, ImGui.GetColorU32(ImGuiCol.FrameBg), [], _rightButtons);
private void DrawPanel() private void DrawPanel()
{ {
using var child = ImUtf8.Child("##Panel"u8, -Vector2.One, true); using var child = ImUtf8.Child("##Panel"u8, -Vector2.One, true);
if (!child || !_selector.HasSelection) if (!child || !selector.HasSelection)
return; return;
var spacing = ImGui.GetStyle().ItemInnerSpacing with { Y = ImGui.GetStyle().ItemSpacing.Y }; var spacing = ImGui.GetStyle().ItemInnerSpacing with { Y = ImGui.GetStyle().ItemSpacing.Y };
@ -65,16 +65,16 @@ public class SetPanel(
{ {
var enabled = Selection.Enabled; var enabled = Selection.Enabled;
if (ImUtf8.Checkbox("##Enabled"u8, ref enabled)) if (ImUtf8.Checkbox("##Enabled"u8, ref enabled))
_manager.SetState(_selector.SelectionIndex, enabled); manager.SetState(selector.SelectionIndex, enabled);
ImUtf8.LabeledHelpMarker("Enabled"u8, ImUtf8.LabeledHelpMarker("Enabled"u8,
"Whether the designs in this set should be applied at all. Only one set can be enabled for a character at the same time."u8); "Whether the designs in this set should be applied at all. Only one set can be enabled for a character at the same time."u8);
} }
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing)) using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
{ {
var useGame = _selector.Selection!.BaseState is AutoDesignSet.Base.Game; var useGame = selector.Selection!.BaseState is AutoDesignSet.Base.Game;
if (ImUtf8.Checkbox("##gameState"u8, ref useGame)) if (ImUtf8.Checkbox("##gameState"u8, ref useGame))
_manager.ChangeBaseState(_selector.SelectionIndex, useGame ? AutoDesignSet.Base.Game : AutoDesignSet.Base.Current); manager.ChangeBaseState(selector.SelectionIndex, useGame ? AutoDesignSet.Base.Game : AutoDesignSet.Base.Current);
ImUtf8.LabeledHelpMarker("Use Game State as Base"u8, ImUtf8.LabeledHelpMarker("Use Game State as Base"u8,
"When this is enabled, the designs matching conditions will be applied successively on top of what your character is supposed to look like for the game. "u8 "When this is enabled, the designs matching conditions will be applied successively on top of what your character is supposed to look like for the game. "u8
+ "Otherwise, they will be applied on top of the characters actual current look using Glamourer."u8); + "Otherwise, they will be applied on top of the characters actual current look using Glamourer."u8);
@ -86,11 +86,11 @@ public class SetPanel(
{ {
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing)) using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
{ {
var editing = _config.ShowAutomationSetEditing; var editing = config.ShowAutomationSetEditing;
if (ImUtf8.Checkbox("##Show Editing"u8, ref editing)) if (ImUtf8.Checkbox("##Show Editing"u8, ref editing))
{ {
_config.ShowAutomationSetEditing = editing; config.ShowAutomationSetEditing = editing;
_config.Save(); config.Save();
} }
ImUtf8.LabeledHelpMarker("Show Editing"u8, ImUtf8.LabeledHelpMarker("Show Editing"u8,
@ -99,47 +99,47 @@ public class SetPanel(
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing)) using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
{ {
var resetSettings = _selector.Selection!.ResetTemporarySettings; var resetSettings = selector.Selection!.ResetTemporarySettings;
if (ImGui.Checkbox("##resetSettings", ref resetSettings)) if (ImGui.Checkbox("##resetSettings", ref resetSettings))
_manager.ChangeResetSettings(_selector.SelectionIndex, resetSettings); manager.ChangeResetSettings(selector.SelectionIndex, resetSettings);
ImUtf8.LabeledHelpMarker("Reset Temporary Settings"u8, ImUtf8.LabeledHelpMarker("Reset Temporary Settings"u8,
"Always reset all temporary settings applied by Glamourer when this automation set is applied, regardless of active designs."u8); "Always reset all temporary settings applied by Glamourer when this automation set is applied, regardless of active designs."u8);
} }
} }
if (_config.ShowAutomationSetEditing) if (config.ShowAutomationSetEditing)
{ {
ImGui.Dummy(Vector2.Zero); ImGui.Dummy(Vector2.Zero);
ImGui.Separator(); ImGui.Separator();
ImGui.Dummy(Vector2.Zero); ImGui.Dummy(Vector2.Zero);
var name = _tempName ?? Selection.Name; var name = _tempName ?? Selection.Name;
var flags = _selector.IncognitoMode ? ImGuiInputTextFlags.ReadOnly | ImGuiInputTextFlags.Password : ImGuiInputTextFlags.None; var flags = selector.IncognitoMode ? ImGuiInputTextFlags.ReadOnly | ImGuiInputTextFlags.Password : ImGuiInputTextFlags.None;
ImGui.SetNextItemWidth(330 * ImGuiHelpers.GlobalScale); ImGui.SetNextItemWidth(330 * ImGuiHelpers.GlobalScale);
if (ImGui.InputText("Rename Set##Name", ref name, 128, flags)) if (ImGui.InputText("Rename Set##Name", ref name, 128, flags))
_tempName = name; _tempName = name;
if (ImGui.IsItemDeactivated()) if (ImGui.IsItemDeactivated())
{ {
_manager.Rename(_selector.SelectionIndex, name); manager.Rename(selector.SelectionIndex, name);
_tempName = null; _tempName = null;
} }
DrawIdentifierSelection(_selector.SelectionIndex); DrawIdentifierSelection(selector.SelectionIndex);
} }
ImGui.Dummy(Vector2.Zero); ImGui.Dummy(Vector2.Zero);
ImGui.Separator(); ImGui.Separator();
ImGui.Dummy(Vector2.Zero); ImGui.Dummy(Vector2.Zero);
DrawDesignTable(); DrawDesignTable();
_randomDrawer.Draw(); randomDrawer.Draw();
} }
private void DrawDesignTable() private void DrawDesignTable()
{ {
var (numCheckboxes, numSpacing) = (_config.ShowAllAutomatedApplicationRules, _config.ShowUnlockedItemWarnings) switch var (numCheckboxes, numSpacing) = (config.ShowAllAutomatedApplicationRules, config.ShowUnlockedItemWarnings) switch
{ {
(true, true) => (9, 14), (true, true) => (9, 14),
(true, false) => (7, 10), (true, false) => (7, 10),
@ -153,7 +153,7 @@ public class SetPanel(
+ 150 * ImGuiHelpers.GlobalScale; + 150 * ImGuiHelpers.GlobalScale;
var singleRow = ImGui.GetContentRegionAvail().X >= requiredSizeOneLine || numSpacing == 0; var singleRow = ImGui.GetContentRegionAvail().X >= requiredSizeOneLine || numSpacing == 0;
var numRows = (singleRow, _config.ShowUnlockedItemWarnings) switch var numRows = (singleRow, config.ShowUnlockedItemWarnings) switch
{ {
(true, true) => 6, (true, true) => 6,
(true, false) => 5, (true, false) => 5,
@ -171,7 +171,7 @@ public class SetPanel(
if (singleRow) if (singleRow)
{ {
ImUtf8.TableSetupColumn("Design"u8, ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale); ImUtf8.TableSetupColumn("Design"u8, ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale);
if (_config.ShowAllAutomatedApplicationRules) if (config.ShowAllAutomatedApplicationRules)
ImUtf8.TableSetupColumn("Application"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.TableSetupColumn("Application"u8, ImGuiTableColumnFlags.WidthFixed,
6 * ImGui.GetFrameHeight() + 10 * ImGuiHelpers.GlobalScale); 6 * ImGui.GetFrameHeight() + 10 * ImGuiHelpers.GlobalScale);
else else
@ -181,7 +181,7 @@ public class SetPanel(
{ {
ImUtf8.TableSetupColumn("Design / Job Restrictions"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.TableSetupColumn("Design / Job Restrictions"u8, ImGuiTableColumnFlags.WidthFixed,
250 * ImGuiHelpers.GlobalScale - (ImGui.GetScrollMaxY() > 0 ? ImGui.GetStyle().ScrollbarSize : 0)); 250 * ImGuiHelpers.GlobalScale - (ImGui.GetScrollMaxY() > 0 ? ImGui.GetStyle().ScrollbarSize : 0));
if (_config.ShowAllAutomatedApplicationRules) if (config.ShowAllAutomatedApplicationRules)
ImUtf8.TableSetupColumn("Application"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.TableSetupColumn("Application"u8, ImGuiTableColumnFlags.WidthFixed,
3 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); 3 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale);
else else
@ -191,7 +191,7 @@ public class SetPanel(
if (singleRow) if (singleRow)
ImUtf8.TableSetupColumn("Job Restrictions"u8, ImGuiTableColumnFlags.WidthStretch); ImUtf8.TableSetupColumn("Job Restrictions"u8, ImGuiTableColumnFlags.WidthStretch);
if (_config.ShowUnlockedItemWarnings) if (config.ShowUnlockedItemWarnings)
ImUtf8.TableSetupColumn(""u8, ImGuiTableColumnFlags.WidthFixed, 2 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); ImUtf8.TableSetupColumn(""u8, ImGuiTableColumnFlags.WidthFixed, 2 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale);
ImGui.TableHeadersRow(); ImGui.TableHeadersRow();
@ -199,19 +199,19 @@ public class SetPanel(
{ {
using var id = ImUtf8.PushId(idx); using var id = ImUtf8.PushId(idx);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var keyValid = _config.DeleteDesignModifier.IsActive(); var keyValid = config.DeleteDesignModifier.IsActive();
var tt = keyValid var tt = keyValid
? "Remove this design from the set." ? "Remove this design from the set."
: $"Remove this design from the set.\nHold {_config.DeleteDesignModifier} to remove."; : $"Remove this design from the set.\nHold {config.DeleteDesignModifier} to remove.";
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), new Vector2(ImGui.GetFrameHeight()), tt, !keyValid, true)) if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), new Vector2(ImGui.GetFrameHeight()), tt, !keyValid, true))
_endAction = () => _manager.DeleteDesign(Selection, idx); _endAction = () => manager.DeleteDesign(Selection, idx);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
DrawSelectable(idx, design.Design); DrawSelectable(idx, design.Design);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
DrawRandomEditing(Selection, design, idx); DrawRandomEditing(Selection, design, idx);
_designCombo.Draw(Selection, design, idx); designCombo.Draw(Selection, design, idx);
DrawDragDrop(Selection, idx); DrawDragDrop(Selection, idx);
if (singleRow) if (singleRow)
{ {
@ -227,7 +227,7 @@ public class SetPanel(
DrawApplicationTypeBoxes(Selection, design, idx, singleRow); DrawApplicationTypeBoxes(Selection, design, idx, singleRow);
} }
if (_config.ShowUnlockedItemWarnings) if (config.ShowUnlockedItemWarnings)
{ {
ImGui.TableNextColumn(); ImGui.TableNextColumn();
DrawWarnings(design); DrawWarnings(design);
@ -238,7 +238,7 @@ public class SetPanel(
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImUtf8.TextFrameAligned("New"u8); ImUtf8.TextFrameAligned("New"u8);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
_designCombo.Draw(Selection, null, -1); designCombo.Draw(Selection, null, -1);
ImGui.TableNextRow(); ImGui.TableNextRow();
_endAction?.Invoke(); _endAction?.Invoke();
@ -292,7 +292,7 @@ public class SetPanel(
if (ImUtf8.Button($"{(usingGearset ? "Gearset:" : "Jobs:")}##usingGearset")) if (ImUtf8.Button($"{(usingGearset ? "Gearset:" : "Jobs:")}##usingGearset"))
{ {
usingGearset = !usingGearset; usingGearset = !usingGearset;
_manager.ChangeGearsetCondition(Selection, idx, (short)(usingGearset ? 0 : -1)); manager.ChangeGearsetCondition(Selection, idx, (short)(usingGearset ? 0 : -1));
} }
ImUtf8.HoverTooltip("Click to switch between Job and Gearset restrictions."u8); ImUtf8.HoverTooltip("Click to switch between Job and Gearset restrictions."u8);
@ -310,7 +310,7 @@ public class SetPanel(
if (ImGui.IsItemDeactivatedAfterEdit()) if (ImGui.IsItemDeactivatedAfterEdit())
{ {
_manager.ChangeGearsetCondition(Selection, idx, (short)(_tmpGearset - 1)); manager.ChangeGearsetCondition(Selection, idx, (short)(_tmpGearset - 1));
_tmpGearset = int.MaxValue; _tmpGearset = int.MaxValue;
_whichIndex = -1; _whichIndex = -1;
} }
@ -326,7 +326,7 @@ public class SetPanel(
if (design.Design is not RandomDesign) if (design.Design is not RandomDesign)
return; return;
_randomDrawer.DrawButton(set, designIdx); randomDrawer.DrawButton(set, designIdx);
ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X); ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X);
} }
@ -348,16 +348,16 @@ public class SetPanel(
continue; continue;
var item = designData.Item(slot); var item = designData.Item(slot);
if (!_itemUnlocks.IsUnlocked(item.Id, out _)) if (!itemUnlocks.IsUnlocked(item.Id, out _))
sb.AppendLine($"{item.Name} in {slot.ToName()} slot is not unlocked. Consider obtaining it via gameplay means!"); sb.AppendLine($"{item.Name} in {slot.ToName()} slot is not unlocked. Consider obtaining it via gameplay means!");
} }
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * ImGuiHelpers.GlobalScale, 0)); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * ImGuiHelpers.GlobalScale, 0));
var tt = _config.UnlockedItemMode var tt = config.UnlockedItemMode
? "\nThese items will be skipped when applied automatically.\n\nTo change this, disable the Obtained Item Mode setting." ? "\nThese items will be skipped when applied automatically.\n\nTo change this, disable the Obtained Item Mode setting."
: string.Empty; : string.Empty;
DrawWarning(sb, _config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All equipment to be applied is unlocked."); DrawWarning(sb, config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All equipment to be applied is unlocked.");
sb.Clear(); sb.Clear();
var sb2 = new StringBuilder(); var sb2 = new StringBuilder();
@ -365,7 +365,7 @@ public class SetPanel(
if (!designData.IsHuman) if (!designData.IsHuman)
sb.AppendLine("The base model id can not be changed automatically to something non-human."); sb.AppendLine("The base model id can not be changed automatically to something non-human.");
var set = _customizations.Manager.GetSet(customize.Clan, customize.Gender); var set = customizations.Manager.GetSet(customize.Clan, customize.Gender);
foreach (var type in CustomizationExtensions.All) foreach (var type in CustomizationExtensions.All)
{ {
var flag = type.ToFlag(); var flag = type.ToFlag();
@ -376,16 +376,16 @@ public class SetPanel(
sb.AppendLine($"{type.ToDefaultName()} Customization should not be changed automatically."); sb.AppendLine($"{type.ToDefaultName()} Customization should not be changed automatically.");
else if (type is CustomizeIndex.Hairstyle or CustomizeIndex.FacePaint else if (type is CustomizeIndex.Hairstyle or CustomizeIndex.FacePaint
&& set.DataByValue(type, customize[type], out var data, customize.Face) >= 0 && set.DataByValue(type, customize[type], out var data, customize.Face) >= 0
&& !_customizeUnlocks.IsUnlocked(data!.Value, out _)) && !customizeUnlocks.IsUnlocked(data!.Value, out _))
sb2.AppendLine( sb2.AppendLine(
$"{type.ToDefaultName()} Customization {_customizeUnlocks.Unlockable[data.Value].Name} is not unlocked but should be applied."); $"{type.ToDefaultName()} Customization {customizeUnlocks.Unlockable[data.Value].Name} is not unlocked but should be applied.");
} }
ImGui.SameLine(); ImGui.SameLine();
tt = _config.UnlockedItemMode tt = config.UnlockedItemMode
? "\nThese customizations will be skipped when applied automatically.\n\nTo change this, disable the Obtained Item Mode setting." ? "\nThese customizations will be skipped when applied automatically.\n\nTo change this, disable the Obtained Item Mode setting."
: string.Empty; : string.Empty;
DrawWarning(sb2, _config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All customizations to be applied are unlocked."); DrawWarning(sb2, config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All customizations to be applied are unlocked.");
ImGui.SameLine(); ImGui.SameLine();
return; return;
@ -420,7 +420,7 @@ public class SetPanel(
if (_dragIndex >= 0) if (_dragIndex >= 0)
{ {
var idx = _dragIndex; var idx = _dragIndex;
_endAction = () => _manager.MoveDesign(set, idx, index); _endAction = () => manager.MoveDesign(set, idx, index);
} }
_dragIndex = -1; _dragIndex = -1;
@ -435,7 +435,7 @@ public class SetPanel(
if (ImGui.SetDragDropPayload(dragDropLabel, null, 0)) if (ImGui.SetDragDropPayload(dragDropLabel, null, 0))
{ {
_dragIndex = index; _dragIndex = index;
_selector.DragDesignIndex = index; selector.DragDesignIndex = index;
} }
} }
} }
@ -455,7 +455,7 @@ public class SetPanel(
style.Pop(); style.Pop();
ImUtf8.HoverTooltip("Toggle all application modes at once."u8); ImUtf8.HoverTooltip("Toggle all application modes at once."u8);
if (_config.ShowAllAutomatedApplicationRules) if (config.ShowAllAutomatedApplicationRules)
{ {
void Box(int idx) void Box(int idx)
{ {
@ -480,31 +480,31 @@ public class SetPanel(
Box(4); Box(4);
} }
_manager.ChangeApplicationType(set, autoDesignIndex, newType); manager.ChangeApplicationType(set, autoDesignIndex, newType);
} }
private void DrawIdentifierSelection(int setIndex) private void DrawIdentifierSelection(int setIndex)
{ {
using var id = ImUtf8.PushId("Identifiers"u8); using var id = ImUtf8.PushId("Identifiers"u8);
_identifierDrawer.DrawWorld(130); identifierDrawer.DrawWorld(130);
ImGui.SameLine(); ImGui.SameLine();
_identifierDrawer.DrawName(200 - ImGui.GetStyle().ItemSpacing.X); identifierDrawer.DrawName(200 - ImGui.GetStyle().ItemSpacing.X);
_identifierDrawer.DrawNpcs(330); identifierDrawer.DrawNpcs(330);
var buttonWidth = new Vector2(165 * ImGuiHelpers.GlobalScale - ImGui.GetStyle().ItemSpacing.X / 2, 0); var buttonWidth = new Vector2(165 * ImGuiHelpers.GlobalScale - ImGui.GetStyle().ItemSpacing.X / 2, 0);
if (ImUtf8.ButtonEx("Set to Character"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetPlayer)) if (ImUtf8.ButtonEx("Set to Character"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetPlayer))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.PlayerIdentifier); manager.ChangeIdentifier(setIndex, identifierDrawer.PlayerIdentifier);
ImGui.SameLine(); ImGui.SameLine();
if (ImUtf8.ButtonEx("Set to NPC"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetNpc)) if (ImUtf8.ButtonEx("Set to NPC"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetNpc))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.NpcIdentifier); manager.ChangeIdentifier(setIndex, identifierDrawer.NpcIdentifier);
if (ImUtf8.ButtonEx("Set to Retainer"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetRetainer)) if (ImUtf8.ButtonEx("Set to Retainer"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetRetainer))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.RetainerIdentifier); manager.ChangeIdentifier(setIndex, identifierDrawer.RetainerIdentifier);
ImGui.SameLine(); ImGui.SameLine();
if (ImUtf8.ButtonEx("Set to Mannequin"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetRetainer)) if (ImUtf8.ButtonEx("Set to Mannequin"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetRetainer))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.MannequinIdentifier); manager.ChangeIdentifier(setIndex, identifierDrawer.MannequinIdentifier);
if (ImUtf8.ButtonEx("Set to Owned NPC"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetOwned)) if (ImUtf8.ButtonEx("Set to Owned NPC"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetOwned))
_manager.ChangeIdentifier(setIndex, _identifierDrawer.OwnedIdentifier); manager.ChangeIdentifier(setIndex, identifierDrawer.OwnedIdentifier);
} }
private sealed class JobGroupCombo(AutoDesignManager manager, JobService jobs, Logger log) private sealed class JobGroupCombo(AutoDesignManager manager, JobService jobs, Logger log)
@ -514,7 +514,7 @@ public class SetPanel(
{ {
CurrentSelection = design.Jobs; CurrentSelection = design.Jobs;
CurrentSelectionIdx = jobs.JobGroups.Values.IndexOf(j => j.Id == design.Jobs.Id); CurrentSelectionIdx = jobs.JobGroups.Values.IndexOf(j => j.Id == design.Jobs.Id);
if (Draw("##JobGroups", design.Jobs.Name, if (Draw("##JobGroups", design.Jobs.Name.ToString(),
"Select for which job groups this design should be applied.\nControl + Right-Click to set to all classes.", "Select for which job groups this design should be applied.\nControl + Right-Click to set to all classes.",
ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeightWithSpacing()) ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeightWithSpacing())
&& CurrentSelectionIdx >= 0) && CurrentSelectionIdx >= 0)
@ -524,6 +524,6 @@ public class SetPanel(
} }
protected override string ToString(JobGroup obj) protected override string ToString(JobGroup obj)
=> obj.Name; => obj.Name.ToString();
} }
} }

View file

@ -3,6 +3,7 @@ using Glamourer.GameData;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -11,29 +12,29 @@ using Penumbra.GameData.Interop;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class ActiveStatePanel(StateManager _stateManager, ActorObjectManager _objectManager) : IGameDataDrawer public sealed class ActiveStatePanel(StateManager stateManager, ActorObjectManager objectManager) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> $"Active Actors ({_stateManager.Count})###Active Actors"; => new StringU8($"Active Actors ({stateManager.Count})###Active Actors");
public bool Disabled public bool Disabled
=> false; => false;
public void Draw() public void Draw()
{ {
foreach (var (identifier, actors) in _objectManager) foreach (var (identifier, actors) in objectManager)
{ {
if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Trash.ToIconString()}##{actors.Label}", new Vector2(ImGui.GetFrameHeight()), if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Trash.ToIconString()}##{actors.Label}", new Vector2(ImGui.GetFrameHeight()),
string.Empty, !_stateManager.ContainsKey(identifier), true)) string.Empty, !stateManager.ContainsKey(identifier), true))
_stateManager.DeleteState(identifier); stateManager.DeleteState(identifier);
ImGui.SameLine(); ImGui.SameLine();
using var t = ImRaii.TreeNode(actors.Label); using var t = ImRaii.TreeNode(actors.Label);
if (!t) if (!t)
continue; continue;
if (_stateManager.GetOrCreate(identifier, actors.Objects[0], out var state)) if (stateManager.GetOrCreate(identifier, actors.Objects[0], out var state))
DrawState(_stateManager, actors, state); DrawState(stateManager, actors, state);
else else
ImGui.TextUnformatted("Invalid actor."); ImGui.TextUnformatted("Invalid actor.");
} }

View file

@ -7,10 +7,10 @@ using Penumbra.GameData.Interop;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public unsafe class AdvancedCustomizationDrawer(ActorObjectManager objects) : IGameDataDrawer public sealed unsafe class AdvancedCustomizationDrawer(ActorObjectManager objects) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Advanced Customizations"; => "Advanced Customizations"u8;
public bool Disabled public bool Disabled
=> false; => false;

View file

@ -7,17 +7,17 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class AutoDesignPanel(AutoDesignManager _autoDesignManager) : IGameDataDrawer public sealed class AutoDesignPanel(AutoDesignManager autoDesignManager) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Auto Designs"; => "Auto Designs"u8;
public bool Disabled public bool Disabled
=> false; => false;
public void Draw() public void Draw()
{ {
foreach (var (set, idx) in _autoDesignManager.WithIndex()) foreach (var (set, idx) in autoDesignManager.WithIndex())
{ {
using var id = ImRaii.PushId(idx); using var id = ImRaii.PushId(idx);
using var tree = ImRaii.TreeNode(set.Name); using var tree = ImRaii.TreeNode(set.Name);

View file

@ -11,10 +11,10 @@ using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class CustomizationServicePanel(CustomizeService customize) : IGameDataDrawer public sealed class CustomizationServicePanel(CustomizeService customize) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Customization Service"; => "Customization Service"u8;
public bool Disabled public bool Disabled
=> !customize.Finished; => !customize.Finished;

View file

@ -7,10 +7,10 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class CustomizationUnlockPanel(CustomizeUnlockManager _customizeUnlocks) : IGameDataDrawer public sealed class CustomizationUnlockPanel(CustomizeUnlockManager customizeUnlocks) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Customizations"; => "Customizations"u8;
public bool Disabled public bool Disabled
=> false; => false;
@ -26,19 +26,19 @@ public class CustomizationUnlockPanel(CustomizeUnlockManager _customizeUnlocks)
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing());
ImGui.TableNextRow(); ImGui.TableNextRow();
var remainder = ImGuiClip.ClippedDraw(_customizeUnlocks.Unlockable, skips, t => var remainder = ImGuiClip.ClippedDraw(customizeUnlocks.Unlockable, skips, t =>
{ {
ImGuiUtil.DrawTableColumn(t.Key.Index.ToDefaultName()); ImGuiUtil.DrawTableColumn(t.Key.Index.ToDefaultName());
ImGuiUtil.DrawTableColumn(t.Key.CustomizeId.ToString()); ImGuiUtil.DrawTableColumn(t.Key.CustomizeId.ToString());
ImGuiUtil.DrawTableColumn(t.Key.Value.Value.ToString()); ImGuiUtil.DrawTableColumn(t.Key.Value.Value.ToString());
ImGuiUtil.DrawTableColumn(t.Value.Data.ToString()); ImGuiUtil.DrawTableColumn(t.Value.Data.ToString());
ImGuiUtil.DrawTableColumn(t.Value.Name); ImGuiUtil.DrawTableColumn(t.Value.Name);
ImGuiUtil.DrawTableColumn(_customizeUnlocks.IsUnlocked(t.Key, out var time) ImGuiUtil.DrawTableColumn(customizeUnlocks.IsUnlocked(t.Key, out var time)
? time == DateTimeOffset.MinValue ? time == DateTimeOffset.MinValue
? "Always" ? "Always"
: time.LocalDateTime.ToString("g") : time.LocalDateTime.ToString("g")
: "Never"); : "Never");
}, _customizeUnlocks.Unlockable.Count); }, customizeUnlocks.Unlockable.Count);
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight());
} }
} }

View file

@ -6,26 +6,26 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class DatFilePanel(ImportService _importService) : IGameDataDrawer public sealed class DatFilePanel(ImportService importService) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Character Dat File"; => "Character Dat File"u8;
public bool Disabled public bool Disabled
=> false; => false;
private string _datFilePath = string.Empty; private string _datFilePath = string.Empty;
private DatCharacterFile? _datFile = null; private DatCharacterFile? _datFile;
public void Draw() public void Draw()
{ {
ImGui.InputTextWithHint("##datFilePath", "Dat File Path...", ref _datFilePath, 256); ImGui.InputTextWithHint("##datFilePath", "Dat File Path...", ref _datFilePath, 256);
var exists = _datFilePath.Length > 0 && File.Exists(_datFilePath); var exists = _datFilePath.Length > 0 && File.Exists(_datFilePath);
if (ImGuiUtil.DrawDisabledButton("Load##Dat", Vector2.Zero, string.Empty, !exists)) if (ImGuiUtil.DrawDisabledButton("Load##Dat", Vector2.Zero, string.Empty, !exists))
_datFile = _importService.LoadDat(_datFilePath, out var tmp) ? tmp : null; _datFile = importService.LoadDat(_datFilePath, out var tmp) ? tmp : null;
if (ImGuiUtil.DrawDisabledButton("Save##Dat", Vector2.Zero, string.Empty, _datFilePath.Length == 0 || _datFile == null)) if (ImGuiUtil.DrawDisabledButton("Save##Dat", Vector2.Zero, string.Empty, _datFilePath.Length == 0 || _datFile == null))
_importService.SaveDesignAsDat(_datFilePath, _datFile!.Value.Customize, _datFile!.Value.Description); importService.SaveDesignAsDat(_datFilePath, _datFile!.Value.Customize, _datFile!.Value.Description);
if (_datFile != null) if (_datFile != null)
{ {

View file

@ -1,7 +1,7 @@
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services; using ITab = OtterGui.Widgets.ITab;
using OtterGui.Widgets;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
@ -32,7 +32,7 @@ public unsafe class DebugTab(ServiceManager manager) : ITab
if (ImGui.CollapsingHeader("General")) if (ImGui.CollapsingHeader("General"))
{ {
manager.Timers.Draw("Timers"); StartTimeTracker.Draw("Timers"u8);
} }
foreach (var header in _headers) foreach (var header in _headers)

View file

@ -1,4 +1,5 @@
using Glamourer.Gui.Tabs.DebugTab.IpcTester; using Glamourer.Gui.Tabs.DebugTab.IpcTester;
using ImSharp;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
@ -18,8 +19,8 @@ public class DebugTabHeader(string label, params IGameDataDrawer[] subTrees)
foreach (var subTree in SubTrees) foreach (var subTree in SubTrees)
{ {
using var disabled = ImRaii.Disabled(subTree.Disabled); var disabled = Im.Disabled(subTree.Disabled);
using var tree = ImRaii.TreeNode(subTree.Label); using var tree = Im.Tree.Node(subTree.Label);
if (tree) if (tree)
{ {
disabled.Dispose(); disabled.Dispose();

View file

@ -9,10 +9,10 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class DesignConverterPanel(DesignConverter _designConverter) : IGameDataDrawer public sealed class DesignConverterPanel(DesignConverter designConverter) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Design Converter"; => "Design Converter"u8;
public bool Disabled public bool Disabled
=> false; => false;
@ -48,7 +48,7 @@ public class DesignConverterPanel(DesignConverter _designConverter) : IGameDataD
_version = _clipboardData.Decompress(out _dataUncompressed); _version = _clipboardData.Decompress(out _dataUncompressed);
_textUncompressed = Encoding.UTF8.GetString(_dataUncompressed); _textUncompressed = Encoding.UTF8.GetString(_dataUncompressed);
_json = JObject.Parse(_textUncompressed); _json = JObject.Parse(_textUncompressed);
_tmpDesign = _designConverter.FromBase64(_clipboardText, true, true, out _); _tmpDesign = designConverter.FromBase64(_clipboardText, true, true, out _);
} }
catch (Exception ex) catch (Exception ex)
{ {

View file

@ -1,9 +1,9 @@
using Dalamud.Interface; using Dalamud.Interface;
using Glamourer.Designs; using Glamourer.Designs;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using OtterGui; using OtterGui;
using OtterGui.Extensions; using OtterGui.Extensions;
using OtterGui.Filesystem;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Text; using OtterGui.Text;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -11,10 +11,10 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class DesignManagerPanel(DesignManager _designManager, DesignFileSystem _designFileSystem) : IGameDataDrawer public sealed class DesignManagerPanel(DesignManager designManager, DesignFileSystem designFileSystem) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> $"Design Manager ({_designManager.Designs.Count} Designs)###Design Manager"; => new StringU8($"Design Manager ({designManager.Designs.Count} Designs)###Design Manager");
public bool Disabled public bool Disabled
=> false; => false;
@ -22,13 +22,13 @@ public class DesignManagerPanel(DesignManager _designManager, DesignFileSystem _
public void Draw() public void Draw()
{ {
DrawButtons(); DrawButtons();
foreach (var (design, idx) in _designManager.Designs.WithIndex()) foreach (var (design, idx) in designManager.Designs.WithIndex())
{ {
using var t = ImRaii.TreeNode($"{design.Name}##{idx}"); using var t = ImRaii.TreeNode($"{design.Name}##{idx}");
if (!t) if (!t)
continue; continue;
DrawDesign(design, _designFileSystem); DrawDesign(design, designFileSystem);
var base64 = DesignBase64Migration.CreateOldBase64(design.DesignData, design.Application.Equip, design.Application.Customize, var base64 = DesignBase64Migration.CreateOldBase64(design.DesignData, design.Application.Equip, design.Application.Customize,
design.Application.Meta, design.Application.Meta,
design.WriteProtected()); design.WriteProtected());
@ -44,18 +44,18 @@ public class DesignManagerPanel(DesignManager _designManager, DesignFileSystem _
if (ImUtf8.Button("Generate 500 Test Designs"u8)) if (ImUtf8.Button("Generate 500 Test Designs"u8))
for (var i = 0; i < 500; ++i) for (var i = 0; i < 500; ++i)
{ {
var design = _designManager.CreateEmpty($"Test Designs/Test Design {i}", true); var design = designManager.CreateEmpty($"Test Designs/Test Design {i}", true);
_designManager.AddTag(design, "_DebugTest"); designManager.AddTag(design, "_DebugTest");
} }
ImUtf8.SameLineInner(); ImUtf8.SameLineInner();
if (ImUtf8.Button("Remove All Test Designs"u8)) if (ImUtf8.Button("Remove All Test Designs"u8))
{ {
var designs = _designManager.Designs.Where(d => d.Tags.Contains("_DebugTest")).ToArray(); var designs = designManager.Designs.Where(d => d.Tags.Contains("_DebugTest")).ToArray();
foreach (var design in designs) foreach (var design in designs)
_designManager.Delete(design); designManager.Delete(design);
if (_designFileSystem.Find("Test Designs", out var path) && path is DesignFileSystem.Folder { TotalChildren: 0 }) if (designFileSystem.Find("Test Designs", out var path) && path is DesignFileSystem.Folder { TotalChildren: 0 })
_designFileSystem.Delete(path); designFileSystem.Delete(path);
} }
} }

View file

@ -11,10 +11,10 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class DesignTesterPanel(ItemManager _items, HumanModelList _humans) : IGameDataDrawer public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Base64 Design Tester"; => "Base64 Design Tester"u8;
public bool Disabled public bool Disabled
=> false; => false;
@ -56,7 +56,7 @@ public class DesignTesterPanel(ItemManager _items, HumanModelList _humans) : IGa
try try
{ {
_parse64 = DesignBase64Migration.MigrateBase64(_items, _humans, _base64, out var ef, out var cf, out var wp, out var meta); _parse64 = DesignBase64Migration.MigrateBase64(items, humans, _base64, out var ef, out var cf, out var wp, out var meta);
_restore = DesignBase64Migration.CreateOldBase64(in _parse64, ef, cf, meta, wp); _restore = DesignBase64Migration.CreateOldBase64(in _parse64, ef, cf, meta, wp);
_restoreBytes = Convert.FromBase64String(_restore); _restoreBytes = Convert.FromBase64String(_restore);
} }

View file

@ -1,12 +1,12 @@
using OtterGui.Services; using Luna;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class DynamisPanel(DynamisIpc dynamis) : IGameDataDrawer public sealed class DynamisPanel(DynamisIpc dynamis) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Dynamis Interop"; => "Dynamis Interop"u8;
public void Draw() public void Draw()
=> dynamis.DrawDebugInfo(); => dynamis.DrawDebugInfo();

View file

@ -4,33 +4,33 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class FunPanel(FunModule _funModule, Configuration _config) : IGameDataDrawer public sealed class FunPanel(FunModule funModule, Configuration config) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Fun Module"; => "Fun Module"u8;
public bool Disabled public bool Disabled
=> false; => false;
public void Draw() public void Draw()
{ {
ImGui.TextUnformatted($"Current Festival: {_funModule.CurrentFestival}"); ImGui.TextUnformatted($"Current Festival: {funModule.CurrentFestival}");
ImGui.TextUnformatted($"Festivals Enabled: {_config.DisableFestivals switch { 1 => "Undecided", 0 => "Enabled", _ => "Disabled" }}"); ImGui.TextUnformatted($"Festivals Enabled: {config.DisableFestivals switch { 1 => "Undecided", 0 => "Enabled", _ => "Disabled" }}");
ImGui.TextUnformatted($"Popup Open: {ImGui.IsPopupOpen("FestivalPopup", ImGuiPopupFlags.AnyPopup)}"); ImGui.TextUnformatted($"Popup Open: {ImGui.IsPopupOpen("FestivalPopup", ImGuiPopupFlags.AnyPopup)}");
if (ImGui.Button("Force Christmas")) if (ImGui.Button("Force Christmas"))
_funModule.ForceFestival(FunModule.FestivalType.Christmas); funModule.ForceFestival(FunModule.FestivalType.Christmas);
if (ImGui.Button("Force Halloween")) if (ImGui.Button("Force Halloween"))
_funModule.ForceFestival(FunModule.FestivalType.Halloween); funModule.ForceFestival(FunModule.FestivalType.Halloween);
if (ImGui.Button("Force April First")) if (ImGui.Button("Force April First"))
_funModule.ForceFestival(FunModule.FestivalType.AprilFirst); funModule.ForceFestival(FunModule.FestivalType.AprilFirst);
if (ImGui.Button("Force None")) if (ImGui.Button("Force None"))
_funModule.ForceFestival(FunModule.FestivalType.None); funModule.ForceFestival(FunModule.FestivalType.None);
if (ImGui.Button("Revert")) if (ImGui.Button("Revert"))
_funModule.ResetFestival(); funModule.ResetFestival();
if (ImGui.Button("Reset Popup")) if (ImGui.Button("Reset Popup"))
{ {
_config.DisableFestivals = 1; config.DisableFestivals = 1;
_config.Save(); config.Save();
} }
} }
} }

View file

@ -6,7 +6,6 @@ using Glamourer.Designs;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using OtterGui;
using OtterGui.Extensions; using OtterGui.Extensions;
using OtterGui.Text; using OtterGui.Text;
using Penumbra.GameData; using Penumbra.GameData;
@ -17,15 +16,15 @@ using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public unsafe class GlamourPlatePanel : IGameDataDrawer public sealed unsafe class GlamourPlatePanel : IGameDataDrawer
{ {
private readonly DesignManager _design; private readonly DesignManager _design;
private readonly ItemManager _items; private readonly ItemManager _items;
private readonly StateManager _state; private readonly StateManager _state;
private readonly ActorObjectManager _objects; private readonly ActorObjectManager _objects;
public string Label public ReadOnlySpan<byte> Label
=> "Glamour Plates"; => "Glamour Plates"u8;
public bool Disabled public bool Disabled
=> false; => false;

View file

@ -6,10 +6,10 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public unsafe class InventoryPanel : IGameDataDrawer public sealed unsafe class InventoryPanel : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Inventory"; => "Inventory"u8;
public bool Disabled public bool Disabled
=> false; => false;

View file

@ -4,9 +4,9 @@ using Dalamud.Plugin;
using Glamourer.Api.Enums; using Glamourer.Api.Enums;
using Glamourer.Api.IpcSubscribers; using Glamourer.Api.IpcSubscribers;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Text; using OtterGui.Text;
namespace Glamourer.Gui.Tabs.DebugTab.IpcTester; namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;

View file

@ -6,15 +6,15 @@ using Penumbra.GameData.Gui.Debug;
namespace Glamourer.Gui.Tabs.DebugTab.IpcTester; namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;
public class IpcTesterPanel( public sealed class IpcTesterPanel(
IDalamudPluginInterface pluginInterface, IDalamudPluginInterface pluginInterface,
DesignIpcTester designs, DesignIpcTester designs,
ItemsIpcTester items, ItemsIpcTester items,
StateIpcTester state, StateIpcTester state,
IFramework framework) : IGameDataDrawer IFramework framework) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "IPC Tester"; => "IPC Tester"u8;
public bool Disabled public bool Disabled
=> false; => false;

View file

@ -2,9 +2,10 @@
using Glamourer.Api.Enums; using Glamourer.Api.Enums;
using Glamourer.Api.IpcSubscribers; using Glamourer.Api.IpcSubscribers;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using ImSharp;
using Luna;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Gui; using Penumbra.GameData.Gui;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
@ -67,8 +68,8 @@ public class ItemsIpcTester(IDalamudPluginInterface pluginInterface) : IUiServic
ImGui.SetNextItemWidth(width); ImGui.SetNextItemWidth(width);
if (ImGuiUtil.InputUlong("Custom Item ID", ref tmp)) if (ImGuiUtil.InputUlong("Custom Item ID", ref tmp))
_customItemId = tmp; _customItemId = tmp;
EquipSlotCombo.Draw("Equip Slot", string.Empty, ref _slot, width); EquipSlotCombo.Draw("Equip Slot"u8, StringU8.Empty, ref _slot, width);
BonusSlotCombo.Draw("Bonus Slot", string.Empty, ref _bonusSlot, width); BonusSlotCombo.Draw("Bonus Slot"u8, StringU8.Empty, ref _bonusSlot, width);
var value = (int)_stainId.Id; var value = (int)_stainId.Id;
ImGui.SetNextItemWidth(width); ImGui.SetNextItemWidth(width);
if (ImGui.InputInt("Stain ID", ref value, 1, 3)) if (ImGui.InputInt("Stain ID", ref value, 1, 3))

View file

@ -6,11 +6,11 @@ using Glamourer.Api.Enums;
using Glamourer.Api.Helpers; using Glamourer.Api.Helpers;
using Glamourer.Api.IpcSubscribers; using Glamourer.Api.IpcSubscribers;
using Glamourer.Designs; using Glamourer.Designs;
using Luna;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Text; using OtterGui.Text;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
using Penumbra.String; using Penumbra.String;

View file

@ -10,10 +10,10 @@ using ImGuiClip = OtterGui.ImGuiClip;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class ItemUnlockPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) : IGameDataDrawer public sealed class ItemUnlockPanel(ItemUnlockManager itemUnlocks, ItemManager items) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Unlocked Items"; => "Unlocked Items"u8;
public bool Disabled public bool Disabled
=> false; => false;
@ -35,10 +35,10 @@ public class ItemUnlockPanel(ItemUnlockManager _itemUnlocks, ItemManager _items)
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing());
ImGui.TableNextRow(); ImGui.TableNextRow();
var remainder = ImGuiClip.ClippedDraw(_itemUnlocks, skips, t => var remainder = ImGuiClip.ClippedDraw(itemUnlocks, skips, t =>
{ {
ImGuiUtil.DrawTableColumn(t.Key.ToString()); ImGuiUtil.DrawTableColumn(t.Key.ToString());
if (_items.ItemData.TryGetValue(t.Key, EquipSlot.MainHand, out var equip)) if (items.ItemData.TryGetValue(t.Key, EquipSlot.MainHand, out var equip))
{ {
ImGuiUtil.DrawTableColumn(equip.Name); ImGuiUtil.DrawTableColumn(equip.Name);
ImGuiUtil.DrawTableColumn(equip.Type.ToName()); ImGuiUtil.DrawTableColumn(equip.Type.ToName());
@ -51,12 +51,12 @@ public class ItemUnlockPanel(ItemUnlockManager _itemUnlocks, ItemManager _items)
ImGui.TableNextColumn(); ImGui.TableNextColumn();
} }
ImGuiUtil.DrawTableColumn(_itemUnlocks.IsUnlocked(t.Key, out var time) ImGuiUtil.DrawTableColumn(itemUnlocks.IsUnlocked(t.Key, out var time)
? time == DateTimeOffset.MinValue ? time == DateTimeOffset.MinValue
? "Always" ? "Always"
: time.LocalDateTime.ToString("g") : time.LocalDateTime.ToString("g")
: "Never"); : "Never");
}, _itemUnlocks.Count); }, itemUnlocks.Count);
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight());
} }
} }

View file

@ -14,17 +14,17 @@ using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public unsafe class ModelEvaluationPanel( public sealed unsafe class ModelEvaluationPanel(
ActorObjectManager _objectManager, ActorObjectManager objectManager,
VisorService _visorService, VisorService visorService,
VieraEarService _vieraEarService, VieraEarService vieraEarService,
UpdateSlotService _updateSlotService, UpdateSlotService updateSlotService,
ChangeCustomizeService _changeCustomizeService, ChangeCustomizeService changeCustomizeService,
CrestService _crestService, CrestService crestService,
DictBonusItems bonusItems) : IGameDataDrawer DictBonusItems bonusItems) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Model Evaluation"; => "Model Evaluation"u8;
public bool Disabled public bool Disabled
=> false; => false;
@ -34,7 +34,7 @@ public unsafe class ModelEvaluationPanel(
public void Draw() public void Draw()
{ {
ImGui.InputInt("Game Object Index", ref _gameObjectIndex, 0, 0); ImGui.InputInt("Game Object Index", ref _gameObjectIndex, 0, 0);
var actor = _objectManager.Objects[_gameObjectIndex]; var actor = objectManager.Objects[_gameObjectIndex];
var model = actor.Model; var model = actor.Model;
using var table = ImRaii.Table("##evaluationTable", 4, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); using var table = ImRaii.Table("##evaluationTable", 4, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -128,13 +128,13 @@ public unsafe class ModelEvaluationPanel(
return; return;
if (ImGui.SmallButton("Set True")) if (ImGui.SmallButton("Set True"))
_visorService.SetVisorState(model, true); visorService.SetVisorState(model, true);
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Set False")) if (ImGui.SmallButton("Set False"))
_visorService.SetVisorState(model, false); visorService.SetVisorState(model, false);
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Toggle")) if (ImGui.SmallButton("Toggle"))
_visorService.SetVisorState(model, !VisorService.GetVisorState(model)); visorService.SetVisorState(model, !VisorService.GetVisorState(model));
} }
private void DrawVieraEars(Actor actor, Model model) private void DrawVieraEars(Actor actor, Model model)
@ -148,13 +148,13 @@ public unsafe class ModelEvaluationPanel(
return; return;
if (ImGui.SmallButton("Set True")) if (ImGui.SmallButton("Set True"))
_vieraEarService.SetVieraEarState(model, true); vieraEarService.SetVieraEarState(model, true);
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Set False")) if (ImGui.SmallButton("Set False"))
_vieraEarService.SetVieraEarState(model, false); vieraEarService.SetVieraEarState(model, false);
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Toggle")) if (ImGui.SmallButton("Toggle"))
_vieraEarService.SetVieraEarState(model, !model.VieraEarsVisible); vieraEarService.SetVieraEarState(model, !model.VieraEarsVisible);
} }
private void DrawHatState(Actor actor, Model model) private void DrawHatState(Actor actor, Model model)
@ -172,13 +172,13 @@ public unsafe class ModelEvaluationPanel(
return; return;
if (ImGui.SmallButton("Hide")) if (ImGui.SmallButton("Hide"))
_updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, CharacterArmor.Empty); updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, CharacterArmor.Empty);
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Show")) if (ImGui.SmallButton("Show"))
_updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, actor.GetArmor(EquipSlot.Head)); updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, actor.GetArmor(EquipSlot.Head));
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Toggle")) if (ImGui.SmallButton("Toggle"))
_updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, updateSlotService.UpdateEquipSlot(model, EquipSlot.Head,
model.AsHuman->Head.Value == 0 ? actor.GetArmor(EquipSlot.Head) : CharacterArmor.Empty); model.AsHuman->Head.Value == 0 ? actor.GetArmor(EquipSlot.Head) : CharacterArmor.Empty);
} }
@ -248,14 +248,14 @@ public unsafe class ModelEvaluationPanel(
continue; continue;
if (ImGui.SmallButton("Change Piece")) if (ImGui.SmallButton("Change Piece"))
_updateSlotService.UpdateArmor(model, slot, updateSlotService.UpdateArmor(model, slot,
new CharacterArmor((PrimaryId)(slot == EquipSlot.Hands ? 6064 : slot == EquipSlot.Head ? 6072 : 1), 1, StainIds.None)); new CharacterArmor((PrimaryId)(slot == EquipSlot.Hands ? 6064 : slot == EquipSlot.Head ? 6072 : 1), 1, StainIds.None));
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Change Stain")) if (ImGui.SmallButton("Change Stain"))
_updateSlotService.UpdateStain(model, slot, new StainIds(5, 7)); updateSlotService.UpdateStain(model, slot, new StainIds(5, 7));
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Reset")) if (ImGui.SmallButton("Reset"))
_updateSlotService.UpdateEquipSlot(model, slot, actor.GetArmor(slot)); updateSlotService.UpdateEquipSlot(model, slot, actor.GetArmor(slot));
} }
foreach (var slot in BonusExtensions.AllFlags) foreach (var slot in BonusExtensions.AllFlags)
@ -280,7 +280,7 @@ public unsafe class ModelEvaluationPanel(
if (ImUtf8.SmallButton("Change Piece"u8)) if (ImUtf8.SmallButton("Change Piece"u8))
{ {
var data = model.GetBonus(slot); var data = model.GetBonus(slot);
_updateSlotService.UpdateBonusSlot(model, slot, data with { Variant = (Variant)((data.Variant.Id + 1) % 12) }); updateSlotService.UpdateBonusSlot(model, slot, data with { Variant = (Variant)((data.Variant.Id + 1) % 12) });
} }
} }
} }
@ -311,7 +311,7 @@ public unsafe class ModelEvaluationPanel(
var shift = BitOperations.TrailingZeroCount(mask); var shift = BitOperations.TrailingZeroCount(mask);
var newValue = value + (1 << shift); var newValue = value + (1 << shift);
modelCustomize.Set(type, (CustomizeValue)newValue); modelCustomize.Set(type, (CustomizeValue)newValue);
_changeCustomizeService.UpdateCustomize(model, modelCustomize); changeCustomizeService.UpdateCustomize(model, modelCustomize);
} }
ImGui.SameLine(); ImGui.SameLine();
@ -322,14 +322,14 @@ public unsafe class ModelEvaluationPanel(
var shift = BitOperations.TrailingZeroCount(mask); var shift = BitOperations.TrailingZeroCount(mask);
var newValue = value - (1 << shift); var newValue = value - (1 << shift);
modelCustomize.Set(type, (CustomizeValue)newValue); modelCustomize.Set(type, (CustomizeValue)newValue);
_changeCustomizeService.UpdateCustomize(model, modelCustomize); changeCustomizeService.UpdateCustomize(model, modelCustomize);
} }
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Reset")) if (ImGui.SmallButton("Reset"))
{ {
modelCustomize.Set(type, actorCustomize[type]); modelCustomize.Set(type, actorCustomize[type]);
_changeCustomizeService.UpdateCustomize(model, modelCustomize); changeCustomizeService.UpdateCustomize(model, modelCustomize);
} }
} }
} }
@ -357,6 +357,6 @@ public unsafe class ModelEvaluationPanel(
} }
if (whichToggle != 0) if (whichToggle != 0)
_crestService.UpdateCrests(actor, totalModelFlags ^ whichToggle); crestService.UpdateCrests(actor, totalModelFlags ^ whichToggle);
} }
} }

View file

@ -14,11 +14,11 @@ using ImGuiClip = OtterGui.ImGuiClip;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class NpcAppearancePanel(NpcCombo npcCombo, StateManager stateManager, ActorObjectManager objectManager, DesignConverter designConverter) public sealed class NpcAppearancePanel(NpcCombo npcCombo, StateManager stateManager, ActorObjectManager objectManager, DesignConverter designConverter)
: IGameDataDrawer : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "NPC Appearance"; => "NPC Appearance"u8;
public bool Disabled public bool Disabled
=> false; => false;

View file

@ -7,10 +7,10 @@ using Penumbra.GameData.Interop;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class ObjectManagerPanel(ActorObjectManager _objectManager, ActorManager _actors) : IGameDataDrawer public sealed class ObjectManagerPanel(ActorObjectManager objectManager, ActorManager actors) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Object Manager"; => "Object Manager"u8;
public bool Disabled public bool Disabled
=> false; => false;
@ -19,7 +19,7 @@ public class ObjectManagerPanel(ActorObjectManager _objectManager, ActorManager
public void Draw() public void Draw()
{ {
_objectManager.Objects.DrawDebug(); objectManager.Objects.DrawDebug();
using (var table = ImUtf8.Table("##data"u8, 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit)) using (var table = ImUtf8.Table("##data"u8, 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit))
{ {
@ -27,32 +27,32 @@ public class ObjectManagerPanel(ActorObjectManager _objectManager, ActorManager
return; return;
ImUtf8.DrawTableColumn("World"u8); ImUtf8.DrawTableColumn("World"u8);
ImUtf8.DrawTableColumn(_actors.Finished ? _actors.Data.ToWorldName(_objectManager.World) : "Service Missing"); ImUtf8.DrawTableColumn(actors.Finished ? actors.Data.ToWorldName(objectManager.World) : "Service Missing");
ImUtf8.DrawTableColumn(_objectManager.World.ToString()); ImUtf8.DrawTableColumn(objectManager.World.ToString());
ImUtf8.DrawTableColumn("Player Character"u8); ImUtf8.DrawTableColumn("Player Character"u8);
ImUtf8.DrawTableColumn($"{_objectManager.Player.Utf8Name} ({_objectManager.Player.Index})"); ImUtf8.DrawTableColumn($"{objectManager.Player.Utf8Name} ({objectManager.Player.Index})");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImUtf8.CopyOnClickSelectable(_objectManager.Player.ToString()); ImUtf8.CopyOnClickSelectable(objectManager.Player.ToString());
ImUtf8.DrawTableColumn("In GPose"u8); ImUtf8.DrawTableColumn("In GPose"u8);
ImUtf8.DrawTableColumn(_objectManager.IsInGPose.ToString()); ImUtf8.DrawTableColumn(objectManager.IsInGPose.ToString());
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImUtf8.DrawTableColumn("In Lobby"u8); ImUtf8.DrawTableColumn("In Lobby"u8);
ImUtf8.DrawTableColumn(_objectManager.IsInLobby.ToString()); ImUtf8.DrawTableColumn(objectManager.IsInLobby.ToString());
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (_objectManager.IsInGPose) if (objectManager.IsInGPose)
{ {
ImUtf8.DrawTableColumn("GPose Player"u8); ImUtf8.DrawTableColumn("GPose Player"u8);
ImUtf8.DrawTableColumn($"{_objectManager.GPosePlayer.Utf8Name} ({_objectManager.GPosePlayer.Index})"); ImUtf8.DrawTableColumn($"{objectManager.GPosePlayer.Utf8Name} ({objectManager.GPosePlayer.Index})");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImUtf8.CopyOnClickSelectable(_objectManager.GPosePlayer.ToString()); ImUtf8.CopyOnClickSelectable(objectManager.GPosePlayer.ToString());
} }
ImUtf8.DrawTableColumn("Number of Players"u8); ImUtf8.DrawTableColumn("Number of Players"u8);
ImUtf8.DrawTableColumn(_objectManager.Count.ToString()); ImUtf8.DrawTableColumn(objectManager.Count.ToString());
ImGui.TableNextColumn(); ImGui.TableNextColumn();
} }
@ -70,7 +70,7 @@ public class ObjectManagerPanel(ActorObjectManager _objectManager, ActorManager
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing());
ImGui.TableNextRow(); ImGui.TableNextRow();
var remainder = ImGuiClip.FilteredClippedDraw(_objectManager, skips, var remainder = ImGuiClip.FilteredClippedDraw(objectManager, skips,
p => p.Value.Label.Contains(_objectFilter, StringComparison.OrdinalIgnoreCase), p p => p.Value.Label.Contains(_objectFilter, StringComparison.OrdinalIgnoreCase), p
=> =>
{ {

View file

@ -11,10 +11,10 @@ using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItemTooltip _penumbraTooltip) : IGameDataDrawer public sealed class PenumbraPanel(PenumbraService penumbra, PenumbraChangedItemTooltip penumbraTooltip) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Penumbra Interop"; => "Penumbra Interop"u8;
public bool Disabled public bool Disabled
=> false; => false;
@ -29,20 +29,20 @@ public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItem
return; return;
ImGuiUtil.DrawTableColumn("Available"); ImGuiUtil.DrawTableColumn("Available");
ImGuiUtil.DrawTableColumn(_penumbra.Available.ToString()); ImGuiUtil.DrawTableColumn(penumbra.Available.ToString());
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.SmallButton("Unattach")) if (ImGui.SmallButton("Unattach"))
_penumbra.Unattach(); penumbra.Unattach();
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.SmallButton("Reattach")) if (ImGui.SmallButton("Reattach"))
_penumbra.Reattach(); penumbra.Reattach();
ImGuiUtil.DrawTableColumn("Version"); ImGuiUtil.DrawTableColumn("Version");
ImGuiUtil.DrawTableColumn($"{_penumbra.CurrentMajor}.{_penumbra.CurrentMinor}"); ImGuiUtil.DrawTableColumn($"{penumbra.CurrentMajor}.{penumbra.CurrentMinor}");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGuiUtil.DrawTableColumn("Attached When"); ImGuiUtil.DrawTableColumn("Attached When");
ImGuiUtil.DrawTableColumn(_penumbra.AttachTime.ToLocalTime().ToLongTimeString()); ImGuiUtil.DrawTableColumn(penumbra.AttachTime.ToLocalTime().ToLongTimeString());
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGuiUtil.DrawTableColumn("Draw Object"); ImGuiUtil.DrawTableColumn("Draw Object");
@ -52,16 +52,16 @@ public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItem
if (ImGui.InputScalar("##drawObjectPtr", ImGuiDataType.U64, ref address, nint.Zero, nint.Zero, "%llx", if (ImGui.InputScalar("##drawObjectPtr", ImGuiDataType.U64, ref address, nint.Zero, nint.Zero, "%llx",
ImGuiInputTextFlags.CharsHexadecimal)) ImGuiInputTextFlags.CharsHexadecimal))
_drawObject = address; _drawObject = address;
ImGuiUtil.DrawTableColumn(_penumbra.Available ImGuiUtil.DrawTableColumn(penumbra.Available
? $"0x{_penumbra.GameObjectFromDrawObject(_drawObject).Address:X}" ? $"0x{penumbra.GameObjectFromDrawObject(_drawObject).Address:X}"
: "Penumbra Unavailable"); : "Penumbra Unavailable");
ImGuiUtil.DrawTableColumn("Cutscene Object"); ImGuiUtil.DrawTableColumn("Cutscene Object");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale); ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
ImGui.InputInt("##CutsceneIndex", ref _gameObjectIndex, 0, 0); ImGui.InputInt("##CutsceneIndex", ref _gameObjectIndex, 0, 0);
ImGuiUtil.DrawTableColumn(_penumbra.Available ImGuiUtil.DrawTableColumn(penumbra.Available
? _penumbra.CutsceneParent((ushort)_gameObjectIndex).ToString() ? penumbra.CutsceneParent((ushort)_gameObjectIndex).ToString()
: "Penumbra Unavailable"); : "Penumbra Unavailable");
ImGuiUtil.DrawTableColumn("Redraw Object"); ImGuiUtil.DrawTableColumn("Redraw Object");
@ -69,25 +69,25 @@ public unsafe class PenumbraPanel(PenumbraService _penumbra, PenumbraChangedItem
ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale); ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
ImGui.InputInt("##redrawObject", ref _gameObjectIndex, 0, 0); ImGui.InputInt("##redrawObject", ref _gameObjectIndex, 0, 0);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
using (_ = ImRaii.Disabled(!_penumbra.Available)) using (_ = ImRaii.Disabled(!penumbra.Available))
{ {
if (ImGui.SmallButton("Redraw")) if (ImGui.SmallButton("Redraw"))
_penumbra.RedrawObject((ObjectIndex)_gameObjectIndex, RedrawType.Redraw); penumbra.RedrawObject((ObjectIndex)_gameObjectIndex, RedrawType.Redraw);
} }
ImGuiUtil.DrawTableColumn("Last Tooltip Date"); ImGuiUtil.DrawTableColumn("Last Tooltip Date");
ImGuiUtil.DrawTableColumn(_penumbraTooltip.LastTooltip > DateTime.MinValue ImGuiUtil.DrawTableColumn(penumbraTooltip.LastTooltip > DateTime.MinValue
? $"{_penumbraTooltip.LastTooltip.ToLongTimeString()} ({_penumbraTooltip.LastType} {_penumbraTooltip.LastId})" ? $"{penumbraTooltip.LastTooltip.ToLongTimeString()} ({penumbraTooltip.LastType} {penumbraTooltip.LastId})"
: "Never"); : "Never");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGuiUtil.DrawTableColumn("Last Click Date"); ImGuiUtil.DrawTableColumn("Last Click Date");
ImGuiUtil.DrawTableColumn(_penumbraTooltip.LastClick > DateTime.MinValue ? _penumbraTooltip.LastClick.ToLongTimeString() : "Never"); ImGuiUtil.DrawTableColumn(penumbraTooltip.LastClick > DateTime.MinValue ? penumbraTooltip.LastClick.ToLongTimeString() : "Never");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Separator(); ImGui.Separator();
ImGui.Separator(); ImGui.Separator();
foreach (var (slot, item) in _penumbraTooltip.LastItems) foreach (var (slot, item) in penumbraTooltip.LastItems)
{ {
switch (slot) switch (slot)
{ {

View file

@ -1,27 +1,25 @@
using Glamourer.Interop; using Glamourer.State;
using Glamourer.Interop.Structs;
using Glamourer.State;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Gui.Debug; using Penumbra.GameData.Gui.Debug;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class RetainedStatePanel(StateManager _stateManager, ActorObjectManager _objectManager) : IGameDataDrawer public sealed class RetainedStatePanel(StateManager stateManager, ActorObjectManager objectManager) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Retained States (Inactive Actors)"; => "Retained States (Inactive Actors)"u8;
public bool Disabled public bool Disabled
=> false; => false;
public void Draw() public void Draw()
{ {
foreach (var (identifier, state) in _stateManager.Where(kvp => !_objectManager.ContainsKey(kvp.Key))) foreach (var (identifier, state) in stateManager.Where(kvp => !objectManager.ContainsKey(kvp.Key)))
{ {
using var t = ImRaii.TreeNode(identifier.ToString()); using var t = ImRaii.TreeNode(identifier.ToString());
if (t) if (t)
ActiveStatePanel.DrawState(_stateManager, ActorData.Invalid, state); ActiveStatePanel.DrawState(stateManager, ActorData.Invalid, state);
} }
} }
} }

View file

@ -10,10 +10,10 @@ using ImGuiClip = OtterGui.ImGuiClip;
namespace Glamourer.Gui.Tabs.DebugTab; namespace Glamourer.Gui.Tabs.DebugTab;
public class UnlockableItemsPanel(ItemUnlockManager _itemUnlocks, ItemManager _items) : IGameDataDrawer public sealed class UnlockableItemsPanel(ItemUnlockManager itemUnlocks, ItemManager items) : IGameDataDrawer
{ {
public string Label public ReadOnlySpan<byte> Label
=> "Unlockable Items"; => "Unlockable Items"u8;
public bool Disabled public bool Disabled
=> false; => false;
@ -36,10 +36,10 @@ public class UnlockableItemsPanel(ItemUnlockManager _itemUnlocks, ItemManager _i
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing());
ImGui.TableNextRow(); ImGui.TableNextRow();
var remainder = ImGuiClip.ClippedDraw(_itemUnlocks.Unlockable, skips, t => var remainder = ImGuiClip.ClippedDraw(itemUnlocks.Unlockable, skips, t =>
{ {
ImGuiUtil.DrawTableColumn(t.Key.ToString()); ImGuiUtil.DrawTableColumn(t.Key.ToString());
if (_items.ItemData.TryGetValue(t.Key, EquipSlot.MainHand, out var equip)) if (items.ItemData.TryGetValue(t.Key, EquipSlot.MainHand, out var equip))
{ {
ImGuiUtil.DrawTableColumn(equip.Name); ImGuiUtil.DrawTableColumn(equip.Name);
ImGuiUtil.DrawTableColumn(equip.Type.ToName()); ImGuiUtil.DrawTableColumn(equip.Type.ToName());
@ -52,13 +52,13 @@ public class UnlockableItemsPanel(ItemUnlockManager _itemUnlocks, ItemManager _i
ImGui.TableNextColumn(); ImGui.TableNextColumn();
} }
ImGuiUtil.DrawTableColumn(_itemUnlocks.IsUnlocked(t.Key, out var time) ImGuiUtil.DrawTableColumn(itemUnlocks.IsUnlocked(t.Key, out var time)
? time == DateTimeOffset.MinValue ? time == DateTimeOffset.MinValue
? "Always" ? "Always"
: time.LocalDateTime.ToString("g") : time.LocalDateTime.ToString("g")
: "Never"); : "Never");
ImGuiUtil.DrawTableColumn(t.Value.ToString()); ImGuiUtil.DrawTableColumn(t.Value.ToString());
}, _itemUnlocks.Unlockable.Count); }, itemUnlocks.Unlockable.Count);
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight());
} }
} }

View file

@ -4,17 +4,17 @@ using Glamourer.Automation;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.Designs.Links; using Glamourer.Designs.Links;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
namespace Glamourer.Gui.Tabs.DesignTab; namespace Glamourer.Gui.Tabs.DesignTab;
public class DesignLinkDrawer( public class DesignLinkDrawer(
DesignLinkManager _linkManager, DesignLinkManager linkManager,
DesignFileSystemSelector _selector, DesignFileSystemSelector selector,
LinkDesignCombo _combo, LinkDesignCombo combo,
DesignColors _colorManager, DesignColors colorManager,
Configuration config) : IUiService Configuration config) : IUiService
{ {
private int _dragDropIndex = -1; private int _dragDropIndex = -1;
@ -47,23 +47,23 @@ public class DesignLinkDrawer(
switch (_dragDropTargetOrder) switch (_dragDropTargetOrder)
{ {
case LinkOrder.Before: case LinkOrder.Before:
for (var i = _selector.Selected!.Links.Before.Count - 1; i >= _dragDropTargetIndex; --i) for (var i = selector.Selected!.Links.Before.Count - 1; i >= _dragDropTargetIndex; --i)
_linkManager.MoveDesignLink(_selector.Selected!, i, LinkOrder.Before, 0, LinkOrder.After); linkManager.MoveDesignLink(selector.Selected!, i, LinkOrder.Before, 0, LinkOrder.After);
break; break;
case LinkOrder.After: case LinkOrder.After:
for (var i = 0; i <= _dragDropTargetIndex; ++i) for (var i = 0; i <= _dragDropTargetIndex; ++i)
{ {
_linkManager.MoveDesignLink(_selector.Selected!, 0, LinkOrder.After, _selector.Selected!.Links.Before.Count, linkManager.MoveDesignLink(selector.Selected!, 0, LinkOrder.After, selector.Selected!.Links.Before.Count,
LinkOrder.Before); LinkOrder.Before);
} }
break; break;
} }
else if (_dragDropTargetOrder is LinkOrder.Self) else if (_dragDropTargetOrder is LinkOrder.Self)
_linkManager.MoveDesignLink(_selector.Selected!, _dragDropIndex, _dragDropOrder, _selector.Selected!.Links.Before.Count, linkManager.MoveDesignLink(selector.Selected!, _dragDropIndex, _dragDropOrder, selector.Selected!.Links.Before.Count,
LinkOrder.Before); LinkOrder.Before);
else else
_linkManager.MoveDesignLink(_selector.Selected!, _dragDropIndex, _dragDropOrder, _dragDropTargetIndex, _dragDropTargetOrder); linkManager.MoveDesignLink(selector.Selected!, _dragDropIndex, _dragDropOrder, _dragDropTargetIndex, _dragDropTargetOrder);
_dragDropIndex = -1; _dragDropIndex = -1;
_dragDropTargetIndex = -1; _dragDropTargetIndex = -1;
@ -83,9 +83,9 @@ public class DesignLinkDrawer(
6 * ImGui.GetFrameHeight() + 5 * ImGui.GetStyle().ItemInnerSpacing.X); 6 * ImGui.GetFrameHeight() + 5 * ImGui.GetStyle().ItemInnerSpacing.X);
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemInnerSpacing); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemInnerSpacing);
DrawSubList(_selector.Selected!.Links.Before, LinkOrder.Before); DrawSubList(selector.Selected!.Links.Before, LinkOrder.Before);
DrawSelf(); DrawSelf();
DrawSubList(_selector.Selected!.Links.After, LinkOrder.After); DrawSubList(selector.Selected!.Links.After, LinkOrder.After);
DrawNew(); DrawNew();
MoveLink(); MoveLink();
} }
@ -94,7 +94,7 @@ public class DesignLinkDrawer(
{ {
using var id = ImRaii.PushId((int)LinkOrder.Self); using var id = ImRaii.PushId((int)LinkOrder.Self);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var color = _colorManager.GetColor(_selector.Selected!); var color = colorManager.GetColor(selector.Selected!);
using (ImRaii.PushFont(UiBuilder.IconFont)) using (ImRaii.PushFont(UiBuilder.IconFont))
{ {
using var c = ImRaii.PushColor(ImGuiCol.Text, color); using var c = ImRaii.PushColor(ImGuiCol.Text, color);
@ -106,11 +106,11 @@ public class DesignLinkDrawer(
using (ImRaii.PushColor(ImGuiCol.Text, color)) using (ImRaii.PushColor(ImGuiCol.Text, color))
{ {
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
ImGui.Selectable(_selector.IncognitoMode ? _selector.Selected!.Incognito : _selector.Selected!.Name.Text); ImGui.Selectable(selector.IncognitoMode ? selector.Selected!.Incognito : selector.Selected!.Name.Text);
} }
ImGuiUtil.HoverTooltip("Current Design"); ImGuiUtil.HoverTooltip("Current Design");
DrawDragDrop(_selector.Selected!, LinkOrder.Self, 0); DrawDragDrop(selector.Selected!, LinkOrder.Self, 0);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
using (ImRaii.PushFont(UiBuilder.IconFont)) using (ImRaii.PushFont(UiBuilder.IconFont))
{ {
@ -134,10 +134,10 @@ public class DesignLinkDrawer(
var (design, flags) = list[i]; var (design, flags) = list[i];
ImGui.TableNextColumn(); ImGui.TableNextColumn();
using (ImRaii.PushColor(ImGuiCol.Text, _colorManager.GetColor(design))) using (ImRaii.PushColor(ImGuiCol.Text, colorManager.GetColor(design)))
{ {
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
ImGui.Selectable(_selector.IncognitoMode ? design.Incognito : design.Name.Text); ImGui.Selectable(selector.IncognitoMode ? design.Incognito : design.Name.Text);
} }
DrawDragDrop(design, order, i); DrawDragDrop(design, order, i);
@ -147,7 +147,7 @@ public class DesignLinkDrawer(
DrawApplicationBoxes(i, order, flags); DrawApplicationBoxes(i, order, flags);
if (delete) if (delete)
_linkManager.RemoveDesignLink(_selector.Selected!, i--, order); linkManager.RemoveDesignLink(selector.Selected!, i--, order);
} }
} }
@ -156,11 +156,11 @@ public class DesignLinkDrawer(
var buttonSize = new Vector2(ImGui.GetFrameHeight()); var buttonSize = new Vector2(ImGui.GetFrameHeight());
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.TableNextColumn(); ImGui.TableNextColumn();
_combo.Draw(ImGui.GetContentRegionAvail().X); combo.Draw(ImGui.GetContentRegionAvail().X);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
string ttBefore, ttAfter; string ttBefore, ttAfter;
bool canAddBefore, canAddAfter; bool canAddBefore, canAddAfter;
var design = _combo.Design as Design; var design = combo.Design as Design;
if (design == null) if (design == null)
{ {
ttAfter = ttBefore = "Select a design first."; ttAfter = ttBefore = "Select a design first.";
@ -168,11 +168,11 @@ public class DesignLinkDrawer(
} }
else else
{ {
canAddBefore = LinkContainer.CanAddLink(_selector.Selected!, design, LinkOrder.Before, out var error); canAddBefore = LinkContainer.CanAddLink(selector.Selected!, design, LinkOrder.Before, out var error);
ttBefore = canAddBefore ttBefore = canAddBefore
? $"Add a link at the top of the list to {design.Name}." ? $"Add a link at the top of the list to {design.Name}."
: $"Can not add a link to {design.Name}:\n{error}"; : $"Can not add a link to {design.Name}:\n{error}";
canAddAfter = LinkContainer.CanAddLink(_selector.Selected!, design, LinkOrder.After, out error); canAddAfter = LinkContainer.CanAddLink(selector.Selected!, design, LinkOrder.After, out error);
ttAfter = canAddAfter ttAfter = canAddAfter
? $"Add a link at the bottom of the list to {design.Name}." ? $"Add a link at the bottom of the list to {design.Name}."
: $"Can not add a link to {design.Name}:\n{error}"; : $"Can not add a link to {design.Name}:\n{error}";
@ -180,13 +180,13 @@ public class DesignLinkDrawer(
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowCircleUp.ToIconString(), buttonSize, ttBefore, !canAddBefore, true)) if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowCircleUp.ToIconString(), buttonSize, ttBefore, !canAddBefore, true))
{ {
_linkManager.AddDesignLink(_selector.Selected!, design!, LinkOrder.Before); linkManager.AddDesignLink(selector.Selected!, design!, LinkOrder.Before);
_linkManager.MoveDesignLink(_selector.Selected!, _selector.Selected!.Links.Before.Count - 1, LinkOrder.Before, 0, LinkOrder.Before); linkManager.MoveDesignLink(selector.Selected!, selector.Selected!.Links.Before.Count - 1, LinkOrder.Before, 0, LinkOrder.Before);
} }
ImGui.SameLine(); ImGui.SameLine();
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowCircleDown.ToIconString(), buttonSize, ttAfter, !canAddAfter, true)) if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowCircleDown.ToIconString(), buttonSize, ttAfter, !canAddAfter, true))
_linkManager.AddDesignLink(_selector.Selected!, design!, LinkOrder.After); linkManager.AddDesignLink(selector.Selected!, design!, LinkOrder.After);
} }
private void DrawDragDrop(Design design, LinkOrder order, int index) private void DrawDragDrop(Design design, LinkOrder order, int index)
@ -238,7 +238,7 @@ public class DesignLinkDrawer(
ImGui.SameLine(); ImGui.SameLine();
Box(4); Box(4);
if (newType != current) if (newType != current)
_linkManager.ChangeApplicationType(_selector.Selected!, idx, order, newType); linkManager.ChangeApplicationType(selector.Selected!, idx, order, newType);
return; return;
void Box(int i) void Box(int i)

View file

@ -2,9 +2,9 @@
using Glamourer.Services; using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui.Filesystem; using OtterGui.Filesystem;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Text; using OtterGui.Text;
using OtterGui.Text.EndObjects; using OtterGui.Text.EndObjects;
@ -134,7 +134,7 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule
if (!target.IsDropping(DragDropLabel) || _dragCodeIdx == -1) if (!target.IsDropping(DragDropLabel) || _dragCodeIdx == -1)
return; return;
if (config.Codes.Move(_dragCodeIdx, idx)) if (Extensions.Move(config.Codes, _dragCodeIdx, idx))
codeService.SaveState(); codeService.SaveState();
_dragCodeIdx = -1; _dragCodeIdx = -1;
} }

View file

@ -1,11 +1,11 @@
using Dalamud.Interface; using Dalamud.Interface;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui; using OtterGui;
using OtterGui.Log;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Widgets; using OtterGui.Widgets;
using Logger = OtterGui.Log.Logger;
namespace Glamourer.Gui.Tabs.SettingsTab; namespace Glamourer.Gui.Tabs.SettingsTab;

View file

@ -2,9 +2,9 @@
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Glamourer.Services; using Glamourer.Services;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Luna;
using OtterGui; using OtterGui;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;

View file

@ -426,7 +426,7 @@ public class UnlockTable : Table<EquipItem>, IDisposable
{ {
_jobs = jobs; _jobs = jobs;
_values = _jobs.Jobs.Ordered.Select(j => j.Flag).ToArray(); _values = _jobs.Jobs.Ordered.Select(j => j.Flag).ToArray();
_names = _jobs.Jobs.Ordered.Select(j => j.Abbreviation).ToArray(); _names = _jobs.Jobs.Ordered.Select(j => j.Abbreviation.ToString()).ToArray();
AllFlags = _values.Aggregate((l, r) => l | r); AllFlags = _values.Aggregate((l, r) => l | r);
_filterValue = AllFlags; _filterValue = AllFlags;
Flags &= ~ImGuiTableColumnFlags.NoResize; Flags &= ~ImGuiTableColumnFlags.NoResize;
@ -498,7 +498,7 @@ public class UnlockTable : Table<EquipItem>, IDisposable
{ {
var group = _jobs.AllJobGroups[Math.Max((int)item.JobRestrictions.Id, 1)]; var group = _jobs.AllJobGroups[Math.Max((int)item.JobRestrictions.Id, 1)];
if (group.Name.Length > 0) if (group.Name.Length > 0)
text = group.Name; text = group.Name.ToString();
} }
ImGui.TextUnformatted(text); ImGui.TextUnformatted(text);

View file

@ -1,10 +1,9 @@
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.UI.Misc; using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using Glamourer.Events; using Glamourer.Events;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
using Penumbra.String; using Penumbra.String;

View file

@ -1,5 +1,5 @@
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Files.MaterialStructs; using Penumbra.GameData.Files.MaterialStructs;
using Penumbra.String.Functions; using Penumbra.String.Functions;
using SharpGen.Runtime; using SharpGen.Runtime;

View file

@ -1,6 +1,6 @@
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Files.MaterialStructs; using Penumbra.GameData.Files.MaterialStructs;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;

View file

@ -1,10 +1,9 @@
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle; using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
using FFXIVClientStructs.Havok.Animation.Rig;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Glamourer.State; using Glamourer.State;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Files.MaterialStructs; using Penumbra.GameData.Files.MaterialStructs;
@ -19,7 +18,6 @@ public sealed unsafe class MaterialManager : IRequiredService, IDisposable
private readonly StateManager _stateManager; private readonly StateManager _stateManager;
private readonly PenumbraService _penumbra; private readonly PenumbraService _penumbra;
private readonly ActorManager _actors; private readonly ActorManager _actors;
private readonly Configuration _config;
private int _lastSlot; private int _lastSlot;
@ -31,7 +29,6 @@ public sealed unsafe class MaterialManager : IRequiredService, IDisposable
_stateManager = stateManager; _stateManager = stateManager;
_actors = actors; _actors = actors;
_penumbra = penumbra; _penumbra = penumbra;
_config = config;
_event = prepareColorSet; _event = prepareColorSet;
_event.Subscribe(OnPrepareColorSet, PrepareColorSet.Priority.MaterialManager); _event.Subscribe(OnPrepareColorSet, PrepareColorSet.Priority.MaterialManager);
} }

View file

@ -2,8 +2,8 @@
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle; using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
using Luna;
using OtterGui.Classes; using OtterGui.Classes;
using OtterGui.Services;
using Penumbra.GameData; using Penumbra.GameData;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Files.MaterialStructs; using Penumbra.GameData.Files.MaterialStructs;

View file

@ -1,4 +1,4 @@
using OtterGui.Services; using Luna;
using Penumbra.GameData; using Penumbra.GameData;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;

View file

@ -1,8 +1,8 @@
using Dalamud.Plugin; using Dalamud.Plugin;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.GameData; using Glamourer.GameData;
using Luna;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui.Services;
namespace Glamourer.Interop.PalettePlus; namespace Glamourer.Interop.PalettePlus;

View file

@ -1,7 +1,7 @@
using Glamourer.Designs.Links; using Glamourer.Designs.Links;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;

View file

@ -1,6 +1,6 @@
using Glamourer.Automation; using Glamourer.Automation;
using Glamourer.Designs; using Glamourer.Designs;
using OtterGui.Services; using Luna;
namespace Glamourer.Interop.Penumbra; namespace Glamourer.Interop.Penumbra;

View file

@ -3,8 +3,7 @@ using Glamourer.Api.Enums;
using Glamourer.Designs.History; using Glamourer.Designs.History;
using Glamourer.Events; using Glamourer.Events;
using Glamourer.State; using Glamourer.State;
using OtterGui.Classes; using Luna;
using OtterGui.Services;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
@ -46,7 +45,7 @@ public class PenumbraAutoRedraw : IDisposable, IRequiredService
} }
private readonly ConcurrentQueue<(ActorState, Action, int)> _actions = []; private readonly ConcurrentQueue<(ActorState, Action, int)> _actions = [];
private readonly ConcurrentSet<ActorState> _skips = []; private readonly OtterGui.Classes.ConcurrentSet<ActorState> _skips = [];
private DateTime _frame; private DateTime _frame;
private void OnStateChanged(StateChangeType type, StateSource source, ActorState state, ActorData _1, ITransaction? _2) private void OnStateChanged(StateChangeType type, StateSource source, ActorState state, ActorData _1, ITransaction? _2)

View file

@ -1,5 +1,4 @@
using OtterGui.Classes; using Luna;
using OtterGui.Services;
namespace Glamourer.Interop.Penumbra; namespace Glamourer.Interop.Penumbra;

View file

@ -1,6 +1,6 @@
using OtterGui.Classes; using Luna;
using OtterGui.Log; using Backup = OtterGui.Classes.Backup;
using OtterGui.Services; using Logger = OtterGui.Log.Logger;
namespace Glamourer.Services; namespace Glamourer.Services;

View file

@ -1,13 +1,12 @@
using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Luna;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui;
using OtterGui.Extensions; using OtterGui.Extensions;
using OtterGui.Filesystem;
using OtterGui.Services;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
using Extensions = OtterGui.Filesystem.Extensions;
using Notification = OtterGui.Classes.Notification; using Notification = OtterGui.Classes.Notification;
namespace Glamourer.Services; namespace Glamourer.Services;
@ -32,7 +31,7 @@ public sealed class CollectionOverrideService : IService, ISavable
if (!identifier.IsValid) if (!identifier.IsValid)
identifier = _actors.FromObject(actor.AsObject, out _, true, true, true); identifier = _actors.FromObject(actor.AsObject, out _, true, true, true);
return _overrides.FindFirst(p => p.Actor.Matches(identifier), out var ret) return ArrayExtensions.FindFirst(_overrides, p => p.Actor.Matches(identifier), out var ret)
? (ret.CollectionId, ret.DisplayName, true) ? (ret.CollectionId, ret.DisplayName, true)
: (_penumbra.GetActorCollection(actor, out var name), name, false); : (_penumbra.GetActorCollection(actor, out var name), name, false);
} }
@ -107,7 +106,7 @@ public sealed class CollectionOverrideService : IService, ISavable
public void MoveOverride(int idxFrom, int idxTo) public void MoveOverride(int idxFrom, int idxTo)
{ {
if (!_overrides.Move(idxFrom, idxTo)) if (!Extensions.Move(_overrides, idxFrom, idxTo))
return; return;
Glamourer.Log.Debug($"Moved collection override {idxFrom + 1} to {idxTo + 1}."); Glamourer.Log.Debug($"Moved collection override {idxFrom + 1} to {idxTo + 1}.");

View file

@ -10,14 +10,13 @@ using Glamourer.Gui.Tabs.DesignTab;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Glamourer.State; using Glamourer.State;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using OtterGui; using Luna;
using OtterGui.Classes;
using OtterGui.Extensions; using OtterGui.Extensions;
using OtterGui.Services;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
using SeStringBuilderExtensions = OtterGui.Classes.SeStringBuilderExtensions;
namespace Glamourer.Services; namespace Glamourer.Services;
@ -104,10 +103,10 @@ public class CommandService : IDisposable, IApiService
return; return;
default: default:
_chat.Print("Use without argument to toggle the main window."); _chat.Print("Use without argument to toggle the main window.");
_chat.Print(new SeStringBuilder().AddText("Use ").AddPurple("/glamour").AddText(" instead of ").AddRed("/glamourer") _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("Use ").AddPurple("/glamour").AddText(" instead of "), "/glamourer")
.AddText(" for application commands.").BuiltString); .AddText(" for application commands.").BuiltString);
_chat.Print(new SeStringBuilder().AddCommand("qdb", "Toggles the quick design bar on or off.").BuiltString); _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "qdb", "Toggles the quick design bar on or off.").BuiltString);
_chat.Print(new SeStringBuilder().AddCommand("lock", "Toggles the lock of the main window on or off.").BuiltString); _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "lock", "Toggles the lock of the main window on or off.").BuiltString);
return; return;
} }
@ -146,35 +145,28 @@ public class CommandService : IDisposable, IApiService
private bool PrintHelp(string argument) private bool PrintHelp(string argument)
{ {
if (!string.Equals(argument, "help", StringComparison.OrdinalIgnoreCase) && argument != "?") if (!string.Equals(argument, "help", StringComparison.OrdinalIgnoreCase) && argument != "?")
_chat.Print(new SeStringBuilder().AddText("The given argument ").AddRed(argument, true) _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("The given argument "), argument, true)
.AddText(" is not valid. Valid arguments are:").BuiltString); .AddText(" is not valid. Valid arguments are:").BuiltString);
else else
_chat.Print("Valid arguments for /glamour are:"); _chat.Print("Valid arguments for /glamour are:");
_chat.Print(new SeStringBuilder().AddCommand("apply", "Applies a given design to a given character. Use without arguments for help.") _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "apply", "Applies a given design to a given character. Use without arguments for help.")
.BuiltString); .BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "reapply", "Re-applies the current supposed state of a given character. Use without arguments for help.").BuiltString);
.AddCommand("reapply", "Re-applies the current supposed state of a given character. Use without arguments for help.").BuiltString); _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "revert", "Reverts a given character to its game state. Use without arguments for help.")
_chat.Print(new SeStringBuilder().AddCommand("revert", "Reverts a given character to its game state. Use without arguments for help.")
.BuiltString); .BuiltString);
_chat.Print(new SeStringBuilder().AddCommand("reapplyautomation", _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "reapplyautomation",
"Reapplies the current automation state on top of the characters current state.. Use without arguments for help.").BuiltString); "Reapplies the current automation state on top of the characters current state.. Use without arguments for help.").BuiltString);
_chat.Print(new SeStringBuilder().AddCommand("reverttoautomation", _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "reverttoautomation",
"Reverts a given character to its supposed state using automated designs. Use without arguments for help.").BuiltString); "Reverts a given character to its supposed state using automated designs. Use without arguments for help.").BuiltString);
_chat.Print(new SeStringBuilder().AddCommand("resetdesign", _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "resetdesign",
"Reapplies the current automation and resets the random design. Use without arguments for help.").BuiltString); "Reapplies the current automation and resets the random design. Use without arguments for help.").BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "clearsettings", "Clears all temporary settings applied by Glamourer. Use without arguments for help.").BuiltString);
.AddCommand("clearsettings", "Clears all temporary settings applied by Glamourer. Use without arguments for help.").BuiltString); _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "copy", "Copy the current state of a character to clipboard. Use without arguments for help.").BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "save", "Save the current state of a character to a named design. Use without arguments for help.").BuiltString);
.AddCommand("copy", "Copy the current state of a character to clipboard. Use without arguments for help.").BuiltString); _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "automation", "Change the state of automated design sets. Use without arguments for help.").BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "applyitem", "Apply a specific item to a character. Use without arguments for help.").BuiltString);
.AddCommand("save", "Save the current state of a character to a named design. Use without arguments for help.").BuiltString); _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "applycustomization", "Apply a specific customization value to a character. Use without arguments for help.")
_chat.Print(new SeStringBuilder()
.AddCommand("automation", "Change the state of automated design sets. Use without arguments for help.").BuiltString);
_chat.Print(new SeStringBuilder()
.AddCommand("applyitem", "Apply a specific item to a character. Use without arguments for help.").BuiltString);
_chat.Print(new SeStringBuilder()
.AddCommand("applycustomization", "Apply a specific customization value to a character. Use without arguments for help.")
.BuiltString); .BuiltString);
return true; return true;
} }
@ -184,15 +176,15 @@ public class CommandService : IDisposable, IApiService
var argumentList = argument.Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var argumentList = argument.Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (argumentList.Length < 1) if (argumentList.Length < 1)
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour clearsettings ").AddGreen("[Character Identifier]").AddText(" | ") _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("Use with /glamour clearsettings ").AddGreen("[Character Identifier]").AddText(" | ")
.AddPurple("<true or false>").AddText(" | ").AddBlue("<true or false>").BuiltString); .AddPurple("<true or false>").AddText(" | "), "<true or false>").BuiltString);
PlayerIdentifierHelp(false, true); PlayerIdentifierHelp(false, true);
_chat.Print(new SeStringBuilder() _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder()
.AddText(" 》 The character identifier specifies the collection to clear settings from. It also accepts '").AddGreen("all") .AddText(" 》 The character identifier specifies the collection to clear settings from. It also accepts '"), "all")
.AddText("' to clear all collections.").BuiltString); .AddText("' to clear all collections.").BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》 The booleans are optional and default to 'true', the ").AddPurple("first") _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText(" 》 The booleans are optional and default to 'true', the ").AddPurple("first")
.AddText(" determines whether ").AddPurple("manually").AddText(" applied settings are cleared, the ").AddBlue("second") .AddText(" determines whether ").AddPurple("manually").AddText(" applied settings are cleared, the ").AddBlue("second")
.AddText(" determines whether ").AddBlue("automatically").AddText(" applied settings are cleared.").BuiltString); .AddText(" determines whether "), "automatically").AddText(" applied settings are cleared.").BuiltString);
return false; return false;
} }
@ -242,25 +234,24 @@ public class CommandService : IDisposable, IApiService
var argumentList = arguments.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var argumentList = arguments.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (argumentList.Length != 2) if (argumentList.Length != 2)
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour automation ").AddBlue("enable, disable or application", true) _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText("Use with /glamour automation ").AddBlue("enable, disable or application", true)
.AddText(" ") .AddText(" ")
.AddRed("Automated Design Set Index or Name", true).AddText(" | ").AddYellow("<Design Index>").AddText(" ") .AddRed("Automated Design Set Index or Name", true).AddText(" | ").AddYellow("<Design Index>").AddText(" "), "<Application Flags>")
.AddPurple("<Application Flags>")
.BuiltString); .BuiltString);
_chat.Print( _chat.Print(
" 》 If the design set name is a valid natural number it will be used as a index. Design names that are such numbers can not be dealt with."); " 》 If the design set name is a valid natural number it will be used as a index. Design names that are such numbers can not be dealt with.");
_chat.Print(" 》 If multiple design sets have the same name, the first one will be changed."); _chat.Print(" 》 If multiple design sets have the same name, the first one will be changed.");
_chat.Print(" 》 The name is case-insensitive."); _chat.Print(" 》 The name is case-insensitive.");
_chat.Print(new SeStringBuilder().AddText(" 》 If the command is ").AddBlue("application") _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 If the command is ").AddBlue("application")
.AddText(" the ").AddYellow("design index").AddText(" and ").AddPurple("flags").AddText(" are required.").BuiltString); .AddText(" the ").AddYellow("design index").AddText(" and "), "flags").AddText(" are required.").BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》 The ").AddYellow("design index") _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText(" 》 The "), "design index")
.AddText(" is the number in front of the relevant design in the automated design set.").BuiltString); .AddText(" is the number in front of the relevant design in the automated design set.").BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》 The ").AddPurple("Application Flags").AddText(" are a combination of the letters ") _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 The ").AddPurple("Application Flags").AddText(" are a combination of the letters ")
.AddInitialPurple("Customizations, ") .AddInitialPurple("Customizations, ")
.AddInitialPurple("Equipment, ") .AddInitialPurple("Equipment, ")
.AddInitialPurple("Accessories, ") .AddInitialPurple("Accessories, ")
.AddInitialPurple("Dyes & Crests and ") .AddInitialPurple("Dyes & Crests and ")
.AddInitialPurple("Weapons, where ").AddPurple("CEADW") .AddInitialPurple("Weapons, where "), "CEADW")
.AddText(" means everything should be toggled on, and no value means nothing should be toggled on.") .AddText(" means everything should be toggled on, and no value means nothing should be toggled on.")
.BuiltString); .BuiltString);
return false; return false;
@ -286,9 +277,9 @@ public class CommandService : IDisposable, IApiService
break; break;
case "application": return HandleApplication(argumentList[1]); case "application": return HandleApplication(argumentList[1]);
default: default:
_chat.Print(new SeStringBuilder().AddText("The command ") _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("The command ")
.AddBlue(argumentList[0], true).AddText(" is unknown. Currently only ").AddBlue("enable").AddText(", ").AddBlue("disable") .AddBlue(argumentList[0], true).AddText(" is unknown. Currently only ").AddBlue("enable").AddText(", ").AddBlue("disable")
.AddText(" or ").AddBlue("application") .AddText(" or "), "application")
.AddText(" are supported.").BuiltString); .AddText(" are supported.").BuiltString);
return false; return false;
} }
@ -310,8 +301,7 @@ public class CommandService : IDisposable, IApiService
if (idx >= 0) if (idx >= 0)
return true; return true;
_chat.Print(new SeStringBuilder().AddText("Could not change state of automated design set ") _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("Could not change state of automated design set "), name, true).AddText(" No automated design set of that name or index exists.").BuiltString);
.AddRed(name, true).AddText(" No automated design set of that name or index exists.").BuiltString);
return false; return false;
} }
@ -320,7 +310,7 @@ public class CommandService : IDisposable, IApiService
var split = argument.Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var split = argument.Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (split.Length != 2) if (split.Length != 2)
{ {
_chat.Print(new SeStringBuilder().AddText("The command ").AddBlue("automation") _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("The command "), "automation")
.AddText(" requires a design index and application flags.").BuiltString); .AddText(" requires a design index and application flags.").BuiltString);
return false; return false;
} }
@ -334,7 +324,7 @@ public class CommandService : IDisposable, IApiService
var split2 = split[1].Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var split2 = split[1].Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (!int.TryParse(split2[0], out var designIdx) || designIdx <= 0) if (!int.TryParse(split2[0], out var designIdx) || designIdx <= 0)
{ {
_chat.Print(new SeStringBuilder().AddText("The value ").AddYellow(split2[0], true) _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("The value "), split2[0], true)
.AddText(" is not a valid design index.").BuiltString); .AddText(" is not a valid design index.").BuiltString);
return false; return false;
} }
@ -358,7 +348,7 @@ public class CommandService : IDisposable, IApiService
case 'd': applicationFlags |= ApplicationType.GearCustomization; break; case 'd': applicationFlags |= ApplicationType.GearCustomization; break;
case 'w': applicationFlags |= ApplicationType.Weapons; break; case 'w': applicationFlags |= ApplicationType.Weapons; break;
default: default:
_chat.Print(new SeStringBuilder().AddText("The value ").AddPurple(split2[1], true) _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText("The value "), split2[1], true)
.AddText(" is not a valid set of application flags.").BuiltString); .AddText(" is not a valid set of application flags.").BuiltString);
return false; return false;
} }
@ -372,7 +362,7 @@ public class CommandService : IDisposable, IApiService
{ {
if (argument.Length == 0) if (argument.Length == 0)
{ {
_chat.Print(new SeStringBuilder().AddText($"Use with /glamour {command} ").AddGreen("[Character Identifier]").BuiltString); _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText($"Use with /glamour {command} "), "[Character Identifier]").BuiltString);
PlayerIdentifierHelp(false, true); PlayerIdentifierHelp(false, true);
return true; return true;
} }
@ -402,7 +392,7 @@ public class CommandService : IDisposable, IApiService
{ {
if (argument.Length == 0) if (argument.Length == 0)
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour revert ").AddGreen("[Character Identifier]").BuiltString); _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour revert "), "[Character Identifier]").BuiltString);
PlayerIdentifierHelp(false, true); PlayerIdentifierHelp(false, true);
return true; return true;
} }
@ -424,7 +414,7 @@ public class CommandService : IDisposable, IApiService
{ {
if (argument.Length == 0) if (argument.Length == 0)
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour revert ").AddGreen("[Character Identifier]").BuiltString); _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour revert "), "[Character Identifier]").BuiltString);
PlayerIdentifierHelp(false, true); PlayerIdentifierHelp(false, true);
return true; return true;
} }
@ -450,9 +440,8 @@ public class CommandService : IDisposable, IApiService
var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (split.Length is not 2) if (split.Length is not 2)
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour applyitem ").AddYellow("[Item ID or Item Name]") _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour applyitem ").AddYellow("[Item ID or Item Name]")
.AddText(" | ") .AddText(" | "), "[Character Identifier]")
.AddGreen("[Character Identifier]")
.BuiltString); .BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(new SeStringBuilder()
.AddText( .AddText(
@ -468,7 +457,7 @@ public class CommandService : IDisposable, IApiService
if (_items.ItemData.Primary.TryGetValue(id, out var main)) if (_items.ItemData.Primary.TryGetValue(id, out var main))
items[0] = main; items[0] = main;
} }
else if (_items.ItemData.Primary.FindFirst(pair => string.Equals(pair.Value.Name, split[0], StringComparison.OrdinalIgnoreCase), else if (ArrayExtensions.FindFirst(_items.ItemData.Primary, pair => string.Equals(pair.Value.Name, split[0], StringComparison.OrdinalIgnoreCase),
out var i)) out var i))
{ {
items[0] = i.Value; items[0] = i.Value;
@ -476,7 +465,7 @@ public class CommandService : IDisposable, IApiService
if (!items[0].Valid) if (!items[0].Valid)
{ {
_chat.Print(new SeStringBuilder().AddText("The item ").AddYellow(split[0], true) _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("The item "), split[0], true)
.AddText(" could not be identified as a valid item.").BuiltString); .AddText(" could not be identified as a valid item.").BuiltString);
return false; return false;
} }
@ -534,7 +523,7 @@ public class CommandService : IDisposable, IApiService
|| customizeInt < 0 || customizeInt < 0
|| customizeInt >= CustomizationExtensions.AllBasic.Length) || customizeInt >= CustomizationExtensions.AllBasic.Length)
{ {
_chat.Print(new SeStringBuilder().AddText("The customization type ").AddYellow(customizationSplit[0], true) _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("The customization type "), customizationSplit[0], true)
.AddText(" could not be identified as a valid type.").BuiltString); .AddText(" could not be identified as a valid type.").BuiltString);
return false; return false;
} }
@ -560,7 +549,7 @@ public class CommandService : IDisposable, IApiService
} }
else else
{ {
_chat.Print(new SeStringBuilder().AddText("The customization value ").AddPurple(valueString, true) _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText("The customization value "), valueString, true)
.AddText(" could not be parsed.") .AddText(" could not be parsed.")
.BuiltString); .BuiltString);
return false; return false;
@ -634,26 +623,24 @@ public class CommandService : IDisposable, IApiService
bool PrintCustomizationHelp() bool PrintCustomizationHelp()
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour applycustomization ").AddYellow("[Customization Type]") _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour applycustomization ").AddYellow("[Customization Type]")
.AddPurple(" [Value, Next, Previous, Minus, or Plus] ") .AddPurple(" [Value, Next, Previous, Minus, or Plus] ")
.AddBlue("<Amount>") .AddBlue("<Amount>")
.AddText(" | ") .AddText(" | "), "[Character Identifier]")
.AddGreen("[Character Identifier]")
.BuiltString); .BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》 Valid ").AddPurple("values") _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 Valid "), "values")
.AddText(" depend on the the character's gender, clan, and the customization type.").BuiltString); .AddText(" depend on the the character's gender, clan, and the customization type.").BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》 ").AddPurple("Plus").AddText(" and ").AddPurple("Minus") _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText(" 》 ").AddPurple("Plus").AddText(" and ").AddPurple("Minus")
.AddText(" are the same as pressing the + and - buttons in the UI, times the optional ").AddBlue(" amount").AddText(".") .AddText(" are the same as pressing the + and - buttons in the UI, times the optional "), " amount").AddText(".")
.BuiltString); .BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》 ").AddPurple("Next").AddText(" and ").AddPurple("Previous") _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 ").AddPurple("Next").AddText(" and "), "Previous")
.AddText(" is similar to Plus and Minus, but with wrap-around on reaching the end.").BuiltString); .AddText(" is similar to Plus and Minus, but with wrap-around on reaching the end.").BuiltString);
var builder = new SeStringBuilder().AddText(" 》 Available ").AddYellow("Customization Types") var builder = SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText(" 》 Available ").AddYellow("Customization Types")
.AddText(" are either a number in ") .AddText(" are either a number in "), $"[0, {CustomizationExtensions.AllBasic.Length}]")
.AddYellow($"[0, {CustomizationExtensions.AllBasic.Length}]")
.AddText(" or one of "); .AddText(" or one of ");
foreach (var index in CustomizationExtensions.AllBasic.SkipLast(1)) foreach (var index in CustomizationExtensions.AllBasic.SkipLast(1))
builder.AddYellow(index.ToString()).AddText(", "); SeStringBuilderExtensions.AddYellow(builder, index.ToString()).AddText(", ");
_chat.Print(builder.AddYellow(CustomizationExtensions.AllBasic[^1].ToString()).AddText(".").BuiltString); _chat.Print(SeStringBuilderExtensions.AddYellow(builder, CustomizationExtensions.AllBasic[^1].ToString()).AddText(".").BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(new SeStringBuilder()
.AddText(" 》 The item name is case-insensitive. Numeric IDs are preferred before item names.") .AddText(" 》 The item name is case-insensitive. Numeric IDs are preferred before item names.")
.BuiltString); .BuiltString);
@ -667,12 +654,11 @@ public class CommandService : IDisposable, IApiService
var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (split.Length is not 2) if (split.Length is not 2)
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour apply ") _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("Use with /glamour apply ")
.AddYellow("[Design Name, Path or Identifier, Quick, Selection, Random, or Clipboard]") .AddYellow("[Design Name, Path or Identifier, Quick, Selection, Random, or Clipboard]")
.AddText(" | ") .AddText(" | ")
.AddGreen("[Character Identifier]") .AddGreen("[Character Identifier]")
.AddText("; ") .AddText("; "), "<Apply Mods>")
.AddBlue("<Apply Mods>")
.BuiltString); .BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(new SeStringBuilder()
.AddText( .AddText(
@ -691,15 +677,15 @@ public class CommandService : IDisposable, IApiService
.AddText(" 》 Selection will use the design currently selected in the main interfaces Designs tab, if any.").BuiltString); .AddText(" 》 Selection will use the design currently selected in the main interfaces Designs tab, if any.").BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(new SeStringBuilder()
.AddText(" 》 Clipboard as a single word will try to apply a design string currently in your clipboard.").BuiltString); .AddText(" 》 Clipboard as a single word will try to apply a design string currently in your clipboard.").BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder()
.AddText(" 》 ").AddYellow("Random") .AddText(" 》 "), "Random")
.AddText( .AddText(
" supports many restrictions, see the Restriction Builder when adding a Random design to Automations for valid strings.") " supports many restrictions, see the Restriction Builder when adding a Random design to Automations for valid strings.")
.BuiltString); .BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder()
.AddText(" 》 ").AddBlue("<Enable Mods>").AddText(" is optional and can be omitted (together with the ;), ").AddBlue("true") .AddText(" 》 ").AddBlue("<Enable Mods>").AddText(" is optional and can be omitted (together with the ;), ").AddBlue("true")
.AddText(" or ").AddBlue("false").AddText(".").BuiltString); .AddText(" or "), "false").AddText(".").BuiltString);
_chat.Print(new SeStringBuilder().AddText("If ").AddBlue("true") _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("If "), "true")
.AddText(", it will try to apply mod associations to the collection assigned to the identified character.").BuiltString); .AddText(", it will try to apply mod associations to the collection assigned to the identified character.").BuiltString);
PlayerIdentifierHelp(false, true); PlayerIdentifierHelp(false, true);
return true; return true;
@ -763,7 +749,7 @@ public class CommandService : IDisposable, IApiService
{ {
if (argument.Length == 0) if (argument.Length == 0)
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour delete ").AddYellow("[Design Name, Path or Identifier]").BuiltString); _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("Use with /glamour delete "), "[Design Name, Path or Identifier]").BuiltString);
_chat.Print(new SeStringBuilder() _chat.Print(new SeStringBuilder()
.AddText( .AddText(
" 》 The design name is case-insensitive. If multiple designs of that name up to case exist, the first one is chosen.") " 》 The design name is case-insensitive. If multiple designs of that name up to case exist, the first one is chosen.")
@ -790,7 +776,7 @@ public class CommandService : IDisposable, IApiService
{ {
if (argument.Length == 0) if (argument.Length == 0)
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour copy ").AddGreen("[Character Identifier]").BuiltString); _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour copy "), "[Character Identifier]").BuiltString);
PlayerIdentifierHelp(false, true); PlayerIdentifierHelp(false, true);
} }
@ -829,8 +815,7 @@ public class CommandService : IDisposable, IApiService
var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (split.Length != 2) if (split.Length != 2)
{ {
_chat.Print(new SeStringBuilder().AddText("Use with /glamour save ").AddYellow("[New Design Name]").AddText(" | ") _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour save ").AddYellow("[New Design Name]").AddText(" | "), "[Character Identifier]").BuiltString);
.AddGreen("[Character Identifier]").BuiltString);
PlayerIdentifierHelp(false, true); PlayerIdentifierHelp(false, true);
} }
@ -850,7 +835,7 @@ public class CommandService : IDisposable, IApiService
return true; return true;
} }
_chat.Print(new SeStringBuilder().AddText("Could not save state to design ").AddYellow(split[0], true) _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("Could not save state to design "), split[0], true)
.AddText(": No identified object is available or has stored state.").BuiltString); .AddText(": No identified object is available or has stored state.").BuiltString);
return false; return false;
} }
@ -864,7 +849,7 @@ public class CommandService : IDisposable, IApiService
var identifier = _actors.FromObject(obj.AsObject, out _, true, true, true); var identifier = _actors.FromObject(obj.AsObject, out _, true, true, true);
if (!identifier.IsValid) if (!identifier.IsValid)
{ {
_chat.Print(new SeStringBuilder().AddText("The placeholder ").AddGreen(argument) _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("The placeholder "), argument)
.AddText(" did not resolve to a game object with a valid identifier.").BuiltString); .AddText(" did not resolve to a game object with a valid identifier.").BuiltString);
identifiers = []; identifiers = [];
return false; return false;
@ -884,7 +869,7 @@ public class CommandService : IDisposable, IApiService
&& identifiers[0].Type is IdentifierType.Player or IdentifierType.Owned && identifiers[0].Type is IdentifierType.Player or IdentifierType.Owned
&& identifiers[0].HomeWorld == ushort.MaxValue) && identifiers[0].HomeWorld == ushort.MaxValue)
{ {
_chat.Print(new SeStringBuilder().AddText("The argument ").AddRed(argument, true) _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("The argument "), argument, true)
.AddText(" did not specify a world.").BuiltString); .AddText(" did not specify a world.").BuiltString);
return false; return false;
} }
@ -894,7 +879,7 @@ public class CommandService : IDisposable, IApiService
} }
catch (ActorIdentifierFactory.IdentifierParseError e) catch (ActorIdentifierFactory.IdentifierParseError e)
{ {
_chat.Print(new SeStringBuilder().AddText("The argument ").AddRed(argument, true) _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("The argument "), argument, true)
.AddText($" could not be converted to an identifier. {e.Message}") .AddText($" could not be converted to an identifier. {e.Message}")
.BuiltString); .BuiltString);
identifiers = []; identifiers = [];
@ -904,27 +889,27 @@ public class CommandService : IDisposable, IApiService
private void PlayerIdentifierHelp(bool allowAnyWorld, bool allowIndex) private void PlayerIdentifierHelp(bool allowAnyWorld, bool allowIndex)
{ {
var npcGuide = new SeStringBuilder().AddText(" 》》》").AddGreen("n").AddText(" | ").AddPurple("[NPC Type]").AddText(" : ") var npcGuide = SeStringBuilderExtensions.AddInitialPurple(new SeStringBuilder().AddText(" 》》》").AddGreen("n").AddText(" | ").AddPurple("[NPC Type]").AddText(" : ")
.AddRed("[NPC Name]").AddBlue(allowIndex ? "@<Object Index>" : string.Empty).AddText(", where NPC Type can be ") .AddRed("[NPC Name]").AddBlue(allowIndex ? "@<Object Index>" : string.Empty).AddText(", where NPC Type can be ")
.AddInitialPurple("Mount") .AddInitialPurple("Mount")
.AddInitialPurple("Companion") .AddInitialPurple("Companion")
.AddInitialPurple("Accessory").AddInitialPurple("Event NPC").AddText("or ").AddInitialPurple("Battle NPC", false); .AddInitialPurple("Accessory").AddInitialPurple("Event NPC").AddText("or "), "Battle NPC", false);
if (allowIndex) if (allowIndex)
npcGuide = npcGuide.AddText(", and the ").AddBlue("index").AddText(" is an optional non-negative number in the object table."); npcGuide = SeStringBuilderExtensions.AddBlue(npcGuide.AddText(", and the "), "index").AddText(" is an optional non-negative number in the object table.");
else else
npcGuide = npcGuide.AddText("."); npcGuide = npcGuide.AddText(".");
_chat.Print(new SeStringBuilder().AddText(" 》 Valid Character Identifiers have the form:").BuiltString); _chat.Print(new SeStringBuilder().AddText(" 》 Valid Character Identifiers have the form:").BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》》》").AddGreen("<me>").AddText(" or ").AddGreen("<t>").AddText(" or ").AddGreen("<mo>") _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText(" 》》》").AddGreen("<me>").AddText(" or ").AddGreen("<t>").AddText(" or ").AddGreen("<mo>")
.AddText(" or ").AddGreen("<f>") .AddText(" or "), "<f>")
.AddText(" as placeholders for your character, your target, your mouseover or your focus, if they exist.").BuiltString); .AddText(" as placeholders for your character, your target, your mouseover or your focus, if they exist.").BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》》》").AddGreen("p").AddText(" | ").AddWhite("[Player Name]@[World Name]") _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》").AddGreen("p").AddText(" | "), "[Player Name]@[World Name]")
.AddText(allowAnyWorld ? ", if no @ is provided, Any World is used." : ".") .AddText(allowAnyWorld ? ", if no @ is provided, Any World is used." : ".")
.BuiltString); .BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》》》").AddGreen("r").AddText(" | ").AddWhite("[Retainer Name]").AddText(".").BuiltString); _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》").AddGreen("r").AddText(" | "), "[Retainer Name]").AddText(".").BuiltString);
_chat.Print(npcGuide.BuiltString); _chat.Print(npcGuide.BuiltString);
_chat.Print(new SeStringBuilder().AddText(" 》》》 ").AddGreen("o").AddText(" | ").AddPurple("[NPC Type]") _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》 ").AddGreen("o").AddText(" | ").AddPurple("[NPC Type]")
.AddText(" : ") .AddText(" : ")
.AddRed("[NPC Name]").AddText(" | ").AddWhite("[Player Name]@<World Name>").AddText(".").BuiltString); .AddRed("[NPC Name]").AddText(" | "), "[Player Name]@<World Name>").AddText(".").BuiltString);
} }
} }

View file

@ -1,5 +1,5 @@
using Glamourer.GameData; using Glamourer.GameData;
using OtterGui.Services; using Luna;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;

View file

@ -1,7 +1,7 @@
using Dalamud.Interface.DragDrop; using Dalamud.Interface.DragDrop;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using OtterGui.Services; using Luna;
namespace Glamourer.Services; namespace Glamourer.Services;

View file

@ -1,6 +1,6 @@
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.State; using Glamourer.State;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;

View file

@ -5,8 +5,7 @@ using Glamourer.Designs.Special;
using Glamourer.Gui; using Glamourer.Gui;
using Glamourer.Gui.Tabs.DesignTab; using Glamourer.Gui.Tabs.DesignTab;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using OtterGui.Services; using Luna;
using OtterGui.Classes;
namespace Glamourer.Services; namespace Glamourer.Services;

View file

@ -1,7 +1,7 @@
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using OtterGui.Services; using Luna;
using Penumbra.GameData; using Penumbra.GameData;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;

View file

@ -1,8 +1,8 @@
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Glamourer.State; using Glamourer.State;
using Luna;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui.Services;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;

View file

@ -19,16 +19,18 @@ using Glamourer.Interop;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using Glamourer.State; using Glamourer.State;
using Glamourer.Unlocks; using Glamourer.Unlocks;
using Luna;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using OtterGui.Classes; using OtterGui.Classes;
using OtterGui.Log;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Data; using Penumbra.GameData.Data;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
using FrameworkManager = OtterGui.Classes.FrameworkManager;
using Logger = OtterGui.Log.Logger;
using MessageService = OtterGui.Classes.MessageService;
namespace Glamourer.Services; namespace Glamourer.Services;
@ -37,7 +39,7 @@ public static class StaticServiceManager
public static ServiceManager CreateProvider(IDalamudPluginInterface pi, Logger log, Glamourer glamourer) public static ServiceManager CreateProvider(IDalamudPluginInterface pi, Logger log, Glamourer glamourer)
{ {
EventWrapperBase.ChangeLogger(log); EventWrapperBase.ChangeLogger(log);
var services = new ServiceManager(log) var services = new ServiceManager(new Luna.Logger("Glamourer"))
.AddExistingService(log) .AddExistingService(log)
.AddMeta() .AddMeta()
.AddInterop() .AddInterop()
@ -51,8 +53,15 @@ public static class StaticServiceManager
services.AddIServices(typeof(EquipItem).Assembly); services.AddIServices(typeof(EquipItem).Assembly);
services.AddIServices(typeof(Glamourer).Assembly); services.AddIServices(typeof(Glamourer).Assembly);
services.AddIServices(typeof(ImRaii).Assembly); services.AddIServices(typeof(ImRaii).Assembly);
services.AddIServices(typeof(ServiceManager).Assembly);
services.AddIServices<OtterGui.Services.IService>(typeof(Glamourer).Assembly);
services.AddSingleton<DictJob>();
services.AddSingleton<DictJobGroup>();
services.AddSingleton<NameDicts>();
services.AddSingleton<DictWorld>();
services.AddSingleton<IGlamourerApi>(p => p.GetRequiredService<GlamourerApi>()); services.AddSingleton<IGlamourerApi>(p => p.GetRequiredService<GlamourerApi>());
services.CreateProvider(); services.BuildProvider();
return services; return services;
} }

View file

@ -1,5 +1,5 @@
using Glamourer.Designs.Links; using Glamourer.Designs.Links;
using OtterGui.Services; using Luna;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;

2
Luna

@ -1 +1 @@
Subproject commit 2487453cfa4e95b9dbc661ed6e7298655df3b055 Subproject commit 1887502aa892743e9db84c9adc084d748219f1f3

@ -1 +1 @@
Subproject commit be7792ea33ae0b91109fcb95360cf4f382e9bc99 Subproject commit de0c19f712c75efe05aef7ff614b2ead0f10e534