diff --git a/Glamourer/Automation/AutoDesignApplier.cs b/Glamourer/Automation/AutoDesignApplier.cs index f90cb9b..22048a8 100644 --- a/Glamourer/Automation/AutoDesignApplier.cs +++ b/Glamourer/Automation/AutoDesignApplier.cs @@ -299,12 +299,19 @@ public sealed class AutoDesignApplier : IDisposable if (_manager.EnabledSets.TryGetValue(identifier, out set)) return true; - identifier = _actors.CreatePlayer(identifier.PlayerName, ushort.MaxValue); + identifier = _actors.CreatePlayer(identifier.PlayerName, WorldId.AnyWorld); return _manager.EnabledSets.TryGetValue(identifier, out set); case IdentifierType.Retainer: case IdentifierType.Npc: return _manager.EnabledSets.TryGetValue(identifier, out set); case IdentifierType.Owned: + if (_manager.EnabledSets.TryGetValue(identifier, out set)) + return true; + + identifier = _actors.CreateOwned(identifier.PlayerName, WorldId.AnyWorld, identifier.Kind, identifier.DataId); + if (_manager.EnabledSets.TryGetValue(identifier, out set)) + return true; + identifier = _actors.CreateNpc(identifier.Kind, identifier.DataId); return _manager.EnabledSets.TryGetValue(identifier, out set); default: diff --git a/Glamourer/Automation/AutoDesignManager.cs b/Glamourer/Automation/AutoDesignManager.cs index 474afdd..a219376 100644 --- a/Glamourer/Automation/AutoDesignManager.cs +++ b/Glamourer/Automation/AutoDesignManager.cs @@ -570,12 +570,13 @@ public class AutoDesignManager : ISavable, IReadOnlyList, IDispos IdentifierType.Player => true, IdentifierType.Retainer => true, IdentifierType.Npc => true, + IdentifierType.Owned => true, _ => false, }; if (!validType) { - group = Array.Empty(); + group = []; return false; } @@ -602,6 +603,7 @@ public class AutoDesignManager : ISavable, IReadOnlyList, IDispos : ActorIdentifier.RetainerType.Bell).CreatePermanent(), ], IdentifierType.Npc => CreateNpcs(_actors, identifier), + IdentifierType.Owned => CreateNpcs(_actors, identifier), _ => [], }; @@ -616,8 +618,7 @@ public class AutoDesignManager : ISavable, IReadOnlyList, IDispos }; return table.Where(kvp => kvp.Value == name) .Select(kvp => manager.CreateIndividualUnchecked(identifier.Type, identifier.PlayerName, identifier.HomeWorld.Id, - identifier.Kind, - kvp.Key)).ToArray(); + identifier.Kind, kvp.Key)).ToArray(); } } diff --git a/Glamourer/Gui/Tabs/AutomationTab/IdentifierDrawer.cs b/Glamourer/Gui/Tabs/AutomationTab/IdentifierDrawer.cs index 8498bc1..b197a1a 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/IdentifierDrawer.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/IdentifierDrawer.cs @@ -20,6 +20,7 @@ public class IdentifierDrawer public ActorIdentifier PlayerIdentifier { get; private set; } = ActorIdentifier.Invalid; public ActorIdentifier RetainerIdentifier { get; private set; } = ActorIdentifier.Invalid; public ActorIdentifier MannequinIdentifier { get; private set; } = ActorIdentifier.Invalid; + public ActorIdentifier OwnedIdentifier { get; private set; } = ActorIdentifier.Invalid; public IdentifierDrawer(ActorManager actors, DictWorld dictWorld, DictModelChara dictModelChara, DictBNpcNames bNpcNames, DictBNpc bNpc, HumanModelList humans) @@ -60,6 +61,9 @@ public class IdentifierDrawer public bool CanSetNpc => NpcIdentifier.IsValid; + public bool CanSetOwned + => OwnedIdentifier.IsValid; + private void UpdateIdentifiers() { if (ByteString.FromString(_characterName, out var byteName)) @@ -67,6 +71,11 @@ public class IdentifierDrawer PlayerIdentifier = _actors.CreatePlayer(byteName, _worldCombo.CurrentSelection.Key); RetainerIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Bell); MannequinIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Mannequin); + + if (_humanNpcCombo.CurrentSelection.Kind is ObjectKind.EventNpc or ObjectKind.BattleNpc) + OwnedIdentifier = _actors.CreateOwned(byteName, _worldCombo.CurrentSelection.Key, _humanNpcCombo.CurrentSelection.Kind, _humanNpcCombo.CurrentSelection.Ids[0]); + else + OwnedIdentifier = ActorIdentifier.Invalid; } NpcIdentifier = _humanNpcCombo.CurrentSelection.Kind is ObjectKind.EventNpc or ObjectKind.BattleNpc diff --git a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs index 8d52a76..ab2b3d6 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs @@ -10,6 +10,7 @@ using ImGuiNET; using OtterGui; using OtterGui.Log; using OtterGui.Raii; +using OtterGui.Text; using OtterGui.Widgets; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; @@ -424,22 +425,26 @@ public class SetPanel( private void DrawIdentifierSelection(int setIndex) { - using var id = ImRaii.PushId("Identifiers"); + using var id = ImUtf8.PushId("Identifiers"u8); _identifierDrawer.DrawWorld(130); ImGui.SameLine(); _identifierDrawer.DrawName(200 - ImGui.GetStyle().ItemSpacing.X); _identifierDrawer.DrawNpcs(330); var buttonWidth = new Vector2(165 * ImGuiHelpers.GlobalScale - ImGui.GetStyle().ItemSpacing.X / 2, 0); - if (ImGuiUtil.DrawDisabledButton("Set to Character", buttonWidth, string.Empty, !_identifierDrawer.CanSetPlayer)) + if (ImUtf8.ButtonEx("Set to Character"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetPlayer)) _manager.ChangeIdentifier(setIndex, _identifierDrawer.PlayerIdentifier); ImGui.SameLine(); - if (ImGuiUtil.DrawDisabledButton("Set to NPC", buttonWidth, string.Empty, !_identifierDrawer.CanSetNpc)) + if (ImUtf8.ButtonEx("Set to NPC"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetNpc)) _manager.ChangeIdentifier(setIndex, _identifierDrawer.NpcIdentifier); - if (ImGuiUtil.DrawDisabledButton("Set to Retainer", buttonWidth, string.Empty, !_identifierDrawer.CanSetRetainer)) + + if (ImUtf8.ButtonEx("Set to Retainer"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetRetainer)) _manager.ChangeIdentifier(setIndex, _identifierDrawer.RetainerIdentifier); ImGui.SameLine(); - if (ImGuiUtil.DrawDisabledButton("Set to Mannequin", buttonWidth, string.Empty, !_identifierDrawer.CanSetRetainer)) + if (ImUtf8.ButtonEx("Set to Mannequin"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetRetainer)) _manager.ChangeIdentifier(setIndex, _identifierDrawer.MannequinIdentifier); + + if (ImUtf8.ButtonEx("Set to Owned NPC"u8, string.Empty, buttonWidth, !_identifierDrawer.CanSetOwned)) + _manager.ChangeIdentifier(setIndex, _identifierDrawer.OwnedIdentifier); } private sealed class JobGroupCombo(AutoDesignManager manager, JobService jobs, Logger log)