public void Can_deserialize_packet() { var rawPacket = FakePackets.Instantiate(new byte[] { 0xAE, // packet 0x00, 0x3C, // size 0x00, 0x00, 0x00, 0x01, // ID 0x01, 0x90, // Model 0x03, // type 0x02, 0xB2, // color 0x00, 0x03, // font 0x45, 0x4E, 0x55, 0x00, // language // name 0x64, 0x64, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x73, 0x00, 0x64, 0x00, 0x66, 0x00, 0x00, // message 0x13, 0x03, // ??? }); var packet = new SpeechMessagePacket(); packet.Deserialize(rawPacket); packet.Id.Should().Be(new ObjectId(0x00000001)); packet.Model.Should().Be((ModelId)0x0190); packet.Type.Should().Be((SpeechType)3); packet.Color.Should().Be((Color)0x02B2); packet.Font.Should().Be(0x0003); packet.Language.Should().Be("ENU"); packet.Name.Should().Be("ddt"); packet.Message.Should().Be("asdf"); }
public void Can_deserialize_object_with_item_with_color() { var packetWithOneItemWithoutColor = FakePackets.Instantiate(new byte[] { 0x78, // packet 0x00, 0x20, // length 0x00, 0x00, 0x00, 0x01, // id 0x01, 0x90, // type 0x12, 0x9B, // xpos 0x05, 0x53, // ypos 0x0A, // zpos 0x07, // direction/facing 0x83, 0xEA, // color 0x00, // status flag 0x01, // notoriety 0x40, 0x00, 0x00, 0x02, // item id 0xA0, 0x3B, // item type 0x0B, // layer 0x04, 0x4E, // color 0x00, 0x00, 0x00, 0x00 // EOF }); var materializedPacket = new DrawObjectPacket(); materializedPacket.Deserialize(packetWithOneItemWithoutColor); var items = materializedPacket.Items.ToArray(); items.Length.Should().Be(1); items.First().Id.Should().Be(new ObjectId(0x40000002)); items.First().Type.Should().Be((ModelId)(0xA03B - 0x8000)); items.First().Amount.Should().Be(1); items.First().ContainerId.Should().Be(new ObjectId(0x00000001u)); items.First().Layer.Should().Be(Layer.Hair); items.First().Color.Should().Be((Color)0x044E); }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x1C, // packet 0x00, 0x40, // size 0x00, 0x00, 0x00, 0x00, // id 0x00, 0x00, // model 0x00, // SpeechType 0x03, 0xB2, // color 0x00, 0x03, // font // name 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // message 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x43, 0x61, 0x6E, 0x63, 0x65, 0x6C, 0x6C, 0x65, 0x64, 0x00 }); var packet = new SendSpeechPacket(); packet.Deserialize(rawPacket); packet.Id.Should().Be(new ObjectId(0)); packet.Model.Should().Be((ModelId)0); packet.Type.Should().Be(SpeechType.Normal); packet.Color.Should().Be((Color)0x03B2); packet.Font.Should().Be(3); packet.Name.Should().Be("System"); packet.Message.Should().Be("Targeting Cancelled"); }
public void Can_deserialize_object_without_items() { var drawObjectPacketWithoutItems = FakePackets.Instantiate(source: new byte[] { 0x78, // packet 0x00, 0x17, // length 0x00, 0x00, 0x00, 0x01, // id 0x01, 0x90, // type 0x12, 0x9B, // xpos 0x05, 0x53, // ypos 0x0A, // zpos 0x07, // direction/facing 0x83, 0xEA, // color 0x00, // status flag 0x01, // notoriety 0x00, 0x00, 0x00, 0x00 // EOF }); var drawObjectPacket = new DrawObjectPacket(); drawObjectPacket.Deserialize(drawObjectPacketWithoutItems); drawObjectPacket.Id.Should().Be(new ObjectId(0x00000001)); drawObjectPacket.Type.Should().Be((ModelId)0x0190); drawObjectPacket.Location.X.Should().Be(0x129B); drawObjectPacket.Location.Y.Should().Be(0x0553); drawObjectPacket.Location.Z.Should().Be(0x0A); drawObjectPacket.Direction.Should().Be(Direction.Northwest); drawObjectPacket.MovementType.Should().Be(MovementType.Walk); drawObjectPacket.Notoriety.Should().Be(Notoriety.Innocent); drawObjectPacket.Color.Should().Be((Color)0x83EA); drawObjectPacket.Items.Should().BeEmpty(); }
public void Can_deserialize_shorter_form_with_garbage_after_message_null() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x1C, // packet 0x00, 0x2C, // length 0x00, 0x00, 0x00, 0x00, // speaker id 0x00, 0x00, // body type 0x00, // speech type 0xFF, 0xFF, // color 0xFF, 0xFF, // font 0x53, 0x59, 0x53, 0x54, 0x45, 0x4D, 0x00, // null terminated name // null terminated message text 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6E, 0x63, 0x79, 0x00, 0x75, // garbage after messsage }); var packet = new SendSpeechPacket(); packet.Deserialize(rawPacket); packet.Id.Should().Be(new ObjectId(0)); packet.Model.Should().Be((ModelId)0); packet.Type.Should().Be(SpeechType.Normal); packet.Color.Should().Be((Color)0xFFFF); packet.Font.Should().Be(0xFFFF); packet.Name.Should().Be("SYSTEM"); packet.Message.Should().Be("updateAccountCurrency"); }
public void Can_deserialize_packet_with_negative_z_coord() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x1B, // packet 0x00, 0x00, 0x00, 0x01, // player id 0x00, 0x00, 0x00, 0x00, // unknown 0x01, 0x90, // body type 0x12, 0x97, // xloc 0x05, 0x46, // yloc 0x00, // unknown 0xF0, // zloc 0x03, // facing 0x00, 0x00, 0x7F, 0x00, // unknown 0x00, 0x06, 0x10, 0x00, // unknown 0x00, // unknown 0x04, 0x70, // server boundary width - 8 0x05, 0x00, // server boundary height 0x00, 0x00, // unknown 0x00, 0x00, 0x00, 0x00, // unknown }); var packet = new CharLocaleAndBodyPacket(); packet.Deserialize(rawPacket); unchecked { packet.Location.Z.Should().Be((sbyte)0xF0); } }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x25, // packet 0x40, 0x06, 0x40, 0x87, // object id 0x1B, 0xDD, // object type 0x00, // item id offset? 0x00, 0x02, // amount 0x00, 0x72, // xloc 0x00, 0x74, // yloc 0x40, 0x02, 0x43, 0x33, // container id 0x00, 0x00, // color }); var packet = new AddItemToContainerPacket(); packet.Deserialize(rawPacket); packet.ItemId.Should().Be(new ObjectId(0x40064087)); packet.Type.Should().Be((ModelId)0x1BDD); packet.Amount.Should().Be(2); packet.Location.X.Should().Be(0x72); packet.Location.Y.Should().Be(0x74); packet.ContainerId.Should().Be(new ObjectId(0x40024333)); packet.Color.Should().Be((Color)0); }
public void Can_deserialize_when_tile_with_negative_z_coord_targeted() { var rawPacket = FakePackets.Instantiate(source: new byte[] { 0x6C, // packet 0x01, // CursorTarget 0xDE, 0xAD, 0xBE, 0xEF, // cursor id 0x00, // CursorType 0x00, 0x00, 0x00, 0x00, // clicked on id 0x03, 0xE8, // xloc 0x03, 0xE8, // yloc 0x00, // unknown 0xF0, // zloc 0x0D, 0x9B // type }); var materializedPacket = new TargetCursorPacket(); materializedPacket.Deserialize(rawPacket); materializedPacket.CursorTarget.Should().Be(CursorTarget.Location); materializedPacket.CursorId.Should().Be(new CursorId(0xDEADBEEF)); materializedPacket.CursorType.Should().Be(CursorType.Neutral); materializedPacket.ClickedOnId.Should().Be(new ObjectId(0)); materializedPacket.Location.X.Should().Be(0x03E8); materializedPacket.Location.Y.Should().Be(0x03E8); unchecked { materializedPacket.Location.Z.Should().Be((sbyte)0xF0); } materializedPacket.ClickedOnType.Should().Be((ModelId)0x0D9B); }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x20, // packet 0x00, 0x00, 0x00, 0x01, // id 0x01, 0x90, // body type 0x00, // unknown 0x83, 0xEA, // skin color hue 0x00, // flag byte 0x12, 0x9C, // xloc 0x05, 0x52, // yloc 0x00, 0x00, // unknown 0x04, // direction 0x0A, // zloc }); var packet = new DrawGamePlayerPacket(); packet.Deserialize(rawPacket); packet.PlayerId.Should().Be(new ObjectId(0x00000001)); packet.BodyType.Should().Be((ModelId)0x0190); packet.Location.X.Should().Be(0x129C); packet.Location.Y.Should().Be(0x0552); packet.Location.Z.Should().Be(0x0A); packet.Color.Should().Be((Color)0x83EA); packet.MovementType.Should().Be(MovementType.Walk); packet.Direction.Should().Be(Direction.South); }
public void Can_deserialize_when_item_targeted() { var rawPacket = FakePackets.Instantiate(source: new byte[] { 0x6C, // packet 0x00, // CursorTarget 0xDE, 0xAD, 0xBE, 0xEF, // cursor id 0x00, // CursorType 0x40, 0x00, 0x00, 0x0B, // clicked on item id 0x00, 0x80, // xloc 0x00, 0x6D, // yloc 0x00, // unknown 0x00, // zloc 0x0E, 0xED // type }); var materializedPacket = new TargetCursorPacket(); materializedPacket.Deserialize(rawPacket); materializedPacket.CursorTarget.Should().Be(CursorTarget.Object); materializedPacket.CursorId.Should().Be(new CursorId(0xDEADBEEF)); materializedPacket.CursorType.Should().Be(CursorType.Neutral); materializedPacket.ClickedOnId.Should().Be(new ObjectId(0x4000000B)); materializedPacket.Location.X.Should().Be(0x0080); materializedPacket.Location.Y.Should().Be(0x006D); materializedPacket.Location.Z.Should().Be(0); materializedPacket.ClickedOnType.Should().Be((ModelId)0x0EED); }
public void Can_deserialize_packet_with_negative_z_coord() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x20, // packet 0x00, 0x00, 0x00, 0x01, // id 0x01, 0x90, // body type 0x00, // unknown 0x83, 0xEA, // skin color hue 0x00, // flag byte 0x12, 0x9C, // xloc 0x05, 0x52, // yloc 0x00, 0x00, // unknown 0x04, // direction 0xF0, // zloc }); var packet = new DrawGamePlayerPacket(); packet.Deserialize(rawPacket); unchecked { packet.Location.Z.Should().Be((sbyte)0xF0); } }
public void Can_deserialize_packet_with_negative_zcoord() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x1A, 0x00, 0x0E, 0x40, 0x00, 0x11, 0x37, 0x0E, 0x80, 0x0A, 0xAB, 0x0C, 0xB5, 0xF0, }); var packet = new ObjectInfoPacket(); packet.Deserialize(rawPacket); packet.Id.Should().Be(new ObjectId(0x40001137)); packet.Type.Should().Be((ModelId)0x0E80); packet.Location.X.Should().Be(0x0AAB); packet.Location.Y.Should().Be(0x0CB5); unchecked { packet.Location.Z.Should().Be((sbyte)0xF0); } }
public void Can_deserialize_packet_with_dye() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x1A, // packet 0x00, 0x10, // size 0x40, 0x03, 0x7C, 0xBD, // object id 0x1A, 0xD7, // type 0x14, 0xF4, // xloc 0x8B, 0xAE, // yloc 0x06, // zloc 0x09, 0x80 // dye }); var packet = new ObjectInfoPacket(); packet.Deserialize(rawPacket); packet.Id.Should().Be(new ObjectId(0x40037cbd)); packet.Type.Should().Be((ModelId)0x1ad7); packet.Location.X.Should().Be(0x14f4); packet.Location.Y.Should().Be(0x0BAE); packet.Location.Z.Should().Be(0x06); packet.Dye.Should().Be((Color)0x0980); }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x1B, // packet 0x00, 0x00, 0x00, 0x01, // player id 0x00, 0x00, 0x00, 0x00, // unknown 0x01, 0x90, // body type 0x12, 0x97, // xloc 0x05, 0x46, // yloc 0x00, // unknown 0x0A, // zloc 0x03, // facing 0x00, 0x00, 0x7F, 0x00, // unknown 0x00, 0x06, 0x10, 0x00, // unknown 0x00, // unknown 0x04, 0x70, // server boundary width - 8 0x05, 0x00, // server boundary height 0x00, 0x00, // unknown 0x00, 0x00, 0x00, 0x00, // unknown }); var packet = new CharLocaleAndBodyPacket(); packet.Deserialize(rawPacket); packet.PlayerId.Should().Be(new ObjectId(0x00000001)); packet.BodyType.Should().Be((ModelId)0x0190); packet.Location.X.Should().Be(0x1297); packet.Location.Y.Should().Be(0x0546); packet.Location.Z.Should().Be(0x0A); packet.Direction.Should().Be(Direction.Southeast); packet.MovementType.Should().Be(MovementType.Walk); }
public void Can_deserialize_packet_with_item_without_color() { var packetWithOneItemWithoutColor = FakePackets.Instantiate(new byte[] { 0x78, // packet 0x00, 0x1E, // length 0x00, 0x00, 0x00, 0x01, // id 0x01, 0x90, // type 0x12, 0x9B, // xpos 0x05, 0x53, // ypos 0x0A, // zpos 0x07, // direction/facing 0x83, 0xEA, // color 0x00, // status flag 0x01, // notoriety 0x40, 0x00, 0x00, 0x0C, // item1 id 0x0F, 0x44, // item1 type 0x02, // layer 0x00, 0x00, 0x00, 0x00 // EOF }); var materializedPacket = new DrawObjectPacket(); materializedPacket.Deserialize(packetWithOneItemWithoutColor); var items = materializedPacket.Items.ToArray(); items.Length.Should().Be(1); items.First().Id.Should().Be(new ObjectId(0x4000000C)); items.First().Type.Should().Be((ModelId)0x0F44); items.First().Amount.Should().Be(1); items.First().ContainerId.Should().Be(new ObjectId(0x00000001u)); items.First().Layer.Should().Be(Layer.TwoHandedWeapon); }
public void Can_deserialize_packet_with_StatusFlag_equals_to_0() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x11, // packet 0x00, 0x2B, // size 0x00, 0x05, 0x75, 0xF7, // player id // name 0x50, 0x74, 0x61, 0x63, 0x65, 0x6B, 0x00, 0x00, 0x00, 0x78, 0xA0, 0x7E, 0x0B, 0xAB, 0xE4, 0xA1, 0x02, 0x88, 0x7A, 0x7E, 0x0B, 0x79, 0xA3, 0x4D, 0x00, 0x00, 0x7A, 0x7E, 0x0B, 0xB0, 0x00, 0x64, // current health 0x00, 0x64, // max health 0x00, // name change flag 0x00, // status flag }); var packet = new StatusBarInfoPacket(); packet.Deserialize(rawPacket); packet.PlayerId.Should().Be(new ObjectId(0x000575F7)); packet.PlayerName.Should().Be("Ptacek"); packet.CurrentHealth.Should().Be(0x64); packet.MaxHealth.Should().Be(0x64); packet.Status.Should().Be(0); }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x77, // packet 0x00, 0x06, 0x62, 0x21, // PlayerId 0x00, 0x06, // type 0x08, 0xED, // xloc 0x09, 0x7F, // yloc 0x01, // zloc 0x01, // direction 0x09, 0x01, // color 0x00, // status flag 0x03, // highlight color }); var packet = new UpdatePlayerPacket(); packet.Deserialize(rawPacket); packet.PlayerId.Should().Be(new ObjectId(0x00066221)); packet.Type.Should().Be((ModelId)0x0006); packet.Location.X.Should().Be(0x08ed); packet.Location.Y.Should().Be(0x097f); packet.Location.Z.Should().Be(1); packet.Direction.Should().Be(Direction.Northeast); packet.MovementType.Should().Be(MovementType.Walk); packet.Color.Should().Be((Color)0x0901); }
public void Can_deserialize_packet_with_StatusFlag_equals_to_6() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x11, // packet 0x00, 0x79, // size 0x00, 0x00, 0x04, 0x61, // id // name 0x61, 0x73, 0x64, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, // hp 0x00, 0x43, // max hp 0x00, // name change 0x06, // status flag 0x00, // sex + race 0x00, 0x23, // str 0x00, 0x23, // dex 0x00, 0x0A, // int 0x00, 0x23, // stam 0x00, 0x23, // max stam 0x00, 0x0A, // mana 0x00, 0x0A, // max mana 0x00, 0x00, 0x03, 0xE8, // gold 0x00, 0x02, // armor 0x00, 0x3E, // weight // ignored 0x00, 0xDE, 0x01, 0x00, 0xE6, 0x00, 0x05, 0x00, 0x04, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, 0x64, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }); var packet = new StatusBarInfoPacket(); packet.Deserialize(rawPacket); packet.PlayerId.Should().Be(new ObjectId(0x00000461)); packet.PlayerName.Should().Be("asdf"); packet.CurrentHealth.Should().Be(0x43); packet.MaxHealth.Should().Be(0x43); packet.Status.Should().Be(0); packet.Strength.Should().Be(0x23); packet.Dexterity.Should().Be(0x23); packet.Intelligence.Should().Be(0x0a); packet.CurrentStamina.Should().Be(0x23); packet.MaxStamina.Should().Be(0x23); packet.CurrentMana.Should().Be(0x0a); packet.MaxMana.Should().Be(0x0a); packet.Gold.Should().Be(0x03e8); packet.Weight.Should().Be(0x3e); }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x22, // packet 0x02, // movement sequence key 0x41, // notoriety flag }); var packet = new CharacterMoveAckPacket(); packet.Deserialize(rawPacket); packet.MovementSequenceKey.Should().Be(0x02); }
public void Can_deserialize_single_skill_update() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x3A, 0x00, 0x0B, 0xFF, 0x00, 0x2C, 0x00, 0x0A, 0x00, 0x0A, 0x00, }); var packet = new SendSkillsPacket(); packet.Deserialize(rawPacket); packet.Values.Length.Should().Be(1); packet.Values[0].Should().Be(new SkillValue(Skill.Lumberjacking, 0x0A, 0x0A, 0, false)); }
public void Can_deserialize_packet_with_StatusFlag_equals_to_7() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x11, // packet 0x00, 0x54, // size 0x00, 0x04, 0x5B, 0x2A, // player id // name 0x50, 0x69, 0x70, 0x6B, 0x61, 0x00, 0xFF, 0x34, 0x0B, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x35, 0x0B, 0x38, 0x05, 0x35, 0x0B, 0x38, 0x05, 0x35, 0x0B, 0x72, 0x65, 0x67, 0x69, 0x6F, 0x00, 0x68, // current health 0x00, 0x68, // max health 0x00, // name change flag 0x07, // status flag 0x00, // sex + race 0x00, 0x76, // strength 0x00, 0x32, // dexterity 0x00, 0x28, // intelligence 0x00, 0x26, // current stamina 0x00, 0x68, // max stamina 0x00, 0x28, // current mana 0x00, 0x28, // max mana 0x00, 0x00, 0x2E, 0x38, // gold 0x00, 0x26, // armor rating 0x00, 0x9C, // weight // ignored fields 0x03, 0xE8, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x1F, }); var packet = new StatusBarInfoPacket(); packet.Deserialize(rawPacket); packet.PlayerId.Should().Be(new ObjectId(0x00045B2A)); packet.PlayerName.Should().Be("Pipka"); packet.CurrentHealth.Should().Be(0x68); packet.MaxHealth.Should().Be(0x68); packet.Status.Should().Be(0); packet.Strength.Should().Be(0x76); packet.Dexterity.Should().Be(0x32); packet.Intelligence.Should().Be(0x28); packet.CurrentStamina.Should().Be(0x26); packet.MaxStamina.Should().Be(0x68); packet.CurrentMana.Should().Be(0x28); packet.MaxMana.Should().Be(0x28); packet.Gold.Should().Be(0x2E38); packet.Weight.Should().Be(0x9C); }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0xBF, // packet 0x00, 0x0D, // size 0x00, 0x04, // sub command 0x96, 0x00, 0x05, 0x7B, 0x00, 0x00, 0x00, 0x01 }); var packet = new CloseGenericGumpPacket(); packet.Deserialize(rawPacket); packet.GumpTypeId.Should().Be((GumpTypeId)0x9600057B); }
public void Can_deserialize_walk_request() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x02, // packet 0x00, // direction 0x06, // sequence key 0x00, 0x00, 0x00, 0x00 // fast walk prevention key }); var packet = new MoveRequest(); packet.Deserialize(rawPacket); packet.Direction.Should().Be(Direction.North); packet.MovementType.Should().Be(MovementType.Walk); packet.SequenceKey.Should().Be(0x06); }
public void Can_deserialize_packet_with_StatusFlag_equals_to_1() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x11, // packet 0x00, 0x42, // size 0x00, 0x04, 0x5B, 0x2A, // serial // name 0x50, 0x69, 0x70, 0x6B, 0x61, 0x00, 0x61, 0x6B, 0x00, 0x00, 0x05, 0x35, 0x0B, 0x61, 0x63, 0x74, 0x00, 0x68, 0x05, 0x35, 0x0B, 0xC4, 0xFF, 0x34, 0x0B, 0x7C, 0xFF, 0x34, 0x0B, 0x00, 0x00, 0x68, // current health 0x00, 0x68, // max health 0x00, // name change flag 0x01, // status flag 0x00, // sex + race 0x00, 0x72, // strength 0x00, 0x32, // dexterity 0x00, 0x28, // intelligence 0x00, 0x53, // current stamina 0x00, 0x68, // max stamina 0x00, 0x28, // current mana 0x00, 0x28, // max mana 0x00, 0x00, 0x2F, 0xBE, // gold 0x00, 0x43, // armor rating 0x00, 0x9A // weight }); var packet = new StatusBarInfoPacket(); packet.Deserialize(rawPacket); packet.PlayerId.Should().Be(new ObjectId(0x00045B2A)); packet.PlayerName.Should().Be("Pipka"); packet.CurrentHealth.Should().Be(0x68); packet.MaxHealth.Should().Be(0x68); packet.Status.Should().Be(0); packet.Strength.Should().Be(0x72); packet.Dexterity.Should().Be(0x32); packet.Intelligence.Should().Be(0x28); packet.CurrentStamina.Should().Be(0x53); packet.MaxStamina.Should().Be(0x68); packet.CurrentMana.Should().Be(0x28); packet.MaxMana.Should().Be(0x28); packet.Gold.Should().Be(0x2FBE); packet.Weight.Should().Be(0x9A); }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0xBA, // packet id 0x01, // active? 0x12, 0x14, // x 0x0F, 0x3E, // y }); var packet = new QuestArrowPacket(); packet.Deserialize(rawPacket); packet.Active.Should().BeTrue(); packet.Location.Should().Be(new Location2D(0x1214, 0x0F3E)); }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0xA3, // packet 0x00, 0x04, 0x5B, 0x2A, // player id 0x00, 0x68, // max stamina 0x00, 0x53 // current stamina }); var packet = new UpdateCurrentStaminaPacket(); packet.Deserialize(rawPacket); packet.PlayerId.Should().Be(new ObjectId(0x00045B2A)); packet.MaxStamina.Should().Be(0x0068); packet.CurrentStamina.Should().Be(0x0053); }
public void Can_deserialize_unicode() { var rawPacket = FakePackets.Instantiate(new byte[] { 0xAD, // packet 0x00, 0x16, // size 0x00, // type 0x02, 0xB2, // color 0x00, 0x03, // font 0x45, 0x4E, 0x55, 0x00, // language 0x00, 0x61, 0x00, 0x73, 0x00, 0x64, 0x00, 0x66, 0x00, 0x00, // message }); var packet = new SpeechRequest(); packet.Deserialize(rawPacket); packet.Text.Should().Be("asdf"); }
public void Can_deserialize_packet_with_negative_z_coords() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x70, // packet 0x03, // direction type 0x00, 0x04, 0x5B, 0x2A, // character id 0x00, 0x00, 0x00, 0x00, // target id 0x37, 0x3A, // model of the first frame 0x0A, 0xA0, // xloc 0x0C, 0xB3, // yloc 0xF0, // zloc 0x0A, 0xA0, // target xloc 0x0C, 0xB3, // target yloc 0xF1, // target zloc 0x00, // speed of animation 0x0F, // duration 0x00, 0x00, // unknown 0x01, // adjust direction during animation 0x00, // explode on impact }); var packet = new GraphicalEffectPacket(); packet.Deserialize(rawPacket); packet.DirectionType.Should().Be(EffectDirectionType.StayWithSource); packet.CharacterId.Should().Be((ObjectId)0x00045B2A); packet.TargetId.Should().Be((ObjectId)0x00000000); packet.Type.Should().Be((ModelId)0x373A); unchecked { packet.Location.Should().Be(new Location3D(0x0AA0, 0x0CB3, (sbyte)0xF0)); packet.TargetLocation.Should().Be(new Location3D(0x0AA0, 0x0CB3, (sbyte)0xF1)); } packet.AnimationSpeed.Should().Be(0); packet.Duration.Should().Be(0); packet.AdjustDirection.Should().BeTrue(); packet.ExplodeOnImpact.Should().BeFalse(); }
public void Can_deserialize_packet_with_keywords() { var rawPacket = FakePackets.Instantiate(new byte[] { 0xAD, // packet 0x00, 0x15, // size 0xC0, // type 0x02, 0xB2, // color 0x00, 0x03, // font 0x45, 0x4E, 0x55, 0x00, // language 0x00, 0x10, 0x1C, // keywords 0x2C, 0x74, 0x65, 0x73, 0x74, 0x00, // message }); var packet = new SpeechRequest(); packet.Deserialize(rawPacket); packet.Text.Should().Be(",test"); }
public void Can_deserialize() { var rawPacket = FakePackets.Instantiate(new byte[] { 0x54, // packet id 0x01, // mode 0x01, 0x3E, // sound id 0x00, 0x00, // unknown 0x06, 0xA5, // x 0x04, 0xCB, // y 0x00, 0x23, // z }); var packet = new PlaySoundEffectPacket(); packet.Deserialize(rawPacket); packet.Id.Should().Be((SoundId)0x13E); packet.Location.Should().Be(new Location3D(0x06A5, 0x04CB, 0)); }