Skip to content

Commit 29e8c5b

Browse files
committed
Update 2.1.0.2
2 parents a5be1a2 + a62717e commit 29e8c5b

File tree

7 files changed

+56
-6
lines changed

7 files changed

+56
-6
lines changed

xivModdingFramework/General/Enums/XivRace.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private static void CheckTree()
131131
});
132132
dict.Add(XivRace.Roegadyn_Male, new XivRaceNode()
133133
{
134-
Parent = dict[XivRace.Hyur_Highlander_Male],
134+
Parent = dict[XivRace.Hyur_Midlander_Male],
135135
Race = XivRace.Roegadyn_Male,
136136
Children = new List<XivRaceNode>(),
137137
HasSkin = true
@@ -191,7 +191,7 @@ private static void CheckTree()
191191
});
192192
dict.Add(XivRace.Roegadyn_Female, new XivRaceNode()
193193
{
194-
Parent = dict[XivRace.Hyur_Highlander_Female],
194+
Parent = dict[XivRace.Hyur_Midlander_Female],
195195
Race = XivRace.Roegadyn_Female,
196196
Children = new List<XivRaceNode>()
197197
});

xivModdingFramework/Items/Categories/Gear.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,36 @@ public async Task<List<IItemModel>> GetSameModelList(IItemModel item)
745745
var slot = item.GetItemSlotAbbreviation();
746746
var imcEntries = info.GetAllEntries(slot);
747747

