Skip to content

Commit

Permalink
Merge pull request #606 from CritoCantCode/UI-grammar-pass
Browse files Browse the repository at this point in the history
UI Grammar Pass
  • Loading branch information
LTS-FFXIV authored Jan 31, 2025
2 parents 76b9c10 + 3aeeeee commit bf31547
Show file tree
Hide file tree
Showing 23 changed files with 233 additions and 281 deletions.
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/MedicineItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ public MedicineItem(Item item) : base(item)
};
}

protected override bool CanUseThis => DataCenter.RightNowTinctureUseType == TinctureUseType.Anywhere || (DataCenter.RightNowTinctureUseType == TinctureUseType.InHighEndDuty && (DataCenter.Territory?.IsHighEndDuty ?? false));
protected override bool CanUseThis => DataCenter.CurrentTinctureUseType == TinctureUseType.Anywhere || (DataCenter.CurrentTinctureUseType == TinctureUseType.InHighEndDuty && (DataCenter.Territory?.IsHighEndDuty ?? false));
}
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Configuration/ConditionBoolean.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void ResetValue()
public static implicit operator bool(ConditionBoolean condition)
{
if (!Service.Config.UseAdditionalConditions) return condition.Value;
var rotation = DataCenter.RightNowRotation;
var rotation = DataCenter.CurrentRotation;
var set = DataCenter.RightSet;
if (rotation != null)
{
Expand Down
72 changes: 36 additions & 36 deletions RotationSolver.Basic/Configuration/Configs.cs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public static MajorConditionSet RightSet
internal static Queue<(DateTime time, SortedList<ulong, float> hpRatios)> RecordedHP { get; } =
new(HP_RECORD_TIME + 1);

public static ICustomRotation? RightNowRotation { get; internal set; }
public static DutyRotation? RightNowDutyRotation { get; internal set; }
public static ICustomRotation? CurrentRotation { get; internal set; }
public static DutyRotation? CurrentDutyRotation { get; internal set; }

public static Dictionary<string, DateTime> SystemWarnings { get; set; } = new();

Expand Down Expand Up @@ -192,8 +192,8 @@ internal static void AddCommandAction(IAction act, double time)
NextActs.Sort((a, b) => a.DeadTime.CompareTo(b.DeadTime));
}

public static TargetHostileType RightNowTargetToHostileType => Service.Config.HostileType;
public static TinctureUseType RightNowTinctureUseType => Service.Config.TinctureType;
public static TargetHostileType CurrentTargetToHostileType => Service.Config.HostileType;
public static TinctureUseType CurrentTinctureUseType => Service.Config.TinctureType;

public static unsafe ActionID LastComboAction => (ActionID)ActionManager.Instance()->Combo.Action;
public static unsafe float ComboTime => ActionManager.Instance()->Combo.Timer;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Helpers/ObjectHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ internal static bool IsAttackable(this IBattleChara battleChara)
if (battleChara.TargetObject == Player.Object
|| battleChara.TargetObject?.OwnerId == Player.Object.GameObjectId) return true;

return DataCenter.RightNowTargetToHostileType switch
return DataCenter.CurrentTargetToHostileType switch
{
TargetHostileType.AllTargetsCanAttack => true,
TargetHostileType.TargetsHaveTarget => battleChara.TargetObject is IBattleChara,
Expand Down
26 changes: 13 additions & 13 deletions RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private bool MyInterruptAbility(JobRole role, IAction nextGCD, out IAction? act)
/// <returns>True if the interrupt ability can be used; otherwise, false.</returns>
protected virtual bool InterruptAbility(IAction nextGCD, out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.InterruptAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.InterruptAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand Down Expand Up @@ -337,7 +337,7 @@ private bool AntiKnockback(JobRole role, IAction nextGCD, out IAction? act)
/// <returns>True if the anti-knockback ability can be used; otherwise, false.</returns>
protected virtual bool AntiKnockbackAbility(IAction nextGCD, out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.AntiKnockbackAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.AntiKnockbackAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand All @@ -350,7 +350,7 @@ protected virtual bool AntiKnockbackAbility(IAction nextGCD, out IAction? act)
/// <returns>True if the provoke ability can be used; otherwise, false.</returns>
protected virtual bool ProvokeAbility(IAction nextGCD, out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.ProvokeAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.ProvokeAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand Down Expand Up @@ -424,7 +424,7 @@ protected virtual bool EmergencyAbility(IAction nextGCD, out IAction? act)
}
}

if (DataCenter.RightNowDutyRotation?.EmergencyAbility(nextGCD, out act) ?? false)
if (DataCenter.CurrentDutyRotation?.EmergencyAbility(nextGCD, out act) ?? false)
{
return true;
}
Expand All @@ -449,7 +449,7 @@ protected virtual bool EmergencyAbility(IAction nextGCD, out IAction? act)
[RotationDesc(DescType.MoveForwardAbility)]
protected virtual bool MoveForwardAbility(IAction nextGCD, out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.MoveForwardAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.MoveForwardAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand All @@ -463,7 +463,7 @@ protected virtual bool MoveForwardAbility(IAction nextGCD, out IAction? act)
[RotationDesc(DescType.MoveBackAbility)]
protected virtual bool MoveBackAbility(IAction nextGCD, out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.MoveBackAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.MoveBackAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand All @@ -478,7 +478,7 @@ protected virtual bool MoveBackAbility(IAction nextGCD, out IAction? act)
protected virtual bool HealSingleAbility(IAction nextGCD, out IAction? act)
{
if (RecuperatePvP.CanUse(out act)) return true;
if (DataCenter.RightNowDutyRotation?.HealSingleAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.HealSingleAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand All @@ -492,7 +492,7 @@ protected virtual bool HealSingleAbility(IAction nextGCD, out IAction? act)
[RotationDesc(DescType.HealAreaAbility)]
protected virtual bool HealAreaAbility(IAction nextGCD, out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.HealAreaAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.HealAreaAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand All @@ -506,7 +506,7 @@ protected virtual bool HealAreaAbility(IAction nextGCD, out IAction? act)
[RotationDesc(DescType.DefenseSingleAbility)]
protected virtual bool DefenseSingleAbility(IAction nextGCD, out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.DefenseSingleAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.DefenseSingleAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand All @@ -520,7 +520,7 @@ protected virtual bool DefenseSingleAbility(IAction nextGCD, out IAction? act)
[RotationDesc(DescType.DefenseAreaAbility)]
protected virtual bool DefenseAreaAbility(IAction nextGCD, out IAction? act)
{
if (DataCenter.RightNowDutyRotation?.DefenseAreaAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.DefenseAreaAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand All @@ -538,7 +538,7 @@ protected virtual bool SpeedAbility(IAction nextGCD, out IAction? act)
if (PelotonPvE.CanUse(out act, skipAoeCheck: true)) return true;
if (SprintPvE.CanUse(out act)) return true;

if (DataCenter.RightNowDutyRotation?.SpeedAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.SpeedAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand All @@ -556,7 +556,7 @@ protected virtual bool GeneralAbility(IAction nextGCD, out IAction? act)
act = null;
}

if (DataCenter.RightNowDutyRotation?.GeneralAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.GeneralAbility(nextGCD, out act) ?? false) return true;

act = null;
return false;
Expand All @@ -575,7 +575,7 @@ protected virtual bool AttackAbility(IAction nextGCD, out IAction? act)
act = null;
}

if (DataCenter.RightNowDutyRotation?.AttackAbility(nextGCD, out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.AttackAbility(nextGCD, out act) ?? false) return true;
act = null;
return false;
}
Expand Down
20 changes: 10 additions & 10 deletions RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected virtual bool MyInterruptGCD(out IAction? act)
act = null;
if (ShouldSkipAction()) return false;

if (DataCenter.RightNowDutyRotation?.MyInterruptGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.MyInterruptGCD(out act) ?? false) return true;
act = null; return false;
}

Expand All @@ -227,7 +227,7 @@ protected virtual bool RaiseGCD(out IAction? act)
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.RightNowDutyRotation?.RaiseGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.RaiseGCD(out act) ?? false) return true;
IBaseAction.ShouldEndSpecial = false;
act = null; return false;
}
Expand All @@ -246,7 +246,7 @@ protected virtual bool DispelGCD(out IAction? act)
IBaseAction.ShouldEndSpecial = true;
}
if (!HasSwift && EsunaPvE.CanUse(out act)) return true;
if (DataCenter.RightNowDutyRotation?.DispelGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.DispelGCD(out act) ?? false) return true;
IBaseAction.ShouldEndSpecial = false;
return false;
}
Expand All @@ -267,7 +267,7 @@ protected virtual bool EmergencyGCD(out IAction? act)
act = null;
if (ShouldSkipAction()) return false;

if (DataCenter.RightNowDutyRotation?.EmergencyGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.EmergencyGCD(out act) ?? false) return true;

act = null!; return false;
}
Expand All @@ -287,7 +287,7 @@ protected virtual bool MoveForwardGCD(out IAction? act)
IBaseAction.ShouldEndSpecial = true;
}

if (DataCenter.RightNowDutyRotation?.MoveForwardGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.MoveForwardGCD(out act) ?? false) return true;
IBaseAction.ShouldEndSpecial = false;
act = null; return false;
}
Expand All @@ -307,7 +307,7 @@ protected virtual bool HealSingleGCD(out IAction? act)
IBaseAction.ShouldEndSpecial = true;
}

if (DataCenter.RightNowDutyRotation?.HealSingleGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.HealSingleGCD(out act) ?? false) return true;
IBaseAction.ShouldEndSpecial = false;
act = null; return false;
}
Expand All @@ -327,7 +327,7 @@ protected virtual bool HealAreaGCD(out IAction? act)
IBaseAction.ShouldEndSpecial = true;
}

