Skip to content

Commit

Permalink
Merge pull request #765 from erdelf/master
Browse files Browse the repository at this point in the history
Adjusting Wrath IPC + Combat detection
  • Loading branch information
erdelf authored Jan 20, 2025
2 parents 7ca3453 + d18c92d commit 56b5bc5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
7 changes: 0 additions & 7 deletions AutoDuty/AutoDuty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,14 +1212,7 @@ internal void SetRotationPluginSettings(bool on, bool ignoreConfig = false)
if (on)
if (!Wrath_IPCSubscriber.IsCurrentJobAutoRotationReady())
if (this.Configuration.Wrath_AutoSetupJobs)
{
Wrath_IPCSubscriber.SetJobAutoReady();
if (!Wrath_IPCSubscriber.IsCurrentJobAutoRotationReady())
{
Wrath_IPCSubscriber.Release();
wrathRotationReady = false;
}
}
else
wrathRotationReady = false;

Expand Down
2 changes: 1 addition & 1 deletion AutoDuty/Helpers/PlayerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ internal static JobRole GetJobRole(this ClassJob job)

internal static unsafe bool IsMoving => AgentMap.Instance()->IsPlayerMoving == 1;

internal static unsafe bool InCombat => Player.Character->InCombat;
internal static unsafe bool InCombat => Svc.Condition[ConditionFlag.InCombat];

/*internal static unsafe short GetCurrentItemLevelFromGearSet(int gearsetId = -1, bool updateGearsetBeforeCheck = true)
{
Expand Down
34 changes: 21 additions & 13 deletions AutoDuty/IPC/IPCSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,23 +286,31 @@ public enum AutoRotationConfigOption
IncludeNPCs = 12,//bool
}

public enum AutoRotationConfigDPSRotationSubset
public enum DPSRotationMode
{
Manual = 0,
Lowest_Current = 4,
Highest_Max = 1,
Tank_Target = 5,
Nearest = 6,
Manual = 0,
Highest_Max = 1,
Lowest_Max = 2,
Highest_Current = 3,
Lowest_Current = 4,
Tank_Target = 5,
Nearest = 6,
Furthest = 7,
}

/// <summary>
/// The subset of <see cref="AutoRotationConfig.HealerRotationMode" /> options
/// that can be set via IPC.
/// </summary>
public enum AutoRotationConfigHealerRotationSubset
public enum HealerRotationMode
{
Manual = 0,
Lowest_Current = 2
Manual = 0,
Highest_Current = 1,
Lowest_Current = 2
//Self_Priority,
//Tank_Priority,
//Healer_Priority,
//DPS_Priority,
}

private static Guid? _curLease;
Expand Down Expand Up @@ -438,8 +446,8 @@ public enum AutoRotationConfigHealerRotationSubset
/// </param>
/// <value>+1 <c>set</c></value>
/// <seealso cref="AutoRotationConfigOption"/>
/// <seealso cref="AutoRotationConfigDPSRotationSubset"/>
/// <seealso cref="AutoRotationConfigHealerRotationSubset"/>
/// <seealso cref="DPSRotationMode"/>
/// <seealso cref="HealerRotationMode"/>
[EzIPC] private static readonly Action<Guid, AutoRotationConfigOption, object> SetAutoRotationConfigState;

internal static void SetJobAutoReady()
Expand All @@ -460,12 +468,12 @@ internal static void SetAutoMode(bool on)
SetAutoRotationConfigState(_curLease.Value, AutoRotationConfigOption.AutoRezDPSJobs, true);
SetAutoRotationConfigState(_curLease.Value, AutoRotationConfigOption.IncludeNPCs, true);

AutoRotationConfigDPSRotationSubset dpsConfig = Plugin.CurrentPlayerItemLevelandClassJob.Value.GetCombatRole() == CombatRole.Tank ?
DPSRotationMode dpsConfig = Plugin.CurrentPlayerItemLevelandClassJob.Value.GetCombatRole() == CombatRole.Tank ?
Plugin.Configuration.Wrath_TargetingTank :
Plugin.Configuration.Wrath_TargetingNonTank;
SetAutoRotationConfigState(_curLease.Value, AutoRotationConfigOption.DPSRotationMode, dpsConfig);

SetAutoRotationConfigState(_curLease.Value, AutoRotationConfigOption.HealerRotationMode, AutoRotationConfigHealerRotationSubset.Lowest_Current);
SetAutoRotationConfigState(_curLease.Value, AutoRotationConfigOption.HealerRotationMode, HealerRotationMode.Lowest_Current);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions AutoDuty/Windows/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ public bool PositionalRoleBased
#region Wrath

public bool Wrath_AutoSetupJobs { get; set; } = true;
internal Wrath_IPCSubscriber.AutoRotationConfigDPSRotationSubset Wrath_TargetingTank = Wrath_IPCSubscriber.AutoRotationConfigDPSRotationSubset.Highest_Max;
internal Wrath_IPCSubscriber.AutoRotationConfigDPSRotationSubset Wrath_TargetingNonTank = Wrath_IPCSubscriber.AutoRotationConfigDPSRotationSubset.Lowest_Current;
internal Wrath_IPCSubscriber.DPSRotationMode Wrath_TargetingTank = Wrath_IPCSubscriber.DPSRotationMode.Highest_Max;
internal Wrath_IPCSubscriber.DPSRotationMode Wrath_TargetingNonTank = Wrath_IPCSubscriber.DPSRotationMode.Lowest_Current;


#endregion
Expand Down Expand Up @@ -519,9 +519,9 @@ public static void Draw()
ImGui.PushItemWidth(150 * ImGuiHelpers.GlobalScale);
if (ImGui.BeginCombo("##ConfigWrathTargetingTank", Configuration.Wrath_TargetingTank.ToCustomString()))
{
foreach (Wrath_IPCSubscriber.AutoRotationConfigDPSRotationSubset targeting in Enum.GetValues(typeof(Wrath_IPCSubscriber.AutoRotationConfigDPSRotationSubset)))
foreach (Wrath_IPCSubscriber.DPSRotationMode targeting in Enum.GetValues(typeof(Wrath_IPCSubscriber.DPSRotationMode)))
{
if(targeting == Wrath_IPCSubscriber.AutoRotationConfigDPSRotationSubset.Tank_Target)
if(targeting == Wrath_IPCSubscriber.DPSRotationMode.Tank_Target)
continue;

if (ImGui.Selectable(targeting.ToCustomString()))
Expand All @@ -539,7 +539,7 @@ public static void Draw()
ImGui.PushItemWidth(150 * ImGuiHelpers.GlobalScale);
if (ImGui.BeginCombo("##ConfigWrathTargetingNonTank", Configuration.Wrath_TargetingNonTank.ToCustomString()))
{
foreach (Wrath_IPCSubscriber.AutoRotationConfigDPSRotationSubset targeting in Enum.GetValues(typeof(Wrath_IPCSubscriber.AutoRotationConfigDPSRotationSubset)))
foreach (Wrath_IPCSubscriber.DPSRotationMode targeting in Enum.GetValues(typeof(Wrath_IPCSubscriber.DPSRotationMode)))
{
if (ImGui.Selectable(targeting.ToCustomString()))
{
Expand Down

0 comments on commit 56b5bc5

Please sign in to comment.