Exemplo n.º 1
0
        private void ComboInParty_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!_canWriteData)
            {
                return;
            }

            byte partyState = 0;

            switch (ComboInParty.SelectedIndex)
            {
            case 0:
                partyState = 17;
                break;

            case 1:
                partyState = 16;
                break;

            case 2:
                partyState = 0;
                break;
            }
            var charOffset = _offsetPartyStats + _characterIndex * _blockSize;
            var offset     = (int)Marshal.OffsetOf <PartyMember>("InParty") + charOffset;

            GameMemory.Write(offset, partyState, false);

            Refresh(_characterIndex);
        }
Exemplo n.º 2
0
        public static void SetNodeActivation(int nodeIndex, byte nodeActivation)
        {
            var nodeOffset = _offsetSphereGrid + 0x818 + nodeIndex * _sizeSphereGridNode;
            var dataOffset = Marshal.OffsetOf <SphereGridNode>("ActivatedBy");

            GameMemory.Write((int)(dataOffset + nodeOffset), nodeActivation, false);
        }
Exemplo n.º 3
0
        private void FFX2_Click(object sender, RoutedEventArgs e)
        {
            _configFlyout.IsOpen = false;
            var processSelect = new ProcessSelectWindow("FFX-2")
            {
                Owner = this
            };

            processSelect.ShowDialog();

            if (processSelect.DialogResult == true)
            {
                Hide();
                var FFX2Editor = new FFX2Editor();
                FFX2Editor.ShowDialog();
                GameMemory.Detach();
                if (Settings.Default.CloseWithGame)
                {
                    Environment.Exit(0);
                }

                Show();
                Topmost = true;
                Topmost = false;
            }
        }
