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 Penumbra.GameData.Actors;
|
||||||
|
|
||||||
using IPCProfileDataTuple = (System.Guid UniqueId, string Name, string CharacterName, bool IsEnabled);
|
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);
|
//using OnUpdateTuple = (Dalamud.Game.ClientState.Objects.Types.Character Character, System.Guid? ProfileUniqueId, string? ProfileJson);
|
||||||
|
|
||||||
namespace CustomizePlus.Api;
|
namespace CustomizePlus.Api;
|
||||||
@@ -29,9 +30,10 @@ public partial class CustomizePlusIpc
|
|||||||
/// Not triggered if any changes happen due to character no longer existing.
|
/// 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.
|
/// 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.
|
/// Ignores temporary profiles.
|
||||||
|
/// /!\ If no profile is set on specified character profile id will be equal to Guid.Empty
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[EzIPCEvent("Profile.OnUpdate")]
|
[EzIPCEvent("Profile.OnUpdate")]
|
||||||
private Action<Character, Guid?> OnProfileUpdate;
|
private Action<Character, Guid> OnProfileUpdate;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve list of all user profiles
|
/// Retrieve list of all user profiles
|
||||||
@@ -49,7 +51,7 @@ public partial class CustomizePlusIpc
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get JSON copy of profile with specified unique id
|
/// Get JSON copy of profile with specified unique id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[EzIPC("Profile.GetProfileByUniqueId")]
|
[EzIPC("Profile.GetByUniqueId")]
|
||||||
private (int, string?) GetProfileByUniqueId(Guid uniqueId)
|
private (int, string?) GetProfileByUniqueId(Guid uniqueId)
|
||||||
{
|
{
|
||||||
if (uniqueId == Guid.Empty)
|
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")}");
|
_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;
|
private readonly Func<IList<IPCProfileDataTuple>> _getProfileListIpcFunc;
|
||||||
|
|
||||||
[EzIPC("Profile.EnableByUniqueId")]
|
[EzIPC("Profile.EnableByUniqueId")]
|
||||||
private readonly Action<Guid> _enableProfileByUniqueIdIpcFunc;
|
private readonly Func<Guid, int> _enableProfileByUniqueIdIpcFunc;
|
||||||
|
|
||||||
[EzIPC("Profile.DisableByUniqueId")]
|
[EzIPC("Profile.DisableByUniqueId")]
|
||||||
private readonly Action<Guid> _disableProfileByUniqueIdIpcFunc;
|
private readonly Func<Guid, int> _disableProfileByUniqueIdIpcFunc;
|
||||||
|
|
||||||
[EzIPC("Profile.GetActiveProfileIdOnCharacter")]
|
[EzIPC("Profile.GetActiveProfileIdOnCharacter")]
|
||||||
private readonly Func<Character, (int, Guid?)> _getActiveProfileIdOnCharacterIpcFunc;
|
private readonly Func<Character, (int, Guid?)> _getActiveProfileIdOnCharacterIpcFunc;
|
||||||
@@ -59,7 +59,7 @@ public class IPCTestTab //: IDisposable
|
|||||||
[EzIPC("Profile.DeleteTemporaryProfileByUniqueId")]
|
[EzIPC("Profile.DeleteTemporaryProfileByUniqueId")]
|
||||||
private readonly Func<Guid, int> _deleteTemporaryProfileByUniqueIdIpcFunc;
|
private readonly Func<Guid, int> _deleteTemporaryProfileByUniqueIdIpcFunc;
|
||||||
|
|
||||||
[EzIPC("Profile.GetProfileByUniqueId")]
|
[EzIPC("Profile.GetByUniqueId")]
|
||||||
private readonly Func<Guid, (int, string?)> _getProfileByIdIpcFunc;
|
private readonly Func<Guid, (int, string?)> _getProfileByIdIpcFunc;
|
||||||
|
|
||||||
//private readonly ICallGateSubscriber<string, Character?, object>? _setCharacterProfile;
|
//private readonly ICallGateSubscriber<string, Character?, object>? _setCharacterProfile;
|
||||||
@@ -263,15 +263,31 @@ public class IPCTestTab //: IDisposable
|
|||||||
|
|
||||||
if (ImGui.Button("Enable profile by Unique ID"))
|
if (ImGui.Button("Enable profile by Unique ID"))
|
||||||
{
|
{
|
||||||
_enableProfileByUniqueIdIpcFunc(Guid.Parse(_targetProfileId));
|
int result = _enableProfileByUniqueIdIpcFunc(Guid.Parse(_targetProfileId));
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
_popupSystem.ShowPopup(PopupSystem.Messages.IPCEnableProfileByIdDone);
|
_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"))
|
if (ImGui.Button("Disable profile by Unique ID"))
|
||||||
{
|
{
|
||||||
_disableProfileByUniqueIdIpcFunc(Guid.Parse(_targetProfileId));
|
int result = _disableProfileByUniqueIdIpcFunc(Guid.Parse(_targetProfileId));
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
_popupSystem.ShowPopup(PopupSystem.Messages.IPCDisableProfileByIdDone);
|
_popupSystem.ShowPopup(PopupSystem.Messages.IPCDisableProfileByIdDone);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Error($"Error code {result} while calling DisableByUniqueId");
|
||||||
|
_popupSystem.ShowPopup(PopupSystem.Messages.ActionError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui.Button("DeleteTemporaryProfileByUniqueId"))
|
if (ImGui.Button("DeleteTemporaryProfileByUniqueId"))
|
||||||
{
|
{
|
||||||
@@ -293,7 +309,7 @@ public class IPCTestTab //: IDisposable
|
|||||||
[EzIPCEvent("Profile.OnUpdate")]
|
[EzIPCEvent("Profile.OnUpdate")]
|
||||||
private void OnProfileUpdate(Character Character, Guid? ProfileUniqueId)
|
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)
|
private Character? FindCharacterByAddress(nint address)
|
||||||
|
|||||||
Submodule submodules/ECommons updated: a3521ec618...d238d4188e
Reference in New Issue
Block a user