diff --git a/CustomizePlus/UI/Windows/MainWindow/Tabs/Debug/IPCTestTab.cs b/CustomizePlus/UI/Windows/MainWindow/Tabs/Debug/IPCTestTab.cs index 55251c5..33e14e0 100644 --- a/CustomizePlus/UI/Windows/MainWindow/Tabs/Debug/IPCTestTab.cs +++ b/CustomizePlus/UI/Windows/MainWindow/Tabs/Debug/IPCTestTab.cs @@ -21,6 +21,7 @@ using CustomizePlus.Configuration.Data; using CustomizePlus.Api.Data; using CustomizePlus.GameData.Extensions; using Penumbra.GameData.Interop; +using Penumbra.GameData.Structs; namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug; @@ -65,6 +66,12 @@ public class IPCTestTab //: IDisposable [EzIPC("Profile.DeleteTemporaryProfileByUniqueId")] private readonly Func _deleteTemporaryProfileByUniqueIdIpcFunc; + [EzIPC("Profile.AddPlayerCharacter")] + private readonly Func _addPlayerCharacterIpcFunc; + + [EzIPC("Profile.RemovePlayerCharacter")] + private readonly Func _removePlayerCharacterIpcFunc; + [EzIPC("Profile.GetByUniqueId")] private readonly Func _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.SameLine(); ImGui.InputInt("##cutsceneactoridx", ref _cutsceneActorIdx); diff --git a/CustomizePlus/UI/Windows/PopupSystem.Messages.cs b/CustomizePlus/UI/Windows/PopupSystem.Messages.cs index 33b0ea1..a19c67c 100644 --- a/CustomizePlus/UI/Windows/PopupSystem.Messages.cs +++ b/CustomizePlus/UI/Windows/PopupSystem.Messages.cs @@ -8,6 +8,7 @@ public partial class PopupSystem public static class Messages { public const string ActionError = "action_error"; + public const string ActionDone = "action_done"; public const string FantasiaPlusDetected = "fantasia_detected_warn"; @@ -31,6 +32,7 @@ public partial class PopupSystem private void RegisterMessages() { 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+.");