Ejemplo n.º 1
0
        internal IGameMemoryRE7 RefreshLimited()
        {
            /*
             * if (PointerMapName.BaseAddress != IntPtr.Zero)
             * {
             *  var bytes = PointerMapName.DerefByteArray(0x0, 48);
             *  gameMemoryValues.MapName = System.Text.Encoding.Unicode.GetString(bytes);
             * }
             * else
             * {
             *  gameMemoryValues.MapName = "Menu";
             * }
             */
            gameMemoryValues.CurrentDA = PointerDA.DerefFloat(0xF8);
            gameMemoryValues.CurrentHP = PointerHP.DerefFloat(0x24);
            gameMemoryValues.MaxHP     = PointerHP.DerefFloat(0x20);

            if (gameMemoryValues.CurrentHP == 1000 && !isReset)
            {
                isReset = true;
                memoryAccess.SetFloatAt(IntPtr.Add(PointerHP.Address, 0x20), 1500);
            }
            HasScanned = true;
            return(gameMemoryValues);
        }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 internal void UpdatePointers()
 {
     if (Process.GetProcessesByName("re7").FirstOrDefault() == null)
     {
         return;
     }
     if (!connected)
     {
         Initialize(Process.GetProcessesByName("re7").FirstOrDefault().Id); return;
     }
     else
     {
         PointerMrEverythingCount.UpdatePointers();
         PointerDA.UpdatePointers();
         PointerMapName.UpdatePointers();
         PointerHP.UpdatePointers();
         PointerBagCount.UpdatePointers();
         PointerInventoryCount.UpdatePointers();
         PointerInventorySlotSelected.UpdatePointers();
         PointerEnemyEntryCount.UpdatePointers();
         GenerateEnemyEntries(); // This has to be here for the next part.
         for (int i = 0; i < PointerEnemyEntries.Length; ++i)
         {
             PointerEnemyEntries[i].UpdatePointers();
         }
     }
 }
Ejemplo n.º 3
0
        internal IGameMemoryRE7 Refresh()
        {
            if (PointerMapName.BaseAddress != IntPtr.Zero)
            {
                var bytes = PointerMapName.DerefByteArray(0x0, 48);
                gameMemoryValues.MapName = System.Text.Encoding.Unicode.GetString(bytes);
            }
            else
            {
                gameMemoryValues.MapName = "Menu";
            }

            gameMemoryValues.MrEverything = PointerMrEverythingCount.DerefInt(0x28);
            gameMemoryValues.CurrentDA    = PointerDA.DerefFloat(0xF8);
            gameMemoryValues.CurrentHP    = PointerHP.DerefFloat(0x24);
            gameMemoryValues.MaxHP        = PointerHP.DerefFloat(0x20);

            if (gameMemoryValues.CurrentHP == 1000 && !isReset)
            {
                isReset = true;
                memoryAccess.SetFloatAt(IntPtr.Add(PointerHP.Address, 0x20), 1500);
            }


            if (PointerBagCount.Address != IntPtr.Zero)
            {
                gameMemoryValues.PlayerInventorySlots = (PointerBagCount.DerefInt(0x78) * 4) + 12;
            }
            else
            {
                gameMemoryValues.PlayerInventorySlots = 12;
            }


            gameMemoryValues.PlayerInventoryCount = PointerInventoryCount.DerefInt(0x28);

            // Enemy HP

            GenerateEnemyEntries();
            if (gameMemoryValues.EnemyHealth == null || gameMemoryValues.EnemyHealth.Length < EnemyTableCount)
            {
                gameMemoryValues.EnemyHealth = new EnemyHP[EnemyTableCount];
                gameMemoryValues.EnemyCount  = gameMemoryValues.EnemyHealth.Length;
                for (int i = 0; i < gameMemoryValues.EnemyHealth.Length; ++i)
                {
                    gameMemoryValues.EnemyHealth[i] = new EnemyHP();
                }
            }
            for (int i = 0; i < gameMemoryValues.EnemyHealth.Length; ++i)
            {
                if (i < PointerEnemyEntries.Length && PointerEnemyEntries[i].Address != IntPtr.Zero)
                { // While we're within the size of the enemy table, set the values.
                    gameMemoryValues.EnemyHealth[i].ID        = PointerEnemyEntries[i].DerefUShort(0x48);
                    gameMemoryValues.EnemyHealth[i].MaximumHP = PointerEnemyEntries[i].DerefFloat(0x20);
                    gameMemoryValues.EnemyHealth[i].CurrentHP = PointerEnemyEntries[i].DerefFloat(0x24);
                }
                else
                { // We're beyond the current size of the enemy table. It must have shrunk because it was larger before but for the sake of performance, we're not going to constantly recreate the array any time the size doesn't match. Just blank out the remaining array values.
                    gameMemoryValues.EnemyHealth[i].ID        = 0;
                    gameMemoryValues.EnemyHealth[i].MaximumHP = 0;
                    gameMemoryValues.EnemyHealth[i].CurrentHP = 0;
                }
            }


            gameMemoryValues.PlayerCurrentSelectedInventorySlots = PointerInventorySlotSelected.DerefInt(0x24);

            GetItems();

            HasScanned = true;
            return(gameMemoryValues);
        }