Skip to content

Commit ee7681d

Browse files
committed
AutoHook 3.0.2.0 [PUSH]
Ty Jaksuhn for the new features
1 parent 8b3e10c commit ee7681d

11 files changed

Lines changed: 556 additions & 249 deletions

AutoHook/AutoHook.cs

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Globalization;
1+
using System.Collections.Generic;
2+
using System.Globalization;
3+
using System.Linq;
24
using AutoHook.Configurations;
35
using AutoHook.IPC;
46
using AutoHook.Resources.Localization;
@@ -12,7 +14,6 @@ namespace AutoHook;
1214

1315
public class AutoHook : IDalamudPlugin
1416
{
15-
1617
/*
1718
todo: autofood (not yet)
1819
todo: Add Guides
@@ -24,7 +25,18 @@ public class AutoHook : IDalamudPlugin
2425
private const string CmdAhOn = "/ahon";
2526
private const string CmdAhOff = "/ahoff";
2627
private const string CmdAhtg = "/ahtg";
27-
28+
private const string CmdAhPreset = "/ahpreset";
29+
30+
private static readonly Dictionary<string, string> CommandHelp = new()
31+
{
32+
{CmdAhOff, UIStrings.Disables_AutoHook},
33+
{CmdAhOn, UIStrings.Enables_AutoHook},
34+
{CmdAhCfg, UIStrings.Opens_Config_Window},
35+
{CmdAh, UIStrings.Opens_Config_Window},
36+
{CmdAhtg, UIStrings.Toggles_AutoHook_On_Off},
37+
{CmdAhPreset, UIStrings.Set_preset_command}
38+
};
39+
2840
private static PluginUi _pluginUi = null!;
2941

3042
private static AutoGig _autoGig = null!;
@@ -50,37 +62,15 @@ public AutoHook(DalamudPluginInterface pluginInterface)
5062
UIStrings.Culture = new CultureInfo(Service.Configuration.CurrentLanguage);
5163
_pluginUi = new PluginUi();
5264
_autoGig = new AutoGig();
53-
54-
Service.Commands.AddHandler(CmdAhOff, new CommandInfo(OnCommand)
55-
{
56-
HelpMessage = UIStrings.Disables_AutoHook
57-
});
58-
59-
Service.Commands.AddHandler(CmdAhOn, new CommandInfo(OnCommand)
60-
{
61-
HelpMessage = UIStrings.Enables_AutoHook
62-
});
63-
64-
Service.Commands.AddHandler(CmdAhCfg, new CommandInfo(OnCommand)
65-
{
66-
HelpMessage = UIStrings.Opens_Config_Window
67-
});
6865

69-
Service.Commands.AddHandler(CmdAh, new CommandInfo(OnCommand)
70-
{
71-
HelpMessage = UIStrings.Opens_Config_Window
72-
});
73-
74-
/*Service.Commands.AddHandler(CmdAh, new CommandInfo(OnCommand)
75-
{
76-
HelpMessage = UIStrings.Opens_Config_Window
77-
});*/
78-
79-
Service.Commands.AddHandler(CmdAhtg, new CommandInfo(OnCommand)
66+
foreach (var (command, help) in CommandHelp)
8067
{
81-
HelpMessage = UIStrings.Toggles_AutoHook_On_Off
82-
});
83-
68+
Service.Commands.AddHandler(command, new CommandInfo(OnCommand)
69+
{
70+
HelpMessage = help
71+
});
72+
}
73+
8474
_hookManager = new HookingManager();
8575

8676
#if (DEBUG)
@@ -112,7 +102,24 @@ private static void OnCommand(string command, string args)
112102
Service.Chat.Print(UIStrings.AutoHook_Enabled);
113103
Service.Configuration.PluginEnabled = true;
114104
break;
105+
case CmdAhPreset:
106+
SetPreset(args);
107+
break;
108+
}
109+
}
110+
111+
private static void SetPreset(string presetName)
112+
{
113+
var preset = Service.Configuration.HookPresets.CustomPresets.FirstOrDefault(x => x.PresetName == presetName);
114+
if (preset == null)
115+
{
116+
Service.Chat.Print(UIStrings.Preset_not_found);
117+
return;
115118
}
119+
120+
Service.Configuration.HookPresets.SelectedPreset = preset;
121+
Service.Chat.Print(@$"{UIStrings.Preset_set_to_} {preset.PresetName}");
122+
Service.Save();
116123
}
117124

118125
public void Dispose()
@@ -125,11 +132,11 @@ public void Dispose()
125132
Service.Save();
126133
Service.PluginInterface.UiBuilder.Draw -= Service.WindowSystem.Draw;
127134
Service.PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
128-
Service.Commands.RemoveHandler(CmdAh);
129-
Service.Commands.RemoveHandler(CmdAhCfg);
130-
Service.Commands.RemoveHandler(CmdAhOn);
131-
Service.Commands.RemoveHandler(CmdAhOff);
132-
Service.Commands.RemoveHandler(CmdAhtg);
135+
136+
foreach (var (command, _) in CommandHelp)
137+
{
138+
Service.Commands.RemoveHandler(command);
139+
}
133140
}
134141

