summaryrefslogtreecommitdiff
path: root/NET/worlds/network/SubscribeRoomCmd.java
blob: 9eef4fc579f8335e87583b8144d78169b694b89d (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
package NET.worlds.network;

import NET.worlds.scape.RoomSubscribeInfo;
import java.io.IOException;

public class SubscribeRoomCmd extends netPacket {
   public static final byte SUBSCRIBEROOMCMD = 22;
   protected short _distance;
   protected short _x;
   protected short _y;
   protected short _z;
   protected short _roomNumber;

   public SubscribeRoomCmd(RoomSubscribeInfo info, int room) {
      super(null, 22);
      this._roomNumber = (short)room;
      this._distance = (short)(info.d - 100.0F);
      this._x = (short)info.x;
      this._y = (short)info.y;
      this._z = (short)info.z;
   }

   @Override
   int packetSize() {
      return 10 + super.packetSize();
   }

   @Override
   void send(ServerOutputStream o) throws IOException {
      super.send(o);
      o.writeShort(this._roomNumber);
      o.writeShort(this._x);
      o.writeShort(this._y);
      o.writeShort(this._z);
      o.writeShort(this._distance);
   }

   @Override
   public String toString(WorldServer serv) {
      return "SUBSCRIB " + this._roomNumber + ": " + this._distance + "cm @ " + this._x + "," + this._y + "," + this._z;
   }
}