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

Commit

Permalink
fix: changed the watcher for count check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 14, 2023
1 parent bc73dd5 commit 453ed68
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
1 change: 0 additions & 1 deletion RotationSolver/UI/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ internal static void DrawCheckBox(string name, SettingsCommand command, string d
{
Service.Config.SetValue(command, value);
otherThing?.Invoke();
Service.Config.Save();
});

ImGui.SameLine();
Expand Down
22 changes: 17 additions & 5 deletions RotationSolver/Watcher.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Hooking;
using Dalamud.Interface.Colors;
using Dalamud.Logging;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game;
using RotationSolver.Localization;
Expand Down Expand Up @@ -34,28 +35,39 @@ private static unsafe void ReceiveAbilityEffect(uint sourceId, IntPtr sourceChar
{
_receiveAbilityHook.Original(sourceId, sourceCharacter, pos, effectHeader, effectArray, effectTargets);
if (Service.Player == null) return;
var set = new ActionEffectSet(effectHeader, effectArray, effectTargets);

ActionFromSelf(sourceId, set, effectArray->Param2);
ActionFromEnemy(sourceId, set);
try
{
var set = new ActionEffectSet(effectHeader, effectArray, effectTargets);

ActionFromSelf(sourceId, set);
ActionFromEnemy(sourceId, set);
}
catch(Exception ex)
{
PluginLog.Error(ex, "Error at Ability Receive.");
}
}

private static void ActionFromEnemy(uint sourceId, ActionEffectSet set)
{
var source = Service.ObjectTable.SearchById(sourceId);
if(source == null) return;
if (source == null) return;
if (source is not BattleChara battle) return;
if (battle is PlayerCharacter) return;

ShowStrEnemy = set.ToString();
}

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

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

var action = set.Action;
var tar = set.Target;

Expand Down

0 comments on commit 453ed68

Please sign in to comment.