Ir para conteúdo
  • Cadastre-se

Posts Recomendados

This is the example of a Client Chooser, you can do it better, add more option o whatever you want.

This picture shows 2 clients, 1 open and logged in and other only open.

chooser.png


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using MXbotALFA.Objetos;

using System.Diagnostics;

using MXbotALFA.Forms;

using System.Threading;

namespace MXbotALFA

{

	public partial class Form1 : Form

	{

		Cliente c;

		MainMx formBot;

		public List<Cliente> ClientList = new List<Cliente>();

		string nombreProceso = "tibia";

		string version = "9.4.2.0";

		int cont = 1;

		public Form1()

		{

			InitializeComponent();

		}

		private void Form1_Load(object sender, EventArgs e)

		{

			foreach (Process p in Process.GetProcessesByName(nombreProceso))

			{

				if (p.MainModule.FileVersionInfo.FileVersion == version)

				{

					c = new Cliente(p, this);

					if (!string.IsNullOrEmpty(c.ToString()))

					{

						listBox1.Items.Add("Client #" + cont + ": " + c.ToString() + " " + c.getNombre);

						cont++;

					}

					else { listBox1.Items.Add("Necesitas loguear"); }

				}

				else

				{

					listBox1.Items.Add("Versión " + p.MainModule.FileVersionInfo.FileVersion + " no soportada");

				}

			}

			if (ClientList.Count == 0)

			{

				listBox1.Items.Add("No se encontró ningun Cliente");

			}

		}

		private void button1_Click(object sender, EventArgs e)

		{

			cont = 1;

			this.ClientList.Clear();

			listBox1.Items.Clear();

			this.Form1_Load(sender, e);

		}

		private void button2_Click(object sender, EventArgs e)

		{

			System.Environment.Exit(0);

		}

		private void listBox1_DoubleClick(object sender, EventArgs e)

		{

			int n = listBox1.SelectedIndex;

			if (n != -1 && n < ClientList.Count)

			{

				formBot = new MainMx(ClientList.ElementAt(n));

				Thread NuevoHilo = new System.Threading.Thread(new System.Threading.ThreadStart(runMainMX));

				this.Close();

				NuevoHilo.SetApartmentState(System.Threading.ApartmentState.STA);

				NuevoHilo.Start();

			}

		}

		public void runMainMX()

		{

			formBot.ShowDialog();

		}

	}

}

This is the class Cliente.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Diagnostics;

using System.Windows.Forms;

namespace MXbotALFA.Objetos

{

	public class Cliente

	{

		public Inputhelper Input;

		//public Healer formHealer;

		public List<string> Creaturas = new List<string>();

		public List<int> CreaturasHP = new List<int>();

		public IntPtr Handle;

		Form1 MainForm;

		public Process proceso;

		public int AdressOffset;

		//Other Address

		public static uint bListstart = 0x946000;

		public static uint steps = 0xb0;

		public static uint Max = 1300;

		public static uint ends = bListstart + (steps * Max);

		//Player Address

		public static uint PlayerId = 0x7AC054;

		public static uint Experience = 0x7ABFB8;

		public static uint Status = 0x7BA894;

		public static uint Healthadr = 0x7A9CEC;

		public static uint Manaadr = 0x7AC004;

		public static uint HealthMaxadr = 0x7AC048;

		public static uint ManaMaxadr = 0x7ABFB0;

		public static uint Nivel = 0x7ABFEC;

		public static uint Password = 0x7BA86C;

		public static uint Account = 0x7BA904;

		public static uint Soul = 0x7ABFF0;

		public static uint Flags = 0x7A9CF4;

		public static uint Capacity = 0x7ABFC4;

		public static uint DistanceIsVisible = 148;

		public static uint CreaturaHP = 140;

		public static uint LastSeeID = 0x942F94;

		//Address

		public static uint HotkeyObjectStart = 0x7BA7A8;

		public static uint HotkeySendAutostart = 0x7BA75C;

		public static uint HotkeyUseTypeStart = 0x7BA6C0;

		public static uint HotkeyTextStart = 0x7B8290;

		public Cliente(Process _process, Form1 mForm)

		{

			this.MainForm = mForm;

			proceso = _process;

			proceso.EnableRaisingEvents = true;

			Handle = _process.Handle;

			AdressOffset = proceso.MainModule.BaseAddress.ToInt32() - 0x400000;

			MessageBox.Show(""+AdressOffset);

			Input = new Inputhelper(this);

			MainForm.ClientList.Add(this);

		}

		public uint GetPlayerAdr()

		{

			for (uint i = bListstart; i <= ends; i += steps)

			{

				if (ReadInt(i) == ReadInt(PlayerId))

				{

					return i;

				}

			}

			return 0;

		}

		public void GetCreaturas()

		{

			Creaturas.Clear();

			CreaturasHP.Clear();

			for (uint i = bListstart; i <= ends; i += steps)

			{

				if (ReadByte(i + DistanceIsVisible) == 1)

				{

					Creaturas.Add(ReadString(i + 4));

					CreaturasHP.Add(ReadInt(i + CreaturaHP));

				}

			}

		}

		public override String ToString()

