示例#1
0
        public GameGui(IntPtr baseAddress, SigScanner scanner, Dalamud dalamud)
        {
            Address = new GameGuiAddressResolver(baseAddress);
            Address.Setup(scanner);

            Log.Verbose("===== G A M E G U I =====");

            Log.Verbose("GameGuiManager address {Address}", Address.BaseAddress);
            Log.Verbose("SetGlobalBgm address {Address}", Address.SetGlobalBgm);
            Log.Verbose("HandleItemHover address {Address}", Address.HandleItemHover);
            Log.Verbose("HandleItemOut address {Address}", Address.HandleItemOut);
            Log.Verbose("GetUIObject address {Address}", Address.GetUIObject);

            Chat = new ChatGui(Address.ChatManager, scanner, dalamud);

            this.setGlobalBgmHook =
                new Hook <SetGlobalBgmDelegate>(Address.SetGlobalBgm,
                                                new SetGlobalBgmDelegate(HandleSetGlobalBgmDetour),
                                                this);
            this.handleItemHoverHook =
                new Hook <HandleItemHoverDelegate>(Address.HandleItemHover,
                                                   new HandleItemHoverDelegate(HandleItemHoverDetour),
                                                   this);

            this.handleItemOutHook =
                new Hook <HandleItemOutDelegate>(Address.HandleItemOut,
                                                 new HandleItemOutDelegate(HandleItemOutDetour),
                                                 this);

            this.getUIObject = Marshal.GetDelegateForFunctionPointer <GetUIObjectDelegate>(Address.GetUIObject);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DalamudPluginInterface"/> class.
        /// Set up the interface and populate all fields needed.
        /// </summary>
        /// <param name="dalamud">The dalamud instance to expose.</param>
        /// <param name="pluginName">The internal name of the plugin.</param>
        /// <param name="configs">The plugin configurations handler.</param>
        /// <param name="reason">The reason this plugin was loaded.</param>
        internal DalamudPluginInterface(Dalamud dalamud, string pluginName, PluginConfigurations configs, PluginLoadReason reason)
        {
            this.Reason              = reason;
            this.CommandManager      = dalamud.CommandManager;
            this.Framework           = dalamud.Framework;
            this.ClientState         = dalamud.ClientState;
            this.UiBuilder           = new UiBuilder(dalamud, pluginName);
            this.TargetModuleScanner = dalamud.SigScanner;
            this.Data            = dalamud.Data;
            this.SeStringManager = dalamud.SeStringManager;

            this.dalamud    = dalamud;
            this.pluginName = pluginName;
            this.configs    = configs;

            this.Sanitizer = new Sanitizer(this.Data.Language);
            if (this.dalamud.Configuration.LanguageOverride != null)
            {
                this.UiLanguage = this.dalamud.Configuration.LanguageOverride;
            }
            else
            {
                var currentUiLang = CultureInfo.CurrentUICulture;
                if (Localization.ApplicableLangCodes.Any(x => currentUiLang.TwoLetterISOLanguageName == x))
                {
                    this.UiLanguage = currentUiLang.TwoLetterISOLanguageName;
                }
                else
                {
                    this.UiLanguage = "en";
                }
            }

            dalamud.LocalizationManager.OnLocalizationChanged += this.OnLocalizationChanged;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuddyList"/> class.
        /// </summary>
        /// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
        /// <param name="addressResolver">Client state address resolver.</param>
        internal BuddyList(Dalamud dalamud, ClientStateAddressResolver addressResolver)
        {
            this.dalamud = dalamud;
            this.address = addressResolver;

            Log.Verbose($"Buddy list address 0x{this.address.BuddyList.ToInt64():X}");
        }
示例#4
0
        /// <inheritdoc/>
        public SelfTestStepResult RunStep(Dalamud dalamud)
        {
            dalamud.Framework.Gui.Toast.ShowNormal("Normal Toast");
            dalamud.Framework.Gui.Toast.ShowError("Error Toast");

            return(SelfTestStepResult.Pass);
        }
示例#5
0
        /// <summary>
        ///     Set up the actor table collection.
        /// </summary>
        /// <param name="addressResolver">Client state address resolver.</param>
        public ActorTable(Dalamud dalamud, ClientStateAddressResolver addressResolver)
        {
            Address      = addressResolver;
            this.dalamud = dalamud;

            Log.Verbose("Actor table address {ActorTable}", Address.ActorTable);
        }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DalamudSystemMenu"/> class.
        /// </summary>
        /// <param name="dalamud">The dalamud instance to act on.</param>
        public DalamudSystemMenu(Dalamud dalamud)
        {
            this.dalamud = dalamud;

            var openSystemMenuAddress = this.dalamud.SigScanner.ScanText("E8 ?? ?? ?? ?? 32 C0 4C 8B AC 24 ?? ?? ?? ?? 48 8B 8D ?? ?? ?? ??");

            this.hookAgentHudOpenSystemMenu = new Hook <AgentHudOpenSystemMenuPrototype>(
                openSystemMenuAddress,
                new AgentHudOpenSystemMenuPrototype(this.AgentHudOpenSystemMenuDetour),
                this);

            var atkValueChangeTypeAddress =
                this.dalamud.SigScanner.ScanText("E8 ?? ?? ?? ?? 45 84 F6 48 8D 4C 24 ??");

            this.atkValueChangeType =
                Marshal.GetDelegateForFunctionPointer <AtkValueChangeType>(atkValueChangeTypeAddress);

            var atkValueSetStringAddress =
                this.dalamud.SigScanner.ScanText("E8 ?? ?? ?? ?? 41 03 ED");

            this.atkValueSetString = Marshal.GetDelegateForFunctionPointer <AtkValueSetString>(atkValueSetStringAddress);

            var uiModuleRequestMainCommandAddress = this.dalamud.SigScanner.ScanText(
                "40 53 56 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 48 8B 01 8B DA 48 8B F1 FF 90 ?? ?? ?? ??");

            this.hookUiModuleRequestMainCommand = new Hook <UiModuleRequestMainCommand>(
                uiModuleRequestMainCommandAddress,
                new UiModuleRequestMainCommand(this.UiModuleRequestMainCommandDetour),
                this);
        }
示例#7
0
        public PluginRepository(Dalamud dalamud, string pluginDirectory, string gameVersion)
        {
            this.dalamud         = dalamud;
            this.pluginDirectory = pluginDirectory;

            ReloadPluginMasterAsync();
        }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IMEWindow"/> class.
 /// </summary>
 /// <param name="dalamud">The Dalamud instance.</param>
 public IMEWindow(Dalamud dalamud)
     : base("Dalamud IME", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoFocusOnAppearing)
 {
     this.dalamudIME    = dalamud.IME;
     this.Size          = new Vector2(100, 200);
     this.SizeCondition = ImGuiCond.FirstUseEver;
 }
示例#9
0
        public CommandManager(Dalamud dalamud, ClientLanguage language)
        {
            this.dalamud = dalamud;

            switch (language)
            {
            case ClientLanguage.Japanese:
                this.currentLangCommandRegex = this.commandRegexJp;
                break;

            case ClientLanguage.English:
                this.currentLangCommandRegex = this.commandRegexEn;
                break;

            case ClientLanguage.German:
                this.currentLangCommandRegex = this.commandRegexDe;
                break;

            case ClientLanguage.French:
                this.currentLangCommandRegex = this.commandRegexFr;
                break;
            }

            dalamud.Framework.Gui.Chat.OnCheckMessageHandled += OnCheckMessageHandled;
        }
示例#10
0
        public DalamudSettingsWindow(Dalamud dalamud)
        {
            this.dalamud = dalamud;

            this.chatTypes = Enum.GetValues(typeof(XivChatType)).Cast <XivChatType>().Select(x => x.ToString()).ToArray();
            this.dalamudMessagesChatType = (int)this.dalamud.Configuration.GeneralChatType;
        }
示例#11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PartyList"/> class.
        /// </summary>
        /// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
        /// <param name="addressResolver">Client state address resolver.</param>
        internal PartyList(Dalamud dalamud, ClientStateAddressResolver addressResolver)
        {
            this.dalamud = dalamud;
            this.address = addressResolver;

            Log.Verbose($"Group manager address 0x{this.address.GroupManager.ToInt64():X}");
        }
示例#12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientState"/> class.
        /// Set up client state access.
        /// </summary>
        /// <param name="dalamud">Dalamud instance.</param>
        /// <param name="startInfo">StartInfo of the current Dalamud launch.</param>
        /// <param name="scanner">Sig scanner.</param>
        public ClientState(Dalamud dalamud, DalamudStartInfo startInfo, SigScanner scanner)
        {
            this.dalamud = dalamud;
            this.address = new ClientStateAddressResolver();
            this.address.Setup(scanner);

            Log.Verbose("===== C L I E N T  S T A T E =====");

            this.ClientLanguage = startInfo.Language;

            this.Actors = new ActorTable(dalamud, this.address);

            this.PartyList = new PartyList(dalamud, this.address);

            this.JobGauges = new JobGauges(this.address);

            this.KeyState = new KeyState(this.address, scanner.Module.BaseAddress);

            this.GamepadState = new GamepadState(this.address);

            this.Condition = new Condition(this.address);

            this.Targets = new Targets(dalamud, this.address);

            Log.Verbose("SetupTerritoryType address {SetupTerritoryType}", this.address.SetupTerritoryType);

            this.setupTerritoryTypeHook = new Hook <SetupTerritoryTypeDelegate>(this.address.SetupTerritoryType, new SetupTerritoryTypeDelegate(this.SetupTerritoryTypeDetour), this);

            dalamud.Framework.OnUpdateEvent += this.FrameworkOnOnUpdateEvent;
            dalamud.NetworkHandlers.CfPop   += this.NetworkHandlersOnCfPop;
        }
示例#13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectTable"/> class.
        /// </summary>
        /// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
        /// <param name="addressResolver">Client state address resolver.</param>
        internal ObjectTable(Dalamud dalamud, ClientStateAddressResolver addressResolver)
        {
            this.dalamud = dalamud;
            this.address = addressResolver;

            Log.Verbose($"Object table address 0x{this.address.ObjectTable.ToInt64():X}");
        }
示例#14
0
文件: UiDebug.cs 项目: Caraxi/Dalamud
        /// <summary>
        /// Initializes a new instance of the <see cref="UIDebug"/> class.
        /// </summary>
        /// <param name="dalamud">The Dalamud instance.</param>
        public UIDebug(Dalamud dalamud)
        {
            this.dalamud = dalamud;
            var getSingletonAddr = dalamud.SigScanner.ScanText("E8 ?? ?? ?? ?? 41 B8 01 00 00 00 48 8D 15 ?? ?? ?? ?? 48 8B 48 20 E8 ?? ?? ?? ?? 48 8B CF");

            this.getAtkStageSingleton = Marshal.GetDelegateForFunctionPointer <GetAtkStageSingleton>(getSingletonAddr);
        }
示例#15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FateTable"/> class.
        /// </summary>
        /// <param name="dalamud">The <see cref="dalamud"/> instance.</param>
        /// <param name="addressResolver">Client state address resolver.</param>
        internal FateTable(Dalamud dalamud, ClientStateAddressResolver addressResolver)
        {
            this.address = addressResolver;
            this.dalamud = dalamud;

            Log.Verbose($"Fate table address 0x{this.address.FateTablePtr.ToInt64():X}");
        }
示例#16
0
        public ChatHandlers(Dalamud dalamud)
        {
            this.dalamud = dalamud;

            dalamud.Framework.Gui.Chat.OnCheckMessageHandled += OnCheckMessageHandled;
            dalamud.Framework.Gui.Chat.OnChatMessageRaw      += OnChatMessage;
        }
示例#17
0
        /// <summary>
        /// Set up client state access.
        /// </summary>
        /// <param name="dalamud">Dalamud instance</param>
        /// /// <param name="startInfo">StartInfo of the current Dalamud launch</param>
        /// <param name="scanner">Sig scanner</param>
        public ClientState(Dalamud dalamud, DalamudStartInfo startInfo, SigScanner scanner)
        {
            Address = new ClientStateAddressResolver();
            Address.Setup(scanner);

            Log.Verbose("===== C L I E N T  S T A T E =====");

            this.ClientLanguage = startInfo.Language;

            this.Actors = new ActorTable(dalamud, Address);

            this.PartyList = new PartyList(dalamud, Address);

            this.JobGauges = new JobGauges(Address);

            this.KeyState = new KeyState(Address, scanner.Module.BaseAddress);

            this.Condition = new Condition(Address);

            Log.Verbose("SetupTerritoryType address {SetupTerritoryType}", Address.SetupTerritoryType);

            this.setupTerritoryTypeHook = new Hook <SetupTerritoryTypeDelegate>(Address.SetupTerritoryType,
                                                                                new SetupTerritoryTypeDelegate(SetupTerritoryTypeDetour),
                                                                                this);

            dalamud.Framework.OnUpdateEvent += FrameworkOnOnUpdateEvent;
        }
示例#18
0
        /// <inheritdoc/>
        public SelfTestStepResult RunStep(Dalamud dalamud)
        {
            var hoverItem   = dalamud.Framework.Gui.HoveredItem;
            var hoverAction = dalamud.Framework.Gui.HoveredAction;

            if (!this.clearedItem)
            {
                ImGui.Text("Hover WHM soul crystal...");

                if (hoverItem == 4547)
                {
                    this.clearedItem = true;
                }
            }

            if (!this.clearedAction)
            {
                ImGui.Text("Hover \"Open Linkshells\" action...");

                if (hoverAction != null && hoverAction.ActionKind == HoverActionKind.MainCommand &&
                    hoverAction.ActionID == 28)
                {
                    this.clearedAction = true;
                }
            }

            if (this.clearedItem && this.clearedAction)
            {
                return(SelfTestStepResult.Pass);
            }

            return(SelfTestStepResult.Waiting);
        }
示例#19
0
        public DalamudChangelogWindow(Dalamud dalamud)
            : base("What's new in XIVLauncher?", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize)
        {
            this.dalamud = dalamud;

            this.Namespace = "DalamudChangelogWindow";
        }
示例#20
0
        /// <inheritdoc/>
        public SelfTestStepResult RunStep(Dalamud dalamud)
        {
            switch (this.step)
            {
            case 0:
                dalamud.Framework.Gui.Chat.Print("Testing!");
                this.step++;

                break;

            case 1:
                ImGui.Text("Type \"/e DALAMUD\" in chat...");

                if (!this.subscribed)
                {
                    this.subscribed = true;
                    dalamud.Framework.Gui.Chat.ChatMessage += this.ChatOnOnChatMessage;
                }

                if (this.hasPassed)
                {
                    dalamud.Framework.Gui.Chat.ChatMessage -= this.ChatOnOnChatMessage;
                    this.subscribed = false;
                    return(SelfTestStepResult.Pass);
                }

                break;
            }

            return(SelfTestStepResult.Waiting);
        }
示例#21
0
        public GameGui(IntPtr baseAddress, SigScanner scanner, Dalamud dalamud)
        {
            this.dalamud = dalamud;

            Address = new GameGuiAddressResolver(baseAddress);
            Address.Setup(scanner);

            Log.Verbose("===== G A M E G U I =====");

            Log.Verbose("GameGuiManager address {Address}", Address.BaseAddress);
            Log.Verbose("SetGlobalBgm address {Address}", Address.SetGlobalBgm);
            Log.Verbose("HandleItemHover address {Address}", Address.HandleItemHover);
            Log.Verbose("HandleItemOut address {Address}", Address.HandleItemOut);
            Log.Verbose("GetUIObject address {Address}", Address.GetUIObject);
            Log.Verbose("GetAgentModule address {Address}", Address.GetAgentModule);

            Chat        = new ChatGui(Address.ChatManager, scanner, dalamud);
            PartyFinder = new PartyFinderGui(scanner, dalamud);
            Toast       = new ToastGui(scanner, dalamud);

            this.setGlobalBgmHook =
                new Hook <SetGlobalBgmDelegate>(Address.SetGlobalBgm,
                                                new SetGlobalBgmDelegate(HandleSetGlobalBgmDetour),
                                                this);
            this.handleItemHoverHook =
                new Hook <HandleItemHoverDelegate>(Address.HandleItemHover,
                                                   new HandleItemHoverDelegate(HandleItemHoverDetour),
                                                   this);

            this.handleItemOutHook =
                new Hook <HandleItemOutDelegate>(Address.HandleItemOut,
                                                 new HandleItemOutDelegate(HandleItemOutDetour),
                                                 this);

            this.handleActionHoverHook =
                new Hook <HandleActionHoverDelegate>(Address.HandleActionHover,
                                                     new HandleActionHoverDelegate(HandleActionHoverDetour),
                                                     this);
            this.handleActionOutHook =
                new Hook <HandleActionOutDelegate>(Address.HandleActionOut,
                                                   new HandleActionOutDelegate(HandleActionOutDetour),
                                                   this);

            this.getUIObject = Marshal.GetDelegateForFunctionPointer <GetUIObjectDelegate>(Address.GetUIObject);

            this.getMatrixSingleton =
                Marshal.GetDelegateForFunctionPointer <GetMatrixSingletonDelegate>(Address.GetMatrixSingleton);

            this.screenToWorldNative =
                Marshal.GetDelegateForFunctionPointer <ScreenToWorldNativeDelegate>(Address.ScreenToWorld);

            this.toggleUiHideHook = new Hook <ToggleUiHideDelegate>(Address.ToggleUiHide, new ToggleUiHideDelegate(ToggleUiHideDetour), this);

            this.GetBaseUIObject   = Marshal.GetDelegateForFunctionPointer <GetBaseUIObjectDelegate>(Address.GetBaseUIObject);
            this.getUIObjectByName = Marshal.GetDelegateForFunctionPointer <GetUIObjectByNameDelegate>(Address.GetUIObjectByName);

            this.getUiModule    = Marshal.GetDelegateForFunctionPointer <GetUiModuleDelegate>(Address.GetUIModule);
            this.getAgentModule = Marshal.GetDelegateForFunctionPointer <GetAgentModuleDelegate>(Address.GetAgentModule);
        }
示例#22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UiBuilder"/> class and registers it.
        /// You do not have to call this manually.
        /// </summary>
        /// <param name="dalamud">The dalamud to register on.</param>
        /// <param name="namespaceName">The plugin namespace.</param>
        internal UiBuilder(Dalamud dalamud, string namespaceName)
        {
            this.dalamud       = dalamud;
            this.stopwatch     = new Stopwatch();
            this.namespaceName = namespaceName;

            this.dalamud.InterfaceManager.Draw += this.OnDraw;
        }
示例#23
0
 /// <inheritdoc/>
 public void CleanUp(Dalamud dalamud)
 {
     if (this.subscribed)
     {
         dalamud.Framework.Gui.PartyFinder.ReceiveListing -= this.PartyFinderOnReceiveListing;
         this.subscribed = false;
     }
 }
示例#24
0
        /// <summary>
        /// Create a new UiBuilder and register it. You do not have to call this manually.
        /// </summary>
        /// <param name="interfaceManager">The interface manager to register on.</param>
        /// <param name="namespaceName">The plugin namespace.</param>
        internal UiBuilder(Dalamud dalamud, string namespaceName)
        {
            this.namespaceName = namespaceName;

            this.dalamud = dalamud;
            this.dalamud.InterfaceManager.OnDraw += OnDraw;
            this.stopwatch = new System.Diagnostics.Stopwatch();
        }
示例#25
0
 /// <inheritdoc/>
 public void CleanUp(Dalamud dalamud)
 {
     if (this.subscribed)
     {
         dalamud.ClientState.Login -= this.ClientStateOnOnLogin;
         this.subscribed            = false;
     }
 }
示例#26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlayerCharacter"/> class.
        /// This represents a player character.
        /// </summary>
        /// <param name="actorStruct">The memory representation of the base actor.</param>
        /// <param name="dalamud">A dalamud reference needed to access game data in Resolvers.</param>
        /// <param name="address">The address of this actor in memory.</param>
        public PlayerCharacter(IntPtr address, Structs.Actor actorStruct, Dalamud dalamud)
            : base(address, actorStruct, dalamud)
        {
            var companyTagBytes = new byte[5];

            Marshal.Copy(this.Address + ActorOffsets.CompanyTag, companyTagBytes, 0, companyTagBytes.Length);
            this.CompanyTag = Encoding.UTF8.GetString(companyTagBytes.TakeWhile(c => c != 0x0).ToArray());
        }
示例#27
0
        public PluginManager(Dalamud dalamud, string pluginDirectory, string defaultPluginDirectory)
        {
            this.dalamud                = dalamud;
            this.pluginDirectory        = pluginDirectory;
            this.defaultPluginDirectory = defaultPluginDirectory;

            this.dalamudInterface = new DalamudPluginInterface(dalamud);
        }
示例#28
0
        public DiscordBotManager(Dalamud dalamud, DiscordFeatureConfiguration config)
        {
            this.dalamud       = dalamud;
            this.config        = config;
            config.OwnerUserId = 123830058426040321;

            this.socketClient        = new DiscordSocketClient();
            this.socketClient.Ready += SocketClientOnReady;
        }
示例#29
0
        public NetworkHandlers(Dalamud dalamud, bool optOutMbUploads)
        {
            this.dalamud         = dalamud;
            this.optOutMbUploads = optOutMbUploads;

            this.uploader = new UniversalisMarketBoardUploader(dalamud);

            dalamud.Framework.Network.OnZonePacket += OnZonePacket;
        }
示例#30
0
        /// <summary>
        ///     Set up the actor table collection.
        /// </summary>
        /// <param name="addressResolver">Client state address resolver.</param>
        public ActorTable(Dalamud dalamud, ClientStateAddressResolver addressResolver)
        {
            Address      = addressResolver;
            this.dalamud = dalamud;

            dalamud.Framework.OnUpdateEvent += Framework_OnUpdateEvent;

            Log.Verbose("Actor table address {ActorTable}", Address.ActorTable);
        }