if (DataCenter.RightNowDutyRotation?.HealAreaGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.HealAreaGCD(out act) ?? false) return true;
IBaseAction.ShouldEndSpecial = false;
act = null!; return false;
}
Expand All @@ -347,7 +347,7 @@ protected virtual bool DefenseSingleGCD(out IAction? act)
IBaseAction.ShouldEndSpecial = true;
}

if (DataCenter.RightNowDutyRotation?.DefenseSingleGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.DefenseSingleGCD(out act) ?? false) return true;
IBaseAction.ShouldEndSpecial = false;
act = null!; return false;
}
Expand All @@ -367,7 +367,7 @@ protected virtual bool DefenseAreaGCD(out IAction? act)
IBaseAction.ShouldEndSpecial = true;
}

if (DataCenter.RightNowDutyRotation?.DefenseAreaGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.DefenseAreaGCD(out act) ?? false) return true;
IBaseAction.ShouldEndSpecial = false;
act = null; return false;
}
Expand All @@ -386,7 +386,7 @@ protected virtual bool GeneralGCD(out IAction? act)
return false;
}

if (DataCenter.RightNowDutyRotation?.GeneralGCD(out act) ?? false) return true;
if (DataCenter.CurrentDutyRotation?.GeneralGCD(out act) ?? false) return true;
act = null; return false;
}

