Skip to content

Commit

Permalink
AutoHook 3.0.0.3 [PUSH]
Browse files Browse the repository at this point in the history
Fix for #119
  • Loading branch information
InitialDet committed Oct 16, 2023
1 parent cd3d1f0 commit 74eb9f3
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 74 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>3.0.0.2</Version>
<Version>3.0.0.3</Version>
<Description>Auto hooks for you</Description>
<PackageProjectUrl>https://github.com/InitialDet/AutoHook</PackageProjectUrl>
<Configurations>Release;Debug</Configurations>
Expand Down
11 changes: 4 additions & 7 deletions AutoHook/Classes/AutoCasts/AutoCastLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ namespace AutoHook.Classes.AutoCasts;

public class AutoCastLine : BaseActionCast
{

public AutoCastLine() : base(UIStrings.AutoCastLine_Auto_Cast_Line, Data.IDs.Actions.Cast)
{
GpThreshold = 1;
}

public override bool CastCondition()
{
return true;
}

/*protected override DrawOptionsDelegate DrawOptions => () =>
{
};*/

public override string GetName()
=> Name = UIStrings.AutoCastLine_Auto_Cast_Line;
}
7 changes: 5 additions & 2 deletions AutoHook/Classes/AutoCasts/AutoChum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ namespace AutoHook.Classes.AutoCasts;
public class AutoChum : BaseActionCast
{
private bool _onlyUseWithIntuition;

public AutoChum() : base(UIStrings.Chum, IDs.Actions.Chum)
{
DoesCancelMooch = true;
HelpText = UIStrings.CancelsCurrentMooch;
}

public override string GetName()
=> Name = UIStrings.Chum;

public override bool CastCondition()
{
if (!PlayerResources.HasStatus(IDs.Status.FishersIntuition) && _onlyUseWithIntuition)
return false;

return true;
return true;
}

protected override DrawOptionsDelegate DrawOptions => () =>
Expand Down
15 changes: 8 additions & 7 deletions AutoHook/Classes/AutoCasts/AutoCordial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public class AutoCordial : BaseActionCast
private const uint CordialWateredRecovery = 150;

private bool _invertCordialPriority;

public AutoCordial() : base(UIStrings.Cordial, IDs.Item.Cordial, ActionType.Item)
{
GpThreshold = 1;
}

public override bool CastCondition()
{
var cordialList = new List<(uint, bool, uint)>
Expand All @@ -31,20 +31,21 @@ public override bool CastCondition()
(IDs.Item.WateredCordial, true, CordialHqWateredRecovery), // Hq
(IDs.Item.WateredCordial, false, CordialWateredRecovery)
};

if (_invertCordialPriority)
cordialList.Reverse();

foreach (var (id, hq, recovery) in cordialList)
{
if (!PlayerResources.HaveItemInInventory(id, hq))
continue;

Id = id;

var notOvercaped = PlayerResources.GetCurrentGp() + recovery < PlayerResources.GetMaxGp();
return notOvercaped && PlayerResources.IsPotOffCooldown();
}

return false;
}

Expand All @@ -55,7 +56,7 @@ public override void SetThreshold(int newCost)
else
GpThreshold = newCost;
}