		{

			if (this.IsOnline())

			{

				return this.proceso.Id.ToString();

			}

			return null;

		}

		public List<string> getMonstruos

		{

			get { return Creaturas; }

		}

		public List<int> getCreaturasHP

		{

			get { return CreaturasHP; }

		}

		public bool IsOnline()

		{

			if (ReadByte(Status) == 8)

			{

				return true;

			}

			return false;

		}

		public string getNombre

		{

			get { return ReadString(GetPlayerAdr() + 4); }

		}

		public int getID

		{

			get { return ReadInt(LastSeeID); }

		}

		public string getNombreSever

		{

			get { return ReadString(GetPlayerAdr() + 30); }

		}

		public int getNivel

		{

			get { return ReadInt(Nivel); }

		}

		public string getAccount

		{

			get { return ReadString(Manaadr); }

		}

		public string getPassword

		{

			get { return ReadString(Healthadr); }

		}

		public int getMana

		{

			get { return ReadInt(Manaadr); }

		}

		public int getHp

		{

			get { return ReadInt(Healthadr); }

		}

		public int getManaMax

		{

			get { return ReadInt(ManaMaxadr); }

		}

		public int getHpMax

		{

			get { return ReadInt(HealthMaxadr); }

		}

		public void FullLight()

		{

			WriteInt(GetPlayerAdr() + 124, 27);

			WriteInt(GetPlayerAdr() + 128, 215);

		}

		public void adoons(int id)

		{

			WriteInt(GetPlayerAdr() + 120, id);

		}

		public enum OutfitMontura : int

		{

			WidowQueen = 368,

			RacingBird = 369,

			WarBear = 370,

			BlackSheep = 371,

			MidnightPanther = 372,

			Draptor = 373,

			Titanica = 374,

			TinLizzard = 375,

			Blazebringer = 376,

			RapidBoar = 377,

			Stampor = 378,

			UndeadCaveBear = 379,

			Donkey = 387,

			Uniwheel = 388,

			TigerSlug = 389,

			CrystalWolf  = 391,

			WarHorse = 392,

			KinglyDeer = 401,

			Panda = 402,

			Dromedary = 405,

			KingScorpion = 406,

			RentedHorse = 421,

			FireWarHorse = 426,

			ShadowDraptor = 427,

			Ladybug = 447,

			Manta = 450

		}

		public enum HotkeyUsetype

		{

			Onself = 2,

			OnTarget = 1,

			WithCrosshair = 0

		}

		public struct Hotkey

		{

			public string Message;

			public HotkeyUsetype UseType;

			public int ItemId;

			public byte SendAuto;

		}

		public void Sendhotkey(Hotkey hotkey)

		{

			int hotkeyObject = ReadInt(HotkeyObjectStart);

			int hotkeySendAuto = ReadInt(HotkeySendAutostart);

			int hotkeyUseType = ReadInt(HotkeyUseTypeStart);

			string hotkeyText = ReadString(HotkeyTextStart);

			WriteInt(HotkeyObjectStart, hotkey.ItemId);

			WriteByte(HotkeySendAutostart, hotkey.SendAuto);

			WriteInt(HotkeyUseTypeStart, (int)hotkey.UseType);

			WriteString(HotkeyTextStart, hotkey.Message);

			Input.SendKey(Keys.F1);

			WriteInt(HotkeyObjectStart, hotkeyObject);

			WriteInt((uint)hotkeySendAuto, hotkeySendAuto);

			WriteInt(HotkeyUseTypeStart, hotkeyUseType);

			WriteString(HotkeyTextStart, hotkeyText);

		}

		#region "Memoria"

		public string ReadString(uint adr)

		{

			return Util.Memoria.ReadString(Handle, AdressOffset + adr);

		}

		public int ReadInt(uint adr)

		{

			return Util.Memoria.ReadInt32(Handle, AdressOffset + adr);

		}

		public byte ReadByte(uint adr)

		{

			return Util.Memoria.ReadByte(Handle, AdressOffset + adr);

		}

		public void WriteInt(uint adr, int value)

		{

			Util.Memoria.WriteInt32(Handle, AdressOffset + adr, value);

		}

		public void WriteByte(uint adr, byte value)

		{

			Util.Memoria.WriteByte(Handle, AdressOffset + adr, value);

		}

		public void WriteString(uint adr, string value)

		{

			Util.Memoria.WriteString(Handle, AdressOffset + adr, value);

		}

		#endregion

	}

}

You can do a class player with all its attributes, to do it more simple. If you have some problems interpreting the code comment, and maybe you need to eliminate some things :P. So all do you need is the Object c, if you want to do a healer you can pass the object to the constructor of a FormHealer for example and use it. Now you can work easily in XP and seven. Your main form will look like this.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using MXbotALFA.Objetos;

using MXbotALFA.Util;

namespace MXbotALFA.Forms

{

	public partial class MainMx : Form

	{

		private Cliente c;

		public MainMx(Cliente c)

		{

			this.c = c;

			InitializeComponent();

		}

		private void MainMx_Load(object sender, EventArgs e)

		{

			this.Text = "MXbot ~ "+c.getNombre;

		}

	}

}

Editado por Mmmmm (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 2 weeks later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo