Skip to content

Commit

Permalink
AutoHook 3.0.1.0 [PUSH]
Browse files Browse the repository at this point in the history
Fixes and changes
#140, #138, #137, #136, #132, #127, #121
  • Loading branch information
InitialDet committed Dec 6, 2023
1 parent e8e9e55 commit cdb94c3
Show file tree
Hide file tree
Showing 37 changed files with 1,780 additions and 298 deletions.
9 changes: 7 additions & 2 deletions AutoHook/AutoHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class AutoHook : IDalamudPlugin
public string Name => UIStrings.AutoHook;

private const string CmdAhCfg = "/ahcfg";
private const string CmdAh = "/ah";
private const string CmdAh = "/autohook";
private const string CmdAhOn = "/ahon";
private const string CmdAhOff = "/ahoff";
private const string CmdAhtg = "/ahtg";
Expand Down Expand Up @@ -63,6 +63,11 @@ public AutoHook(DalamudPluginInterface pluginInterface)
{
HelpMessage = UIStrings.Opens_Config_Window
});

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

/*Service.Commands.AddHandler(CmdAh, new CommandInfo(OnCommand)
{
Expand Down Expand Up @@ -117,8 +122,8 @@ public void Dispose()
Service.Save();
Service.PluginInterface.UiBuilder.Draw -= Service.WindowSystem.Draw;
Service.PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
Service.Commands.RemoveHandler(CmdAh);
Service.Commands.RemoveHandler(CmdAhCfg);
//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 @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Det</Authors>
<Version>3.0.0.7</Version>
<Version>3.0.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/Classes/AutoCasts/AutoCastLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class AutoCastLine : BaseActionCast
{
public AutoCastLine() : base(UIStrings.AutoCastLine_Auto_Cast_Line, Data.IDs.Actions.Cast)
{
GpThreshold = 1;

}

public override bool CastCondition()
Expand Down
6 changes: 3 additions & 3 deletions AutoHook/Classes/AutoCasts/AutoCordial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class AutoCordial : BaseActionCast

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

}

public override string GetName()
Expand Down Expand Up @@ -65,8 +65,8 @@ public override bool CastCondition()

public override void SetThreshold(int newCost)
{
if (newCost <= 1)
GpThreshold = 1;
if (newCost <= 0)
GpThreshold = 0;
else
GpThreshold = newCost;
}
Expand Down
4 changes: 2 additions & 2 deletions AutoHook/Classes/AutoCasts/AutoMooch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override string GetName()

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

if (Mooch2.IsAvailableToCast())
Expand All @@ -38,7 +38,7 @@ public override bool CastCondition()
return true;
}

return true;
return false;
}

protected override DrawOptionsDelegate DrawOptions => () =>
Expand Down
2 changes: 1 addition & 1 deletion AutoHook/Classes/AutoCasts/AutoPrizeCatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override bool CastCondition()
if (!Enabled)
return false;

if (UseWhenMoochIIOnCD && PlayerResources.ActionTypeAvailable(IDs.Actions.Mooch2))
if (UseWhenMoochIIOnCD && !PlayerResources.ActionOnCoolDown(IDs.Actions.Mooch2))
return false;

if (UseOnlyWithIdenticalCast && !PlayerResources.HasStatus(IDs.Status.IdenticalCast))
Expand Down
20 changes: 20 additions & 0 deletions AutoHook/Classes/AutoCasts/AutoReleaseFish.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using AutoHook.Resources.Localization;

namespace AutoHook.Classes.AutoCasts;

public class AutoReleaseFish : BaseActionCast
{
public AutoReleaseFish() : base(UIStrings.ReleaseAllFish, Data.IDs.Actions.Release)
{
HelpText = UIStrings.ReleaseAllFishHelpText;
DoesCancelMooch = false;
}

public override bool CastCondition()
{
return true;
}

public override string GetName()
=> Name = UIStrings.ReleaseAllFish;
}
8 changes: 4 additions & 4 deletions AutoHook/Classes/BaseActionCast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ protected BaseActionCast(string name, uint id, ActionType actionType = ActionTyp

public uint Id { get; set; }

public int GpThreshold = 1;
public int GpThreshold = 0;

public bool GpThresholdAbove { get; set; } = true;

public bool DoesCancelMooch { get; init; }
public bool DoesCancelMooch { get; set; }

public bool DontCancelMooch = true;

Expand All @@ -45,7 +45,7 @@ public virtual void SetThreshold(int newCost)
{
var actionCost = (int) PlayerResources.CastActionCost(Id, ActionType);

GpThreshold = (newCost < 1) ? 1 : Math.Max(newCost, actionCost);
GpThreshold = (newCost < 0) ? 0 : Math.Max(newCost, actionCost);

Service.Save();
}
Expand Down Expand Up @@ -159,7 +159,7 @@ public virtual void DrawGpThreshold()
ImGui.SetNextItemWidth(100 * ImGuiHelpers.GlobalScale);
if (ImGui.InputInt(UIStrings.GP, ref GpThreshold, 1, 1))
{
GpThreshold = Math.Max(GpThreshold, 1);
GpThreshold = Math.Max(GpThreshold, 0);
SetThreshold(GpThreshold);
Service.Save();
}
Expand Down
6 changes: 4 additions & 2 deletions AutoHook/Configurations/AutoCastsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ public class AutoCastsConfig
//public AutoSurfaceSlap CastSurfaceSlap = new();
public AutoThaliaksFavor CastThaliaksFavor = new();

//public AutoReleaseFish CastReleaseFish = new();

public List<BaseActionCast> GetAutoActions()
{
{
return new List<BaseActionCast>
{
CastThaliaksFavor,
CastMakeShiftBait,
CastCordial,
CastPatience,
CastMakeShiftBait,
CastChum,
CastFishEyes,
CastPrizeCatch,
Expand Down
4 changes: 3 additions & 1 deletion AutoHook/Configurations/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public class Configuration : IPluginConfiguration
public bool ShowChatLogs = true;

public int DelayBetweenCastsMin = 600;

public int DelayBetweenCastsMax = 1000;

public int DelayBetweenHookMin = 0;
public int DelayBetweenHookMax = 0;

public bool ShowStatusHeader = true;

Expand Down
20 changes: 20 additions & 0 deletions AutoHook/Configurations/ExtraConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using AutoHook.Classes;

namespace AutoHook.Configurations;

public class ExtraConfig
{
public bool Enabled = false;

public bool SwapBaitIntuitionGain = false;
public BaitFishClass BaitToSwapIntuitionGain = new();

public bool SwapBaitIntuitionLost = false;
public BaitFishClass BaitToSwapIntuitionLost = new();

public bool SwapPresetIntuitionGain = false;
public string PresetToSwapIntuitionGain = "-";

public bool SwapPresetIntuitionLost = false;
public string PresetToSwapIntuitionLost = "-";
}
18 changes: 16 additions & 2 deletions AutoHook/Configurations/FishConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AutoHook.Classes;
using System;
using AutoHook.Classes;
using AutoHook.Classes.AutoCasts;
using AutoHook.Enums;
using AutoHook.Resources.Localization;
Expand All @@ -7,6 +8,7 @@ namespace AutoHook.Configurations;

public class FishConfig
{
private Guid _uniqueId;
public bool Enabled = true;

public BaitFishClass Fish;
Expand All @@ -28,12 +30,24 @@ public class FishConfig

public bool NeverMooch = false;

public CatchSteps StopFishingStep = CatchSteps.None;
public bool NeverRelease = false;

public FishingSteps StopFishingStep = FishingSteps.None;

public FishConfig(BaitFishClass fish)
{
Fish = fish;
// ok this is not the best way, but im tired and it works for now so be nice to me
Mooch.Name = UIStrings.Always_Mooch;

_uniqueId = Guid.NewGuid();
}

public Guid GetUniqueId()
{
if (_uniqueId == Guid.Empty)
_uniqueId = Guid.NewGuid();

return _uniqueId;
}
}
22 changes: 16 additions & 6 deletions AutoHook/Configurations/HookConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Xml;
using AutoHook.Classes;
using AutoHook.Data;
using AutoHook.Enums;
Expand All @@ -10,8 +11,8 @@ public class HookConfig
{
public bool Enabled = true;

//public string BaitName = UIStrings.BaitName_Default;

private Guid _uniqueId;
public BaitFishClass BaitFish = new();

public bool HookWeakEnabled = true;
Expand Down Expand Up @@ -57,7 +58,7 @@ public class HookConfig
public bool StopAfterCaught = false;
public int StopAfterCaughtLimit = 1;

public CatchSteps StopFishingStep = CatchSteps.None;
public FishingSteps StopFishingStep = FishingSteps.None;

/*public HookConfig(string bait)
{
Expand All @@ -67,6 +68,7 @@ public class HookConfig
public HookConfig(BaitFishClass baitFish)
{
BaitFish = baitFish;
_uniqueId = Guid.NewGuid();
}

public HookType? GetHook(BiteType bite)
Expand Down Expand Up @@ -121,8 +123,7 @@ public bool CheckHookDHTHEnabled(BiteType bite) =>
bite == BiteType.Weak ? HookWeakDHTHEnabled :
bite == BiteType.Strong ? HookStrongDHTHEnabled :
bite == BiteType.Legendary ? HookLegendaryDHTHEnabled : false;



private HookType GetPatienceHook(BiteType bite) => bite switch
{
BiteType.Weak => HookTypeWeak,
Expand Down Expand Up @@ -161,7 +162,16 @@ public bool CheckHookDHTHEnabled(BiteType bite) =>

return HookType.None;
}



public Guid GetUniqueId()
{
if (_uniqueId == Guid.Empty)
_uniqueId = Guid.NewGuid();

return _uniqueId;
}

public override bool Equals(object? obj)
{
return obj is HookConfig settings &&
Expand Down
2 changes: 2 additions & 0 deletions AutoHook/Configurations/PresetConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class PresetConfig
public List<FishConfig> ListOfFish { get; set; } = new();

public AutoCastsConfig AutoCastsCfg = new();

public ExtraConfig ExtraCfg = new();

public PresetConfig(string presetName)
{
Expand Down
1 change: 1 addition & 0 deletions AutoHook/Data/IDs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public static class Actions
public const uint
Cast = 289,
Quit = 299,
Release = 300,
Gig = 7632,
NaturesBounty = 7909,
Mooch = 297,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;

namespace AutoHook.Enums;

public enum CatchSteps
[Flags]
public enum FishingSteps
{
None,
BeganFishing,
Expand All @@ -13,4 +16,4 @@ public enum CatchSteps
FishReeled,
TimeOut,
Quitting
}
}
9 changes: 9 additions & 0 deletions AutoHook/Enums/IntuitionStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace AutoHook.Enums;

public enum IntuitionStatus
{
NotActive,
Gained,
Active,
Lost,
}
Loading

0 comments on commit cdb94c3

Please sign in to comment.