public HandlePing(Client client) { PacketWriter Writer = new PacketWriter(); Writer.WriteShort((short)PacketOpcodes.sPong); client.SendPacket(Writer); }
public HandlePin(Client client, byte[] packet) { PacketReader Reader = new PacketReader(packet); byte type = Reader.ReadByte(); if (type == 0) { PacketWriter Writer = new PacketWriter(); Writer.WriteShort((short)PacketOpcodes.sWorldInfoRequest); client.SendPacket(Writer); } else if (type == 1) { MessageBox.Show("Please set a pin."); client.MapleConnect.Close(); client.LoginThread.Abort(); client.Account.LoggingIn = false; client.MForm.ChangedAccount(); } else if (type == 2) { MessageBox.Show("Incorrect pin"); client.MapleConnect.Close(); client.LoginThread.Abort(); client.Account.LoggingIn = false; client.MForm.ChangedAccount(); } }
public HandleSelectWorld(Client client) { for (int i = 0; i <= 1; i++) { if (client.Account.Worlds[i].Name.ToUpper() == client.Account.World.ToUpper()) { client.Account.WorldIndex = i; int MinIndex = 0; if (client.Account.AutoSelect) { for (int j = 0; j < client.Account.Worlds[i].ChannelCount; j++) { if (MinIndex == 0) MinIndex = j; else if (client.Account.Worlds[i].Channels[j].Population < client.Account.Worlds[i].Channels[MinIndex].Population) MinIndex = j; } // MessageBox.Show("Selecting channel " + client.Account.Worlds[i].Channels[MinIndex].Name + " with the lowest population (" + client.Account.Worlds[i].Channels[MinIndex].Population + ")"); client.Account.ChannelIndex = MinIndex; } } } if (client.Account.WorldIndex == -1) MessageBox.Show("Unable to find world."); else { PacketWriter Writer = new PacketWriter(); Writer.WriteShort((short)PacketOpcodes.sSelectWorld); Writer.WriteShort(client.Account.Worlds[client.Account.WorldIndex].ID); client.SendPacket(Writer); } }
public LoginCharacter(Client client, int id) { PacketWriter Writer = new PacketWriter(); Writer.WriteShort((short)PacketOpcodes.sSelectCharacter); Writer.WriteInt(client.Account.Characters[id].ID); client.SendPacket(Writer); // Program.mFrm.CharLoggedIn(id); }
/// <summary> /// Initialises the connection to the server. /// Connects to the server and sends packets to initialise the session. /// </summary> /// <param name="client">Client to initialise</param> public Init(Client client) { client.ChangeConnection("109.234.73.11", 8484); PacketWriter Writer = new PacketWriter(); Writer.WriteShort((short)PacketOpcodes.sInit1); client.SendPacket(Writer); Writer.Reset(0); Writer.WriteShort((short)PacketOpcodes.sInit2); client.SendPacket(Writer); }
public HandleLoginInfo(Client client, byte[] packet) { PacketReader Reader = new PacketReader(packet); byte Type = Reader.ReadByte(); if (Type == 4) { MessageBox.Show("Incorrect password."); client.MapleConnect.Close(); client.LoginThread.Abort(); client.Account.LoggingIn = false; client.MForm.ChangedAccount(); } else if (Type == 5) { MessageBox.Show("Username does not exist."); client.MapleConnect.Close(); client.LoginThread.Abort(); client.Account.LoggingIn = false; client.MForm.ChangedAccount(); } else if (Type == 7) { MessageBox.Show("Account already logged in."); client.MapleConnect.Close(); client.LoginThread.Abort(); client.Account.LoggingIn = false; client.MForm.ChangedAccount(); } else { client.Account.AccountID = Reader.ReadInt(); Reader.ReadByte(); Reader.ReadByte(); Reader.ReadByte(); client.Account.Username = Reader.ReadMapleString(); Reader.ReadMapleString(); Reader.ReadInt(); //MessageBox.Show("Actual username: "******"; Account id: " + client.Account.Account_id); PacketWriter Writer = new PacketWriter(); Writer.WriteShort((short)PacketOpcodes.sPin); Writer.WriteByte(1); Writer.WriteByte(0); Writer.WriteInt(client.Account.AccountID); Writer.WriteMapleString(client.Account.Pin); client.SendPacket(Writer); } }
public HandleSelectChannel(Client client) { // if we reach here then that means that the world select succeeded, ensuring that WorldID & channel_id are NOT nil, all cool Random Rand = new Random(System.DateTime.Now.Millisecond); PacketWriter Writer = new PacketWriter(); Writer.WriteShort((short)PacketOpcodes.sSelectChannel); Writer.WriteByte(client.Account.Worlds[client.Account.WorldIndex].ID); Writer.WriteByte(client.Account.Worlds[client.Account.WorldIndex].Channels[client.Account.ChannelIndex].ID); Writer.WriteInt(Rand.Next(40604, 230493854)); Writer.WriteByte(client.Account.Worlds[client.Account.WorldIndex].Channels[client.Account.ChannelIndex].Language); Writer.WriteMapleString("Windows Vista"); Writer.WriteMapleString("ETHERNET"); client.SendPacket(Writer); }
/// <summary> /// Handles account login. /// Encrypts password and send login packet. /// </summary> /// <param name="client">Client from which packet was received</param> /// <param name="packet">Packet to be handled</param>> public HandleLogin(Client client, byte[] packet) { PacketReader Reader = new PacketReader(packet); int Length = Reader.ReadShort(); byte[] Key = Reader.ReadBytes(Length); string PwEncrypted = Encoding.ASCII.GetString(Crypto.WzRSAEncrypt.Encrypt(Key, Length, client.Account.Password)); byte[] Buffer = { 0x00, 0xE0, 0x4D, 0xA6, 0xA5, 0xCF, 0xB4, 0x68, 0xCB, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x32, 0xFD, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00 }; PacketWriter Writer = new PacketWriter(); Writer.WriteShort((short)PacketOpcodes.sLogin); Writer.WriteMapleString(client.Account.Username); Writer.WriteMapleString(PwEncrypted); Writer.WriteMapleString("00E04DA6A5CF_B468CBE4"); Writer.WriteBytes(Buffer); client.SendPacket(Writer); }
public HandleSheepExploit(Client client) { PacketWriter chat = new PacketWriter(); Random rnd = new Random(DateTime.Now.Millisecond); int rndValue = rnd.Next(); chat.WriteShort(0x2F); chat.WriteInt(rndValue); chat.WriteMapleString("lols"); chat.WriteByte(0); client.SendPacket(chat); /*PacketWriter perion = new PacketWriter(); perion.WriteShort((short)PacketOpcodes.s_shop); perion.WriteInt(1024); for (int i = 0; i <= 6; i++) { client.SendPacket(perion); } perion.Dispose();*/ /*PacketWriter tele = new PacketWriter(); tele.WriteShort((short)PacketOpcodes.s_owl_teleport); tele.WriteInt(338835); // shop id tele.WriteInt(910040003); // map id client.SendPacket(tele); Thread.Sleep(10); tele.Dispose(); PacketWriter chat = new PacketWriter(); chat.WriteShort((short)PacketOpcodes.s_npc_chat); chat.WriteInt(24848); chat.WriteInt(10158151); client.SendPacket(chat); Thread.Sleep(50); chat.Dispose();*/ }
public HandleServerConnect(Client client, byte[] packet) { PacketReader Reader = new PacketReader(packet); Reader.ReadByte(); // unknown Reader.ReadByte(); // unknown int Host = Reader.ReadInt(); int Port = Reader.ReadShort(); int CharacterID = Reader.ReadInt(); Reader.ReadByte(); // unknown Reader.ReadInt(); // unknown client.ChangeIntConnection(Host, Port); byte[] Buffer = { 0x00, 0xE0, 0x4D, 0xA6, 0xA5, 0xCF, 0xB4, 0x68, 0xCB, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x32, 0xFD, 0x00, 0x00 }; PacketWriter Writer = new PacketWriter(); Writer.WriteShort((short)PacketOpcodes.sChannelConnect); Writer.WriteInt(CharacterID); Writer.WriteBytes(Buffer); Writer.WriteBytes(client.Account.SessionID); client.SendPacket(Writer); }
public void StartSpamGP() { while (Account.Characters[Account.CharacterIndex].LoggedIn) { PacketWriter Writer = new PacketWriter(); // 95 00 1D 08 00 00 00 Writer.WriteShort(0x95); Writer.WriteShort(0x81D); Writer.WriteShort(0); Writer.WriteByte(0); SendPacket(Writer); Thread.Sleep(1); } }
/// <summary> /// Converts PacketWriter memory stream to byte[] /// Sends converted packet over mConnection /// </summary> /// <param name="writer">PacketWriter to be converted to byte[] and sent</param> public void SendPacket(PacketWriter writer) { byte[] Buffer = new byte[writer.Length]; Buffer = writer.ToArray(); this.MapleConnect.SendPacket(Buffer); }