Bots: pick Classic herbs and ore veins with the gathering spell, and a "gather on" order
On Classic an herb or ore vein is a chest locked by Herbalism or Mining, not a
type-50 gathering node, and since the 9 Nov fix a bot never opens one with a
plain click. So no bot picked any node, and an owner had no way to make an alt
gather (Discord 12 Nov). use_game_object now does what a player's right-click
does on such a node: it casts the bot's own open-lock spell (Herbalism 2366,
Mining 2575, best rank), which checks the skill level, the Mining Pick and the
node, gives the skill-up and opens the loot; the next use takes the loot.
Locks the bot has no skill, level or spell for stay closed.
The snapshot carries the node's lock skill and level, whether it is closed,
and the object whose loot the bot has open. idle:gather and gather_detour pick
these nodes; a companion does so only after its owner whispers "gather on"
("gather_all" for the group), out of combat, within 25 y of it and 30 y of the
player, holding the follow while it casts and loots. "clearprefs" turns it off.
(cherry picked from commit 09b5d4639f0e2977e03df18a035a18a8c7a2211f)
This commit is contained in:
@@ -5405,8 +5405,9 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
|
||||
ai->set_verbose_logging(false);
|
||||
ai->set_aoe_preference(false);
|
||||
ai->set_aoe_denied(false);
|
||||
ai->set_gather_ordered(false);
|
||||
Push(bot, WhisperIntent{sender->GetName(),
|
||||
"Clearprefs: focus, role, follow_distance, verbose, aoe reset."});
|
||||
"Clearprefs: focus, role, follow_distance, verbose, aoe, gather reset."});
|
||||
return true;
|
||||
}
|
||||
if (cmd == "clearprefs_all" || cmd == "clearprefsall" || cmd == "clear_prefs_all")
|
||||
@@ -5423,6 +5424,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
|
||||
ai->set_verbose_logging(false);
|
||||
ai->set_aoe_preference(false);
|
||||
ai->set_aoe_denied(false);
|
||||
ai->set_gather_ordered(false);
|
||||
});
|
||||
Push(bot, WhisperIntent{sender->GetName(),
|
||||
fmt::format("Clearprefs_all: reset on {} bot(s).", changed)});
|
||||
@@ -5514,6 +5516,49 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
|
||||
desired ? "Aoe: ON (area spells allowed)" : "Aoe: OFF (no spells that hit more than one enemy)"});
|
||||
return true;
|
||||
}
|
||||
if (cmd == "gather" || cmd == "gather_all" || cmd == "gatherall")
|
||||
{
|
||||
// gather on — picks the herbs and ore veins near it as it follows you, with the gathering skills it has (GatheringRules.cpp)
|
||||
// gather off — leaves them alone again (the default)
|
||||
// gather — toggle. gather_all sets every bot of the group. Memory only; clearprefs turns it off.
|
||||
bool const all = cmd != "gather";
|
||||
BotAI* self_ai = Services::Registry().ai(bot->GetGUID().GetCounter());
|
||||
if (!self_ai)
|
||||
{
|
||||
Push(bot, WhisperIntent{sender->GetName(), "Gather: bot not registered."});
|
||||
return true;
|
||||
}
|
||||
bool desired;
|
||||
if (parsed.tail == "on" || parsed.tail == "1") desired = true;
|
||||
else if (parsed.tail == "off" || parsed.tail == "0") desired = false;
|
||||
else desired = !self_ai->gather_ordered();
|
||||
if (all)
|
||||
{
|
||||
const uint32 changed = ForEachGroupBot(bot, [&](Player const* p)
|
||||
{
|
||||
if (BotAI* ai = Services::Registry().ai(p->GetGUID().GetCounter()))
|
||||
ai->set_gather_ordered(desired);
|
||||
});
|
||||
Push(bot, WhisperIntent{sender->GetName(),
|
||||
desired ? fmt::format("Gather: ON for {} bot(s).", changed) : fmt::format("Gather: OFF for {} bot(s).", changed)});
|
||||
return true;
|
||||
}
|
||||
self_ai->set_gather_ordered(desired);
|
||||
bool const herb = bot->HasSkill(SKILL_HERBALISM), mine = bot->HasSkill(SKILL_MINING);
|
||||
std::string reply;
|
||||
if (!desired)
|
||||
reply = "Gather: OFF";
|
||||
else if (herb && mine)
|
||||
reply = "Gather: ON (herbs and ore)";
|
||||
else if (herb)
|
||||
reply = "Gather: ON (herbs)";
|
||||
else if (mine)
|
||||
reply = "Gather: ON (ore)";
|
||||
else
|
||||
reply = "Gather: ON, but I have no Herbalism or Mining";
|
||||
Push(bot, WhisperIntent{sender->GetName(), reply});
|
||||
return true;
|
||||
}
|
||||
if (cmd == "setrole")
|
||||
{
|
||||
// /setrole tank|healer|dps|clear — pin the bot to a role
|
||||
|
||||
Reference in New Issue
Block a user