748+
if (sameModelItems.Any(x => x.ModelInfo.ImcSubsetID != 0))
749+
{
750+
// Need to list default IMC set.
751+
// Need to create a new item for it.
752+
var npcItem = new XivGear()
753+
{
754+
Name = "NPC Equipment e" + item.ModelInfo.PrimaryID + " " + slot + " Default Variant",
755+
ModelInfo = new XivGearModelInfo(),
756+
PrimaryCategory = item.PrimaryCategory,
757+
SecondaryCategory = item.SecondaryCategory,
758+
TertiaryCategory = item.TertiaryCategory,
759+
DataFile = item.DataFile,
760+
};
761+
npcItem.ModelInfo.PrimaryID = item.ModelInfo.PrimaryID;
762+
npcItem.ModelInfo.SecondaryID = item.ModelInfo.SecondaryID;
763+
npcItem.ModelInfo.ImcSubsetID = 0;
764+
try
765+
{
766+
((XivGearModelInfo)npcItem.ModelInfo).IsWeapon = ((XivGearModelInfo)item.ModelInfo).IsWeapon;
767+
}
768+
catch
769+
{
770+
// No-op. Should never actually get here, but safety check on the cast.
771+
}
772+
773+
sameModelItems.Add(npcItem);
774+
}
775+
748776
// Need to verify all of our IMC sets are properly represented in the item list.
749-
for (int i = 0; i < imcEntries.Count; i++)
777+
for (int i = 1; i <= imcEntries.Count; i++)
750778
{
751779
// Already in it. All set.
752780
if (sameModelItems.Any(x => x.ModelInfo.ImcSubsetID == i)) continue;

xivModdingFramework/Materials/FileTypes/Mtrl.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ private async Task<List<TexTypePath>> GetTexNames(IEnumerable<string> texPathLis
934934
// Helper regexes for GetMtrlPath.
935935
private readonly Regex _raceRegex = new Regex("(c[0-9]{4})");
936936
private readonly Regex _weaponMatch = new Regex("(w[0-9]{4})");
937+
private readonly Regex _tailMatch = new Regex("(t[0-9]{4})");
937938
private readonly Regex _skinRegex = new Regex("^/mt_c([0-9]{4})b([0-9]{4})_.+\\.mtrl$");
938939
/// <summary>
939940
/// Resolves the MTRL path for a given MDL path.
@@ -996,6 +997,17 @@ public string GetMtrlPath(string mdlPath, string mtrlName, int mtrlVariant = 1)
996997
mdlPath = mdlPath.Replace(mdlMatch.Groups[1].Value, mtrlMatch.Groups[1].Value);
997998
}
998999

1000+
mdlMatch = _tailMatch.Match(mdlPath);
1001+
mtrlMatch = _tailMatch.Match(mtrlName);
1002+
1003+
// Both items have tail model information in their path, and the weapons DON'T match.
1004+
if (mdlMatch.Success && mtrlMatch.Success && mdlMatch.Groups[1].Value != mtrlMatch.Groups[1].Value)
1005+
{
1006+
// Replacing the tail reference in the main path with the one from the MTRL.
1007+
// Needless to say, this only happens with tail items.
1008+
mdlPath = mdlPath.Replace(mdlMatch.Groups[1].Value, mtrlMatch.Groups[1].Value);
1009+
}
1010+
9991011
var mdlFolder = Path.GetDirectoryName(mdlPath);
10001012
mdlFolder = mdlFolder.Replace("\\", "/");
10011013

xivModdingFramework/Models/DataContainers/TTModel.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,12 +918,21 @@ public void SaveToFile(string filePath, Action<bool, string> loggingFunction = n
918918
foreach(var material in Materials)
919919
{
920920
// Materials
921-
query = @"insert into materials (material_id, diffuse, normal, specular, opacity) values ($material_id, $diffuse, $normal, $specular, $opacity);";
921+
query = @"insert into materials (material_id, name, diffuse, normal, specular, opacity, emissive) values ($material_id, $name, $diffuse, $normal, $specular, $opacity, $emissive);";
922922
using (var cmd = new SQLiteCommand(query, db))
923923
{
924924
var mtrl_prefix = directory + "\\" + Path.GetFileNameWithoutExtension(material.Substring(1)) + "_";
925925
var mtrl_suffix = ".png";
926+
var name = material;
927+
try
928+
{
929+
name = Path.GetFileNameWithoutExtension(material);
930+
} catch
931+
{
932+
933+
}
926934
cmd.Parameters.AddWithValue("material_id", matIdx);
935+
cmd.Parameters.AddWithValue("name", name);
927936
cmd.Parameters.AddWithValue("diffuse", mtrl_prefix + "d" + mtrl_suffix);
928937
cmd.Parameters.AddWithValue("normal", mtrl_prefix + "n" + mtrl_suffix);
929938
cmd.Parameters.AddWithValue("specular", mtrl_prefix + "s" + mtrl_suffix);

xivModdingFramework/Models/FileTypes/Mdl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ public async Task<XivMdl> GetRawMdlData(string mdlPath, bool getOriginal = false
991991
xivMdl.MeshShapeData.AssignMeshAndLodNumbers(indexOffsets);
992992

993993
// Sets the boolean flag if the model has shape data
994-
xivMdl.HasShapeData = xivMdl.ModelData.ShapeCount > 0;
994+
xivMdl.HasShapeData = xivMdl.ModelData.ShapeCount > 0 && getShapeData;
995995

996996
// Bone index for Parts
997997
var partBoneSet = new BoneSet

xivModdingFramework/Models/Helpers/ModelModifiers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ public static void CloneUV2(TTModel model, Action<bool, string> loggingFunction
697697
loggingFunction = NoOp;
698698
}
699699

700-
loggingFunction(false, "Clearing UV2...");
700+
loggingFunction(false, "Cloning UV1 to UV2...");
701701
foreach (var m in model.MeshGroups)
702702
{
703703
foreach (var p in m.Parts)

xivModdingFramework/Resources/SQL/CreateImportDB.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ CREATE TABLE "skeleton" (
120120
-- Materials
121121
CREATE TABLE "materials" (
122122
"material_id" INTEGER NOT NULL,
123+
"name" TEXT,
123124
"diffuse" TEXT,
124125
"normal" TEXT,
125126
"specular" TEXT,

0 commit comments

Comments
 (0)