Skip to content

Commit

Permalink
Merge pull request #151 from Jaksuhn/prize-catch-mods
Browse files Browse the repository at this point in the history
(by Jaksuhn) multiple "only use when active slap" options
  • Loading branch information
InitialDet authored Feb 4, 2024
2 parents 1542e78 + 4d3ae00 commit 0589ba2
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 10 deletions.
10 changes: 10 additions & 0 deletions AutoHook/Classes/AutoCasts/AutoPrizeCatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class AutoPrizeCatch : BaseActionCast

public bool UseOnlyWithIdenticalCast = false;

public bool UseOnlyWithActiveSlap = false;

public AutoPrizeCatch() : base(UIStrings.Prize_Catch, Data.IDs.Actions.PrizeCatch, ActionType.Action)
{
DoesCancelMooch = true;
Expand All @@ -31,6 +33,9 @@ public override bool CastCondition()
if (UseOnlyWithIdenticalCast && !PlayerResources.HasStatus(IDs.Status.IdenticalCast))
return false;

if (UseOnlyWithActiveSlap && !PlayerResources.HasStatus(IDs.Status.SurfaceSlap))
return false;

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

Expand All @@ -56,5 +61,10 @@ public override bool CastCondition()
{
Service.Save();
}

if (DrawUtil.Checkbox(UIStrings.OnlyUseWhenActiveSurfaceSlap, ref UseOnlyWithActiveSlap))
{
Service.Save();
}
};
}
28 changes: 27 additions & 1 deletion AutoHook/Configurations/HookConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,24 @@ public class HookConfig
public bool HookWeakEnabled = true;
public bool HookWeakIntuitionEnabled = true;
public bool HookWeakDHTHEnabled = true;
public bool HookWeakOnlyWhenActiveSlap = false;
public bool HookWeakOnlyWhenNOTActiveSlap = false;
public HookType HookTypeWeak = HookType.Precision;
public HookType HookTypeWeakIntuition = HookType.Precision;

public bool HookStrongEnabled = true;
public bool HookStrongIntuitionEnabled = true;
public bool HookStrongDHTHEnabled = true;
public bool HookStrongOnlyWhenActiveSlap = false;
public bool HookStrongOnlyWhenNOTActiveSlap = false;
public HookType HookTypeStrong = HookType.Powerful;
public HookType HookTypeStrongIntuition = HookType.Powerful;

public bool HookLegendaryEnabled = true;
public bool HookLegendaryIntuitionEnabled = true;
public bool HookLegendaryDHTHEnabled = true;
public bool HookLegendaryOnlyWhenActiveSlap = false;
public bool HookLegendaryOnlyWhenNOTActiveSlap = false;
public HookType HookTypeLegendary = HookType.Powerful;
public HookType HookTypeLegendaryIntuition = HookType.Powerful;

Expand All @@ -45,6 +51,7 @@ public class HookConfig
public bool UseDoubleHook = false;
public bool UseTripleHook = false;
public bool UseDHTHPatience = false;
public bool UseDHTHOnlyIdenticalCast = false;
public bool UseDHTHOnlySurfaceSlap = false;
public bool LetFishEscape = false;

Expand Down Expand Up @@ -83,6 +90,12 @@ public HookConfig(BaitFishClass baitFish)
else if (!CheckHookEnabled(bite))
return HookType.None;

if (CheckHookSurfaceSlapEnabled(bite) && !PlayerResources.HasStatus(IDs.Status.SurfaceSlap))
return HookType.None;

if (CheckHookSurfaceSlapNOTEnabled(bite) && PlayerResources.HasStatus(IDs.Status.SurfaceSlap))
return HookType.None;

var hook = GetDoubleTripleHook(bite);

if (hook != HookType.None)
Expand Down Expand Up @@ -119,6 +132,16 @@ public bool CheckHookIntuitionEnabled(BiteType bite) =>
bite == BiteType.Strong ? HookStrongIntuitionEnabled :
bite == BiteType.Legendary ? HookLegendaryIntuitionEnabled : false;