135142
private static void OnOpenConfigUi() => _pluginUi.Toggle();

AutoHook/AutoHook.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<Authors>Det</Authors>
5-
<Version>3.0.1.0</Version>
5+
<Version>3.0.2.0</Version>
66
<Description>Auto hooks for you</Description>
77
<PackageProjectUrl>https://github.com/InitialDet/AutoHook</PackageProjectUrl>
88
<Configurations>Release;Debug</Configurations>

AutoHook/PluginUI.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ private void DrawChangelog()
266266

267267
if (changes[0].MinorChanges.Count > 0)
268268
{
269-
ImGui.TextWrapped("Bug Fixes");
269+
ImGui.TextWrapped("Minor Changes");
270270
foreach (var minorChange in changes[0].MinorChanges)
271271
{
272272
ImGui.TextWrapped($"- {minorChange}");
@@ -310,6 +310,18 @@ public static class PluginChangeLog
310310
{
311311
public static readonly List<Version> Versions = new()
312312
{
313+
new Version("3.0.2.0")
314+
{
315+
MainChanges =
316+
{
317+
"(by Jaksuhn) Added IPC",
318+
"(by Jaksuhn) Added makeshift bait only under intuition option"
319+
},
320+
MinorChanges =
321+
{
322+
"Added a new command to change the current preset"
323+
}
324+
},
313325
new Version("3.0.1.0")
314326
{
315327
MainChanges =

AutoHook/Resources/Localization/UIStrings.Designer.cs

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AutoHook/Resources/Localization/UIStrings.de.resx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,12 +801,21 @@ Check the Guide Tab for Guides.</value>
801801
<data name="SubAuto_Disabled" xml:space="preserve">
802802
<value>Auto cast is disabled</value>
803803
</data>
804+
<data name="SubExtra_Disabled" xml:space="preserve">
805+
<value>Extra options disabled</value>
806+
</data>
804807
<data name="Default_AutoCast_Being_Used" xml:space="preserve">
805808
<value>[Default] auto cast is being used instead</value>
806809
</data>
807810
<data name="Custom_AutoCast_Being_Used" xml:space="preserve">
808811
<value>Custom preset [{0}] Auto cast is being used instead</value>
809812
</data>
813+
<data name="Default_Extra_Being_Used" xml:space="preserve">
814+
<value>[Default] Extra config is being used instead</value>
815+
</data>
816+
<data name="Custom_Extra_Being_Used" xml:space="preserve">
817+
<value>Custom preset [{0}] Extra config is being used instead</value>
818+
</data>
810819
<data name="Auto_Cast_Alert_Manual_Hook" xml:space="preserve">
811820
<value>Important! Auto Casts wont be used if you hook manually.</value>
812821
</data>
@@ -823,4 +832,37 @@ Check the Guide Tab for Guides.</value>
823832
<value>Search...</value>
824833
<comment>Hint Text for search bar</comment>
825834
</data>
835+
<data name="Extra" xml:space="preserve">
836+
<value>Extra</value>
837+
</data>
838+
<data name="NeverReleaseHelptext" xml:space="preserve">
839+
<value>This fish won't be released if 'Release All Fish' is enabled in the Auto Cast tab</value>
840+
</data>
841+
<data name="NeverRelease" xml:space="preserve">
842+
<value>Never Release</value>
843+
</data>
844+
<data name="ReleaseAllFish" xml:space="preserve">
845+
<value>Release All Fish</value>
846+
</data>
847+
<data name="ReleaseAllFishHelpText" xml:space="preserve">
848+
<value>If you dont want to release a specific fish, add it to a preset and select "Never Release"</value>
849+
</data>
850+
<data name="Enable_Extra_Configs" xml:space="preserve">
851+
<value>Enable Extra Configs</value>
852+
</data>
853+
<data name="When_gaining_fishers_intuition" xml:space="preserve">
854+
<value>When gaining fisher's intuition...</value>
855+
</data>
856+
<data name="When_losing_fishers_intuition" xml:space="preserve">
857+
<value>When losing fisher's intuition...</value>
858+
</data>
859+
<data name="Draw_Configs" xml:space="preserve">
860+
<value>Configs</value>
861+
</data>
862+
<data name="Draw_Guides" xml:space="preserve">
863+
<value>Guides</value>
864+
</data>
865+
<data name="Delay_when_hooking" xml:space="preserve">
866+
<value>Delay when hooking</value>
867+
</data>
826868
</root>

0 commit comments

Comments
 (0)