Пример #1
0
        public void Initialize(DalamudPluginInterface pInterface)
        {
            Plugin = this;

            Interface = pInterface;

            Config = (Configuration)Interface.GetPluginConfig() ?? new Configuration();
            Config.Initialize();
            Config.TryBackup(); // Backup on version change

            Interface.Framework.OnUpdateEvent += Update;

            ui = new PluginUI();
            Interface.UiBuilder.OnOpenConfigUi += ToggleConfig;
            Interface.UiBuilder.OnBuildUi      += Draw;

            CheckHideOptOuts();

            commandManager = new PluginCommandManager();

            SetupIPC();

            InitializePointers();

            Task.Run(async() =>
            {
                while (!Config.AlwaysDisplayBars && !ui.configOpen && !IsLoggedIn())
                {
                    await Task.Delay(1000);
                }
                ReadyPlugin();
            });
        }
 public void Init(DalamudPluginInterface pluginInterface)
 {
     _address.Setup(pluginInterface.TargetModuleScanner);
     _placeholderResolver = Marshal.GetDelegateForFunctionPointer <ResolvePlaceholderActor>(_address.ResolvePlaceholderText);
     _magicStructInfo     = pluginInterface.TargetModuleScanner.GetStaticAddressFromSig("48 8B 0D ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ?? 48 89 05 ?? ?? ?? ?? 48 85 C9 74 0C");
     SetupPlaceholderResolver();
 }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlayerTrackProvider"/> class.
        /// </summary>
        /// <param name="pluginInterface">plugin interface.</param>
        /// <param name="api">plugin api.</param>
        public PlayerTrackProvider(DalamudPluginInterface pluginInterface, IPlayerTrackAPI api)
        {
            this.API = api;

            try
            {
                this.ProviderAPIVersion = pluginInterface.GetIpcProvider <int>(LabelProviderApiVersion);
                this.ProviderAPIVersion.RegisterFunc(() => api.APIVersion);
            }
            catch (Exception ex)
            {
                Logger.LogError($"Error registering IPC provider for {LabelProviderApiVersion}:\n{ex}");
            }

            try
            {
                this.ProviderGetPlayerCurrentNameWorld =
                    pluginInterface.GetIpcProvider <string, uint, string>(LabelProviderGetPlayerCurrentNameWorld);
                this.ProviderGetPlayerCurrentNameWorld.RegisterFunc(api.GetPlayerCurrentNameWorld);
            }
            catch (Exception e)
            {
                Logger.LogError($"Error registering IPC provider for {LabelProviderGetPlayerCurrentNameWorld}:\n{e}");
            }
        }
Пример #4
0
 public MapLinker(
     DalamudPluginInterface pluginInterface,
     ChatGui chat,
     CommandManager commands,
     DataManager data,
     ClientState clientState,
     Framework framework,
     GameGui gameGui,
     TargetManager targetManager)
 {
     Interface      = pluginInterface;
     ClientState    = clientState;
     TargetManager  = targetManager;
     Framework      = framework;
     CommandManager = commands;
     DataManager    = data;
     ChatGui        = chat;
     GameGui        = gameGui;
     Aetherytes     = DataManager.GetExcelSheet <Aetheryte>(ClientState.ClientLanguage);
     AetherytesMap  = DataManager.GetExcelSheet <MapMarker>(ClientState.ClientLanguage);
     Config         = pluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
     Config.Initialize(pluginInterface);
     CommandManager.AddHandler("/maplink", new CommandInfo(CommandHandler)
     {
         HelpMessage = "/maplink - open the maplink panel."
     });
     Gui = new PluginUi(this);
     ChatGui.ChatMessage += Chat_OnChatMessage;
 }
Пример #5
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            Interface     = pluginInterface ?? throw new ArgumentNullException(nameof(pluginInterface), "DalamudPluginInterface cannot be null");
            Configuration = pluginInterface.GetPluginConfig() as YesAlreadyConfiguration ?? new YesAlreadyConfiguration();

            Interface.CommandManager.AddHandler(Command, new CommandInfo(OnChatCommand)
            {
                HelpMessage = "Open a window to edit various settings.",
                ShowInHelp  = true
            });

            Address = new PluginAddressResolver();
            Address.Setup(pluginInterface.TargetModuleScanner);
            PluginUi = new PluginUI(this);

            Click.Initialize(pluginInterface);

            AddonSelectYesNoOnSetupHook = new(Address.AddonSelectYesNoOnSetupAddress, new OnSetupDelegate(AddonSelectYesNoOnSetupDetour), this);
            AddonSelectYesNoOnSetupHook.Enable();

            AddonSalvageDialogOnSetupHook = new(Address.AddonSalvageDialongOnSetupAddress, new OnSetupDelegate(AddonSalvageDialogOnSetupDetour), this);
            AddonSalvageDialogOnSetupHook.Enable();

            AddonMaterializeDialogOnSetupHook = new(Address.AddonMaterializeDialongOnSetupAddress, new OnSetupDelegate(AddonMaterializeDialogOnSetupDetour), this);
            AddonMaterializeDialogOnSetupHook.Enable();

            AddonItemInspectionResultOnSetupHook = new(Address.AddonItemInspectionResultOnSetupAddress, new OnSetupDelegate(AddonItemInspectionResultOnSetupDetour), this);
            AddonItemInspectionResultOnSetupHook.Enable();

            AddonRetainerTaskAskOnSetupHook = new(Address.AddonRetainerTaskAskOnSetupAddress, new OnSetupDelegate(AddonRetainerTaskAskOnSetupDetour), this);
            AddonRetainerTaskAskOnSetupHook.Enable();

            AddonRetainerTaskResultOnSetupHook = new(Address.AddonRetainerTaskResultOnSetupAddress, new OnSetupDelegate(AddonRetainerTaskResultOnSetupDetour), this);
            AddonRetainerTaskResultOnSetupHook.Enable();
        }
