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

Commit 4ab8bfc

Browse files
committed
fix: some check fix for the ff16 duty.
1 parent 5859d8b commit 4ab8bfc

File tree

11 files changed

+54
-38
lines changed

11 files changed

+54
-38
lines changed

RotationSolver.Basic/Actions/ActionTargetInfo.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,16 @@ private readonly IEnumerable<BattleChara> GetCanTargets(bool skipStatusProvideCh
7272
objs.Add(obj);
7373
}
7474

75+
var targetables = objs.Where(CanUseTo);
76+
77+
if (!targetables.Any() && action.Info.IsDutyAction)
78+
{
79+
targetables = [Player.Object];
80+
}
81+
7582
var isAuto = !DataCenter.IsManual || IsTargetFriendly;
76-
return objs.Where(b => isAuto || b.ObjectId == Svc.Targets.Target?.ObjectId)
77-
.Where(InViewTarget).Where(CanUseTo).Where(action.Setting.CanTarget);
83+
return targetables.Where(b => isAuto || b.ObjectId == Svc.Targets.Target?.ObjectId)
84+
.Where(InViewTarget).Where(action.Setting.CanTarget);
7885
}
7986

8087
private readonly List<BattleChara> GetCanAffects(bool skipStatusProvideCheck, TargetType type)

RotationSolver.Basic/Actions/BaseAction.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ public bool CanUse(out IAction act, bool skipStatusProvideCheck = false, bool sk
143143

144144
if (!Cooldown.CooldownCheck(usedUp, onLastAbility, skipClippingCheck, gcdCountForAbility)) return false;
145145

146-
147146
if (Setting.SpecialType is SpecialActionType.MeleeRange
148147
&& IActionHelper.IsLastAction(IActionHelper.MovingActions)) return false; //No range actions after moving.
149148

@@ -187,7 +186,7 @@ public unsafe bool Use()
187186

188187
var loc = (FFXIVClientStructs.FFXIV.Common.Math.Vector3)target.Position;
189188

190-
return ActionManager.Instance()->UseActionLocation(ActionType.Action, ID, Player.Object.ObjectId, &loc);
189+
return ActionManager.Instance()->UseActionLocation(ActionType.Action, adjustId, Player.Object.ObjectId, &loc);
191190
}
192191
else if (Svc.Objects.SearchById(target.Target?.ObjectId
193192
?? Player.Object?.ObjectId ?? GameObject.InvalidGameObjectId) == null)

RotationSolver.Basic/Data/VfxNewData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ public readonly struct VfxNewData(uint objectId, string path)
1111

1212
public readonly TimeSpan TimeDuration => DateTime.Now - Time;
1313

14-
public override string ToString() => $"Object Effect: {Svc.Objects.SearchById(ObjectId)?.Name ?? "Object"}: {Path}";
14+
public override string ToString() => $"Object Effect: {Svc.Objects.SearchById(ObjectId)?.Name ?? "Object"}: {Path}, {TimeDuration.TotalSeconds}";
1515
}

RotationSolver.Basic/Helpers/ActionHelper.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Action = Lumina.Excel.GeneratedSheets.Action;
1+
using FFXIVClientStructs.FFXIV.Client.Game;
2+
using Action = Lumina.Excel.GeneratedSheets.Action;
23

34

45
namespace RotationSolver.Basic.Helpers;
@@ -15,11 +16,21 @@ internal static class ActionHelper
1516

1617
internal static byte GetCoolDownGroup(this Action action)
1718
{
18-
var group = action.IsGeneralGCD() ? action.AdditionalCooldownGroup : action.CooldownGroup;
19-
if (group == 0) group = GCDCooldownGroup;
19+
var group = action.IsGeneralGCD() ? GetAdditionalCooldownGroup(action) : GetFirstCooldownGroup(action);
20+
if (group < 0) group = GCDCooldownGroup;
2021
return group;
2122
}
2223

