1 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2
3
4 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.*;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public abstract class Self
28 extends
29 InfoMessage
30 implements IWorldEvent, IWorldChangeEvent, ICompositeWorldObject
31
32 ,IPerson
33 {
34
35
36 public static final String PROTOTYPE =
37 "SLF {Id unreal_id} {BotId unreal_id} {Name text} {Vehicle False} {Location 0,0,0} {Velocity 0,0,0} {Rotation 0,0,0} {Team 0} {Weapon text} {Shooting False} {Health 0} {PrimaryAmmo 0} {SecondaryAmmo 0} {Adrenaline 0} {Armor 0} {SmallArmor 0} {AltFiring False} {Crouched False} {Walking False} {FloorLocation 0,0,0} {FloorNormal 0,0,0} {Combo text} {UDamageTime 0} {Action text} {EmotLeft text} {EmotCenter text} {EmotRight text} {Bubble text} {Anim text} ";
38
39
40
41
42
43
44 public Self()
45 {
46 }
47
48
49
50
51 protected long SimTime;
52
53
54
55
56 @Override
57 public long getSimTime() {
58 return SimTime;
59 }
60
61
62
63
64 protected void setSimTime(long SimTime) {
65 this.SimTime = SimTime;
66 }
67
68
69
70
71 public abstract UnrealId getId()
72 ;
73
74
75
76
77 public abstract UnrealId getBotId()
78 ;
79
80
81
82
83 public abstract String getName()
84 ;
85
86
87
88
89
90 public abstract boolean isVehicle()
91 ;
92
93
94
95
96
97
98 public abstract Location getLocation()
99 ;
100
101
102
103
104
105
106
107 public abstract Velocity getVelocity()
108 ;
109
110
111
112
113
114
115 public abstract Rotation getRotation()
116 ;
117
118
119
120
121
122
123
124 public abstract int getTeam()
125 ;
126
127
128
129
130
131
132
133
134
135
136
137
138
139 public abstract String getWeapon()
140 ;
141
142
143
144
145 public abstract boolean isShooting()
146 ;
147
148
149
150
151
152
153
154 public abstract int getHealth()
155 ;
156
157
158
159
160
161
162
163 public abstract int getPrimaryAmmo()
164 ;
165
166
167
168
169
170
171
172 public abstract int getSecondaryAmmo()
173 ;
174
175
176
177
178 public abstract int getAdrenaline()
179 ;
180
181
182
183
184
185
186
187
188
189
190 public abstract int getArmor()
191 ;
192
193
194
195
196
197
198 public abstract int getSmallArmor()
199 ;
200
201
202
203
204
205
206 public abstract boolean isAltFiring()
207 ;
208
209
210
211
212
213
214 public abstract boolean isCrouched()
215 ;
216
217
218
219
220
221
222 public abstract boolean isWalking()
223 ;
224
225
226
227
228
229
230 public abstract Location getFloorLocation()
231 ;
232
233
234
235
236
237
238 public abstract Location getFloorNormal()
239 ;
240
241
242
243
244
245
246
247
248 public abstract String getCombo()
249 ;
250
251
252
253
254
255
256
257 public abstract double getUDamageTime()
258 ;
259
260
261
262
263
264
265 public abstract String getAction()
266 ;
267
268
269
270
271
272
273 public abstract String getEmotLeft()
274 ;
275
276
277
278
279
280
281 public abstract String getEmotCenter()
282 ;
283
284
285
286
287
288
289 public abstract String getEmotRight()
290 ;
291
292
293
294
295
296
297 public abstract String getBubble()
298 ;
299
300
301
302
303
304
305 public abstract String getAnim()
306 ;
307
308
309 public static class SelfUpdate
310 extends GBObjectUpdate implements ICompositeWorldObjectUpdatedEvent, IGBWorldObjectEvent {
311 private Self object;
312 private long time;
313 private ITeamId teamId;
314
315 public SelfUpdate
316 (Self source, long eventTime, ITeamId teamId) {
317 this.object = source;
318 this.time = eventTime;
319 this.teamId = teamId;
320 }
321
322
323
324
325 @Override
326 public long getSimTime() {
327 return time;
328 }
329
330 @Override
331 public IWorldObject getObject() {
332 return object;
333 }
334
335 @Override
336 public WorldObjectId getId() {
337 return object.getId();
338 }
339
340 @Override
341 public ILocalWorldObjectUpdatedEvent getLocalEvent() {
342 return new SelfLocalImpl.SelfLocalUpdate
343 ((SelfLocal)object.getLocal(), time);
344 }
345
346 @Override
347 public ISharedWorldObjectUpdatedEvent getSharedEvent() {
348 return new SelfSharedImpl.SelfSharedUpdate
349 ((SelfShared)object.getShared(), time, teamId);
350 }
351
352 @Override
353 public IStaticWorldObjectUpdatedEvent getStaticEvent() {
354 return new SelfStaticImpl.SelfStaticUpdate
355 ((SelfStatic)object.getStatic(), time);
356 }
357
358 }
359
360
361 public String toString() {
362 return
363 super.toString() + "[" +
364
365 "Id = " + String.valueOf(getId()
366 ) + " | " +
367
368 "BotId = " + String.valueOf(getBotId()
369 ) + " | " +
370
371 "Name = " + String.valueOf(getName()
372 ) + " | " +
373
374 "Vehicle = " + String.valueOf(isVehicle()
375 ) + " | " +
376
377 "Location = " + String.valueOf(getLocation()
378 ) + " | " +
379
380 "Velocity = " + String.valueOf(getVelocity()
381 ) + " | " +
382
383 "Rotation = " + String.valueOf(getRotation()
384 ) + " | " +
385
386 "Team = " + String.valueOf(getTeam()
387 ) + " | " +
388
389 "Weapon = " + String.valueOf(getWeapon()
390 ) + " | " +
391
392 "Shooting = " + String.valueOf(isShooting()
393 ) + " | " +
394
395 "Health = " + String.valueOf(getHealth()
396 ) + " | " +
397
398 "PrimaryAmmo = " + String.valueOf(getPrimaryAmmo()
399 ) + " | " +
400
401 "SecondaryAmmo = " + String.valueOf(getSecondaryAmmo()
402 ) + " | " +
403
404 "Adrenaline = " + String.valueOf(getAdrenaline()
405 ) + " | " +
406
407 "Armor = " + String.valueOf(getArmor()
408 ) + " | " +
409
410 "SmallArmor = " + String.valueOf(getSmallArmor()
411 ) + " | " +
412
413 "AltFiring = " + String.valueOf(isAltFiring()
414 ) + " | " +
415
416 "Crouched = " + String.valueOf(isCrouched()
417 ) + " | " +
418
419 "Walking = " + String.valueOf(isWalking()
420 ) + " | " +
421
422 "FloorLocation = " + String.valueOf(getFloorLocation()
423 ) + " | " +
424
425 "FloorNormal = " + String.valueOf(getFloorNormal()
426 ) + " | " +
427
428 "Combo = " + String.valueOf(getCombo()
429 ) + " | " +
430
431 "UDamageTime = " + String.valueOf(getUDamageTime()
432 ) + " | " +
433
434 "Action = " + String.valueOf(getAction()
435 ) + " | " +
436
437 "EmotLeft = " + String.valueOf(getEmotLeft()
438 ) + " | " +
439
440 "EmotCenter = " + String.valueOf(getEmotCenter()
441 ) + " | " +
442
443 "EmotRight = " + String.valueOf(getEmotRight()
444 ) + " | " +
445
446 "Bubble = " + String.valueOf(getBubble()
447 ) + " | " +
448
449 "Anim = " + String.valueOf(getAnim()
450 ) + " | " +
451
452 "]";
453 }
454
455
456 public String toHtmlString() {
457 return super.toString() + "[<br/>" +
458
459 "<b>Id</b> = " + String.valueOf(getId()
460 ) + " <br/> " +
461
462 "<b>BotId</b> = " + String.valueOf(getBotId()
463 ) + " <br/> " +
464
465 "<b>Name</b> = " + String.valueOf(getName()
466 ) + " <br/> " +
467
468 "<b>Vehicle</b> = " + String.valueOf(isVehicle()
469 ) + " <br/> " +
470
471 "<b>Location</b> = " + String.valueOf(getLocation()
472 ) + " <br/> " +
473
474 "<b>Velocity</b> = " + String.valueOf(getVelocity()
475 ) + " <br/> " +
476
477 "<b>Rotation</b> = " + String.valueOf(getRotation()
478 ) + " <br/> " +
479
480 "<b>Team</b> = " + String.valueOf(getTeam()
481 ) + " <br/> " +
482
483 "<b>Weapon</b> = " + String.valueOf(getWeapon()
484 ) + " <br/> " +
485
486 "<b>Shooting</b> = " + String.valueOf(isShooting()
487 ) + " <br/> " +
488
489 "<b>Health</b> = " + String.valueOf(getHealth()
490 ) + " <br/> " +
491
492 "<b>PrimaryAmmo</b> = " + String.valueOf(getPrimaryAmmo()
493 ) + " <br/> " +
494
495 "<b>SecondaryAmmo</b> = " + String.valueOf(getSecondaryAmmo()
496 ) + " <br/> " +
497
498 "<b>Adrenaline</b> = " + String.valueOf(getAdrenaline()
499 ) + " <br/> " +
500
501 "<b>Armor</b> = " + String.valueOf(getArmor()
502 ) + " <br/> " +
503
504 "<b>SmallArmor</b> = " + String.valueOf(getSmallArmor()
505 ) + " <br/> " +
506
507 "<b>AltFiring</b> = " + String.valueOf(isAltFiring()
508 ) + " <br/> " +
509
510 "<b>Crouched</b> = " + String.valueOf(isCrouched()
511 ) + " <br/> " +
512
513 "<b>Walking</b> = " + String.valueOf(isWalking()
514 ) + " <br/> " +
515
516 "<b>FloorLocation</b> = " + String.valueOf(getFloorLocation()
517 ) + " <br/> " +
518
519 "<b>FloorNormal</b> = " + String.valueOf(getFloorNormal()
520 ) + " <br/> " +
521
522 "<b>Combo</b> = " + String.valueOf(getCombo()
523 ) + " <br/> " +
524
525 "<b>UDamageTime</b> = " + String.valueOf(getUDamageTime()
526 ) + " <br/> " +
527
528 "<b>Action</b> = " + String.valueOf(getAction()
529 ) + " <br/> " +
530
531 "<b>EmotLeft</b> = " + String.valueOf(getEmotLeft()
532 ) + " <br/> " +
533
534 "<b>EmotCenter</b> = " + String.valueOf(getEmotCenter()
535 ) + " <br/> " +
536
537 "<b>EmotRight</b> = " + String.valueOf(getEmotRight()
538 ) + " <br/> " +
539
540 "<b>Bubble</b> = " + String.valueOf(getBubble()
541 ) + " <br/> " +
542
543 "<b>Anim</b> = " + String.valueOf(getAnim()
544 ) + " <br/> " +
545
546 "<br/>]";
547 }
548
549
550
551
552
553
554
555
556
557
558 }
559