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

Commit

Permalink
fix: removed crossbar because of the unknow of the paring of hotbar a…
Browse files Browse the repository at this point in the history
…nd action bar.
  • Loading branch information
ArchiDog1998 committed Apr 2, 2023
1 parent c75d22e commit f186ec6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
1 change: 0 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ private bool AutoDefense(byte abilitiesRemaining, JobRole role, bool helpDefense
&& (Service.Config.AutoProvokeForTank || DataCenter.AllianceTanks.Count() < 2)
&& TargetFilter.ProvokeTarget(DataCenter.HostileTargets, true).Count() != DataCenter.HostileTargets.Count()))
{

if (!HasTankStance && TankStance.CanUse(out act)) return true;
if (Provoke.CanUse(out act, CanUseOption.MustUse)) return true;
}
Expand Down
5 changes: 4 additions & 1 deletion RotationSolver.Basic/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static unsafe uint GetAdjustedActionId(uint id)

public static bool WorldToScreen(Vector3 worldPos, out Vector2 screenPos) => GameGui.WorldToScreen(worldPos, out screenPos);

public unsafe static IEnumerable<IntPtr> GetAddon<T>() where T : struct
public unsafe static IEnumerable<IntPtr> GetAddons<T>() where T : struct
{
if(typeof(T).GetCustomAttribute<Addon>() is not Addon on) return new IntPtr[0];

Expand All @@ -115,6 +115,9 @@ public unsafe static IEnumerable<IntPtr> GetAddon<T>() where T : struct
.Where(ptr => ptr != IntPtr.Zero);
}

public unsafe static IntPtr GetAddon<T>() where T : struct
=> GetAddons<T>().FirstOrDefault();

public static PlayerCharacter Player => ClientState.LocalPlayer;
[PluginService]
public static ClientState ClientState { get; set; }
Expand Down
23 changes: 16 additions & 7 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Dalamud.Game.ClientState.Objects.Types;
using FFXIVClientStructs.FFXIV.Client.Game.Fate;
using FFXIVClientStructs.FFXIV.Client.UI;
using ImGuiNET;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Basic;
Expand Down Expand Up @@ -144,14 +145,22 @@ private void DrawCDEX()
}
}

private void DrawIcon()
private unsafe void DrawIcon()
{
//ControlWindow.DrawIAction(CustomRotation.Addle, 256, 1.6f);
for (int i = 0; i <= 200; i++)
{
if (i % 10 != 0) ImGui.SameLine();
ControlWindow.DrawIAction(CustomRotation.Addle, 48, i / 100f);
}
//var pointer = (AddonActionCross*) Service.GetAddon<AddonActionCross>();
//if (pointer != null)
//{
// ImGui.Text($"LTRT: {pointer->ExpandedHoldControlsLTRT}");
// ImGui.Text($"RTLT: {pointer->ExpandedHoldControlsRTLT}");
//}
//var pointer2 = (AddonActionDoubleCrossBase*)Service.GetAddon<AddonActionDoubleCrossBase>();
//if (pointer2 != null)
//{
// ImGui.Text($"ShowDPadSlots: {pointer2->ShowDPadSlots}");
// ImGui.Text($"BarTarget: {pointer2->BarTarget}");
// ImGui.Text($"UseLeftSide: {pointer2->UseLeftSide}");
// ImGui.Text($"MergedPositioning: {pointer2->MergedPositioning}");
//}
}

private static void DrawAction(ActionID id, string type)
Expand Down
9 changes: 3 additions & 6 deletions RotationSolver/Updaters/PreviewUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static unsafe void UpdateCastBar()

ByteColor c = _showCanMove ? _greenColor : _redColor;

var castBars = Service.GetAddon<AddonCastBar>();
var castBars = Service.GetAddons<AddonCastBar>();
if (!castBars.Any()) return;
var castBar = castBars.FirstOrDefault();

Expand Down Expand Up @@ -143,10 +143,8 @@ private static unsafe void LoopAllSlotBar(ActionBarAction doingSomething)
{
var index = 0;
var hotBarIndex = 0;
foreach (var intPtr in Service.GetAddon<AddonActionBar>()
.Union(Service.GetAddon<AddonActionBarX>())
.Union(Service.GetAddon<AddonActionCross>())
.Union(Service.GetAddon<AddonActionDoubleCrossBase>()))
foreach (var intPtr in Service.GetAddons<AddonActionBar>()
.Union(Service.GetAddons<AddonActionBarX>()))
{
if (intPtr == IntPtr.Zero) continue;
var actionBar = (AddonActionBarBase*)intPtr;
Expand All @@ -171,7 +169,6 @@ private static unsafe void LoopAllSlotBar(ActionBarAction doingSomething)
}
}


private static unsafe void HighLightActionBar(ActionBarPredicate shouldShow = null)
{
LoopAllSlotBar((slot, hot, highLightId) =>
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static unsafe uint[] GetEnemies()
{
if (!Service.Config.AddEnemyListToHostile) return new uint[0];

var addons = Service.GetAddon<AddonEnemyList>();
var addons = Service.GetAddons<AddonEnemyList>();

if(!addons.Any()) return new uint[0];
var addon = addons.FirstOrDefault();
Expand Down

0 comments on commit f186ec6

Please sign in to comment.