Ejemplo n.º 1
0
        private void OnHelpFindOverlayButtonClicked()
        {
            const string msgCaption = "You can't find the overlay?";

            IOverlay overlay = this.overlays.FirstOrDefault(o => o.Process.MainWindowTitle == "FINAL FANTASY XIV");

            this.log.Write(LogLevel.Info, string.Format("MainWindowTitle: {0}", overlay.Process.MainWindowTitle));

            if (overlay != null)
            {
                FFXIVItemSet itemSet = overlay.MemoryReader.ReadItemSet();

                if (itemSet.Weapon != FFXIVWeapon.None)
                {
                    if (overlay.IsVisable)
                    {
                        if (MessageBox.Show(string.Format("You should see the overlay at the following position.\r\n X: {0} Y: {1}\r\nShould I highlight the overlay for a few seconds?", overlay.Position.X, overlay.Position.Y), msgCaption, MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                        {
                            overlay.Highlight(10);
                        }

                        // activate the game window
                        Native.NativeMethods.SetForegroundWindow(overlay.Process.MainWindowHandle);
                    }
                    else
                    {
                        MessageBox.Show(string.Format("You have not equipped a supported weapon.\r\n Weapon: {0}, Shield: {1}", itemSet.Weapon.ID, itemSet.Shield.ID), msgCaption, MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
                else
                {
                    MessageBox.Show(string.Format("Can't find the equipped items. You're not logged on or the memory addresses has change({0},{1}).", Process.GetProcessesByName(App.XIVProcessName).Length.ToString(), Process.GetProcessesByName(App.XIV_DX11_ProcessName).Length.ToString()), msgCaption, MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else if (Process.GetProcessesByName(App.XIVProcessName).Any() || Process.GetProcessesByName(App.XIV_DX11_ProcessName).Any())
            {
                MessageBox.Show("The overlay was never created. It looks like a bug. Please look into the logs to get more details.", msgCaption, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                MessageBox.Show("There is no FFXIV running. Start the game and try again.", msgCaption, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }