Skip to content

Commit

Permalink
6.5 Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
InitialDet committed Oct 4, 2023
1 parent 634b9f2 commit ff6ce5b
Show file tree
Hide file tree
Showing 29 changed files with 970 additions and 181 deletions.
13 changes: 8 additions & 5 deletions AutoHook/AutoHook.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AutoHook.Configurations;
using System.Globalization;
using AutoHook.Configurations;
using AutoHook.Resources.Localization;
using AutoHook.SeFunctions;
using AutoHook.Spearfishing;
Expand Down Expand Up @@ -39,7 +40,7 @@ public AutoHook(DalamudPluginInterface pluginInterface)

_playerResources = new PlayerResources();
_playerResources.Initialize();

UIStrings.Culture = new CultureInfo(Service.Configuration.CurrentLanguage);
_pluginUi = new PluginUi();
_autoGig = new AutoGig();

Expand All @@ -58,10 +59,10 @@ public AutoHook(DalamudPluginInterface pluginInterface)
HelpMessage = UIStrings.Opens_Config_Window
});

Service.Commands.AddHandler(CmdAh, new CommandInfo(OnCommand)
/*Service.Commands.AddHandler(CmdAh, new CommandInfo(OnCommand)
{
HelpMessage = UIStrings.Opens_Config_Window
});
});*/

Service.Commands.AddHandler(CmdAhtg, new CommandInfo(OnCommand)
{
Expand All @@ -72,6 +73,8 @@ public AutoHook(DalamudPluginInterface pluginInterface)

#if (DEBUG)
OnOpenConfigUi();


#endif
}

Expand Down Expand Up @@ -112,7 +115,7 @@ public void Dispose()
Service.PluginInterface.UiBuilder.Draw -= Service.WindowSystem.Draw;
Service.PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
Service.Commands.RemoveHandler(CmdAhCfg);
Service.Commands.RemoveHandler(CmdAh);
//Service.Commands.RemoveHandler(CmdAh);
Service.Commands.RemoveHandler(CmdAhOn);
Service.Commands.RemoveHandler(CmdAhOff);
Service.Commands.RemoveHandler(CmdAhtg);
Expand Down
2 changes: 1 addition & 1 deletion AutoHook/AutoHook.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<!-- Localization -->

<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.10" />
<PackageReference Include="DalamudPackager" Version="2.1.12" />
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
Expand Down
2 changes: 1 addition & 1 deletion AutoHook/AutoHook.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"RepoUrl": "https://github.com/InitialDet/AutoHook",
"ApplicableVersion": "any",
"Tags": [ "Gathering", "Fishing" ],
"DalamudApiLevel": 8,
"DalamudApiLevel": 9,
"AcceptsFeedback": false,
"IconUrl": "https://raw.githubusercontent.com/InitialDet/AutoHook/main/AutoHook/images/icon.png",
"Changelog": "Click the new Changelog button to see whats new"
Expand Down
34 changes: 17 additions & 17 deletions AutoHook/Classes/AvailableAutoCast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed class AutoMakeShiftBait : BaseActionCast
{
public int MakeshiftBaitStacks = 5;

public AutoMakeShiftBait() : base(UIStrings.MakeShift_Bait, IDs.Actions.MakeshiftBait, ActionType.Spell)
public AutoMakeShiftBait() : base(UIStrings.MakeShift_Bait, IDs.Actions.MakeshiftBait, ActionType.Action)
{

}
Expand Down Expand Up @@ -43,7 +43,7 @@ public sealed class AutoThaliaksFavor : BaseActionCast
public int ThaliaksFavorStacks = 3;
public int ThaliaksFavorRecover = 150;

public AutoThaliaksFavor() : base(UIStrings.Thaliaks_Favor, IDs.Actions.ThaliaksFavor, ActionType.Spell)
public AutoThaliaksFavor() : base(UIStrings.Thaliaks_Favor, IDs.Actions.ThaliaksFavor, ActionType.Action)
{

}
Expand All @@ -52,7 +52,7 @@ public override bool CastCondition()
{
bool hasStacks = PlayerResources.HasAnglersArtStacks(ThaliaksFavorStacks);

bool notOvercaped = (PlayerResources.GetCurrentGP() + ThaliaksFavorRecover) < PlayerResources.GetMaxGP();
bool notOvercaped = (PlayerResources.GetCurrentGp() + ThaliaksFavorRecover) < PlayerResources.GetMaxGp();

return hasStacks && notOvercaped; // dont use if its going to overcap gp
}
Expand All @@ -63,7 +63,7 @@ public override bool CastCondition()
public sealed class AutoChum : BaseActionCast
{
public bool OnlyUseWithIntuition = false;
public AutoChum() : base(UIStrings.Chum, IDs.Actions.Chum, ActionType.Spell)
public AutoChum() : base(UIStrings.Chum, IDs.Actions.Chum, ActionType.Action)
{
DoesCancelMooch = true;
}
Expand All @@ -82,7 +82,7 @@ public override bool CastCondition()
public class AutoFishEyes : BaseActionCast
{

public AutoFishEyes() : base(UIStrings.Fish_Eyes, IDs.Actions.FishEyes, ActionType.Spell)
public AutoFishEyes() : base(UIStrings.Fish_Eyes, IDs.Actions.FishEyes, ActionType.Action)
{
DoesCancelMooch = true;
}
Expand All @@ -98,7 +98,7 @@ public override bool CastCondition()
public sealed class AutoIdenticalCast : BaseActionCast
{
// this option is based on the custom BaitConfig, not the AutoCast tab
public AutoIdenticalCast() : base(UIStrings.Identical_Cast, Data.IDs.Actions.IdenticalCast, ActionType.Spell)
public AutoIdenticalCast() : base(UIStrings.Identical_Cast, Data.IDs.Actions.IdenticalCast, ActionType.Action)
{
Enabled = true;
}
Expand All @@ -115,7 +115,7 @@ public sealed class AutoSurfaceSlap : BaseActionCast
{

// this option is based on the BaitConfig, not the AutoCast tab
public AutoSurfaceSlap() : base(UIStrings.Surface_Slap, Data.IDs.Actions.SurfaceSlap, ActionType.Spell)
public AutoSurfaceSlap() : base(UIStrings.Surface_Slap, Data.IDs.Actions.SurfaceSlap, ActionType.Action)
{
Enabled = true;
}
Expand All @@ -135,7 +135,7 @@ public class AutoPrizeCatch : BaseActionCast
public bool UseOnlyWithIdenticalCast = false;


public AutoPrizeCatch() : base(UIStrings.Prize_Catch, Data.IDs.Actions.PrizeCatch, ActionType.Spell)
public AutoPrizeCatch() : base(UIStrings.Prize_Catch, Data.IDs.Actions.PrizeCatch, ActionType.Action)
{
DoesCancelMooch = true;
}
Expand Down Expand Up @@ -169,7 +169,7 @@ public override bool CastCondition()
#region AutoPatienceI
public class AutoPatienceI : BaseActionCast
{
public AutoPatienceI() : base(UIStrings.Patience_I, Data.IDs.Actions.Patience, ActionType.Spell)
public AutoPatienceI() : base(UIStrings.Patience_I, Data.IDs.Actions.Patience, ActionType.Action)
{
DoesCancelMooch = true;
}
Expand All @@ -193,7 +193,7 @@ public override bool CastCondition()
#region AutoPatienceII
public class AutoPatienceII : BaseActionCast
{
public AutoPatienceII() : base(UIStrings.Patience_II, Data.IDs.Actions.Patience2, ActionType.Spell)
public AutoPatienceII() : base(UIStrings.Patience_II, Data.IDs.Actions.Patience2, ActionType.Action)
{
DoesCancelMooch = true;
}
Expand All @@ -217,7 +217,7 @@ public override bool CastCondition()
#region AutoDoubleHook
public sealed class AutoDoubleHook : BaseActionCast
{
public AutoDoubleHook() : base(UIStrings.Double_Hook, Data.IDs.Actions.DoubleHook, ActionType.Spell)
public AutoDoubleHook() : base(UIStrings.Double_Hook, Data.IDs.Actions.DoubleHook, ActionType.Action)
{

}
Expand All @@ -231,7 +231,7 @@ public override bool CastCondition()
#region AutoTripleHook
public sealed class AutoTripleHook : BaseActionCast
{
public AutoTripleHook() : base(UIStrings.Triple_Hook, Data.IDs.Actions.TripleHook, ActionType.Spell)
public AutoTripleHook() : base(UIStrings.Triple_Hook, Data.IDs.Actions.TripleHook, ActionType.Action)
{

}
Expand All @@ -257,7 +257,7 @@ public override bool CastCondition()
if (!PlayerResources.HaveItemInInventory(ID))
return false;

bool notOvercaped = (PlayerResources.GetCurrentGP() + itemGPRecovery < PlayerResources.GetMaxGP());
bool notOvercaped = (PlayerResources.GetCurrentGp() + itemGPRecovery < PlayerResources.GetMaxGp());

return notOvercaped && PlayerResources.IsPotOffCooldown();
}
Expand Down Expand Up @@ -286,7 +286,7 @@ public override bool CastCondition()
if (!PlayerResources.HaveItemInInventory(ID))
return false;

bool notOvercaped = (PlayerResources.GetCurrentGP() + itemGPRecovery < PlayerResources.GetMaxGP());
bool notOvercaped = (PlayerResources.GetCurrentGp() + itemGPRecovery < PlayerResources.GetMaxGp());

return notOvercaped && PlayerResources.IsPotOffCooldown();
}
Expand Down Expand Up @@ -315,7 +315,7 @@ public override bool CastCondition()
if (!PlayerResources.HaveItemInInventory(ID))
return false;

bool notOvercaped = (PlayerResources.GetCurrentGP() + itemGPRecovery < PlayerResources.GetMaxGP());
bool notOvercaped = (PlayerResources.GetCurrentGp() + itemGPRecovery < PlayerResources.GetMaxGp());

return notOvercaped && PlayerResources.IsPotOffCooldown();
}
Expand Down Expand Up @@ -344,7 +344,7 @@ public override bool CastCondition()
if (!PlayerResources.HaveItemInInventory(ID))
return false;

bool notOvercaped = (PlayerResources.GetCurrentGP() + itemGPRecovery < PlayerResources.GetMaxGP());
bool notOvercaped = (PlayerResources.GetCurrentGp() + itemGPRecovery < PlayerResources.GetMaxGp());

return notOvercaped && PlayerResources.IsPotOffCooldown();
}
Expand Down Expand Up @@ -373,7 +373,7 @@ public override bool CastCondition()
if (!PlayerResources.HaveItemInInventory(ID))
return false;

bool notOvercaped = (PlayerResources.GetCurrentGP() + itemGPRecovery < PlayerResources.GetMaxGP());
bool notOvercaped = (PlayerResources.GetCurrentGp() + itemGPRecovery < PlayerResources.GetMaxGp());

return notOvercaped && PlayerResources.IsPotOffCooldown();
}
Expand Down
6 changes: 3 additions & 3 deletions AutoHook/Classes/BaseActionCast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ public abstract class BaseActionCast
protected BaitConfig? _baitConfig = null;
protected static readonly AutoCastsConfig AcConfig = Service.Configuration.AutoCastsCfg;

protected BaseActionCast(string name, uint id, ActionType actionType = ActionType.Spell)
protected BaseActionCast(string name, uint id, ActionType actionType = ActionType.Action)
{
Name = name;
ID = id;
Enabled = false;

ActionType = actionType;

if (actionType == ActionType.Spell)
if (actionType == ActionType.Action)
GPThreshold = PlayerResources.CastActionCost(ID, ActionType);
}

Expand Down Expand Up @@ -53,7 +53,7 @@ public bool IsAvailableToCast(BaitConfig? baitConfig)
if (DoesCancelMooch && PlayerResources.IsMoochAvailable() && AcConfig.DontCancelMooch)
return false;

uint currentGp = PlayerResources.GetCurrentGP();
uint currentGp = PlayerResources.GetCurrentGp();

bool hasGP;

Expand Down
4 changes: 2 additions & 2 deletions AutoHook/Configurations/AutoCastsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ public class AutoCastsConfig
return new(cordial.ID, cordial.ActionType);

if (UseMooch(out uint idMooch))
return new(idMooch, ActionType.Spell);
return new(idMooch, ActionType.Action);

if (EnableAutoCast)
return new(IDs.Actions.Cast, ActionType.Spell);
return new(IDs.Actions.Cast, ActionType.Action);

return null;
}
Expand Down
4 changes: 2 additions & 2 deletions AutoHook/Configurations/BaitConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ public bool CheckHookDHTHEnabled(BiteType bite) =>
if (PlayerResources.HasStatus(IDs.Status.AnglersFortune) && !UseDHTHPatience)
return HookType.None;

if (UseTripleHook && PlayerResources.GetCurrentGP() >= 700 && CheckHookDHTHEnabled(bite))
if (UseTripleHook && PlayerResources.GetCurrentGp() >= 700 && CheckHookDHTHEnabled(bite))
return HookType.Triple;

if (UseDoubleHook && PlayerResources.GetCurrentGP() >= 400 && CheckHookDHTHEnabled(bite))
if (UseDoubleHook && PlayerResources.GetCurrentGp() >= 400 && CheckHookDHTHEnabled(bite))
return HookType.Double;

if (LetFishEscape)
Expand Down
2 changes: 2 additions & 0 deletions AutoHook/Configurations/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Compression;
using System.IO;
using System.Text;
Expand All @@ -15,6 +16,7 @@ namespace AutoHook.Configurations;
public class Configuration : IPluginConfiguration
{
public int Version { get; set; } = 2;
public string CurrentLanguage { get; set; } = "en";

public bool PluginEnabled = true;

Expand Down
6 changes: 3 additions & 3 deletions AutoHook/HookManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using AutoHook.Enums;
using AutoHook.Resources.Localization;
using AutoHook.Utils;
using Dalamud.Game;
using Dalamud.Logging;
using Parser;
using AutoHook.Parser;
using Dalamud.Plugin.Services;
using Item = Lumina.Excel.GeneratedSheets.Item;

namespace AutoHook;
Expand Down Expand Up @@ -185,7 +185,7 @@ private void OnCatch(string fishName, uint fishId)
}


private void OnFrameworkUpdate(Framework _)
private void OnFrameworkUpdate(IFramework _)
{
var state = Service.EventFramework.FishingState;

Expand Down
2 changes: 1 addition & 1 deletion AutoHook/Parser/FishingParser.Regexes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Text.RegularExpressions;
using Dalamud;

namespace Parser;
namespace AutoHook.Parser;

public partial class FishingParser
{
Expand Down
6 changes: 3 additions & 3 deletions AutoHook/Parser/FishingParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Item = Lumina.Excel.GeneratedSheets.Item;
using AutoHook.Data;

namespace Parser;
namespace AutoHook.Parser;

public partial class FishingParser : IDisposable
{
Expand All @@ -32,7 +32,7 @@ public unsafe FishingParser()
{
_catchHook = new UpdateFishCatch(Service.SigScanner).CreateHook(OnCatchUpdate);
var hookPtr = (IntPtr)ActionManager.MemberFunctionPointers.UseAction;
_hookHook = Hook<UseActionDelegate>.FromAddress(hookPtr, OnUseAction);
_hookHook = Service.GameInteropProvider.HookFromAddress<UseActionDelegate>(hookPtr, OnUseAction);
}

public void Enable()
Expand Down Expand Up @@ -85,7 +85,7 @@ private void OnMessageDelegate(XivChatType type, uint senderId, ref SeString sen

private bool OnUseAction(IntPtr manager, ActionType actionType, uint actionId, GameObjectID targetId, uint a4, uint a5, uint a6, IntPtr a7)
{
if (actionType == ActionType.Spell && PlayerResources.ActionAvailable(actionId))
if (actionType == ActionType.Action && PlayerResources.ActionAvailable(actionId))
switch (actionId)
{
case IDs.Actions.Cast:
Expand Down
Loading

0 comments on commit ff6ce5b

Please sign in to comment.