Added soul gems support
This commit is contained in:
parent
76d611147a
commit
bb459ce135
@ -14,6 +14,7 @@ inline std::map<std::string, std::any> g_settings{
|
||||
{ "bPickupArrows", true },
|
||||
{ "bPickupFlora", true },
|
||||
{ "bPickupIngredients", true },
|
||||
{ "bPickupSoulGems", true },
|
||||
};
|
||||
|
||||
auto EventListener::GetSingleton() -> EventListener*
|
||||
@ -45,30 +46,29 @@ auto EventListener::ProcessEvent(
|
||||
return RE::BSEventNotifyControl::kContinue;
|
||||
}
|
||||
|
||||
const auto itemType = baseObj->GetFormType();
|
||||
|
||||
if (!IsValidType(itemType)) {
|
||||
if (!IsValidType(baseObj->GetFormType())) {
|
||||
return RE::BSEventNotifyControl::kContinue;
|
||||
}
|
||||
|
||||
RE::TESBoundObject* produceItem = nullptr;
|
||||
|
||||
bool bIsCoinPouch = IsCoinPouch(baseObj);
|
||||
bool bIsGold = std::any_cast<bool>(g_settings["bPickupGold"]) && (bIsCoinPouch || baseObj->IsGold());
|
||||
bool bIsLockpick = std::any_cast<bool>(g_settings["bPickupLockpicks"]) && baseObj->IsLockpick();
|
||||
bool bIsGold = (bIsCoinPouch || baseObj->IsGold()) && std::any_cast<bool>(g_settings["bPickupGold"]);
|
||||
bool bIsLockpick = baseObj->IsLockpick() && std::any_cast<bool>(g_settings["bPickupLockpicks"]);
|
||||
bool bIsSoulGem = baseObj->IsSoulGem() && std::any_cast<bool>(g_settings["bPickupSoulGems"]);
|
||||
|
||||
RE::BGSKeywordForm* keywordForm = (baseObj->Is(RE::FormType::Misc) && std::any_cast<bool>(g_settings["bPickupMaterials"])) ? baseObj->As<RE::BGSKeywordForm>() : nullptr;
|
||||
bool bIsGem = keywordForm && keywordForm->HasKeyword(keywordGem);
|
||||
bool bIsHide = keywordForm && keywordForm->HasKeyword(keywordHide);
|
||||
bool bIsIngot = keywordForm && keywordForm->HasKeyword(keywordIngot);
|
||||
|
||||
bool bIsAmmo = std::any_cast<bool>(g_settings["bPickupArrows"]) && (baseObj->IsAmmo() || baseObj->Is(RE::FormType::Projectile)) && baseObj->GetPlayable();
|
||||
bool bIsAmmo = (baseObj->IsAmmo() || baseObj->Is(RE::FormType::Projectile)) && baseObj->GetPlayable() && std::any_cast<bool>(g_settings["bPickupArrows"]);
|
||||
|
||||
bool bIsFlora = std::any_cast<bool>(g_settings["bPickupFlora"]) && !bIsCoinPouch && baseObj->Is(RE::FormType::Flora) && (produceItem = baseObj->As<RE::TESFlora>()->produceItem);
|
||||
bool bIsTree = std::any_cast<bool>(g_settings["bPickupFlora"]) && baseObj->Is(RE::FormType::Tree) && (produceItem = baseObj->As<RE::TESObjectTREE>()->produceItem);
|
||||
bool bIsIngredient = std::any_cast<bool>(g_settings["bPickupIngredients"]) && baseObj->Is(RE::FormType::Ingredient);
|
||||
bool bIsFlora = !bIsCoinPouch && baseObj->Is(RE::FormType::Flora) && std::any_cast<bool>(g_settings["bPickupFlora"]) && (produceItem = baseObj->As<RE::TESFlora>()->produceItem);
|
||||
bool bIsTree = baseObj->Is(RE::FormType::Tree) && std::any_cast<bool>(g_settings["bPickupFlora"]) && (produceItem = baseObj->As<RE::TESObjectTREE>()->produceItem);
|
||||
bool bIsIngredient = baseObj->Is(RE::FormType::Ingredient) && std::any_cast<bool>(g_settings["bPickupIngredients"]);
|
||||
|
||||
if (!bIsGold && !bIsLockpick && !bIsGem && !bIsHide && !bIsIngot && !bIsAmmo && !bIsFlora && !bIsTree && !bIsIngredient) {
|
||||
if (!bIsGold && !bIsLockpick && !bIsSoulGem && !bIsGem && !bIsHide && !bIsIngot && !bIsAmmo && !bIsFlora && !bIsTree && !bIsIngredient) {
|
||||
return RE::BSEventNotifyControl::kContinue;
|
||||
}
|
||||
|
||||
@ -109,6 +109,11 @@ auto EventListener::ProcessEvent(
|
||||
bAdd = true;
|
||||
}
|
||||
|
||||
} else if (bIsSoulGem) {
|
||||
if (a_refBase->IsSoulGem()) {
|
||||
bAdd = true;
|
||||
}
|
||||
|
||||
} else if (bIsAmmo) {
|
||||
if ((a_refBase->IsAmmo() || a_refBase->Is(RE::FormType::Projectile)) && a_refBase->GetPlayable()) {
|
||||
bAdd = true;
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
RE::FormType::Tree,
|
||||
RE::FormType::Ammo,
|
||||
RE::FormType::Ingredient,
|
||||
RE::FormType::SoulGem,
|
||||
RE::FormType::Projectile,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user