From 7a0ee537565a32ac331ddadd02acc9a83a145491 Mon Sep 17 00:00:00 2001 From: RisaDev <151885272+RisaDev@users.noreply.github.com> Date: Tue, 8 Oct 2024 00:32:58 +0300 Subject: [PATCH] Hopefully this doesn't break anything, I can't test this properly on my free trial account Removed "Limit to my creatures", the code now automatically detects this for all owned actors. If you liked to apply edits to minions and stuff of other players... too bad. Implemented UI for setting profiles to NPC, minions and mounts (still WIP, will probably have to implement multiple characters per profile) --- .../Extensions/ActorIdentifierExtensions.cs | 29 ++++++ CustomizePlus/Api/Data/IPCCharacterProfile.cs | 1 - .../Armatures/Services/ArmatureManager.cs | 23 +---- .../Helpers/V3ProfileToV4Converter.cs | 1 - CustomizePlus/Core/ServiceManagerBuilder.cs | 3 +- .../Core/Services/SupportLogBuilderService.cs | 1 - CustomizePlus/Profiles/Data/Profile.cs | 4 +- .../Profiles/Events/ProfileChanged.cs | 1 - .../Profiles/ProfileManager.ProfileLoading.cs | 1 - CustomizePlus/Profiles/ProfileManager.cs | 41 ++++----- .../Templates/Events/TemplateChanged.cs | 1 - .../Templates/TemplateEditorManager.cs | 12 --- .../UI/Windows/Controls/ActorAssignmentUi.cs | 88 ++++++------------- .../Tabs/Debug/StateMonitoringTab.cs | 1 - .../Profiles/ProfileFileSystemSelector.cs | 5 +- .../MainWindow/Tabs/Profiles/ProfilePanel.cs | 80 ++++++----------- .../Tabs/Templates/BoneEditorPanel.cs | 65 +++++++------- 17 files changed, 141 insertions(+), 216 deletions(-) diff --git a/CustomizePlus.GameData/Extensions/ActorIdentifierExtensions.cs b/CustomizePlus.GameData/Extensions/ActorIdentifierExtensions.cs index 122d125..8e3d834 100644 --- a/CustomizePlus.GameData/Extensions/ActorIdentifierExtensions.cs +++ b/CustomizePlus.GameData/Extensions/ActorIdentifierExtensions.cs @@ -28,6 +28,35 @@ public static class ActorIdentifierExtensions return PenumbraExtensions.Manager.Data.ToName(identifier.Kind, identifier.DataId); } + /// + /// Compares two actor identifiers while ignoring ownership for owned objects. For all other identifier types will use Matches() method. + /// + public static bool CompareIgnoringOwnership(this ActorIdentifier identifier, ActorIdentifier other) + { + if (identifier.Type != other.Type) + return false; + + return identifier.Type switch + { + IdentifierType.Owned => PenumbraExtensions.Manager.DataIdEquals(identifier, other), + _ => identifier.Matches(other) + }; + } + + /// + /// Check if owned actor is owned by local player. Will return false if Type is not Owned. + /// + public static bool IsOwnedByLocalPlayer(this ActorIdentifier identifier) + { + if (identifier.Type != IdentifierType.Owned) + return false; + + if (PenumbraExtensions.Manager == null) + return false; + + return identifier.PlayerName == PenumbraExtensions.Manager.GetCurrentPlayer().PlayerName; + } + /// /// Wrapper around Incognito which returns non-incognito name in debug builds /// diff --git a/CustomizePlus/Api/Data/IPCCharacterProfile.cs b/CustomizePlus/Api/Data/IPCCharacterProfile.cs index c0f75c2..262e8cc 100644 --- a/CustomizePlus/Api/Data/IPCCharacterProfile.cs +++ b/CustomizePlus/Api/Data/IPCCharacterProfile.cs @@ -53,7 +53,6 @@ public class IPCCharacterProfile CreationDate = DateTimeOffset.UtcNow, ModifiedDate = DateTimeOffset.UtcNow, Enabled = true, - LimitLookupToOwnedObjects = false, UniqueId = Guid.NewGuid(), Templates = new List