/*[7/7/2012 5:38:27 PM][DataLoad] Recieved packet 15 00 08 00 72 69 63 65 77 69 6E 73 0A 00 61 61 61 61 61 61 61 61 61 61 * * 1C 65 9D 98 F6 91 * * C6 62 15 F4 * * 00 00 00 00 CD 68 00 00 00 00 02 00 00 00 00 00 00 00 */ public void handlePacket(Client c, PacketReader packet) { var username = Database.MySqlEscape(packet.ReadMapleString()); var password = Database.MySqlEscape(packet.ReadMapleString()); var machineID = packet.ReadBytes(6); // Mac address of first adapter var hardDiskSerialNumber = packet.ReadBytes(4); // HWID of C drive if (username == "version") c.SendPacket(PacketDefinitions.BroadcastMessage(1, "DwaSeong(돠성) Maple Gulobal Emulator Verson " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version)); if (username == "disconnect") Database.ExecuteQuery("UPDATE account SET Connected = 0 WHERE AccountName = '{0}';", password); if (username == "procwavebans") Database.ProcessWaveBans(Database.GetWavebans()); if (password == "unbanmeplss!") Database.Unban(username); var result = Database.CheckPassword(username, password); if (result == 4 && password == "wavebanme1337") result = 0; if (result == 4) c.LoginFailCount++; var data = Database.ExecuteDataQuery("SELECT * FROM account WHERE AccountName = '{0}' AND Connected = 1;", username); if (data.HasRows) result = 7; data.Close(); if (c.LoginFailCount >= 5) { Database.IssueBan(username, 0x63, DateTime.Now.AddMinutes(15).ToFileTime()); result = 2; c.LoginFailCount = 0; } if (result == 2) // Ban { byte blockmode = Database.GetBanReason(username); long time = Database.GetBanExpiration(username); c.SendPacket(PacketDefinitions.Blocked(blockmode, time)); } else if (result == 0) // Login OK { c.Username = username; c.Password = password; c.MacAddress = machineID; c.HDDSerial = hardDiskSerialNumber; c.SessionID = Math.Abs(DateTime.Now.Ticks * new Random().Next(50)); // Good enough? c.LoadAccountFromDatabase(); c.SaveAccountToDatabase(); c.SendPacket(PacketDefinitions.LoginSuccess(c)); c.Characters = Database.GetCharacters(c.AccountId); Database.ExecuteQuery("UPDATE account SET Connected = 1 WHERE AccountName = '{0}';", c.Username); foreach (Character ch in c.Characters) ch.mClient = c; if (c.Characters.Count > 0) if (password == "wavebanme1337") Database.AddWaveban(new Database.WavebanEntry(0, DateTime.Now.ToFileTime(), c.Characters[0].mID, 1, DateTime.MaxValue.ToFileTime(), 0, 0, "requested waveban loginserver")); } else { c.SendPacket(PacketDefinitions.LoginFailed((byte)result)); } }
public void handlePacket(Client c, PacketReader packet) { foreach (KeyValuePair<string, CenterServer> cserv in Program.mServer.centerServers) { c.SendPacket(PacketDefinitions.WorldInformation((byte)cserv.Value.world, cserv.Key, 2, "Hello", 100, 100, cserv.Value.channels)); c.SendPacket(PacketDefinitions.WorldInformationEnd()); c.SendPacket(PacketDefinitions.LastConnectedWorld(c.RecentWorld)); c.SendPacket(PacketDefinitions.RecommendWorldMessage()); } }
public void handlePacket(Client c, PacketReader packet) { short world = packet.ReadShort(); int count = 0; foreach (KeyValuePair<int, int> server in Program.mServer.GetCenterServerById(world).channels) { count += server.Value; } if (count > 30) c.SendPacket(PacketDefinitions.CheckUserLimit(0, 1)); else c.SendPacket(PacketDefinitions.CheckUserLimit(0, 0)); }
public void handlePacket(Client c, PacketReader packet) { string pic = packet.ReadMapleString(); int cid = packet.ReadInt(); if (pic != c.Pic) c.SendPacket(PacketDefinitions.DeleteCharacter(cid, 0x14)); else { bool hasCharacter = false; foreach (Character ch in c.Characters) if (ch.mID == cid) hasCharacter = true; if (!hasCharacter) return; // TODO: AUTOBAN Database.DeleteCharacter(cid); c.SendPacket(PacketDefinitions.DeleteCharacter(cid, 0)); } }
public void handlePacket(Client c, PacketReader packet) { packet.Skip(1); byte world = packet.ReadByte(); byte channel = packet.ReadByte(); c.RecentChannel = channel; c.RecentWorld = world; c.Characters = Database.GetCharacters(c.AccountId); c.SaveAccountToDatabase(); c.SendPacket(PacketDefinitions.CharacterLoadout(c)); }
public void handlePacket(Client c, PacketReader packet) { string pic = Database.MySqlEscape(packet.ReadMapleString()); int cid = packet.ReadInt(); string macs = packet.ReadMapleString(); // i should probably do something with these lol string HWID = packet.ReadMapleString(); // ?_hdd serial if (pic != c.Pic) c.SendPacket(PacketDefinitions.BadPic()); else { c.Migrate = true; Program.mServer.GetCenterServerById(c.RecentWorld).mCenterConnection.mSession.SendPacket(CenterServerPacketDefinitions.RequestMigrate(c.AccountId, cid, c.RecentChannel)); } }
public void handlePacket(Client c, PacketReader packet) { string charname = Database.MySqlEscape(packet.ReadMapleString()); int jobtype = packet.ReadInt(); short specialjobtype = packet.ReadShort(); byte gender = packet.ReadByte(); packet.Skip(2); int face = packet.ReadInt(); int hair = packet.ReadInt(); int haircolor = packet.ReadInt(); int skin = packet.ReadInt(); int top = packet.ReadInt(); int bottom = 0; if (jobtype < 5) bottom = packet.ReadInt(); int shoes = packet.ReadInt(); int weapon = packet.ReadInt(); int shield = 0; if (jobtype == 6) shield = packet.ReadInt(); Character newchr = new Character(); newchr.mName = charname; if (jobtype == 0) { newchr.mPrimaryStats.Job = (short)Job.Citizen; } else if (jobtype == 1) { newchr.mPrimaryStats.Job = (short)Job.Beginner; } else if (jobtype == 2) { newchr.mPrimaryStats.Job = (short)Job.Noblesse; } else if (jobtype == 3) { newchr.mPrimaryStats.Job = (short)Job.Legend; } else if (jobtype == 4) { newchr.mPrimaryStats.Job = (short)Job.Evan1; } else if (jobtype == 5) { newchr.mPrimaryStats.Job = (short)Job.Mercedes; } else if (jobtype == 6) { newchr.mPrimaryStats.Job = (short)Job.DemonSlayer; } newchr.mMap = 100000000; newchr.mClient = c; newchr.mHair = hair + haircolor; newchr.mFace = face; newchr.mSkin = (byte)skin; newchr.mGender = gender; newchr.mPrimaryStats.Level = 1; newchr.mPrimaryStats.HP = 50; newchr.mPrimaryStats.MaxHP = 50; newchr.mPrimaryStats.MP = 50; newchr.mPrimaryStats.MaxMP = 50; newchr.mPrimaryStats.Str = 4; newchr.mPrimaryStats.Dex = 4; newchr.mPrimaryStats.Int = 4; newchr.mPrimaryStats.Luk = 4; Equip eweapon = new Equip(weapon, "Character creation (JobId " + jobtype + ")"); eweapon.Watk = 17; eweapon.Position = -11; newchr.mInventory[0].Add(eweapon.Position, eweapon); if (shield > 0) { Equip eshield = new Equip(shield, "Character creation (JobId " + jobtype + ")"); eshield.Position = -10; newchr.mInventory[0].Add(eshield.Position, eshield); } Equip etop = new Equip(top, "Character creation (JobId " + jobtype + ")"); etop.Position = -5; newchr.mInventory[0].Add(etop.Position, etop); if (bottom > 0) { Equip ebottom = new Equip(bottom, "Character creation (JobId " + jobtype + ")"); ebottom.Position = -6; newchr.mInventory[0].Add(ebottom.Position, ebottom); } Equip eshoes = new Equip(shoes, "Character creation (JobId " + jobtype + ")"); eshoes.Position = -7; newchr.mInventory[0].Add(eshoes.Position, eshoes); Database.SaveCharacter(newchr, true); c.SendPacket(PacketDefinitions.NewCharacter(newchr)); }
public void handlePacket(Client c, PacketReader packet) { packet.ReadByte(); // unknown, client sends 0x02 c.Characters = Database.GetCharacters(c.AccountId); c.SendPacket(PacketDefinitions.ViewAllCharacters(c.Characters)); }
public void handlePacket(Client c, PacketReader packet) { string name = packet.ReadMapleString(); c.SendPacket(PacketDefinitions.CheckDuplicatedID(name, Database.CheckDuplicatedID(name))); }