Accept higher penumbra API versions.

This commit is contained in:
Ottermandias 2022-06-23 16:36:12 +02:00
parent 0ff5eade69
commit e1cf3db0ab
5 changed files with 19 additions and 19 deletions

Binary file not shown.

View file

@ -6,16 +6,16 @@ using Glamourer.Gui;
using ImGuiNET; using ImGuiNET;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
namespace Glamourer; namespace Glamourer.Api;
public class PenumbraAttach : IDisposable public class PenumbraAttach : IDisposable
{ {
public const int RequiredPenumbraShareVersion = 4; public const int RequiredPenumbraShareVersion = 4;
private ICallGateSubscriber<ChangedItemType, uint, object>? _tooltipSubscriber; private ICallGateSubscriber<ChangedItemType, uint, object>? _tooltipSubscriber;
private ICallGateSubscriber<MouseButton, ChangedItemType, uint, 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;
private readonly ICallGateSubscriber<object?> _initializedEvent; private readonly ICallGateSubscriber<object?> _initializedEvent;
private readonly ICallGateSubscriber<object?> _disposedEvent; private readonly ICallGateSubscriber<object?> _disposedEvent;
@ -23,7 +23,7 @@ public class PenumbraAttach : IDisposable
public PenumbraAttach(bool attach) public PenumbraAttach(bool attach)
{ {
_initializedEvent = Dalamud.PluginInterface.GetIpcSubscriber<object?>("Penumbra.Initialized"); _initializedEvent = Dalamud.PluginInterface.GetIpcSubscriber<object?>("Penumbra.Initialized");
_disposedEvent = Dalamud.PluginInterface.GetIpcSubscriber<object?>("Penumbra.Disposed"); _disposedEvent = Dalamud.PluginInterface.GetIpcSubscriber<object?>("Penumbra.Disposed");
_initializedEvent.Subscribe(Reattach); _initializedEvent.Subscribe(Reattach);
_disposedEvent.Subscribe(Unattach); _disposedEvent.Subscribe(Unattach);
Reattach(attach); Reattach(attach);
@ -39,11 +39,11 @@ public class PenumbraAttach : IDisposable
Unattach(); Unattach();
var versionSubscriber = Dalamud.PluginInterface.GetIpcSubscriber<int>("Penumbra.ApiVersion"); var versionSubscriber = Dalamud.PluginInterface.GetIpcSubscriber<int>("Penumbra.ApiVersion");
var version = versionSubscriber.InvokeFunc(); var version = versionSubscriber.InvokeFunc();
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)
@ -66,9 +66,9 @@ public class PenumbraAttach : IDisposable
{ {
_tooltipSubscriber?.Unsubscribe(PenumbraTooltip); _tooltipSubscriber?.Unsubscribe(PenumbraTooltip);
_clickSubscriber?.Unsubscribe(PenumbraRightClick); _clickSubscriber?.Unsubscribe(PenumbraRightClick);
_tooltipSubscriber = null; _tooltipSubscriber = null;
_clickSubscriber = null; _clickSubscriber = null;
_redrawSubscriberName = null; _redrawSubscriberName = null;
if (_redrawSubscriberObject != null) if (_redrawSubscriberObject != null)
{ {
PluginLog.Debug("Glamourer detached from Penumbra."); PluginLog.Debug("Glamourer detached from Penumbra.");
@ -94,9 +94,9 @@ public class PenumbraAttach : IDisposable
if (button != MouseButton.Right || type != ChangedItemType.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 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)
{ {

View file

@ -5,8 +5,8 @@
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<RootNamespace>Glamourer</RootNamespace> <RootNamespace>Glamourer</RootNamespace>
<AssemblyName>Glamourer</AssemblyName> <AssemblyName>Glamourer</AssemblyName>
<FileVersion>0.1.0.0</FileVersion> <FileVersion>0.1.0.1</FileVersion>
<AssemblyVersion>0.1.0.0</AssemblyVersion> <AssemblyVersion>0.1.0.1</AssemblyVersion>
<Company>SoftOtter</Company> <Company>SoftOtter</Company>
<Product>Glamourer</Product> <Product>Glamourer</Product>
<Copyright>Copyright © 2020</Copyright> <Copyright>Copyright © 2020</Copyright>

View file

@ -5,7 +5,7 @@
"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": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ], "Tags": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ],
"InternalName": "Glamourer", "InternalName": "Glamourer",
"AssemblyVersion": "0.1.0.0", "AssemblyVersion": "0.1.0.1",
"RepoUrl": "https://github.com/Ottermandias/Glamourer", "RepoUrl": "https://github.com/Ottermandias/Glamourer",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"DalamudApiLevel": 6, "DalamudApiLevel": 6,

View file

@ -6,8 +6,8 @@
"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": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ], "Tags": [ "Appearance", "Glamour", "Race", "Outfit", "Armor", "Clothes", "Skins", "Customization", "Design", "Character" ],
"InternalName": "Glamourer", "InternalName": "Glamourer",
"AssemblyVersion": "0.1.0.0", "AssemblyVersion": "0.1.0.1",
"TestingAssemblyVersion": "0.1.0.0", "TestingAssemblyVersion": "0.1.0.1",
"RepoUrl": "https://github.com/Ottermandias/Glamourer", "RepoUrl": "https://github.com/Ottermandias/Glamourer",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"DalamudApiLevel": 6, "DalamudApiLevel": 6,