From e2456492436ea6be221592ed8e976f06e09ec850 Mon Sep 17 00:00:00 2001 From: Arkadii Hlushchevskyi Date: Sun, 21 Apr 2024 22:11:14 +0300 Subject: [PATCH 1/2] Added Perk filter. --- SPID/include/Cache.h | 3 ++- SPID/src/LookupNPC.cpp | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/SPID/include/Cache.h b/SPID/include/Cache.h index 4b2a3a5..c3ed2db 100644 --- a/SPID/include/Cache.h +++ b/SPID/include/Cache.h @@ -13,7 +13,8 @@ namespace FormType RE::FormType::FormList, RE::FormType::Spell, RE::FormType::Armor, - RE::FormType::Location + RE::FormType::Location, + RE::FormType::Perk }; bool GetWhitelisted(RE::FormType a_type); diff --git a/SPID/src/LookupNPC.cpp b/SPID/src/LookupNPC.cpp index 6251b89..8d2d0d9 100644 --- a/SPID/src/LookupNPC.cpp +++ b/SPID/src/LookupNPC.cpp @@ -146,6 +146,11 @@ namespace NPC const auto location = a_form->As(); return actor->GetEditorLocation() == location; } + case RE::FormType::Perk: + { + const auto perk = a_form->As(); + return actor->HasPerk(perk); + } case RE::FormType::FormList: { bool result = false; From d9a9e87ba61b13c79156854bdf1b309a4b44bee2 Mon Sep 17 00:00:00 2001 From: Arkadii Hlushchevskyi Date: Sun, 21 Apr 2024 22:13:19 +0300 Subject: [PATCH 2/2] Distributing perks before spells. This will allow Spells to also filter by distributed perks. --- SPID/src/Distribute.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SPID/src/Distribute.cpp b/SPID/src/Distribute.cpp index ea982e5..471ecb5 100644 --- a/SPID/src/Distribute.cpp +++ b/SPID/src/Distribute.cpp @@ -24,6 +24,12 @@ namespace Distribute }, accumulatedForms); + for_each_form( + npcData, forms.perks, input, [&](const std::vector& a_perks) { + npc->AddPerks(a_perks, 1); + }, + accumulatedForms); + for_each_form( npcData, forms.spells, input, [&](const std::vector& a_spells) { npc->GetSpellList()->AddSpells(a_spells); @@ -36,12 +42,6 @@ namespace Distribute }, accumulatedForms); - for_each_form( - npcData, forms.perks, input, [&](const std::vector& a_perks) { - npc->AddPerks(a_perks, 1); - }, - accumulatedForms); - for_each_form( npcData, forms.shouts, input, [&](const std::vector& a_shouts) { npc->GetSpellList()->AddShouts(a_shouts);