Tweak automation

This commit is contained in:
郑佩茹
2022-09-22 17:22:19 -06:00
parent 1e490e80e4
commit 88d81c7a31
4 changed files with 31 additions and 3 deletions

View File

@@ -47,6 +47,27 @@ bool SmartDestroyItemAction::Execute(Event event)
if (bagSpace < 90)
return false;
// only destoy grey items if with real player/guild
if (botAI->HasRealPlayerMaster() && botAI->IsInRealGuild())
{
std::set<Item*> items;
FindItemsToTradeByQualityVisitor visitor(ITEM_QUALITY_POOR, 5);
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
items.insert(visitor.GetResult().begin(), visitor.GetResult().end());
for (auto& item : items)
{
FindItemByIdVisitor visitor(item->GetTemplate()->ItemId);
DestroyItem(&visitor);
bagSpace = AI_VALUE(uint8, "bag space");
if (bagSpace < 90)
return true;
}
return true;
}
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.