Add owned temp profile test to ipc tests

This commit is contained in:
RisaDev
2024-10-24 02:24:33 +03:00
parent 466602c03a
commit fbe6ff18dc
2 changed files with 41 additions and 2 deletions

View File

@@ -49,7 +49,7 @@ public class CPlusChangeLog
.RegisterEntry("The way console commands work has not changed. This means that the commands will affect profiles the same way as before, even if profile affects multiple characters.", 3)
.RegisterEntry("\"Limit to my creatures\" option has been removed as it is now obsolete.", 2)
.RegisterEntry("It is now possible to choose profile which will be applied to any character you login with.", 2)
.RegisterEntry("Minions should now correctly synchronize via Mare Synchronos.", 1)
.RegisterEntry("Player-owned NPCs (minions, mounts) should now correctly synchronize via Mare Synchronos.", 1)
.RegisterHighlight("Added profile priority system.")
.RegisterEntry("When several active profiles affect the same character, profile priority will be used to determine which profile will be applied to said character.", 1)
@@ -64,7 +64,7 @@ public class CPlusChangeLog
.RegisterEntry("Profile.GetList has been updated to include profile priority as well as list of characters with their metadata. Please refer to Customize+ IPC source code files for additional information.", 1)
.RegisterEntry("Profile.OnUpdate event is now being triggered for profiles with \"Apply to all players and retainers\" and \"Apply to any character you are logged in with\" options enabled.", 1)
.RegisterEntry("Format of the profile json expected by Profile.SetTemporaryProfileOnCharacter has been updated: CharacterName field removed.", 1)
.RegisterEntry("Temporary profiles should now apply correctly to non-player characters like minions.", 1)
.RegisterEntry("Temporary profiles should now apply correctly to owned characters like minions.", 1)
.RegisterHighlight("Fixed issue when Customize+ did not detect changes in character skeleton. This mostly happened when altering character appearance via Glamourer and other plugins/tools.")

View File

@@ -19,11 +19,14 @@ using OtterGui.Log;
using CustomizePlus.Core.Extensions;
using CustomizePlus.Configuration.Data;
using CustomizePlus.Api.Data;
using CustomizePlus.GameData.Extensions;
namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug;
public class IPCTestTab //: IDisposable
{
private const string _ownedTesProfile = "{\"Bones\":{\"n_root\":{\"Translation\":{\"X\":0.0,\"Y\":0.0,\"Z\":0.0},\"Rotation\":{\"X\":0.0,\"Y\":0.0,\"Z\":0.0},\"Scaling\":{\"X\":2.0,\"Y\":2.0,\"Z\":2.0}}}}";
private readonly IObjectTable _objectTable;
private readonly ProfileManager _profileManager;
private readonly PopupSystem _popupSystem;
@@ -128,6 +131,42 @@ public class IPCTestTab //: IDisposable
ImGui.Separator();
if (ImGui.Button("Owned Actors Temporary Profile Test"))
{
bool found = false;
foreach(var obj in _objectManager)
{
if (!obj.Identifier(_actorManager, out var ownedIdent) ||
ownedIdent.Type != Penumbra.GameData.Enums.IdentifierType.Owned ||
ownedIdent.IsOwnedByLocalPlayer())
continue;
found = true;
(int result, Guid? profileGuid) = _setTemporaryProfileOnCharacterIpcFunc(obj.Index.Index, _ownedTesProfile);
if (result == 0)
{
_popupSystem.ShowPopup(PopupSystem.Messages.IPCSetProfileToChrDone);
_logger.Information($"Temporary profile id: {profileGuid} on {ownedIdent}");
}
else
{
_logger.Error($"Error code {result} while calling SetTemporaryProfileOnCharacter");
_popupSystem.ShowPopup(PopupSystem.Messages.ActionError);
}
break;
}
if(!found)
{
_logger.Error($"No characters found for Owned Test");
_popupSystem.ShowPopup(PopupSystem.Messages.ActionError);
}
}
ImGui.Separator();
ImGui.Text($"Memory: {(string.IsNullOrWhiteSpace(_rememberedProfileJson) ? "empty" : "has data")}");
ImGui.Text("Character to operate on:");