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;
|
2022-09-05 09:56:13 +00:00
|
|
|
|
using OrangeGuidanceTomestone.MiniPenumbra;
|
2022-09-03 02:59:45 +00:00
|
|
|
|
|
|
|
|
|
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-07 05:46:30 +00:00
|
|
|
|
[PluginService]
|
|
|
|
|
internal GameGui GameGui { 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-05 09:56:13 +00:00
|
|
|
|
internal VfxReplacer VfxReplacer { get; }
|
2022-09-04 03:23:19 +00:00
|
|
|
|
internal Commands Commands { get; }
|
2022-09-06 12:07:23 +00:00
|
|
|
|
internal Pinger Pinger { get; }
|
2022-09-03 13:55:36 +00:00
|
|
|
|
|
2022-09-05 09:56:13 +00:00
|
|
|
|
internal string AvfxFilePath { get; }
|
|
|
|
|
|
2022-09-03 02:59:45 +00:00
|
|
|
|
public Plugin() {
|
2022-09-05 09:56:13 +00:00
|
|
|
|
this.AvfxFilePath = this.CopyAvfxFile();
|
|
|
|
|
|
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);
|
2022-09-05 09:56:13 +00:00
|
|
|
|
this.VfxReplacer = new VfxReplacer(this);
|
2022-09-04 20:39:09 +00:00
|
|
|
|
this.Commands = new Commands(this);
|
2022-09-06 12:07:23 +00:00
|
|
|
|
this.Pinger = new Pinger(this);
|
2022-09-04 20:39:09 +00:00
|
|
|
|
|
2022-09-03 13:55:36 +00:00
|
|
|
|
if (this.Config.ApiKey == string.Empty) {
|
2022-09-05 23:23:55 +00:00
|
|
|
|
this.GetApiKey();
|
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-06 12:07:23 +00:00
|
|
|
|
this.Pinger.Dispose();
|
2022-09-04 03:23:19 +00:00
|
|
|
|
this.Commands.Dispose();
|
2022-09-05 09:56:13 +00:00
|
|
|
|
this.VfxReplacer.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-05 09:56:13 +00:00
|
|
|
|
|
|
|
|
|
private string CopyAvfxFile() {
|
|
|
|
|
var configDir = this.Interface!.GetPluginConfigDirectory();
|
|
|
|
|
Directory.CreateDirectory(configDir);
|
2022-09-09 09:35:10 +00:00
|
|
|
|
for (var i = 0; i < Messages.VfxPaths.Length; i++) {
|
2022-09-06 04:24:32 +00:00
|
|
|
|
var letter = (char) ('a' + i);
|
2022-09-06 04:37:17 +00:00
|
|
|
|
var stream = Resourcer.Resource.AsStreamUnChecked($"OrangeGuidanceTomestone.vfx.b0941trp1{letter}_o.avfx");
|
2022-09-06 04:24:32 +00:00
|
|
|
|
var path = Path.Join(configDir, $"sign_{letter}.avfx");
|
|
|
|
|
stream.CopyTo(File.Create(path));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return configDir;
|
2022-09-05 09:56:13 +00:00
|
|
|
|
}
|
2022-09-05 23:23:55 +00:00
|
|
|
|
|
|
|
|
|
internal void GetApiKey() {
|
|
|
|
|
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();
|
|
|
|
|
this.Messages.SpawnVfx();
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-09-03 02:59:45 +00:00
|
|
|
|
}
|