1
2
3
4
5
6
7
8
9
10
11
12 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands;import java.util.*;import javax.vecmath.*;import cz.cuni.amis.pogamut.base.communication.messages.*;import cz.cuni.amis.pogamut.base.communication.worldview.*;import cz.cuni.amis.pogamut.base.communication.worldview.event.*;import cz.cuni.amis.pogamut.base.communication.worldview.object.*;import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;import cz.cuni.amis.pogamut.base.communication.translator.event.*;import cz.cuni.amis.pogamut.multi.communication.translator.event.*;import cz.cuni.amis.pogamut.base3d.worldview.object.*;import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.*;import cz.cuni.amis.pogamut.ut2004.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType.Category;import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;import cz.cuni.amis.utils.exception.*;import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;import cz.cuni.amis.utils.SafeEquals;import cz.cuni.amis.pogamut.base.agent.*;import cz.cuni.amis.pogamut.multi.agent.*;import cz.cuni.amis.pogamut.multi.communication.worldview.property.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.property.*;import cz.cuni.amis.utils.token.*;import cz.cuni.amis.utils.*;
13
14
15
16
17
18
19
20 public class CommandPlayer
21 extends CommandMessage
22 {
23
24
25
26 public static final String PROTOTYPE =
27 " {Player text} {Command text} {Location 0,0,0} {FocusLocation 0,0,0} {Walk False} {Rotation 0,0,0} ";
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 public CommandPlayer(
46 String Player, String Command, Location Location, Location FocusLocation, Boolean Walk, Rotation Rotation
47 ) {
48
49 this.Player = Player;
50
51 this.Command = Command;
52
53 this.Location = Location;
54
55 this.FocusLocation = FocusLocation;
56
57 this.Walk = Walk;
58
59 this.Rotation = Rotation;
60
61 }
62
63
64
65
66
67
68
69
70
71
72
73
74 public CommandPlayer() {
75 }
76
77
78
79
80
81
82
83 public CommandPlayer(CommandPlayer original) {
84
85 this.Player = original.Player;
86
87 this.Command = original.Command;
88
89 this.Location = original.Location;
90
91 this.FocusLocation = original.FocusLocation;
92
93 this.Walk = original.Walk;
94
95 this.Rotation = original.Rotation;
96
97 }
98
99
100
101
102 protected
103 String Player =
104
105 null
106 ;
107
108
109
110
111
112
113 public String getPlayer()
114
115 {
116 return
117 Player;
118 }
119
120
121
122
123
124
125
126 public CommandPlayer
127 setPlayer(String Player)
128
129 {
130 this.Player = Player;
131 return this;
132 }
133
134
135
136
137 protected
138 String Command =
139
140 null
141 ;
142
143
144
145
146
147
148 public String getCommand()
149
150 {
151 return
152 Command;
153 }
154
155
156
157
158
159
160
161 public CommandPlayer
162 setCommand(String Command)
163
164 {
165 this.Command = Command;
166 return this;
167 }
168
169
170
171
172 protected
173 Location Location =
174
175 null
176 ;
177
178
179
180
181
182
183 public Location getLocation()
184
185 {
186 return
187 Location;
188 }
189
190
191
192
193
194
195
196 public CommandPlayer
197 setLocation(Location Location)
198
199 {
200 this.Location = Location;
201 return this;
202 }
203
204
205
206
207 protected
208 Location FocusLocation =
209
210 null
211 ;
212
213
214
215
216
217
218 public Location getFocusLocation()
219
220 {
221 return
222 FocusLocation;
223 }
224
225
226
227
228
229
230
231 public CommandPlayer
232 setFocusLocation(Location FocusLocation)
233
234 {
235 this.FocusLocation = FocusLocation;
236 return this;
237 }
238
239
240
241
242 protected
243 Boolean Walk =
244
245 null
246 ;
247
248
249
250
251
252
253 public Boolean isWalk()
254
255 {
256 return
257 Walk;
258 }
259
260
261
262
263
264
265
266 public CommandPlayer
267 setWalk(Boolean Walk)
268
269 {
270 this.Walk = Walk;
271 return this;
272 }
273
274
275
276
277 protected
278 Rotation Rotation =
279
280 null
281 ;
282
283
284
285
286
287
288 public Rotation getRotation()
289
290 {
291 return
292 Rotation;
293 }
294
295
296
297
298
299
300
301 public CommandPlayer
302 setRotation(Rotation Rotation)
303
304 {
305 this.Rotation = Rotation;
306 return this;
307 }
308
309 public String toString() {
310 return toMessage();
311 }
312
313 public String toHtmlString() {
314 return super.toString() + "[<br/>" +
315
316 "<b>Player</b> = " +
317 String.valueOf(getPlayer()
318 ) +
319 " <br/> " +
320
321 "<b>Command</b> = " +
322 String.valueOf(getCommand()
323 ) +
324 " <br/> " +
325
326 "<b>Location</b> = " +
327 String.valueOf(getLocation()
328 ) +
329 " <br/> " +
330
331 "<b>FocusLocation</b> = " +
332 String.valueOf(getFocusLocation()
333 ) +
334 " <br/> " +
335
336 "<b>Walk</b> = " +
337 String.valueOf(isWalk()
338 ) +
339 " <br/> " +
340
341 "<b>Rotation</b> = " +
342 String.valueOf(getRotation()
343 ) +
344 " <br/> " +
345
346 "<br/>]"
347 ;
348 }
349
350 public String toMessage() {
351 StringBuffer buf = new StringBuffer();
352 buf.append("COMPLR");
353
354 if (Player != null) {
355 buf.append(" {Player " + Player + "}");
356 }
357
358 if (Command != null) {
359 buf.append(" {Command " + Command + "}");
360 }
361
362 if (Location != null) {
363 buf.append(" {Location " +
364 Location.getX() + "," +
365 Location.getY() + "," +
366 Location.getZ() + "}");
367 }
368
369 if (FocusLocation != null) {
370 buf.append(" {FocusLocation " +
371 FocusLocation.getX() + "," +
372 FocusLocation.getY() + "," +
373 FocusLocation.getZ() + "}");
374 }
375
376 if (Walk != null) {
377 buf.append(" {Walk " + Walk + "}");
378 }
379
380 if (Rotation != null) {
381 buf.append(" {Rotation " +
382 Rotation.getPitch() + "," +
383 Rotation.getYaw() + "," +
384 Rotation.getRoll() + "}");
385 }
386
387 return buf.toString();
388 }
389
390
391
392
393
394 }
395