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

Commit

Permalink
fix: role action role check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 18, 2024
1 parent b713a6a commit f264523
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
11 changes: 8 additions & 3 deletions RotationSolver.Basic/Actions/ActionBasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,21 @@ internal readonly bool BasicCheck(bool skipStatusProvideCheck, bool skipCombo, b
if (player.HasStatus(true, _action.Setting.StatusProvide)) return false;
}

if(_action.Action.ActionCategory.Row == 15)
if (_action.Action.ActionCategory.Row == 15)
{
if (CustomRotation.LimitBreakLevel <= 1) return false;
}

if(!skipCombo && IsGeneralGCD)
if (!skipCombo && IsGeneralGCD)
{
if (!CheckForCombo()) return false;
}

if (_action.Action.IsRoleAction)
{
if (!_action.Action.ClassJobCategory.Value?.IsJobInCategory(DataCenter.Job) ?? false) return false;
}

//Need casting.
if (CastTime > 0 && !player.HasStatus(true,
[
Expand All @@ -133,7 +138,7 @@ internal readonly bool BasicCheck(bool skipStatusProvideCheck, bool skipCombo, b
&& DataCenter.TimeSinceLastAction.TotalSeconds < 3) return false;

if (!(_action.Setting.ActionCheck?.Invoke() ?? true)) return false;
if (!(_action.Setting.RotationCheck?.Invoke() ?? true)) return false;
if (!IBaseAction.ForceEnable && !(_action.Setting.RotationCheck?.Invoke() ?? true)) return false;

return true;
}
Expand Down
1 change: 1 addition & 0 deletions RotationSolver.Basic/Actions/BaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public bool CanUse(out IAction act, bool skipStatusProvideCheck = false, bool sk
bool isEmpty = false, bool onLastAbility = false, bool ignoreClippingCheck = false, bool skipAoeCheck = false, byte gcdCountForAbility = 0)
{
act = this!;

Setting.EndSpecial = IBaseAction.ShouldEndSpecial;

if (IBaseAction.ActionPreview)
Expand Down
7 changes: 3 additions & 4 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,9 @@ internal static SpecialCommandType SpecialType

internal static float CombatTimeRaw { get; set; }

public static IEnumerable<BattleChara> PartyMembers { get; internal set; } = Array.Empty<PlayerCharacter>();
public static IEnumerable<BattleChara> AllianceMembers { get; internal set; } = Array.Empty<PlayerCharacter>();

public static IEnumerable<BattleChara> AllHostileTargets { get; internal set; } = Array.Empty<BattleChara>();
public static BattleChara[] PartyMembers { get; internal set; } = [];
public static BattleChara[] AllianceMembers { get; internal set; } = [];
public static BattleChara[] AllHostileTargets { get; internal set; } = [];

public static BattleChara? InterruptTarget { get; internal set; }

Expand Down
5 changes: 1 addition & 4 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
"RotationSolver.Basic.Data.SpecialCommandType.Speed": "Open a window to speed up.",
"RotationSolver.Basic.Data.TargetHostileType.TargetsHaveTarget": "Previously engaged targets (engages on countdown timer)",
"RotationSolver.Data.UiString.ActionAttack": "Attack",
"RotationSolver.Data.UiString.ActionAbility": "Ability",
"RotationSolver.Data.UiString.ActionFriendly": "Friendly",
"RotationSolver.Data.UiString.SpecialCommandType_Smart": "Auto Target ",
"RotationSolver.Data.UiString.SpecialCommandType_Off": "Off",
"RotationSolver.Data.UiString.SpecialCommandType_Cancel": "Cancel"
"RotationSolver.Data.UiString.ActionAbility": "Ability"
}
1 change: 0 additions & 1 deletion RotationSolver/Updaters/MajorUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using FFXIVClientStructs.FFXIV.Client.Game.Control;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using FFXIVClientStructs.FFXIV.Component.GUI;
using RotationSolver.Basic.Configuration;
using RotationSolver.Commands;
using RotationSolver.Data;
using RotationSolver.Localization;
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private unsafe static void UpdateHostileTargets(IEnumerable<BattleChara> allTarg
if (DownloadHelper.ContributorsHash.Contains(hash)) return false;
}
return true;
});
}).ToArray();

var timesToKill = DataCenter.AllHostileTargets.Select(b => b.GetTimeToKill()).Where(v => !float.IsNaN(v));
DataCenter.AverageTimeToKill = timesToKill.Any() ? timesToKill.Average() : 0;
Expand Down Expand Up @@ -204,8 +204,8 @@ private static bool IsHostileCastingBase(BattleChara h, Func<Action, bool> check
private static uint _lastMp = 0;
private unsafe static void UpdateFriends(IEnumerable<BattleChara> allTargets)
{
DataCenter.AllianceMembers = allTargets.Where(ObjectHelper.IsAlliance);
DataCenter.PartyMembers = DataCenter.AllianceMembers.Where(ObjectHelper.IsParty);
DataCenter.AllianceMembers = allTargets.Where(ObjectHelper.IsAlliance).ToArray();
DataCenter.PartyMembers = DataCenter.AllianceMembers.Where(ObjectHelper.IsParty).ToArray();

var mayPet = allTargets.OfType<BattleNpc>().Where(npc => npc.OwnerId == Player.Object.ObjectId);
DataCenter.HasPet = mayPet.Any(npc => npc.BattleNpcKind == BattleNpcSubKind.Pet);
Expand Down
2 changes: 1 addition & 1 deletion XIVPainter

0 comments on commit f264523

Please sign in to comment.