quests and queststate work
This commit is contained in:
parent
94b460bbc8
commit
445ae1387c
27 changed files with 3815 additions and 179 deletions
|
|
@ -144,6 +144,10 @@ public sealed class MemoryPoller : IDisposable
|
|||
_cache.AreaHash = state.AreaHash;
|
||||
_cache.AreaLevel = state.AreaLevel;
|
||||
_cache.CharacterName = state.Player.CharacterName;
|
||||
_cache.GameUiPtr = snap.GameUiPtr;
|
||||
_cache.UiQuestGroups = snap.UiQuestGroups;
|
||||
_cache.QuestLinkedList = snap.QuestLinkedList;
|
||||
_cache.QuestStates = snap.QuestStates;
|
||||
_cache.LatestState = state;
|
||||
_cache.ColdTickTimestamp = Environment.TickCount64;
|
||||
|
||||
|
|
@ -331,25 +335,42 @@ public sealed class MemoryPoller : IDisposable
|
|||
|
||||
if (snap.QuestFlags is { Count: > 0 })
|
||||
{
|
||||
state.ActiveQuests = snap.QuestFlags.Select(q => new QuestProgress
|
||||
{
|
||||
QuestStateIndex = q.QuestStateIndex,
|
||||
QuestName = q.QuestName,
|
||||
InternalId = q.InternalId,
|
||||
StateId = q.StateId,
|
||||
IsTracked = q.IsTracked,
|
||||
StateText = q.StateText,
|
||||
ProgressText = q.ProgressText,
|
||||
}).ToList();
|
||||
// StateId: 1=available/in-progress, 2=completed, 3+=special
|
||||
// Filter to non-completed quests for ActiveQuests
|
||||
state.ActiveQuests = snap.QuestFlags
|
||||
.Where(q => q.StateId != 2) // exclude completed
|
||||
.Select(q => new QuestProgress
|
||||
{
|
||||
QuestStateIndex = q.QuestStateIndex,
|
||||
QuestName = q.QuestName,
|
||||
InternalId = q.InternalId,
|
||||
StateId = q.StateId,
|
||||
IsTracked = q.IsTracked,
|
||||
StateText = q.StateText,
|
||||
ProgressText = q.ProgressText,
|
||||
}).ToList();
|
||||
|
||||
if (_lastQuestCount != snap.QuestFlags.Count)
|
||||
var activeCount = state.ActiveQuests.Count;
|
||||
if (_lastQuestCount != activeCount)
|
||||
{
|
||||
var indices = string.Join(", ", snap.QuestFlags.Select(q => q.QuestStateIndex));
|
||||
Log.Debug("Quest state indices ({Count}): [{Indices}]", snap.QuestFlags.Count, indices);
|
||||
_lastQuestCount = snap.QuestFlags.Count;
|
||||
Log.Debug("Active quests: {Active}/{Total} (filtered ES!=2)",
|
||||
activeCount, snap.QuestFlags.Count);
|
||||
_lastQuestCount = activeCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (snap.UiQuestGroups is { Count: > 0 })
|
||||
{
|
||||
state.UiQuests = snap.UiQuestGroups.Select(g => new UiQuestInfo
|
||||
{
|
||||
Title = g.Title,
|
||||
Objectives = g.Steps
|
||||
.Where(s => s.Text is not null)
|
||||
.Select(s => s.Text!)
|
||||
.ToList(),
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
if (snap.Terrain is not null)
|
||||
{
|
||||
state.Terrain = new WalkabilitySnapshot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue