Add NPC special collections.

This commit is contained in:
Ottermandias 2022-07-02 15:35:51 +02:00
parent d9418b6743
commit 062c69385f
2 changed files with 94 additions and 9 deletions

View file

@ -26,6 +26,22 @@ public enum CollectionType : byte
Lost,
Rava,
Veena,
MidlanderNpc,
HighlanderNpc,
WildwoodNpc,
DuskwightNpc,
PlainsfolkNpc,
DunesfolkNpc,
SeekerOfTheSunNpc,
KeeperOfTheMoonNpc,
SeawolfNpc,
HellsguardNpc,
RaenNpc,
XaelaNpc,
HelionNpc,
LostNpc,
RavaNpc,
VeenaNpc,
Inactive, // A collection was added or removed
Default, // The default collection was changed
@ -62,6 +78,22 @@ public static class CollectionTypeExtensions
CollectionType.Lost => SubRace.Lost.ToName(),
CollectionType.Rava => SubRace.Rava.ToName(),
CollectionType.Veena => SubRace.Veena.ToName(),
CollectionType.MidlanderNpc => SubRace.Midlander.ToName() + " (NPC)",
CollectionType.HighlanderNpc => SubRace.Highlander.ToName() + " (NPC)",
CollectionType.WildwoodNpc => SubRace.Wildwood.ToName() + " (NPC)",
CollectionType.DuskwightNpc => SubRace.Duskwight.ToName() + " (NPC)",
CollectionType.PlainsfolkNpc => SubRace.Plainsfolk.ToName() + " (NPC)",
CollectionType.DunesfolkNpc => SubRace.Dunesfolk.ToName() + " (NPC)",
CollectionType.SeekerOfTheSunNpc => SubRace.SeekerOfTheSun.ToName() + " (NPC)",
CollectionType.KeeperOfTheMoonNpc => SubRace.KeeperOfTheMoon.ToName() + " (NPC)",
CollectionType.SeawolfNpc => SubRace.Seawolf.ToName() + " (NPC)",
CollectionType.HellsguardNpc => SubRace.Hellsguard.ToName() + " (NPC)",
CollectionType.RaenNpc => SubRace.Raen.ToName() + " (NPC)",
CollectionType.XaelaNpc => SubRace.Xaela.ToName() + " (NPC)",
CollectionType.HelionNpc => SubRace.Helion.ToName() + " (NPC)",
CollectionType.LostNpc => SubRace.Lost.ToName() + " (NPC)",
CollectionType.RavaNpc => SubRace.Rava.ToName() + " (NPC)",
CollectionType.VeenaNpc => SubRace.Veena.ToName() + " (NPC)",
CollectionType.Inactive => "Collection",
CollectionType.Default => "Default",
CollectionType.Character => "Character",
@ -110,6 +142,38 @@ public static class CollectionTypeExtensions
"This collection applies to all player character Rava Viera that do not have a more specific character collection associated.",
CollectionType.Veena =>
"This collection applies to all player character Veena Viera that do not have a more specific character collection associated.",
CollectionType.MidlanderNpc =>
"This collection applies to all non-player character Midlander Hyur that do not have a more specific character collection associated.",
CollectionType.HighlanderNpc =>
"This collection applies to all non-player character Highlander Hyur that do not have a more specific character collection associated.",
CollectionType.WildwoodNpc =>
"This collection applies to all non-player character Wildwood Elezen that do not have a more specific character collection associated.",
CollectionType.DuskwightNpc =>
"This collection applies to all non-player character Duskwight Elezen that do not have a more specific character collection associated.",
CollectionType.PlainsfolkNpc =>
"This collection applies to all non-player character Plainsfolk Lalafell that do not have a more specific character collection associated.",
CollectionType.DunesfolkNpc =>
"This collection applies to all non-player character Dunesfolk Lalafell that do not have a more specific character collection associated.",
CollectionType.SeekerOfTheSunNpc =>
"This collection applies to all non-player character Seekers of the Sun that do not have a more specific character collection associated.",
CollectionType.KeeperOfTheMoonNpc =>
"This collection applies to all non-player character Keepers of the Moon that do not have a more specific character collection associated.",
CollectionType.SeawolfNpc =>
"This collection applies to all non-player character Sea Wolf Roegadyn that do not have a more specific character collection associated.",
CollectionType.HellsguardNpc =>
"This collection applies to all non-player character Hellsguard Roegadyn that do not have a more specific character collection associated.",
CollectionType.RaenNpc =>
"This collection applies to all non-player character Raen Au Ra that do not have a more specific character collection associated.",
CollectionType.XaelaNpc =>
"This collection applies to all non-player character Xaela Au Ra that do not have a more specific character collection associated.",
CollectionType.HelionNpc =>
"This collection applies to all non-player character Helion Hrothgar that do not have a more specific character collection associated.",
CollectionType.LostNpc =>
"This collection applies to all non-player character Lost Hrothgar that do not have a more specific character collection associated.",
CollectionType.RavaNpc =>
"This collection applies to all non-player character Rava Viera that do not have a more specific character collection associated.",
CollectionType.VeenaNpc =>
"This collection applies to all non-player character Veena Viera that do not have a more specific character collection associated.",
_ => string.Empty,
};
}

