Skip to content

Commit

Permalink
AutoHook 2.2.2.1 [PUSH]
Browse files Browse the repository at this point in the history
Fixed an issue where Actions that could cancel mooch where not being used even when Auto Mooch was disabled.

Delay between casts lowered (revert if problems are reported)
  • Loading branch information
InitialDet committed Jul 30, 2022
1 parent 73e9bd0 commit 852f2ff
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion AutoHook/AutoHook.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Det</Authors>
<Version>2.2.2.0</Version>
<Version>2.2.2.1</Version>
<Description>Auto hooks for you</Description>
<PackageProjectUrl>https://github.com/InitialDet/AutoHook</PackageProjectUrl>
<Configurations>Release;Debug</Configurations>
Expand Down
22 changes: 10 additions & 12 deletions AutoHook/Configurations/AutoCastsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ public class AutoCastsConfig
public bool EnableCordialFirst = false;


HookConfig? hookConfig = null;
private HookConfig? hookConfig = null;
private bool IsMoochAvailable = false;

public AutoCast? GetNextAutoCast(HookConfig? hookConfig)
{

if (!EnableAll)
return null;

this.hookConfig = hookConfig;

IsMoochAvailable = UseMooch(out uint idMooch);

if (!PlayerResources.ActionAvailable(IDs.Actions.Cast))
return null;

Expand Down Expand Up @@ -77,7 +80,7 @@ public class AutoCastsConfig
if (UsesCordials(out uint idCordial))
return new(idCordial, ActionType.Item);

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

if (EnableAutoCast)
Expand Down Expand Up @@ -128,7 +131,7 @@ private bool UsePatience()
if (!PlayerResources.HasStatus(IDs.Status.AnglersFortune))
{
// Dont use Patience if mooch is available
if (IsMoochAvailable())
if (IsMoochAvailable)
{
return false;
}
Expand Down Expand Up @@ -186,17 +189,12 @@ private bool UseMakeshiftBait()
return hasStacks && available;
}

private bool IsMoochAvailable()
{
return PlayerResources.ActionAvailable(IDs.Actions.Mooch) || PlayerResources.ActionAvailable(IDs.Actions.Mooch2);
}

private bool UsePrizeCatch()
{
if (!EnablePrizeCatch)
return false;

if (IsMoochAvailable() && DontCancelMooch)
if (IsMoochAvailable && DontCancelMooch)
return false;

if (PlayerResources.HasStatus(IDs.Status.MakeshiftBait))
Expand All @@ -213,15 +211,15 @@ private bool UsePrizeCatch()

private bool UsesFishEyes()
{
if (IsMoochAvailable() && DontCancelMooch)
if (IsMoochAvailable && DontCancelMooch)
return false;

return EnableFishEyes && PlayerResources.ActionAvailable(IDs.Actions.FishEyes);
}

private bool UsesChum()
{
if (IsMoochAvailable() && DontCancelMooch)
if (IsMoochAvailable && DontCancelMooch)
return false;

return EnableChum && PlayerResources.ActionAvailable(IDs.Actions.Chum);
Expand Down
5 changes: 1 addition & 4 deletions AutoHook/Ui/AutoCastsTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ public override void DrawHeader()
if (DrawUtil.Checkbox("Enable Auto Casts", ref cfg.EnableAll, "You can uncheck this to not use any actions below"))
{ }


if (cfg.EnableAll) {
ImGui.SameLine();
if (DrawUtil.Checkbox("Don't Cancel Mooch", ref cfg.DontCancelMooch, "If mooch is available, actions that cancel mooch wont be used (e.g. Chum, Fish Eyes, Prize Catch etc.)"))
if (DrawUtil.Checkbox("Don't Cancel Mooch", ref cfg.DontCancelMooch, "If mooch is available & Auto Mooch is enabled, actions that cancel mooch wont be used (e.g. Chum, Fish Eyes, Prize Catch etc.)"))
{ }
}


}

public override void Draw()
Expand Down
2 changes: 1 addition & 1 deletion AutoHook/Utils/PlayerResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static async void CastActionDelayed(uint id, ActionType actionType = Acti
}

if (delay <= 0)
delay = new Random().Next(800, 1000);
delay = new Random().Next(600, 700);

isCasting = true;

Expand Down

0 comments on commit 852f2ff

Please sign in to comment.