Пример #6
0
        public RezPls(DalamudPluginInterface pluginInterface)
        {
            Dalamud.Initialize(pluginInterface);
            Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "";
            Config  = RezPlsConfig.Load();

            StatusSet     = new StatusSet();
            _actorWatcher = new ActorWatcher(StatusSet);
            _overlay      = new Overlay(_actorWatcher);
            _interface    = new Interface(this);

            if (Config.Enabled)
            {
                Enable();
            }
            else
            {
                Disable();
            }
            Dalamud.Commands.AddHandler("/rezpls", new CommandInfo(OnRezPls)
            {
                HelpMessage = "Open the configuration window for RezPls.",
                ShowInHelp  = true,
            });
        }
Пример #7
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;

            var getBaseUIObjScan    = this.pluginInterface.TargetModuleScanner.ScanText("E8 ?? ?? ?? ?? 41 b8 01 00 00 00 48 8d 15 ?? ?? ?? ?? 48 8b 48 20 e8 ?? ?? ?? ?? 48 8b cf");
            var getUI2ObjByNameScan = this.pluginInterface.TargetModuleScanner.ScanText("e8 ?? ?? ?? ?? 48 8b cf 48 89 87 ?? ?? 00 00 e8 ?? ?? ?? ?? 41 b8 01 00 00 00");

            this.getBaseUIObj    = Marshal.GetDelegateForFunctionPointer <GetBaseUIObjDelegate>(getBaseUIObjScan);
            this.getUI2ObjByName = Marshal.GetDelegateForFunctionPointer <GetUI2ObjByNameDelegate>(getUI2ObjByNameScan);
            this.chatLogObject   = this.getUI2ObjByName(Marshal.ReadIntPtr(getBaseUIObj(), 0x20), "ChatLog");

            this.config = (PingConfiguration)this.pluginInterface.GetPluginConfig() ?? new PingConfiguration();
            this.config.Initialize(this.pluginInterface);

            this.pingTracker = new AggregatePingTracker(this.config,
                                                        new ComponentModelPingTracker(this.config),
                                                        new Win32APIPingTracker(this.config));

            this.pluginInterface.Framework.OnUpdateEvent += OnFrameworkUpdate;

            this.ui = new PingUI(this.pingTracker, this.config);

            this.pluginInterface.UiBuilder.OnOpenConfigUi += (sender, e) => this.ui.ConfigVisible = true;
            this.pluginInterface.UiBuilder.OnBuildUi      += this.ui.BuildUi;

            AddCommandHandlers();
        }
Пример #8
0
        public override bool ShouldShow(DalamudPluginInterface pluginInterface, RemindMe plugin, MonitorDisplay display)
        {
            try {
                if (pluginInterface.ClientState.LocalPlayer.ClassJob.GameData.Role != 1)
                {
                    return(false);
                }
                // Check have stance
                if (pluginInterface.ClientState.LocalPlayer.StatusEffects.Any(s => tankStatusEffectIDs.Contains((uint)s.EffectId)))
                {
                    return(false);
                }
                // Check other tanks have stance


                foreach (var a in pluginInterface.ClientState.Actors)
                {
                    if (!(a is PlayerCharacter pc))
                    {
                        continue;
                    }
                    if (pc.ClassJob.GameData.Role != 1 || pc.ActorId == pluginInterface.ClientState.LocalPlayer.ActorId)
                    {
                        continue;
                    }
                    if (pc.StatusEffects.Any(s => tankStatusEffectIDs.Contains((uint)s.EffectId)))
                    {
                        return(false);
                    }
                }
                return(true);
            } catch {
                return(false);
            }
        }
