OrangeGuidanceTomestone/client/Plugin.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2022-09-03 23:45:16 +00:00
using Dalamud.Game;
using Dalamud.Game.ClientState;
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
[PluginService]
internal ClientState ClientState { 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-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();
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-03 23:45:16 +00:00
this.Vfx = new Vfx();
2022-09-03 03:24:01 +00:00
this.Ui = new PluginUi(this);
2022-09-03 23:45:16 +00:00
this.Messages = new Messages(this);
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-03 23:45:16 +00:00
this.Messages.Dispose();
2022-09-03 03:24:01 +00:00
this.Ui.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
}