mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
inventory and use item
This commit is contained in:
@@ -282,10 +282,12 @@ std::vector<Item*> InventoryAction::parseItems(std::string const text, IterateIt
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
found.insert(visitor.GetResult().begin(), visitor.GetResult().end());
|
||||
}
|
||||
|
||||
FindUsableNamedItemVisitor visitor(bot);
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
found.insert(visitor.GetResult().begin(), visitor.GetResult().end());
|
||||
if (text == "")
|
||||
{
|
||||
FindUsableNamedItemVisitor visitor(bot);
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
found.insert(visitor.GetResult().begin(), visitor.GetResult().end());
|
||||
}
|
||||
|
||||
uint32 quality = chat->parseItemQuality(text);
|
||||
if (quality != MAX_ITEM_QUALITY)
|
||||
|
||||
@@ -19,19 +19,7 @@ bool UseItemAction::Execute(Event event)
|
||||
|
||||
if (gos.empty())
|
||||
{
|
||||
if (items.size() > 1)
|
||||
{
|
||||
std::vector<Item*>::iterator i = items.begin();
|
||||
Item* item = *i++;
|
||||
Item* itemTarget = *i;
|
||||
|
||||
if (item->IsPotion() || item->GetTemplate()->Class == ITEM_CLASS_CONSUMABLE)
|
||||
return UseItemAuto(item);
|
||||
else
|
||||
return UseItemOnItem(item, itemTarget);
|
||||
}
|
||||
else if (!items.empty())
|
||||
return UseItemAuto(*items.begin());
|
||||
return UseItemAuto(*items.begin());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ class UseRandomRecipe : public UseItemAction
|
||||
|
||||
bool isUseful() override;
|
||||
bool isPossible() override;
|
||||
bool Execute(Event event);
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class UseRandomQuestItem : public UseItemAction
|
||||
|
||||
Reference in New Issue
Block a user