using CustomizePlus.Configuration.Data.Version3; using CustomizePlus.Core.Data; using CustomizePlus.Game.Services; using CustomizePlus.GameData.Extensions; using CustomizePlus.Profiles.Data; using CustomizePlus.Templates.Data; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Text; using System.Threading.Tasks; namespace CustomizePlus.Api.Data; /// /// Bare essentials version of character profile /// public class IPCCharacterProfile { // public List Characters { get; set; } = new(); public Dictionary Bones { get; init; } = new(); public static IPCCharacterProfile FromFullProfile(Profile profile) { var ipcProfile = new IPCCharacterProfile(); /* foreach (var character in profile.Characters) { //todo: unify with tuple? var ipcCharacter = new IPCCharacter(); ipcCharacter.Name = character.ToNameWithoutOwnerName(); ipcCharacter.CharacterType = (byte)character.Type; ipcCharacter.WorldId = character.Type == IdentifierType.Player || character.Type == IdentifierType.Owned ? character.HomeWorld.Id : WorldId.AnyWorld.Id; ipcCharacter.CharacterSubType = character.Type == IdentifierType.Retainer ? (ushort)character.Retainer : (ushort)0; ipcProfile.Characters.Add(ipcCharacter); }*/ foreach (var template in profile.Templates) { foreach (var kvPair in template.Bones) //not super optimal but whatever { ipcProfile.Bones[kvPair.Key] = new IPCBoneTransform { Translation = kvPair.Value.Translation, Rotation = kvPair.Value.Rotation, Scaling = kvPair.Value.Scaling }; } } return ipcProfile; } public static (Profile, Template) ToFullProfile(IPCCharacterProfile profile, bool isTemporary = true) { var fullProfile = new Profile { //Character should be set manually CreationDate = DateTimeOffset.UtcNow, ModifiedDate = DateTimeOffset.UtcNow, Enabled = true, UniqueId = Guid.NewGuid(), Templates = new List