From f6a0e9845f1c02e70ef38af921f3c31ef193aebb Mon Sep 17 00:00:00 2001 From: cdmpse Date: Sat, 17 Oct 2015 10:17:40 -0500 Subject: [PATCH] Added Animation object controller and allow SDB with trailing blanks --- .../swg/zone/object_controller/Animation.java | 35 +++++++++++++++++++ .../server_info/RelationalServerData.java | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/network/packets/swg/zone/object_controller/Animation.java diff --git a/src/network/packets/swg/zone/object_controller/Animation.java b/src/network/packets/swg/zone/object_controller/Animation.java new file mode 100644 index 00000000..b22106d5 --- /dev/null +++ b/src/network/packets/swg/zone/object_controller/Animation.java @@ -0,0 +1,35 @@ +package network.packets.swg.zone.object_controller; + +import java.nio.ByteBuffer; + +public class Animation extends ObjectController { + + public static final int CRC = 0x00F2; + + private String animation; + + public Animation(long objectId, String animation) { + super(objectId, CRC); + this.animation = animation; + } + + public Animation(ByteBuffer data) { + super(CRC); + decode(data); + } + + @Override + public void decode(ByteBuffer data) { + decodeHeader(data); + animation = getAscii(data); + } + + @Override + public ByteBuffer encode() { + ByteBuffer data = ByteBuffer.allocate(HEADER_LENGTH + 2 + animation.length()); + encodeHeader(data); + addAscii(data, animation); + return data; + } +} + diff --git a/src/resources/server_info/RelationalServerData.java b/src/resources/server_info/RelationalServerData.java index 3c5af206..7ec2d19a 100644 --- a/src/resources/server_info/RelationalServerData.java +++ b/src/resources/server_info/RelationalServerData.java @@ -251,7 +251,7 @@ public class RelationalServerData extends RelationalDatabase { try { int lineNum = 1; while ((line = reader.readLine()) != null) { - String [] parts = line.split("\t"); + String [] parts = line.split("\t", -1); if (columnNames == null) columnNames = parts; else if (columnTypes == null) {