From b6689ffceac1efe70655f6edd89dac31428304c4 Mon Sep 17 00:00:00 2001 From: UnfamiliarLegacy <74633542+UnfamiliarLegacy@users.noreply.github.com> Date: Sat, 22 Jun 2024 06:28:24 +0200 Subject: [PATCH] Change shockwave short packet expression from s to u This is used in g-python so this should make it less confusing --- .../services/packet_representation/PacketStringUtils.java | 2 +- G-Earth/src/test/java/TestPacketStringUtils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/G-Earth/src/main/java/gearth/services/packet_representation/PacketStringUtils.java b/G-Earth/src/main/java/gearth/services/packet_representation/PacketStringUtils.java index d93871a..c4cb2f0 100644 --- a/G-Earth/src/main/java/gearth/services/packet_representation/PacketStringUtils.java +++ b/G-Earth/src/main/java/gearth/services/packet_representation/PacketStringUtils.java @@ -58,7 +58,7 @@ public class PacketStringUtils { boolean fixLengthLater = false; if (format != HPacketFormat.EVA_WIRE) { - packet = replaceWithFormat(format, packet, "\\{s:(-?[0-9]+)}", (temp, value) -> temp.appendUShort(Short.parseShort(value))); + packet = replaceWithFormat(format, packet, "\\{u:(-?[0-9]+)}", (temp, value) -> temp.appendShort(Short.parseShort(value))); packet = replaceWithFormat(format, packet, "\\{i:(-?[0-9]+)}", (temp, value) -> temp.appendInt(Integer.parseInt(value))); packet = replaceWithFormat(format, packet, "\\{b:([Ff]alse|[Tt]rue)}", (temp, value) -> temp.appendBoolean(value.equalsIgnoreCase("true"))); diff --git a/G-Earth/src/test/java/TestPacketStringUtils.java b/G-Earth/src/test/java/TestPacketStringUtils.java index be693e0..e24df73 100644 --- a/G-Earth/src/test/java/TestPacketStringUtils.java +++ b/G-Earth/src/test/java/TestPacketStringUtils.java @@ -36,7 +36,7 @@ public class TestPacketStringUtils { public void testShockwaveOutgoingExpressions() throws InvalidPacketException { checkExpression(HPacketFormat.WEDGIE_OUTGOING, "{h:18}{b:false}", "@RH"); // GETFVRF checkExpression(HPacketFormat.WEDGIE_OUTGOING, "{h:52}{s:\"Hoi123\"}", "@t@FHoi123"); // CHAT - checkExpression(HPacketFormat.WEDGIE_OUTGOING, "{h:75}{s:10}{s:6}", "AK@J@F"); // MOVE + checkExpression(HPacketFormat.WEDGIE_OUTGOING, "{h:75}{u:10}{u:6}", "AK@J@F"); // MOVE } private void checkSame(String expected) throws InvalidPacketException {