Пример #9
0
    private static Configuration GetAndMigrateConfig(DalamudPluginInterface pi)
    {
        var config = pi.GetPluginConfig() as Configuration ?? new Configuration();

        switch (config.Version)
        {
        case 0: {
            SimpleLog.Debug("Migrate configuration 0 to version 1:");
            SimpleLog.Debug($"HideInCombat: ${config.HideInCombat}");
            config.Visibility = config.HideInCombat ? CompassVisibility.NotInCombat : CompassVisibility.Always;
            config.Version    = 1;
            pi.SavePluginConfig(config);
            break;
        }
        }

        // NOTE: Technical debt; This array is order-sensitive as it is used in combination with
        //  Configuration.ShouldHideOnUiObjectSerializer. There were problems serializing a Dictionary,
        //  but apart from that I am unsure why _this_ was the solution I came up with. Oh well.
        config.ShouldHideOnUiObject = Constant.InitialUiObjectArray;
        for (var i = 0; i < config.ShouldHideOnUiObjectSerializer.Length; i++)
        {
            config.ShouldHideOnUiObject[i].disable = config.ShouldHideOnUiObjectSerializer[i];
        }
        if (config.ShouldHideOnUiObjectSerializer.Length < config.ShouldHideOnUiObject.Length)
        {
            Array.Resize(ref config.ShouldHideOnUiObjectSerializer, config.ShouldHideOnUiObject.Length);
        }

        return(config);
    }
Пример #10
0
        public ItemSearchWindow(ItemSearchPlugin plugin, string searchText = "")
        {
            this.pluginInterface = plugin.PluginInterface;
            this.data            = pluginInterface.Data;
            this.builder         = pluginInterface.UiBuilder;
            this.pluginConfig    = plugin.PluginConfig;
            this.plugin          = plugin;

            while (!data.IsDataReady)
            {
                Thread.Sleep(1);
            }

            SearchFilters = new List <SearchFilter> {
                new ItemNameSearchFilter(pluginConfig, searchText),
                new ItemUICategorySearchFilter(pluginConfig, data),
                new LevelEquipSearchFilter(pluginConfig),
                new LevelItemSearchFilter(pluginConfig),
                new EquipAsSearchFilter(pluginConfig, data),
                new RaceSexSearchFilter(pluginConfig, data),
                new DyeableSearchFilter(pluginConfig),
                new StatSearchFilter(pluginConfig, data),
            };

            ActionButtons = new List <IActionButton> {
                new MarketBoardActionButton(pluginInterface, pluginConfig),
                new DataSiteActionButton(pluginConfig)
            };
        }
Пример #11
0
        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();
            }
        }
Пример #12
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            // Core plugin initialization
            this.pluginInterface = pluginInterface;

            this.config = (PingConfiguration)this.pluginInterface.GetPluginConfig() ?? new PingConfiguration();
            this.config.Initialize(this.pluginInterface);

            // Set up ping trackers
            this.pingTracker = new AggregatePingTracker(this.config,
                                                        new ComponentModelPingTracker(this.config),
                                                        new Win32APIPingTracker(this.config)
                                                        /*new LinuxViaWinePingTracker(this.config)*/);
            this.pingTracker.OnPingUpdated += payload =>
            {
                dynamic obj = new ExpandoObject();
                obj.LastRTT    = payload.LastRTT;
                obj.AverageRTT = payload.AverageRTT;
                this.pluginInterface.SendMessage(obj);
            };

            this.pluginInterface.Framework.OnUpdateEvent += OnFrameworkUpdate;

            // Set up UI
            this.ui = new PingUI(this.pingTracker, this.pluginInterface.UiBuilder, this.config);

            this.pluginInterface.UiBuilder.OnOpenConfigUi += (sender, e) => this.ui.ConfigVisible = true;
            this.pluginInterface.UiBuilder.OnBuildUi      += this.ui.BuildUi;

            // Initialize command manager
            this.commandManager = new PluginCommandManager <PingPlugin>(this, this.pluginInterface);
        }
Пример #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SomethingNeedDoingPlugin"/> class.
        /// </summary>
        /// <param name="pluginInterface">Dalamud plugin interface.</param>
        public SomethingNeedDoingPlugin(DalamudPluginInterface pluginInterface)
        {
            pluginInterface.Create <Service>();

            ClickLib.Click.Initialize();

            Service.Plugin        = this;
            Service.Configuration = SomethingNeedDoingConfiguration.Load(pluginInterface.ConfigDirectory);

            Service.ChatManager      = new ChatManager();
            Service.GameEventManager = new GameEventManager();
            Service.MacroManager     = new MacroManager();

            this.macroWindow  = new();
            this.helpWindow   = new();
            this.windowSystem = new("SomethingNeedDoing");
            this.windowSystem.AddWindow(this.macroWindow);
            this.windowSystem.AddWindow(this.helpWindow);

            Service.Interface.UiBuilder.Draw         += this.windowSystem.Draw;
            Service.Interface.UiBuilder.OpenConfigUi += this.OnOpenConfigUi;
            Service.CommandManager.AddHandler(Command, new CommandInfo(this.OnChatCommand)
            {
                HelpMessage = "Open a window to edit various settings.",
                ShowInHelp  = true,
            });
        }
