Skip to content

Commit 0e82007

Browse files
erwan-jolyclaude
andauthored
Add optional Zero field to ScriptPacket for step ack (#438)
* Add ScriptCompletePacket for official "script 0 <id> <step>" ack The official NosTale server emits `script 0 <scriptId> <stepId>` after each tutorial script step to acknowledge completion. Without it the client freezes on interactive steps (e.g. the quest accept dialog does nothing when pressed). The existing ScriptPacket only covers the 2-field `script <scriptId> <stepId>` form used to enter a step, so this adds a sibling ServerPackets class with a literal leading `0` to match the ack shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Add optional leading Zero field to ScriptPacket for step ack The official NosTale server emits two `script` shapes: `script <scriptId> <stepId>` to enter a step, and `script 0 <scriptId> <stepId>` to acknowledge that step has completed. Without the ack the client freezes on interactive steps (e.g. the quest-accept dialog does nothing when pressed). Add an optional leading Zero byte so the same packet class emits both shapes — Zero=null for advance, Zero=0 for ack. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 43f02b1 commit 0e82007

3 files changed

Lines changed: 34 additions & 3 deletions

File tree

src/NosCore.Packets/NosCore.Packets.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<RepositoryUrl>https://github.com/NosCoreIO/NosCore.Packets.git</RepositoryUrl>
1313
<PackageIconUrl></PackageIconUrl>
1414
<PackageTags>nostale, noscore, chickenapi, nostale private server source, nostale emulator</PackageTags>
15-
<Version>16.7.0</Version>
15+
<Version>16.8.0</Version>
1616
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1717
<Description>NosCore's Packets (Nostale packets) defined over classes</Description>
1818
<PackageLicenseExpression>MIT</PackageLicenseExpression>

src/NosCore.Packets/ServerPackets/Quest/ScriptPacket.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ namespace NosCore.Packets.ServerPackets.Quest
1212
[PacketHeader("script", Scope.InGame)]
1313
public class ScriptPacket : PacketBase
1414
{
15-
[PacketIndex(0)]
16-
public int ScriptId { get; set; }
15+
[PacketIndex(0, IsOptional = true)]
16+
public byte? Zero { get; set; }
1717

1818
[PacketIndex(1)]
19+
public int ScriptId { get; set; }
20+
21+
[PacketIndex(2)]
1922
public int ScriptStepId { get; set; }
2023
}
2124
}

test/NosCore.Packets.Tests/SerializerTest.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class SerializationTests
5959
typeof(MlobjlstPacket),
6060
typeof(SuccessPacket),
6161
typeof(TargetOffPacket),
62+
typeof(ScriptPacket),
6263
typeof(GuriPacket),
6364
typeof(BiPacket),
6465
typeof(MsgiPacket),
@@ -167,6 +168,33 @@ public void SerializeInheritedPacket()
167168
Assert.AreEqual("targetoff 57 149 1 1997", packet);
168169
}
169170

171+
[TestMethod]
172+
public void SerializeScriptPacketAdvance()
173+
{
174+
var testPacket = new ScriptPacket
175+
{
176+
ScriptId = 1,
177+
ScriptStepId = 80
178+
};
179+
180+
var packet = Serializer.Serialize(testPacket);
181+
Assert.AreEqual("script 1 80", packet);
182+
}
183+
184+
[TestMethod]
185+
public void SerializeScriptPacketComplete()
186+
{
187+
var testPacket = new ScriptPacket
188+
{
189+
Zero = 0,
190+
ScriptId = 1,
191+
ScriptStepId = 80
192+
};
193+
194+
var packet = Serializer.Serialize(testPacket);
195+
Assert.AreEqual("script 0 1 80", packet);
196+
}
197+
170198
[TestMethod]
171199
public void SerializeRecursiveListSubPackets()
172200
{

0 commit comments

Comments
 (0)