summaryrefslogtreecommitdiff
path: root/NET/worlds/network/teleportCmd.java
blob: d6fec641876c9918c97a5728447e5f0c6162f720 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*     */ 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()
/*     */   {
/*  64 */     this._commandType = 18;
/*     */   }
/*     */   
/*     */   public teleportCmd(Room room, byte exittype, byte entrytype, short x, short y, short z, short direction)
/*     */   {
/*  69 */     super(null, 18);
/*  70 */     this._roomID = 0;
/*  71 */     if (room != null) {
/*  72 */       this._roomID = room.getNetworkRoom().getRoomID();
/*     */     }
/*  74 */     this._exittype = exittype;
/*  75 */     this._entrytype = entrytype;
/*  76 */     this._x = x;
/*  77 */     this._y = y;
/*  78 */     this._z = z;
/*  79 */     this._direction = direction;
/*     */   }
/*     */   
/*     */   void parseNetData(ServerInputStream data) throws IOException
/*     */   {
/*  84 */     this._roomID = data.readUnsignedShort();
/*  85 */     this._exittype = data.readByte();
/*  86 */     this._entrytype = data.readByte();
/*  87 */     this._x = data.readShort();
/*  88 */     this._y = data.readShort();
/*  89 */     this._z = data.readShort();
/*  90 */     this._direction = data.readShort();
/*     */   }
/*     */   
/*     */   void process(WorldServer _serv) throws Exception
/*     */   {
/*  95 */     NetworkObject o = _serv.getObject(this._objID);
/*  96 */     if (o == null) {
/*  97 */       o = Drone.make(this._objID, _serv);
/*     */     }
/*     */     
/* 100 */     NetworkRoom netroom = _serv.getNetworkRoom(this._roomID);
/* 101 */     Room newroom = null;
/* 102 */     if (netroom != null) {
/* 103 */       newroom = netroom.getRoom();
/*     */     }
/*     */     
/*     */ 
/* 107 */     this._direction = ((short)(90 - this._direction));
/*     */     
/* 109 */     this._direction = ((short)(360 - this._direction));
/* 110 */     if ((o instanceof Drone)) {
/* 111 */       ((Drone)o).teleport(_serv, this._exittype, this._entrytype, newroom, this._x, this._y, 
/* 112 */         this._z, this._direction);
/*     */     }
/*     */   }
/*     */   
/*     */   int packetSize()
/*     */   {
/* 118 */     return 12 + super.packetSize();
/*     */   }
/*     */   
/*     */   void send(ServerOutputStream o) throws IOException
/*     */   {
/* 123 */     super.send(o);
/*     */     
/* 125 */     o.writeShort(this._roomID);
/* 126 */     o.writeByte(this._exittype);
/* 127 */     o.writeByte(this._entrytype);
/* 128 */     o.writeShort(this._x);
/* 129 */     o.writeShort(this._y);
/* 130 */     o.writeShort(this._z);
/* 131 */     o.writeShort(this._direction);
/*     */   }
/*     */   
/*     */ 
/*     */   public String toString(WorldServer serv)
/*     */   {
/* 137 */     return 
/*     */     
/* 139 */       "TELEPORT " + this._objID.toString(serv) + " <" + this._exittype + "  >" + this._entrytype + " in " + this._roomID + " @ " + this._x + "," + this._y + "," + this._z + "," + this._direction;
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\teleportCmd.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */