Skip to content

Commit 8c0e6d6

Browse files
committed
Merge remote-tracking branch 'org/full_model' into develop
2 parents 7dcc313 + bd0274f commit 8c0e6d6

File tree

4 files changed

+444
-13
lines changed

4 files changed

+444
-13
lines changed

xivModdingFramework/General/Enums/XivRace.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ public static bool IsChildOf(this XivRace possibleChild, XivRace possibleParent,
348348
}
349349

350350
/// <summary>
351-
/// Determines if this race is a parent of a nother given race or not.
351+
/// Determines if this race is a parent of another given race or not.
352352
/// If the values are the same, it is considered TRUE by default.
353353
/// </summary>
354354
/// <param name="possibleParent"></param>
@@ -377,6 +377,35 @@ public static bool IsParentOf(this XivRace possibleParent, XivRace possibleChild
377377

378378
}
379379

380+
/// <summary>
381+
/// Determines if this race is a direct parent of another given race or not.
382+
/// If the values are the same, it is considered TRUE by default.
383+
/// </summary>
384+
/// <param name="possibleParent"></param>
385+
/// <param name="possibleChild"></param>
386+
/// <returns></returns>
387+
public static bool IsDirectParentOf(this XivRace possibleParent, XivRace possibleChild, bool allowSame = true)
388+
{
389+
CheckTree();
390+
if (possibleChild == possibleParent && allowSame)
391+
{
392+
return true;
393+
}
394+
395+
var node = GetNode(possibleChild);
396+
397+
if (node?.Parent != null)
398+
{
399+
node = node.Parent;
400+
if (node.Race == possibleParent)
401+
{
402+
return true;
403+
}
404+
}
405+
406+
return false;
407+
}
408+
380409
/// <summary>
381410
/// Retrieves the tree node for the given race.
382411
/// </summary>

0 commit comments

Comments
 (0)