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

Commit

Permalink
fix: fixed the heal potion usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed May 2, 2023
1 parent c11e8a6 commit ef42c91
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 28 deletions.
93 changes: 91 additions & 2 deletions Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,66 @@
"46": 0.6,
"48": 0.6,
"52": 0.6,
"53": 0.6,
"54": 0.6,
"56": 0.6,
"61": 0.6,
"62": 0.6,
"65": 0.6,
"66": 0.6,
"69": 0.6,
"70": 0.6,
"74": 0.6,
"97": 0.6,
"98": 0.6,
"100": 0.6,
"101": 0.6,
"106": 0.6,
"107": 0.6,
"110": 0.6,
"113": 0.6,
"114": 0.6,
"116": 0.6,
"117": 0.6,
"118": 0.6,
"127": 0.1,
"132": 0.6,
"133": 0.1,
"135": 0.1,
"136": 0.6,
"137": 0.6,
"139": 0.1,
"140": 0.6,
"141": 0.1,
"147": 0.1,
"149": 0.6,
"152": 0.1,
"153": 0.1,
"152": 0.6,
"153": 0.6,
"154": 0.1,
"156": 0.6,
"158": 0.6,
"159": 0.1,
"162": 0.1,
"167": 0.6,
"181": 0.6,
"185": 0.1,
"190": 0.1,
"3545": 0.6,
"3546": 0.6,
"3549": 0.6,
"3550": 0.6,
"3552": 0.6,
"3558": 0.6,
"3559": 0.6,
"3560": 0.6,
"3562": 0.6,
"3573": 0.6,
"3574": 0.6,
"3576": 0.1,
"3577": 0.1,
"3578": 0.6,
"3579": 0.1,
"3582": 0.6,
"3587": 0.6,
"3590": 0.6,
"3593": 0.6,
Expand All @@ -43,6 +87,7 @@
"3613": 0.6,
"3614": 0.6,
"3615": 0.6,
"4262": 0.6,
"4401": 0.6,
"4402": 0.6,
"4403": 0.6,
Expand All @@ -54,7 +99,19 @@
"7387": 0.6,
"7388": 0.6,
"7389": 0.6,
"7395": 0.6,
"7396": 0.6,
"7404": 0.6,
"7406": 0.6,
"7407": 0.6,
"7409": 0.6,
"7421": 0.6,
"7426": 0.6,
"7427": 0.6,
"7429": 0.6,
"7431": 0.1,
"7432": 0.6,
"7447": 0.1,
"7503": 0.1,
"7505": 0.6,
"7506": 0.6,
Expand All @@ -70,12 +127,17 @@
"7533": 0.6,
"7535": 0.6,
"7540": 0.6,
"7541": 0.6,
"7542": 0.6,
"7546": 0.6,
"7548": 0.6,
"7557": 0.6,
"7559": 0.6,
"7560": 0.6,
"7561": 0.6,
"7562": 0.6,
"7568": 0.1,
"7863": 0.6,
"9793": 0.1,
"10083": 0.1,
"12260": 0.1,
Expand All @@ -98,8 +160,14 @@
"16165": 0.6,
"16462": 0.6,
"16464": 0.6,
"16473": 0.6,
"16495": 0.6,
"16496": 0.6,
"16505": 0.1,
"16507": 0.6,
"16508": 0.6,
"16510": 0.6,
"16514": 0.6,
"16524": 0.1,
"16525": 0.1,
"16527": 0.6,
Expand Down Expand Up @@ -139,9 +207,30 @@
"25753": 1.15,
"25759": 0.6,
"25760": 0.6,
"25761": 0.6,
"25762": 0.6,
"25763": 0.6,
"25766": 0.6,
"25768": 0.6,
"25784": 0.6,
"25785": 0.6,
"25793": 0.1,
"25796": 0.6,
"25797": 0.6,
"25798": 0.1,
"25799": 0.6,
"25801": 0.6,
"25820": 0.6,
"25826": 0.1,
"25830": 0.6,
"25835": 0.75,
"25836": 0.6,
"25837": 0.1,
"25838": 0.6,
"25839": 0.6,
"25840": 0.6,
"25865": 0.1,
"25870": 0.6,
"25885": 0.6,
"31323": 2.1
}
7 changes: 5 additions & 2 deletions RotationSolver.Basic/Actions/BaseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ public virtual unsafe bool CanUse(out IAction item)

var remain = RecastTimeOneCharge - RecastTimeElapsed;

if (DataCenter.NextAbilityToNextGCD > AnimationLockTime + DataCenter.Ping + DataCenter.MinAnimationLock) return false;
if(DataCenter.WeaponRemain > 0)
{
if (DataCenter.NextAbilityToNextGCD > AnimationLockTime + DataCenter.Ping + DataCenter.MinAnimationLock) return false;

if (CooldownHelper.RecastAfter(DataCenter.ActionRemain, remain, false)) return false;
if (CooldownHelper.RecastAfter(DataCenter.ActionRemain, remain, false)) return false;
}

