Update more.

This commit is contained in:
Ottermandias 2021-09-05 00:04:20 +02:00
parent ebcd1ea795
commit c9f46575a1
6 changed files with 36 additions and 43 deletions

Binary file not shown.

View file

@ -88,7 +88,7 @@
</None> </None>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="if $(Configuration) == Release powershell Compress-Archive -Force $(TargetPath), $(TargetDir)$(SolutionName).json, $(TargetDir)$(SolutionName).GameData.dll, $(TargetDir)Penumbra.GameData.dll, $(TargetDir)Penumbra.Api.dll, $(TargetDir)Penumbra.PlayerWatch.dll $(SolutionDir)$(SolutionName).zip" /> <Exec Command="if $(Configuration) == Release powershell Compress-Archive -Force $(TargetPath), $(TargetDir)$(SolutionName).json, $(TargetDir)$(SolutionName).GameData.dll, $(TargetDir)Penumbra.GameData.dll, $(TargetDir)Penumbra.PlayerWatch.dll $(SolutionDir)$(SolutionName).zip" />
<Exec Command="if $(Configuration) == Release powershell Copy-Item -Force $(TargetDir)$(SolutionName).json -Destination $(SolutionDir)" /> <Exec Command="if $(Configuration) == Release powershell Copy-Item -Force $(TargetDir)$(SolutionName).json -Destination $(SolutionDir)" />
</Target> </Target>
</Project> </Project>

View file

