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

Commit

Permalink
fix: add animationLockTime property for IAction.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 19, 2023
1 parent 121c98b commit 8a9e8fc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public virtual unsafe uint MPNeed

public uint SortKey => CoolDownGroup;

public float AnimationLockTime => IActionHelper.AnimationLockTime.TryGetValue(AdjustedID, out var time) ? time : 0.6f;

public BaseAction(ActionID actionID, ActionOption option = ActionOption.None)
{
_action = Service.GetSheet<Action>().GetRow((uint)actionID);
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Actions/BaseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public bool IsInCooldown

public uint SortKey { get; }

public float AnimationLockTime => IActionHelper.AnimationLockTime.TryGetValue(AdjustedID, out var time) ? time : 1.1f;

public unsafe BaseItem(uint row, uint a4 = 65535)
{
_item = Service.GetSheet<Item>().GetRow(row);
Expand Down
1 change: 1 addition & 0 deletions RotationSolver.Basic/Actions/IAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public interface IAction : ITexture
uint ID { get; }
uint AdjustedID { get; }
float RecastTimeOneCharge { get; }
float AnimationLockTime { get; }
uint SortKey { get; }

/// <summary>
Expand Down
11 changes: 6 additions & 5 deletions RotationSolver/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private static unsafe void ReceiveAbilityEffect(uint sourceId, IntPtr sourceChar
{
var set = new ActionEffectSet(sourceId, effectHeader, effectArray, effectTargets);

ActionFromSelf(sourceId, set);
ActionFromSelf(sourceId, set, effectHeader->actionId);
ActionFromEnemy(sourceId, set);
}
catch(Exception ex)
Expand Down Expand Up @@ -71,13 +71,15 @@ private static void ActionFromEnemy(uint sourceId, ActionEffectSet set)
ShowStrEnemy = $"Damage Ratio: {damageRatio}\n{set}";
}

private static void ActionFromSelf(uint sourceId, ActionEffectSet set)
private static void ActionFromSelf(uint sourceId, ActionEffectSet set, uint id)
{
if (sourceId != Service.Player.ObjectId) return;
if (set.Type != ActionType.Spell) return;
if (set.Type != ActionType.Spell && set.Type != ActionType.Item) return;
if ((ActionCate)set.Action?.ActionCategory.Value.RowId == ActionCate.AutoAttack) return;

if(!set.TargetEffects.Any()) return;
IActionHelper.AnimationLockTime[id] = set.AnimationLock;

if (!set.TargetEffects.Any()) return;
var flag = set.TargetEffects.FirstOrDefault()[0].Param2;

var action = set.Action;
Expand All @@ -88,7 +90,6 @@ private static void ActionFromSelf(uint sourceId, ActionEffectSet set)
//Record
DataCenter.AddActionRec(set.Action);
DataCenter.NextActionMinTime = DateTime.Now.AddSeconds(set.AnimationLock);
IActionHelper.AnimationLockTime[set.Action.RowId] = set.AnimationLock;
ShowStrSelf = set.ToString();

//Macro
Expand Down

0 comments on commit 8a9e8fc

Please sign in to comment.