diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/network/longLocCmd.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/network/longLocCmd.java')
| -rw-r--r-- | NET/worlds/network/longLocCmd.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/NET/worlds/network/longLocCmd.java b/NET/worlds/network/longLocCmd.java new file mode 100644 index 0000000..0f9afd4 --- /dev/null +++ b/NET/worlds/network/longLocCmd.java @@ -0,0 +1,65 @@ +package NET.worlds.network; + +import NET.worlds.scape.Drone; +import java.io.IOException; + +public class longLocCmd extends receivedNetPacket { + public static final byte LONGLOCCMD = 1; + protected short _x; + protected short _y; + protected short _z; + protected short _dir; + + public longLocCmd() { + this._commandType = 1; + } + + public longLocCmd(short x, short y, short z, short dir) { + super(null, 1); + this._x = x; + this._y = y; + this._z = z; + this._dir = dir; + } + + @Override + void parseNetData(ServerInputStream data) throws IOException { + this._x = data.readShort(); + this._y = data.readShort(); + this._z = data.readShort(); + this._dir = data.readShort(); + } + + @Override + int packetSize() { + return 8 + super.packetSize(); + } + + @Override + void send(ServerOutputStream o) throws IOException { + super.send(o); + o.writeShort(this._x); + o.writeShort(this._y); + o.writeShort(this._z); + o.writeShort(this._dir); + } + + @Override + void process(WorldServer _serv) throws Exception { + NetworkObject o = _serv.getObject(this._objID); + if (o instanceof Drone) { + this._dir = (short)(90 - this._dir); + this._dir = (short)(360 - this._dir); + if (o == null) { + System.out.println("error in message: " + this.toString(_serv)); + } + + ((Drone)o).longLoc(this._x, this._y, this._z, this._dir); + } + } + + @Override + public String toString(WorldServer serv) { + return "LONGLOC " + this._objID.toString(serv) + " @ " + this._x + "," + this._y + "," + this._z + "," + this._dir; + } +} |