fix(Core/Inventory): Don't destroy active quest items

This commit is contained in:
bash 2026-05-01 14:48:08 +02:00
parent c87297ff0a
commit 7318396256

View File

@ -29,6 +29,10 @@ void DestroyItemAction::DestroyItem(FindItemVisitor* visitor)
std::vector<Item*> items = visitor->GetResult();
for (Item* item : items)
{
// backstop: never drop an active quest item
if (bot->HasQuestForItem(item->GetTemplate()->ItemId))
continue;
std::ostringstream out;
out << chat->FormatItem(item->GetTemplate()) << " destroyed";
botAI->TellMaster(out);
@ -67,18 +71,11 @@ bool SmartDestroyItemAction::Execute(Event /*event*/)
return true;
}
// ITEM_USAGE_QUEST is excluded — those are still-needed quest items
std::vector<uint32> bestToDestroy = {ITEM_USAGE_NONE}; // First destroy anything useless.
if (!AI_VALUE(bool, "can sell") &&
AI_VALUE(
bool,
"should get money")) // We need money so quest items are less important since they can't directly be sold.
bestToDestroy.push_back(ITEM_USAGE_QUEST);
else // We don't need money so destroy the cheapest stuff.
{
bestToDestroy.push_back(ITEM_USAGE_VENDOR);
bestToDestroy.push_back(ITEM_USAGE_AH);
}
// If we still need room
bestToDestroy.push_back(