Cleanup
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using CustomizePlus.Configuration.Data.Version3;
|
using CustomizePlus.Configuration.Data.Version3;
|
||||||
using CustomizePlus.Core.Data;
|
using CustomizePlus.Core.Data;
|
||||||
|
using CustomizePlus.Game.Services;
|
||||||
using CustomizePlus.GameData.Extensions;
|
using CustomizePlus.GameData.Extensions;
|
||||||
using CustomizePlus.Profiles.Data;
|
using CustomizePlus.Profiles.Data;
|
||||||
using CustomizePlus.Templates.Data;
|
using CustomizePlus.Templates.Data;
|
||||||
@@ -17,14 +18,18 @@ namespace CustomizePlus.Api.Data;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class IPCCharacterProfile
|
public class IPCCharacterProfile
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Used only for display purposes
|
||||||
|
/// </summary>
|
||||||
public string CharacterName { get; set; } = "Invalid";
|
public string CharacterName { get; set; } = "Invalid";
|
||||||
|
|
||||||
public Dictionary<string, IPCBoneTransform> Bones { get; init; } = new();
|
public Dictionary<string, IPCBoneTransform> Bones { get; init; } = new();
|
||||||
|
|
||||||
public static IPCCharacterProfile FromFullProfile(Profile profile)
|
public static IPCCharacterProfile FromFullProfile(Profile profile)
|
||||||
{
|
{
|
||||||
var ipcProfile = new IPCCharacterProfile
|
var ipcProfile = new IPCCharacterProfile
|
||||||
{
|
{
|
||||||
CharacterName = profile.Character.ToNameWithoutOwnerName(), //todo: proper update to v5
|
CharacterName = profile.Character.ToNameWithoutOwnerName(),
|
||||||
Bones = new Dictionary<string, IPCBoneTransform>()
|
Bones = new Dictionary<string, IPCBoneTransform>()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,8 +53,8 @@ public class IPCCharacterProfile
|
|||||||
{
|
{
|
||||||
var fullProfile = new Profile
|
var fullProfile = new Profile
|
||||||
{
|
{
|
||||||
Name = $"{profile.CharacterName}'s IPC profile",
|
Name = $"IPC profile for {profile.CharacterName}",
|
||||||
// CharacterName = profile.CharacterName, //todo: proper update to v5
|
//Character should be set manually
|
||||||
CreationDate = DateTimeOffset.UtcNow,
|
CreationDate = DateTimeOffset.UtcNow,
|
||||||
ModifiedDate = DateTimeOffset.UtcNow,
|
ModifiedDate = DateTimeOffset.UtcNow,
|
||||||
Enabled = true,
|
Enabled = true,
|
||||||
|
|||||||
@@ -470,10 +470,27 @@ public unsafe sealed class ArmatureManager : IDisposable
|
|||||||
|
|
||||||
if (type == ProfileChanged.Type.TemporaryProfileAdded)
|
if (type == ProfileChanged.Type.TemporaryProfileAdded)
|
||||||
{
|
{
|
||||||
if (!profile.Character.IsValid || !Armatures.ContainsKey(profile.Character)) //todo: any world support
|
if (!profile.Character.IsValid || !Armatures.ContainsKey(profile.Character)) //temporary profiles are never using AnyWorld identifiers so we should be fine here
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//todo: remove this later
|
||||||
|
/*Armature? armature = null;
|
||||||
|
foreach(var kvPair in Armatures)
|
||||||
|
{
|
||||||
|
//todo: check mount/companion
|
||||||
|
if(kvPair.Key.CompareIgnoringOwnership(profile.Character) &&
|
||||||
|
(kvPair.Key.Type != IdentifierType.Owned || kvPair.Key.IsOwnedByLocalPlayer()))
|
||||||
|
{
|
||||||
|
armature = kvPair.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (armature == null)
|
||||||
|
return;*/
|
||||||
|
|
||||||
var armature = Armatures[profile.Character];
|
var armature = Armatures[profile.Character];
|
||||||
|
|
||||||
if (armature.Profile == profile)
|
if (armature.Profile == profile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -342,14 +342,14 @@ public partial class ProfileManager : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
//warn: temporary profile system does not support any world identifiers
|
//warn: temporary profile system does not support any world identifiers
|
||||||
public void AddTemporaryProfile(Profile profile, Actor actor/*, Template template*/)
|
public void AddTemporaryProfile(Profile profile, Actor actor)
|
||||||
{
|
{
|
||||||
if (!actor.Identifier(_actorManager, out var identifier))
|
if (!actor.Identifier(_actorManager, out var identifier))
|
||||||
throw new ActorNotFoundException();
|
throw new ActorNotFoundException();
|
||||||
|
|
||||||
profile.Enabled = true;
|
profile.Enabled = true;
|
||||||
profile.ProfileType = ProfileType.Temporary;
|
profile.ProfileType = ProfileType.Temporary;
|
||||||
profile.Character = identifier;
|
profile.Character = identifier; //warn: identifier must not be AnyWorld or stuff will break!
|
||||||
|
|
||||||
var existingProfile = Profiles.FirstOrDefault(x => x.Character.CompareIgnoringOwnership(profile.Character) && x.IsTemporary);
|
var existingProfile = Profiles.FirstOrDefault(x => x.Character.CompareIgnoringOwnership(profile.Character) && x.IsTemporary);
|
||||||
if (existingProfile != null)
|
if (existingProfile != null)
|
||||||
@@ -458,7 +458,7 @@ public partial class ProfileManager : IDisposable
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
var currentPlayer = _actorManager.GetCurrentPlayer();
|
var currentPlayer = _actorManager.GetCurrentPlayer();
|
||||||
return currentPlayer.IsValid && _actorManager.GetCurrentPlayer().CompareIgnoringOwnership(actorIdentifier);
|
return currentPlayer.IsValid && currentPlayer.CompareIgnoringOwnership(actorIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actorIdentifier.Type == IdentifierType.Owned && !actorIdentifier.IsOwnedByLocalPlayer())
|
if (actorIdentifier.Type == IdentifierType.Owned && !actorIdentifier.IsOwnedByLocalPlayer())
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using CustomizePlus.Core.Data;
|
using CustomizePlus.Core.Data;
|
||||||
using CustomizePlus.Game.Events;
|
using CustomizePlus.Game.Events;
|
||||||
using CustomizePlus.Game.Services;
|
using CustomizePlus.Game.Services;
|
||||||
|
using CustomizePlus.GameData.Extensions;
|
||||||
using CustomizePlus.Profiles;
|
using CustomizePlus.Profiles;
|
||||||
using CustomizePlus.Profiles.Data;
|
using CustomizePlus.Profiles.Data;
|
||||||
using CustomizePlus.Profiles.Enums;
|
using CustomizePlus.Profiles.Enums;
|
||||||
@@ -76,7 +77,7 @@ public class TemplateEditorManager : IDisposable
|
|||||||
//todo: check with mounts/companions
|
//todo: check with mounts/companions
|
||||||
var playerName = _gameObjectService.GetCurrentPlayerName();
|
var playerName = _gameObjectService.GetCurrentPlayerName();
|
||||||
return _gameObjectService.FindActorsByIdentifier(Character)
|
return _gameObjectService.FindActorsByIdentifier(Character)
|
||||||
.Where(x => x.Item1.Type != Penumbra.GameData.Enums.IdentifierType.Owned || x.Item1.PlayerName.ToString() == playerName)
|
.Where(x => x.Item1.Type != Penumbra.GameData.Enums.IdentifierType.Owned || x.Item1.IsOwnedByLocalPlayer())
|
||||||
.Any();
|
.Any();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user