Merge PR 397: bot channel posts name the mobs actually nearby
Ubuntu x64 / build (clang-17, clang++-17, <nil>, 1) (push) Canceled after 0s
Ubuntu x64 / build (clang-17, clang++-17, ccache, 0) (push) Canceled after 0s
Ubuntu x64 / build (gcc-13, g++-13, <nil>, 1) (push) Canceled after 0s
macOS arm64 / build (push) Canceled after 0s
Windows x64 / build (push) Canceled after 0s

Brings in Zapgun's local fauna line for bot channel posts (PR #397).
This commit is contained in:
Karrz1
2026-11-24 00:51:23 +00:00
committed by GitHub
@@ -788,6 +788,29 @@ std::string CreatureName(NearbyUnit const& u)
return {};
}
// The creature names the bot actually sees around it (its snapshot's nearby enemies, resolved
// through their templates): the ground truth a channel post may name, so the model's "a dry joke
// about the mobs here" speaks of real ones and not of a creature that lives in another zone.
// Critters and players are not worth naming.
std::string LocalFauna(BotSnapshotView const& s)
{
std::string out;
for (NearbyUnit const& u : s.nearby_enemies())
{
CreatureTemplate const* ct = (u.is_player || !u.entry) ? nullptr : sObjectMgr->GetCreatureTemplate(u.entry);
if (!ct || ct->type == CREATURE_TYPE_CRITTER || ct->Name.empty())
continue;
if (out.find(ct->Name) == std::string::npos)
{
out += out.empty() ? std::string() : ", ";
out += ct->Name;
if (out.size() > 160)
break;
}
}
return out;
}
// %my_role: the bot's spec and class ("Protection Warrior"), ike3's formatClass(bot, spec).
std::string RoleName(BotSnapshotView const& s)
{
@@ -1315,6 +1338,11 @@ void Suggest(BotAI& ai, BotSnapshotView const& s, BotIntentEmitter& em, uint32 n
detail = "complain about the drop rate on your quest " + quest_title;
detail += "; " + me + ". Not about grinding spots";
}
// Ground the post in what the bot actually sees: the mob names around it. Without this the
// model joked about creatures its zone does not have (the same failure VanillaLevelPlaces
// fixed for zone names).
if (std::string const fauna = LocalFauna(s); !fauna.empty())
detail += " The creatures around you here: " + fauna + ".";
if (BotBridge::QueuePost(s.bot_id(), sug.channel, what, detail, text, link.empty() ? std::string() : name_of(link), link))
return;
}