1
0
annas-questmap/QuestMap/Plugin.cs

59 lines
1.9 KiB
C#
Raw Normal View History

2021-08-23 17:20:39 +00:00
using System.Threading.Channels;
using Dalamud.IoC;
2021-07-21 06:11:01 +00:00
using Dalamud.Plugin;
2023-09-03 22:04:08 +00:00
using Dalamud.Plugin.Services;
2021-07-21 06:11:01 +00:00
using XivCommon;
namespace QuestMap {
2021-08-23 17:20:39 +00:00
// ReSharper disable once ClassNeverInstantiated.Global
internal class Plugin : IDalamudPlugin {
2023-09-28 06:48:18 +00:00
internal static string Name => "Quest Map";
2021-08-23 17:20:39 +00:00
[PluginService]
internal DalamudPluginInterface Interface { get; init; } = null!;
[PluginService]
2023-09-28 06:48:18 +00:00
internal IClientState ClientState { get; init; } = null!;
2021-08-23 17:20:39 +00:00
[PluginService]
2023-09-28 06:48:18 +00:00
internal ICommandManager CommandManager { get; init; } = null!;
2021-08-23 17:20:39 +00:00
[PluginService]
2023-09-28 06:48:18 +00:00
internal IDataManager DataManager { get; init; } = null!;
2021-08-23 17:20:39 +00:00
[PluginService]
2023-09-28 06:48:18 +00:00
internal IGameGui GameGui { get; init; } = null!;
2021-08-23 17:20:39 +00:00
2023-09-03 22:04:08 +00:00
[PluginService]
internal ITextureProvider TextureProvider { get; init; } = null!;
2021-08-23 17:20:39 +00:00
2021-07-21 06:11:01 +00:00
internal XivCommonBase Common { get; }
internal Configuration Config { get; }
internal Quests Quests { get; }
internal PluginUi Ui { get; }
private Commands Commands { get; }
public Plugin(DalamudPluginInterface pi) {
pi.Inject(this); // not sure why [PluginInterface] above aren't initialized by dalamud, but they're null
2023-10-03 21:39:42 +00:00
this.Common = new XivCommonBase(this.Interface);
2021-07-21 06:11:01 +00:00
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
var graphChannel = Channel.CreateUnbounded<GraphInfo>();
this.Quests = new Quests(this, graphChannel.Writer);
this.Ui = new PluginUi(this, graphChannel.Reader);
this.Commands = new Commands(this);
}
public void Dispose() {
this.Commands.Dispose();
this.Ui.Dispose();
this.Common.Dispose();
}
internal void SaveConfig() {
this.Interface.SavePluginConfig(this.Config);
}
}
}