1.9.0.0 (Testing) Release
This commit is contained in:
+66
-15
@@ -1,21 +1,22 @@
|
||||
using Craftimizer.Plugin.Utils;
|
||||
using Craftimizer.Plugin.Windows;
|
||||
using Craftimizer.Simulator;
|
||||
using Craftimizer.Simulator.Actions;
|
||||
using Craftimizer.Utils;
|
||||
using Craftimizer.Windows;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using ImGuiScene;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using ClassJob = Craftimizer.Simulator.ClassJob;
|
||||
|
||||
namespace Craftimizer.Plugin;
|
||||
|
||||
public sealed class Plugin : IDalamudPlugin
|
||||
{
|
||||
public string Name => "Craftimizer";
|
||||
public string Version { get; }
|
||||
public string Author { get; }
|
||||
public string BuildConfiguration { get; }
|
||||
@@ -23,23 +24,23 @@ public sealed class Plugin : IDalamudPlugin
|
||||
|
||||
public WindowSystem WindowSystem { get; }
|
||||
public Settings SettingsWindow { get; }
|
||||
public Craftimizer.Windows.RecipeNote RecipeNoteWindow { get; }
|
||||
public Craft SynthesisWindow { get; }
|
||||
public RecipeNote RecipeNoteWindow { get; }
|
||||
public MacroList ListWindow { get; private set; }
|
||||
public MacroEditor? EditorWindow { get; private set; }
|
||||
public MacroClipboard? ClipboardWindow { get; private set; }
|
||||
|
||||
public Configuration Configuration { get; }
|
||||
public Hooks Hooks { get; }
|
||||
public Craftimizer.Utils.RecipeNote RecipeNote { get; }
|
||||
public IconManager IconManager { get; }
|
||||
|
||||
public Plugin([RequiredVersion("1.0")] DalamudPluginInterface pluginInterface)
|
||||
{
|
||||
Service.Initialize(this, pluginInterface);
|
||||
|
||||
WindowSystem = new("Craftimizer");
|
||||
Configuration = pluginInterface.GetPluginConfig() as Configuration ?? new();
|
||||
Hooks = new();
|
||||
RecipeNote = new();
|
||||
IconManager = new();
|
||||
WindowSystem = new(Name);
|
||||
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
Version = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;
|
||||
@@ -49,16 +50,41 @@ public sealed class Plugin : IDalamudPlugin
|
||||
|
||||
SettingsWindow = new();
|
||||
RecipeNoteWindow = new();
|
||||
SynthesisWindow = new();
|
||||
ListWindow = new();
|
||||
|
||||
// Trigger static constructors so a huge hitch doesn't occur on first RecipeNote frame.
|
||||
FoodStatus.Initialize();
|
||||
Gearsets.Initialize();
|
||||
ActionUtils.Initialize();
|
||||
|
||||
Service.PluginInterface.UiBuilder.Draw += WindowSystem.Draw;
|
||||
Service.PluginInterface.UiBuilder.OpenConfigUi += OpenSettingsWindow;
|
||||
Service.PluginInterface.UiBuilder.OpenMainUi += OpenCraftingLog;
|
||||
|
||||
Service.CommandManager.AddHandler("/craftimizer", new CommandInfo((_, _) => OpenSettingsWindow())
|
||||
{
|
||||
HelpMessage = "Open the settings window.",
|
||||
});
|
||||
Service.CommandManager.AddHandler("/craftmacros", new CommandInfo((_, _) => OpenMacroListWindow())
|
||||
{
|
||||
HelpMessage = "Open the crafting macros window.",
|
||||
});
|
||||
Service.CommandManager.AddHandler("/crafteditor", new CommandInfo((_, _) => OpenSettingsWindow())
|
||||
{
|
||||
HelpMessage = "Open the crafting macro editor.",
|
||||
});
|
||||
}
|
||||
|
||||
public void OpenMacroEditor(CharacterStats characterStats, RecipeData recipeData, MacroEditor.CrafterBuffs buffs, IEnumerable<ActionType> actions, Action<IEnumerable<ActionType>>? setter)
|
||||
{
|
||||
EditorWindow?.Dispose();
|
||||
EditorWindow = new(characterStats, recipeData, buffs, actions, setter);
|
||||
}
|
||||
|
||||
public void OpenSettingsWindow()
|
||||
{
|
||||
SettingsWindow.IsOpen = true;
|
||||
SettingsWindow.BringToFront();
|
||||
if (SettingsWindow.IsOpen ^= true)
|
||||
SettingsWindow.BringToFront();
|
||||
}
|
||||
|
||||
public void OpenSettingsTab(string selectedTabLabel)
|
||||
@@ -67,11 +93,36 @@ public sealed class Plugin : IDalamudPlugin
|
||||
SettingsWindow.SelectTab(selectedTabLabel);
|
||||
}
|
||||
|
||||
public void OpenMacroListWindow()
|
||||
{
|
||||
ListWindow.IsOpen = true;
|
||||
ListWindow.BringToFront();
|
||||
}
|
||||
|
||||
public void OpenCraftingLog()
|
||||
{
|
||||
Chat.SendMessage("/craftinglog");
|
||||
}
|
||||
|
||||
public void OpenMacroClipboard(List<string> macros)
|
||||
{
|
||||
ClipboardWindow?.Dispose();
|
||||
ClipboardWindow = new(macros);
|
||||
}
|
||||
|
||||
public void CopyMacro(IReadOnlyList<ActionType> actions) =>
|
||||
MacroCopy.Copy(actions);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
SimulatorWindow?.Dispose();
|
||||
SynthesisWindow.Dispose();
|
||||
RecipeNote.Dispose();
|
||||
Service.CommandManager.RemoveHandler("/craftimizer");
|
||||
Service.CommandManager.RemoveHandler("/craftmacros");
|
||||
Service.CommandManager.RemoveHandler("/crafteditor");
|
||||
SettingsWindow.Dispose();
|
||||
RecipeNoteWindow.Dispose();
|
||||
ListWindow.Dispose();
|
||||
EditorWindow?.Dispose();
|
||||
ClipboardWindow?.Dispose();
|
||||
Hooks.Dispose();
|
||||
IconManager.Dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user