Пример #14
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            generalStopwatch.Start();
            cacheTimer.Start();
#if DEBUG
            drawConfigWindow = true;
#endif
            this.PluginInterface = pluginInterface;

            LoadConfig();

            PluginInterface.Framework.OnUpdateEvent += FrameworkUpdate;

            IconManager = new IconManager(pluginInterface);

            actionManagerStatic = pluginInterface.TargetModuleScanner.GetStaticAddressFromSig("48 89 05 ?? ?? ?? ?? C3 CC C2 00 00 CC CC CC CC CC CC CC CC CC CC CC CC CC 48 8D 0D ?? ?? ?? ?? E9 ?? ?? ?? ??");
            blueSpellBook       = (uint *)(pluginInterface.TargetModuleScanner.GetStaticAddressFromSig("0F B7 0D ?? ?? ?? ?? 84 C0") + 0x2A);
            PluginLog.Verbose($"Blue Spell Book: {(ulong) blueSpellBook:X}");

            ActionManager = new ActionManager(this, actionManagerStatic);

            pluginInterface.UiBuilder.OnOpenConfigUi += OnOpenConfigUi;

            PluginInterface.UiBuilder.OnBuildUi += this.BuildUI;

            pluginInterface.ClientState.TerritoryChanged += TerritoryChanged;
            TerritoryChanged(this, pluginInterface.ClientState.TerritoryType);

            updateRetainerListHook = new Hook <UpdateRetainerListDelegate>(pluginInterface.TargetModuleScanner.ScanText("40 53 48 83 EC 20 48 8B 01 48 8B D9 FF 50 20 84 C0 74 0F 48 8B 03 48 8B CB 48 83 C4 20 5B 48 FF 60 18 E8"), new UpdateRetainerListDelegate(UpdateRetainerListDetour));
            updateRetainerListHook.Enable();

            Client = new ClientInterface(pluginInterface.TargetModuleScanner, pluginInterface.Data);

            SetupCommands();
        }
Пример #15
0
        public MOAction(SigScanner scanner, ClientState clientState, MOActionConfiguration configuration, ref DalamudPluginInterface plugin, IEnumerable <Lumina.Excel.GeneratedSheets.Action> rawActions)
        {
            fieldMOLocation     = scanner.GetStaticAddressFromSig("E8 ?? ?? ?? ?? 83 BF ?? ?? ?? ?? ?? 0F 84 ?? ?? ?? ?? 48 8D 4C 24 ??", 0x283);
            focusTargLocation   = scanner.GetStaticAddressFromSig("48 8B 0D ?? ?? ?? ?? 48 89 5C 24 ?? BB ?? ?? ?? ?? 48 89 7C 24 ??", 0);
            regularTargLocation = scanner.GetStaticAddressFromSig("F3 0F 11 05 ?? ?? ?? ?? EB 27", 0) + 0x4;
            MagicStructInfo     = scanner.GetStaticAddressFromSig("48 8B 0D ?? ?? ?? ?? 48 8D 05 ?? ?? ?? ?? 48 89 05 ?? ?? ?? ?? 48 85 C9 74 0C", 0);


            Configuration = configuration;

            Address = new MOActionAddressResolver();
            Address.Setup(scanner);

            pluginInterface = plugin;
            RawActions      = rawActions;

            Stacks = new Dictionary <uint, List <StackEntry> >();

            PluginLog.Log("===== M O A C T I O N =====");
            PluginLog.Log("RequestAction address {IsIconReplaceable}", Address.RequestAction);
            PluginLog.Log("SetUiMouseoverEntityId address {SetUiMouseoverEntityId}", Address.SetUiMouseoverEntityId);

            requestActionHook   = new Hook <OnRequestActionDetour>(Address.RequestAction, new OnRequestActionDetour(HandleRequestAction), this);
            uiMoEntityIdHook    = new Hook <OnSetUiMouseoverEntityId>(Address.SetUiMouseoverEntityId, new OnSetUiMouseoverEntityId(HandleUiMoEntityId), this);
            PlaceholderResolver = Marshal.GetDelegateForFunctionPointer <ResolvePlaceholderActor>(Address.ResolvePlaceholderText);
            MagicUiObject       = IntPtr.Zero;

            enabledActions     = new HashSet <ulong>();
            UnorthodoxFriendly = new HashSet <uint>();
            UnorthodoxHostile  = new HashSet <uint>();
            UnorthodoxHostile.Add(3575);
            UnorthodoxFriendly.Add(17055);
            UnorthodoxFriendly.Add(7443);
        }
