Change shockwave short packet expression from s to u

This is used in g-python so this should make it less confusing
This commit is contained in:
UnfamiliarLegacy 2024-06-22 06:28:24 +02:00
parent deec521ab1
commit b6689ffcea
2 changed files with 2 additions and 2 deletions

View File

@ -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")));

View File

@ -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 {