예제 #1
0
        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);
        }
예제 #2
0
        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();
        }
예제 #3
0
파일: Penumbra.cs 프로젝트: xivdev/Penumbra
    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":
            {
                ModManager.DiscoverMods();
                Dalamud.Chat.Print($"Reloaded Penumbra mods. You have {ModManager.Count} mods."
                                   );
                break;
            }

            case "redraw":
            {
                if (args.Length > 1)
                {
                    ObjectReloader.RedrawObject(args[1], RedrawType.Redraw);
                }
                else
                {
                    ObjectReloader.RedrawAll(RedrawType.Redraw);
                }

                break;
            }

            case "debug":
            {
                Config.DebugMode = true;
                Config.Save();
                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.EnableMods);
                Dalamud.Chat.Print(Config.EnableMods
                        ? modsEnabled
                        : modsDisabled);
                break;
            }

            case "unfix":
            {
                Config.FixMainWindow = false;
                _configWindow.Flags &= ~(ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);
                break;
            }

            case "collection":
            {
                if (args.Length == 2)
                {
                    args = args[1].Split(new[] { ' ' }, 2);
                    if (args.Length == 2)
                    {
                        SetCollection(args[0], args[1]);
                    }
                }
                else
                {
                    Dalamud.Chat.Print("Missing arguments, the correct command format is:"
                                       + " /penumbra collection {default} <collectionName>");
                }

                break;
            }
            }

            return;
        }

        _configWindow.Toggle();
    }
예제 #4
0
        public void RedrawObject(GameObject?gameObject, RedrawType setting)
        {
            CheckInitialized();

            _penumbra !.ObjectReloader.RedrawObject(gameObject, setting);
        }
예제 #5
0
        public void RedrawObject(string name, RedrawType setting)
        {
            CheckInitialized();

            _penumbra !.ObjectReloader.RedrawObject(name, setting);
        }
예제 #6
0
 public void RedrawObject(int tableIndex, RedrawType setting)
 {
     CheckInitialized();
     _penumbra !.ObjectReloader.RedrawObject(tableIndex, setting);
 }