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

Commit

Permalink
fix: add sight check for action target.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed May 26, 2023
1 parent f3e14cd commit 6bb38be
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ public unsafe bool CanUseTo(BattleChara tar)

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

var point = Player.Object.Position;
var tarPt = tar.Position;
var point = Player.Object.Position + Vector3.UnitY * Player.GameObject->Height;
var tarPt = tar.Position + Vector3.UnitY * tar.GetAddress()->Height;
var direction = tarPt - point;
if(BGCollisionModule.Raycast(point, direction, out var _, direction.Length())) return false;

Expand Down
20 changes: 9 additions & 11 deletions RotationSolver/UI/OverlayWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,19 @@ private static void DrawTarget(BattleChara tar, uint color, float radius, out Ve
const int COUNT = 20;
private static void DrawPositional()
{
//if (!Player.Object.IsJobCategory(JobRole.Tank)
// && !Player.Object.IsJobCategory(JobRole.Melee)) return;
if (!Player.Object.IsJobCategory(JobRole.Tank)
&& !Player.Object.IsJobCategory(JobRole.Melee)) return;

//var target = ActionUpdater.NextGCDAction?.Target?.IsNPCEnemy() ?? false
// ? ActionUpdater.NextGCDAction.Target
// : Svc.Targets.Target?.IsNPCEnemy() ?? false
// ? Svc.Targets.Target
// : null;

var target = Player.Object;
var target = ActionUpdater.NextGCDAction?.Target?.IsNPCEnemy() ?? false
? ActionUpdater.NextGCDAction.Target
: Svc.Targets.Target?.IsNPCEnemy() ?? false
? Svc.Targets.Target
: null;

if (target == null) return;

//if (ActionUpdater.NextGCDAction != null
// && !ActionUpdater.NextGCDAction.IsSingleTarget) return;
if (ActionUpdater.NextGCDAction != null
&& !ActionUpdater.NextGCDAction.IsSingleTarget) return;

Vector3 pPosition = target.Position;

Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ internal partial class RotationConfigWindow
private void DrawDebugTab()
{
if (!Player.Available) return;

var str = SocialUpdater.EncryptString(Player.Object);
ImGui.SetNextItemWidth(ImGui.CalcTextSize(str).X + 10);
ImGui.InputText("That is your HASH", ref str, 100);
Expand Down Expand Up @@ -98,6 +99,7 @@ private unsafe void DrawTargetData()
{
if(Svc.Targets.Target != null)
{
ImGui.Text("Height: " + Svc.Targets.Target.GetAddress()->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 Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/MajorUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static void FrameworkUpdate(Framework framework)
bool newValue = Svc.Condition[(ConditionFlag)indexs[i]];
if (_values.TryGetValue(i, out bool value) && value != newValue && indexs[i] != 48 && indexs[i] != 27)
{
Svc.Toasts.ShowQuest(indexs[i].ToString() + " " + key + ": " + newValue.ToString());
//Svc.Toasts.ShowQuest(indexs[i].ToString() + " " + key + ": " + newValue.ToString());
}
_values[i] = newValue;
}
Expand Down

0 comments on commit 6bb38be

Please sign in to comment.