2023-01-24 21:50:56 +00:00
|
|
|
using Dalamud.Data;
|
|
|
|
using Dalamud.Game;
|
|
|
|
using Dalamud.Game.ClientState;
|
|
|
|
using Dalamud.Game.ClientState.Objects;
|
2023-01-24 21:50:56 +00:00
|
|
|
using Dalamud.Game.Command;
|
2023-01-24 21:50:56 +00:00
|
|
|
using Dalamud.Game.Network;
|
|
|
|
using Dalamud.Interface.Windowing;
|
2023-01-24 21:50:56 +00:00
|
|
|
using Dalamud.IoC;
|
|
|
|
using Dalamud.Plugin;
|
|
|
|
using System.IO;
|
2023-01-24 21:50:56 +00:00
|
|
|
|
|
|
|
namespace FFXIV_Vibe_Plugin {
|
|
|
|
public sealed class Plugin : IDalamudPlugin {
|
|
|
|
// Dalamud plugin definition
|
|
|
|
public string Name => "FFXIV Vibe Plugin";
|
|
|
|
public static readonly string ShortName = "FVP";
|
|
|
|
public readonly string CommandName = "/fvp";
|
|
|
|
|
|
|
|
// Dalamud plugins
|
|
|
|
private Dalamud.Game.Gui.ChatGui? DalamudChat { get; init; }
|
|
|
|
private DalamudPluginInterface PluginInterface { get; init; }
|
|
|
|
private CommandManager CommandManager { get; init; }
|
|
|
|
public Configuration Configuration { get; init; }
|
|
|
|
|
|
|
|
public WindowSystem WindowSystem = new("FFXIV_Vibe_Plugin");
|
|
|
|
|
|
|
|
// FFXIV_Vibe_Plugin definition
|
|
|
|
// TODO: private PluginUI PluginUi { get; init; }
|
|
|
|
private FFXIV_Vibe_Plugin.App app;
|
|
|
|
|
|
|
|
public Plugin(
|
|
|
|
[RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
|
|
|
|
[RequiredVersion("1.0")] CommandManager commandManager,
|
|
|
|
[RequiredVersion("1.0")] ClientState clientState,
|
|
|
|
[RequiredVersion("1.0")] GameNetwork gameNetwork,
|
|
|
|
[RequiredVersion("1.0")] SigScanner scanner,
|
|
|
|
[RequiredVersion("1.0")] ObjectTable gameObjects,
|
2023-01-30 20:04:22 +00:00
|
|
|
[RequiredVersion("1.0")] DataManager dataManager,
|
|
|
|
[RequiredVersion("1.0")] Dalamud.Game.Gui.ChatGui? dalamudChat
|
2023-01-24 21:50:56 +00:00
|
|
|
) {
|
|
|
|
this.PluginInterface = pluginInterface;
|
|
|
|
this.CommandManager = commandManager;
|
|
|
|
|
|
|
|
this.Configuration = this.PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
|
2023-01-30 20:04:22 +00:00
|
|
|
this.Configuration.Initialize(this.PluginInterface);
|
2023-01-24 21:50:56 +00:00
|
|
|
|
|
|
|
this.CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand) {
|
|
|
|
HelpMessage = "A vibe plugin for fun..."
|
|
|
|
});
|
|
|
|
|
|
|
|
this.PluginInterface.UiBuilder.Draw += DrawUI;
|
|
|
|
this.PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI;
|
|
|
|
|
|
|
|
// Init our own app
|
2023-01-30 20:04:22 +00:00
|
|
|
this.app = new FFXIV_Vibe_Plugin.App(this, CommandName, ShortName, gameNetwork, clientState, dataManager, dalamudChat, Configuration, scanner, gameObjects, pluginInterface);
|
|
|
|
|
|
|
|
// Setting the windows
|
2023-01-24 21:50:56 +00:00
|
|
|
WindowSystem.AddWindow(this.app.PluginUi);
|
2023-01-24 21:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose() {
|
|
|
|
this.WindowSystem.RemoveAllWindows();
|
|
|
|
this.CommandManager.RemoveHandler(CommandName);
|
|
|
|
this.app.Dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnCommand(string command, string args) {
|
|
|
|
this.app.OnCommand(command, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void DrawUI() {
|
2023-01-24 21:50:56 +00:00
|
|
|
this.WindowSystem.Draw();
|
2023-01-24 21:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void DrawConfigUI() {
|
2023-01-24 21:50:56 +00:00
|
|
|
WindowSystem.GetWindow("FFXIV_Vibe_Plugin_UI").IsOpen = true;
|
2023-01-24 21:50:56 +00:00
|
|
|
}
|
2023-01-24 21:50:56 +00:00
|
|
|
}
|
2023-01-24 21:50:56 +00:00
|
|
|
}
|