Skip to content

Commit

Permalink
Api11
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownX7 committed Nov 18, 2024
1 parent 0cf3543 commit dd42bef
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion ActionStackManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static Bool OnUseAction(ActionManager* actionManager, uint actionType, ui
if (!stack.Actions.Any(action
=> action.ID == 0
|| action.ID == 1 && a.CanTargetHostile
|| action.ID == 2 && (a.CanTargetFriendly || a.CanTargetParty)
|| action.ID == 2 && (a.CanTargetAlliance || a.CanTargetParty)
|| (action.UseAdjustedID ? actionManager->CS.GetAdjustedActionId(action.ID) : action.ID) == adjustedActionID))
continue;

Expand Down
6 changes: 3 additions & 3 deletions Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public static unsafe class Game

public static readonly AsmPatch queueGroundTargetsPatch = new("75 49 44 8B C7 41 8B D5", [ 0x90, 0x90 ], ReAction.Config.EnableGroundTargetQueuing);

// test byte ptr [rsi+3A], 04
// jnz 7Ah
public static readonly AsmPatch spellAutoAttackPatch = new("41 B0 01 44 0F B6 CA 41 0F B6 D0 E9 ?? ?? ?? ?? 41 B0 01", [ 0xF6, 0x46, 0x3A, 0x04, 0x0F, 0x85, 0x7A, 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 ], ReAction.Config.EnableSpellAutoAttacks && ReAction.Config.EnableSpellAutoAttacksOutOfCombat);
// test byte ptr [rbp+3A], 04 (CanTargetSelf)
// jnz 79h
public static readonly AsmPatch spellAutoAttackPatch = new("41 B0 01 41 0F B6 D0 E9 ?? ?? ?? ?? 41 B0 01", [ 0xF6, 0x45, 0x3A, 0x04, 0x0F, 0x85, 0x79, 0x00, 0x00, 0x00, 0x90, 0x90 ], ReAction.Config.EnableSpellAutoAttacks && ReAction.Config.EnableSpellAutoAttacksOutOfCombat);

public static readonly AsmPatch allowUnassignableActionsPatch = new("75 07 32 C0 E9 ?? ?? ?? ?? 48 8B 00", [ 0xEB ], ReAction.Config.EnableUnassignableActions);

Expand Down
2 changes: 1 addition & 1 deletion Modules/CameraRelativeActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private static void PostActionStack(ActionManager* actionManager, uint actionTyp
private static bool CheckAction(uint actionType, uint actionID, uint adjustedActionID)
{
if (!ReAction.actionSheet.TryGetValue(adjustedActionID, out var a)) return false;
if (ReAction.Config.EnableCameraRelativeDirectionals && a.IsPlayerAction && (a.Unknown50 == 6 || (a.CastType is 3 or 4 && a.CanTargetSelf))) return true; // Channeled abilities and cones and rectangles
if (ReAction.Config.EnableCameraRelativeDirectionals && a.IsPlayerAction && (a.AutoAttackBehaviour == 6 || (a.CastType is 3 or 4 && a.CanTargetSelf))) return true; // Channeled abilities and cones and rectangles
if (!ReAction.Config.EnableCameraRelativeDashes) return false;
if (!a.AffectsPosition && adjustedActionID != 29494) return false; // Block non movement abilities
if (!a.CanTargetSelf) return false; // Block non self targeted abilities
Expand Down
8 changes: 4 additions & 4 deletions Modules/EnhancedAutoFaceTarget.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using Hypostasis.Game.Structures;
using Lumina.Excel.GeneratedSheets;
using Lumina.Excel.Sheets;

namespace ReAction.Modules;

public unsafe class EnhancedAutoFaceTarget : PluginModule
{
// jmp 1Ch
private static readonly AsmPatch removeAutoFaceTargetPatch = new("80 7E 33 06 75 1E 48 8D 0D", [ 0x90, 0x90, 0x90, 0x90, 0xEB, 0x1C ]);
private static readonly AsmPatch removeAutoFaceTargetPatch = new("80 7D 33 06 75 1E 48 8D 0D", [ 0x90, 0x90, 0x90, 0x90, 0xEB, 0x1C ]);
// jz -> jmp ??
private static readonly AsmPatch removeAutoFaceGroundTargetPatch = new("80 7E 33 06 74 21 48 8D 8F", [ 0x90, 0x90, 0x90, 0x90, 0xEB ]);
private static readonly AsmPatch removeAutoFaceGroundTargetPatch = new("80 7D 33 06 74 21 48 8D 8F", [ 0x90, 0x90, 0x90, 0x90, 0xEB ]);

public override bool ShouldEnable => ReAction.Config.EnableEnhancedAutoFaceTarget;

Expand All @@ -30,7 +30,7 @@ protected override void Disable()

private static void PostActionStack(ActionManager* actionManager, uint actionType, uint actionID, uint adjustedActionID, ref ulong targetObjectID, uint param, uint useType, int pvp)
{
if (DalamudApi.DataManager.GetExcelSheet<Action>()?.GetRow(adjustedActionID) is { Unknown26: false }) // This is checked by Client::Game::ActionManager_GetActionInRangeOrLoS
if (DalamudApi.DataManager.GetExcelSheet<Action>().GetRow(adjustedActionID) is { NeedToFaceTarget: false })
removeAutoFaceTargetPatch.Enable();
else
removeAutoFaceTargetPatch.Disable();
Expand Down
6 changes: 3 additions & 3 deletions Modules/QueueMore.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Hypostasis.Game.Structures;
using Lumina.Excel.GeneratedSheets;
using Lumina.Excel.Sheets;

namespace ReAction.Modules;

Expand Down Expand Up @@ -56,14 +56,14 @@ private static void PostUseAction(ActionManager* actionManager, uint actionType,
{
allowQueuingPatch.Disable();

if (ret && DalamudApi.DataManager.GetExcelSheet<Action>()?.GetRow(adjustedActionID) is { ActionCategory.Row: 9 or 15 })
if (ret && DalamudApi.DataManager.GetExcelSheet<Action>().GetRow(adjustedActionID) is { ActionCategory.RowId: 9 or 15 })
lastLBSequence = actionManager->currentSequence;
}

private static bool CheckAction(uint actionType, uint actionID, uint adjustedActionID) =>
actionType switch
{
1 when DalamudApi.DataManager.GetExcelSheet<Action>()?.GetRow(adjustedActionID) is { ActionCategory.Row: 9 or 15 } => lastLBSequence != Common.ActionManager->currentSequence, // Allow LB
1 when DalamudApi.DataManager.GetExcelSheet<Action>().GetRow(adjustedActionID) is { ActionCategory.RowId: 9 or 15 } => lastLBSequence != Common.ActionManager->currentSequence, // Allow LB
2 => true, // Allow items
5 when actionID == 4 => true, // Allow Sprint
_ => false
Expand Down
22 changes: 11 additions & 11 deletions PluginUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using Hypostasis.Game.Structures;
using ImGuiNET;
using Lumina.Excel.GeneratedSheets;
using Action = Lumina.Excel.GeneratedSheets.Action;
using Lumina.Excel.Sheets;
using Action = Lumina.Excel.Sheets.Action;

namespace ReAction;

Expand Down Expand Up @@ -226,13 +226,13 @@ private static void DrawStackEditorLists(Configuration.ActionStack stack)
0 => "All Actions",
1 => "All Harmful Actions",
2 => "All Beneficial Actions",
_ => $"[#{a.RowId} {a.ClassJob.Value?.Abbreviation}{(a.IsPvP ? " PVP" : string.Empty)}] {a.Name}"
_ => $"[#{a.RowId} {a.ClassJob.ValueNullable?.Abbreviation}{(a.IsPvP ? " PVP" : string.Empty)}] {a.Name}"
};

private static readonly ImGuiEx.ExcelSheetComboOptions<Action> actionComboOptions = new()
{
FormatRow = FormatActionRow,
FilteredSheet = DalamudApi.DataManager.GetExcelSheet<Action>()?.Take(3).Concat(ReAction.actionSheet.Select(kv => kv.Value))
FilteredSheet = DalamudApi.DataManager.GetExcelSheet<Action>().Take(3).Concat(ReAction.actionSheet.Select(kv => kv.Value))
};

private static readonly ImGuiEx.ExcelSheetPopupOptions<Action> actionPopupOptions = new()
Expand Down Expand Up @@ -304,13 +304,13 @@ private static void DrawActionEditor(Configuration.ActionStack stack)
private static string FormatOverrideActionRow(Action a) => a.RowId switch
{
0 => "Same Action",
_ => $"[#{a.RowId} {a.ClassJob.Value?.Abbreviation}{(a.IsPvP ? " PVP" : string.Empty)}] {a.Name}"
_ => $"[#{a.RowId} {a.ClassJob.ValueNullable?.Abbreviation}{(a.IsPvP ? " PVP" : string.Empty)}] {a.Name}"
};

private static readonly ImGuiEx.ExcelSheetComboOptions<Action> actionOverrideComboOptions = new()
{
FormatRow = FormatOverrideActionRow,
FilteredSheet = DalamudApi.DataManager.GetExcelSheet<Action>()?.Take(1).Concat(ReAction.actionSheet.Select(kv => kv.Value))
FilteredSheet = DalamudApi.DataManager.GetExcelSheet<Action>().Take(1).Concat(ReAction.actionSheet.Select(kv => kv.Value))
};

private static void DrawItemEditor(Configuration.ActionStack stack)
Expand Down Expand Up @@ -544,7 +544,7 @@ private static void DrawOtherSettings()

ImGui.SameLine();

if (ImGuiEx.BeginGroupBox("Sunderings", 0.5f))
/*if (ImGuiEx.BeginGroupBox("Sunderings", 0.5f))
{
save |= ImGui.Checkbox("Sunder Meditation", ref ReAction.Config.EnableDecomboMeditation);
ImGuiEx.SetItemTooltip("Removes the Meditation <-> Steel Peak / Forbidden Chakra combo. You will need to use\nthe hotbar feature below to place one of them on your hotbar in order to use them again.\nSteel Peak ID: 25761\nForbidden Chakra ID: 3547");
Expand All @@ -568,7 +568,7 @@ private static void DrawOtherSettings()
ImGuiEx.SetItemTooltip("Removes the Geirskogul -> Nastrond combo. You will need to use the\nhotbar feature below to place it on your hotbar in order to use it again.\nNastrond ID: 7400");
ImGuiEx.EndGroupBox();
}
}*/

if (ImGuiEx.BeginGroupBox("Misc", 0.5f))
{
Expand Down Expand Up @@ -596,7 +596,7 @@ private static void DrawOtherSettings()
ImGuiEx.EndGroupBox();
}

ImGui.SameLine();
//ImGui.SameLine();

if (ImGuiEx.BeginGroupBox("Place on Hotbar (HOVER ME FOR INFORMATION)", 0.5f, new ImGuiEx.GroupBoxOptions
{
Expand Down Expand Up @@ -684,7 +684,7 @@ public static void DrawHotbarIDInput(RaptureHotbarModule.HotbarSlotType slotType
ImGuiEx.ExcelSheetCombo($"ID##{commandType}", ref commandID, new ImGuiEx.ExcelSheetComboOptions<FieldMarker> { FormatRow = r => $"[#{r.RowId}] {r.Name}" });
break;
case RaptureHotbarModule.HotbarSlotType.Recipe:
ImGuiEx.ExcelSheetCombo($"ID##{commandType}", ref commandID, new ImGuiEx.ExcelSheetComboOptions<Recipe> { FormatRow = r => $"[#{r.RowId}] {r.ItemResult.Value?.Name}" });
ImGuiEx.ExcelSheetCombo($"ID##{commandType}", ref commandID, new ImGuiEx.ExcelSheetComboOptions<Recipe> { FormatRow = r => $"[#{r.RowId}] {r.ItemResult.ValueNullable?.Name}" });
break;
case RaptureHotbarModule.HotbarSlotType.ChocoboRaceAbility:
ImGuiEx.ExcelSheetCombo($"ID##{commandType}", ref commandID, new ImGuiEx.ExcelSheetComboOptions<ChocoboRaceAbility> { FormatRow = r => $"[#{r.RowId}] {r.Name}" });
Expand All @@ -711,7 +711,7 @@ public static void DrawHotbarIDInput(RaptureHotbarModule.HotbarSlotType slotType
ImGuiEx.ExcelSheetCombo($"ID##{commandType}", ref commandID, new ImGuiEx.ExcelSheetComboOptions<Perform> { FormatRow = r => $"[#{r.RowId}] {r.Instrument}" });
break;
case RaptureHotbarModule.HotbarSlotType.McGuffin:
ImGuiEx.ExcelSheetCombo($"ID##{commandType}", ref commandID, new ImGuiEx.ExcelSheetComboOptions<McGuffin> { FormatRow = r => $"[#{r.RowId}] {r.UIData.Value?.Name}" });
ImGuiEx.ExcelSheetCombo($"ID##{commandType}", ref commandID, new ImGuiEx.ExcelSheetComboOptions<McGuffin> { FormatRow = r => $"[#{r.RowId}] {r.UIData.ValueNullable?.Name}" });
break;
case RaptureHotbarModule.HotbarSlotType.Ornament:
ImGuiEx.ExcelSheetCombo($"ID##{commandType}", ref commandID, new ImGuiEx.ExcelSheetComboOptions<Ornament> { FormatRow = r => $"[#{r.RowId}] {r.Singular}" });
Expand Down
6 changes: 3 additions & 3 deletions PronounManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.Game.Control;
using FFXIVClientStructs.FFXIV.Client.Game.Object;
using Lumina.Excel.GeneratedSheets;
using Lumina.Excel.Sheets;

namespace ReAction;

Expand All @@ -20,11 +20,11 @@ public static unsafe class PronounHelpers
public static GameObject* GetPartyMemberByClassJobID(byte classJob) => (GameObject*)Common.GetPartyMembers().Skip(1).FirstOrDefault(address => ((Character*)address)->CharacterData.ClassJob == classJob);

public static GameObject* GetPartyMemberByRoleID(byte role) => DalamudApi.DataManager.GetExcelSheet<ClassJob>() is { } sheet
? (GameObject*)Common.GetPartyMembers().Skip(1).FirstOrDefault(address => sheet.GetRow(((Character*)address)->CharacterData.ClassJob)?.Role == role)
? (GameObject*)Common.GetPartyMembers().Skip(1).FirstOrDefault(address => sheet.GetRow(((Character*)address)->CharacterData.ClassJob).Role == role)
: null;

public static GameObject* GetPartyMemberByLimitBreak1(uint actionID) => DalamudApi.DataManager.GetExcelSheet<ClassJob>() is { } sheet
? (GameObject*)Common.GetPartyMembers().Skip(1).FirstOrDefault(address => sheet.GetRow(((Character*)address)->CharacterData.ClassJob)?.LimitBreak1.Row == actionID)
? (GameObject*)Common.GetPartyMembers().Skip(1).FirstOrDefault(address => sheet.GetRow(((Character*)address)->CharacterData.ClassJob).LimitBreak1.RowId == actionID)
: null;
}

Expand Down
8 changes: 4 additions & 4 deletions ReAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ namespace ReAction;

public class ReAction(IDalamudPluginInterface pluginInterface) : DalamudPlugin<Configuration>(pluginInterface), IDalamudPlugin
{
public static Dictionary<uint, Lumina.Excel.GeneratedSheets.Action> actionSheet;
public static Dictionary<uint, Lumina.Excel.GeneratedSheets.Action> mountActionsSheet;
public static Dictionary<uint, Lumina.Excel.Sheets.Action> actionSheet;
public static Dictionary<uint, Lumina.Excel.Sheets.Action> mountActionsSheet;

protected override void Initialize()
{
Game.Initialize();
PronounManager.Initialize();

actionSheet = DalamudApi.DataManager.GetExcelSheet<Lumina.Excel.GeneratedSheets.Action>()?.Where(i => i.ClassJobCategory.Row > 0 && i.ActionCategory.Row <= 4 && i.RowId > 8).ToDictionary(i => i.RowId, i => i);
mountActionsSheet = DalamudApi.DataManager.GetExcelSheet<Lumina.Excel.GeneratedSheets.Action>()?.Where(i => i.ActionCategory.Row == 12).ToDictionary(i => i.RowId, i => i);
actionSheet = DalamudApi.DataManager.GetExcelSheet<Lumina.Excel.Sheets.Action>().Where(i => i.ClassJobCategory.RowId > 0 && i.ActionCategory.RowId <= 4 && i.RowId > 8).ToDictionary(i => i.RowId, i => i);
mountActionsSheet = DalamudApi.DataManager.GetExcelSheet<Lumina.Excel.Sheets.Action>().Where(i => i.ActionCategory.RowId == 12).ToDictionary(i => i.RowId, i => i);
if (actionSheet == null || mountActionsSheet == null)
throw new ApplicationException("Action sheet failed to load!");
}
Expand Down
4 changes: 2 additions & 2 deletions ReAction.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.3.3.10</Version>
<Version>1.3.3.11</Version>
<TargetFramework>net8.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<Platforms>x64;AnyCPU</Platforms>
Expand All @@ -16,7 +16,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.13" />
<PackageReference Include="DalamudPackager" Version="11.0.0" />
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
Expand Down
2 changes: 1 addition & 1 deletion ReAction.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
],
"InternalName": "ReAction",
"AssemblyVersion": "9.9.9.9",
"Changelog": "Fixed an issue with queuing some charged actions."
"Changelog": ""
}

0 comments on commit dd42bef

Please sign in to comment.