Пример #16
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            Instance = this;
            this.pi  = pluginInterface;

            this.configuration = this.pi.GetPluginConfig() as Configuration ?? new Configuration();
            this.configuration.Initialize(this.pi);

            this.ui = new PluginUI(this.configuration);

            this.pi.CommandManager.AddHandler(commandName, new CommandInfo(OnCommand)
            {
                HelpMessage = "Shows the logged stats for your current class"
            });

            this.pi.UiBuilder.OnBuildUi      += DrawUI;
            this.pi.UiBuilder.OnOpenConfigUi += (sender, args) => DrawConfigUI();
            classCheckThread = new Thread(Loop)
            {
                Name         = "XIVStats Worker Thread",
                IsBackground = true
            };
            classCheckThread.Start();
            pi.Framework.Gui.Chat.OnChatMessage += OnChatMessage;
        }
Пример #17
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.pi            = pluginInterface;
            this.configuration = pluginInterface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration();

            pluginInterface.CommandManager.AddHandler(command, new CommandInfo(OnDisplayCommand)
            {
                HelpMessage = "Displays the memory patcher window.  Do not use this if you don't know what it is for.",
                ShowInHelp  = false
            });

            // Bit of a hack, but I want these persistent outside of the install directory, but also not in the config itself
            var patchPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "XivLauncher", "pluginConfigs", "memoryPatcher");

            if (!Directory.Exists(patchPath))
            {
                Directory.CreateDirectory(patchPath);
                // this may go away, but for now install the base patch(es) for people to use and test with
                InstallDefaultPatches(patchPath);
            }

            this.patcher = new Patcher(patchPath, pluginInterface.TargetModuleScanner);

            EnableAutoLoadPatches();

            // let's just pass the entire world in here... :(
            this.ui = new PatcherUI(this.patcher, this.configuration, this.pi, this);

            this.pi.UiBuilder.OnBuildUi      += Display;
            this.pi.UiBuilder.OnOpenConfigUi += (sender, args) => OnDisplayCommand(command, "");
        }
Пример #18
0
        public Housemate(
            [RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
            [RequiredVersion("1.0")] CommandManager commandManager,
            [RequiredVersion("1.0")] DataManager dataManager,
            [RequiredVersion("1.0")] ObjectTable objectTable,
            [RequiredVersion("1.0")] ClientState clientState,
            [RequiredVersion("1.0")] GameGui gameGui,
            [RequiredVersion("1.0")] SigScanner sigScanner)
        {
            _pi             = pluginInterface;
            _commandManager = commandManager;

            _configuration = _pi.GetPluginConfig() as Configuration ?? new Configuration();
            _configuration.Initialize(_pi);
            _ui = new HousemateUI(_configuration, objectTable, clientState, gameGui);

            commandManager.AddHandler(CommandName, new CommandInfo(OnCommand)
            {
                HelpMessage = $"Display the Housemate configuration interface.\n" +
                              $"Toggle the Housemate object overlay with '{CommandName} toggle'"
            });

            HousingData.Init(dataManager);
            HousingMemory.Init(sigScanner);

            _pi.UiBuilder.Draw         += DrawUI;
            _pi.UiBuilder.OpenConfigUi += DrawConfigUI;
        }
    /// <summary>
    /// Initializes a new instance of the <see cref="XIVComboExpandedPlugin"/> class.
    /// </summary>
    /// <param name="pluginInterface">Dalamud plugin interface.</param>
    public XIVComboExpandedPlugin(DalamudPluginInterface pluginInterface)
    {
        FFXIVClientStructs.Resolver.Initialize();

        pluginInterface.Create <Service>();

        Service.Configuration = pluginInterface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration();
        Service.Address       = new PluginAddressResolver();
        Service.Address.Setup();

        if (Service.Configuration.Version == 4)
        {
            this.UpgradeConfig4();
        }

        Service.ComboCache   = new CustomComboCache();
        Service.IconReplacer = new IconReplacer();

        this.configWindow = new();
        this.windowSystem = new("XIVComboExpanded");
        this.windowSystem.AddWindow(this.configWindow);

        Service.Interface.UiBuilder.OpenConfigUi += this.OnOpenConfigUi;
        Service.Interface.UiBuilder.Draw         += this.windowSystem.Draw;

        Service.CommandManager.AddHandler(Command, new CommandInfo(this.OnCommand)
        {
            HelpMessage = "Open a window to edit custom combo settings.",
            ShowInHelp  = true,
        });
    }
Пример #20
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.PluginInterface = pluginInterface;

            this.Configuration = this.PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
            this.Configuration.Initialize(this.PluginInterface);

            this.MaterialPathHandler = new MaterialPathHandler(this);
            this.MaterialPathHandler.Init();

            this.SettingsUI = new PluginUI(this);
#if DEBUG
            this.SettingsUI.Visible = true;
#endif

            this.PluginInterface.UiBuilder.OnBuildUi      += DrawUI;
            this.PluginInterface.UiBuilder.OnOpenConfigUi += (sender, args) => this.SettingsUI.Visible = true;

            this.PluginInterface.CommandManager.AddHandler("/mtools",
                                                           new CommandInfo(
                                                               (name_, args) => { this.SettingsUI.Visible = true; }
                                                               )
            {
                HelpMessage = "Show material tools settings window."
            });
        }