public bool CheckHookSurfaceSlapEnabled(BiteType bite) =>
bite == BiteType.Weak ? HookWeakOnlyWhenActiveSlap :
bite == BiteType.Strong ? HookStrongOnlyWhenActiveSlap :
bite == BiteType.Legendary ? HookLegendaryOnlyWhenActiveSlap : false;

public bool CheckHookSurfaceSlapNOTEnabled(BiteType bite) =>
bite == BiteType.Weak ? HookWeakOnlyWhenNOTActiveSlap :
bite == BiteType.Strong ? HookStrongOnlyWhenNOTActiveSlap :
bite == BiteType.Legendary ? HookLegendaryOnlyWhenNOTActiveSlap : false;

public bool CheckHookDHTHEnabled(BiteType bite) =>
bite == BiteType.Weak ? HookWeakDHTHEnabled :
bite == BiteType.Strong ? HookStrongDHTHEnabled :
Expand All @@ -144,7 +167,10 @@ public bool CheckHookDHTHEnabled(BiteType bite) =>
{
if (UseTripleHook || UseDoubleHook)
{
if (UseDHTHOnlySurfaceSlap && !PlayerResources.HasStatus(IDs.Status.IdenticalCast))
if (UseDHTHOnlyIdenticalCast && !PlayerResources.HasStatus(IDs.Status.IdenticalCast))
return HookType.None;

if (UseDHTHOnlySurfaceSlap && !PlayerResources.HasStatus(IDs.Status.SurfaceSlap))
return HookType.None;

if (PlayerResources.HasStatus(IDs.Status.AnglersFortune) && !UseDHTHPatience)
Expand Down
19 changes: 19 additions & 0 deletions AutoHook/Resources/Localization/UIStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions AutoHook/Resources/Localization/UIStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -874,4 +874,10 @@ Check the Guide Tab for Guides.</value>
<data name="Preset_set_to_" xml:space="preserve">
<value>Preset set to:</value>
</data>
<data name="OnlyUseWhenActiveSurfaceSlap" xml:space="preserve">
<value>Only use when Surface Slap is active</value>
</data>
<data name="OnlyUseWhenNOTActiveSurfaceSlap" xml:space="preserve">
<value>Only use when Surface Slap is not active</value>
</data>
</root>
37 changes: 28 additions & 9 deletions AutoHook/Ui/SubTabBaitMooch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class SubTabBaitMooch
private static string StrHookWeak => UIStrings.HookWeakExclamation;
private static string StrHookStrong => UIStrings.HookStrongExclamation;
private static string StrHookLegendary => UIStrings.HookLegendaryExclamation;
private static string StrHookWhenActiveSlap => UIStrings.OnlyUseWhenActiveSurfaceSlap;

//private PresetConfig _selectedPreset;
private List<HookConfig> _listOfHooks = new();
Expand Down Expand Up @@ -124,12 +125,12 @@ private void DrawDeleteButton(HookConfig hookConfig)

private void DrawHookCheckboxes(HookConfig hookConfig)
{
DrawSelectTugs(StrHookWeak, ref hookConfig.HookWeakEnabled, ref hookConfig.HookTypeWeak);
DrawSelectTugs(StrHookStrong, ref hookConfig.HookStrongEnabled, ref hookConfig.HookTypeStrong);
DrawSelectTugs(StrHookLegendary, ref hookConfig.HookLegendaryEnabled, ref hookConfig.HookTypeLegendary);
DrawSelectTugs(StrHookWeak, ref hookConfig.HookWeakEnabled, ref hookConfig.HookTypeWeak, ref hookConfig.HookWeakOnlyWhenActiveSlap, ref hookConfig.HookWeakOnlyWhenNOTActiveSlap);
DrawSelectTugs(StrHookStrong, ref hookConfig.HookStrongEnabled, ref hookConfig.HookTypeStrong, ref hookConfig.HookStrongOnlyWhenActiveSlap, ref hookConfig.HookStrongOnlyWhenNOTActiveSlap);
DrawSelectTugs(StrHookLegendary, ref hookConfig.HookLegendaryEnabled, ref hookConfig.HookTypeLegendary, ref hookConfig.HookLegendaryOnlyWhenActiveSlap, ref hookConfig.HookLegendaryOnlyWhenNOTActiveSlap);
}

private void DrawSelectTugs(string hook, ref bool enabled, ref HookType type)
private void DrawSelectTugs(string hook, ref bool enabled, ref HookType type, ref bool hookOnlyWhenActiveSlap, ref bool hookOnlyWhenNOTActiveSlap)
{
ImGui.PushID($"{hook}");
if(ImGui.Checkbox($"", ref enabled))
Expand Down Expand Up @@ -161,6 +162,20 @@ private void DrawSelectTugs(string hook, ref bool enabled, ref HookType type)
Service.Save();
}

ImGui.Spacing();

if (DrawUtil.Checkbox(UIStrings.OnlyUseWhenActiveSurfaceSlap, ref hookOnlyWhenActiveSlap))
{
hookOnlyWhenNOTActiveSlap = false;
Service.Save();
}

if (DrawUtil.Checkbox(UIStrings.OnlyUseWhenNOTActiveSurfaceSlap, ref hookOnlyWhenNOTActiveSlap))
{
hookOnlyWhenActiveSlap = false;
Service.Save();
}

ImGui.TreePop();
}

Expand Down Expand Up @@ -306,8 +321,12 @@ private void DrawCheckBoxDoubleTripleHook(HookConfig hookConfig)
ImGui.TextColored(ImGuiColors.DalamudYellow, UIStrings.DoubleTripleHookSettings);
ImGui.Spacing();

if (ImGui.Checkbox($"{UIStrings.OnlyUseWhenIdenticalCastIsActive}##surface_slap",
ref hookConfig.UseDHTHOnlySurfaceSlap))
if (ImGui.Checkbox($"{UIStrings.OnlyUseWhenIdenticalCastIsActive}##identical_cast", ref hookConfig.UseDHTHOnlyIdenticalCast))
{
Service.Save();
}

if (ImGui.Checkbox($"{UIStrings.OnlyUseWhenActiveSurfaceSlap}##surface_slap", ref hookConfig.UseDHTHOnlySurfaceSlap))
{
Service.Save();
}
Expand Down Expand Up @@ -393,9 +412,9 @@ public void DrawFishersIntuitionConfig(HookConfig cfg)

ImGui.Separator();

DrawSelectTugs(StrHookWeak, ref cfg.HookWeakIntuitionEnabled, ref cfg.HookTypeWeakIntuition);
DrawSelectTugs(StrHookStrong, ref cfg.HookStrongIntuitionEnabled, ref cfg.HookTypeStrongIntuition);
DrawSelectTugs(StrHookLegendary, ref cfg.HookLegendaryIntuitionEnabled, ref cfg.HookTypeLegendaryIntuition);
DrawSelectTugs(StrHookWeak, ref cfg.HookWeakIntuitionEnabled, ref cfg.HookTypeWeakIntuition, ref cfg.HookWeakOnlyWhenActiveSlap, ref cfg.HookWeakOnlyWhenNOTActiveSlap);
DrawSelectTugs(StrHookStrong, ref cfg.HookStrongIntuitionEnabled, ref cfg.HookTypeStrongIntuition, ref cfg.HookStrongOnlyWhenActiveSlap, ref cfg.HookStrongOnlyWhenNOTActiveSlap);
DrawSelectTugs(StrHookLegendary, ref cfg.HookLegendaryIntuitionEnabled, ref cfg.HookTypeLegendaryIntuition, ref cfg.HookLegendaryOnlyWhenActiveSlap, ref cfg.HookLegendaryOnlyWhenNOTActiveSlap);

ImGui.EndPopup();
}
Expand Down

0 comments on commit 0589ba2

Please sign in to comment.