Skip to content

Commit ff2b1c4

Browse files
committed
Update 2.3.2.5
2 parents 6a075b8 + 94d2fe9 commit ff2b1c4

File tree

33 files changed

+3052
-2683
lines changed

33 files changed

+3052
-2683
lines changed

xivModdingFramework/Cache/XivCache.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static class XivCache
2929
private static GameInfo _gameInfo;
3030
private static DirectoryInfo _dbPath;
3131
private static DirectoryInfo _rootCachePath;
32-
public static readonly Version CacheVersion = new Version("1.0.2.0");
32+
public static readonly Version CacheVersion = new Version("1.0.2.1");
3333
private const string dbFileName = "mod_cache.db";
3434
private const string rootCacheFileName = "item_sets.db";
3535
private const string creationScript = "CreateCacheDB.sql";
@@ -1585,7 +1585,7 @@ public static Dictionary<XivItemType, Dictionary<int, Dictionary<XivItemType, Di
15851585

15861586
public static async Task<XivDependencyRoot> GetFirstRoot(string internalPath)
15871587
{
1588-
var roots = await XivDependencyGraph.GetDependencyRoots(internalPath);
1588+
var roots = await XivDependencyGraph.GetDependencyRoots(internalPath, true);
15891589
if(roots.Count > 0)
15901590
{
15911591
return roots[0];

xivModdingFramework/Cache/XivDependencyGraph.cs

Lines changed: 34 additions & 133 deletions
Large diffs are not rendered by default.

xivModdingFramework/General/Enums/XivRace.cs

Lines changed: 111 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,39 @@
2626

2727
namespace xivModdingFramework.General.Enums
2828
{
29+
30+
public enum XivBaseRace : byte
31+
{
32+
Hyur = 1,
33+
Elezen = 2,
34+
Lalafell = 3,
35+
Miqote = 4,
36+
Roegadyn = 5,
37+
AuRa = 6,
38+
Hrothgar = 7,
39+
Viera = 8
40+
};
41+
42+
public enum XivSubRace : byte
43+
{
44+
Hyur_Midlander = 1,
45+
Hyur_Highlander,
46+
Elezen_Wildwood,
47+
Elezen_Duskwright,
48+
Lalafell_Plainsfolk,
49+
Lalafell_Dunesfolk,
50+
Miqote_Seeker,
51+
Miqote_Keeper,
52+
Roegadyn_SeaWolf,
53+
Roegadyn_Hellsguard,
54+
AuRa_Raen,
55+
AuRa_Xaela,
56+
Hrothgar_Hellion,
57+
Hrothgar_Lost,
58+
Viera_Rava,
59+
Viera_Veena
60+
};
61+
2962
/// <summary>
3063
/// Enum containing all known races
3164
/// </summary>
@@ -81,7 +114,7 @@ public class XivRaceNode {
81114
public bool HasSkin = false;
82115
}
83116

84-
public static class XivRaceTree
117+
public static class XivRaceTree
85118
{
86119
private static XivRaceNode tree;
87120
private static Dictionary<XivRace, XivRaceNode> dict;
@@ -351,7 +384,7 @@ public static XivRaceNode GetFullRaceTree()
351384
public static bool IsChildOf(this XivRace possibleChild, XivRace possibleParent, bool allowSame = true)
352385
{
353386
CheckTree();
354-
if(possibleChild == possibleParent && allowSame)
387+
if (possibleChild == possibleParent && allowSame)
355388
{
356389
return true;
357390
}
@@ -369,7 +402,7 @@ public static bool IsChildOf(this XivRace possibleChild, XivRace possibleParent,
369402
public static bool IsParentOf(this XivRace possibleParent, XivRace possibleChild, bool allowSame = true)
370403
{
371404
CheckTree();
372-
if(possibleChild == possibleParent && allowSame)
405+
if (possibleChild == possibleParent && allowSame)
373406
{
374407
return true;
375408
}
@@ -450,7 +483,7 @@ public static List<XivRace> GetChildren(this XivRace race, bool includeNPCs = fa
450483

451484
// Recursion for children.
452485
var children = new List<XivRace>();
453-
foreach(var c in node.Children)
486+
foreach (var c in node.Children)
454487
{
455488
children.AddRange(GetChildren(c.Race, includeNPCs));
456489
}
@@ -467,17 +500,17 @@ public static List<XivRace> GetChildren(this XivRace race, bool includeNPCs = fa
467500
public static XivRace GetSkinRace(this XivRace race)
468501
{
469502
var node = GetNode(race);
470-
if(node == null)
503+
if (node == null)
471504
{
472505
return XivRace.Hyur_Midlander_Male;
473506
}
474507

475-
if(node.HasSkin)
508+
if (node.HasSkin)
476509
{
477510
return node.Race;
478511
}
479512

480-
while(node.Parent != null)
513+
while (node.Parent != null)
481514
{
482515
node = node.Parent;
483516
if (node.HasSkin)
@@ -487,6 +520,77 @@ public static XivRace GetSkinRace(this XivRace race)
487520
return XivRace.Hyur_Midlander_Male;
488521
}
489522

523+
524+
/// <summary>
525+
/// Retrieves the subrace offset for this race.
526+
/// </summary>
527+
/// <param name="race"></param>
528+
/// <returns></returns>
529+
public static int GetSubRaceId(this XivSubRace subrace)
530+
{
531+
return (int)subrace % 2 == 1 ? 0 : 1;
532+
}
533+
public static XivBaseRace GetBaseRace(this XivSubRace subrace)
534+
{
535+
byte rId = (byte) ((((byte)subrace) - 1) / 2);
536+
return (XivBaseRace) rId;
537+
}
538+
539+
/// <summary>
540+
/// Retrieves the base race enum value for this race/clan/gender race.
541+
/// Used for CMP files and a few other things.
542+
/// </summary>
543+
/// <param name="race"></param>
544+
/// <returns></returns>
545+
public static XivBaseRace GetBaseRace(this XivRace race)
546+
{
547+
switch(race)
548+
{
549+
case XivRace.Hyur_Midlander_Male:
550+
case XivRace.Hyur_Midlander_Female:
551+
case XivRace.Hyur_Midlander_Male_NPC:
552+
case XivRace.Hyur_Midlander_Female_NPC:
553+
case XivRace.Hyur_Highlander_Male:
554+
case XivRace.Hyur_Highlander_Female:
555+
case XivRace.Hyur_Highlander_Male_NPC:
556+
case XivRace.Hyur_Highlander_Female_NPC:
557+
return XivBaseRace.Hyur;
558+
case XivRace.Elezen_Male:
559+
case XivRace.Elezen_Female:
560+
case XivRace.Elezen_Male_NPC:
561+
case XivRace.Elezen_Female_NPC:
562+
return XivBaseRace.Elezen;
563+
case XivRace.Lalafell_Male:
564+
case XivRace.Lalafell_Female:
565+
case XivRace.Lalafell_Male_NPC:
566+
case XivRace.Lalafell_Female_NPC:
567+
return XivBaseRace.Lalafell;
568+
case XivRace.Miqote_Male:
569+
case XivRace.Miqote_Female:
570+
case XivRace.Miqote_Male_NPC:
571+
case XivRace.Miqote_Female_NPC:
572+
return XivBaseRace.Miqote;
573+
case XivRace.Roegadyn_Male:
574+
case XivRace.Roegadyn_Female:
575+
case XivRace.Roegadyn_Male_NPC:
576+
case XivRace.Roegadyn_Female_NPC:
577+
return XivBaseRace.Roegadyn;
578+
case XivRace.AuRa_Male:
579+
case XivRace.AuRa_Female:
580+
case XivRace.AuRa_Male_NPC:
581+
case XivRace.AuRa_Female_NPC:
582+
return XivBaseRace.AuRa;
583+
case XivRace.Viera:
584+
case XivRace.Viera_NPC:
585+
return XivBaseRace.Viera;
586+
case XivRace.Hrothgar:
587+
case XivRace.Hrothgar_NPC:
588+
return XivBaseRace.Hrothgar;
589+
default:
590+
return XivBaseRace.Hyur;
591+
}
592+
}
593+
490594
/// <summary>
491595
/// Gets the internal FFXIV MTRL path for a given race's skin, using the tree as needed to find the appropriate ancestor skin.
492596
/// </summary>

xivModdingFramework/Items/Categories/Companions.cs

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -435,98 +435,6 @@ public async Task<List<string>> GetDemiHumanMountModelEquipPartList(IItemModel i
435435
return equipPartList;
436436
}
437437

438-
/// <summary>
439-
/// Searches for monsters with the given model ID
440-
/// </summary>
441-
/// <param name="modelID">The ID of the monster model</param>
442-
/// <param name="type">The type of monster to look for</param>
443-
/// <returns>A list of Search Results</returns>
444-
public async Task<List<SearchResults>> SearchMonstersByModelID(int modelID, XivItemType type)
445-
{
446-
var monsterSearchLock = new object();
447-
var monsterSearchLock1 = new object();
448-
var searchResultsList = new List<SearchResults>();
449-
var index = new Index(_gameDirectory);
450-
var id = modelID.ToString().PadLeft(4, '0');
451-
452-
var bodyVariantDictionary = new Dictionary<int, List<int>>();
453-
454-
if (type == XivItemType.monster)
455-
{
456-
var folder = $"chara/monster/m{id}/obj/body/b";
457-
458-
await Task.Run(() => Parallel.For(0, 100, (i) =>
459-
{
460-
var folderHashDictionary = new Dictionary<int, int>();
461-
462-
var mtrlFolder = $"{folder}{i.ToString().PadLeft(4, '0')}/material/v";
463-
464-
for (var j = 1; j < 100; j++)
465-
{
466-
lock (monsterSearchLock)
467-
{
468-
folderHashDictionary.Add(HashGenerator.GetHash($"{mtrlFolder}{j.ToString().PadLeft(4, '0')}"),
469-
j);
470-
}
471-
}
472-
473-
var variantList = index.GetFolderExistsList(folderHashDictionary, XivDataFile._04_Chara).Result;
474-
475-
if (variantList.Count > 0)
476-
{
477-
lock (monsterSearchLock1)
478-
{
479-
variantList.Sort();
480-
bodyVariantDictionary.Add(i, variantList);
481-
}
482-
483-
}
484-
}));
485-
}
486-
else if (type == XivItemType.demihuman)
487-
{
488-
var folder = $"chara/demihuman/d{id}/obj/equipment/e";
489-
490-
await Task.Run(() => Parallel.For(0, 100, (i) =>
491-
{
492-
var folderHashDictionary = new Dictionary<int, int>();
493-
494-
var mtrlFolder = $"{folder}{i.ToString().PadLeft(4, '0')}/material/v";
495-
496-
for (var j = 1; j < 100; j++)
497-
{
498-
lock (monsterSearchLock)
499-
{
500-
folderHashDictionary.Add(HashGenerator.GetHash($"{mtrlFolder}{j.ToString().PadLeft(4, '0')}"),
501-
j);
502-
}
503-
}
504-
505-
var variantList = index.GetFolderExistsList(folderHashDictionary, XivDataFile._04_Chara).Result;
506-
507-
if (variantList.Count > 0)
508-
{
509-
lock (monsterSearchLock1)
510-
{
511-
variantList.Sort();
512-
bodyVariantDictionary.Add(i, variantList);
513-
}
514-
}
515-
}));
516-
}
517-
518-
foreach (var bodyVariant in bodyVariantDictionary)
519-
{
520-
foreach (var variant in bodyVariant.Value)
521-
{
522-
searchResultsList.Add(new SearchResults { Body = bodyVariant.Key.ToString(), Slot = XivStrings.Monster, Variant = variant });
523-
}
524-
}
525-
526-
searchResultsList.Sort();
527-
528-
return searchResultsList;
529-
}
530438

531439
/// <summary>
532440
/// A dictionary containing the slot abbreviations in the format [equipment slot, slot abbreviation]

0 commit comments

Comments
 (0)