Пример #21
0
        private void InitAddresses(DalamudPluginInterface plugin)
        {
            var scanner          = plugin.TargetModuleScanner;
            var aetheryteListAob = scanner.ScanText("33D2488D0D????????E8????????49894424");

            if (aetheryteListAob == IntPtr.Zero)
            {
                _plugin.LogError("aetheryteListAob is null.");
                return;
            }
            var aetheryteListOffset = Marshal.ReadInt32(aetheryteListAob, 5);

            AetheryteListAddress  = scanner.ResolveRelativeAddress(aetheryteListAob + 9, aetheryteListOffset);
            TeleportStatusAddress = AetheryteListAddress == IntPtr.Zero ? IntPtr.Zero : AetheryteListAddress + 0x28;
            if (TeleportStatusAddress == IntPtr.Zero)
            {
                _plugin.LogError("TeleportStatusAddress is null.");
                return;
            }
            var itemCountArgAob = scanner.ScanText("488D0D????????66894424??4533C94533C0");

            if (itemCountArgAob == IntPtr.Zero)
            {
                _plugin.LogError("itemCountArgAob is null.");
                return;
            }
            var itemCountArgOffset = Marshal.ReadInt32(itemCountArgAob, 3);

            ItemCountStaticArgAddress = scanner.ResolveRelativeAddress(itemCountArgAob + 7, itemCountArgOffset);
            if (ItemCountStaticArgAddress == IntPtr.Zero)
            {
                _plugin.LogError("ItemCountStaticArgAddress is null.");
            }
        }
Пример #22
0
        public static void Init(DalamudPluginInterface pluginInterface)
        {
            //	Get the game sheets that we need to populate a zone dictionary.
            ExcelSheet <Lumina.Excel.GeneratedSheets.TerritoryType>          territorySheet     = pluginInterface.Data.GetExcelSheet <Lumina.Excel.GeneratedSheets.TerritoryType>();
            ExcelSheet <Lumina.Excel.GeneratedSheets.ContentFinderCondition> contentFinderSheet = pluginInterface.Data.GetExcelSheet <Lumina.Excel.GeneratedSheets.ContentFinderCondition>();
            ExcelSheet <Lumina.Excel.GeneratedSheets.Map> mapSheet = pluginInterface.Data.GetExcelSheet <Lumina.Excel.GeneratedSheets.Map>();

            //	Clean out anything that we had before.
            mZoneInfoDict.Clear();
            mTerritoryTypeIDToContentFinderIDDict.Clear();

            //	Populate the zero entries ahead of time since there may be a many to one relationship with some zero IDs.
            mZoneInfoDict[0] = ZoneInfo.Unknown;
            mTerritoryTypeIDToContentFinderIDDict[0] = 0;

            //	Get the name for every "MapID" that is an instance zone.  This is spread out over a few different sheets.  The ID number that gets used in the actual preset is the column 10 in
            //	TerritoryType.  The zone name is correlated in PlaceName, and the duty name and ContentLink IDs are in ContentFinderCondition.  We are using the Content link because that's what's
            //	returned by the best (working) function that I have been able to find so far for the current instance zone.  Confusingly, as scope has changed a bit, we want to store the actual
            //	ID of the maps for these zones too.  The best solution (for the time being) seems to be to store a pseudo map name string (the base of the map names for that zone) that can be cross-referenced later.
            foreach (TerritoryType zone in territorySheet.ToList())
            {
                if (zone.ExclusiveType == 2 && !mZoneInfoDict.ContainsKey(zone.Unknown10))
                {
                    ContentFinderCondition contentRow = contentFinderSheet.GetRow(zone.Unknown10);
                    if (contentRow != null &&
                        contentRow.ContentLinkType > 0 &&
                        contentRow.ContentLinkType < 3)
                    {
                        if (!mZoneInfoDict.ContainsKey(zone.Unknown10))
                        {
                            string dutyName = contentRow.Name.Trim();
                            if (dutyName.Length > 0)
                            {
                                dutyName = dutyName.First().ToString().ToUpper() + dutyName.Substring(1);
                            }
                            mZoneInfoDict.Add(zone.Unknown10, new ZoneInfo(dutyName, zone.PlaceName.Value.Name, zone.RowId, zone.Map.Value.Id.Split('/')[0], zone.Unknown10, contentRow.Content));
                        }
                        if (!mTerritoryTypeIDToContentFinderIDDict.ContainsKey(zone.RowId))
                        {
                            mTerritoryTypeIDToContentFinderIDDict.Add(zone.RowId, zone.Unknown10);
                        }
                    }
                }
            }

            //	Now get all of the map info for each territory.  We're doing it this way rather than solely taking the map column
            //	from the TerritoryType sheet because it's easier to handle when a territory has multiple maps this way, rather than
            //	testing each map name for something other than a "/00" and then incrementing until we find where the maps stop existing.
            foreach (Map map in mapSheet.ToList())
            {
                string mapZoneKey = map.Id.Split('/')[0];

                if (!mMapInfoDict.ContainsKey(mapZoneKey))
                {
                    mMapInfoDict.Add(mapZoneKey, new List <MapInfo>());
                }

                mMapInfoDict[mapZoneKey].Add(new MapInfo(map.Id, map.SizeFactor, map.OffsetX, map.OffsetY, map.PlaceNameSub.Value.Name));
            }
        }
