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

Commit

Permalink
fix: add positional drawing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 30, 2024
1 parent 5654794 commit 96bd1d3
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 22 deletions.
2 changes: 1 addition & 1 deletion RotationSolver.Basic
Submodule RotationSolver.Basic updated 28 files
+7 −0 RotationSolver.Basic/Configuration/Configs.cs
+2 −2 RotationSolver.Basic/Helpers/ObjectHelper.cs
+115 −38 RotationSolver.Basic/Rotations/Basic/BardRotation.cs
+2 −2 RotationSolver.Basic/Rotations/Basic/MonkRotation.cs
+7 −7 RotationSolver.GameData/BasicRotationGenerator.cs
+1 −1 RotationSolver.GameData/Getters/ActionSets/ReplaceActionGetter.cs
+14 −0 RotationSolver.SourceGenerators/Resources/AstrologianRotation.txt
+11 −0 RotationSolver.SourceGenerators/Resources/BardRotation.txt
+6 −0 RotationSolver.SourceGenerators/Resources/BlackMageRotation.txt
+11 −0 RotationSolver.SourceGenerators/Resources/DancerRotation.txt
+9 −0 RotationSolver.SourceGenerators/Resources/DarkKnightRotation.txt
+12 −0 RotationSolver.SourceGenerators/Resources/DragoonRotation.txt
+8 −0 RotationSolver.SourceGenerators/Resources/GunbreakerRotation.txt
+13 −0 RotationSolver.SourceGenerators/Resources/MachinistRotation.txt
+12 −0 RotationSolver.SourceGenerators/Resources/MonkRotation.txt
+7 −0 RotationSolver.SourceGenerators/Resources/NinjaRotation.txt
+146 −149 RotationSolver.SourceGenerators/Resources/OpCode.txt
+9 −0 RotationSolver.SourceGenerators/Resources/PaladinRotation.txt
+18 −0 RotationSolver.SourceGenerators/Resources/PictomancerRotation.txt
+10 −0 RotationSolver.SourceGenerators/Resources/ReaperRotation.txt
+11 −0 RotationSolver.SourceGenerators/Resources/RedMageRotation.txt
+7 −0 RotationSolver.SourceGenerators/Resources/SageRotation.txt
+5 −0 RotationSolver.SourceGenerators/Resources/SamuraiRotation.txt
+9 −0 RotationSolver.SourceGenerators/Resources/ScholarRotation.txt
+6 −0 RotationSolver.SourceGenerators/Resources/SummonerRotation.txt
+12 −0 RotationSolver.SourceGenerators/Resources/ViperRotation.txt
+7 −0 RotationSolver.SourceGenerators/Resources/WarriorRotation.txt
+7 −0 RotationSolver.SourceGenerators/Resources/WhiteMageRotation.txt
25 changes: 13 additions & 12 deletions RotationSolver/UI/PainterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ public static Vector4 HighlightColor
}
}

private readonly static Drawing3DCircularSector _target = new (default, 0, 0, 3)
{
IsFill = false,
Enable = false,
};
private readonly static Drawing3DImage _targetImage = new (null, default, 0)
{
MustInViewRange = true,
Enable = false,
};
private const float targetRadius = 0.15f;
private const float beneficialRadius = 0.6f;

Expand Down Expand Up @@ -130,11 +120,12 @@ public static void Init()

annulus.UpdateEveryFrame = () =>
{
var tar = DataCenter.HostileTarget;
if (Service.Config.UseOverlayWindow && Player.Available && (Player.Object.IsJobCategory(JobRole.Tank) || Player.Object.IsJobCategory(JobRole.Melee))
&& (Svc.Targets.Target?.IsEnemy() ?? false) && Service.Config.DrawMeleeOffset
&& (tar?.IsEnemy() ?? false) && Service.Config.DrawMeleeOffset
&& ActionUpdater.NextGCDAction == null)
{
annulus.Target = Svc.Targets.Target;
annulus.Target = tar;
}
else
{
Expand Down Expand Up @@ -252,6 +243,16 @@ private static void UpdateTargetTexts()
}
}

