summaryrefslogtreecommitdiff
path: root/NET/worlds/network/teleportCmd.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/network/teleportCmd.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/network/teleportCmd.java')
-rw-r--r--NET/worlds/network/teleportCmd.java103
1 files changed, 103 insertions, 0 deletions
diff --git a/NET/worlds/network/teleportCmd.java b/NET/worlds/network/teleportCmd.java
new file mode 100644
index 0000000..7c8c9ff
--- /dev/null
+++ b/NET/worlds/network/teleportCmd.java
@@ -0,0 +1,103 @@
+package NET.worlds.network;
+
+import NET.worlds.scape.Drone;
+import NET.worlds.scape.Room;
+import java.io.IOException;
+
+public class teleportCmd extends receivedNetPacket {
+ public static final byte TELEPORTCMD = 18;
+ protected int _roomID;
+ protected byte _exittype;
+ protected byte _entrytype;
+ protected short _x;
+ protected short _y;
+ protected short _z;
+ protected short _direction;
+
+ public teleportCmd() {
+ this._commandType = 18;
+ }
+
+ public teleportCmd(Room room, byte exittype, byte entrytype, short x, short y, short z, short direction) {
+ super(null, 18);
+ this._roomID = 0;
+ if (room != null) {
+ this._roomID = room.getNetworkRoom().getRoomID();
+ }
+
+ this._exittype = exittype;
+ this._entrytype = entrytype;
+ this._x = x;
+ this._y = y;
+ this._z = z;
+ this._direction = direction;
+ }
+
+ @Override
+ void parseNetData(ServerInputStream data) throws IOException {
+ this._roomID = data.readUnsignedShort();
+ this._exittype = data.readByte();
+ this._entrytype = data.readByte();
+ this._x = data.readShort();
+ this._y = data.readShort();
+ this._z = data.readShort();
+ this._direction = data.readShort();
+ }
+
+ @Override
+ void process(WorldServer _serv) throws Exception {
+ NetworkObject o = _serv.getObject(this._objID);
+ if (o == null) {
+ o = Drone.make(this._objID, _serv);
+ }
+
+ NetworkRoom netroom = _serv.getNetworkRoom(this._roomID);
+ Room newroom = null;
+ if (netroom != null) {
+ newroom = netroom.getRoom();
+ }
+
+ this._direction = (short)(90 - this._direction);
+ this._direction = (short)(360 - this._direction);
+ if (o instanceof Drone) {
+ ((Drone)o).teleport(_serv, this._exittype, this._entrytype, newroom, this._x, this._y, this._z, this._direction);
+ }
+ }
+
+ @Override
+ int packetSize() {
+ return 12 + super.packetSize();
+ }
+
+ @Override
+ void send(ServerOutputStream o) throws IOException {
+ super.send(o);
+ o.writeShort(this._roomID);
+ o.writeByte(this._exittype);
+ o.writeByte(this._entrytype);
+ o.writeShort(this._x);
+ o.writeShort(this._y);
+ o.writeShort(this._z);
+ o.writeShort(this._direction);
+ }
+
+ @Override
+ public String toString(WorldServer serv) {
+ return "TELEPORT "
+ + this._objID.toString(serv)
+ + " <"
+ + this._exittype
+ + " >"
+ + this._entrytype
+ + " in "
+ + this._roomID
+ + " @ "
+ + this._x
+ + ","
+ + this._y
+ + ","
+ + this._z
+ + ","
+ + this._direction;
+ }
+}