Пример #23
0
 public void Initialize(DalamudPluginInterface pluginInterface)
 {
     Interface = pluginInterface;
     Config    = pluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
     Config.Initialize(pluginInterface);
     AetheryteDataManager.Init(pluginInterface);
     Manager = new TeleportManager(this);
     Interface.CommandManager.AddHandler("/tp", new CommandInfo(CommandHandler)
     {
         HelpMessage = "<name> - Teleport to <name>"
     });
     Interface.CommandManager.AddHandler("/tpt", new CommandInfo(CommandHandler)
     {
         HelpMessage = "<name> - Teleport to <name> using Aetheryte Tickets if possible"
     });
     Interface.CommandManager.AddHandler("/tpm", new CommandInfo(CommandHandler)
     {
         HelpMessage = "<mapname> - Teleport to <mapname>"
     });
     Interface.CommandManager.AddHandler("/tptm", new CommandInfo(CommandHandler)
     {
         HelpMessage = "<mapname> - Teleport to <mapname> using Aetheryte Tickets if possible"
     });
     Gui = new PluginUi(this);
     Interface.Framework.Gui.Chat.OnChatMessage += Gui.LinksWindow.ChatOnChatMessage;
 }
Пример #24
0
        public AutoVisor(DalamudPluginInterface pluginInterface)
        {
            Dalamud.Initialize(pluginInterface);
            Version         = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "";
            _commandManager = new CommandManager(Dalamud.SigScanner);
            Config          = AutoVisorConfiguration.Load();
            CheckSettings();
            VisorManager = new VisorManager(_commandManager);
            _ui          = new AutoVisorUi(this);

            if (Config.Enabled)
            {
                VisorManager.Activate();
            }

            Dalamud.Commands.AddHandler("/autovisor", new CommandInfo(OnAutoVisor)
            {
                HelpMessage = "Use to open the graphical interface.",
                ShowInHelp  = true,
            });

            Dalamud.Commands.AddHandler("/ppose", new CommandInfo(OnPPose)
            {
                HelpMessage = PPoseHelp,
                ShowInHelp  = true,
            });

            Dalamud.PluginInterface.UiBuilder.Draw         += _ui.Draw;
            Dalamud.PluginInterface.UiBuilder.OpenConfigUi += OnConfigCommandHandler;
        }
Пример #25
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;

            ci = new ClientInterface(pluginInterface.TargetModuleScanner, pluginInterface.Data);

            try {
                var macroCallPtr = pluginInterface.TargetModuleScanner.ScanText("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 48 8D 4D 28");
                macroCallHook = new Hook <MacroCallDelegate>(macroCallPtr, new MacroCallDelegate(MacroCallDetour));
                macroCallHook?.Enable();

                pluginInterface.CommandManager.AddHandler("/nextmacro", new Dalamud.Game.Command.CommandInfo(OnMacroCommandHandler)
                {
                    HelpMessage = "Executes the next macro.",
                    ShowInHelp  = true
                });
                pluginInterface.CommandManager.AddHandler("/runmacro", new Dalamud.Game.Command.CommandInfo(OnRunMacroCommand)
                {
                    HelpMessage = "Execute a macro (Not usable inside macros). - /runmacro ## [individual|shared].",
                    ShowInHelp  = true
                });

                pluginInterface.Framework.OnUpdateEvent += FrameworkUpdate;
            } catch (Exception ex) {
                PluginLog.LogError(ex.ToString());
            }
        }
Пример #26
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;

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


            this.mpTimer              = new MpTimer(this.pluginInterface);
            this.mpTimer.enable       = this.configuration.enable;
            this.mpTimer.clickThrough = this.configuration.clickThrough;
            this.mpTimer.boundaryTime = this.configuration.boundaryTime;
            this.mpTimer.combatOnly   = this.configuration.combatOnly;
            this.mpTimer.leftColor    = this.configuration.leftColor;
            this.mpTimer.rightColor   = this.configuration.rightColor;


            this.pluginInterface.CommandManager.AddHandler(commandName, new CommandInfo(OnCommand)
            {
                HelpMessage = "Open the MP Timer Config window."
            });

            this.pluginInterface.UiBuilder.OnBuildUi      += DrawUI;
            this.pluginInterface.UiBuilder.OnOpenConfigUi += (sender, args) => DrawConfigUI();
        }
