Skip to content

Commit

Permalink
resolve #40
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Oct 9, 2024
1 parent 01657ae commit 61d64a7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
13 changes: 6 additions & 7 deletions Automaton/Features/AutoFollow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ namespace Automaton.Features;

public class AutoFollowConfiguration
{
[EnumConfig] public Utilities.Utils.MovementType MovementType;
[EnumConfig] public Utils.MovementType MovementType;

[IntConfig(DefaultValue = 3)] public int DistanceToKeep = 3;
[IntConfig] public int DisableIfFurtherThan;
[BoolConfig] public bool OnlyInDuty;
[BoolConfig] public bool ChangeMasterOnChat;
[BoolConfig] public bool MountAndFly;
[StringConfig] public string AutoFollowName = string.Empty;
}
Expand Down Expand Up @@ -94,13 +93,15 @@ private void Follow(IFramework framework)

if (master.ObjectKind == Dalamud.Game.ClientState.Objects.Enums.ObjectKind.Player)
{
// mount
if (master.Character()->IsMounted() && CanMount())
{
movement.Enabled = false;
ActionManager.Instance()->UseAction(ActionType.GeneralAction, 9);
return;
}

// fly
if (Config.MountAndFly && ((Structs.Character*)master.Address)->IsFlying != 0 && !Svc.Condition[ConditionFlag.InFlight] && Svc.Condition[ConditionFlag.Mounted])
{
movement.Enabled = false;
Expand All @@ -110,17 +111,15 @@ private void Follow(IFramework framework)
return;
}

if (!(master.Character()->IsMounted() && Svc.Condition[ConditionFlag.Mounted]) && TerritorySupportsMounting())
// dismount
if (!master.Character()->IsMounted() && Svc.Condition[ConditionFlag.Mounted])
{
movement.Enabled = false;
master.BattleChara()->GetStatusManager()->RemoveStatus(10);
ActionManager.Instance()->UseAction(ActionType.GeneralAction, 9);
ActionManager.Instance()->UseAction(ActionType.GeneralAction, 23);
return;
}
}

// set dismount logic here

if (Vector3.Distance(Player.Position, master.Position) <= Config.DistanceToKeep) { movement.Enabled = false; return; }

movement.Enabled = true;
Expand Down
3 changes: 2 additions & 1 deletion Automaton/Features/IgnoreInteractChecks.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ImGuiNET;
using ECommons.GameFunctions;
using ImGuiNET;

namespace Automaton.Features;

Expand Down
2 changes: 1 addition & 1 deletion Automaton/Utilities/Structs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public unsafe struct CameraEx
[StructLayout(LayoutKind.Explicit, Size = 0x1BD0)]
public unsafe partial struct Character
{
[FieldOffset(0x60C)] public byte IsFlying;
[FieldOffset(0x386)] public byte IsFlying;
}

[StructLayout(LayoutKind.Explicit, Size = 0x38)]
Expand Down

0 comments on commit 61d64a7

Please sign in to comment.