IPC test for AddPlayerCharacter/RemovePlayerCharacter

This commit is contained in:
RisaDev
2025-04-18 22:14:40 +03:00
parent 31a192c6eb
commit 5ba38d9303
2 changed files with 35 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ using CustomizePlus.Configuration.Data;
using CustomizePlus.Api.Data; using CustomizePlus.Api.Data;
using CustomizePlus.GameData.Extensions; using CustomizePlus.GameData.Extensions;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
using Penumbra.GameData.Structs;
namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug; namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug;
@@ -65,6 +66,12 @@ public class IPCTestTab //: IDisposable
[EzIPC("Profile.DeleteTemporaryProfileByUniqueId")] [EzIPC("Profile.DeleteTemporaryProfileByUniqueId")]
private readonly Func<Guid, int> _deleteTemporaryProfileByUniqueIdIpcFunc; private readonly Func<Guid, int> _deleteTemporaryProfileByUniqueIdIpcFunc;
[EzIPC("Profile.AddPlayerCharacter")]
private readonly Func<Guid, string, ushort, int> _addPlayerCharacterIpcFunc;
[EzIPC("Profile.RemovePlayerCharacter")]
private readonly Func<Guid, string, ushort, int> _removePlayerCharacterIpcFunc;
[EzIPC("Profile.GetByUniqueId")] [EzIPC("Profile.GetByUniqueId")]
private readonly Func<Guid, (int, string?)> _getProfileByIdIpcFunc; private readonly Func<Guid, (int, string?)> _getProfileByIdIpcFunc;
@@ -337,6 +344,32 @@ public class IPCTestTab //: IDisposable
} }
} }
if (ImGui.Button("Add character to profile"))
{
int result = _addPlayerCharacterIpcFunc(Guid.Parse(_targetProfileId), _targetCharacterName, WorldId.AnyWorld.Id);
if (result == 0)
_popupSystem.ShowPopup(PopupSystem.Messages.ActionDone);
else
{
_logger.Error($"Error code {result} while calling AddPlayerCharacter");
_popupSystem.ShowPopup(PopupSystem.Messages.ActionError);
}
}
if (ImGui.Button("Remove character from profile"))
{
int result = _removePlayerCharacterIpcFunc(Guid.Parse(_targetProfileId), _targetCharacterName, WorldId.AnyWorld.Id);
if (result == 0)
_popupSystem.ShowPopup(PopupSystem.Messages.ActionDone);
else
{
_logger.Error($"Error code {result} while calling RemovePlayerCharacter");
_popupSystem.ShowPopup(PopupSystem.Messages.ActionError);
}
}
ImGui.Text("Cutscene actor index:"); ImGui.Text("Cutscene actor index:");
ImGui.SameLine(); ImGui.SameLine();
ImGui.InputInt("##cutsceneactoridx", ref _cutsceneActorIdx); ImGui.InputInt("##cutsceneactoridx", ref _cutsceneActorIdx);

View File

@@ -8,6 +8,7 @@ public partial class PopupSystem
public static class Messages public static class Messages
{ {
public const string ActionError = "action_error"; public const string ActionError = "action_error";
public const string ActionDone = "action_done";
public const string FantasiaPlusDetected = "fantasia_detected_warn"; public const string FantasiaPlusDetected = "fantasia_detected_warn";
@@ -31,6 +32,7 @@ public partial class PopupSystem
private void RegisterMessages() private void RegisterMessages()
{ {
RegisterPopup(Messages.ActionError, "Error while performing selected action.\nDetails have been printed to Dalamud log (/xllog in chat)."); RegisterPopup(Messages.ActionError, "Error while performing selected action.\nDetails have been printed to Dalamud log (/xllog in chat).");
RegisterPopup(Messages.ActionDone, "Action performed successfully.");
RegisterPopup(Messages.FantasiaPlusDetected, "Customize+ detected that you have Fantasia+ installed.\nPlease delete or turn it off and restart your game to use Customize+."); RegisterPopup(Messages.FantasiaPlusDetected, "Customize+ detected that you have Fantasia+ installed.\nPlease delete or turn it off and restart your game to use Customize+.");