Skip to content

Commit

Permalink
AutoHook 2.4.1.0 [PUSH]
Browse files Browse the repository at this point in the history
#60 added
  • Loading branch information
InitialDet committed Jan 16, 2023
1 parent 4806485 commit c9e5975
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 21 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.4.0.1</Version>
<Version>2.4.1.0</Version>
<Description>Auto hooks for you</Description>
<PackageProjectUrl>https://github.com/InitialDet/AutoHook</PackageProjectUrl>
<Configurations>Release;Debug</Configurations>
Expand Down
2 changes: 1 addition & 1 deletion AutoHook/AutoHook.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"DalamudApiLevel": 8,
"AcceptsFeedback": false,
"IconUrl": "https://raw.githubusercontent.com/InitialDet/AutoHook/main/AutoHook/images/icon.png",
"Changelog": "- Presets for custom baits added, you can now swap configs without needing to recreate it every time\n- Added an option to only cast Chum when under the effect of Fisher's Intuition\n- Added an option to only cast Prize Catch when Mooch II is not available, saving you 100gp if all you want is to mooch\n- Added Custom Timer when under the effect of Chum\n- Added an option to only use Prize Catch when under the effect of Identical Cast\n- Upgrade to .net7 and API8"
"Changelog": "- Presets for custom baits added, you can now swap configs without needing to recreate it every time\n- Added options to cast Chum or Mooch only when under the effect of Fisher's Intuition\n- Added an option to only cast Prize Catch when Mooch II is not available, saving you 100gp if all you want is to mooch\n- Added Custom Timer when under the effect of Chum\n- Added an option to only use Prize Catch when under the effect of Identical Cast\n- Upgrade to .net7 and API8"
}
12 changes: 11 additions & 1 deletion AutoHook/Configurations/AutoCastsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ public class AutoCastsConfig
{
public bool EnableAll = false;
public bool EnableAutoCast = false;
public bool EnableMooch = false;

public bool EnableMooch = false;
public bool EnableMooch2 = false;
public bool OnlyMoochIntuition = false;

public bool EnablePatience = false;
public static bool EnableMakeshiftPatience = false;
Expand Down Expand Up @@ -119,20 +120,29 @@ private bool UseMooch(out uint id)

bool useAutoMooch = false;
bool useAutoMooch2 = false;
bool onlyMoochIntuition = false;

//
if (BaitConfig == null || BaitConfig?.BaitName == "DefaultCast" || BaitConfig?.BaitName == "DefaultMooch")
{
useAutoMooch = EnableMooch;
useAutoMooch2 = EnableMooch2;
onlyMoochIntuition = OnlyMoochIntuition;

}
else
{
useAutoMooch = BaitConfig?.UseAutoMooch ?? false;
useAutoMooch2 = BaitConfig?.UseAutoMooch2 ?? false;
onlyMoochIntuition = BaitConfig?.OnlyMoochIntuition ?? false;
}

if (useAutoMooch)
{

if (onlyMoochIntuition && !PlayerResources.HasStatus(IDs.Status.IdenticalCast))
return false;

if (PlayerResources.ActionAvailable(IDs.Actions.Mooch))
{
id = IDs.Actions.Mooch;
Expand Down
3 changes: 2 additions & 1 deletion AutoHook/Configurations/BaitConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public class BaitConfig

public bool UseAutoMooch = true;
public bool UseAutoMooch2 = false;

public bool OnlyMoochIntuition = false;

public bool UseSurfaceSlap = false;
public bool UseIdenticalCast = false;

Expand Down
33 changes: 23 additions & 10 deletions AutoHook/Ui/TabAutoCasts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ public override void DrawHeader()
// Disable all casts
ImGui.Spacing();
if (DrawUtil.Checkbox("Enable Auto Casts", ref cfg.EnableAll))
{ }
{
Service.Configuration.Save();
}

if (cfg.EnableAll)
{
ImGui.SameLine();
if (DrawUtil.Checkbox("Don't Cancel Mooch", ref AutoCastsConfig.DontCancelMooch, "Actions that cancel mooch wont be used (e.g. Chum, Fish Eyes, Prize Catch etc.)"))
{ }
{
Service.Configuration.Save();
}
}

ImGui.Spacing();
Expand Down Expand Up @@ -59,7 +63,9 @@ public override void Draw()
private void DrawAutoCast()
{
if (DrawUtil.Checkbox("Global Auto Cast Line", ref cfg.EnableAutoCast, "Cast (FSH Action) will be used after a fish bite\n\nIMPORTANT!!!\nIf you have this option enabled and you don't have a Custom Auto Mooch or the Global Auto Mooch option enabled, the line will be casted normally and you'll lose your mooch oportunity (If available)."))
{ }
{
Service.Configuration.Save();
}

if (cfg.EnableAutoCast)
{
Expand All @@ -76,8 +82,10 @@ private void DrawExtraOptionsAutoCast()

private void DrawAutoMooch()
{
if (DrawUtil.Checkbox("Global Auto Mooch", ref cfg.EnableMooch, "All fish will be mooched if available. This option have priority over Auto Cast Line\n\nIf you want to Auto Mooch only a especific fish and ignore others, disable this option and add Custom Preset."))
{ }
if (DrawUtil.Checkbox("Global Auto Mooch", ref cfg.EnableMooch, "This option have priority over Auto Cast Line\n\nIf you want to Auto Mooch only a especific fish and ignore others, disable this option and add Custom Preset."))
{
Service.Configuration.Save();
}

if (cfg.EnableMooch)
{
Expand All @@ -89,7 +97,15 @@ private void DrawAutoMooch()

private void DrawExtraOptionsAutoMooch()
{
ImGui.Checkbox("Use Mooch II", ref cfg.EnableMooch2);
if (ImGui.Checkbox("Use Mooch II", ref cfg.EnableMooch2))
{
Service.Configuration.Save();
}

if (ImGui.Checkbox("Only use when Fisher's Intution is active", ref cfg.OnlyMoochIntuition))
{
Service.Configuration.Save();
}
}

private void DrawPatience()
Expand Down Expand Up @@ -202,9 +218,7 @@ private void DrawExtraOptionsMakeShiftBait()
else
cfg.AutoMakeShiftBait.MakeshiftBaitStacks = stack;


Service.Configuration.Save();

}
}

Expand All @@ -215,15 +229,14 @@ private void DrawPrizeCatch()
{
cfg.AutoPrizeCatch.Enabled = enabled;
Service.Configuration.Save();

}

if (enabled)
{
ImGui.Indent();
DrawExtraOptionPrizeCatch();
ImGui.Unindent();
}
}
}

private void DrawExtraOptionPrizeCatch()
Expand Down
15 changes: 12 additions & 3 deletions AutoHook/Ui/TabBaseConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ public void DrawAutoMooch(BaitConfig cfg)
{
ImGui.TextColored(ImGuiColors.DalamudYellow, "Auto Mooch");
ImGui.Spacing();
ImGui.Text("- If this is a Bait, all fish caught by this bait will be mooched");
ImGui.Text("- If this is a Bait (Ex: Versatile Lure), all fish caught by this bait will be mooched");
ImGui.Text("- If this is a Fish/Mooch (Ex: Harbor Herring), it'll be mooched when caught");
ImGui.Text("If this option is disabled, it will NOT be mooched even if Auto Mooch is also enabled in the general tab");
ImGui.Text("If this option is disabled, the fish will NOT be mooched even if Auto Mooch is also enabled in the general tab");
if (Utils.DrawUtil.Checkbox("Auto Mooch", ref cfg.UseAutoMooch, "This option takes priority over the Auto Cast Line"))
{
if (!cfg.UseAutoMooch)
Expand All @@ -288,7 +288,16 @@ public void DrawAutoMooch(BaitConfig cfg)
if (cfg.UseAutoMooch)
{
ImGui.Indent();
ImGui.Checkbox("Use Mooch II", ref cfg.UseAutoMooch2);

if (ImGui.Checkbox("Use Mooch II", ref cfg.UseAutoMooch2))
{
Service.Configuration.Save();
}

if (ImGui.Checkbox("Only use when Fisher's Intution is active", ref cfg.OnlyMoochIntuition))
{
Service.Configuration.Save();
}
ImGui.Unindent();
}
ImGui.EndPopup();
Expand Down
11 changes: 7 additions & 4 deletions AutoHook/Ui/TabPresets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public override void DrawHeader()
{
cfg.BaitPresetList.Remove(cfg.CurrentPreset);
cfg.CurrentPreset = null;

}

cfg.Save();
Expand Down Expand Up @@ -130,6 +129,13 @@ public override void DrawHeader()
ImGui.SameLine();
ImGuiComponents.HelpMarker("Make sure to edit the bait/fish name correctly like ingame (Ex: Versatile Lure)");

// I hate ImGui and i dont care to make this look good
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
ImGui.TextWrapped("Auto Mooch");
ImGui.PopStyleColor();
ImGui.SameLine();
ImGui.TextWrapped("is enabled by default when new bait/fish is added ");

if (ImGui.Button("Add Current Bait/Fish"))
{
var setting = new BaitConfig(HookingManager.CurrentBait ?? "-");
Expand Down Expand Up @@ -224,7 +230,6 @@ private void DrawImportExport()

if (ImGui.Button("Import"))
{

if (Service.Configuration.BaitPresetList.Contains(new(name)))
{
_alertMessage = "A preset with the same name already exists";
Expand Down Expand Up @@ -258,7 +263,6 @@ private void DrawImportExport()
ImGui.SetTooltip("Import stack from clipboard.");

TimedWarning();

}

private static readonly double _timelimit = 5000;
Expand All @@ -276,7 +280,6 @@ private void TimedWarning()
}
}
}

public override void Draw()
{
if (_hasPreset)
Expand Down

0 comments on commit c9e5975

Please sign in to comment.