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

Commit

Permalink
fix: is moving or jumping.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 28, 2023
1 parent 6713df5 commit 3dc7156
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public unsafe virtual bool CanUse(out IAction act, CanUseOption option = CanUseO
//Is knocking back.
if (DateTime.Now > DataCenter.KnockbackStart && DateTime.Now < DataCenter.KnockbackFinished) return false;

if (DataCenter.NoPoslock && DataCenter.IsMoving && !option.HasFlag(CanUseOption.IgnoreCastCheck)) return false;
if (DataCenter.NoPoslock && DataCenter.IsMovingOrJumping && !option.HasFlag(CanUseOption.IgnoreCastCheck)) return false;
}

if (IsGeneralGCD && IsEot && IsFriendly && IActionHelper.IsLastGCD(true, this)
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 @@ -196,7 +196,7 @@ private bool TargetAreaMove(float range, bool mustUse)
private bool TargetAreaFriend(float range, bool mustUse, PlayerCharacter player)
{
if (!Service.Config.GetValue(PluginConfigBool.UseGroundBeneficialAbility)) return false;
if (!Service.Config.GetValue(PluginConfigBool.UseGroundBeneficialAbilityWhenMoving) && DataCenter.IsMoving) return false;
if (!Service.Config.GetValue(PluginConfigBool.UseGroundBeneficialAbilityWhenMoving) && DataCenter.IsMovingOrJumping) return false;

var strategy = Service.Config.GetValue(PluginConfigInt.BeneficialAreaStrategy);
switch (strategy)
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static TargetingType TargetingType
}
}

public static bool IsMoving { get; internal set; }
public static bool IsMovingOrJumping { get; internal set; }

