-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGameObjectExtensions.cs
More file actions
32 lines (25 loc) · 922 Bytes
/
GameObjectExtensions.cs
File metadata and controls
32 lines (25 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Dalamud.Game.ClientState.Objects.Types;
using FFXIVClientStructs.FFXIV.Common.Math;
using System;
namespace DrahsidLib;
public unsafe static class GameObjectExtensions {
const int CursorHeightOffset = 0x124;
const float HeadHeightOffset = -0.2f;
public unsafe static float GetCursorHeight(this IGameObject thisx)
{
return Marshal.PtrToStructure<float>(thisx.Address + CursorHeightOffset);
}
public unsafe static bool TargetIsTargetable(this IGameObject thisx) {
if (thisx.TargetObject == null) {
return false;
}
CSGameObject* targetobj = (CSGameObject*)thisx.TargetObject.Address;
return targetobj->GetIsTargetable();
}
public unsafe static Vector3 GetHeadPosition(this IGameObject thisx)
{
Vector3 pos = thisx.Position;
pos.Y += thisx.GetCursorHeight() - HeadHeightOffset;
return pos;
}
}