private void BtnTest_Click(object sender, EventArgs e) { var confetti = Defs.ItemByName("divine confetti"); new AddItem(confetti, 8).Execute(); // new AddItem() }
private void BtnSave_Click(object sender, EventArgs e) { // We have to rewrite the entire inventory so first let's build it var invBytes = new List <byte[]>(); try { for (var currentRow = 0; currentRow < itemGrid.RowCount; currentRow++) { var itemName = itemGrid.Rows[currentRow].Cells[1].Value.ToString(); var item = Defs.ItemByName(itemName); var initialItem = _items.ElementAt(currentRow); if (item == null) { invBytes.Add(initialItem); continue; } var id0Bytes = BitConverter.GetBytes(item.Id1).Concat(new byte[] { 0x00, 0xB0 }).ToArray(); var id2Bytes = BitConverter.GetBytes(item.Id1).Concat(new byte[] { 0x00, 0x40 }).ToArray(); var quantityBytes = BitConverter.GetBytes(Convert.ToInt32(itemGrid.Rows[currentRow].Cells[2].Value.ToString(), 10)); //var someIdBytes = BitConverter.GetBytes(item.Id2).ToArray().Take(3); var indexBytes = initialItem.Skip(12).Take(4); var actualFinalBytes = id0Bytes.Concat(id2Bytes).Concat(quantityBytes).Concat(indexBytes).ToArray(); invBytes.Add(actualFinalBytes); } } catch (Exception ex) { Debug.WriteLine(ex); MetroMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } Debug.WriteLine("SPIDER"); foreach (var bytese in invBytes) { Debug.WriteLine(BitConverter.ToString(bytese).Replace("-", " ")); } Debug.WriteLine("========="); Debug.WriteLine("MEMORY"); foreach (var bytese in _items) { Debug.WriteLine(BitConverter.ToString(bytese).Replace("-", " ")); } Debug.WriteLine("Trying to write spider"); using (var remoteProc = new RemoteProcess(Utils.Sekiro())) { var address = remoteProc.Read <IntPtr>(new IntPtr(0x143B49D10)) + 0x2E30; remoteProc.WriteBytes(address, invBytes.SelectMany(b => b).ToArray()); } }
private void InjectItems_Click(object sender, EventArgs e) { var items = new List <Item>(); for (var i = 0; i < injectorGrid.RowCount; i++) { var cbox = (DataGridViewComboBoxCell)injectorGrid.Rows[i].Cells[0]; if (cbox.Value == null) { continue; } var item = Defs.ItemByName(cbox.Value.ToString()); if (item == null) { continue; } var consumable = BitConverter.GetBytes(item.Id2)[3] == 0x40; var quantity = 1; if (consumable) { try { var quantityString = injectorGrid.Rows[i].Cells[1].Value.ToString(); int.TryParse(quantityString, out quantity); } catch { Diag.WriteLine($"[Item Injecter] Invalid quantity for {cbox.Value}"); } } try { new AddItem(new Item { Id1 = item.Id1, Id2 = item.Id2, Consumable = consumable }, quantity).Execute(); MetroMessageBox.Show(this, "Items Injected!", ":3", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MetroMessageBox.Show(this, ex.Message, "Failed to inject items :(", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }