Updated ECommons, Profile.GetProfileByUniqueId -> Profile.GetByUniqueId, OnProfileUpdate now returns Guid.Empty if no profile is set
This commit is contained in:
@@ -18,6 +18,7 @@ using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Penumbra.GameData.Actors;
|
||||
|
||||
using IPCProfileDataTuple = (System.Guid UniqueId, string Name, string CharacterName, bool IsEnabled);
|
||||
using Penumbra.GameData.Interop;
|
||||
//using OnUpdateTuple = (Dalamud.Game.ClientState.Objects.Types.Character Character, System.Guid? ProfileUniqueId, string? ProfileJson);
|
||||
|
||||
namespace CustomizePlus.Api;
|
||||
@@ -29,9 +30,10 @@ public partial class CustomizePlusIpc
|
||||
/// Not triggered if any changes happen due to character no longer existing.
|
||||
/// Right now ignores every character but local player. It is not recommended to assume that this will always be the case and not perform any checks on your side.
|
||||
/// Ignores temporary profiles.
|
||||
/// /!\ If no profile is set on specified character profile id will be equal to Guid.Empty
|
||||
/// </summary>
|
||||
[EzIPCEvent("Profile.OnUpdate")]
|
||||
private Action<Character, Guid?> OnProfileUpdate;
|
||||
private Action<Character, Guid> OnProfileUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve list of all user profiles
|
||||
@@ -49,7 +51,7 @@ public partial class CustomizePlusIpc
|
||||
/// <summary>
|
||||
/// Get JSON copy of profile with specified unique id
|
||||
/// </summary>
|
||||
[EzIPC("Profile.GetProfileByUniqueId")]
|
||||
[EzIPC("Profile.GetByUniqueId")]
|
||||
private (int, string?) GetProfileByUniqueId(Guid uniqueId)
|
||||
{
|
||||
if (uniqueId == Guid.Empty)
|
||||
@@ -327,6 +329,6 @@ public partial class CustomizePlusIpc
|
||||
|
||||
_logger.Debug($"Sending player update message: Character: {character.Name.ToString().Incognify()}, Profile: {(profile != null ? profile.ToString() : "no profile")}");
|
||||
|
||||
OnProfileUpdate(character, profile != null ? profile.UniqueId : null);
|
||||
OnProfileUpdate(character, profile != null ? profile.UniqueId : Guid.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ public class IPCTestTab //: IDisposable
|
||||
private readonly Func<IList<IPCProfileDataTuple>> _getProfileListIpcFunc;
|
||||
|
||||
[EzIPC("Profile.EnableByUniqueId")]
|
||||
private readonly Action<Guid> _enableProfileByUniqueIdIpcFunc;
|
||||
private readonly Func<Guid, int> _enableProfileByUniqueIdIpcFunc;
|
||||
|
||||
[EzIPC("Profile.DisableByUniqueId")]
|
||||
private readonly Action<Guid> _disableProfileByUniqueIdIpcFunc;
|
||||
private readonly Func<Guid, int> _disableProfileByUniqueIdIpcFunc;
|
||||
|
||||
[EzIPC("Profile.GetActiveProfileIdOnCharacter")]
|
||||
private readonly Func<Character, (int, Guid?)> _getActiveProfileIdOnCharacterIpcFunc;
|
||||
@@ -59,7 +59,7 @@ public class IPCTestTab //: IDisposable
|
||||
[EzIPC("Profile.DeleteTemporaryProfileByUniqueId")]
|
||||
private readonly Func<Guid, int> _deleteTemporaryProfileByUniqueIdIpcFunc;
|
||||
|
||||
[EzIPC("Profile.GetProfileByUniqueId")]
|
||||
[EzIPC("Profile.GetByUniqueId")]
|
||||
private readonly Func<Guid, (int, string?)> _getProfileByIdIpcFunc;
|
||||
|
||||
//private readonly ICallGateSubscriber<string, Character?, object>? _setCharacterProfile;
|
||||
@@ -263,14 +263,30 @@ public class IPCTestTab //: IDisposable
|
||||
|
||||
if (ImGui.Button("Enable profile by Unique ID"))
|
||||
{
|
||||
_enableProfileByUniqueIdIpcFunc(Guid.Parse(_targetProfileId));
|
||||
_popupSystem.ShowPopup(PopupSystem.Messages.IPCEnableProfileByIdDone);
|
||||
int result = _enableProfileByUniqueIdIpcFunc(Guid.Parse(_targetProfileId));
|
||||
if (result == 0)
|
||||
{
|
||||
_popupSystem.ShowPopup(PopupSystem.Messages.IPCEnableProfileByIdDone);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error($"Error code {result} while calling EnableByUniqueId");
|
||||
_popupSystem.ShowPopup(PopupSystem.Messages.ActionError);
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.Button("Disable profile by Unique ID"))
|
||||
{
|
||||
_disableProfileByUniqueIdIpcFunc(Guid.Parse(_targetProfileId));
|
||||
_popupSystem.ShowPopup(PopupSystem.Messages.IPCDisableProfileByIdDone);
|
||||
int result = _disableProfileByUniqueIdIpcFunc(Guid.Parse(_targetProfileId));
|
||||
if (result == 0)
|
||||
{
|
||||
_popupSystem.ShowPopup(PopupSystem.Messages.IPCDisableProfileByIdDone);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error($"Error code {result} while calling DisableByUniqueId");
|
||||
_popupSystem.ShowPopup(PopupSystem.Messages.ActionError);
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.Button("DeleteTemporaryProfileByUniqueId"))
|
||||
@@ -293,7 +309,7 @@ public class IPCTestTab //: IDisposable
|
||||
[EzIPCEvent("Profile.OnUpdate")]
|
||||
private void OnProfileUpdate(Character Character, Guid? ProfileUniqueId)
|
||||
{
|
||||
_logger.Debug($"IPC Test Tab - OnProfileUpdate: Character: {Character.Name.ToString().Incognify()}, Profile ID: {(ProfileUniqueId != null ? ProfileUniqueId.ToString() : "no id")}");
|
||||
_logger.Debug($"IPC Test Tab - OnProfileUpdate: Character: {Character.Name.ToString().Incognify()}, Profile ID: {(ProfileUniqueId != Guid.Empty ? ProfileUniqueId.ToString() : "no id")}");
|
||||
}
|
||||
|
||||
private Character? FindCharacterByAddress(nint address)
|
||||
|
||||
Submodule submodules/ECommons updated: a3521ec618...d238d4188e
Reference in New Issue
Block a user