mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Target Info
add target info to ClientState
This commit is contained in:
parent
8b749be730
commit
d9c8eeedd3
3 changed files with 38 additions and 0 deletions
|
|
@ -97,6 +97,11 @@ namespace Dalamud.Game.ClientState
|
|||
/// </summary>
|
||||
public Condition Condition;
|
||||
|
||||
/// <summary>
|
||||
/// The class facilitating target data access
|
||||
/// </summary>
|
||||
public Targets Targets;
|
||||
|
||||
/// <summary>
|
||||
/// Set up client state access.
|
||||
/// </summary>
|
||||
|
|
@ -121,6 +126,8 @@ namespace Dalamud.Game.ClientState
|
|||
|
||||
this.Condition = new Condition( Address );
|
||||
|
||||
this.Targets = new Targets(dalamud, Address);
|
||||
|
||||
Log.Verbose("SetupTerritoryType address {SetupTerritoryType}", Address.SetupTerritoryType);
|
||||
|
||||
this.setupTerritoryTypeHook = new Hook<SetupTerritoryTypeDelegate>(Address.SetupTerritoryType,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace Dalamud.Game.ClientState
|
|||
public IntPtr LocalContentId { get; private set; }
|
||||
public IntPtr JobGaugeData { get; private set; }
|
||||
public IntPtr KeyboardState { get; private set; }
|
||||
public IntPtr TargetManager { get; private set; }
|
||||
|
||||
// Functions
|
||||
public IntPtr SetupTerritoryType { get; private set; }
|
||||
|
|
@ -35,6 +36,8 @@ namespace Dalamud.Game.ClientState
|
|||
PartyListUpdate = sig.ScanText("E8 ?? ?? ?? ?? 49 8B D4 4C 8D 87 ?? ?? ?? ??");
|
||||
|
||||
ConditionFlags = sig.GetStaticAddressFromSig("48 8D 0D ?? ?? ?? ?? BA ?? ?? ?? ?? 45 33 C0");
|
||||
|
||||
TargetManager = sig.GetStaticAddressFromSig("48 8B 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? FF 50 ?? 48 85 DB", 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
28
Dalamud/Game/ClientState/Targets.cs
Normal file
28
Dalamud/Game/ClientState/Targets.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Dalamud.Game.ClientState.Actors.Types;
|
||||
|
||||
namespace Dalamud.Game.ClientState {
|
||||
public sealed class Targets {
|
||||
private ClientStateAddressResolver Address { get; }
|
||||
private Dalamud dalamud;
|
||||
|
||||
public Actor CurrentTarget => GetActorByOffset(0x80);
|
||||
public Actor MouseOverTarget => GetActorByOffset(0xD0);
|
||||
public Actor FocusTarget => GetActorByOffset(0xF8);
|
||||
public Actor PreviousTarget => GetActorByOffset(0x110);
|
||||
|
||||
internal Targets(Dalamud dalamud, ClientStateAddressResolver addressResolver) {
|
||||
this.dalamud = dalamud;
|
||||
Address = addressResolver;
|
||||
}
|
||||
|
||||
private Actor GetActorByOffset(int offset) {
|
||||
if (Address.TargetManager == IntPtr.Zero) return null;
|
||||
var actorAddress = Marshal.ReadIntPtr(Address.TargetManager + offset);
|
||||
if (actorAddress == IntPtr.Zero) return null;
|
||||
var data = Marshal.PtrToStructure<Structs.Actor>(actorAddress);
|
||||
return new Actor(actorAddress, data, this.dalamud);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue