//0xBF private static void OnBigFuckingPacket(Packet p) { switch (p.ReadUShort()) { case 6://party switch (p.ReadByte()) { case 1: { byte count = p.ReadByte(); for (int i = 0; i < 10; i++) party[i] = i < count ? p.ReadUInt() : 0; } break; case 2: { byte count = p.ReadByte(); p.Skip(4); for (int i = 0; i < 10; i++) party[i] = i < count ? p.ReadUInt() : 0; } break; } break; case 8://map change Map = (Map)p.ReadByte(); MapChanged.Raise(); break; } }
//0x3A private static void OnSkillUpdate(Packet p) { ushort id; switch (p.ReadByte()) { case 0: while ((id = p.ReadUShort()) > 0) Player.UpdateSkill(id - 1, p.ReadUShort(), p.ReadUShort(), (SkillLock)p.ReadByte(), 100); break; case 2: while ((id = p.ReadUShort()) > 0) Player.UpdateSkill(id - 1, p.ReadUShort(), p.ReadUShort(), (SkillLock)p.ReadByte(), p.ReadUShort()); break; case 0xDF: id = p.ReadUShort(); Player.UpdateSkill(id, p.ReadUShort(), p.ReadUShort(), (SkillLock)p.ReadByte(), p.ReadUShort()); break; case 0xFF: id = p.ReadUShort(); Player.UpdateSkill(id, p.ReadUShort(), p.ReadUShort(), (SkillLock)p.ReadByte(), 100); break; } Player.ProcessDelta(); }
//0x22 private static void OnMovementAccepted(Packet p) { p.Skip(1); Player.Notoriety = (Notoriety)p.ReadByte(); if (movementQueue.Count > 0) ProcessMove(movementQueue.Dequeue()); Player.ProcessDelta(); }
//0x20 private static void OnPlayerUpdate(Packet p) { if (p.ReadUInt() != Player) throw new Exception("OnMobileStatus");//does this happen? movementQueue.Clear(); Player.Graphic = (ushort)(p.ReadUShort() + p.ReadSByte()); Player.Hue = p.ReadUShort(); Player.Flags = (UOFlags)p.ReadByte(); ushort x = p.ReadUShort(); ushort y = p.ReadUShort(); p.Skip(2);//unknown Player.Direction = (Direction)p.ReadByte(); Player.Position = new Position(x, y, p.ReadSByte()); OnPlayerMoved(); Player.ProcessDelta(); }
//0x21 private static void OnMovementRejected(Packet p) { movementQueue.Clear(); p.Skip(1); ushort x = p.ReadUShort(); ushort y = p.ReadUShort(); Player.Direction = (Direction)p.ReadByte(); Player.Position = new Position(x, y, p.ReadSByte()); Player.ProcessDelta(); }
//0xCC private static void OnLocalizedMessageAffix(Packet p) { Entity entity = Mobiles.Get(p.ReadUInt()); ushort graphic = p.ReadUShort(); MessageType type = (MessageType)p.ReadByte(); Hue hue = p.ReadUShort(); MessageFont font = (MessageFont)p.ReadUShort(); uint cliloc = p.ReadUInt(); AffixType affixType = (AffixType)p.ReadByte(); string name = p.ReadASCII(30); string affix = p.ReadASCII(); string text = p.ReadUnicode(); if (entity != null) { entity.Graphic = graphic; entity.Name = name; entity.ProcessDelta(); } Chat.OnLocalizedMessage(entity, new UOMessageEventArgs(text, hue, type, font, cliloc, affixType, affix)); }
//0x1B private static void OnLoginConfirm(Packet p) { Mobiles.Add(Player = new PlayerMobile(p.ReadUInt())); p.Skip(4);//unknown Player.Graphic = p.ReadUShort(); Player.Position = new Position(p.ReadUShort(), p.ReadUShort(), (sbyte)p.ReadUShort()); Player.Direction = (Direction)p.ReadByte(); //p.Skip(9);//unknown //p.ReadUShort();//map width //p.ReadUShort();//map height Player.ProcessDelta(); Mobiles.ProcessDelta(); }
//0x78 private static void OnMobileIncoming(Packet p) { Mobile mobile = GetOrCreateMobile(p.ReadUInt()); mobile.Graphic = p.ReadUShort(); mobile.Position = new Position(p.ReadUShort(), p.ReadUShort(), p.ReadSByte()); mobile.Direction = (Direction)p.ReadByte(); mobile.Hue = p.ReadUShort(); mobile.Flags = (UOFlags)p.ReadByte(); mobile.Notoriety = (Notoriety)p.ReadByte(); uint itemSerial; while ((itemSerial = p.ReadUInt()) != 0) { Item item = GetOrCreateItem(itemSerial); ushort graphic = p.ReadUShort(); item.Layer = (Layer)p.ReadByte(); if (useNewMobileIncoming.Value || (graphic & 0x8000) != 0) item.Hue = p.ReadUShort(); if (useNewMobileIncoming.Value) item.Graphic = graphic; else if (usePostSAChanges.Value) item.Graphic = (ushort)(graphic & 0x7FFF); else item.Graphic = (ushort)(graphic & 0x3FFF); item.Amount = 1; item.Container = mobile; mobile.Items.Add(item); item.ProcessDelta(); Items.Add(item); } mobile.ProcessDelta(); if (Mobiles.Add(mobile)) Mobiles.ProcessDelta(); Items.ProcessDelta(); }
//0x1C private static void OnASCIIMessage(Packet p) { Entity entity = Mobiles.Get(p.ReadUInt()); ushort graphic = p.ReadUShort(); MessageType type = (MessageType)p.ReadByte(); Hue hue = p.ReadUShort(); MessageFont font = (MessageFont)p.ReadUShort(); string name = p.ReadASCII(30); string text = p.ReadASCII(); if (entity != null) { entity.Graphic = graphic; entity.Name = name; entity.ProcessDelta(); } Chat.OnMessage(entity, new UOMessageEventArgs(text, hue, type, font)); }
private static void WritePacket(Packet packet) { Console.WriteLine("\t\t {0:X2} - {1} bytes", packet.Id, packet.Length); Console.WriteLine(" 0 1 2 3 4 5 6 7 8 9 A B C D E F"); Console.WriteLine("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"); packet.Seek(0); for (int i = 0; i < packet.Length; i++) { if (i % 16 == 0 && i != 0) Console.WriteLine(); if (i % 8 == 0 && i % 16 != 0) Console.Write(" "); Console.Write(packet.ReadByte().ToString("X2")); Console.Write(" "); } Console.WriteLine(); Console.WriteLine(); }
//0xC8 private static void OnChangeUpdateRange(Packet p) { updateRange = p.ReadByte(); }
//0x3A private static void OnChangeSkillLock(Packet p) { Player.UpdateSkillLock(p.ReadUShort(), (SkillLock)p.ReadByte()); Player.ProcessDelta(); }
//0x02 private static void OnMovementRequest(Packet p) { movementQueue.Enqueue((Direction)p.ReadByte()); }
//0x97 private static void OnMovementDemand(Packet p) { ProcessMove((Direction)p.ReadByte()); Player.ProcessDelta(); }
//0x11 private static void OnMobileStatus(Packet p) { Mobile mobile = Mobiles.Get(p.ReadUInt()); if (mobile == null) return; mobile.Name = p.ReadASCII(30); mobile.Hits = p.ReadUShort(); mobile.HitsMax = p.ReadUShort(); mobile.Renamable = p.ReadBool(); byte type = p.ReadByte(); if (type > 0) { Player.Female = p.ReadBool(); Player.Strength = p.ReadUShort(); Player.Dexterity = p.ReadUShort(); Player.Intelligence = p.ReadUShort(); Player.Stamina = p.ReadUShort(); Player.StaminaMax = p.ReadUShort(); Player.Mana = p.ReadUShort(); Player.ManaMax = p.ReadUShort(); Player.Gold = p.ReadUInt(); Player.ResistPhysical = p.ReadUShort(); Player.Weight = p.ReadUShort(); } if (type >= 5)//ML { Player.WeightMax = p.ReadUShort(); p.Skip(1); } if (type >= 2)//T2A p.Skip(2); if (type >= 3)//Renaissance { Player.Followers = p.ReadByte(); Player.FollowersMax = p.ReadByte(); } if (type >= 4)//AOS { Player.ResistFire = p.ReadUShort(); Player.ResistCold = p.ReadUShort(); Player.ResistPoison = p.ReadUShort(); Player.ResistEnergy = p.ReadUShort(); Player.Luck = p.ReadUShort(); Player.DamageMin = p.ReadUShort(); Player.DamageMax = p.ReadUShort(); Player.TithingPoints = p.ReadUInt(); } mobile.ProcessDelta(); }
//0x77 private static void OnMobileMoving(Packet p) { Mobile mobile = GetOrCreateMobile(p.ReadUInt()); mobile.Graphic = p.ReadUShort(); mobile.Position = new Position(p.ReadUShort(), p.ReadUShort(), p.ReadSByte()); mobile.Direction = (Direction)p.ReadByte(); mobile.Hue = p.ReadUShort(); mobile.Flags = (UOFlags)p.ReadByte(); mobile.Notoriety = (Notoriety)p.ReadByte(); mobile.ProcessDelta(); if (Mobiles.Add(mobile)) Mobiles.ProcessDelta(); }