blob: 0f9afd40aed761738d94d4ad3b8111e5a7e3f789 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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;
}
}
|