View file

@ -367,15 +367,7 @@ public unsafe partial class PathResolver
if( character->ModelCharaId == 0 )
{
// Check if the object is a non-player human NPC.
if( actor->ObjectKind != ( byte )ObjectKind.Player )
{
collection = Penumbra.CollectionManager.ByType( CollectionType.NonPlayerCharacter );
if( collection != null )
{
return true;
}
}
else
if( actor->ObjectKind == ( byte )ObjectKind.Player )
{
// Check the subrace. If it does not fit any or no subrace collection is set, check the player character collection.
collection = ( SubRace )( ( Character* )actor )->CustomizeData[ 4 ] switch
@ -404,6 +396,35 @@ public unsafe partial class PathResolver
return true;
}
}
else
{
// Check the subrace. If it does not fit any or no subrace collection is set, check the npn-player character collection.
collection = ( SubRace )( ( Character* )actor )->CustomizeData[ 4 ] switch
{
SubRace.Midlander => Penumbra.CollectionManager.ByType( CollectionType.MidlanderNpc ),
SubRace.Highlander => Penumbra.CollectionManager.ByType( CollectionType.HighlanderNpc ),
SubRace.Wildwood => Penumbra.CollectionManager.ByType( CollectionType.WildwoodNpc ),
SubRace.Duskwight => Penumbra.CollectionManager.ByType( CollectionType.DuskwightNpc ),
SubRace.Plainsfolk => Penumbra.CollectionManager.ByType( CollectionType.PlainsfolkNpc ),
SubRace.Dunesfolk => Penumbra.CollectionManager.ByType( CollectionType.DunesfolkNpc ),
SubRace.SeekerOfTheSun => Penumbra.CollectionManager.ByType( CollectionType.SeekerOfTheSunNpc ),
SubRace.KeeperOfTheMoon => Penumbra.CollectionManager.ByType( CollectionType.KeeperOfTheMoonNpc ),
SubRace.Seawolf => Penumbra.CollectionManager.ByType( CollectionType.SeawolfNpc ),
SubRace.Hellsguard => Penumbra.CollectionManager.ByType( CollectionType.HellsguardNpc ),
SubRace.Raen => Penumbra.CollectionManager.ByType( CollectionType.RaenNpc ),
SubRace.Xaela => Penumbra.CollectionManager.ByType( CollectionType.XaelaNpc ),
SubRace.Helion => Penumbra.CollectionManager.ByType( CollectionType.HelionNpc ),
SubRace.Lost => Penumbra.CollectionManager.ByType( CollectionType.LostNpc ),
SubRace.Rava => Penumbra.CollectionManager.ByType( CollectionType.RavaNpc ),
SubRace.Veena => Penumbra.CollectionManager.ByType( CollectionType.VeenaNpc ),
_ => null,
};
collection ??= Penumbra.CollectionManager.ByType( CollectionType.NonPlayerCharacter );
if( collection != null )
{
return true;
}
}
}
}