Improve AdventureBot travel recovery and destination eligibility
GCC PCH / build (push) Waiting to run
clang PCH / build (push) Canceled after 0s

This commit is contained in:
Nico committed 2026-10-29 11:10:27 +01:00
1 parent 321a28640c
commit 49712aadfe
50 files changed
+984 -44

No files matched your search

@@ -578,7 +578,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
return false;
}
if (!sAdventureAreaMgr->AllowsNode(player,destinationItr->second))
if (!locationGoal && !sAdventureAreaMgr->AllowsNode(player,destinationItr->second))
{ error="destination node denied by area/node catalog"; return false; }
if (locationGoal)
{
@@ -587,13 +587,20 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
{ error="destination location denied by area catalog"; return false; }
}
bool const flightEnabled = sClientlessFlightMgr->Enabled(player);
auto flightCost = [&](ClientlessTravelNode const& from, uint32 map, float x, float y, float z)
auto flightCost = [&](ClientlessTravelNode const& from, uint32 map, float x, float y, float z, bool access = false)
{
if (!flightEnabled || from.MapId != map)
return std::numeric_limits<float>::infinity();
Position a,b; a.Relocate(from.X,from.Y,from.Z,from.O); b.Relocate(x,y,z);
auto begin=std::chrono::steady_clock::now();++trace.FlightCalls;
float result=sClientlessFlightMgr->Estimate(player,map,a,b);
float result=sClientlessFlightMgr->Estimate(player,map,a,b,access);
if(access && std::isfinite(result))
{
float distance=a.GetExactDist(&b);
if(distance<20)result=std::numeric_limits<float>::infinity();
else result=(sClientlessFlightMgr->Preferred(player,map,a) || sClientlessFlightMgr->Preferred(player,map,b))?
40+distance*0.4f:180+distance*1.5f;
}
trace.FlightUs+=std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now()-begin).count();
return result;
};
@@ -684,6 +691,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
: std::numeric_limits<float>::infinity();
};
std::unordered_set<std::string> flightRoots;
uint32 startCount = 0;
for (auto const& pair : _nodes)
{
@@ -712,6 +720,14 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
bool const reachable = entryNav.Calculated && entryNav.Complete &&
entryNav.FinalDistance <= 1.5f && entryNav.MaxSegmentLength <= 8.0f &&
entryNav.MaxZDelta <= 5.0f && entryNav.PathLength <= 500.0f;
ClientlessTravelNode departure;
departure.MapId=player->GetMapId();departure.X=player->GetPositionX();departure.Y=player->GetPositionY();departure.Z=player->GetPositionZ();
float air=blockedBridgeKeys && blockedBridgeKeys->count("flight:flight_departure->"+node.Key)?
std::numeric_limits<float>::infinity():flightCost(departure,node.MapId,node.X,node.Y,node.Z,!reachable);
if(std::isfinite(air) && (!reachable || air<entryNav.PathLength))
{flightRoots.insert(node.Key);startCost=air;}
else
{
// VCORE_C819_DEFERRED_START_NODES: incomplete is not the same as unsafe.
// The endpoint is handled by the executor, not counted as arrival at node.
bool const partial = entryNav.Calculated &&
@@ -736,6 +752,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
startCost = entryNav.PathLength;
if (!reachable)
startCost += 100000.0f; // Tier 2 only: deferred roots rank after reachable roots
}
}
State state{ node.Key, false };
std::string const key = stateKey(state);
@@ -1670,12 +1687,18 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
item.EntryPoint.X, item.EntryPoint.Y, item.EntryPoint.Z,
item.EdgeDatabaseId, item.GroundStartIndex);
}
if(route.empty() && item.IncomingEdgeType=="start" && flightRoots.count(item.Value.Node))
{
ClientlessTravelRouteStep departure;departure.NodeKey="flight_departure";departure.NodeType="ground";departure.EdgeType="start";
departure.MapId=player->GetMapId();departure.X=player->GetPositionX();departure.Y=player->GetPositionY();departure.Z=player->GetPositionZ();
route.push_back(departure);
}
ClientlessTravelNode const& node = _nodes.at(item.Value.Node);
ClientlessTravelRouteStep step;
step.NodeKey = node.Key;
step.NodeType = node.Type;
step.WorldPointKey = node.WorldPointKey;
step.EdgeType = item.IncomingEdgeType;
step.EdgeType = item.IncomingEdgeType=="start" && flightRoots.count(item.Value.Node)?"free_flight":item.IncomingEdgeType;
step.EdgeDatabaseId = item.EdgeDatabaseId;
step.EdgeReverse = item.EdgeReverse;
if (item.VirtualGroundEntry)