Snapshot for release 2026.11.2.1 (internal 03dbb32)

This commit is contained in:
Tom Bohar 2026-11-02 03:33:34 -05:00
commit 79cbb84d61
77 changed files with 8622 additions and 224 deletions

View file

@ -46,7 +46,9 @@ public sealed partial class RynthNavPlugin
long now = NowMs;
if (!force && now < _nextAvoidMs) return;
_nextAvoidMs = now + AvoidRefreshMs;
if (!_avoidPortals) { _avoid.Clear(); return; }
// What the walk ran into on this leg (RynthNavPlugin.Blocked.cs) is kept out of like a
// portal, whatever the portals setting.
if (!_avoidPortals) { _avoid.Set(_blockedSpots, Array.Empty<PortalAvoid.Spot>()); return; }
IReadOnlyList<PortalAvoid.Spot> atlasPortals = AtlasPortalSpots();
var map = new List<PortalAvoid.Spot>();
@ -54,27 +56,38 @@ public sealed partial class RynthNavPlugin
if (Math.Abs(sp.X - _wx) < AvoidNearUnits && Math.Abs(sp.Y - _wy) < AvoidNearUnits) map.Add(sp);
var live = new List<PortalAvoid.Spot>();
if (Host.HasGetLiveObjectIds)
{
foreach (uint id in Host.GetLiveObjectIds())
{
if (!Host.TryGetItemType(id, out uint type) || (type & ItemTypePortal) == 0) continue;
if (!Host.TryGetObjectPosition(id, out uint cell, out float x, out float y, out _) || cell == 0) continue;
double wx = ((cell >> 24) & 0xFF) * 192.0 + x, wy = ((cell >> 16) & 0xFF) * 192.0 + y;
if (Math.Abs(wx - _wx) > AvoidNearUnits || Math.Abs(wy - _wy) > AvoidNearUnits) continue;
Host.TryGetObjectName(id, out string name);
live.Add(new PortalAvoid.Spot(wx, wy, PortalAvoid.LiveRadius, name ?? ""));
}
}
LivePortalSpots(live, _wx - AvoidNearUnits, _wy - AvoidNearUnits, _wx + AvoidNearUnits, _wy + AvoidNearUnits);
// The step's own target: walking into a portal (a route's portal step, a dungeon's entrance).
bool portalLeg = _route != null && _routeIdx < _route.Count && _route[_routeIdx].UsePortal;
int portals = live.Count, mapPortals = map.Count;
map.AddRange(_blockedSpots); // after the live portals: one inside a live portal's circle adds nothing
if (portalLeg) _avoid.Set(live, map, _gotoTew, _gotoTns, AvoidTargetUnits);
else _avoid.Set(live, map);
if (_avoid.Count != _avoidLogged)
{
_avoidLogged = _avoid.Count;
Host.Log($"[RynthNav] avoid: {_avoid.Count} portal(s) near you to keep out of ({live.Count} seen, {map.Count} from the Atlas){(portalLeg ? "; the step's own portal excepted" : "")}");
string blocked = _blockedSpots.Count > 0 ? $", {_blockedSpots.Count} spot(s) it ran into" : "";
Host.Log($"[RynthNav] avoid: {_avoid.Count} spot(s) near you to keep out of ({portals} portal(s) seen, {mapPortals} from the Atlas{blocked}){(portalLeg ? "; the step's own portal excepted" : "")}");
}
}
/// <summary>
/// Every portal object the client knows standing in the box (world units, edges included), as
/// circles of <see cref="PortalAvoid.LiveRadius"/>: exact positions. The walker's set and
/// FindPathEx's (RynthNavPlugin.PathApi.cs) both start from these.
/// </summary>
private void LivePortalSpots(List<PortalAvoid.Spot> into, double minX, double minY, double maxX, double maxY)
{
if (!Host.HasGetLiveObjectIds) return;
foreach (uint id in Host.GetLiveObjectIds())
{
if (!Host.TryGetItemType(id, out uint type) || (type & ItemTypePortal) == 0) continue;
if (!Host.TryGetObjectPosition(id, out uint cell, out float x, out float y, out _) || cell == 0) continue;
double wx = ((cell >> 24) & 0xFF) * 192.0 + x, wy = ((cell >> 16) & 0xFF) * 192.0 + y;
if (wx < minX || wx > maxX || wy < minY || wy > maxY) continue;
Host.TryGetObjectName(id, out string name);
into.Add(new PortalAvoid.Spot(wx, wy, PortalAvoid.LiveRadius, name ?? ""));
}
}