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

Commit

Permalink
fix: remove object Table.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed May 18, 2023
1 parent 0cdb7ae commit 982cea6
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 20 deletions.
5 changes: 3 additions & 2 deletions RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ECommons.GameHelpers;
using ECommons.DalamudServices;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.Game;

namespace RotationSolver.Basic.Actions;
Expand Down Expand Up @@ -149,7 +150,7 @@ public unsafe bool Use()
{
return ActionManager.Instance()->UseActionLocation(ActionType.Spell, ID, Player.Object.ObjectId, &loc);
}
else if(Service.ObjectTable.SearchById(_targetId) == null)
else if(Svc.Objects.SearchById(_targetId) == null)
{
return false;
}
Expand Down
9 changes: 5 additions & 4 deletions RotationSolver.Basic/Data/ActionEffectSet.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FFXIVClientStructs.FFXIV.Client.Game;
using ECommons.DalamudServices;
using FFXIVClientStructs.FFXIV.Client.Game;
using Lumina.Excel.GeneratedSheets;
using System.Collections;
using Action = Lumina.Excel.GeneratedSheets.Action;
Expand All @@ -18,14 +19,14 @@ public ActionEffectSet(uint sourceId, ActionEffectHeader* effectHeader, ActionEf
{
Type = effectHeader->actionType;
Action = Service.GetSheet<Action>().GetRow(effectHeader->actionId);
Target = Service.ObjectTable.SearchById(effectHeader->animationTargetId);
Source = Service.ObjectTable.SearchById(sourceId);
Target = Svc.Objects.SearchById(effectHeader->animationTargetId);
Source = Svc.Objects.SearchById(sourceId);
AnimationLock = effectHeader->animationLockTime;

TargetEffects = new TargetEffect[effectHeader->NumTargets];
for (int i = 0; i < effectHeader->NumTargets; i++)
{
TargetEffects[i] = new TargetEffect(Service.ObjectTable.SearchById(effectTargets[i]), effectArray + 8 * i);
TargetEffects[i] = new TargetEffect(Svc.Objects.SearchById(effectTargets[i]), effectArray + 8 * i);
}
}

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Helpers/TargetFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ internal static IEnumerable<BattleChara> ProvokeTarget(IEnumerable<BattleChara>
&& (target.TargetObject?.IsValid() ?? false))
{
//the target is not a tank role
if (Service.ObjectTable.SearchById(target.TargetObjectId) is BattleChara battle
if (Svc.Objects.SearchById(target.TargetObjectId) is BattleChara battle
&& !battle.IsJobCategory(JobRole.Tank)
&& (!needDistance || Vector3.Distance(target.Position, loc) > 5))
{
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/Basic/SGE_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected static bool AddersgallEndAfterGCD(uint gctCount = 0, float offset = 0)

return TargetFilter.FindAttackedTarget(targets, mustUse);
},
ActionCheck = (b, m) => Service.ObjectTable.OfType<BattleChara>()
ActionCheck = (b, m) => Svc.Objects.OfType<BattleChara>()
.Where(o => o.CurrentHp > 0)
.All(o => !o.HasStatus(true, StatusID.Kardion)),
};
Expand Down
3 changes: 0 additions & 3 deletions RotationSolver.Basic/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ public unsafe static IEnumerable<IntPtr> GetAddons<T>() where T : struct
[PluginService]
private static DataManager DataManager { get; set; }

[PluginService]
public static ObjectTable ObjectTable { get; private set; }

[PluginService]
public static TargetManager TargetManager { get; private set; }

Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private unsafe void DrawStatus()

foreach (var status in Player.Object.StatusList)
{
var source = status.SourceId == Player.Object.ObjectId ? "You" : Service.ObjectTable.SearchById(status.SourceId) == null ? "None" : "Others";
var source = status.SourceId == Player.Object.ObjectId ? "You" : Svc.Objects.SearchById(status.SourceId) == null ? "None" : "Others";
ImGui.Text($"{status.GameData.Name}: {status.StatusId} From: {source}");
}
}
Expand Down Expand Up @@ -100,7 +100,7 @@ private unsafe void DrawTargetData()
{
ImGui.Text("Kind: " + Service.TargetManager.Target.GetObjectKind().ToString());
ImGui.Text("SubKind: " + Service.TargetManager.Target.GetBattleNPCSubKind().ToString());
var owner = Service.ObjectTable.SearchById(Service.TargetManager.Target.OwnerId);
var owner = Svc.Objects.SearchById(Service.TargetManager.Target.OwnerId);
if(owner != null)
{
ImGui.Text("Owner: " + owner.Name.ToString());
Expand Down Expand Up @@ -134,7 +134,7 @@ private unsafe void DrawTargetData()

foreach (var status in b.StatusList)
{
var source = status.SourceId == Player.Object.ObjectId ? "You" : Service.ObjectTable.SearchById(status.SourceId) == null ? "None" : "Others";
var source = status.SourceId == Player.Object.ObjectId ? "You" : Svc.Objects.SearchById(status.SourceId) == null ? "None" : "Others";
ImGui.Text($"{status.GameData.Name}: {status.StatusId} From: {source}");
}
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/PreviewUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private static void UpdateEntry()
(Service.Config.StopCastingDelayMin, Service.Config.StopCastingDelayMax));
internal static void UpdateCastBarState()
{
var tardead = Service.Config.UseStopCasting && Service.ObjectTable.SearchById(Player.Object.CastTargetObjectId) is BattleChara b
var tardead = Service.Config.UseStopCasting && Svc.Objects.SearchById(Player.Object.CastTargetObjectId) is BattleChara b
&& (b is PlayerCharacter ? b.HasStatus(false, StatusID.Raise) : b.CurrentHp == 0);
_isTarNoNeedCast = _tarStopCastDelay.Delay(tardead);

Expand Down
5 changes: 2 additions & 3 deletions RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using ECommons.DalamudServices;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using Lumina.Excel.GeneratedSheets;
using RotationSolver.Basic.Configuration;
using System.Text.RegularExpressions;
Expand All @@ -15,11 +14,11 @@ internal static partial class TargetUpdater
{
internal static void UpdateTarget()
{
DataCenter.AllTargets = Service.ObjectTable.GetObjectInRadius(30);
DataCenter.AllTargets = Svc.Objects.GetObjectInRadius(30);
var battles = DataCenter.AllTargets.OfType<BattleChara>();
UpdateHostileTargets(battles);
UpdateFriends(battles);
UpdateNamePlate(Service.ObjectTable.OfType<BattleChara>());
UpdateNamePlate(Svc.Objects.OfType<BattleChara>());
}

internal static void ClearTarget()
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ private static unsafe void ReceiveAbilityEffect(uint sourceId, IntPtr sourceChar
private static void ActionFromEnemy(uint sourceId, ActionEffectSet set)
{
//Check Source.
var source = Service.ObjectTable.SearchById(sourceId);
var source = Svc.Objects.SearchById(sourceId);
if (source == null) return;
if (source is not BattleChara battle) return;
if (battle is PlayerCharacter) return;
if (battle.SubKind == 9) return; //Friend!
if (Service.ObjectTable.SearchById(battle.ObjectId) is PlayerCharacter) return;
if (Svc.Objects.SearchById(battle.ObjectId) is PlayerCharacter) return;

var damageRatio = set.TargetEffects
.Where(e => e.Target == Player.Object)
Expand Down

0 comments on commit 982cea6

Please sign in to comment.