OrangeGuidanceTomestone/client/Plugin.cs

71 lines
1.9 KiB
C#
Raw Normal View History

2022-09-04 07:12:51 +00:00
using Dalamud.Data;
using Dalamud.Game;
2022-09-03 23:45:16 +00:00
using Dalamud.Game.ClientState;
2022-09-04 22:19:16 +00:00
using Dalamud.Game.ClientState.Conditions;
2022-09-04 03:23:19 +00:00
using Dalamud.Game.Command;
2022-09-05 08:02:34 +00:00
using Dalamud.Game.Gui;
2022-09-03 13:55:36 +00:00
using Dalamud.IoC;
2022-09-03 02:59:45 +00:00
using Dalamud.Plugin;
namespace OrangeGuidanceTomestone;
public class Plugin : IDalamudPlugin {
public string Name => "Orange Guidance Tomestone";
[PluginService]
internal DalamudPluginInterface Interface { get; init; }
2022-09-03 13:55:36 +00:00
2022-09-05 08:02:34 +00:00
[PluginService]
internal ChatGui ChatGui { get; init; }
2022-09-03 13:55:36 +00:00
[PluginService]
internal ClientState ClientState { get; init; }
2022-09-04 03:23:19 +00:00
[PluginService]
internal CommandManager CommandManager { get; init; }
2022-09-04 22:19:16 +00:00
[PluginService]
internal Condition Condition { get; init; }
2022-09-04 07:12:51 +00:00
[PluginService]
internal DataManager DataManager { get; init; }
2022-09-03 23:45:16 +00:00
[PluginService]
internal Framework Framework { get; init; }
2022-09-03 13:55:36 +00:00
internal Configuration Config { get; }
2022-09-03 23:45:16 +00:00
internal Vfx Vfx { get; }
2022-09-03 03:24:01 +00:00
internal PluginUi Ui { get; }
2022-09-03 23:45:16 +00:00
internal Messages Messages { get; }
2022-09-04 03:23:19 +00:00
internal Commands Commands { get; }
2022-09-03 13:55:36 +00:00
2022-09-03 02:59:45 +00:00
public Plugin() {
2022-09-03 13:55:36 +00:00
this.Config = this.Interface!.GetPluginConfig() as Configuration ?? new Configuration();
2022-09-04 20:39:09 +00:00
this.Vfx = new Vfx();
this.Messages = new Messages(this);
this.Ui = new PluginUi(this);
this.Commands = new Commands(this);
2022-09-03 13:55:36 +00:00
if (this.Config.ApiKey == string.Empty) {
Task.Run(async () => {
var resp = await new HttpClient().PostAsync("https://tryfingerbuthole.anna.lgbt/account", null);
var key = await resp.Content.ReadAsStringAsync();
this.Config.ApiKey = key;
this.SaveConfig();
2022-09-04 20:39:09 +00:00
this.Messages.SpawnVfx();
2022-09-03 13:55:36 +00:00
});
}
2022-09-03 02:59:45 +00:00
}
2022-09-03 13:55:36 +00:00
2022-09-03 02:59:45 +00:00
public void Dispose() {
2022-09-04 03:23:19 +00:00
this.Commands.Dispose();
2022-09-03 03:24:01 +00:00
this.Ui.Dispose();
2022-09-04 19:19:38 +00:00
this.Messages.Dispose();
2022-09-04 02:11:18 +00:00
this.Vfx.Dispose();
2022-09-03 02:59:45 +00:00
}
2022-09-03 13:55:36 +00:00
internal void SaveConfig() {
this.Interface.SavePluginConfig(this.Config);
}
2022-09-03 02:59:45 +00:00
}