From 341537f5fb84353cd1d54933fc02e5ad2ac8aa08 Mon Sep 17 00:00:00 2001 From: Oiuv Date: Tue, 16 Apr 2024 19:22:00 +0800 Subject: [PATCH] Modify command `s` to prevent the accidental sale of all items --- src/strategy/actions/SellAction.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/strategy/actions/SellAction.cpp b/src/strategy/actions/SellAction.cpp index 2a15d08c..cafe9192 100644 --- a/src/strategy/actions/SellAction.cpp +++ b/src/strategy/actions/SellAction.cpp @@ -74,13 +74,18 @@ bool SellAction::Execute(Event event) return true; } - std::vector items = parseItems(text, ITERATE_ITEMS_IN_BAGS); - for (Item* item : items) + if (text == "all") { - Sell(item); + std::vector items = parseItems(text, ITERATE_ITEMS_IN_BAGS); + for (Item *item : items) + { + Sell(item); + } + return true; } - return true; + botAI->TellError("Usage: s gray/*/vendor/all"); + return false; } void SellAction::Sell(FindItemVisitor* visitor)