24+
private static unsafe byte GetFirstCooldownGroup(Action action)
25+
{
26+
return (byte)ActionManager.Instance()->GetRecastGroup((int)ActionType.Action, action.RowId);
27+
}
28+
29+
private static unsafe byte GetAdditionalCooldownGroup(Action action)
30+
{
31+
return (byte)ActionManager.Instance()->GetAdditionalRecastGroup(ActionType.Action, action.RowId);
32+
}
33+
2334
internal static bool IsInJob(this Action i)
2435
{
2536
var cate = i.ClassJobCategory.Value;

RotationSolver.Basic/Helpers/ActionIdHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public unsafe static bool IsCoolingDown(byte cdGroup)
3535
/// </summary>
3636
/// <param name="cdGroup"></param>
3737
/// <returns></returns>
38-
public static unsafe RecastDetail* GetCoolDownDetail(byte cdGroup) => ActionManager.Instance()->GetRecastGroupDetail(cdGroup - 1);
38+
public static unsafe RecastDetail* GetCoolDownDetail(byte cdGroup) => ActionManager.Instance()->GetRecastGroupDetail(cdGroup);
3939

4040

4141
private static Action GetAction(this ActionID actionID)

RotationSolver.Basic/RotationSolver.Basic.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@
6262
<Using Include="Dalamud.Interface" />
6363
<Using Include="ImGuiNET" />
6464
<Using Include="Newtonsoft.Json" />
65-
<ProjectReference Include="..\ECommons\ECommons\ECommons.csproj">
66-
<PrivateAssets>all</PrivateAssets>
67-
</ProjectReference>
65+
<ProjectReference Include="..\ECommons\ECommons\ECommons.csproj"/>
6866

6967
<ProjectReference Include="..\RotationSolver.SourceGenerators\RotationSolver.SourceGenerators.csproj" OutputItemType="Analyzer" ExcludeAssets="All" ReferenceOutputAssembly="false" />
7068

7169
<ProjectReference Include="..\XIVConfigUI\XIVConfigUI\XIVConfigUI.csproj" />
7270

7371
<ProjectReference Include="..\XIVDrawer\XIVDrawer\XIVDrawer.csproj" />
7472

75-
<PackageReference Include="Svg" Version="3.4.7" />
73+
<PackageReference Include="Svg" Version="3.4.7" >
74+
<PrivateAssets>all</PrivateAssets>
75+
</PackageReference>
7676

7777
<None Include="..\Images\Logo.png">
7878
<Pack>True</Pack>

RotationSolver.Basic/Rotations/Duties/FF16Rotation.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,12 @@ namespace RotationSolver.Basic.Rotations.Duties;
88
[DutyTerritory(1166)]
99
public abstract class FF16Rotation : DutyRotation
1010
{
11-
public override bool AttackAbility(out IAction? act)
12-
{
13-
if (RisingFlamesPvE.CanUse(out act, skipAoeCheck: true)) return true;
14-
return base.AttackAbility(out act);
15-
}
1611
}
1712

1813
partial class DutyRotation
1914
{
20-
static partial void ModifyDodgePvE(ref ActionSetting setting)
21-
{
22-
setting.StatusProvide = [StatusID.Precision];
23-
}
24-
25-
static partial void ModifyPrecisionStrikePvE(ref ActionSetting setting)
26-
{
27-
setting.StatusNeed = [StatusID.Precision];
28-
}
15+
//static partial void ModifyPrecisionStrikePvE(ref ActionSetting setting)
16+
//{
17+
// setting.StatusNeed = [StatusID.Precision];
18+
//}
2919
}

RotationSolver/Localization/Localization.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,5 +504,7 @@
504504
"RotationSolver.Basic.Configuration.ConfigsDescription.RotationSolver.Basic.Configuration.ConditionBoolean MoveAreaActionFarthest": "Moves to the furthest possible position that can be targeted with movement actions.",
505505
"RotationSolver.Basic.Configuration.ConfigsDescription.Single MoveTargetAngle": "If the selection mode is based on character facing, i.e., targets within the character's viewpoint are moveable targets. \nIf the selection mode is screen-centered, i.e., targets within a sector drawn upward from the character's point are movable targets.",
506506
"XIVConfigUI.ConfigUnitType.Degree": "Angle Unit, in degrees.",
507-
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean InDebug": "Debug Mode."
507+
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean InDebug": "Debug Mode.",
508+
"XIVConfigUI.ConfigUnitType.Seconds": "Time Unit, in seconds.",
509+
"XIVConfigUI.ConfigUnitType.Percent": "Ratio Unit, as percentage."
508510
}

