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

Commit

Permalink
fix: fix with Parasol.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed May 26, 2023
1 parent 5bc534c commit f3e14cd
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"141": 0.1,
"147": 0.1,
"149": 0.6,
"152": 0.6,
"152": 0.1,
"153": 0.6,
"154": 0.1,
"156": 0.6,
Expand Down Expand Up @@ -332,7 +332,7 @@
"25788": 0.6,
"25793": 0.1,
"25796": 0.6,
"25797": 0.6,
"25797": 0.1,
"25798": 0.1,
"25799": 0.6,
"25801": 0.6,
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public unsafe bool CanUseTo(BattleChara tar)
var point = Player.Object.Position;
var tarPt = tar.Position;
var direction = tarPt - point;
if(BGCollisionModule.Raycast2(point, direction, out var _, direction.Length())) return false;
if(BGCollisionModule.Raycast(point, direction, out var _, direction.Length())) return false;

return true;
}
Expand Down
7 changes: 1 addition & 6 deletions RotationSolver.Basic/Data/IconSet.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using Dalamud.Logging;
using Dalamud.Utility;
using ECommons.DalamudServices;
using ECommons.ImGuiMethods;
using ECommons.ImGuiMethods;
using ImGuiScene;
using System.IO;
using System.Net;

namespace RotationSolver.Basic.Data;

Expand Down
4 changes: 4 additions & 0 deletions RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Dalamud.Plugin;
using ECommons;
using ECommons.DalamudServices;
using ECommons.GameHelpers;
using ECommons.ImGuiMethods;
using RotationSolver.Basic.Configuration;
using RotationSolver.Commands;
using RotationSolver.Data;
Expand All @@ -30,6 +32,7 @@ public sealed class RotationSolverPlugin : IDalamudPlugin, IDisposable
public RotationSolverPlugin(DalamudPluginInterface pluginInterface)
{
ECommonsMain.Init(pluginInterface, this);
ThreadLoadImageHandler.TryGetIconTextureWrap(0, false, out _);

try
{
Expand Down Expand Up @@ -134,6 +137,7 @@ internal static void UpdateDisplayWindow()
&& !Svc.Condition[ConditionFlag.BetweenAreas]
&& !Svc.Condition[ConditionFlag.BetweenAreas51]
&& !Svc.Condition[ConditionFlag.WaitingForDuty]
&& (!Svc.Condition[ConditionFlag.UsingParasol] || Player.Object.StatusFlags.HasFlag(Dalamud.Game.ClientState.Objects.Enums.StatusFlags.WeaponOut))
&& !Svc.Condition[ConditionFlag.OccupiedInQuestEvent]);

_controlWindow.IsOpen = isValid && Service.Config.ShowControlWindow;
Expand Down
9 changes: 7 additions & 2 deletions RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,13 @@ static void DrawCommandAction(uint iconId, StateCommandType command, Vector4 col
var help = GetHelp(command);
string baseId = "ImgButton" + command.ToString();

ImGui.SetCursorPosX(ImGui.GetCursorPosX() + Math.Max(0, strWidth / 2 - width / 2));
DrawIAction(IconSet.GetTexture(iconId).ImGuiHandle, baseId, abilityW, command, help);
var texture = IconSet.GetTexture(iconId);
if(texture != null)
{
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + Math.Max(0, strWidth / 2 - width / 2));
DrawIAction(texture.ImGuiHandle, baseId, abilityW, command, help);
}

ImGui.EndGroup();

if (DataCenter.StateType == command)
Expand Down
37 changes: 28 additions & 9 deletions RotationSolver/UI/OverlayWindow.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using ECommons.DalamudServices;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.Game.Event;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Common.Component.BGCollision;
using RotationSolver.Updaters;
using System.Drawing;

namespace RotationSolver.UI;

Expand Down Expand Up @@ -124,19 +127,21 @@ 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 = ActionUpdater.NextGCDAction?.Target?.IsNPCEnemy() ?? false
// ? ActionUpdater.NextGCDAction.Target
// : Svc.Targets.Target?.IsNPCEnemy() ?? false
// ? Svc.Targets.Target
// : null;

var target = Player.Object;

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 Expand Up @@ -263,6 +268,7 @@ public static IEnumerable<Vector2> ClosePoints(IEnumerable<Vector2> pts)

public static IEnumerable<Vector2> GetPtsOnScreen(IEnumerable<Vector3> pts)
{
//pts = ProjectPts(pts, 3);
var cameraPts = pts.Select(WorldToCamera).ToArray();
var changedPts = new List<Vector3>(cameraPts.Length * 2);

Expand Down Expand Up @@ -295,6 +301,19 @@ public static IEnumerable<Vector2> GetPtsOnScreen(IEnumerable<Vector3> pts)
});
}

private static IEnumerable<Vector3> ProjectPts(IEnumerable<Vector3> pts, float height)
{
return pts.Select(pt =>
{
var pUp = pt + Vector3.UnitY * height;
if (BGCollisionModule.Raycast(pUp, -Vector3.UnitY, out var hit))
{
return hit.Point;
}
return pt;
});
}

const float PLANE_Z = 0.001f;
public static void GetPointOnPlane(Vector3 front, ref Vector3 back)
{
Expand Down
4 changes: 3 additions & 1 deletion RotationSolver/Updaters/InputUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Dalamud.Game.ClientState.GamePad;
using Dalamud.Game.ClientState.Keys;
using ECommons.DalamudServices;
using ECommons.GameHelpers;
using RotationSolver.Basic.Configuration;
using RotationSolver.Commands;

Expand All @@ -27,9 +28,10 @@ internal static unsafe void UpdateCommand()
|| Svc.Condition[ConditionFlag.Mounted]
|| Svc.Condition[ConditionFlag.SufferingStatusAffliction2]
|| Svc.Condition[ConditionFlag.RolePlaying]
|| Svc.Condition[ConditionFlag.UsingParasol]
|| Svc.Condition[ConditionFlag.UsingParasol] && !Player.Object.StatusFlags.HasFlag(Dalamud.Game.ClientState.Objects.Enums.StatusFlags.WeaponOut)
|| Svc.Condition[ConditionFlag.InFlight]) return;


if (DateTime.Now - RecordingTime > TimeSpan.FromSeconds(10))
{
RecordingSpecialType = SpecialCommandType.None;
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 f3e14cd

Please sign in to comment.