Пример #27
0
        //	Initialization
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            //	Configuration
            mPluginInterface = pluginInterface;
            mConfiguration   = mPluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
            mConfiguration.Initialize(mPluginInterface);
            MemoryHandler.Init(mPluginInterface);
            ZoneInfoHandler.Init(mPluginInterface);

            //	Text Command Initialization
            mPluginInterface.CommandManager.AddHandler(mTextCommandName, new CommandInfo(ProcessTextCommand)
            {
                HelpMessage = "Performs waymark preset commands.  Use \"/pwaymark help\" for detailed usage information."
            });

            //	UI Initialization
            mUI = new PluginUI(mConfiguration, mPluginInterface);
            mPluginInterface.UiBuilder.OnBuildUi      += DrawUI;
            mPluginInterface.UiBuilder.OnOpenConfigUi += (sender, args) => DrawConfigUI();
            mUI.SetCurrentTerritoryTypeID(mPluginInterface.ClientState.TerritoryType);
            mUI.Initialize();

            //	Event Subscription
            mPluginInterface.ClientState.TerritoryChanged += OnTerritoryChanged;

            //	Tell the user if there's something out of the ordinary.
            if (!MemoryHandler.FoundSavedPresetSigs())
            {
                mPluginInterface.Framework.Gui.Chat.Print("Error initializing WaymarkPresetPlugin: Cannot write to or read from game.");
            }
        }
Пример #28
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface ?? throw new ArgumentNullException(nameof(pluginInterface), "DalamudPluginInterface cannot be null");

            this.config = (Configuration)this.pluginInterface.GetPluginConfig() ?? new Configuration();
            this.config.Initialize(this.pluginInterface);

            this.ui  = new PluginUI(config);
            this.cui = new ConfigUI(config.Opacity, config.isLocked, config);
            this.pluginInterface.UiBuilder.OnBuildUi += this.ui.Draw;
            this.pluginInterface.UiBuilder.OnBuildUi += this.cui.Draw;

            this.commandManager = new PluginCommandManager <Plugin>(this, this.pluginInterface);

            this.pluginInterface.Framework.OnUpdateEvent += this.GetData;
            Address = new PluginAddressResolver();
            Address.Setup(pluginInterface.TargetModuleScanner);
            IsActionUnlocked = Marshal.GetDelegateForFunctionPointer <IsActionUnlockedDelegate>(Address.IsActionUnlockedAddress);

            try
            {
                LoadData();
            }
            catch (Exception e)
            {
                PluginLog.Error(e, "Boom");
            }
        }
Пример #29
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            generalStopwatch.Start();
            cacheTimer.Start();
#if DEBUG
            drawConfigWindow = true;
#endif
            this.PluginInterface = pluginInterface;

            LoadConfig();

            PluginInterface.Framework.OnUpdateEvent += FrameworkUpdate;

            IconManager = new IconManager(pluginInterface);

            actionManagerStatic = pluginInterface.TargetModuleScanner.GetStaticAddressFromSig("48 89 05 ?? ?? ?? ?? C3 CC C2 00 00 CC CC CC CC CC CC CC CC CC CC CC CC CC 48 8D 0D ?? ?? ?? ?? E9 ?? ?? ?? ??");
            blueSpellBook       = (uint *)(pluginInterface.TargetModuleScanner.GetStaticAddressFromSig("0F B7 0D ?? ?? ?? ?? 84 C0") + 0x2A);
            PluginLog.Verbose($"Blue Spell Book: {(ulong) blueSpellBook:X}");

            ActionManager = new ActionManager(this, actionManagerStatic);

            pluginInterface.UiBuilder.OnOpenConfigUi += OnOpenConfigUi;

            PluginInterface.UiBuilder.OnBuildUi += this.BuildUI;

            pluginInterface.ClientState.TerritoryChanged += TerritoryChanged;
            TerritoryChanged(this, pluginInterface.ClientState.TerritoryType);

            SetupCommands();
        }
Пример #30
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            PluginInterface = pluginInterface;

            Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
            Configuration.Initialize(pluginInterface);

            RemoteConfigManager = new RemoteManager(this);
            var config = RemoteConfigManager.Config;

            Version =
                $"FP{VersionInfo.VersionNum}{VersionInfo.Type}_SP{Spotify.VersionInfo.VersionNum}{Spotify.VersionInfo.Type}_HX{config.ApiVersion}";

            PluginInterface.CommandManager.AddHandler(Command, new CommandInfo(OnCommand)
            {
                HelpMessage = "Run commands for Fantasy Player"
            });

            //Setup player
            PlayerManager = new PlayerManager(this);

            CommandManager = new CommandManager(pluginInterface, this);

            InterfaceController = new InterfaceController(this);

            PluginInterface.UiBuilder.OnBuildUi      += InterfaceController.Draw;
            PluginInterface.UiBuilder.OnOpenConfigUi += OpenConfig;
        }