diff --git a/Glamourer.zip b/Glamourer.zip index 84df484..772065f 100644 Binary files a/Glamourer.zip and b/Glamourer.zip differ diff --git a/Glamourer/Glamourer.csproj b/Glamourer/Glamourer.csproj index 8d9cb2d..b75becb 100644 --- a/Glamourer/Glamourer.csproj +++ b/Glamourer/Glamourer.csproj @@ -88,7 +88,7 @@ - + \ No newline at end of file diff --git a/Glamourer/Glamourer.json b/Glamourer/Glamourer.json index dce34cd..4001289 100644 --- a/Glamourer/Glamourer.json +++ b/Glamourer/Glamourer.json @@ -1,25 +1,14 @@ { - "Disabled": false, - "Testing": false, - "InstalledFromUrl": null, "Author": "Ottermandias", "Name": "Glamourer", "Punchline": "Change and save appearance of players.", "Description": "Adds functionality to change and store appearance of players, customization and equip. Requires Penumbra to be installed and activated to work. Can also add preview options to the Changed Items tab for Penumbra.", - "Tags": null, - "IsHide": false, + "Tags": ["Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character"], "InternalName": "Glamourer", "AssemblyVersion": "0.0.4.0", - "TestingAssemblyVersion": null, - "IsTestingExclusive": false, "RepoUrl": "https://github.com/Ottermandias/Glamourer", "ApplicableVersion": "any", "DalamudApiLevel": 4, - "DownloadCount": 0, - "LastUpdate": 0, - "DownloadLinkInstall": null, - "DownloadLinkUpdate": null, - "DownloadLinkTesting": "https://github.com/Ottermandias/Glamourer/raw/main/Glamourer.zip", "LoadPriority": -100, "ImageUrls": null, "IconUrl": null diff --git a/Glamourer/Gui/ComboWithFilter.cs b/Glamourer/Gui/ComboWithFilter.cs index 5a40a6d..f284437 100644 --- a/Glamourer/Gui/ComboWithFilter.cs +++ b/Glamourer/Gui/ComboWithFilter.cs @@ -68,8 +68,11 @@ namespace Glamourer.Gui { numItems = ItemsAtOnce; nodeIdx = -1; - if (!ImGui.BeginChild(_listLabel, new Vector2(_size, ItemsAtOnce * _heightPerItem))) - return false; + if (!ImGui.BeginChild(_listLabel, new Vector2(_size, ItemsAtOnce * _heightPerItem))) + { + ImGui.EndChild(); + return false; + } var ret = false; try diff --git a/Glamourer/PenumbraAttach.cs b/Glamourer/PenumbraAttach.cs index 7521a5f..3b75c86 100644 --- a/Glamourer/PenumbraAttach.cs +++ b/Glamourer/PenumbraAttach.cs @@ -1,7 +1,7 @@ using System; using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Logging; -using Dalamud.Plugin; +using Dalamud.Plugin.Ipc; using Glamourer.Gui; using ImGuiNET; using Penumbra.GameData.Enums; @@ -12,10 +12,10 @@ namespace Glamourer { public const int RequiredPenumbraShareVersion = 3; - private ICallGateSubscriber? TooltipSubscriber; - private ICallGateSubscriber? ClickSubscriber; - private ICallGateSubscriber? RedrawSubscriberName; - private ICallGateSubscriber? RedrawSubscriberObject; + private ICallGateSubscriber? _tooltipSubscriber; + private ICallGateSubscriber? _clickSubscriber; + private ICallGateSubscriber? _redrawSubscriberName; + private ICallGateSubscriber? _redrawSubscriberObject; public PenumbraAttach(bool attach) => Reattach(attach); @@ -31,16 +31,17 @@ namespace Glamourer if (version != RequiredPenumbraShareVersion) throw new Exception($"Invalid Version {version}, required Version {RequiredPenumbraShareVersion}."); - RedrawSubscriberName = Dalamud.PluginInterface.GetIpcSubscriber("Penumbra.RedrawObjectByName"); - RedrawSubscriberObject = Dalamud.PluginInterface.GetIpcSubscriber("Penumbra.RedrawObject"); + _redrawSubscriberName = Dalamud.PluginInterface.GetIpcSubscriber("Penumbra.RedrawObjectByName"); + _redrawSubscriberObject = Dalamud.PluginInterface.GetIpcSubscriber("Penumbra.RedrawObject"); if (!attach) return; - TooltipSubscriber = Dalamud.PluginInterface.GetIpcSubscriber("Penumbra.ChangedItemTooltip"); - ClickSubscriber = Dalamud.PluginInterface.GetIpcSubscriber("Penumbra.ChangedItemClick"); - TooltipSubscriber.Subscribe(PenumbraTooltip); - ClickSubscriber.Subscribe(PenumbraRightClickWrapper); + _tooltipSubscriber = Dalamud.PluginInterface.GetIpcSubscriber("Penumbra.ChangedItemTooltip"); + _clickSubscriber = + Dalamud.PluginInterface.GetIpcSubscriber("Penumbra.ChangedItemClick"); + _tooltipSubscriber.Subscribe(PenumbraTooltip); + _clickSubscriber.Subscribe(PenumbraRightClick); } catch (Exception e) { @@ -50,30 +51,31 @@ namespace Glamourer public void Unattach() { - TooltipSubscriber?.Unsubscribe(PenumbraTooltip); - ClickSubscriber?.Unsubscribe(PenumbraRightClickWrapper); - TooltipSubscriber = null; - ClickSubscriber = null; - RedrawSubscriberName = null; - RedrawSubscriberObject = null; + _tooltipSubscriber?.Unsubscribe(PenumbraTooltip); + _clickSubscriber?.Unsubscribe(PenumbraRightClick); + _tooltipSubscriber = null; + _clickSubscriber = null; + _redrawSubscriberName = null; + _redrawSubscriberObject = null; } public void Dispose() => Unattach(); - private static void PenumbraTooltip(object? it) + private static void PenumbraTooltip(ChangedItemType type, uint _) { - if (it is Lumina.Excel.GeneratedSheets.Item) + if (type == ChangedItemType.Item) ImGui.Text("Right click to apply to current Glamourer Set. [Glamourer]"); } - private void PenumbraRightClick(MouseButton button, object? it) + private void PenumbraRightClick(MouseButton button, ChangedItemType type, uint id) { - if (button != MouseButton.Right || it is not Lumina.Excel.GeneratedSheets.Item item) + if (button != MouseButton.Right || type != ChangedItemType.Item) return; var gPose = Dalamud.Objects[Interface.GPoseObjectId] as Character; var player = Dalamud.Objects[0] as Character; + var item = (Lumina.Excel.GeneratedSheets.Item) type.GetObject(id)!; var writeItem = new Item(item, string.Empty); if (gPose != null) { @@ -87,16 +89,13 @@ namespace Glamourer } } - private void PenumbraRightClickWrapper(int button, object? it) - => PenumbraRightClick((MouseButton) button, it); - public void RedrawObject(GameObject actor, RedrawType settings, bool repeat) { - if (RedrawSubscriberObject != null) + if (_redrawSubscriberObject != null) { try { - RedrawSubscriberObject.InvokeFunc(actor, (int) settings); + _redrawSubscriberObject.InvokeAction(actor, (int) settings); } catch (Exception e) { @@ -117,7 +116,9 @@ namespace Glamourer RedrawObject(actor, settings, false); } else + { PluginLog.Debug("Trying to redraw object, but not attached to Penumbra."); + } } // Update objects without triggering PlayerWatcher Events, diff --git a/repo.json b/repo.json index 5dce42d..605a113 100644 --- a/repo.json +++ b/repo.json @@ -13,7 +13,7 @@ "IsTestingExclusive": "false", "DownloadCount": 1, "LastUpdate": 1618608322, - "DownloadLinkInstall": "https://github.com/Ottermandias/Glamourer/raw/main/Glamourer.zip", - "DownloadLinkUpdate": "https://github.com/Ottermandias/Glamourer/raw/main/Glamourer.zip", + "DownloadLinkInstall": "https://github.com/Ottermandias/Glamourer/raw/api4/Glamourer.zip", + "DownloadLinkUpdate": "https://github.com/Ottermandias/Glamourer/raw/api4/Glamourer.zip", } ]