@@ -503,9 +503,28 @@ public async Task<List<string>> GetModelFiles()
503
503
var housingAssets = await _housing . GetFurnitureModelParts ( Info . PrimaryId , Info . PrimaryType ) ;
504
504
return housingAssets . Select ( x => x . Value ) . ToList ( ) ;
505
505
} else {
506
+
507
+
506
508
// The rest of the types just have a single, calculateable model path.
507
509
var folder = Info . GetRootFolder ( ) ;
508
- var modelPath = folder + "model/" + Info . GetSimpleModelName ( ) ;
510
+ var modelFolder = folder + "model" ;
511
+ var modelPath = modelFolder + "/" + Info . GetSimpleModelName ( ) ;
512
+
513
+
514
+ if ( Info . PrimaryType == XivItemType . human && Info . SecondaryId / 100 >= 1 )
515
+ {
516
+ // For human types, if their model is missing, the version 00xx is used instead.
517
+ var index = new Index ( XivCache . GameInfo . GameDirectory ) ;
518
+ if ( ! ( await index . FileExists ( modelPath ) ) )
519
+ {
520
+ var replacementNumber = ( Info . SecondaryId % 100 ) ;
521
+ var alteredRoot = new XivDependencyRoot ( Info . PrimaryType , Info . PrimaryId , Info . SecondaryType , replacementNumber , Info . Slot ) ;
522
+
523
+ return await alteredRoot . GetModelFiles ( ) ;
524
+ }
525
+
526
+ }
527
+
509
528
return new List < string > ( ) { modelPath } ;
510
529
}
511
530
@@ -547,16 +566,31 @@ public async Task<List<string>> GetMaterialFiles(int materialVariant = -1)
547
566
if ( models != null && models . Count > 0 )
548
567
{
549
568
var dataFile = IOUtil . GetDataFileFromPath ( models [ 0 ] ) ;
569
+
550
570
var _mdl = new Mdl ( XivCache . GameInfo . GameDirectory , dataFile ) ;
551
571
572
+ Regex secondaryRex = null ;
573
+ string secondaryTypePrefix = null ;
574
+ if ( Info . PrimaryType == XivItemType . human ) {
575
+ secondaryTypePrefix = XivItemTypes . GetSystemPrefix ( ( XivItemType ) Info . SecondaryType ) ;
576
+ secondaryRex = new Regex ( "(" + secondaryTypePrefix + "[0-9]{4})" ) ;
577
+ }
578
+
552
579
foreach ( var model in models )
553
580
{
554
581
var mdlMats = await XivCache . GetChildFiles ( model ) ;
555
- if ( materialVariant < 0 )
582
+ if ( materialVariant <= 0 )
556
583
{
557
584
foreach ( var mat in mdlMats )
558
585
{
559
- materials . Add ( mat ) ;
586
+ var m = mat ;
587
+
588
+ // Human types have their material ID automatically changed over.
589
+ if ( Info . PrimaryType == XivItemType . human )
590
+ {
591
+ m = secondaryRex . Replace ( m , secondaryTypePrefix + Info . SecondaryId . ToString ( ) . PadLeft ( 4 , '0' ) ) ;
592
+ }
593
+ materials . Add ( m ) ;
560
594
}
561
595
}
562
596
else
@@ -899,7 +933,7 @@ public async Task<List<IItemModel>> GetAllItems(int imcSubset = -1)
899
933
}
900
934
901
935
/// For these types we also want to read their IMC file to fill in any missing NPC only versions.
902
- if ( Info . PrimaryType == XivItemType . equipment || Info . PrimaryType == XivItemType . accessory || Info . PrimaryType == XivItemType . weapon )
936
+ if ( Imc . UsesImc ( this ) )
903
937
{
904
938
var imc = new Imc ( XivCache . GameInfo . GameDirectory ) ;
905
939
var imcPaths = await GetImcEntryPaths ( ) ;
0 commit comments