Skip to content

Commit

Permalink
AutoHook 3.0.2.0 [PUSH]
Browse files Browse the repository at this point in the history
Ty Jaksuhn for the new features
  • Loading branch information
InitialDet committed Feb 2, 2024
1 parent 8b3e10c commit ee7681d
Show file tree
Hide file tree
Showing 11 changed files with 556 additions and 249 deletions.
81 changes: 44 additions & 37 deletions AutoHook/AutoHook.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Globalization;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using AutoHook.Configurations;
using AutoHook.IPC;
using AutoHook.Resources.Localization;
Expand All @@ -12,7 +14,6 @@ namespace AutoHook;

public class AutoHook : IDalamudPlugin
{

/*
todo: autofood (not yet)
todo: Add Guides
Expand All @@ -24,7 +25,18 @@ public class AutoHook : IDalamudPlugin
private const string CmdAhOn = "/ahon";
private const string CmdAhOff = "/ahoff";
private const string CmdAhtg = "/ahtg";

private const string CmdAhPreset = "/ahpreset";

private static readonly Dictionary<string, string> CommandHelp = new()
{
{CmdAhOff, UIStrings.Disables_AutoHook},
{CmdAhOn, UIStrings.Enables_AutoHook},
{CmdAhCfg, UIStrings.Opens_Config_Window},
{CmdAh, UIStrings.Opens_Config_Window},
{CmdAhtg, UIStrings.Toggles_AutoHook_On_Off},
{CmdAhPreset, UIStrings.Set_preset_command}
};

private static PluginUi _pluginUi = null!;

private static AutoGig _autoGig = null!;
Expand All @@ -50,37 +62,15 @@ public AutoHook(DalamudPluginInterface pluginInterface)
UIStrings.Culture = new CultureInfo(Service.Configuration.CurrentLanguage);
_pluginUi = new PluginUi();
_autoGig = new AutoGig();

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

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

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

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

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

Service.Commands.AddHandler(CmdAhtg, new CommandInfo(OnCommand)
foreach (var (command, help) in CommandHelp)
{
HelpMessage = UIStrings.Toggles_AutoHook_On_Off
});

Service.Commands.AddHandler(command, new CommandInfo(OnCommand)
{
HelpMessage = help
});
}

_hookManager = new HookingManager();

#if (DEBUG)
Expand Down Expand Up @@ -112,7 +102,24 @@ private static void OnCommand(string command, string args)
Service.Chat.Print(UIStrings.AutoHook_Enabled);
Service.Configuration.PluginEnabled = true;
break;
case CmdAhPreset:
SetPreset(args);
break;
}
}

private static void SetPreset(string presetName)
{
var preset = Service.Configuration.HookPresets.CustomPresets.FirstOrDefault(x => x.PresetName == presetName);
if (preset == null)
{
Service.Chat.Print(UIStrings.Preset_not_found);
return;
}

Service.Configuration.HookPresets.SelectedPreset = preset;
Service.Chat.Print(@$"{UIStrings.Preset_set_to_} {preset.PresetName}");
Service.Save();
}

public void Dispose()
Expand All @@ -125,11 +132,11 @@ 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(CmdAhOn);
Service.Commands.RemoveHandler(CmdAhOff);
Service.Commands.RemoveHandler(CmdAhtg);

foreach (var (command, _) in CommandHelp)
{
Service.Commands.RemoveHandler(command);
}
}

private static void OnOpenConfigUi() => _pluginUi.Toggle();
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.1.0</Version>
<Version>3.0.2.0</Version>
<Description>Auto hooks for you</Description>
<PackageProjectUrl>https://github.com/InitialDet/AutoHook</PackageProjectUrl>
<Configurations>Release;Debug</Configurations>
Expand Down
14 changes: 13 additions & 1 deletion AutoHook/PluginUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ private void DrawChangelog()

if (changes[0].MinorChanges.Count > 0)
{
ImGui.TextWrapped("Bug Fixes");
ImGui.TextWrapped("Minor Changes");
foreach (var minorChange in changes[0].MinorChanges)
{
ImGui.TextWrapped($"- {minorChange}");
Expand Down Expand Up @@ -310,6 +310,18 @@ public static class PluginChangeLog
{
public static readonly List<Version> Versions = new()
{
new Version("3.0.2.0")
{
MainChanges =
{
"(by Jaksuhn) Added IPC",
"(by Jaksuhn) Added makeshift bait only under intuition option"
},
MinorChanges =
{
"Added a new command to change the current preset"
}
},
new Version("3.0.1.0")
{
MainChanges =
Expand Down
27 changes: 27 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.

42 changes: 42 additions & 0 deletions AutoHook/Resources/Localization/UIStrings.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -801,12 +801,21 @@ Check the Guide Tab for Guides.</value>
<data name="SubAuto_Disabled" xml:space="preserve">
<value>Auto cast is disabled</value>
</data>
<data name="SubExtra_Disabled" xml:space="preserve">
<value>Extra options disabled</value>
</data>
<data name="Default_AutoCast_Being_Used" xml:space="preserve">
<value>[Default] auto cast is being used instead</value>
</data>
<data name="Custom_AutoCast_Being_Used" xml:space="preserve">
<value>Custom preset [{0}] Auto cast is being used instead</value>
</data>
<data name="Default_Extra_Being_Used" xml:space="preserve">
<value>[Default] Extra config is being used instead</value>
</data>
<data name="Custom_Extra_Being_Used" xml:space="preserve">
<value>Custom preset [{0}] Extra config is being used instead</value>
</data>
<data name="Auto_Cast_Alert_Manual_Hook" xml:space="preserve">
<value>Important! Auto Casts wont be used if you hook manually.</value>
</data>
Expand All @@ -823,4 +832,37 @@ Check the Guide Tab for Guides.</value>
<value>Search...</value>
<comment>Hint Text for search bar</comment>
</data>
<data name="Extra" xml:space="preserve">
<value>Extra</value>
</data>
<data name="NeverReleaseHelptext" xml:space="preserve">
<value>This fish won't be released if 'Release All Fish' is enabled in the Auto Cast tab</value>
</data>
<data name="NeverRelease" xml:space="preserve">
<value>Never Release</value>
</data>
<data name="ReleaseAllFish" xml:space="preserve">
<value>Release All Fish</value>
</data>
<data name="ReleaseAllFishHelpText" xml:space="preserve">
<value>If you dont want to release a specific fish, add it to a preset and select "Never Release"</value>
</data>
<data name="Enable_Extra_Configs" xml:space="preserve">
<value>Enable Extra Configs</value>
</data>
<data name="When_gaining_fishers_intuition" xml:space="preserve">
<value>When gaining fisher's intuition...</value>
</data>
<data name="When_losing_fishers_intuition" xml:space="preserve">
<value>When losing fisher's intuition...</value>
</data>
<data name="Draw_Configs" xml:space="preserve">
<value>Configs</value>
</data>
<data name="Draw_Guides" xml:space="preserve">
<value>Guides</value>
</data>
<data name="Delay_when_hooking" xml:space="preserve">
<value>Delay when hooking</value>
</data>
</root>
Loading

0 comments on commit ee7681d

Please sign in to comment.