Fix weapon meta changes.

This commit is contained in:
Ottermandias 2021-06-04 13:05:46 +02:00
parent 6a1ae4f317
commit db4942224e
4 changed files with 38 additions and 28 deletions

View file

@ -46,6 +46,7 @@ namespace Penumbra.Importer
ObjectType.DemiHuman => true, ObjectType.DemiHuman => true,
ObjectType.Housing => true, ObjectType.Housing => true,
ObjectType.Monster => true, ObjectType.Monster => true,
ObjectType.Weapon => true,
ObjectType.Icon => false, ObjectType.Icon => false,
ObjectType.Font => false, ObjectType.Font => false,
ObjectType.Interface => false, ObjectType.Interface => false,
@ -53,7 +54,6 @@ namespace Penumbra.Importer
ObjectType.Map => false, ObjectType.Map => false,
ObjectType.Vfx => false, ObjectType.Vfx => false,
ObjectType.Unknown => false, ObjectType.Unknown => false,
ObjectType.Weapon => false,
ObjectType.World => false, ObjectType.World => false,
_ => false, _ => false,
}; };
@ -149,7 +149,7 @@ namespace Penumbra.Importer
} }
catch( Exception e ) catch( Exception e )
{ {
PluginLog.Debug("Skipped {Type}-manipulation:\n{e:l}", manipulation.Type, e ); PluginLog.Debug( "Skipped {Type}-manipulation:\n{e:l}", manipulation.Type, e );
} }
} }

View file

@ -98,7 +98,6 @@ namespace Penumbra.MetaData
public ImcFile? GetNewImcFile( ObjectType type, ushort primarySetId, ushort secondarySetId = 0 ) public ImcFile? GetNewImcFile( ObjectType type, ushort primarySetId, ushort secondarySetId = 0 )
=> GetDefaultImcFile( type, primarySetId, secondarySetId )?.Clone(); => GetDefaultImcFile( type, primarySetId, secondarySetId )?.Clone();
public MetaDefaults( DalamudPluginInterface pi ) public MetaDefaults( DalamudPluginInterface pi )
=> _pi = pi; => _pi = pi;

View file

@ -1,13 +1,17 @@
using System; using System;
using Penumbra.Game; using Penumbra.Game;
using Penumbra.Mods;
using Penumbra.Util; using Penumbra.Util;
namespace Penumbra.MetaData namespace Penumbra.MetaData
{ {
public static class MetaFileNames public static class MetaFileNames
{ {
public static GamePath Eqp() => GamePath.GenerateUnchecked( "chara/xls/equipmentparameter/equipmentparameter.eqp" ); public static GamePath Eqp()
public static GamePath Gmp() => GamePath.GenerateUnchecked( "chara/xls/equipmentparameter/gimmickparameter.gmp" ); => GamePath.GenerateUnchecked( "chara/xls/equipmentparameter/equipmentparameter.eqp" );
public static GamePath Gmp()
=> GamePath.GenerateUnchecked( "chara/xls/equipmentparameter/gimmickparameter.gmp" );
public static GamePath Est( ObjectType type, EquipSlot equip, BodySlot slot ) public static GamePath Est( ObjectType type, EquipSlot equip, BodySlot slot )
{ {
@ -17,15 +21,15 @@ namespace Penumbra.MetaData
{ {
EquipSlot.Body => GamePath.GenerateUnchecked( "chara/xls/charadb/extra_top.est" ), EquipSlot.Body => GamePath.GenerateUnchecked( "chara/xls/charadb/extra_top.est" ),
EquipSlot.Head => GamePath.GenerateUnchecked( "chara/xls/charadb/extra_met.est" ), EquipSlot.Head => GamePath.GenerateUnchecked( "chara/xls/charadb/extra_met.est" ),
_ => throw new NotImplementedException() _ => throw new NotImplementedException(),
}, },
ObjectType.Character => slot switch ObjectType.Character => slot switch
{ {
BodySlot.Hair => GamePath.GenerateUnchecked( "chara/xls/charadb/hairskeletontemplate.est" ), BodySlot.Hair => GamePath.GenerateUnchecked( "chara/xls/charadb/hairskeletontemplate.est" ),
BodySlot.Face => GamePath.GenerateUnchecked( "chara/xls/charadb/faceskeletontemplate.est" ), BodySlot.Face => GamePath.GenerateUnchecked( "chara/xls/charadb/faceskeletontemplate.est" ),
_ => throw new NotImplementedException() _ => throw new NotImplementedException(),
}, },
_ => throw new NotImplementedException() _ => throw new NotImplementedException(),
}; };
} }
@ -41,7 +45,7 @@ namespace Penumbra.MetaData
$"chara/monster/m{primaryId:D4}/obj/body/b{secondaryId:D4}/b{secondaryId:D4}.imc" ), $"chara/monster/m{primaryId:D4}/obj/body/b{secondaryId:D4}/b{secondaryId:D4}.imc" ),
ObjectType.Weapon => GamePath.GenerateUnchecked( ObjectType.Weapon => GamePath.GenerateUnchecked(
$"chara/weapon/w{primaryId:D4}/obj/body/b{secondaryId:D4}/b{secondaryId:D4}.imc" ), $"chara/weapon/w{primaryId:D4}/obj/body/b{secondaryId:D4}/b{secondaryId:D4}.imc" ),
_ => throw new NotImplementedException() _ => throw new NotImplementedException(),
}; };
} }
@ -51,7 +55,7 @@ namespace Penumbra.MetaData
{ {
ObjectType.Accessory => GamePath.GenerateUnchecked( $"chara/xls/charadb/accessorydeformerparameter/c{gr.ToRaceCode()}.eqdp" ), ObjectType.Accessory => GamePath.GenerateUnchecked( $"chara/xls/charadb/accessorydeformerparameter/c{gr.ToRaceCode()}.eqdp" ),
ObjectType.Equipment => GamePath.GenerateUnchecked( $"chara/xls/charadb/equipmentdeformerparameter/c{gr.ToRaceCode()}.eqdp" ), ObjectType.Equipment => GamePath.GenerateUnchecked( $"chara/xls/charadb/equipmentdeformerparameter/c{gr.ToRaceCode()}.eqdp" ),
_ => throw new NotImplementedException() _ => throw new NotImplementedException(),
}; };
} }
@ -69,7 +73,7 @@ namespace Penumbra.MetaData
EquipSlot.Wrists => Eqdp( ObjectType.Accessory, gr ), EquipSlot.Wrists => Eqdp( ObjectType.Accessory, gr ),
EquipSlot.RingL => Eqdp( ObjectType.Accessory, gr ), EquipSlot.RingL => Eqdp( ObjectType.Accessory, gr ),
EquipSlot.RingR => Eqdp( ObjectType.Accessory, gr ), EquipSlot.RingR => Eqdp( ObjectType.Accessory, gr ),
_ => throw new NotImplementedException() _ => throw new NotImplementedException(),
}; };
} }
} }