internal static float StopMovingRaw { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Helpers/ReflectionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static PropertyInfo[] GetStaticProperties<T>(this Type type)
var props = from prop in type.GetRuntimeProperties()
where typeof(T).IsAssignableFrom(prop.PropertyType)
&& prop.GetMethod is MethodInfo info
&& info.IsStatic
&& info.IsStatic && info.GetCustomAttribute<ObsoleteAttribute>() == null
select prop;

return props.Union(type.BaseType.GetStaticProperties<T>()).ToArray();
Expand Down
8 changes: 4 additions & 4 deletions RotationSolver.Basic/Rotations/Basic/SAM_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public static bool IsMoonTimeLessThanFlower
public static IBaseAction OgiNamikiri { get; } = new BaseAction(ActionID.OgiNamikiri)
{
StatusNeed = new[] { StatusID.OgiNamikiriReady },
ActionCheck = (b, m) => !IsMoving
ActionCheck = (b, m) => !IsMovingOrJumping
};

/// <summary>
Expand All @@ -174,7 +174,7 @@ public static bool IsMoonTimeLessThanFlower
/// </summary>
public static IBaseAction Higanbana { get; } = new BaseAction(ActionID.Higanbana, ActionOption.Dot)
{
ActionCheck = (b, m) => !IsMoving && SenCount == 1,
ActionCheck = (b, m) => !IsMovingOrJumping && SenCount == 1,
TargetStatus = new[] { StatusID.Higanbana },
TimeToDie = 40,
};
Expand All @@ -184,15 +184,15 @@ public static bool IsMoonTimeLessThanFlower
/// </summary>
public static IBaseAction TenkaGoken { get; } = new BaseAction(ActionID.TenkaGoken)
{
ActionCheck = (b, m) => !IsMoving && SenCount == 2,
ActionCheck = (b, m) => !IsMovingOrJumping && SenCount == 2,
};

/// <summary>
///
/// </summary>
public static IBaseAction MidareSetsugekka { get; } = new BaseAction(ActionID.MidareSetsugekka)
{
ActionCheck = (b, m) => !IsMoving && SenCount == 3,
ActionCheck = (b, m) => !IsMovingOrJumping && SenCount == 3,
};

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/Basic/SCH_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public abstract class SCH_Base : CustomRotation
/// </summary>
public static IBaseAction SacredSoil { get; } = new BaseAction(ActionID.SacredSoil, ActionOption.Heal)
{
ActionCheck = (b, m) => HasAetherflow && !IsMoving,
ActionCheck = (b, m) => HasAetherflow && !IsMovingOrJumping,
};

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/Basic/WHM_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ protected static bool LilyAfterGCD(uint gcdCount = 0, float offset = 0)
/// </summary>
public static IBaseAction PresenceOfMind { get; } = new BaseAction(ActionID.PresenceOfMind, ActionOption.Buff)
{
ActionCheck = (b, m) => !IsMoving && IsLongerThan(10),
ActionCheck = (b, m) => !IsMovingOrJumping && IsLongerThan(10),
};

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private bool Ability(IAction nextGCD, out IAction act, bool helpDefenseAOE, bool
if (GeneralAbility(out act)) return true;

//Run!
if (IsMoving && NotInCombatDelay && Service.Config.GetValue(PluginConfigBool.AutoSpeedOutOfCombat)
if (IsMovingOrJumping && NotInCombatDelay && Service.Config.GetValue(PluginConfigBool.AutoSpeedOutOfCombat)
&& SpeedAbility(out act)) return true;

return false;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public override bool CanUse(out IAction act, CanUseOption option = CanUseOption.
{
FilterForHostiles = bs => bs.Where(b =>
{
if (b.IsBoss() || IsMoving || b.CastActionId == 0) return false;
if (b.IsBoss() || IsMovingOrJumping || b.CastActionId == 0) return false;

if (!b.IsCastInterruptible || Interject.IsCoolingDown) return true;
return false;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private bool RaiseSpell(SpecialCommandType specialType, out IAction act, bool mu
{
return DataCenter.SetAutoStatus(AutoStatus.Raise, true);
}
else if(!IsMoving)
else if(!IsMovingOrJumping)
{
act = action;
return DataCenter.SetAutoStatus(AutoStatus.Raise, true);
Expand Down
10 changes: 8 additions & 2 deletions RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ public abstract partial class CustomRotation
/// <summary>
/// Check the player is moving, such as running, walking or jumping.
/// </summary>
public static bool IsMoving => DataCenter.IsMoving;
public static bool IsMovingOrJumping => DataCenter.IsMovingOrJumping;

/// <summary>
/// Is moving.
/// </summary>
[Obsolete("Please use IsMovingOrJumping Instead")]
public static bool IsMoving => IsMovingOrJumping;

/// <summary>
/// Is in combat.
Expand Down Expand Up @@ -481,7 +487,7 @@ public static float CombatTime
/// The time of stopping moving.
/// <br>WARNING: Do Not make this method the main of your rotation.</br>
/// </summary>
public static float StopMovingTime => IsMoving ? 0 : DataCenter.StopMovingRaw + DataCenter.WeaponRemain;
public static float StopMovingTime => IsMovingOrJumping ? 0 : DataCenter.StopMovingRaw + DataCenter.WeaponRemain;

/// <summary>
/// Time from GCD.
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ internal partial class Strings
public Dictionary<string, string> MemberInfoName { get; set; } = new Dictionary<string, string>()
{
#region Rotation
{ nameof(CustomRotation.IsMoving), "Is Moving"},
{ nameof(CustomRotation.IsMovingOrJumping), "Is Moving or Jumping"},
{ nameof(CustomRotation.HasSwift), "Has Swift"},
{ nameof(CustomRotation.HasTankStance), "Has tank stance"},
{ nameof(CustomRotation.InCombat), "In Combat"},
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,7 @@ private static unsafe void DrawStatus()
{
ImGui.Text("Fate: " + DataCenter.FateId.ToString());
}
ImGui.Text("Moving: " + DataCenter.IsMoving.ToString());
ImGui.Text("Moving: " + DataCenter.IsMovingOrJumping.ToString());
ImGui.Text("Stop Moving: " + DataCenter.StopMovingRaw.ToString());

ImGui.Text("TerritoryType: " + DataCenter.TerritoryContentType.ToString());
Expand Down
8 changes: 4 additions & 4 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ private unsafe static void UpdateSlots()
static DateTime _stopMovingTime = DateTime.MinValue;
private unsafe static void UpdateMoving()
{
var last = DataCenter.IsMoving;
DataCenter.IsMoving = AgentMap.Instance()->IsPlayerMoving > 0;
if (last && !DataCenter.IsMoving)
var last = DataCenter.IsMovingOrJumping;
DataCenter.IsMovingOrJumping = AgentMap.Instance()->IsPlayerMoving > 0 || Player.GameObject->GetHeight() > 0;
if (last && !DataCenter.IsMovingOrJumping)
{
_stopMovingTime = DateTime.Now;
}
else if (DataCenter.IsMoving)
else if (DataCenter.IsMovingOrJumping)
{
_stopMovingTime = DateTime.MinValue;
}
Expand Down

0 comments on commit 3dc7156

Please sign in to comment.