Bots: .playerbot groundz lists the standing surfaces under a point

Incinerator Gar'im stands high in the canyon wall of Render's Valley
(Discord 2026-11-04). To choose or check a spawn height from the console,
with no player or bot on the map, the new command lists every surface under
a point from the top down: terrain plus building and cave geometry, so a
ledge, a cave floor and the valley floor each show as their own line.

(cherry picked from commit 3628a1e631c0b973e438c63d00ce1ed51d90e893)
This commit is contained in:
Karrz1
2026-11-12 19:23:58 +00:00
parent e12c0add4e
commit 4e6ea306f5
@@ -648,6 +648,7 @@ public:
{ "casttest", HandleCastTest, rbac::RBAC_PERM_COMMAND_GM, Console::Yes },
{ "xpprobe", HandleXpProbe, rbac::RBAC_PERM_COMMAND_GM, Console::Yes },
{ "questchainprobe", HandleQuestChainProbe, rbac::RBAC_PERM_COMMAND_GM, Console::Yes },
{ "groundz", HandleGroundZ, rbac::RBAC_PERM_COMMAND_GM, Console::Yes },
{ "formprobe", HandleFormProbe, rbac::RBAC_PERM_COMMAND_GM, Console::Yes },
{ "equipprobe", HandleEquipProbe, rbac::RBAC_PERM_COMMAND_GM, Console::Yes },
{ "gearpick", HandleGearPick, rbac::RBAC_PERM_COMMAND_GM, Console::Yes },
@@ -5280,6 +5281,36 @@ public:
return true;
}
// .playerbot groundz <map> <x> <y> [<z to search down from>]
// Lists every standing surface under a point, top down (terrain .map plus VMap: ledges, cave roofs and floors, the valley
// floor), with no player or bot needed, so a spawn's height can be checked or chosen from the console. A creature spawned off
// these surfaces floats or sits inside the rock (Incinerator Gar'im, 2026-11-04).
static bool HandleGroundZ(ChatHandler* handler, uint32 mapId, float x, float y, Optional<float> fromZ)
{
if (!sMapStore.LookupEntry(mapId) || !Trinity::IsValidMapCoord(x, y))
{
handler->SendSysMessage("groundz: no such map or point");
handler->SetSentErrorMessage(true);
return false;
}
std::shared_ptr<TerrainInfo> terrain = sTerrainMgr.LoadTerrain(mapId);
PhaseShift const& phaseShift = PhasingHandler::GetEmptyPhaseShift();
float const gridZ = terrain->GetGridHeight(phaseShift, mapId, x, y);
handler->PSendSysMessage("groundz: map %u (%.2f, %.2f) terrain (.map) %.2f", mapId, x, y, gridZ);
float z = fromZ.value_or(2000.0f);
for (uint32 i = 1; i <= 10; ++i)
{
float const surface = terrain->GetStaticHeight(phaseShift, mapId, x, y, z, true, 4000.0f);
if (surface <= INVALID_HEIGHT)
break;
handler->PSendSysMessage("groundz: surface %u at %.2f", i, surface);
z = surface - 3.0f; // under this floor, down to the next one
}
return true;
}
// .playerbot questchainprobe <player> <first quest id>
// Walks a quest chain the way a player meets it: for each quest it reports who starts it (creatures, objects, items), every
// requirement check the player fails, then takes, completes and rewards it and looks for what comes next (the reward's next