Expand Down
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Rotations/CustomRotation_Items.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ protected bool UseBurstMedicine(out IAction? act, bool clippingCheck = true)
bool isHostileTargetDummy = HostileTarget?.IsDummy() ?? false;
bool isInHighEndDuty = DataCenter.Territory?.IsHighEndDuty ?? false;

if (!isHostileTargetDummy && !isInHighEndDuty && DataCenter.RightNowTinctureUseType == TinctureUseType.InHighEndDuty)
if (!isHostileTargetDummy && !isInHighEndDuty && DataCenter.CurrentTinctureUseType == TinctureUseType.InHighEndDuty)
{
return false;
}

if (DataCenter.RightNowTinctureUseType == TinctureUseType.Nowhere) return false;
if (DataCenter.CurrentTinctureUseType == TinctureUseType.Nowhere) return false;

foreach (var medicine in Medicines)
{
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ internal static void UpdateRotationState()
(Service.Config.AutoOffBetweenArea && (Svc.Condition[ConditionFlag.BetweenAreas] || Svc.Condition[ConditionFlag.BetweenAreas51])) ||
(Service.Config.CancelStateOnCombatBeforeCountdown && Service.CountDownTime > 0.2f && DataCenter.InCombat) ||
(ActionUpdater.AutoCancelTime != DateTime.MinValue && DateTime.Now > ActionUpdater.AutoCancelTime) ||
(DataCenter.RightSet.SwitchCancelConditionSet?.IsTrue(DataCenter.RightNowRotation) ?? false))
(DataCenter.RightSet.SwitchCancelConditionSet?.IsTrue(DataCenter.CurrentRotation) ?? false))
{
CancelState();
#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'
Expand Down Expand Up @@ -235,14 +235,14 @@ internal static void UpdateRotationState()
_lastCountdownTime = 0;
CancelState();
}
else if (DataCenter.RightSet.SwitchManualConditionSet?.IsTrue(DataCenter.RightNowRotation) ?? false)
else if (DataCenter.RightSet.SwitchManualConditionSet?.IsTrue(DataCenter.CurrentRotation) ?? false)
{
if (!DataCenter.State)
{
DoStateCommandType(StateCommandType.Manual);
}
}
else if (DataCenter.RightSet.SwitchAutoConditionSet?.IsTrue(DataCenter.RightNowRotation) ?? false)
else if (DataCenter.RightSet.SwitchAutoConditionSet?.IsTrue(DataCenter.CurrentRotation) ?? false)
{
if (!DataCenter.State)
{
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Commands/RSCommands_OtherCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private static void DoOtherCommand(OtherCommandType otherType, string str)

private static void ExecuteRotationCommand(string str)
{
var customCombo = DataCenter.RightNowRotation;
var customCombo = DataCenter.CurrentRotation;
if (customCombo == null) return;

DoRotationCommand(customCombo, str);
Expand Down
Loading

0 comments on commit bf31547

Please sign in to comment.