protected override DrawOptionsDelegate DrawOptions => () =>
{
if (DrawUtil.Checkbox(UIStrings.AutoCastCordialPriority, ref _invertCordialPriority))
Expand Down
9 changes: 6 additions & 3 deletions AutoHook/Classes/AutoCasts/AutoDoubleHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ public class AutoDoubleHook : BaseActionCast
{
public AutoDoubleHook() : base(UIStrings.Double_Hook, Data.IDs.Actions.DoubleHook, ActionType.Action)
{

}

public override string GetName()
=> Name = UIStrings.Double_Hook;

public override bool CastCondition()
{
return true;
}

/*protected override DrawOptionsDelegate DrawOptions => () =>
{
};*/
}
7 changes: 5 additions & 2 deletions AutoHook/Classes/AutoCasts/AutoFishEyes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ public AutoFishEyes() : base(UIStrings.Fish_Eyes, IDs.Actions.FishEyes, ActionTy
HelpText = UIStrings.CancelsCurrentMooch;
}

public override string GetName()
=> Name = UIStrings.Fish_Eyes;

public override bool CastCondition()
{
return true;
}

/*protected override DrawOptionsDelegate DrawOptions => () =>
{
};*/
}
15 changes: 8 additions & 7 deletions AutoHook/Classes/AutoCasts/AutoFood.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@ namespace AutoHook.Classes.AutoCasts;
public class AutoFood : BaseActionCast
{
private float _secondsRemaining = 0;

public AutoFood() : base(UIStrings.Food_Buff, 0, ActionType.Item)
{

}


public override string GetName()
=> Name = UIStrings.Food_Buff;

public override bool CastCondition()
{

if (PlayerResources.CheckFoodBuff() > _secondsRemaining)
{
return false;
}

return true;
}

/*protected override DrawOptionsDelegate DrawOptions => () =>
{
};*/
}
16 changes: 9 additions & 7 deletions AutoHook/Classes/AutoCasts/AutoIdenticalCast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,34 @@ namespace AutoHook.Classes.AutoCasts;
public class AutoIdenticalCast : BaseActionCast
{
public bool OnlyUseUnderPatience = false;
public AutoIdenticalCast(string name = "") : base(UIStrings.Identical_Cast, IDs.Actions.IdenticalCast, ActionType.Action)

public AutoIdenticalCast() : base(UIStrings.Identical_Cast, IDs.Actions.IdenticalCast, ActionType.Action)
{
Name = name == "" ? UIStrings.Identical_Cast : name;
DoesCancelMooch = true;
HelpText = UIStrings.OverridesSurfaceSlap;
}

public override string GetName()
=> Name = UIStrings.UseIdenticalCast;

public override bool CastCondition()
{
if (PlayerResources.HasStatus(IDs.Status.IdenticalCast) || PlayerResources.HasStatus(IDs.Status.SurfaceSlap))
return false;

if (OnlyUseUnderPatience && !PlayerResources.HasStatus(IDs.Status.AnglersFortune))
return false;

return true;
}

protected override DrawOptionsDelegate DrawOptions => () =>
{
if (DrawUtil.Checkbox(UIStrings.Only_When_Patience_Active, ref OnlyUseUnderPatience))
{
Service.Save();
}

if (DrawUtil.Checkbox(UIStrings.Dont_Cancel_Mooch, ref DontCancelMooch,
UIStrings.IdenticalCast_HelpText, true))
{
Expand Down
9 changes: 6 additions & 3 deletions AutoHook/Classes/AutoCasts/AutoMakeShiftBait.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public AutoMakeShiftBait() : base(UIStrings.MakeShift_Bait, IDs.Actions.Makeshif
{
HelpText = UIStrings.TabAutoCasts_DrawMakeShiftBait_HelpText;
}

public override string GetName()
=> Name = UIStrings.MakeShift_Bait;

public override bool CastCondition()
{
if (!Enabled)
Expand All @@ -34,7 +38,7 @@ public override bool CastCondition()

return hasStacks && available;
}

protected override DrawOptionsDelegate DrawOptions => () =>
{
var stack = MakeshiftBaitStacks;
Expand All @@ -45,5 +49,4 @@ public override bool CastCondition()
Service.Save();
}
};
}

}
16 changes: 10 additions & 6 deletions AutoHook/Classes/AutoCasts/AutoMooch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ public class AutoMooch : BaseActionCast
public AutoMooch2 Mooch2 = new();

public bool OnlyMoochIntuition = false;

public AutoMooch() : base(UIStrings.AutoMooch, Data.IDs.Actions.Mooch, ActionType.Action)
{
DoesCancelMooch = false;
}


public override string GetName()
=> Name = UIStrings.AutoMooch;

public override bool CastCondition()
{
if (OnlyMoochIntuition && !PlayerResources.HasStatus(IDs.Status.IdenticalCast))
return false;

if (Mooch2.IsAvailableToCast())
{
Service.PrintDebug(@$"Mooch2 Available, casting mooch2");
Expand All @@ -37,11 +40,12 @@ public override bool CastCondition()

return true;
}

protected override DrawOptionsDelegate DrawOptions => () =>
{
{
Mooch2.DrawConfig();
if (DrawUtil.Checkbox(UIStrings.TabAutoCasts_DrawExtraOptionsAutoMooch_Extra_Only_Active, ref OnlyMoochIntuition))
if (DrawUtil.Checkbox(UIStrings.TabAutoCasts_DrawExtraOptionsAutoMooch_Extra_Only_Active,
ref OnlyMoochIntuition))
{
Service.Save();
}
Expand Down
12 changes: 6 additions & 6 deletions AutoHook/Classes/AutoCasts/AutoMooch2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ public class AutoMooch2 : BaseActionCast
{
public AutoMooch2() : base(UIStrings.UseMoochII, Data.IDs.Actions.Mooch2, ActionType.Action)
{

}


public override string GetName()
=> Name = UIStrings.UseMoochII;

public override bool CastCondition()
{
return true;
}

/*protected override DrawOptionsDelegate DrawOptions => () =>
{
};*/


}
8 changes: 5 additions & 3 deletions AutoHook/Classes/AutoCasts/AutoPatience.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ namespace AutoHook.Classes.AutoCasts;
public class AutoPatience : BaseActionCast
{
public bool EnableMakeshiftPatience;

public AutoPatience() : base(UIStrings.AutoPatience_Patience, Data.IDs.Actions.Patience2, ActionType.Action)
{
DoesCancelMooch = true;
HelpText = UIStrings.CancelsCurrentMooch;
}

public override string GetName()
=> Name = UIStrings.AutoPatience_Patience;

public override bool CastCondition()
{

if (PlayerResources.HasStatus(IDs.Status.AnglersFortune))
return false;

Expand All @@ -30,7 +32,7 @@ public override bool CastCondition()

return true;
}

protected override DrawOptionsDelegate DrawOptions => () =>
{
if (DrawUtil.Checkbox(UIStrings.TabAutoCasts_DrawExtraOptionsPatience, ref EnableMakeshiftPatience))
Expand Down
8 changes: 5 additions & 3 deletions AutoHook/Classes/AutoCasts/AutoPrizeCatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ namespace AutoHook.Classes.AutoCasts;

public class AutoPrizeCatch : BaseActionCast
{

public bool UseWhenMoochIIOnCD = false;

public bool UseOnlyWithIdenticalCast = false;

public AutoPrizeCatch() : base(UIStrings.Prize_Catch, Data.IDs.Actions.PrizeCatch, ActionType.Action)
{
DoesCancelMooch = true;
HelpText = UIStrings.Use_Prize_Catch_HelpText;
}

public override string GetName()
=> Name = UIStrings.Prize_Catch;

public override bool CastCondition()
{
if (!Enabled)
Expand All @@ -40,7 +42,7 @@ public override bool CastCondition()

return PlayerResources.ActionAvailable(IDs.Actions.PrizeCatch);
}

protected override DrawOptionsDelegate DrawOptions => () =>
{
if (DrawUtil.Checkbox(UIStrings.AutoCastExtraOptionPrizeCatch,
Expand Down
Loading

0 comments on commit 74eb9f3

Please sign in to comment.