Exemplo n.º 4
0
        //
        // set player position
        //
        private void SetPlayerPosition()
        {
            if (!Scanning)
            {
                return;
            }

            player = GameMemory.GetPlayer();
            if (player.Name.Length > 0 && (int)Map.ID > 0)
            {
                SetPlayerIcon(player);

                try
                {
                    double x = Math.Round(MapHelper.ConvertCoordinatesIntoMapPosition((double)Map.SizeFactor, (double)Map.OffsetX, player.X), 2);
                    double y = Math.Round(MapHelper.ConvertCoordinatesIntoMapPosition((double)Map.SizeFactor, (double)Map.OffsetY, player.Y), 2);

                    // set map pos
                    mappos.Text = String.Format("x {0} / y {1}  -  [{2} / {3}]   -   [OX: {4} / OY: {5}]",
                                                x, y, player.X, player.Y, Map.OffsetX, Map.OffsetY
                                                );
                }
                catch { }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Request the latest map
        /// </summary>
        public void RequestLatestMap()
        {
            // show loading
            uint MapId = GameMemory.GetPlayer().MapID;

            API.GetMapImage(MapId);
        }
Exemplo n.º 6
0
        public static void RemoveCharacter(Character character)
        {
            // Check if character is in the party
            var partyList = Party.GetActiveParty();
            int partySize = partyList.Length;
            int charaPos  = Array.IndexOf(partyList, character);

            // If in party
            if (charaPos != -1)
            {
                // Remove and move all party members up
                for (int i = charaPos; i < partySize - 1; i++)
                {
                    partyList[i] = partyList[i + 1];
                }
                // Empty last slot
                partyList[partySize - 1] = Character.None;
            }
            else
            {
                return;
            }

            // Convert party list to array of byte
            var partyBytes = new byte[partySize];

            for (int i = 0; i < partySize; i++)
            {
                partyBytes[i] = (byte)partyList[i];
            }

            // Write changes to memory
            GameMemory.Write(_offsetPartyList, partyBytes, false);
        }
Exemplo n.º 7
0
        public static void OnLoad()
        {
            if (!(GameFunctions.Init() && GameMemory.Init() && GameOffsets.Init()))
            {
                Game.DisplayNotification($"~r~[ERROR] Spotlight: ~s~Failed to initialize, unloading...");
                Game.LogTrivial($"[ERROR] Failed to initialize, unloading...");
                Game.UnloadActivePlugin();
            }
            WinFunctions.CopyTlsValues(WinFunctions.GetProcessMainThreadId(), WinFunctions.GetCurrentThreadId(), GameOffsets.TlsAllocator0, GameOffsets.TlsAllocator1, GameOffsets.TlsAllocator2);

            bool  on       = false;
            Ped   p        = Game.LocalPlayer.Character;
            ulong shadowId = Render.GenerateShadowId();

            while (true)
            {
                GameFiber.Yield();
                if (Game.IsKeyDown(System.Windows.Forms.Keys.NumPad0))
                {
                    on = !on;
                }
                if (p && on)
                {
                    Game.DisplayHelp("Light: ~g~On");
                    Render.SpotLight(p.GetOffsetPositionFront(1), p.Direction,
                                     eLightFlags.CanRenderUnderground | eLightFlags.EnableVolume | eLightFlags.DisableSpecular,
                                     30, 45, 0.06f, 0.175f, 45, 5, 8.25f, System.Drawing.Color.Red, shadowId);
                }
            }
        }
Exemplo n.º 8
0
        public override void OnGameAttached(GameState state)
        {
            base.OnGameAttached(state);
            _cmdHandler.Init(state);

            ProcessModuleWow64Safe server = state.GetModule("server.dll");

            var scanner = new SignatureScanner(state.GameProcess, server.BaseAddress, server.ModuleMemorySize);

            _getGlobalNameFuncPtr = scanner.Scan(new SigScanTarget("55 8B EC 51 FF 75 ?? 8D 45 ??"));
            _roHandler            = new RemoteOpsHandler(state.GameProcess);

            if (GameMemory.GetBaseEntityMemberOffset("m_iHealth", state.GameProcess, scanner, out _baseEntityHealthOffset))
            {
                Debug.WriteLine("CBaseEntity::m_iHealth offset = 0x" + _baseEntityHealthOffset.ToString("X"));
            }

            if (server.ModuleMemorySize < _serverModernModuleSize)
            {
                _ebEndCommand.BValue = true;
                // for mod, eb's final map name is different
                if (server.ModuleMemorySize <= _serverModModuleSize)
                {
                    _ebEndMap = "bm_c3a2h";
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// setup the application
        /// </summary>
        private void SetupApplication()
        {
            Logger.Geset();

            Logger.Add("================================================");
            Logger.Add("FINAL FANTASY XIV MAPPY");
            Logger.Add("Built by: Vekien");
            Logger.Add("Discord: https://discord.gg/MFFVHWC");
            Logger.Add("Source: https://github.com/xivapi/xivapi-mappy");
            Logger.Add("");
            Logger.Add("This app reads the FFXIV Memory to look for ");
            Logger.Add("enemies and NPCs. Data of these findings are");
            Logger.Add("stored in the /logs/ folder, you can use this");
            Logger.Add("data in your own applications! You do not need a");
            Logger.Add("XIVAPI Key for personal usage.");
            Logger.Add("If you have any problems, please ask on Discord!");
            Logger.Add("================================================");
            Logger.Add("Connecting to the FFXIV Game Memory ...");
            SetStatus("Connecting ...");

            if (GameMemory.SetGameProcess())
            {
                InitializeTimer.Enabled = true;
            }
            else
            {
                Logger.Add("Could not connect to the games memory, stupid question... Have you started FFXIV and logged in?");
                SetStatus("Could not connect to FFXIV Game Memory!");
            }
        }
Exemplo n.º 10
0
        public static void WriteBytes(EntityType entityType, int entityIndex, string entityDataType, byte dataToWrite)
        {
            var entityOffset = GetEntityOffset(entityType, entityIndex);
            var dataOffset   = entityOffset + (int)Marshal.OffsetOf <BattleEntityData>(entityDataType);

            GameMemory.Write(dataOffset, dataToWrite, false);
        }
Exemplo n.º 11
0
        private void ComboEquipmentSlots_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_refreshing)
            {
                return;
            }
            var newSlots = (sender as ComboBox).SelectedIndex;

            for (var i = 0; i < 4; i++)
            {
                var abilityButton = AbilityPanel.Children[i] as Button;
                if (abilityButton == null)
                {
                    continue;
                }

                if (i >= newSlots)
                {
                    abilityButton.Visibility = Visibility.Collapsed;
                    WriteAbility(_selectedItem, i, 0xFF);
                }
                else
                {
                    abilityButton.Visibility = Visibility.Visible;
                }
            }

            var offset = Equipment.Offset + _selectedItem * Equipment.BlockLength + (int)Marshal.OffsetOf <EquipmentItem>("AbilityCount");

            GameMemory.Write(offset, (byte)newSlots, false);

            RefreshSelectedItem();
        }
Exemplo n.º 12
0
        private void SharedAPThread()
        {
            while (true)
            {
                // Shared AP mod
                if (_sharedApEnabled)
                {
                    if (!GameMemory.IsAttached)
                    {
                        break;
                    }
                    try
                    {
                        Dispatcher.Invoke(UpdateSharedAPState);
                    }
                    catch (Exception ex)
                    {
                        // App probably exited, silent exception
                    }

                    var writeBuffer = new byte[8];
                    for (var i = 0; i < 8; i++)
                    {
                        writeBuffer[i] = _sharedApState[i];
                    }

                    GameMemory.Write(_offsetInBattle, writeBuffer);
                    GameMemory.Write(_offsetGainedAp, writeBuffer);
                }

                Thread.Sleep(10);
            }
        }
Exemplo n.º 13
0
        static APISpotlightMgr()
        {
            bool gameFnInit  = GameFunctions.Init();
            bool gameMemInit = GameMemory.Init();

            if (!gameFnInit || !gameMemInit)
            {
                string str = "";
                if (!gameFnInit)
                {
                    str += nameof(GameFunctions);

                    if (!gameMemInit)
                    {
                        str += " and ";
                        str += nameof(GameMemory);
                    }
                }
                else if (!gameMemInit)
                {
                    str += nameof(GameMemory);
                }

                Game.LogTrivial($"[ERROR] Spotlight: Failed to initialize {str}");
            }

            spotlights = new List <APISpotlight>();
            fiber      = GameFiber.StartNew(UpdateSpotlights, "Spotlight API Manager");

            finalizer = new StaticFinalizer(Dispose);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Memory scan timer
        /// </summary>
        private void ScanIntervalAction()
        {
            // if scanning disabled, do nothing
            if (Scanning)
            {
                ActorItem player = GameMemory.GetPlayer();

                // if player has moved map, disable memory timer
                if (TrackingPlayer.HasMovedMap())
                {
                    // clear markers
                    TrackingEnemies.Clear();
                    TrackingNpcs.Clear();

                    // disable tickers
                    SetScanningState(false);
                    MapViewer.SetMapCountdown("Zoning ...");

                    // get the map viewer to request latest map,
                    // once it has done it, it will renable memory timer
                    MapViewer.RequestLatestMap();
                }
                else
                {
                    // scan for enemies
                    TrackingEnemies.Scan();
                    TrackingNpcs.Scan();
                }
            }
        }
Exemplo n.º 15
0
        static APISpotlightMgr()
        {
            bool gameFnInit  = GameFunctions.Init();
            bool gameMemInit = GameMemory.Init();

            if (!gameFnInit || !gameMemInit)
            {
                string str = "";
                if (!gameFnInit)
                {
                    str += nameof(GameFunctions);

                    if (!gameMemInit)
                    {
                        str += " and ";
                        str += nameof(GameMemory);
                    }
                }
                else if (!gameMemInit)
                {
                    str += nameof(GameMemory);
                }

                Game.LogTrivial($"[ERROR] Spotlight: Failed to initialize {str}");
            }

            BaseSpotlight.CoronaPositionPtr  = (NativeVector3 *)Game.AllocateMemory(sizeof(NativeVector3) * 2);
            BaseSpotlight.CoronaDirectionPtr = BaseSpotlight.CoronaPositionPtr++;

            spotlights = new List <APISpotlight>();
            fiber      = GameFiber.StartNew(UpdateSpotlights, "Spotlight API Manager");

            finalizer = new StaticFinalizer(Dispose);
        }
Exemplo n.º 16
0
        public static void SetPartyMemberAttribute <T>(int partyIndex, string attributeName, T value)
        {
            var offset          = _offsetParty + partyIndex * _blockLength;
            var attributeOffset = Marshal.OffsetOf <PartyMember>(attributeName);

            GameMemory.Write((int)attributeOffset + offset, value, false);
        }
Exemplo n.º 17
0
        private void ButtonEquipmentAppearance_OnClick(object sender, RoutedEventArgs e)
        {
            var currentChara = _currentItem.Character;

            if (currentChara > 6)
            {
                currentChara = 0;
            }

            var searchList = new List <string>();

            for (var n = 0; n < EquipAppearance.EquipAppearances.Length; n++)
            {
                searchList.Add(
                    $"{EquipAppearance.EquipAppearances[n].ID.ToString("X2")} {EquipAppearance.EquipAppearances[n].Name}");
            }

            var currentAppearance = _currentItem.Appearance;

            var searchDialog   = new SearchDialog(searchList, currentAppearance.ToString("X4"), false);
            var searchComplete = searchDialog.ShowDialog();

            if (!searchComplete.Value)
            {
                return;
            }
            var searchIndex = searchDialog.ResultIndex;
            var searchItem  = EquipAppearance.EquipAppearances[searchIndex];

            var offset = Equipment.Offset + _selectedItem * Equipment.BlockLength + (int)Marshal.OffsetOf <EquipmentItem>("Appearance");

            GameMemory.Write(offset, (ushort)searchItem.ID, false);

            RefreshSelectedItem();
        }
Exemplo n.º 18
0
        public static void SetOverdriveCounter(int charIndex, int odIndex, int odCount)
        {
            var odOffset = StructHelper.GetFieldOffset <PartyMember>("OverdriveWarrior",
                                                                     _offsetParty + Marshal.SizeOf <PartyMember>() * charIndex + OverdriveModes[odIndex].BitIndex * 2);

            GameMemory.Write(odOffset, BitConverter.GetBytes((ushort)odCount), false);
        }
Exemplo n.º 19
0
        public static void SetNodeType(int nodeIndex, int nodeType)
        {
            var nodeOffset = _offsetSphereGrid + 0x818 + nodeIndex * _sizeSphereGridNode;
            var dataOffset = Marshal.OffsetOf <SphereGridNode>("NodeType");

            GameMemory.Write((int)(dataOffset + nodeOffset), (ushort)nodeType, false);
        }
Exemplo n.º 20
0
        public static byte[] GetTeamSizes()
        {
            var bdPointer1 = OffsetScanner.GetOffset(GameOffset.FFX_BlitzballTeamData);
            var bdPointer2 = GameMemory.Read <int>(bdPointer1, false);
            var bdPointer  = GameMemory.Read <int>(bdPointer2 + 0x2C, false);

            return(GameMemory.Read <byte>(bdPointer + 0xA88, 6, false));
        }
Exemplo n.º 21
0
        public static void SetTeamSize(int teamIndex, byte teamSize)
        {
            var bdPointer1 = OffsetScanner.GetOffset(GameOffset.FFX_BlitzballTeamData);
            var bdPointer2 = GameMemory.Read <int>(bdPointer1, false);
            var bdPointer  = GameMemory.Read <int>(bdPointer2 + 0x2C, false);

            GameMemory.Write(bdPointer + 0xA88 + teamIndex, teamSize, false);
        }
Exemplo n.º 22
0
        /// <summary>
        /// Mark a map as complete
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnMarkComplete_Click(object sender, EventArgs e)
        {
            Logger.Add("Manually submitting XIVAPI data ...");
            TrackingEnemies.SubmitData();
            TrackingNpcs.SubmitData();

            Logger.Add("Marking the map as complete!");
            API.MarkMapComplete(GameMemory.GetPlayer().MapID);
        }
Exemplo n.º 23
0
        private void ButtonMax_Click(object sender, RoutedEventArgs e)
        {
            var charOffset  = _offsetPartyStats + _characterIndex * _sizePartyMember;
            var levelOffset = (int)Marshal.OffsetOf <PartyMember>("OverdriveLevel") + charOffset;
            var currentMax  = GameMemory.Read <byte>(levelOffset, 2, false);

            GameMemory.Write <byte>(levelOffset, currentMax[1], false);
            Refresh(_characterIndex);
        }
Exemplo n.º 24
0
        private bool PickCardLogic(out ICollection <IBotTask> tasks)
        {
            tasks = new List <IBotTask>();
            if (LeaderBuffMode)
            {
                LeaderBuffMode = false;
                tasks.Add(new TooltipTask("Leader mode..."));
                foreach (var cardType in LeaderBuffList)
                {
                    if (Mulligan.Contain(cardType))
                    {
                        var zone = Mulligan.GetCard(cardType).Area;
                        tasks.Add(new TooltipTask("Buffing..."));
                        tasks.Add(new MouseMoveTask(zone));
                        tasks.Add(new LeftMouseClick());
                        tasks.Add(new SleepTask(1000));
                        return(true);
                    }
                }
            }
            else
            {
                foreach (var cardType in FromHighToLowStr)
                {
                    if (Mulligan.Contain(cardType))
                    {
                        if (GhoulMode || OzzrelMode)
                        {
                            GameMemory.DeleteFromGraveyard(cardType);
                        }
                        if (WeavessIncantationMode)
                        {
                            GameMemory.AddToGraveyard(cardType);
                        }

                        GhoulMode              = false;
                        OzzrelMode             = false;
                        WeavessIncantationMode = false;

                        var zone = Mulligan.GetCard(cardType).Area;
                        tasks.Add(new TooltipTask("Consuming..."));
                        tasks.Add(new MouseMoveTask(zone));
                        tasks.Add(new LeftMouseClick());
                        tasks.Add(new SleepTask(4000));
                        return(true);
                    }
                }
            }
            tasks.Add(new TooltipTask("Choosing random target..."));
            tasks.Add(new KeyboardTask(Messaging.VKeys.Left));
            tasks.Add(new KeyboardTask(Messaging.VKeys.Right));
            tasks.Add(new KeyboardTask(Messaging.VKeys.Enter));
            tasks.Add(new KeyboardTask(Messaging.VKeys.Enter));
            tasks.Add(new SleepTask(1000));
            return(true);
        }
Exemplo n.º 25
0
 public void Deactivate()
 {
     if (!_modActive)
     {
         return;
     }
     ModLogger.WriteLine("Deactivating free camera mod");
     GameMemory.Write <byte>(offsetCameraFlag, 0);
     _modActive = false;
 }
Exemplo n.º 26
0
        private void UpdateSharedAPState()
        {
            var gainedAp = GameMemory.Read <byte>(_offsetGainedAp, 8);

            for (int i = 0; i < 8; i++)
            {
                var box = (CheckBox)ShareBoxes.Children[i];
                _sharedApState[i] = box.IsChecked.Value ? (byte)1 : gainedAp[i];
            }
        }
Exemplo n.º 27
0
        public override void OnGameAttached(GameState state)
        {
            ProcessModuleWow64Safe server = state.GetModule("server.dll");

            var scanner = new SignatureScanner(state.GameProcess, server.BaseAddress, server.ModuleMemorySize);

            if (GameMemory.GetBaseEntityMemberOffset("m_iHealth", state.GameProcess, scanner, out _baseEntityHealthOffset))
            {
                Debug.WriteLine("CBaseEntity::m_iHealth offset = 0x" + _baseEntityHealthOffset.ToString("X"));
            }
        }
Exemplo n.º 28
0
        private void KeyItemButtonsOnButtonClicked(int buttonIndex)
        {
            var keyItemData  = GameMemory.Read <byte>(_offsetKeyItem, 8, false);
            var bitIndex     = KeyItem.KeyItems[buttonIndex].BitIndex;
            var keyByteIndex = bitIndex / 8;
            var keyBitIndex  = bitIndex % 8;

            keyItemData[keyByteIndex] = BitHelper.ToggleBit(keyItemData[keyByteIndex], keyBitIndex);
            GameMemory.Write(_offsetKeyItem, keyItemData, false);
            Refresh();
        }
Exemplo n.º 29
0
        public static string GetName(int partyIndex)
        {
            if (partyIndex < 8)
            {
                return(null);
            }
            var offset    = _offsetAeonNames + 0xA0 + AeonNames[partyIndex - 8];
            var nameBytes = GameMemory.Read <byte>(offset, 8, false);

            return(StringConverter.ToString(nameBytes));
        }
Exemplo n.º 30
0
        private void ComboCurrentOverdrive_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_refreshing)
            {
                return;
            }
            var charOffset = _offsetPartyStats + _characterIndex * _sizePartyMember;
            var offset     = (int)Marshal.OffsetOf <PartyMember>("OverdriveMode") + charOffset;

            GameMemory.Write(offset, (byte)OverdriveMode.OverdriveModes[ComboCurrentOverdrive.SelectedIndex].BitIndex, false);
        }
Exemplo n.º 31
0
        public MOHAComponent(LiveSplitState state)
        {
#if DEBUG
            Debug.Listeners.Clear();
            Debug.Listeners.Add(TimedTraceListener.Instance);
#endif

            _timer = new TimerModel { CurrentState = state };
            _timer.CurrentState.OnStart += timer_OnStart;

            _updateTimer = new Timer() { Interval = 15, Enabled = true };
            _updateTimer.Tick += updateTimer_Tick;

            _gameMemory = new GameMemory();
            _gameMemory.OnFirstLevelLoaded += gameMemory_OnFirstLevelLoading;
            _gameMemory.OnFadeIn += gameMemory_OnFadeIn;
            _gameMemory.OnLoadStarted += gameMemory_OnLoadStarted;
            _gameMemory.OnLoadFinished += gameMemory_OnLoadFinished;
            _gameMemory.OnLastTrigger += gameMemory_OnLastTrigger;
			_gameMemory.OnLevelChanged += gameMemory_OnLevelCompleted;
			_gameMemory.OnActualLevelStart += gameMemory_OnActualLevelStart;
        }