public void Initialize(DalamudPluginInterface pluginInterface) { PluginInterface = pluginInterface; Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); Configuration.Initialize(PluginInterface); GameUtils = new GameUtils(PluginInterface); ModManager = new ModManager(this); ModManager.DiscoverMods(Configuration.CurrentCollection); ResourceLoader = new ResourceLoader(this); PluginInterface.CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand) { HelpMessage = "/penumbra - toggle ui\n/penumbra reload - reload mod file lists & discover any new mods" }); ResourceLoader.Init(); ResourceLoader.Enable(); SettingsInterface = new SettingsInterface(this); PluginInterface.UiBuilder.OnBuildUi += SettingsInterface.Draw; PluginDebugTitleStr = $"{Name} - Debug Build"; if (Configuration.EnableHttpApi) { CreateWebServer(); } }
public Penumbra(DalamudPluginInterface pluginInterface) { FFXIVClientStructs.Resolver.Initialize(); Dalamud.Initialize(pluginInterface); GameData.GameData.GetIdentifier(Dalamud.GameData, Dalamud.ClientState.ClientLanguage); Config = Configuration.Load(); MusicManager = new MusicManager(); MusicManager.DisableStreaming(); var gameUtils = Service <ResidentResources> .Set(); PlayerWatcher = PlayerWatchFactory.Create(Dalamud.Framework, Dalamud.ClientState, Dalamud.Objects); Service <MetaDefaults> .Set(); var modManager = Service <ModManager> .Set(); modManager.DiscoverMods(); ObjectReloader = new ObjectReloader(modManager, Config.WaitFrames); ResourceLoader = new ResourceLoader(this); Dalamud.Commands.AddHandler(CommandName, new CommandInfo(OnCommand) { HelpMessage = "/penumbra - toggle ui\n/penumbra reload - reload mod file lists & discover any new mods", }); ResourceLoader.Init(); ResourceLoader.Enable(); gameUtils.ReloadPlayerResources(); SettingsInterface = new SettingsInterface(this); if (Config.EnableHttpApi) { CreateWebServer(); } if (!Config.EnablePlayerWatch || !Config.IsEnabled) { PlayerWatcher.Disable(); } PlayerWatcher.PlayerChanged += p => { PluginLog.Debug("Triggered Redraw of {Player}.", p.Name); ObjectReloader.RedrawObject(p, RedrawType.OnlyWithSettings); }; Api = new PenumbraApi(this); SubscribeItemLinks(); Ipc = new PenumbraIpc(pluginInterface, Api); }
public void Dispose() { Ipc.Dispose(); Api.Dispose(); SettingsInterface.Dispose(); ObjectReloader.Dispose(); PlayerWatcher.Dispose(); Dalamud.Commands.RemoveHandler(CommandName); ResourceLoader.Dispose(); ShutdownWebServer(); }
public void Initialize(DalamudPluginInterface pluginInterface) { PluginInterface = pluginInterface; Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); Configuration.Initialize(PluginInterface); SoundShit = new SoundShit(this); var gameUtils = Service <GameResourceManagement> .Set(PluginInterface); var modManager = Service <ModManager> .Set(this); Service <MetaDefaults> .Set(PluginInterface); modManager.DiscoverMods(Configuration.CurrentCollection); ResourceLoader = new ResourceLoader(this); PluginInterface.CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand) { HelpMessage = "/penumbra - toggle ui\n/penumbra reload - reload mod file lists & discover any new mods" }); ResourceLoader.Init(); ResourceLoader.Enable(); gameUtils.ReloadPlayerResources(); SettingsInterface = new SettingsInterface(this); PluginInterface.UiBuilder.OnBuildUi += SettingsInterface.Draw; if (Configuration.EnableHttpApi) { CreateWebServer(); } }
public void Initialize(DalamudPluginInterface pluginInterface) { PluginInterface = pluginInterface; Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); Configuration.Initialize(PluginInterface); ModManager = new ModManager(new DirectoryInfo(Configuration.BaseFolder)); ModManager.DiscoverMods(); ResourceLoader = new ResourceLoader(this); PluginInterface.CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand) { HelpMessage = "/penumbra 0 will disable penumbra, /penumbra 1 will enable it." }); ResourceLoader.Init(); ResourceLoader.Enable(); SettingsInterface = new SettingsInterface(this); PluginInterface.UiBuilder.OnBuildUi += SettingsInterface.Draw; }
private void OnCommand(string command, string rawArgs) { const string modsEnabled = "Your mods have now been enabled."; const string modsDisabled = "Your mods have now been disabled."; var args = rawArgs.Split(new[] { ' ' }, 2); if (args.Length > 0 && args[0].Length > 0) { switch (args[0]) { case "reload": { Service <ModManager> .Get().DiscoverMods(); Dalamud.Chat.Print( $"Reloaded Penumbra mods. You have {Service< ModManager >.Get()?.Mods.Count} mods." ); break; } case "redraw": { if (args.Length > 1) { ObjectReloader.RedrawObject(args[1]); } else { ObjectReloader.RedrawAll(); } break; } case "debug": { SettingsInterface.MakeDebugTabVisible(); break; } case "enable": { Dalamud.Chat.Print(Enable() ? "Your mods are already enabled. To disable your mods, please run the following command instead: /penumbra disable" : modsEnabled); break; } case "disable": { Dalamud.Chat.Print(Disable() ? "Your mods are already disabled. To enable your mods, please run the following command instead: /penumbra enable" : modsDisabled); break; } case "toggle": { SetEnabled(!Config.IsEnabled); Dalamud.Chat.Print(Config.IsEnabled ? modsEnabled : modsDisabled); break; } } return; } SettingsInterface.FlipVisibility(); }