Skip to content

Commit fcce88b

Browse files
committed
Merge branch 'furniture_dependencies' into develop
2 parents bc3bd84 + 6ba431c commit fcce88b

File tree

9 files changed

+197
-82
lines changed

9 files changed

+197
-82
lines changed

xivModdingFramework/Cache/XivCache.cs

Lines changed: 3 additions & 3 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.0");
30+
public static readonly Version CacheVersion = new Version("1.0.1.1");
3131
private const string dbFileName = "mod_cache.db";
3232
private const string rootCacheFileName = "item_sets.db";
3333
private const string creationScript = "CreateCacheDB.sql";
@@ -437,7 +437,7 @@ private static async Task RebuildFurnitureCache()
437437
{
438438

439439
var query = @"
440-
insert into housing ( name, category, subcategory, primary_id, icon_id, root)
440+
insert into furniture ( name, category, subcategory, primary_id, icon_id, root)
441441
values($name, $category, $subcategory, $primary_id, $icon_id, $root)";
442442

443443
var root = item.GetRootInfo();
@@ -724,7 +724,7 @@ internal static async Task<List<XivFurniture>> GetCachedFurnitureList(string sub
724724
where.Value = "%" + substring + "%";
725725
}
726726

727-
return await BuildListFromTable("housing", where, async (reader) =>
727+
return await BuildListFromTable("furniture", where, async (reader) =>
728728
{
729729
return MakeFurniture(reader);
730730
});

xivModdingFramework/Cache/XivDependencyGraph.cs

Lines changed: 151 additions & 64 deletions
Large diffs are not rendered by default.

xivModdingFramework/Items/Categories/Housing.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -374,16 +374,29 @@ await Task.Run(() => Parallel.ForEach(housingDictionary.Values, (housingItem) =>
374374
return furnitureList;
375375
}
376376

377+
public async Task<Dictionary<string, string>> GetFurnitureModelParts(IItemModel itemModel)
378+
{
379+
380+
return await GetFurnitureModelParts(itemModel.ModelInfo.PrimaryID, itemModel.SecondaryCategory);
381+
}
382+
383+
384+
public async Task<Dictionary<string, string>> GetFurnitureModelParts(int modelID, XivItemType type)
385+
{
386+
var cat = type == XivItemType.indoor ? XivStrings.Furniture_Indoor : XivStrings.Furniture_Outdoor;
387+
return await GetFurnitureModelParts(modelID, cat);
388+
}
389+
377390
/// <summary>
378391
/// Gets the parts list for furniture
379392
/// </summary>
380393
/// <param name="itemModel">The item to get the parts for</param>
381394
/// <returns>A dictionary containing the part string and mdl path string</returns>
382-
public async Task<Dictionary<string, string>> GetFurnitureModelParts(IItemModel itemModel)
395+
public async Task<Dictionary<string, string>> GetFurnitureModelParts(int modelID, string category)
383396
{
384397
var furniturePartDict = new Dictionary<string, string>();
385398

386-
var assets = await GetFurnitureAssets(itemModel.ModelInfo.PrimaryID, itemModel.SecondaryCategory);
399+
var assets = await GetFurnitureAssets(modelID, category);
387400

388401
foreach (var mdl in assets.MdlList)
389402
{
@@ -432,11 +445,11 @@ public async Task<Dictionary<string, string>> GetFurnitureModelParts(IItemModel
432445
return furniturePartDict;
433446
}
434447

435-
/// <summary>
436-
/// Gets the assets for furniture
437-
/// </summary>
438-
/// <param name="modelID">The model id to get the assets for</param>
439-
/// <returns>A HousingAssets object containing the asset info</returns>
448+
/// <summary>
449+
/// Gets the assets for furniture
450+
/// </summary>
451+
/// <param name="modelID">The model id to get the assets for</param>
452+
/// <returns>A HousingAssets object containing the asset info</returns>
440453
private async Task<HousingAssets> GetFurnitureAssets(int modelID, string category)
441454
{
442455
var index = new Index(_gameDirectory);

xivModdingFramework/Items/DataContainers/XivCharacter.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,21 @@ internal static IItemModel FromDependencyRoot(XivDependencyRoot root)
7676
item.ModelInfo = new XivModelInfo();
7777
item.ModelInfo.PrimaryID = root.Info.PrimaryId;
7878
item.ModelInfo.SecondaryID = (int)root.Info.SecondaryId;
79-
item.Name = root.Info.GetBaseFileName();
8079
item.PrimaryCategory = XivStrings.Character;
8180

8281
if (root.Info.Slot != null)
8382
{
8483
item.SecondaryCategory = Mdl.SlotAbbreviationDictionary.FirstOrDefault(x => x.Value == root.Info.Slot).Key;
84+
85+
//var race = XivRaces.GetXivRace(root.Info.PrimaryId.ToString().PadLeft(4, '0')).GetDisplayName();
86+
item.Name = item.SecondaryCategory + " - " + root.Info.GetBaseFileName();
8587
} else
8688
{
89+
item.Name = root.Info.GetBaseFileName();
8790
item.SecondaryCategory = XivStrings.Body;
8891
}
8992

93+
9094
return item;
9195
}
9296

xivModdingFramework/Items/DataContainers/XivFurniture.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ internal static IItemModel FromDependencyRoot(XivDependencyRoot root)
7373
var item = new XivFurniture();
7474
item.ModelInfo = new XivModelInfo();
7575
item.ModelInfo.PrimaryID = root.Info.PrimaryId;
76-
item.ModelInfo.SecondaryID = (int)root.Info.SecondaryId;
7776
item.Name = root.Info.GetBaseFileName();
7877
item.PrimaryCategory = XivStrings.Housing;
7978
if (root.Info.PrimaryType == Enums.XivItemType.indoor)

xivModdingFramework/Items/Enums/XivItemType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public enum XivItemType
4343
[Description("")] decal,
4444
[Description("")] ui,
4545
[Description("")] furniture, // This one's a little vague and encompasses really all of /bgcommon/
46-
[Description("")] indoor, // These are the clearer versions, but only used by the dependency graph.
47-
[Description("")] outdoor
46+
[Description("indoor")] indoor, // These are the clearer versions, but only used by the dependency graph.
47+
[Description("outdoor")] outdoor
4848
}
4949

5050
public static class XivItemTypes {

xivModdingFramework/Materials/FileTypes/Mtrl.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,14 @@ public async Task<XivMtrl> GetMtrlData(IItemModel itemModel, XivRace race, strin
260260
return mtrlData;
261261
}
262262

263+
private static Regex _dummyTextureRegex = new Regex("^bgcommon/texture/dummy_[a-z]\\.tex$");
264+
263265
/// <summary>
264266
/// Retrieves the list of texture paths used by the given mtrl path (significantly faster than loading the entire material and scanning it).
265267
/// </summary>
266268
/// <param name="mtrlPath"></param>
267269
/// <returns></returns>
268-
public async Task<List<string>> GetTexturePathsFromMtrlPath(string mtrlPath, bool forceOriginal = false)
270+
public async Task<List<string>> GetTexturePathsFromMtrlPath(string mtrlPath, bool includeDummies = false, bool forceOriginal = false)
269271
{
270272
var dat = new Dat(_gameDirectory);
271273
var mtrlData = await dat.GetType2Data(mtrlPath, forceOriginal);
@@ -358,8 +360,16 @@ public async Task<List<string>> GetTexturePathsFromMtrlPath(string mtrlPath, boo
358360
}
359361
}
360362

363+
var rem = new List<string>();
364+
List<string> ret;
365+
if (includeDummies)
366+
{
367+
ret = uniqueTextures.ToList();
368+
} else {
369+
ret = uniqueTextures.Where(x => !_dummyTextureRegex.IsMatch(x)).ToList();
370+
}
361371

362-
return uniqueTextures.ToList();
372+
return ret;
363373
}
364374

365375
/// <summary>

xivModdingFramework/Models/FileTypes/Mdl.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4417,7 +4417,9 @@ public async Task<string> GetMdlPath(IItemModel itemModel, XivRace xivRace, stri
44174417
{XivStrings.Etc, "etc"},
44184418
{XivStrings.Accessory, "acc"},
44194419
{XivStrings.Hair, "hir"},
4420-
{XivStrings.Tail, "til"}
4420+
{XivStrings.Tail, "til"},
4421+
{XivStrings.Furniture_Indoor, "fun"},
4422+
{XivStrings.Furniture_Outdoor, "gar"}
44214423

44224424
};
44234425

xivModdingFramework/Resources/SQL/CreateCacheDB.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CREATE TABLE "ui" (
3434
);
3535

3636
-- All /bgcommon/ stuff.
37-
CREATE TABLE "housing" (
37+
CREATE TABLE "furniture" (
3838
"name" TEXT NOT NULL,
3939
"category" TEXT NOT NULL,
4040
"subcategory" TEXT,

0 commit comments

Comments
 (0)