Exemple #1
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;
            this.pluginInterface.CommandManager.AddHandler("/combo", new CommandInfo(OnCommandDebugCombo)
            {
                HelpMessage = "Open a window to edit custom combo settings.",
                ShowInHelp  = true
            });

            this.Configuration = pluginInterface.GetPluginConfig() as IconReplacerConfiguration ?? new IconReplacerConfiguration();

            this.iconReplacer = new IconReplacer(pluginInterface.TargetModuleScanner, pluginInterface.ClientState, this.Configuration);

            this.iconReplacer.Enable();

            this.pluginInterface.UiBuilder.OnBuildUi += UiBuilder_OnBuildUi;
        }
Exemple #2
0
        public Dalamud(DalamudStartInfo info)
        {
            this.StartInfo     = info;
            this.Configuration = DalamudConfiguration.Load(info.ConfigurationPath);

            this.baseDirectory = info.WorkingDirectory;

            this.unloadSignal = new ManualResetEvent(false);

            // Initialize the process information.
            this.targetModule = Process.GetCurrentProcess().MainModule;
            this.sigScanner   = new SigScanner(this.targetModule);

            // Initialize game subsystem
            Framework = new Framework(this.sigScanner, this);

            // Initialize managers. Basically handlers for the logic
            CommandManager = new CommandManager(this, info.Language);
            SetupCommands();

            ChatHandlers    = new ChatHandlers(this);
            NetworkHandlers = new NetworkHandlers(this, this.Configuration.OptOutMbCollection);

            this.ClientState = new ClientState(this, info, this.sigScanner, this.targetModule);

            this.BotManager = new DiscordBotManager(this, this.Configuration.DiscordFeatureConfig);

            this.PluginManager = new PluginManager(this, info.PluginDirectory, info.DefaultPluginDirectory);

            this.IconReplacer = new IconReplacer(this, this.sigScanner);

            this.WinSock2 = new WinSockHandlers();

            try {
                this.PluginManager.LoadPlugins();
            } catch (Exception ex) {
                Framework.Gui.Chat.PrintError(
                    "[XIVLAUNCHER] There was an error loading additional plugins. Please check the log for more details.");
                Log.Error(ex, "Plugin load failed.");
            }
        }
Exemple #3
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;

            this.pluginInterface.CommandManager.AddHandler("/pcombo", new CommandInfo(OnCommandDebugCombo)
            {
                HelpMessage = "Open a window to edit custom combo settings.",
                ShowInHelp  = true
            });

            this.Configuration = pluginInterface.GetPluginConfig() as XIVComboConfiguration ?? new XIVComboConfiguration();
            if (Configuration.Version < 3)
            {
                Configuration.HiddenActions = new List <bool>();
                for (var i = 0; i < Enum.GetValues(typeof(CustomComboPreset)).Length; i++)
                {
                    Configuration.HiddenActions.Add(false);
                }
                Configuration.Version = 3;
            }

            this.iconReplacer = new IconReplacer(pluginInterface.TargetModuleScanner, pluginInterface.ClientState, this.Configuration);

            this.iconReplacer.Enable();

            this.pluginInterface.UiBuilder.OnOpenConfigUi += (sender, args) => isImguiComboSetupOpen = true;
            this.pluginInterface.UiBuilder.OnBuildUi      += UiBuilder_OnBuildUi;

            /*
             * pluginInterface.Subscribe("PingPlugin", e => {
             *  dynamic msg = e;
             *  iconReplacer.UpdatePing(msg.LastRTT / 2);
             *  PluginLog.Log("Ping was updated to {0} ms", msg.LastRTT / 2);
             *  });
             */
            var values = Enum.GetValues(typeof(CustomComboPreset)).Cast <CustomComboPreset>();

            orderedByClassJob = values.Where(x => x != CustomComboPreset.None && x.GetAttribute <CustomComboInfoAttribute>() != null).OrderBy(x => x.GetAttribute <CustomComboInfoAttribute>().ClassJob).ToArray();
            UpdateConfig();
        }