Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: match ECommons.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jun 27, 2023
1 parent 94030db commit 098903e
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 27 deletions.
7 changes: 4 additions & 3 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Dalamud.Logging;
using ECommons.DalamudServices;
using ECommons.ExcelServices;
using ECommons.GameFunctions;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Common.Component.BGCollision;
Expand Down Expand Up @@ -469,16 +470,16 @@ bool CheckStatus(BattleChara tar)
0, true, TargetStatus);
}

public unsafe bool CanUseTo(BattleChara tar)
public unsafe bool CanUseTo(GameObject tar)
{
if (tar == null || !Player.Available) return false;

var tarAddress = tar.GetAddress();
var tarAddress = tar.Struct();

if (!ActionManager.CanUseActionOnTarget(AdjustedID, tarAddress)) return false;

var point = Player.Object.Position + Vector3.UnitY * Player.GameObject->Height;
var tarPt = tar.Position + Vector3.UnitY * tar.GetAddress()->Height;
var tarPt = tar.Position + Vector3.UnitY * tar.Struct()->Height;
var direction = tarPt - point;

int* unknown = stackalloc int[] { 0x4000, 0, 0x4000, 0 };
Expand Down
4 changes: 1 addition & 3 deletions RotationSolver.Basic/Data/IconSet.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using ECommons.DalamudServices;
using ECommons.ImGuiMethods;
using ECommons.ImGuiMethods;
using ImGuiScene;
using System.Net;

namespace RotationSolver.Basic.Data;

Expand Down
22 changes: 8 additions & 14 deletions RotationSolver.Basic/Helpers/ObjectHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Dalamud.Game.ClientState.Objects.Enums;
using ECommons.GameFunctions;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Game.Event;
using Lumina.Excel.GeneratedSheets;

Expand All @@ -26,9 +26,6 @@ public static bool HasPositional(this GameObject obj)
return !(obj.GetObjectNPC()?.Unknown10 ?? false);
}

public static unsafe FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject* GetAddress(this GameObject obj)
=> (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)(void*)obj.Address;

public static unsafe bool IsOthersPlayers(this GameObject obj)
{
//SpecialType but no NamePlateIcon
Expand All @@ -41,10 +38,9 @@ public static unsafe bool IsOthersPlayers(this GameObject obj)

public static unsafe bool IsNPCEnemy(this GameObject obj)
=> obj != null && obj.GetObjectKind() == ObjectKind.BattleNpc
&& ActionManager.CanUseActionOnTarget((uint)ActionID.Blizzard, obj.GetAddress());

&& obj.IsHostile();

public static unsafe ObjectKind GetObjectKind(this GameObject obj) => (ObjectKind)obj.GetAddress()->ObjectKind;
public static unsafe ObjectKind GetObjectKind(this GameObject obj) => (ObjectKind)obj.Struct()->ObjectKind;

public static bool IsTopPriorityHostile(this GameObject obj)
{
Expand All @@ -67,15 +63,13 @@ or 71344 //Major Quest
return false;
}

public static unsafe uint GetNamePlateIcon(this GameObject obj) => obj.GetAddress()->NamePlateIconId;
public static unsafe void SetNamePlateIcon(this GameObject obj, uint id) => obj.GetAddress()->NamePlateIconId = id;
public static unsafe EventHandlerType GetEventType(this GameObject obj) => obj.GetAddress()->EventId.Type;

public static unsafe BattleNpcSubKind GetBattleNPCSubKind(this GameObject obj) => (BattleNpcSubKind)obj.GetAddress()->SubKind;
public static unsafe uint GetNamePlateIcon(this GameObject obj) => obj.Struct()->NamePlateIconId;
public static unsafe void SetNamePlateIcon(this GameObject obj, uint id) => obj.Struct()->NamePlateIconId = id;
public static unsafe EventHandlerType GetEventType(this GameObject obj) => obj.Struct()->EventId.Type;

public static unsafe uint FateId(this GameObject obj) => obj.GetAddress()->FateId;
public static unsafe BattleNpcSubKind GetBattleNPCSubKind(this GameObject obj) => (BattleNpcSubKind)obj.Struct()->SubKind;

public static unsafe bool IsTargetable(this GameObject obj) => obj.GetAddress()->GetIsTargetable();
public static unsafe uint FateId(this GameObject obj) => obj.Struct()->FateId;

static readonly Dictionary<uint, bool> _effectRangeCheck = new();
public static bool CanInterrupt(this BattleChara b)
Expand Down
1 change: 1 addition & 0 deletions RotationSolver.Basic/Helpers/TargetFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ECommons.DalamudServices;
using ECommons.GameFunctions;
using ECommons.GameHelpers;
using Lumina.Excel.GeneratedSheets;
using System.Data;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public sealed class RotationSolverPlugin : IDalamudPlugin, IDisposable
public static DalamudLinkPayload LinkPayload { get; private set; }
public RotationSolverPlugin(DalamudPluginInterface pluginInterface)
{
ECommonsMain.Init(pluginInterface, this, Module.DalamudReflector);
ECommonsMain.Init(pluginInterface, this, Module.DalamudReflector, Module.ObjectFunctions);

//Init!
//ThreadLoadImageHandler.TryGetIconTextureWrap(0, false, out _);
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ECommons.DalamudServices;
using ECommons.GameFunctions;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.Game.Fate;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using RotationSolver.Updaters;

namespace RotationSolver.UI;
Expand Down Expand Up @@ -100,7 +100,7 @@ private unsafe void DrawTargetData()
{
if(Svc.Targets.Target != null)
{
ImGui.Text("Height: " + Svc.Targets.Target.GetAddress()->Height.ToString());
ImGui.Text("Height: " + Svc.Targets.Target.Struct()->Height.ToString());
ImGui.Text("Kind: " + Svc.Targets.Target.GetObjectKind().ToString());
ImGui.Text("SubKind: " + Svc.Targets.Target.GetBattleNPCSubKind().ToString());
var owner = Svc.Objects.SearchById(Svc.Targets.Target.OwnerId);
Expand All @@ -121,7 +121,7 @@ private unsafe void DrawTargetData()
ImGui.Text("InView: " + Svc.GameGui.WorldToScreen(b.Position, out _).ToString());
ImGui.Text("Name Id: " + b.NameId.ToString());
ImGui.Text("Data Id: " + b.DataId.ToString());
ImGui.Text("Targetable: " + b.GetAddress()->TargetableStatus.ToString());
ImGui.Text("Targetable: " + b.Struct()->Character.GameObject.TargetableStatus.ToString());

var npc = b.GetObjectNPC();
if(npc != null)
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/SocialUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Logging;
using ECommons.Automation;
using ECommons.DalamudServices;
using ECommons.GameFunctions;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.UI;
using Lumina.Excel.GeneratedSheets;
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Dalamud.Game.ClientState.Objects.SubKinds;
using ECommons.DalamudServices;
using ECommons.ExcelServices;
using ECommons.GameFunctions;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.UI;
using Lumina.Excel.GeneratedSheets;
Expand Down
2 changes: 1 addition & 1 deletion XIVPainter

0 comments on commit 098903e

Please sign in to comment.