Skip to content

Commit 7a8cfc2

Browse files
committed
Update 2.3.0.2
2 parents 42370cb + 7e7c2d8 commit 7a8cfc2

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

xivModdingFramework/Cache/XivDependencyGraph.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ public async Task<List<string>> GetModelFiles()
511511
var modelPath = modelFolder + "/" + Info.GetSimpleModelName();
512512

513513

514-
if (Info.PrimaryType == XivItemType.human && Info.SecondaryId / 100 >= 1)
514+
if (Info.PrimaryType == XivItemType.human && Info.SecondaryType != XivItemType.hair && Info.SecondaryId / 100 >= 1)
515515
{
516516
// For human types, if their model is missing, the version 00xx is used instead.
517517
var index = new Index(XivCache.GameInfo.GameDirectory);
@@ -586,7 +586,7 @@ public async Task<List<string>> GetMaterialFiles(int materialVariant = -1)
586586
var m = mat;
587587

588588
// Human types have their material ID automatically changed over.
589-
if (Info.PrimaryType == XivItemType.human)
589+
if (Info.PrimaryType == XivItemType.human && Info.SecondaryType != XivItemType.hair)
590590
{
591591
m = secondaryRex.Replace(m, secondaryTypePrefix + Info.SecondaryId.ToString().PadLeft(4, '0'));
592592
}
@@ -603,7 +603,14 @@ public async Task<List<string>> GetMaterialFiles(int materialVariant = -1)
603603
// This is faster than re-scanning the MDL file.
604604
// And a little more thorough than simply skipping over non-matching refs.
605605
// Since some materials may not have variant references.
606-
materials.Add(_materialSetRegex.Replace(mat, replacement));
606+
var m = _materialSetRegex.Replace(mat, replacement);
607+
608+
// Human types have their material ID automatically fixed to match.
609+
if (Info.PrimaryType == XivItemType.human && Info.SecondaryType != XivItemType.hair)
610+
{
611+
m = secondaryRex.Replace(m, secondaryTypePrefix + Info.SecondaryId.ToString().PadLeft(4, '0'));
612+
}
613+
materials.Add(m);
607614
}
608615
}
609616
}

xivModdingFramework/Helpers/IOUtil.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static async Task<byte[]> Decompressor(byte[] compressedBytes, int uncomp
8787
/// <param name="item">The item to be saved</param>
8888
/// <param name="saveDirectory">The base directory to save to</param>
8989
/// <returns>A string containing the full save path for the given item</returns>
90-
public static string MakeItemSavePath(IItem item, DirectoryInfo saveDirectory, XivRace race = XivRace.All_Races)
90+
public static string MakeItemSavePath(IItem item, DirectoryInfo saveDirectory, XivRace race = XivRace.All_Races, int primaryNumber = -1)
9191
{
9292
string path, validItemName;
9393

@@ -123,9 +123,12 @@ public static string MakeItemSavePath(IItem item, DirectoryInfo saveDirectory, X
123123
{
124124
path = $"{saveDirectory.FullName}/{item.PrimaryCategory}/{validItemName}";
125125
}
126-
else
126+
else if(primaryNumber >= 0)
127+
{
128+
path = $"{saveDirectory.FullName}/{item.PrimaryCategory}/{item.SecondaryCategory}/{race}/{primaryNumber}";
129+
} else
127130
{
128-
path = $"{saveDirectory.FullName}/{item.PrimaryCategory}/{validItemName}/{race}/{((IItemModel)item).ModelInfo.SecondaryID}";
131+
path = $"{saveDirectory.FullName}/{item.PrimaryCategory}/{item.SecondaryCategory}/{race}/{((IItemModel)item).ModelInfo.SecondaryID}";
129132
}
130133
}
131134
else

xivModdingFramework/Models/FileTypes/Eqp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ public async Task SaveEqdpEntries(uint primaryId, string slot, Dictionary<XivRac
463463
var slotIdx = EquipmentDeformationParameterSet.SlotsAsList(isAccessory).IndexOf(slot);
464464

465465
var byteOffset = slotIdx / 4;
466-
var bitOffset = (slotIdx * 2);
466+
var bitOffset = (slotIdx * 2) % 8;
467467

468468

469469

xivModdingFramework/Variants/FileTypes/Imc.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ public void SetEntry(XivImc info, int subsetID = -1, string slot = "", bool allo
718718

719719
// Get which offset the slot uses.
720720
var idx = 0;
721-
if (SlotOffsetDictionary.ContainsKey(slot) && SlotOffsetDictionary[slot] < subset.Count)
721+
if (slot != null && SlotOffsetDictionary.ContainsKey(slot) && SlotOffsetDictionary[slot] < subset.Count)
722722
{
723723
idx = SlotOffsetDictionary[slot];
724724
}

0 commit comments

Comments
 (0)