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 bool Disable() { if (!Config.IsEnabled) { return(false); } Config.IsEnabled = false; Service <ResidentResources> .Get().ReloadPlayerResources(); if (Config.EnablePlayerWatch) { PlayerWatcher.SetStatus(false); } Config.Save(); ObjectReloader.RedrawAll(RedrawType.WithoutSettings); return(true); }
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(); }
public Penumbra(CharacterUtility characterUtility) { CharacterUtility = characterUtility; Framework = new FrameworkManager(); Backup.CreateBackup(PenumbraBackupFiles()); Config = Configuration.Load(); MusicManager = new MusicManager(); if (Config.DisableSoundStreaming) { MusicManager.DisableStreaming(); } ResidentResources = new ResidentResourceManager(); Redirects = new SimpleRedirectManager(); MetaFileManager = new MetaFileManager(); ResourceLoader = new ResourceLoader(this); ResourceLogger = new ResourceLogger(ResourceLoader); ModManager = new Mod.Manager(Config.ModDirectory); ModManager.DiscoverMods(); CollectionManager = new ModCollection.Manager(ModManager); ModFileSystem = ModFileSystem.Load(); ObjectReloader = new ObjectReloader(); PathResolver = new PathResolver(ResourceLoader); Dalamud.Commands.AddHandler(CommandName, new CommandInfo(OnCommand) { HelpMessage = "/penumbra - toggle ui\n/penumbra reload - reload mod file lists & discover any new mods", }); ResidentResources.Reload(); SetupInterface(out _configWindow, out _launchButton, out _windowSystem); if (Config.EnableHttpApi) { CreateWebServer(); } ResourceLoader.EnableHooks(); if (Config.EnableMods) { ResourceLoader.EnableReplacements(); PathResolver.Enable(); } if (Config.DebugMode) { ResourceLoader.EnableDebug(); _configWindow.IsOpen = true; } if (Config.EnableFullResourceLogging) { ResourceLoader.EnableFullLogging(); } ResidentResources.Reload(); Api = new PenumbraApi(this); Ipc = new PenumbraIpc(Dalamud.PluginInterface, Api); SubscribeItemLinks(); if (ImcExceptions > 0) { PluginLog.Error($"{ImcExceptions} IMC Exceptions thrown. Please repair your game files."); } else { PluginLog.Information($"Penumbra Version {Version}, Commit #{CommitHash} successfully Loaded."); } }
public void RedrawAll(RedrawType setting) { CheckInitialized(); _penumbra !.ObjectReloader.RedrawAll(setting); }
public void RedrawObject(GameObject?gameObject, RedrawType setting) { CheckInitialized(); _penumbra !.ObjectReloader.RedrawObject(gameObject, setting); }
public void RedrawObject(string name, RedrawType setting) { CheckInitialized(); _penumbra !.ObjectReloader.RedrawObject(name, setting); }
public void RedrawObject(int tableIndex, RedrawType setting) { CheckInitialized(); _penumbra !.ObjectReloader.RedrawObject(tableIndex, setting); }