From 6a3d214e15830986eed8a0537de09ea414069aab Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Tue, 20 Dec 2022 21:09:36 +0100 Subject: [PATCH] Consider manipulations in changed items. --- Penumbra/Mods/Mod.ChangedItems.cs | 71 ++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/Penumbra/Mods/Mod.ChangedItems.cs b/Penumbra/Mods/Mod.ChangedItems.cs index 549422a1..7c066681 100644 --- a/Penumbra/Mods/Mod.ChangedItems.cs +++ b/Penumbra/Mods/Mod.ChangedItems.cs @@ -1,5 +1,9 @@ +using System; using System.Collections.Generic; using System.Linq; +using Penumbra.GameData.Data; +using Penumbra.GameData.Enums; +using Penumbra.Meta.Manipulations; namespace Penumbra.Mods; @@ -16,7 +20,72 @@ public sealed partial class Mod Penumbra.Identifier.Identify( ChangedItems, gamePath.ToString() ); } - // TODO: manipulations + foreach( var manip in AllManipulations ) + { + ComputeChangedItems( ChangedItems, manip ); + } + LowerChangedItemsString = string.Join( "\0", ChangedItems.Keys.Select( k => k.ToLowerInvariant() ) ); } + + public static void ComputeChangedItems( SortedList< string, object? > changedItems, MetaManipulation manip ) + { + switch( manip.ManipulationType ) + { + case MetaManipulation.Type.Imc: + switch( manip.Imc.ObjectType ) + { + case ObjectType.Equipment: + case ObjectType.Accessory: + Penumbra.Identifier.Identify( changedItems, + GamePaths.Equipment.Mtrl.Path( manip.Imc.PrimaryId, GenderRace.MidlanderMale, manip.Imc.EquipSlot, manip.Imc.Variant, "a" ) ); + break; + case ObjectType.Weapon: + Penumbra.Identifier.Identify( changedItems, GamePaths.Weapon.Mtrl.Path( manip.Imc.PrimaryId, manip.Imc.SecondaryId, manip.Imc.Variant, "a" ) ); + break; + case ObjectType.DemiHuman: + Penumbra.Identifier.Identify( changedItems, + GamePaths.DemiHuman.Mtrl.Path( manip.Imc.PrimaryId, manip.Imc.SecondaryId, manip.Imc.EquipSlot, manip.Imc.Variant, "a" ) ); + break; + case ObjectType.Monster: + Penumbra.Identifier.Identify( changedItems, GamePaths.Monster.Mtrl.Path( manip.Imc.PrimaryId, manip.Imc.SecondaryId, manip.Imc.Variant, "a" ) ); + break; + } + + break; + case MetaManipulation.Type.Eqdp: + Penumbra.Identifier.Identify( changedItems, + GamePaths.Equipment.Mdl.Path( manip.Eqdp.SetId, Names.CombinedRace( manip.Eqdp.Gender, manip.Eqdp.Race ), manip.Eqdp.Slot ) ); + break; + case MetaManipulation.Type.Eqp: + Penumbra.Identifier.Identify( changedItems, GamePaths.Equipment.Mdl.Path( manip.Eqp.SetId, GenderRace.MidlanderMale, manip.Eqp.Slot ) ); + break; + case MetaManipulation.Type.Est: + switch( manip.Est.Slot ) + { + case EstManipulation.EstType.Hair: + changedItems.TryAdd( $"Customization: {manip.Est.Race} {manip.Est.Gender} Hair (Hair) {manip.Est.SetId}", null ); + break; + case EstManipulation.EstType.Face: + changedItems.TryAdd( $"Customization: {manip.Est.Race} {manip.Est.Gender} Face (Face) {manip.Est.SetId}", null ); + break; + case EstManipulation.EstType.Body: + Penumbra.Identifier.Identify( changedItems, + GamePaths.Equipment.Mdl.Path( manip.Est.SetId, Names.CombinedRace( manip.Est.Gender, manip.Est.Race ), EquipSlot.Body ) ); + break; + case EstManipulation.EstType.Head: + Penumbra.Identifier.Identify( changedItems, + GamePaths.Equipment.Mdl.Path( manip.Est.SetId, Names.CombinedRace( manip.Est.Gender, manip.Est.Race ), EquipSlot.Head ) ); + break; + } + + break; + case MetaManipulation.Type.Gmp: + Penumbra.Identifier.Identify( changedItems, GamePaths.Equipment.Mdl.Path( manip.Gmp.SetId, GenderRace.MidlanderMale, EquipSlot.Head ) ); + break; + case MetaManipulation.Type.Rsp: + changedItems.TryAdd( $"{manip.Rsp.SubRace.ToName()} {manip.Rsp.Attribute.ToFullString()}", null ); + break; + } + } } \ No newline at end of file