CommandService now loads commands from other datatables, Made WaypointObject encodable for SWGMap, Added requestWaypointAtPosition

This commit is contained in:
Waverunner
2015-01-06 17:23:13 -05:00
parent 1b8f2c2e30
commit 898dda3832
5 changed files with 77 additions and 14 deletions
@@ -1,10 +1,14 @@
package resources.objects.waypoint;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import resources.network.BaselineBuilder;
import resources.network.BaselineBuilder.Encodable;
import resources.objects.intangible.IntangibleObject;
import resources.player.Player;
public class WaypointObject extends IntangibleObject {
public class WaypointObject extends IntangibleObject implements Encodable{
private static final long serialVersionUID = 1L;
@@ -95,4 +99,21 @@ public class WaypointObject extends IntangibleObject {
createChildrenObjects(target);
target.sendPacket(new SceneEndBaselines(getObjectId()));*/
}
@Override
public byte[] encode() {
ByteBuffer bb = ByteBuffer.allocate(34 + name.length() * 2);
bb.putInt(cellNumber);
bb.putFloat((float) getLocation().getX());
bb.putFloat((float) getLocation().getY());
bb.putFloat((float) getLocation().getZ());
bb.putLong(targetId); // unsure when this is anything but 0, have yet to see it change
bb.putInt(getLocation().getTerrain().getCrc());
bb.putInt(name.length());
bb.put(name.getBytes(Charset.forName("UTF-16LE")));
bb.put((byte) color);
bb.put((byte) (active ? 1 : 0));
return bb.array();
}
}