finished quest pathing
This commit is contained in:
parent
568df4c7fe
commit
419e2eb4a4
17 changed files with 637 additions and 31 deletions
|
|
@ -23,6 +23,12 @@ public sealed class UIElements : RemoteObject
|
|||
/// <summary>Optional lookup for resolving quest state IDs to human-readable text.</summary>
|
||||
public QuestStateLookup? QuestStateLookup { get; set; }
|
||||
|
||||
/// <summary>Optional files container for resolving MapPins → WorldAreas.</summary>
|
||||
public FilesContainer? FilesContainer { get; set; }
|
||||
|
||||
/// <summary>Current area's WorldAreas.dat row address — set by GameMemoryReader for path resolution.</summary>
|
||||
public nint CurrentAreaRowAddress { get; set; }
|
||||
|
||||
public UIElements(MemoryContext ctx, MsvcStringReader strings) : base(ctx)
|
||||
{
|
||||
_strings = strings;
|
||||
|
|
@ -388,9 +394,51 @@ public sealed class UIElements : RemoteObject
|
|||
var isTracked = trackedMap.ContainsKey(questPtr);
|
||||
|
||||
string? stateText = null;
|
||||
string? mapPinsText = null;
|
||||
List<ConnectedAreaInfo>? targetAreas = null;
|
||||
List<string>? pathToTarget = null;
|
||||
|
||||
if (QuestStateLookup is not null && questPtr != 0 && stateId > 0)
|
||||
{
|
||||
QuestStateLookup.TryGetStateText(questPtr, stateId, out stateText);
|
||||
|
||||
// Resolve target areas via MapPins → WorldAreas
|
||||
if (FilesContainer is not null)
|
||||
{
|
||||
var questStateRow = QuestStateLookup.GetQuestStateRow(questPtr, stateId);
|
||||
if (questStateRow is not null)
|
||||
{
|
||||
mapPinsText = questStateRow.MapPinsText;
|
||||
var worldAreas = FilesContainer.GetMapPinWorldAreas(questStateRow);
|
||||
if (worldAreas.Count > 0)
|
||||
{
|
||||
targetAreas = worldAreas.Select(wa => new ConnectedAreaInfo
|
||||
{
|
||||
Id = wa.Id,
|
||||
Name = wa.Name,
|
||||
Act = wa.Act,
|
||||
IsTown = wa.IsTown,
|
||||
HasWaypoint = wa.HasWaypoint,
|
||||
MonsterLevel = wa.MonsterLevel,
|
||||
WorldAreaId = wa.WorldAreaId,
|
||||
}).ToList();
|
||||
|
||||
// BFS path from current area to first target area
|
||||
if (CurrentAreaRowAddress != 0)
|
||||
{
|
||||
var currentArea = FilesContainer.WorldAreas.GetByAddress(CurrentAreaRowAddress);
|
||||
if (currentArea is not null)
|
||||
{
|
||||
var path = FilesContainer.FindPath(currentArea, worldAreas[0]);
|
||||
if (path is { Count: > 1 })
|
||||
pathToTarget = path.Select(p => p.Name ?? p.Id ?? "?").ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.Add(new QuestLinkedEntry
|
||||
{
|
||||
InternalId = internalId,
|
||||
|
|
@ -400,6 +448,9 @@ public sealed class UIElements : RemoteObject
|
|||
StateText = stateText,
|
||||
IsTracked = isTracked,
|
||||
QuestDatPtr = questPtr,
|
||||
MapPinsText = mapPinsText,
|
||||
TargetAreas = targetAreas,
|
||||
PathToTarget = pathToTarget,
|
||||
});
|
||||
|
||||
walk = next;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue