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

Commit

Permalink
fix: add no casting list.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 9, 2024
1 parent 3171706 commit 0792e9f
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 16 deletions.
3 changes: 2 additions & 1 deletion Resources/HostileCastingArea.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,5 +516,6 @@
35218,
32945,
22247,
22238
22238,
33077
]
4 changes: 2 additions & 2 deletions Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ClickingCount": 98904,
"SayingHelloCount": 166,
"ClickingCount": 99386,
"SayingHelloCount": 167,
"SaidUsers": []
}
10 changes: 9 additions & 1 deletion RotationSolver.Basic/Configuration/OtherConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public class OtherConfiguration

public static HashSet<uint> DangerousStatus = [];
public static HashSet<uint> PriorityStatus = [];

public static HashSet<uint> InvincibleStatus = [];
public static HashSet<uint> NoCastingStatus = [];

public static RotationSolverRecord RotationSolverRecord = new();

Expand All @@ -40,6 +40,8 @@ public static void Init()
Task.Run(() => InitOne(ref HostileCastingTank, nameof(HostileCastingTank)));
Task.Run(() => InitOne(ref BeneficialPositions, nameof(BeneficialPositions)));
Task.Run(() => InitOne(ref RotationSolverRecord, nameof(RotationSolverRecord), false));
Task.Run(() => InitOne(ref NoCastingStatus, nameof(NoCastingStatus)));

}

public static Task Save()
Expand All @@ -56,8 +58,14 @@ public static Task Save()
await SaveBeneficialPositions();
await SaveRotationSolverRecord();
await SaveNoProvokeNames();
await SaveNoCastingStatus();
});
}
public static Task SaveNoCastingStatus()
{
return Task.Run(() => Save(NoCastingStatus, nameof(NoCastingStatus)));
}

public static Task SavePriorityStatus()
{
return Task.Run(() => Save(PriorityStatus, nameof(PriorityStatus)));
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Helpers/StatusHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ internal static float StatusTime(this GameObject obj, bool isFromSelf, params St
}
}

private static IEnumerable<float> StatusTimes(this GameObject obj, bool isFromSelf, params StatusID[] statusIDs)
internal static IEnumerable<float> StatusTimes(this GameObject obj, bool isFromSelf, params StatusID[] statusIDs)
{
return obj.GetStatus(isFromSelf, statusIDs).Select(status => status.RemainingTime == 0 ? float.MaxValue : status.RemainingTime);
}
Expand Down
5 changes: 5 additions & 0 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ internal static unsafe bool CanDoAnAction(bool isGCD)
internal static uint _lastActionID;
public static void DoAction()
{
if (Player.Object.HasStatus(false, [..OtherConfiguration.NoCastingStatus.Select(i => (StatusID)i)]))
{
return;
}

var wrong = new Random().NextDouble() < Service.Config.MistakeRatio && ActionUpdater.WrongAction != null;
var nextAction = wrong ? ActionUpdater.WrongAction : ActionUpdater.NextAction;
if (nextAction == null) return;
Expand Down
6 changes: 6 additions & 0 deletions RotationSolver/Data/UiString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ internal enum UiString
[Description("Dispellable debuffs")]
ConfigWindow_List_DangerousStatus,

[Description("No Casting debuffs")]
ConfigWindow_List_NoCastingStatus,

[Description("Ignores target if it has one of this statuses")]
ConfigWindow_List_InvincibilityDesc,

Expand All @@ -213,6 +216,9 @@ internal enum UiString
[Description("Dispellable debuffs list")]
ConfigWindow_List_DangerousStatusDesc,

[Description("No Casting debuffs List")]
ConfigWindow_List_NoCastingStatusDesc,

[Description("Copy to Clipboard")]
ConfigWindow_Actions_Copy,

Expand Down
15 changes: 14 additions & 1 deletion RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,11 @@ internal static GAction[] AllActions
.Where(a => !string.IsNullOrEmpty(a.Name) && !a.IsPvP && !a.IsPlayerAction
&& a.ClassJob.Value == null && a.Cast100ms > 0)
.ToArray();

private static Status[]? _badStatus = null;
internal static Status[] BadStatus
=> _badStatus ??= Service.GetSheet<Status>()
.Where(s => s.StatusCategory == 2 && s.Icon != 0)
.ToArray();
private static void DrawList()
{
ImGui.TextWrapped(UiString.ConfigWindow_List_Description.Local());
Expand Down Expand Up @@ -1949,6 +1953,9 @@ private static void DrawListStatuses()
ImGui.TableNextColumn();
ImGui.TableHeader(UiString.ConfigWindow_List_DangerousStatus.Local());

ImGui.TableNextColumn();
ImGui.TableHeader(UiString.ConfigWindow_List_NoCastingStatus.Local());

ImGui.TableNextRow();

ImGui.TableNextColumn();
Expand All @@ -1965,6 +1972,12 @@ private static void DrawListStatuses()

ImGui.TextWrapped(UiString.ConfigWindow_List_DangerousStatusDesc.Local());
DrawStatusList(nameof(OtherConfiguration.DangerousStatus), OtherConfiguration.DangerousStatus, AllDispelStatus);

ImGui.TableNextColumn();

ImGui.TextWrapped(UiString.ConfigWindow_List_NoCastingStatusDesc.Local());
DrawStatusList(nameof(OtherConfiguration.NoCastingStatus), OtherConfiguration.NoCastingStatus, BadStatus);

}
}

Expand Down
8 changes: 1 addition & 7 deletions RotationSolver/UI/TimelineDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -871,12 +871,6 @@ private static void DrawingGetterDraw(BaseDrawingGetter drawing, uint[] actionId
}
}

private static Status[]? _badStatus = null;
internal static Status[] BadStatus
=> _badStatus ??= Service.GetSheet<Status>()
.Where(s => s.StatusCategory == 2 && s.Icon != 0)
.ToArray();

private static void DrawObjectGetter(ObjectGetter getter, string getterName)
{
if (ImGui.Button(getterName + "##" + getter.GetHashCode()))
Expand Down Expand Up @@ -996,7 +990,7 @@ private static void DrawObjectGetter(ObjectGetter getter, string getterName)
break;
}

RotationConfigWindow.StatusPopUp(key, BadStatus, ref _statusSearching, s => getter.Status = s.RowId);
RotationConfigWindow.StatusPopUp(key, RotationConfigWindow.BadStatus, ref _statusSearching, s => getter.Status = s.RowId);

if (getter.Status != 0)
{
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver/Updaters/PreviewUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using RotationSolver.Basic.Configuration;
using RotationSolver.Commands;

namespace RotationSolver.Updaters;
Expand Down Expand Up @@ -56,7 +57,11 @@ private static unsafe void UpdateCancelCast()
&& Svc.Objects.SearchById(Player.Object.CastTargetObjectId) is BattleChara b
&& b.IsEnemy() && b.CurrentHp == 0;

if (_tarStopCastDelay.Delay(tarDead))
var statusTimes = Player.Object.StatusTimes(false, [.. OtherConfiguration.NoCastingStatus.Select(i => (StatusID)i)]);

var stopDueStatus = statusTimes.Any() && statusTimes.Min() > Player.Object.TotalCastTime - Player.Object.CurrentCastTime;

if (_tarStopCastDelay.Delay(tarDead) || stopDueStatus)
{
UIState.Instance()->Hotbar.CancelCast();
}
Expand Down
6 changes: 5 additions & 1 deletion RotationSolver/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ private static IntPtr ActorVfxNewHandler(string path, IntPtr a2, IntPtr a3, floa

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

#if DEBUG
if(obj is PlayerCharacter)
{
Svc.Log.Debug("Object: " + path);
#endif
}
#endif
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion XIVPainter

0 comments on commit 0792e9f

Please sign in to comment.