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); }
private bool ServerMessage_0x15_MapInfo(Client client, ServerPacket msg) { try //changes { int key = (int)msg.ReadUInt16(); int num1 = (int)msg.ReadByte(); int num2 = (int)msg.ReadByte(); byte num3 = msg.ReadByte(); int width = num1 | (int)msg.ReadByte() << 8; int height = num2 | (int)msg.ReadByte() << 8; msg.ReadUInt16(); msg.ReadString((int)msg.ReadByte()); client.Base.LastTarget = (Entity)null; client.Base.Animations.Clear(); client.Base.Entitys.Clear(); //if ((int)num3 == 3 || (int)num3 == 64) // msg.BodyData[6] = (byte)0; client.Base.DaMap = new Map(client.Tab, (short)key, width, height); client.Base.LastRefreshed = DateTime.Now; if (!client.Base.Waypoints.ContainsKey(key)) { client.Base.Waypoints.Add(key, new List <Location>()); } client.Base.Entitys.Clear(); client.Tab.walkingLocation = null; //client.Base.Players.Clear(); if (client.LastMap != key) { client.ShouldUpdateMap = true; client.LastMap = key; } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); return(false); } }