Files
CustomizeTool/CustomizePlus/Configuration/Helpers/V3ProfileToV4Converter.cs
RisaDev 7a0ee53756 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)
2024-10-08 00:32:58 +03:00

43 lines
1.4 KiB
C#

using CustomizePlus.Configuration.Data.Version3;
using CustomizePlus.Core.Data;
using CustomizePlus.Profiles.Data;
using CustomizePlus.Templates.Data;
using System;
using System.Collections.Generic;
namespace CustomizePlus.Configuration.Helpers;
internal static class V3ProfileToV4Converter
{
public static (Profile, Template) Convert(Version3Profile v3Profile)
{
var profile = new Profile
{
Name = $"{v3Profile.ProfileName} - {v3Profile.CharacterName}",
CharacterName = v3Profile.CharacterName,
CreationDate = v3Profile.CreationDate,
ModifiedDate = DateTimeOffset.UtcNow,
Enabled = v3Profile.Enabled,
UniqueId = Guid.NewGuid(),
Templates = new List<Template>(1)
};
var template = new Template
{
Name = $"{profile.Name}'s template",
CreationDate = profile.CreationDate,
ModifiedDate = profile.ModifiedDate,
UniqueId = Guid.NewGuid(),
Bones = new Dictionary<string, BoneTransform>(v3Profile.Bones.Count)
};
foreach (var kvPair in v3Profile.Bones)
template.Bones.Add(kvPair.Key,
new BoneTransform { Translation = kvPair.Value.Translation, Rotation = kvPair.Value.Rotation, Scaling = kvPair.Value.Scaling });
profile.Templates.Add(template);
return (profile, template);
}
}