private readonly static Drawing3DCircularSector _target = new(default, 0, 0, 3)
{
IsFill = false,
Enable = false,
};
private readonly static Drawing3DImage _targetImage = new(null, default, 0)
{
MustInViewRange = true,
Enable = false,
};
private static void UpdateTarget()
{
_target.Enable = _targetImage.Enable = false;
Expand Down
88 changes: 79 additions & 9 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ internal static class ActionUpdater
static RandomDelay _GCDDelay = new(() => Service.Config.WeaponDelay);

private static IAction? _nextAction;
internal static IAction? NextAction
{
internal static IAction? NextAction
{
get => _nextAction;
set
{
Expand All @@ -27,15 +27,16 @@ internal static IAction? NextAction
}
}

private static StaticVfx? circle, sector, rectangle;
private static StaticVfx? circle, sector, rectangle, positionalSect, line;
private static IBaseAction? _nextGCDAction;
const float gcdHeight = 5;
internal static IBaseAction? NextGCDAction
const float gcdHeight = 5, positionalHeight = 1;
internal static IBaseAction? NextGCDAction
{
get => _nextGCDAction;
set
{
UpdateOmen(value);
UpdatePositional(value);
if (_nextGCDAction == value) return;
_nextGCDAction = value;
}
Expand Down Expand Up @@ -85,6 +86,79 @@ private static void UpdateOmen(IBaseAction? value)
}
}

private static void UpdatePositional(IBaseAction? value)
{
var player = Player.Object;
if (player == null) return;

line ??= new(GroundOmenFriendly.BasicRectangle.Omen(), player, new Vector3(Service.Config.PositionalLineWidth, positionalHeight, 0));
positionalSect ??= new(GroundOmenFriendly.BasicFan090.Omen(), player, new Vector3(0, positionalHeight, 0));

positionalSect.Enable = line.Enable = false;
positionalSect.Owner = line.Owner = player;

if (!Service.Config.UseOverlayWindow) return;
if (!Service.Config.ShowPositional) return;
if (value == null) return;
if (!player.IsJobCategory(JobRole.Melee)) return;
if (value.Target.Target is not IBattleChara enemy) return;

Vector3 pPosition = enemy.Position;
Vector2 faceVec = enemy.GetFaceVector();

Vector3 dir = player.Position - pPosition;
Vector2 dirVec = new(dir.Z, dir.X);

bool isLeft = faceVec.X * dirVec.Y > faceVec.Y * dirVec.X;

var scale = new Vector3(0, positionalHeight, enemy.HitboxRadius + 3);
switch (value.Setting.EnemyPositional)
{
case EnemyPositional.Rear:
positionalSect.Owner = enemy;
scale.X = scale.Z;
positionalSect.UpdateScale(scale);

positionalSect.RotateAddition = MathF.PI;

positionalSect.Enable = true;
break;

case EnemyPositional.Flank:
positionalSect.Owner = enemy;
scale.X = scale.Z;
positionalSect.UpdateScale(scale);

if (isLeft)
{
positionalSect.RotateAddition = MathF.PI / 2;
}
else
{
positionalSect.RotateAddition = -MathF.PI / 2;
}

positionalSect.Enable = true;
break;

default:
line.Owner = enemy;
scale.X = Service.Config.PositionalLineWidth;
line.UpdateScale(scale);
if (isLeft)
{
line.RotateAddition = MathF.PI * 3 / 4;
}
else
{
line.RotateAddition = -MathF.PI * 3 / 4;
}
line.Enable = true;

break;
}
}

internal static IAction? WrongAction { get; set; }
static readonly Random _wrongRandom = new();

Expand Down Expand Up @@ -300,10 +374,6 @@ internal unsafe static bool CanDoAction()

var timeToNext = DataCenter.AnimationLocktime;

////No time to use 0gcd
//if (timeToNext + nextAction.AnimationLockTime
// > DataCenter.WeaponRemain) return false;

//Skip when casting
if (DataCenter.WeaponElapsed <= DataCenter.CastingTotal) return false;

Expand Down

0 comments on commit 96bd1d3

Please sign in to comment.