internal void Read(PacketReader p) { m_Content.Clear(); p.Seek(5, System.IO.SeekOrigin.Begin); // seek to packet data p.ReadUInt32(); // serial p.ReadByte(); // 0 p.ReadByte(); // 0 m_Hash = p.ReadInt32(); m_StringNums.Clear(); m_StringNums.AddRange(m_DefaultStringNums); while (p.Position < p.Length) { int num = p.ReadInt32(); if (num == 0) { break; } m_StringNums.Remove(num); short bytes = p.ReadInt16(); string args = string.Empty; if (bytes > 0) { args = p.ReadUnicodeStringBE(bytes >> 1); } if (m_Content.Any(e => e.Number == num)) { continue; } else { m_Content.Add(new OPLEntry(num, args)); } } foreach (OPLEntry ent in m_CustomContent) { if (m_StringNums.Contains(ent.Number)) { m_StringNums.Remove(ent.Number); } else { foreach (int t in m_DefaultStringNums) { if (ent.Number == t) { ent.Number = GetStringNumber(); break; } } } } }
private static void MobileStatus(PacketReader p) { Serial serial = p.ReadUInt32(); Mobile m = World.FindMobile(serial); if (m == null) { World.AddMobile(m = new Mobile(serial)); } m.Name = p.ReadString(30); m.Hits = p.ReadUInt16(); m.HitsMax = p.ReadUInt16(); p.ReadBoolean(); //CanBeRenamed byte type = p.ReadByte(); if (m == World.Player && type != 0x00) { PlayerData player = (PlayerData)m; player.Female = p.ReadBoolean(); player.Str = p.ReadUInt16(); player.Dex = p.ReadUInt16(); player.Int = p.ReadUInt16(); player.Stam = p.ReadUInt16(); player.StamMax = p.ReadUInt16(); player.Mana = p.ReadUInt16(); player.ManaMax = p.ReadUInt16(); player.Gold = p.ReadUInt32(); player.AR = p.ReadUInt16(); // ar / physical resist player.Weight = p.ReadUInt16(); if (type == 0x03 || type == 0x04) { player.StatCap = p.ReadUInt16(); player.Followers = p.ReadByte(); player.FollowersMax = p.ReadByte(); if (type == 0x04) { /*m_Stream.Write( (short) beheld.FireResistance ); // Fire * m_Stream.Write( (short) beheld.ColdResistance ); // Cold * m_Stream.Write( (short) beheld.PoisonResistance ); // Poison * m_Stream.Write( (short) beheld.EnergyResistance ); // Energy * m_Stream.Write( (short) 0 ); // Luck * m_Stream.Write( (short) 0 ); // Damage min * m_Stream.Write( (short) 0 ); // Damage max*/ p.Seek(14, SeekOrigin.Current); player.Tithe = p.ReadInt32(); } } } }
public void Read(PacketReader p) { m_Content.Clear(); p.Seek(5, System.IO.SeekOrigin.Begin); // seek to packet data p.ReadUInt32(); // serial p.ReadByte(); // 0 p.ReadByte(); // 0 m_Hash = p.ReadInt32(); m_StringNums.Clear(); m_StringNums.AddRange(m_DefaultStringNums); while (p.Position < p.Length) { int num = p.ReadInt32(); if (num == 0) { break; } m_StringNums.Remove(num); short bytes = p.ReadInt16(); string args = null; if (bytes > 0) { args = p.ReadUnicodeStringBE(bytes >> 1); } m_Content.Add(new OPLEntry(num, args)); } for (int i = 0; i < m_CustomContent.Count; i++) { OPLEntry ent = (OPLEntry)m_CustomContent[i]; if (m_StringNums.Contains(ent.Number)) { m_StringNums.Remove(ent.Number); } else { for (int s = 0; s < m_DefaultStringNums.Length; s++) { if (ent.Number == m_DefaultStringNums[s]) { ent.Number = GetStringNumber(); break; } } } } }
internal void Read(PacketReader p) { var property_list = new List <OPLEntry>(); p.Seek(5, System.IO.SeekOrigin.Begin); // seek to packet data p.ReadUInt32(); // serial p.ReadByte(); // 0 p.ReadByte(); // 0 m_Hash = p.ReadInt32(); m_StringNums.Clear(); m_StringNums.AddRange(m_DefaultStringNums); while (p.Position < p.Length) { int num = p.ReadInt32(); if (num == 0) { break; } m_StringNums.Remove(num); short bytes = p.ReadInt16(); string args = string.Empty; if (bytes > 0) { args = p.ReadUnicodeStringBE(bytes >> 1); } if (property_list.Any(e => e.Number == num)) { continue; } else { property_list.Add(new OPLEntry(num, args)); } } m_Content = property_list; }
private static void Skills(PacketReader p) { if (World.Player == null) { return; } byte type = p.ReadByte(); switch (type) { case 0x02: //list (with caps, 3.0.8 and up) { int i; while ((i = p.ReadUInt16()) > 0) { if (i > 0 && i <= Skill.Count) { Skill skill = World.Player.Skills[i - 1]; skill.FixedValue = p.ReadUInt16(); skill.FixedBase = p.ReadUInt16(); skill.Lock = (LockType)p.ReadByte(); skill.FixedCap = p.ReadUInt16(); } else { p.Seek(7, SeekOrigin.Current); } } break; } case 0xDF: //change (with cap, new clients) { int i = p.ReadUInt16(); if (i >= 0 && i < Skill.Count) { Skill skill = World.Player.Skills[i]; skill.FixedValue = p.ReadUInt16(); skill.FixedBase = p.ReadUInt16(); skill.Lock = (LockType)p.ReadByte(); skill.FixedCap = p.ReadUInt16(); } break; } case 0x00: // list (without caps, older clients) { int i; while ((i = p.ReadUInt16()) > 0) { if (i > 0 && i <= Skill.Count) { Skill skill = World.Player.Skills[i - 1]; skill.FixedValue = p.ReadUInt16(); skill.FixedBase = p.ReadUInt16(); skill.Lock = (LockType)p.ReadByte(); skill.FixedCap = 100; //p.ReadUInt16(); } else { p.Seek(5, SeekOrigin.Current); } } break; } case 0xFF: //change (without cap, older clients) { int i = p.ReadUInt16(); if (i >= 0 && i < Skill.Count) { Skill skill = World.Player.Skills[i]; skill.FixedValue = p.ReadUInt16(); skill.FixedBase = p.ReadUInt16(); skill.Lock = (LockType)p.ReadByte(); skill.FixedCap = 100; } break; } } }