diff --git a/src/NosCore.Packets/NosCore.Packets.csproj b/src/NosCore.Packets/NosCore.Packets.csproj index 08e8e3f..2e106d6 100644 --- a/src/NosCore.Packets/NosCore.Packets.csproj +++ b/src/NosCore.Packets/NosCore.Packets.csproj @@ -12,7 +12,7 @@ https://github.com/NosCoreIO/NosCore.Packets.git nostale, noscore, chickenapi, nostale private server source, nostale emulator - 21.1.1 + 21.1.2 false NosCore's Packets (Nostale packets) defined over classes MIT diff --git a/src/NosCore.Packets/ServerPackets/Inventory/EInfoNpcMonsterPacket.cs b/src/NosCore.Packets/ServerPackets/Inventory/EInfoNpcMonsterPacket.cs index 62af08e..db567cb 100644 --- a/src/NosCore.Packets/ServerPackets/Inventory/EInfoNpcMonsterPacket.cs +++ b/src/NosCore.Packets/ServerPackets/Inventory/EInfoNpcMonsterPacket.cs @@ -92,7 +92,7 @@ public class EInfoNpcMonsterPacket : PacketBase [PacketIndex(24)] public int Unknown { get; set; } = -1; - [PacketIndex(25)] + [PacketIndex(25, EscapeSpaces = true)] public string? Name { get; set; } } } diff --git a/test/NosCore.Packets.Tests/SerializerTest.cs b/test/NosCore.Packets.Tests/SerializerTest.cs index 805efb7..94c813f 100644 --- a/test/NosCore.Packets.Tests/SerializerTest.cs +++ b/test/NosCore.Packets.Tests/SerializerTest.cs @@ -104,9 +104,25 @@ public class SerializationTests typeof(Stp2Packet), typeof(TbfPacket), typeof(QrPacket), - typeof(SqstPacket) + typeof(SqstPacket), + typeof(EInfoNpcMonsterPacket) }); + // The monster name ends the line, and a last field keeps its spaces unless it asks not + // to. 929 of the 1109 monster-info lines in a capture carry a name with a space in it. + [TestMethod] + public void SerializeEInfoNpcMonsterPacketEscapesTheName() + { + var testPacket = new EInfoNpcMonsterPacket + { + Unknown = -1, + Name = "Fire Cannoneer" + }; + + var packet = Serializer.Serialize(testPacket); + Assert.IsTrue(packet.EndsWith("-1 Fire^Cannoneer"), packet); + } + [TestMethod] public void AllPacketsAreSerializable() {