if (OtherCheck != null && !OtherCheck()) return false;

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/Basic/BRD_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ protected sealed override bool DefenseAreaAbility(out IAction act)
protected sealed override bool HealSingleAbility(out IAction act)
{
if (NaturesMinne.CanUse(out act)) return true;
return false;
return base.HealSingleAbility(out act);
}
}
3 changes: 1 addition & 2 deletions RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ private bool GeneralHealAbility(SpecialCommandType specialType, out IAction act)
if (DataCenter.SpecialType == SpecialCommandType.HealSingle || CanHealSingleAbility)
{
if (HealSingleAbility(out act)) return true;
if (UseHealPotion(out act)) return true;
}
}

Expand Down Expand Up @@ -286,7 +285,7 @@ protected virtual bool MoveBackAbility(out IAction act)
[RotationDesc(DescType.HealSingleAbility)]
protected virtual bool HealSingleAbility(out IAction act)
{
act = null; return false;
return UseHealPotion(out act);
}

[RotationDesc(DescType.HealAreaAbility)]
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver.Basic/Rotations/CustomRotation_Medicine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ protected bool UseBurstMedicine(out IAction act)

private bool UseHealPotion(out IAction act)
{
var acts = from prop in GetType().GetProperties()
where typeof(HealPotionItem).IsAssignableFrom(prop.PropertyType) && !(prop.GetMethod?.IsPrivate ?? true)
select (HealPotionItem)prop.GetValue(this) into a
var acts = from prop in typeof(CustomRotation).GetProperties()
where !(prop.GetMethod?.IsPrivate ?? true) && typeof(IBaseItem).IsAssignableFrom(prop.PropertyType)
select prop.GetValue(this) as HealPotionItem into a
where a != null && a.CanUse(out _)
orderby a.MaxHealHp
select a;
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@
"SpecialCommandType_AntiKnockback": "Anti-Knockback",
"SpecialCommandType_Burst": "Burst",
"SpecialCommandType_EndSpecial": "End Special",
"SpecialCommandType_Smart": "Smart ",
"SpecialCommandType_Manual": "Manual",
"SpecialCommandType_Smart": "Auto Target ",
"SpecialCommandType_Manual": "Manual Target",
"SpecialCommandType_Cancel": "Cancel",
"SpecialCommandType_Off": "Off",
"ActionConditionType_Elapsed": "Elapsed",
Expand Down
13 changes: 1 addition & 12 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ private void DrawDebugTab()
DrawParamTabItem("Target Data", DrawTargetData);
DrawParamTabItem("Next Action", DrawNextAction);
DrawParamTabItem("Last Action", DrawLastAction);
DrawParamTabItem("CD, EX", DrawCDEX);
DrawParamTabItem("Icon", DrawIcon);
DrawParamTabItem("Effect", () =>
{
Expand Down Expand Up @@ -58,6 +57,7 @@ private unsafe void DrawStatus()
ImGui.Text("Have Companion: " + DataCenter.HasCompanion.ToString());
ImGui.Text("Ping: " + DataCenter.Ping.ToString());
ImGui.Text("MP: " + DataCenter.CurrentMp.ToString());
ImGui.Text("Count Down: " + Service.CountDownTime.ToString());

foreach (var status in Service.Player.StatusList)
{
Expand Down Expand Up @@ -159,17 +159,6 @@ private void DrawLastAction()
DrawAction(DataCenter.LastComboAction, nameof(DataCenter.LastComboAction));
}

private void DrawCDEX()
{
ImGui.Text("Count Down: " + Service.CountDownTime.ToString());

if (ActionUpdater.exception != null)
{
ImGui.Text(ActionUpdater.exception.Message);
ImGui.Text(ActionUpdater.exception.StackTrace);
}
}

private unsafe void DrawIcon()
{
//var pointer = (AddonActionCross*) Service.GetAddon<AddonActionCross>();
Expand Down
5 changes: 2 additions & 3 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Logging;
using FFXIVClientStructs.FFXIV.Client.Game;
using RotationSolver.Commands;
using RotationSolver.Localization;
Expand All @@ -15,8 +16,6 @@ internal static class ActionUpdater
internal static IAction NextAction { get; private set; }
internal static IBaseAction NextGCDAction { get; private set; }

internal static Exception exception;

internal static void UpdateNextAction()
{
PlayerCharacter localPlayer = Service.Player;
Expand Down Expand Up @@ -58,7 +57,7 @@ internal static void UpdateNextAction()
}
catch (Exception ex)
{
exception = ex;
PluginLog.Error(ex, "Failed to update next action.");
}

NextAction = NextGCDAction = null;
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ private static void ActionFromSelf(uint sourceId, ActionEffectSet set, uint id)
{
if (sourceId != Service.Player.ObjectId) return;
if (set.Type != ActionType.Spell && set.Type != ActionType.Item) return;
if ((ActionCate)set.Action?.ActionCategory.Value.RowId == ActionCate.AutoAttack) return;
if (set.Action == null) return;
if ((ActionCate)set.Action.ActionCategory.Value.RowId == ActionCate.AutoAttack) return;

if(set.Action.ClassJob.Row > 0 || Enum.IsDefined((ActionID)id))
{
Expand Down

0 comments on commit ef42c91

Please sign in to comment.