RotationSolver/RotationSolverPlugin.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using RotationSolver.UI.SearchableConfigs;
1818
using RotationSolver.Updaters;
1919
using XIVConfigUI;
20-
using XIVDrawer.Vfx;
2120

2221
namespace RotationSolver;
2322

@@ -100,7 +99,6 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface)
10099
#if DEBUG
101100
if (Player.Available)
102101
{
103-
new ActorVfx("vfx/common/eff/kaihi_stlp_c2v.avfx", Player.Object, Player.Object);
104102
//_ = XIVPainterMain.ShowOff();
105103
}
106104
#endif

RotationSolver/UI/RotationConfigWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
using System.ComponentModel;
2222
using System.Diagnostics;
2323
using XIVConfigUI;
24-
using XIVConfigUI.Attributes;
2524
using XIVConfigUI.SearchableConfigs;
2625
using XIVDrawer;
2726
using GAction = Lumina.Excel.GeneratedSheets.Action;
@@ -1293,6 +1292,7 @@ static void DrawActionDebug()
12931292
ImGui.Text("Cast Time: " + action.Info.CastTime.ToString());
12941293
ImGui.Text("MP: " + action.Info.MPNeed.ToString());
12951294
#endif
1295+
ImGui.Text("AnimationLock: " + action.Info.AnimationLockTime.ToString());
12961296
ImGui.Text("AttackType: " + action.Info.AttackType.ToString());
12971297
ImGui.Text("Aspect: " + action.Info.Aspect.ToString());
12981298
ImGui.Text("Has One:" + action.Cooldown.HasOneCharge.ToString());

RotationSolver/Watcher.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Dalamud.Hooking;
33
using Dalamud.Plugin.Ipc;
44
using ECommons.DalamudServices;
5+
using ECommons.ExcelServices;
56
using ECommons.GameHelpers;
67
using ECommons.Hooks;
78
using ECommons.Hooks.ActionEffectTypes;
@@ -84,8 +85,7 @@ private static IntPtr ActorVfxNewHandler(string path, IntPtr a2, IntPtr a3, floa
8485
{
8586
var obj = Svc.Objects.CreateObjectReference(a2);
8687

87-
if (obj is not PlayerCharacter
88-
|| !path.StartsWith("vfx/common/eff/", StringComparison.OrdinalIgnoreCase))
88+
if (NotFrom(path))
8989
{
9090
if (DataCenter.VfxNewData.Count >= 64)
9191
{
@@ -94,21 +94,30 @@ private static IntPtr ActorVfxNewHandler(string path, IntPtr a2, IntPtr a3, floa
9494

9595
var effect = new VfxNewData(obj?.ObjectId ?? Dalamud.Game.ClientState.Objects.Types.GameObject.InvalidGameObjectId, path);
9696
DataCenter.VfxNewData.Enqueue(effect);
97-
}
9897

9998
#if DEBUG
100-
if(obj is PlayerCharacter)
101-
{
102-
Svc.Log.Debug("Object: " + path);
103-
}
99+
Svc.Log.Debug(effect.ToString());
104100
#endif
101+
}
102+
103+
105104
}
106105
catch (Exception e)
107106
{
108107
Svc.Log.Warning(e, "Failed to load the vfx value!");
109108
}
110109

111110
return _actorVfxCreateHook!.Original(path, a2, a3, a4, a5, a6, a7);
111+
112+
static bool NotFrom(string path)
113+
{
114+
return NotName(path, "dk") && NotName(path, "cmpp") && Enum.GetNames(typeof(Job)).All(s => NotName(path, s.ToLower()));
115+
116+
static bool NotName(string path, string trail)
117+
{
118+
return !path.StartsWith("vfx/common/eff/" + trail, StringComparison.OrdinalIgnoreCase);
119+
}
120+
}
112121
}
113122

114123
private static unsafe long ProcessObjectEffectDetour(GameObject* a1, ushort a2, ushort a3, long a4)

0 commit comments

Comments
 (0)