@ -1,25 +1,14 @@
{ {
"Disabled": false,
"Testing": false,
"InstalledFromUrl": null,
"Author": "Ottermandias", "Author": "Ottermandias",
"Name": "Glamourer", "Name": "Glamourer",
"Punchline": "Change and save appearance of players.", "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.", "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, "Tags": ["Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character"],
"IsHide": false,
"InternalName": "Glamourer", "InternalName": "Glamourer",
"AssemblyVersion": "0.0.4.0", "AssemblyVersion": "0.0.4.0",
"TestingAssemblyVersion": null,
"IsTestingExclusive": false,
"RepoUrl": "https://github.com/Ottermandias/Glamourer", "RepoUrl": "https://github.com/Ottermandias/Glamourer",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"DalamudApiLevel": 4, "DalamudApiLevel": 4,
"DownloadCount": 0,
"LastUpdate": 0,
"DownloadLinkInstall": null,
"DownloadLinkUpdate": null,
"DownloadLinkTesting": "https://github.com/Ottermandias/Glamourer/raw/main/Glamourer.zip",
"LoadPriority": -100, "LoadPriority": -100,
"ImageUrls": null, "ImageUrls": null,
"IconUrl": null "IconUrl": null

View file

@ -68,8 +68,11 @@ namespace Glamourer.Gui
{ {
numItems = ItemsAtOnce; numItems = ItemsAtOnce;
nodeIdx = -1; nodeIdx = -1;
if (!ImGui.BeginChild(_listLabel, new Vector2(_size, ItemsAtOnce * _heightPerItem))) if (!ImGui.BeginChild(_listLabel, new Vector2(_size, ItemsAtOnce * _heightPerItem)))
return false; {
ImGui.EndChild();
return false;
}
var ret = false; var ret = false;
try try

View file

@ -1,7 +1,7 @@
using System; using System;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Logging; using Dalamud.Logging;
using Dalamud.Plugin; using Dalamud.Plugin.Ipc;
using Glamourer.Gui; using Glamourer.Gui;
using ImGuiNET; using ImGuiNET;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -12,10 +12,10 @@ namespace Glamourer
{ {
public const int RequiredPenumbraShareVersion = 3; public const int RequiredPenumbraShareVersion = 3;
private ICallGateSubscriber<object?, object>? TooltipSubscriber; private ICallGateSubscriber<ChangedItemType, uint, object>? _tooltipSubscriber;
private ICallGateSubscriber<int, object?, object>? ClickSubscriber; private ICallGateSubscriber<MouseButton, ChangedItemType, uint, object>? _clickSubscriber;
private ICallGateSubscriber<string, int, object>? RedrawSubscriberName; private ICallGateSubscriber<string, int, object>? _redrawSubscriberName;
private ICallGateSubscriber<GameObject, int, object>? RedrawSubscriberObject; private ICallGateSubscriber<GameObject, int, object>? _redrawSubscriberObject;
public PenumbraAttach(bool attach) public PenumbraAttach(bool attach)
=> Reattach(attach); => Reattach(attach);
@ -31,16 +31,17 @@ namespace Glamourer
if (version != RequiredPenumbraShareVersion) if (version != RequiredPenumbraShareVersion)
throw new Exception($"Invalid Version {version}, required Version {RequiredPenumbraShareVersion}."); throw new Exception($"Invalid Version {version}, required Version {RequiredPenumbraShareVersion}.");
RedrawSubscriberName = Dalamud.PluginInterface.GetIpcSubscriber<string, int, object>("Penumbra.RedrawObjectByName"); _redrawSubscriberName = Dalamud.PluginInterface.GetIpcSubscriber<string, int, object>("Penumbra.RedrawObjectByName");
RedrawSubscriberObject = Dalamud.PluginInterface.GetIpcSubscriber<GameObject, int, object>("Penumbra.RedrawObject"); _redrawSubscriberObject = Dalamud.PluginInterface.GetIpcSubscriber<GameObject, int, object>("Penumbra.RedrawObject");
if (!attach) if (!attach)
return; return;
TooltipSubscriber = Dalamud.PluginInterface.GetIpcSubscriber<object?, object>("Penumbra.ChangedItemTooltip"); _tooltipSubscriber = Dalamud.PluginInterface.GetIpcSubscriber<ChangedItemType, uint, object>("Penumbra.ChangedItemTooltip");
ClickSubscriber = Dalamud.PluginInterface.GetIpcSubscriber<int, object?, object>("Penumbra.ChangedItemClick"); _clickSubscriber =
TooltipSubscriber.Subscribe(PenumbraTooltip); Dalamud.PluginInterface.GetIpcSubscriber<MouseButton, ChangedItemType, uint, object>("Penumbra.ChangedItemClick");
ClickSubscriber.Subscribe(PenumbraRightClickWrapper); _tooltipSubscriber.Subscribe(PenumbraTooltip);
_clickSubscriber.Subscribe(PenumbraRightClick);
} }
catch (Exception e) catch (Exception e)
{ {
@ -50,30 +51,31 @@ namespace Glamourer
public void Unattach() public void Unattach()
{ {
TooltipSubscriber?.Unsubscribe(PenumbraTooltip); _tooltipSubscriber?.Unsubscribe(PenumbraTooltip);
ClickSubscriber?.Unsubscribe(PenumbraRightClickWrapper); _clickSubscriber?.Unsubscribe(PenumbraRightClick);
TooltipSubscriber = null; _tooltipSubscriber = null;
ClickSubscriber = null; _clickSubscriber = null;
RedrawSubscriberName = null; _redrawSubscriberName = null;
RedrawSubscriberObject = null; _redrawSubscriberObject = null;
} }
public void Dispose() public void Dispose()
=> Unattach(); => 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]"); 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; return;
var gPose = Dalamud.Objects[Interface.GPoseObjectId] as Character; var gPose = Dalamud.Objects[Interface.GPoseObjectId] as Character;
var player = Dalamud.Objects[0] 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); var writeItem = new Item(item, string.Empty);
if (gPose != null) 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) public void RedrawObject(GameObject actor, RedrawType settings, bool repeat)
{ {
if (RedrawSubscriberObject != null) if (_redrawSubscriberObject != null)
{ {
try try
{ {
RedrawSubscriberObject.InvokeFunc(actor, (int) settings); _redrawSubscriberObject.InvokeAction(actor, (int) settings);
} }
catch (Exception e) catch (Exception e)
{ {
@ -117,7 +116,9 @@ namespace Glamourer
RedrawObject(actor, settings, false); RedrawObject(actor, settings, false);
} }
else else
{
PluginLog.Debug("Trying to redraw object, but not attached to Penumbra."); PluginLog.Debug("Trying to redraw object, but not attached to Penumbra.");
}
} }
// Update objects without triggering PlayerWatcher Events, // Update objects without triggering PlayerWatcher Events,

View file

@ -13,7 +13,7 @@
"IsTestingExclusive": "false", "IsTestingExclusive": "false",
"DownloadCount": 1, "DownloadCount": 1,
"LastUpdate": 1618608322, "LastUpdate": 1618608322,
"DownloadLinkInstall": "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/main/Glamourer.zip", "DownloadLinkUpdate": "https://github.com/Ottermandias/Glamourer/raw/api4/Glamourer.zip",
} }
] ]