mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
fix(Core/Inventory): Don't destroy active quest items
This commit is contained in:
parent
c87297ff0a
commit
7318396256
@ -29,6 +29,10 @@ void DestroyItemAction::DestroyItem(FindItemVisitor* visitor)
|
|||||||
std::vector<Item*> items = visitor->GetResult();
|
std::vector<Item*> items = visitor->GetResult();
|
||||||
for (Item* item : items)
|
for (Item* item : items)
|
||||||
{
|
{
|
||||||
|
// backstop: never drop an active quest item
|
||||||
|
if (bot->HasQuestForItem(item->GetTemplate()->ItemId))
|
||||||
|
continue;
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << chat->FormatItem(item->GetTemplate()) << " destroyed";
|
out << chat->FormatItem(item->GetTemplate()) << " destroyed";
|
||||||
botAI->TellMaster(out);
|
botAI->TellMaster(out);
|
||||||
@ -67,18 +71,11 @@ bool SmartDestroyItemAction::Execute(Event /*event*/)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ITEM_USAGE_QUEST is excluded — those are still-needed quest items
|
||||||
std::vector<uint32> bestToDestroy = {ITEM_USAGE_NONE}; // First destroy anything useless.
|
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_VENDOR);
|
||||||
bestToDestroy.push_back(ITEM_USAGE_AH);
|
bestToDestroy.push_back(ITEM_USAGE_AH);
|
||||||
}
|
|
||||||
|
|
||||||
// If we still need room
|
// If we still need room
|
||||||
bestToDestroy.push_back(
|
bestToDestroy.push_back(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user