private bool ServerMessage_0x2F_DialogResponse(Client client, ServerPacket msg) { try { if ((int)msg.ReadByte() != 10) { int num1 = (int)msg.ReadByte(); int serial = (int)msg.ReadUInt32(); msg.Read(16); msg.Seek(29, PacketSeekOrigin.Begin); //goto 29 string response = msg.ReadString(); client.Base.currentDialogResponse = response; int result = // The Convert (System) class comes in pretty handy every time // you want to convert something. Convert.ToInt32( Regex.Replace( client.Base.currentDialogResponse, // Our input "[^0-9]", // Select everything that is not in the range of 0-9 "" // Replace that with an empty string. )); client.Base.dialogNumber = result; } } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); return(false); } return(true); }
public bool ServerMessage_0x03_Redirect(Client client, ServerPacket msg) { var address = msg.Read(4); var port = msg.ReadUInt16(); var length = msg.ReadByte(); var seed = msg.ReadByte(); var key = msg.Read(msg.ReadByte()); var name = msg.ReadString8(); var id = msg.ReadUInt32(); Array.Reverse(address); RemoteEndPoint = new IPEndPoint(new IPAddress(address), port); msg.Data[0] = 0x01; msg.Data[1] = 0x00; msg.Data[2] = 0x00; msg.Data[3] = 0x7F; msg.Data[4] = 0x0A; msg.Data[5] = 0x32; return(true); }
private bool ServerMessage_0x08_StatsUpdated(Client client, ServerPacket msg) { try { Aisling aisling = client.Base.Me; byte num1 = msg.ReadByte(); if (((int)num1 & 32) == 32) { msg.Read(3); aisling.Level = (int)msg.ReadByte(); aisling.Ability = (int)msg.ReadByte(); aisling.MaximumHP = msg.ReadUInt32(); aisling.MaximumMP = msg.ReadUInt32(); aisling.Str = (int)msg.ReadByte(); aisling.Int = (int)msg.ReadByte(); aisling.Wis = (int)msg.ReadByte(); aisling.Con = (int)msg.ReadByte(); aisling.Dex = (int)msg.ReadByte(); bool flag = (int)msg.ReadByte() != 0; aisling.AvailablePoints = (int)msg.ReadByte(); aisling.MaximumWeight = (int)msg.ReadUInt16(); aisling.CurrentWeight = (int)msg.ReadUInt16(); msg.Read(4); } if (((int)num1 & 16) == 16) { aisling.CurrentHP = msg.ReadUInt32(); aisling.CurrentMP = msg.ReadUInt32(); } if (((int)num1 & 8) == 8) { aisling.Experience = msg.ReadUInt32(); aisling.ToNextLevel = msg.ReadUInt32(); aisling.AbilityExp = msg.ReadUInt32(); aisling.ToNextAbility = msg.ReadUInt32(); aisling.GamePoints = msg.ReadUInt32(); aisling.Gold = msg.ReadUInt32(); } if (((int)num1 & 4) == 4) { aisling.BitMask = (int)msg.ReadUInt16(); int num2 = (int)msg.ReadByte(); aisling.AttackElement2 = (int)msg.ReadByte(); aisling.DefenseElement2 = (int)msg.ReadByte(); aisling.AttackElement = (Aisling.Elements)msg.ReadByte(); aisling.DefenseElement = (Aisling.Elements)msg.ReadByte(); aisling.MagicResistance = (int)msg.ReadByte(); aisling.ArmorClass = (int)msg.ReadInt16(); aisling.Damage = (int)msg.ReadSByte(); aisling.Hit = (int)msg.ReadSByte(); } if (aisling.BitMask == 8) { msg.Data[0] = (byte)0; } client.Base.Me = aisling; return(true); } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); return(false); } }