Skip to content

Commit

Permalink
6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownX7 committed May 23, 2023
1 parent f13f79a commit 88c51a8
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 41 deletions.
15 changes: 7 additions & 8 deletions ActionStackManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using Dalamud.Logging;
using ActionType = FFXIVClientStructs.FFXIV.Client.Game.ActionType;
using FFXIVClientStructs.FFXIV.Client.Game.Object;
using Hypostasis.Game.Structures;
Expand Down Expand Up @@ -30,14 +29,14 @@ public static Bool OnUseAction(ActionManager* actionManager, uint actionType, ui
if (useType == 100)
{
useType = 0;
PluginLog.Debug("UseAction called from a macro using /macroqueue");
DalamudApi.LogDebug("UseAction called from a macro using /macroqueue");
}

PreUseAction?.Invoke(actionManager, ref actionType, ref actionID, ref targetObjectID, ref param, ref useType, ref pvp);

var adjustedActionID = actionType == 1 ? actionManager->CS.GetAdjustedActionId(actionID) : actionID;

PluginLog.Debug($"UseAction called {actionType}, {actionID} -> {adjustedActionID}, {targetObjectID:X}, {param}, {useType}, {pvp}");
DalamudApi.LogDebug($"UseAction called {actionType}, {actionID} -> {adjustedActionID}, {targetObjectID:X}, {param}, {useType}, {pvp}");

bool? ret = null;
PreActionStack?.Invoke(actionManager, ref actionType, ref actionID, ref adjustedActionID, ref targetObjectID, ref param, useType, ref pvp, out ret);
Expand All @@ -47,7 +46,7 @@ public static Bool OnUseAction(ActionManager* actionManager, uint actionType, ui
var succeeded = false;
if (PluginModuleManager.GetModule<Modules.ActionStacks>().IsValid && tryStack && actionType == 1 && ReAction.actionSheet.TryGetValue(adjustedActionID, out var a))
{
PluginLog.Debug("Checking stacks");
DalamudApi.LogDebug("Checking stacks");

var modifierKeys = GetModifierKeys();
foreach (var stack in ReAction.Config.ActionStacks)
Expand All @@ -65,13 +64,13 @@ public static Bool OnUseAction(ActionManager* actionManager, uint actionType, ui
{
if (stack.BlockOriginal)
{
PluginLog.Debug("Stack failed, blocking original");
DalamudApi.LogDebug("Stack failed, blocking original");
return 0;
}
break;
}

PluginLog.Debug($"Stack succeeded {adjustedActionID} -> {newAction}, {targetObjectID:X} -> {newTarget:X}");
DalamudApi.LogDebug($"Stack succeeded {adjustedActionID} -> {newAction}, {targetObjectID:X} -> {newTarget:X}");

actionID = newAction;
adjustedActionID = newAction;
Expand Down Expand Up @@ -109,7 +108,7 @@ public static Bool OnUseAction(ActionManager* actionManager, uint actionType, ui
}
catch (Exception e)
{
PluginLog.Error($"Failed to modify action\n{e}");
DalamudApi.LogError($"Failed to modify action\n{e}");
return 0;
}
}
Expand Down Expand Up @@ -154,7 +153,7 @@ private static void SetInstantGroundTarget(uint actionType, uint useType)
{
if ((ReAction.Config.EnableBlockMiscInstantGroundTargets && actionType == 11) || useType == 2 && actionType == 1 || actionType == 15) return;

PluginLog.Debug($"Making ground target instant {actionType}, {useType}");
DalamudApi.LogDebug($"Making ground target instant {actionType}, {useType}");

Common.ActionManager->activateGroundTarget = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public override void BindToName(Type serializedType, out string assemblyName, ou
}
}

public override int Version { get; set; }
public int Version { get; set; }

public List<ActionStack> ActionStacks = new();
public bool EnableEnhancedAutoFaceTarget = false;
Expand Down
12 changes: 6 additions & 6 deletions Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ public static unsafe class Game
{
public const uint InvalidObjectID = 0xE0000000;

public static readonly AsmPatch queueGroundTargetsPatch = new("74 24 41 81 FE F5 0D 00 00", new byte[] { 0xEB }, ReAction.Config.EnableGroundTargetQueuing);
public static readonly AsmPatch queueGroundTargetsPatch = new("74 20 81 FD F5 0D 00 00", new byte?[] { 0xEB }, ReAction.Config.EnableGroundTargetQueuing);

// test byte ptr [r15+39], 04
// jnz A7h
public static readonly AsmPatch spellAutoAttackPatch = new("41 B0 01 41 0F B6 D0 E9 ?? ?? ?? ?? 41 B0 01", new byte[] { 0x41, 0xF6, 0x47, 0x39, 0x04, 0x0F, 0x85, 0xA7, 0x00, 0x00, 0x00, 0x90 }, ReAction.Config.EnableSpellAutoAttacks && ReAction.Config.EnableSpellAutoAttacksOutOfCombat);
public static readonly AsmPatch spellAutoAttackPatch = new("41 B0 01 41 0F B6 D0 E9 ?? ?? ?? ?? 41 B0 01", new byte?[] { 0x41, 0xF6, 0x47, 0x39, 0x04, 0x0F, 0x85, 0xA7, 0x00, 0x00, 0x00, 0x90 }, ReAction.Config.EnableSpellAutoAttacks && ReAction.Config.EnableSpellAutoAttacksOutOfCombat);

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

// mov eax, 1000f
// movd xmm1, eax
// mulss xmm0, xmm1
// cvttss2si rcx, xmm0
public static readonly AsmPatch waitSyntaxDecimalPatch = new("F3 0F 58 05 ?? ?? ?? ?? F3 48 0F 2C C0 69 C8",
new byte[] {
new byte?[] {
0xB8, 0x00, 0x00, 0x7A, 0x44,
0x66, 0x0F, 0x6E, 0xC8,
0xF3, 0x0F, 0x59, 0xC1,
Expand All @@ -47,7 +47,7 @@ public static unsafe class Game
// mov [rbx+58h], ecx
// jmp
public static readonly AsmPatch waitCommandDecimalPatch = new("F3 0F 58 0D ?? ?? ?? ?? F3 48 0F 2C C1 69 C8",
new byte[] {
new byte?[] {
0xB8, 0x00, 0x00, 0x7A, 0x44,
0x66, 0x0F, 0x6E, 0xC0,
0xF3, 0x0F, 0x59, 0xC8,
Expand All @@ -59,7 +59,7 @@ public static unsafe class Game
},
ReAction.Config.EnableFractionality);

public static readonly AsmPatch queueACCommandPatch = new("02 00 00 00 41 8B D7 89", new byte[] { 0x64 }, ReAction.Config.EnableMacroQueue);
public static readonly AsmPatch queueACCommandPatch = new("02 00 00 00 41 8B D7 89", new byte?[] { 0x64 }, ReAction.Config.EnableMacroQueue);

public static long GetObjectID(GameObject* o)
{
Expand Down
3 changes: 1 addition & 2 deletions Modules/AutoCastCancel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Dalamud.Game;
using Dalamud.Logging;
using Hypostasis.Game.Structures;

namespace ReAction.Modules;
Expand Down Expand Up @@ -30,7 +29,7 @@ private static void Update(Framework framework)
var o = Game.GetGameObjectFromObjectID(Common.ActionManager->castTargetObjectID);
if (o == null || ActionManager.CanUseActionOnGameObject(Common.ActionManager->castActionID, o)) return;

PluginLog.Debug($"Cancelling cast {Common.ActionManager->castActionType}, {Common.ActionManager->castActionID}, {Common.ActionManager->castTargetObjectID:X}");
DalamudApi.LogDebug($"Cancelling cast {Common.ActionManager->castActionType}, {Common.ActionManager->castActionID}, {Common.ActionManager->castTargetObjectID:X}");

cancelCast();
canceledCast = true;
Expand Down
5 changes: 2 additions & 3 deletions Modules/AutoDismount.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Diagnostics;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Logging;
using Dalamud.Game;
using FFXIVClientStructs.FFXIV.Client.Game;
using ActionManager = Hypostasis.Game.Structures.ActionManager;
Expand Down Expand Up @@ -38,7 +37,7 @@ private static void PreActionStack(ActionManager* actionManager, ref uint action
ret = Game.UseActionHook.Original(actionManager, 5, 23, 0, 0, 0, 0, null);
if (!ret.Value) return;

PluginLog.Debug($"Dismounting {actionType}, {actionID}, {targetObjectID:X}, {useType}, {pvp}");
DalamudApi.LogDebug($"Dismounting {actionType}, {actionID}, {targetObjectID:X}, {useType}, {pvp}");

isMountActionQueued = true;
queuedMountAction = (actionType, actionID, targetObjectID, useType, pvp);
Expand All @@ -51,7 +50,7 @@ private static void Update(Framework framework)

if (mountActionTimer.ElapsedMilliseconds <= 2000)
{
PluginLog.Debug("Using queued mount action");
DalamudApi.LogDebug("Using queued mount action");

ActionStackManager.OnUseAction(Common.ActionManager, queuedMountAction.actionType, queuedMountAction.actionID,
queuedMountAction.targetObjectID, 0, queuedMountAction.useType, queuedMountAction.pvp, null);
Expand Down
5 changes: 2 additions & 3 deletions Modules/AutoTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Linq;
using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Logging;
using Hypostasis.Game.Structures;
using GameObject = FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject;

Expand Down Expand Up @@ -67,14 +66,14 @@ private static void PostActionStack(ActionManager* actionManager, uint actionTyp
|| !a.CanTargetHostile)
return;

PluginLog.Debug($"Attempting to swap target {adjustedActionID}, {targetObjectID:X}");
DalamudApi.LogDebug($"Attempting to swap target {adjustedActionID}, {targetObjectID:X}");

TargetEnemy();
if (DalamudApi.TargetManager.Target is not { } target) return;

var prevTargetObjectID = targetObjectID;
targetObjectID = Game.GetObjectID((GameObject*)target.Address);

PluginLog.Debug($"Target swapped {prevTargetObjectID:X} -> {targetObjectID:X}");
DalamudApi.LogDebug($"Target swapped {prevTargetObjectID:X} -> {targetObjectID:X}");
}
}
3 changes: 1 addition & 2 deletions Modules/CameraRelativeActions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Dalamud.Logging;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Game.Object;
using ActionManager = Hypostasis.Game.Structures.ActionManager;
Expand Down Expand Up @@ -29,7 +28,7 @@ private static void PostActionStack(ActionManager* actionManager, uint actionTyp
|| actionManager->animationLock != 0)
return;

PluginLog.Debug($"Rotating camera {actionType}, {adjustedActionID}");
DalamudApi.LogDebug($"Rotating camera {actionType}, {adjustedActionID}");

SetCharacterRotationToCamera();
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/EnhancedAutoFaceTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace ReAction.Modules;

public unsafe class EnhancedAutoFaceTarget : PluginModule
{
private static readonly AsmPatch removeAutoFaceTargetPatch = new("41 80 7F 33 06 75 1E 48 8D 0D", new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0xEB, 0x1C });
private static readonly AsmPatch removeAutoFaceGroundTargetPatch = new("41 80 7F 33 06 74 22 49 8D 8E", new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0xEB });
private static readonly AsmPatch removeAutoFaceTargetPatch = new("41 80 7F 33 06 75 1E 48 8D 0D", new byte?[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0xEB, 0x1C });
private static readonly AsmPatch removeAutoFaceGroundTargetPatch = new("41 80 7F 33 06 74 22 49 8D 8E", new byte?[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0xEB });

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

Expand Down
3 changes: 1 addition & 2 deletions Modules/FrameAlignment.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Diagnostics;
using Dalamud.Game;
using Dalamud.Logging;

namespace ReAction.Modules;

Expand Down Expand Up @@ -40,7 +39,7 @@ private static void Update(Framework framework)

if (blockDuration > 0)
{
PluginLog.Debug($"Blocking main thread for {blockDuration / Stopwatch.Frequency * 1000} ms");
DalamudApi.LogDebug($"Blocking main thread for {blockDuration / Stopwatch.Frequency * 1000} ms");

timer.Restart();
while (timer.ElapsedTicks < blockDuration) ;
Expand Down
7 changes: 3 additions & 4 deletions Modules/QueueMore.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using Dalamud.Logging;
using Hypostasis.Game.Structures;
using Lumina.Excel.GeneratedSheets;

namespace ReAction.Modules;

public unsafe class QueueMore : PluginModule
{
private static readonly AsmPatch allowQueuingPatch = new("76 2F 80 F9 04", new byte[] { 0xEB });
private static readonly AsmPatch allowQueuingPatch = new("76 2B 80 F9 04", new byte?[] { 0xEB });
private static ushort lastLBSequence = 0;

public override bool ShouldEnable => ReAction.Config.EnableQueuingMore;
Expand Down Expand Up @@ -34,7 +33,7 @@ private static void PreUseAction(ActionManager* actionManager, ref uint actionTy
switch (actionType)
{
case 2:
PluginLog.Debug("Applying queued item param");
DalamudApi.LogDebug("Applying queued item param");
param = 65535;
break;
case 5 when actionID == 4:
Expand All @@ -50,7 +49,7 @@ private static void PostActionStack(ActionManager* actionManager, uint actionTyp
if (useType != 0 || !CheckAction(actionType, actionID, adjustedActionID)) return;

allowQueuingPatch.Enable();
PluginLog.Debug($"Enabling queuing {actionType}, {adjustedActionID}");
DalamudApi.LogDebug($"Enabling queuing {actionType}, {adjustedActionID}");
}

private static void PostUseAction(ActionManager* actionManager, uint actionType, uint actionID, uint adjustedActionID, long targetObjectID, uint param, uint useType, int pvp, bool ret)
Expand Down
6 changes: 3 additions & 3 deletions PluginUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private static void DrawStackList()
}
catch (Exception e)
{
ReAction.PrintError($"Failed to import stack from clipboard!\n{e.Message}");
DalamudApi.PrintError($"Failed to import stack from clipboard!\n{e.Message}");
}
}
ImGui.PopFont();
Expand Down Expand Up @@ -585,7 +585,7 @@ private static void DrawOtherSettings()
else
{
ReAction.Config.EnableFractionality = false;
ReAction.PrintError("Please disable and delete Fractionality by using the trashcan icon on the plugin installer before enabling this!");
DalamudApi.PrintError("Please disable and delete Fractionality by using the trashcan icon on the plugin installer before enabling this!");
}
}
ImGuiEx.SetItemTooltip("Allows decimals in wait commands and removes the 60 seconds cap (e.g. <wait.0.5> or /wait 0.5).");
Expand Down Expand Up @@ -635,7 +635,7 @@ private static void DrawOtherSettings()
if (ImGui.Button("Execute"))
{
Game.SetHotbarSlot(hotbar, hotbarSlot, (byte)commandType, commandID);
ReAction.PrintEcho("MAKE SURE TO MOVE WHATEVER YOU JUST PLACED ON THE HOTBAR OR IT WILL NOT SAVE. YES, MOVING IT TO ANOTHER SLOT AND THEN MOVING IT BACK IS FINE.");
DalamudApi.PrintEcho("MAKE SURE TO MOVE WHATEVER YOU JUST PLACED ON THE HOTBAR OR IT WILL NOT SAVE. YES, MOVING IT TO ANOTHER SLOT AND THEN MOVING IT BACK IS FINE.");
}
ImGuiEx.SetItemTooltip("You need to move whatever you place on the hotbar in order to have it save.");
ImGuiEx.EndGroupBox();
Expand Down
4 changes: 2 additions & 2 deletions ReAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void OnMacroQueue(string command, string argument)
{
if (!Common.IsMacroRunning)
{
PrintError("This command requires a macro to be running.");
DalamudApi.PrintError("This command requires a macro to be running.");
return;
}

Expand All @@ -52,7 +52,7 @@ private void OnMacroQueue(string command, string argument)
Game.queueACCommandPatch.Toggle();
break;
default:
PrintError("Invalid usage.");
DalamudApi.PrintError("Invalid usage.");
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion 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.3</Version>
<Version>1.3.3.4</Version>
<TargetFramework>net7.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<Platforms>x64;AnyCPU</Platforms>
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": "Job placeholders will no longer match yourself."
"Changelog": ""
}

0 comments on commit 88c51a8

Please sign in to comment.