View file

@ -30,7 +30,7 @@ namespace Penumbra.Mods
GmpFile gmp => gmp.WriteBytes(), GmpFile gmp => gmp.WriteBytes(),
EstFile est => est.WriteBytes(), EstFile est => est.WriteBytes(),
ImcFile imc => imc.WriteBytes(), ImcFile imc => imc.WriteBytes(),
_ => throw new NotImplementedException() _ => throw new NotImplementedException(),
}; };
DisposeFile( CurrentFile ); DisposeFile( CurrentFile );
CurrentFile = TempFile.WriteNew( dir, data ); CurrentFile = TempFile.WriteNew( dir, data );
@ -123,12 +123,14 @@ namespace Penumbra.Mods
} }
var gamePath = m.CorrespondingFilename(); var gamePath = m.CorrespondingFilename();
try
{
if( !_currentFiles.TryGetValue( gamePath, out var file ) ) if( !_currentFiles.TryGetValue( gamePath, out var file ) )
{ {
file = new FileInformation( _default.CreateNewFile( m ) ?? throw new IOException() ) file = new FileInformation( _default.CreateNewFile( m ) ?? throw new IOException() )
{ {
Changed = true, Changed = true,
CurrentFile = null CurrentFile = null,
}; };
_currentFiles[ gamePath ] = file; _currentFiles[ gamePath ] = file;
} }
@ -140,10 +142,15 @@ namespace Penumbra.Mods
MetaType.Gmp => m.Apply( ( GmpFile )file.Data ), MetaType.Gmp => m.Apply( ( GmpFile )file.Data ),
MetaType.Est => m.Apply( ( EstFile )file.Data ), MetaType.Est => m.Apply( ( EstFile )file.Data ),
MetaType.Imc => m.Apply( ( ImcFile )file.Data ), MetaType.Imc => m.Apply( ( ImcFile )file.Data ),
_ => throw new NotImplementedException() _ => throw new NotImplementedException(),
}; };
return true; return true;
} }
catch( Exception e )
{
PluginLog.Error( $"Could not obtain default file for manipulation {m.CorrespondingFilename()}:\n{e}" );
return false;
}
}
} }
} }