예제 #1
0
        private void BtnSaveSpider_Click(object sender, EventArgs e)
        {
            if (!_spiderInitialized)
            {
                MetroMessageBox.Show(this, "You should spider something first!", "Error", MessageBoxButtons.OK,
                                     MessageBoxIcon.Error);
                return;
            }

            try {
                var remoteProc = RemoteProc.Instance();
                if (remoteProc == null)
                {
                    return;
                }

                var address = Defs.PointerByName("inventory").GetAddress(remoteProc);
                foreach (var item in _inventory)
                {
                    remoteProc.Write(address, item.SekiroItem);
                    address += 16;
                }
            } catch (Exception ex) {
                Diag.WriteLine(ex.Message);
                MessageBox.Show($"Failed to save inventory :( \n{ex.Message}", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            MetroMessageBox.Show(this,
                                 "Inventory saved! Do something that forces the game to reparse your inventory such as warping or saving and loading",
                                 ":o", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void CboxLastIdol_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Diag.WriteLine("LAST IDOL SET!");
            var idol = cboxLastIdol.SelectedItem.ToString().Idol();

            if (idol == null)
            {
                return;
            }
            var idolId = idol.Id;

            var remoteProc = RemoteProc.Instance();

            if (remoteProc == null)
            {
                return;
            }

            var pointer = Defs.PointerByName("LastCommutedIdol");

            if (pointer == null || pointer.BasePtr() == IntPtr.Zero)
            {
                return;
            }
            remoteProc.Write(pointer.GetAddress(remoteProc), idolId);
        }
        // flagToggle _flagToggle FlagToggle

        private void ForceQuit()
        {
            var rp = RemoteProc.Instance();

            if (rp == null)
            {
                return;
            }

            rp.Write(Defs.PointerByName("QuitToTitle").GetAddress(rp), (byte)1);
        }
예제 #4
0
        private void Init()
        {
            Diag.WriteLine("Initializing");
            SetStatus("Initializing", Color.OrangeRed);

            var remoteProc = RemoteProc.Instance();

            if (remoteProc == null)
            {
                MetroMessageBox.Show(this, "Sekiro should be running but was not found..", "Error",
                                     MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            foreach (var flag in Defs.Flags.FastReverse())
            {
                flag.RenderFlag(this);
            }

            GameState = new GameState();
            GameState.Subscribe((sender, e) => {
                var value = e.Value;
                if (value.GetType() != typeof(byte))
                {
                    return;
                }
                var b = (byte)value;

                UpdateCtrl(lblLoading, () => {
                    if (b == 1)
                    {
                        lblLoading.Text = "Loading: no";
                    }
                    else if (b == 0)
                    {
                        lblLoading.Text = "Loading: yes";
                    }
                    else
                    {
                        lblLoading.Text = "Loading: unknown";
                    }
                });
            });
            GameState.Start();

            PlayerPos = new PlayerPos();
            PlayerPos.Subscribe((sender, e) => {
                var pos = (Vector3)e.Value;
                UpdateCtrl(lblPosX, () => lblPosX.Text = $"X: {pos.X}");
                UpdateCtrl(lblPosY, () => lblPosY.Text = $"Y: {pos.Y}");
                UpdateCtrl(lblPosZ, () => lblPosZ.Text = $"Z: {pos.Z}");
            });
            PlayerPos.Start();

            IngameTime = new IngameTime();
            IngameTime.Subscribe((sender, e) => {
                UpdateCtrl(lblIgt, () => lblIgt.Text = $"IGT: {(string)e.Value}");
            });
            IngameTime.Start();

            PlayerStats = new PlayerStats();
            PlayerStats.Subscribe((sender, e) => {
                var player = (Player)e.Value;
                UpdateCtrl(lblHealth, () => lblHealth.Text   = $"Health: {player.CurrentHealth}/{player.MaximumHealth}");
                UpdateCtrl(lblPosture, () => lblPosture.Text = $"Posture: {player.CurrentPosture}/{player.MaximumPosture}");
            });
            PlayerStats.Start();

            LastIdol = new LastIdol();
            LastIdol.Subscribe((sender, e) => {
                var idola = (Idol)e.Value;
                UpdateCtrl(cboxLastIdol, () => cboxLastIdol.SelectedItem = idola.Name);
            });
            LastIdol.Start();

            var lastIdol = remoteProc.Read <int>(Defs.PointerByName("LastCommutedIdol").GetAddress(remoteProc));
            var idol     = Defs.IdolById(lastIdol);

            if (idol == null)
            {
                Diag.WriteLine($"Null Idol? {lastIdol}");
            }
            else
            {
                UpdateCtrl(cboxLastIdol, () => {
                    cboxLastIdol.SelectedItem = idol.Name;
                });
            }

            SetStatus("Ready", Color.LimeGreen);
            Enable();
        }
예제 #5
0
        private void BtnSpider_Click(object sender, EventArgs e)
        {
            if (!_spiderInitialized)
            {
                InitializeSpider();
            }
            _inventory.Clear();
            var sekiro = Utils.Sekiro();

            if (sekiro == null)
            {
                return;
            }


            var emptyItem = new SekiroItem()
            {
                Id1      = 0,
                Id2      = 0xFFFFFFFF,
                Quantity = 0,
                Garbage  = 0
            };

            var    itemCount = 0;
            IntPtr address;

            var remoteProc = RemoteProc.Instance();

            if (remoteProc == null)
            {
                return;
            }

            address = Defs.PointerByName("inventory").GetAddress(remoteProc);
            var invStart = address.ToInt64();
            var invEnd   = invStart + 4800;

            Diag.WriteLine($"Inv Start: {address.ToString("X")}");
            var spiderIndex = 0;

            while (address.ToInt64() < invEnd)
            {
                var sekiroItem = remoteProc.Read <SekiroItem>(address);
                address += 16;
                var item = sekiroItem.ToItem();
                item.SpiderIndex = spiderIndex;
                spiderIndex++;
                _inventory.Add(item);
                if (sekiroItem.Equals(emptyItem))
                {
                    continue;
                }
                itemCount++;
            }

            Diag.WriteLine($"Inv End: {address.ToString("X")}");
            Diag.WriteLine($"Spidered {itemCount} items");

            var currentRow = 0;

            itemGrid.RowCount = itemCount;
            foreach (var item in _inventory)
            {
                if (item.Empty)
                {
                    continue;
                }
                itemGrid.CurrentCell       = itemGrid.Rows[currentRow].Cells[0];
                itemGrid.CurrentCell.Value = item.SpiderIndex;
                itemGrid.CurrentCell       = itemGrid.Rows[currentRow].Cells[1];
                var cbox = (DataGridViewComboBoxCell)itemGrid.CurrentCell;
                foreach (var defi in Defs.Items)
                {
                    cbox.Items.Add(defi.Name);
                }
                cbox.Items.Add("Unknown");
                cbox.Value = item.Name;

                itemGrid.CurrentCell       = itemGrid.Rows[currentRow].Cells[2];
                itemGrid.CurrentCell.Value = item.SekiroItem.Quantity;
                itemGrid.CurrentCell       = itemGrid.Rows[currentRow].Cells[3];
                itemGrid.CurrentCell.Value = "Not Implemented";
                currentRow++;
            }
        }
예제 #6
0
 public IntPtr GetAddress()
 {
     Diag.WriteLine("Deprecation warning: IntPtrE::GetAddress(). Use IntPtrE::GetAddress(RemoteProcess) instead.");
     return(GetAddress(RemoteProc.Instance()));
 }