diff --git a/Directory.Packages.props b/Directory.Packages.props
index 90ac4edd8..2002a09db 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -44,7 +44,7 @@
-
+
diff --git a/src/NosCore.GameObject/Ecs/Extensions/NpcInfoExtensions.cs b/src/NosCore.GameObject/Ecs/Extensions/NpcInfoExtensions.cs
index eba4475a8..6f6372dbd 100644
--- a/src/NosCore.GameObject/Ecs/Extensions/NpcInfoExtensions.cs
+++ b/src/NosCore.GameObject/Ecs/Extensions/NpcInfoExtensions.cs
@@ -1,4 +1,4 @@
-// __ _ __ __ ___ __ ___ ___
+// __ _ __ __ ___ __ ___ ___
// | \| |/__\ /' _/ / _//__\| _ \ __|
// | | ' | \/ |`._`.| \_| \/ | v / _|
// |_|\__|\__/ |___/ \__/\__/|_|_\___|
@@ -13,15 +13,6 @@ namespace NosCore.GameObject.Ecs.Extensions;
public static class NpcInfoExtensions
{
- // Builds the e_info response for a req_info 5 (NPC) or req_info 6 (monster/mate).
- // OpenNos's NpcMonster.GenerateEInfo AND Mate.GenerateEInfo both emit:
- // `e_info 10
- //
- //
- // -1 `
- // — the leading 10 is the format discriminator and the trailing -1 is a constant
- // the client expects before the name field. Without either, the client can't align
- // fields and falls back to defaults (Level=0, HP=100/100) in the target info card.
public static EInfoNpcMonsterPacket GenerateNpcInfo(this NpcMonsterDto npc, RegionType language)
{
return new EInfoNpcMonsterPacket
@@ -50,6 +41,7 @@ public static EInfoNpcMonsterPacket GenerateNpcInfo(this NpcMonsterDto npc, Regi
DarkResistance = npc.DarkResistance,
MaxHp = npc.MaxHp,
MaxMp = npc.MaxMp,
+ Name = npc.Name[language],
};
}
diff --git a/test/NosCore.GameObject.Tests/Ecs/Extensions/NpcInfoLineTests.cs b/test/NosCore.GameObject.Tests/Ecs/Extensions/NpcInfoLineTests.cs
new file mode 100644
index 000000000..64e9d8141
--- /dev/null
+++ b/test/NosCore.GameObject.Tests/Ecs/Extensions/NpcInfoLineTests.cs
@@ -0,0 +1,60 @@
+// __ _ __ __ ___ __ ___ ___
+// | \| |/__\ /' _/ / _//__\| _ \ __|
+// | | ' | \/ |`._`.| \_| \/ | v / _|
+// |_|\__|\__/ |___/ \__/\__/|_|_\___|
+//
+
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using NosCore.Data.Dto;
+using NosCore.Data.StaticEntities;
+using NosCore.GameObject.Ecs.Extensions;
+using NosCore.Packets.Interfaces;
+using NosCore.Shared.Enumerations;
+using NosCore.Packets;
+
+namespace NosCore.GameObject.Tests.Ecs.Extensions
+{
+ [TestClass]
+ public class NpcInfoLineTests
+ {
+ private static readonly Serializer Wire = new(typeof(IPacket).Assembly.GetTypes()
+ .Where(p => p.GetInterfaces().Contains(typeof(IPacket)) && p.IsClass && !p.IsAbstract)
+ .ToList());
+
+ private static NpcMonsterDto Cuby()
+ {
+ var name = new I18NString
+ {
+ [RegionType.EN] = "Mother Cuby",
+ [RegionType.FR] = "Cuby Mere"
+ };
+
+ return new NpcMonsterDto
+ {
+ NpcMonsterVNum = 303,
+ Level = 35,
+ MaxHp = 1360,
+ MaxMp = 630,
+ Name = name
+ };
+ }
+
+ [TestMethod]
+ public void TheLineEndsWithThePortraitAndTheName()
+ {
+ var line = Wire.Serialize(new[] { (IPacket)Cuby().GenerateNpcInfo(RegionType.EN) }).TrimEnd();
+
+ Assert.IsTrue(line.EndsWith("-1 Mother^Cuby"), line);
+ Assert.AreEqual(26, line.Split(' ').Length - 1, line);
+ }
+
+ [TestMethod]
+ public void TheNameIsTheReadersLanguage()
+ {
+ var line = Wire.Serialize(new[] { (IPacket)Cuby().GenerateNpcInfo(RegionType.FR) }).TrimEnd();
+
+ Assert.IsTrue(line.EndsWith("-1 Cuby^Mere"), line);
+ }
+ }
+}