skills working somewhat
This commit is contained in:
parent
a8c43ba7e2
commit
8a0e4bb481
22 changed files with 4227 additions and 161 deletions
|
|
@ -20,6 +20,7 @@ public sealed class MemoryPoller : IDisposable
|
|||
private Thread? _thread;
|
||||
private volatile bool _running;
|
||||
private bool _disposed;
|
||||
private int _lastQuestCount;
|
||||
|
||||
// Cached resolved addresses (re-resolved on each cold tick)
|
||||
private nint _cameraMatrixAddr;
|
||||
|
|
@ -276,12 +277,23 @@ public sealed class MemoryPoller : IDisposable
|
|||
ManaTotal = snap.ManaTotal,
|
||||
EsCurrent = snap.EsCurrent,
|
||||
EsTotal = snap.EsTotal,
|
||||
Skills = snap.PlayerSkills?.Select((s, i) => new SkillState
|
||||
Skills = snap.PlayerSkills?
|
||||
.Where(s => s.SkillBarSlot >= 0)
|
||||
.Select(s => new SkillState
|
||||
{
|
||||
SlotIndex = i,
|
||||
Name = s.Name,
|
||||
SlotIndex = s.SkillBarSlot,
|
||||
SkillId = s.Id,
|
||||
Id2 = s.Id2,
|
||||
Name = StripPlayerSuffix(s.Name),
|
||||
InternalName = s.InternalName,
|
||||
UseStage = s.UseStage,
|
||||
CastType = s.CastType,
|
||||
CooldownTimeMs = s.CooldownTimeMs,
|
||||
SkillBarSlot = s.SkillBarSlot,
|
||||
ChargesCurrent = Math.Max(0, s.MaxUses - s.ActiveCooldowns),
|
||||
ChargesMax = s.MaxUses,
|
||||
CooldownRemaining = s.ActiveCooldowns > 0 ? s.CooldownTimeMs / 1000f : 0f,
|
||||
CanBeUsed = s.CanBeUsed,
|
||||
CooldownRemaining = s.ActiveCooldowns > 0 ? s.CooldownTimeMs : 0,
|
||||
}).ToList() ?? [],
|
||||
};
|
||||
|
||||
|
|
@ -321,11 +333,21 @@ public sealed class MemoryPoller : IDisposable
|
|||
{
|
||||
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();
|
||||
|
||||
if (_lastQuestCount != snap.QuestFlags.Count)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (snap.Terrain is not null)
|
||||
|
|
@ -341,6 +363,14 @@ public sealed class MemoryPoller : IDisposable
|
|||
return state;
|
||||
}
|
||||
|
||||
private static string? StripPlayerSuffix(string? name)
|
||||
{
|
||||
if (name is null) return null;
|
||||
if (name.EndsWith("Player", StringComparison.Ordinal))
|
||||
return name[..^6];
|
||||
return name;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue