示例#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
    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.");
        }
    }