Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/NosCore.Packets/NosCore.Packets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<RepositoryUrl>https://github.com/NosCoreIO/NosCore.Packets.git</RepositoryUrl>
<PackageIconUrl></PackageIconUrl>
<PackageTags>nostale, noscore, chickenapi, nostale private server source, nostale emulator</PackageTags>
<Version>21.1.1</Version>
<Version>21.1.2</Version>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Description>NosCore's Packets (Nostale packets) defined over classes</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
}
18 changes: 17 additions & 1 deletion test/NosCore.Packets.Tests/SerializerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Loading