Skip to content

Commit 3b3b207

Browse files
committed
More minor improvements to furniture handling in item lists and dependency structures.
1 parent fcce88b commit 3b3b207

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

xivModdingFramework/Cache/XivCache.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static class XivCache
2727
private static GameInfo _gameInfo;
2828
private static DirectoryInfo _dbPath;
2929
private static DirectoryInfo _rootCachePath;
30-
public static readonly Version CacheVersion = new Version("1.0.1.1");
30+
public static readonly Version CacheVersion = new Version("1.0.1.2");
3131
private const string dbFileName = "mod_cache.db";
3232
private const string rootCacheFileName = "item_sets.db";
3333
private const string creationScript = "CreateCacheDB.sql";
@@ -326,12 +326,13 @@ private static void CreateCache()
326326
}
327327
}
328328

329+
var cwd = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
330+
var backupFile = cwd + "\\Resources\\DB\\" + rootCacheFileName;
331+
329332
if (!File.Exists(_rootCachePath.FullName))
330333
{
331-
// If we don't have a root cache file, we can do a few things...
332-
var cwd = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
333-
var backupFile = cwd + "\\Resources\\DB\\" + rootCacheFileName;
334334

335+
// If we don't have a root cache file, we can do a few things...
335336
if (File.Exists(backupFile))
336337
{
337338
// Copy the backup over. - Even if the backup is not for the correct patch of
@@ -358,6 +359,18 @@ private static void CreateCache()
358359
}
359360
}
360361
}
362+
else if(File.Exists(backupFile))
363+
{
364+
// If we have both a backup and current file, see if the current is out of date.
365+
// (If we just updated textools and the download came with a new file)
366+
var backupDate = File.GetLastWriteTime(backupFile);
367+
var currentDate = File.GetLastWriteTime(_rootCachePath.FullName);
368+
if(backupDate > currentDate)
369+
{
370+
// Our backup is newer, copy it through.
371+
File.Copy(backupFile, _rootCachePath.FullName);
372+
}
373+
}
361374
}
362375

363376

xivModdingFramework/Cache/XivDependencyGraph.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ public string GetSgdName()
290290
throw new NotSupportedException("Cannot get SGB File for Non-Furniture item type.");
291291
}
292292

293-
var assetFile = $"{Slot}_b0_m{PrimaryId.ToString().PadLeft(4, '0')}.sgb";
293+
var slotFake = PrimaryType == XivItemType.indoor ? "fun" : "gar";
294+
295+
var assetFile = $"{slotFake}_b0_m{PrimaryId.ToString().PadLeft(4, '0')}.sgb";
294296
return assetFile;
295297
}
296298

@@ -432,13 +434,10 @@ public XivDependencyRoot(XivDependencyRootInfo info)
432434
// initial crawls up the tree are janky.
433435
Info.Slot = "top";
434436
}
435-
} else if(Info.PrimaryType == XivItemType.indoor)
436-
{
437-
Info.Slot = "fun";
438-
439-
} else if(Info.PrimaryType == XivItemType.outdoor)
437+
} else if(Info.PrimaryType == XivItemType.indoor || Info.PrimaryType == XivItemType.outdoor)
440438
{
441-
Info.Slot = "gar";
439+
// No slots here!
440+
Info.Slot = null;
442441
}
443442
}
444443

@@ -1443,8 +1442,6 @@ public static XivDependencyRootInfo ExtractRootInfo(string internalFilePath)
14431442
{
14441443
info.PrimaryType = XivItemTypes.FromSystemName(match.Groups[1].Value);
14451444
info.PrimaryId = Int32.Parse(match.Groups[2].Value);
1446-
1447-
info.Slot = info.PrimaryType == XivItemType.indoor ? "fun" : "gar";
14481445
}
14491446
}
14501447

xivModdingFramework/Models/FileTypes/Mdl.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4418,8 +4418,6 @@ public async Task<string> GetMdlPath(IItemModel itemModel, XivRace xivRace, stri
44184418
{XivStrings.Accessory, "acc"},
44194419
{XivStrings.Hair, "hir"},
44204420
{XivStrings.Tail, "til"},
4421-
{XivStrings.Furniture_Indoor, "fun"},
4422-
{XivStrings.Furniture_Outdoor, "gar"}
44234421

44244422
};
44254423

0 commit comments

Comments
 (0)