Quest potion support
This commit is contained in:
parent
d7058764d4
commit
8130a80e05
@ -158,6 +158,23 @@ inline void FetchSuppliesByForm(RE::TESForm* a_form)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool IsQuestItem(RE::TESForm* a_form, RE::TESQuest* questElixir, RE::TESQuest* questCuthbert)
|
||||||
|
{
|
||||||
|
if (questElixir) {
|
||||||
|
if (a_form->formID == 0x34D22 || a_form->formID == 0x727E0 || a_form->formID == 0x3AD6F || a_form->formID == 0x59B86) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (questCuthbert) {
|
||||||
|
if (a_form->formID == 0x891AF || a_form->formID == 0x34C5D || a_form->formID == 0x34D32) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
inline void ReturnSupplies()
|
inline void ReturnSupplies()
|
||||||
{
|
{
|
||||||
if (!bSuppliesFetched) {
|
if (!bSuppliesFetched) {
|
||||||
@ -171,9 +188,22 @@ inline void ReturnSupplies()
|
|||||||
const auto chest = GetChest();
|
const auto chest = GetChest();
|
||||||
const auto playerRef = RE::PlayerCharacter::GetSingleton();
|
const auto playerRef = RE::PlayerCharacter::GetSingleton();
|
||||||
|
|
||||||
|
auto questElixir = RE::TESDataHandler::GetSingleton()->LookupForm<RE::TESQuest>(0x1C82F, "Enderal - Forgotten Stories.esm"); // FS_NQ05
|
||||||
|
auto questCuthbert = RE::TESDataHandler::GetSingleton()->LookupForm<RE::TESQuest>(0x1CA09, "Enderal - Forgotten Stories.esm"); // FS_NQ07
|
||||||
|
|
||||||
|
if (questElixir->currentStage != 35) {
|
||||||
|
questElixir = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (questCuthbert->currentStage != 115) {
|
||||||
|
questCuthbert = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& item : supplyCount) {
|
for (auto& item : supplyCount) {
|
||||||
|
if (!IsQuestItem(item.first, questElixir, questCuthbert)) {
|
||||||
playerRef->RemoveItem(item.first->As<RE::TESBoundObject>(), item.second, iRemoveReason, nullptr, chest, 0, 0);
|
playerRef->RemoveItem(item.first->As<RE::TESBoundObject>(), item.second, iRemoveReason, nullptr, chest, 0, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
supplyCount.clear();
|
supplyCount.clear();
|
||||||
|
|
||||||
if (GetSettings().at("StoreInventorySupplies")) {
|
if (GetSettings().at("StoreInventorySupplies")) {
|
||||||
@ -199,9 +229,7 @@ inline void ReturnSupplies()
|
|||||||
|
|
||||||
const auto keywords = component->obj->As<RE::BGSKeywordForm>();
|
const auto keywords = component->obj->As<RE::BGSKeywordForm>();
|
||||||
|
|
||||||
if (component->obj->Is(RE::FormType::Ingredient)) {
|
if (component->obj->Is(RE::FormType::Misc) && !component->obj->IsGold() && !component->obj->IsLockpick()) {
|
||||||
suppliesToStore.insert(component->obj);
|
|
||||||
} else if (component->obj->Is(RE::FormType::Misc) && !component->obj->IsGold() && !component->obj->IsLockpick()) {
|
|
||||||
if (keywords->HasKeyword(kOreIngot) || keywords->HasKeyword(kAnimalPart) || keywords->HasKeyword(kAnimalHide) || keywords->HasKeyword(kFirewood) || keywords->HasKeyword(kTool) || keywords->HasKeyword(kClutter) || keywords->HasKeyword(kFoodRaw)) {
|
if (keywords->HasKeyword(kOreIngot) || keywords->HasKeyword(kAnimalPart) || keywords->HasKeyword(kAnimalHide) || keywords->HasKeyword(kFirewood) || keywords->HasKeyword(kTool) || keywords->HasKeyword(kClutter) || keywords->HasKeyword(kFoodRaw)) {
|
||||||
suppliesToStore.insert(component->obj);
|
suppliesToStore.insert(component->obj);
|
||||||
}
|
}
|
||||||
@ -214,12 +242,12 @@ inline void ReturnSupplies()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto inv = playerRef->GetInventory([&](RE::TESBoundObject& a_form) {
|
const auto inv = playerRef->GetInventory([&](RE::TESBoundObject& a_form) {
|
||||||
return suppliesToStore.contains(&a_form);
|
return a_form.Is(RE::FormType::Ingredient) || suppliesToStore.contains(&a_form);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const auto& [item, data] : inv) {
|
for (const auto& [item, data] : inv) {
|
||||||
const auto& [count, entry] = data;
|
const auto& [count, entry] = data;
|
||||||
if (count > 0 && !entry->IsFavorited() && !entry->IsQuestObject()) {
|
if (count > 0 && !entry->IsFavorited() && !entry->IsQuestObject() && !IsQuestItem(item, questElixir, questCuthbert)) {
|
||||||
playerRef->RemoveItem(item, count, iRemoveReason, nullptr, chest, 0, 0);
|
playerRef->RemoveItem(item, count, iRemoveReason, nullptr, chest, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user