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

Commit

Permalink
fix: timeline add combat time condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jan 27, 2023
1 parent f8db907 commit c34156e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
6 changes: 3 additions & 3 deletions RotationSolver/Actions/IBaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ internal interface IBaseAction : IAction, IEnable
/// <param name="act"></param>
/// <param name="mustUse">AOE only need one target to use.
/// Moving action don't need to have enough distance to use.
/// Skip for <seealso cref="StatusProvide"/> and <seealso cref="TargetStatus"> cheking.</param>
/// <param name="emptyOrSkipCombo">Use all charges, no keeping.
/// Skip for <seealso cref="StatusProvide"/> and <seealso cref="TargetStatus"> checking.</param>
/// <param name="emptyOrSkipCombo">Use all charges, no keeping one.
/// Do not need to check the combo.</param>
/// <param name="skipDisable">skip the diable for emergency use. Please always set this to false.</param>
/// <param name="skipDisable">Skip the diable for emergency use. Please always set this to false.</param>
/// <returns>Should I use.</returns>
bool CanUse(out IAction act, bool mustUse = false, bool emptyOrSkipCombo = false, bool skipDisable = false);

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"Timeline_ConditionSet": "ConditionSet",
"Timeline_ActionCondition": "ActionCondition",
"Timeline_TargetCondition": "TargetCondition",
"Timeline_ComboCondition": "ComboCondition",
"Timeline_RotationCondition": "RotationCondition",
"Timeline_ActionTarget": "{0}'s target",
"Timeline_Target": "Target",
"Timeline_Player": "Player",
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ internal class Strings
public string Timeline_ConditionSet { get; set; } = "ConditionSet";
public string Timeline_ActionCondition { get; set; } = "ActionCondition";
public string Timeline_TargetCondition { get; set; } = "TargetCondition";
public string Timeline_ComboCondition { get; set; } = "ComboCondition";
public string Timeline_RotationCondition { get; set; } = "RotationCondition";
public string Timeline_ActionTarget { get; set; } = "{0}'s target";
public string Timeline_Target { get; set; } = "Target";
public string Timeline_Player { get; set; } = "Player";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ protected static bool EndAfterGCD(float remain, uint gcdCount = 0, uint abilityC
protected static bool EndAfter(float remain, float remainNeed)
=> CooldownHelper.RecastAfter(remain, remainNeed);

/// <summary>
/// Whether the battle lasted less than <paramref name="time"/> seconds
/// </summary>
/// <param name="time">time in second.</param>
/// <returns></returns>
public static bool CombatElapsed(float time)
{
return CooldownHelper.ElapsedAfter(time, (float)ActionUpdater.CombatTime.TotalSeconds);
}

public MethodInfo[] AllLast => GetType().GetStaticBoolMethodInfo(m =>
{
var types = m.GetParameters();
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Timeline/ConditionSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void AddButton()
AddOneCondition<ConditionSet>(LocalizationManager.RightLang.Timeline_ConditionSet);
AddOneCondition<ActionCondition>(LocalizationManager.RightLang.Timeline_ActionCondition);
AddOneCondition<TargetCondition>(LocalizationManager.RightLang.Timeline_TargetCondition);
AddOneCondition<RotationCondition>(LocalizationManager.RightLang.Timeline_ComboCondition);
AddOneCondition<RotationCondition>(LocalizationManager.RightLang.Timeline_RotationCondition);

ImGui.EndPopup();
}
Expand Down
21 changes: 19 additions & 2 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ internal static class ActionUpdater
private static IntPtr LastComboMove => ComboTimer + 4;
public static unsafe ActionID LastComboAction => *(ActionID*)LastComboMove;


static DateTime _startCombatTime = DateTime.MinValue;
public static TimeSpan CombatTime
{
get
{
if(_startCombatTime == DateTime.MinValue) return TimeSpan.Zero;
return DateTime.Now - _startCombatTime;
}
}
internal static float WeaponRemain { get; private set; } = 0;

internal static float WeaponTotal { get; private set; } = 0;
Expand Down Expand Up @@ -67,7 +75,16 @@ internal static void UpdateNextAction()

internal unsafe static void UpdateActionInfo()
{
var last = InCombat;
InCombat = Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.InCombat];
if(!last && InCombat)
{
_startCombatTime = DateTime.Now;
}
else if(last && !InCombat)
{
_startCombatTime = DateTime.MinValue;
}

for (int i = 0; i < BluSlots.Length; i++)
{
Expand Down Expand Up @@ -136,7 +153,7 @@ private static void UPdateMPTimer()
if (player == null) return;

//不是黑魔不考虑啊
if (player.ClassJob.Id != 25) return;
if (player.ClassJob.Id != (uint)ClassJobID.BlackMage) return;

//有醒梦,就算了啊
if (player.HasStatus(true, StatusID.LucidDreaming)) return;
Expand Down

0 comments on commit c34156e

Please sign in to comment.