Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Windows.Forms;
- using System.Diagnostics;
- namespace AOUtils
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- //Pointer: 77bb084;
- //Gold Offset: c890;
- uint pAddress = 0x7bb084;
- int ptrOffset = 0xc890;
- uint offset = 0;
- int bytesOut = 0;
- /// <summary>
- /// Form loading, and opening AOReader alias ReadProcessMemory.CS
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Form1_Load(object sender, EventArgs e)
- {
- AOReader mreader = new AOReader();
- var p = GetProcess("Kukun");
- if (p != null)
- {
- mreader.ReadProcess = p;
- mreader.OpenProcess();
- offset = BitConverter
- .ToUInt32(mreader.ReadMemory((IntPtr)(pAddress + (uint)p.Modules[0].BaseAddress), 4, out bytesOut), 0);
- if (ptrOffset < 0)
- {
- offset -= (uint)Math.Abs(ptrOffset);
- }
- else
- {
- offset += (uint)ptrOffset;
- }
- }
- }
- /// <summary>
- /// All Clients called angel.dat also we can have multiple process opened
- /// , so for identify it, we add parameter
- /// with the name of character.
- /// </summary>
- /// <param name="altName"></param>
- /// <returns></returns>
- private static Process GetProcess(string altName)
- {
- Process p = Process.GetProcessesByName("angel.dat")
- .ToList().FirstOrDefault(d=>d.MainWindowTitle.Contains(altName));
- if (p!= null)
- {
- return p;
- }
- return null;
- }
- /// <summary>
- /// Trying to get gold amount and display to TextBox.
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click_1(object sender, EventArgs e)
- {
- AOReader mreader = new AOReader();
- //This i add for check if GetProcess is working, can be removed.
- IntPtr Base = GetProcess("Kukun").MainModule.BaseAddress;
- MessageBox.Show("Base Address: " + Base);
- var gold = BitConverter
- .ToUInt32(mreader.ReadMemory((IntPtr)(pAddress + offset), 4, out bytesOut), 0);
- textBox1.Text = gold.ToString("n0");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement