View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2    		
3    		// --- IMPORTS FROM /messages/settings/javasettings/javaimport BEGIN
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   		// --- IMPORTS FROM /messages/settings/javasettings/javaimport END
6   		
7   		
8   		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] BEGIN
9   				
10  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] END
11  		
12  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] END
15      
16   		/**
17           *  
18           			Definition of the event KIL.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Some other player died - reporting his
25  		death. Additional information about DamageType - DeathString and so are exported just if we can see the dying player.
26  	
27           */
28   	public class PlayerKilled 
29    				extends InfoMessage
30      			implements IWorldEvent, IWorldChangeEvent
31      			
32  	    {
33   	
34      	/** Example how the message looks like - used during parser tests. */
35      	public static final String PROTOTYPE =
36      		"KIL {Id unreal_id}  {Killer unreal_id}  {KilledPawn text}  {DamageType text}  {DeathString text}  {WeaponName text}  {Flaming False}  {CausedByWorld False}  {DirectDamage False}  {BulletHit False}  {VehicleHit False} ";
37      
38      	
39      	
40      	/**
41      	 * Parameter-less contructor for the message.
42      	 */
43  		public PlayerKilled()
44  		{
45  		}
46  	
47      	
48      	
49      	
50      	/**
51  		 * Creates new instance of the message PlayerKilled.
52  		 * 
53  		Asynchronous message. Some other player died - reporting his
54  		death. Additional information about DamageType - DeathString and so are exported just if we can see the dying player.
55  	
56  		 * Corresponding GameBots message
57  		 *   
58  		 *   is
59  		 *   KIL.
60  		 * 
61   	  	 * 
62  		 *   
63  		 *     @param Id Unique Id of the dead player.
64  		 *   
65  		 * 
66  		 *   
67  		 *     @param Killer 
68  			Unique Id of player that killed if any (the victim might
69  			have walked off a ledge).
70  		
71  		 *   
72  		 * 
73  		 *   
74  		 *     @param KilledPawn 
75  			The UT Pawn that was killed - support for vehicles. If someone destroyes vehicle
76  			we will get it here (Id will be none and in KilledPawn we will have destroyed vehicle).
77  		
78  		 *   
79  		 * 
80  		 *   
81  		 *     @param DamageType 
82  			A string describing what kind of damage killed the victim.
83  		
84  		 *   
85  		 * 
86  		 *   
87  		 *     @param DeathString 
88  			String describing this type of death.
89  		
90  		 *   
91  		 * 
92  		 *   
93  		 *     @param WeaponName 
94  			Name of the weapon that caused this damage.
95  		
96  		 *   
97  		 * 
98  		 *   
99  		 *     @param Flaming 
100 			If this damage is causing the player to burn. TODO
101 		
102 		 *   
103 		 * 
104 		 *   
105 		 *     @param CausedByWorld 
106 			If this damage was caused by world - falling into lava, or falling down.
107 		
108 		 *   
109 		 * 
110 		 *   
111 		 *     @param DirectDamage 
112 			If the damage is direct. TODO
113 		
114 		 *   
115 		 * 
116 		 *   
117 		 *     @param BulletHit 
118 			If this damage was caused by bullet.
119 		
120 		 *   
121 		 * 
122 		 *   
123 		 *     @param VehicleHit 
124 			If this damage was caused by vehicle running over us.
125 		
126 		 *   
127 		 * 
128 		 */
129 		public PlayerKilled(
130 			UnrealId Id,  UnrealId Killer,  String KilledPawn,  String DamageType,  String DeathString,  String WeaponName,  boolean Flaming,  boolean CausedByWorld,  boolean DirectDamage,  boolean BulletHit,  boolean VehicleHit
131 		) {
132 			
133 					this.Id = Id;
134 				
135 					this.Killer = Killer;
136 				
137 					this.KilledPawn = KilledPawn;
138 				
139 					this.DamageType = DamageType;
140 				
141 					this.DeathString = DeathString;
142 				
143 					this.WeaponName = WeaponName;
144 				
145 					this.Flaming = Flaming;
146 				
147 					this.CausedByWorld = CausedByWorld;
148 				
149 					this.DirectDamage = DirectDamage;
150 				
151 					this.BulletHit = BulletHit;
152 				
153 					this.VehicleHit = VehicleHit;
154 				
155 		}
156     
157     	/**
158 		 * Cloning constructor from the full message.
159 		 *
160 		 * @param original
161 		 */
162 		public PlayerKilled(PlayerKilled original) {		
163 			
164 					this.Id = original.getId()
165  	;
166 				
167 					this.Killer = original.getKiller()
168  	;
169 				
170 					this.KilledPawn = original.getKilledPawn()
171  	;
172 				
173 					this.DamageType = original.getDamageType()
174  	;
175 				
176 					this.DeathString = original.getDeathString()
177  	;
178 				
179 					this.WeaponName = original.getWeaponName()
180  	;
181 				
182 					this.Flaming = original.isFlaming()
183  	;
184 				
185 					this.CausedByWorld = original.isCausedByWorld()
186  	;
187 				
188 					this.DirectDamage = original.isDirectDamage()
189  	;
190 				
191 					this.BulletHit = original.isBulletHit()
192  	;
193 				
194 					this.VehicleHit = original.isVehicleHit()
195  	;
196 				
197 			this.SimTime = original.getSimTime();			
198 		}
199 		
200 	   		
201 			protected long SimTime;
202 				
203 			/**
204 			 * Simulation time in MILLI SECONDS !!!
205 			 */	
206 			@Override
207 			public long getSimTime() {
208 				return SimTime;
209 			}
210 						
211 			/**
212 			 * Used by Yylex to slip correct time of the object or programmatically.
213 			 */
214 			protected void setSimTime(long SimTime) {
215 				this.SimTime = SimTime;
216 			}
217 	   	
218     	
219 	    /**
220          * Unique Id of the dead player. 
221          */
222         protected
223          UnrealId Id =
224        	null;
225 	
226  		/**
227          * Unique Id of the dead player. 
228          */
229         public  UnrealId getId()
230  	 {
231     					return Id;
232     				}
233     			
234     	
235 	    /**
236          * 
237 			Unique Id of player that killed if any (the victim might
238 			have walked off a ledge).
239 		 
240          */
241         protected
242          UnrealId Killer =
243        	null;
244 	
245  		/**
246          * 
247 			Unique Id of player that killed if any (the victim might
248 			have walked off a ledge).
249 		 
250          */
251         public  UnrealId getKiller()
252  	 {
253     					return Killer;
254     				}
255     			
256     	
257 	    /**
258          * 
259 			The UT Pawn that was killed - support for vehicles. If someone destroyes vehicle
260 			we will get it here (Id will be none and in KilledPawn we will have destroyed vehicle).
261 		 
262          */
263         protected
264          String KilledPawn =
265        	null;
266 	
267  		/**
268          * 
269 			The UT Pawn that was killed - support for vehicles. If someone destroyes vehicle
270 			we will get it here (Id will be none and in KilledPawn we will have destroyed vehicle).
271 		 
272          */
273         public  String getKilledPawn()
274  	 {
275     					return KilledPawn;
276     				}
277     			
278     	
279 	    /**
280          * 
281 			A string describing what kind of damage killed the victim.
282 		 
283          */
284         protected
285          String DamageType =
286        	null;
287 	
288  		/**
289          * 
290 			A string describing what kind of damage killed the victim.
291 		 
292          */
293         public  String getDamageType()
294  	 {
295     					return DamageType;
296     				}
297     			
298     	
299 	    /**
300          * 
301 			String describing this type of death.
302 		 
303          */
304         protected
305          String DeathString =
306        	null;
307 	
308  		/**
309          * 
310 			String describing this type of death.
311 		 
312          */
313         public  String getDeathString()
314  	 {
315     					return DeathString;
316     				}
317     			
318     	
319 	    /**
320          * 
321 			Name of the weapon that caused this damage.
322 		 
323          */
324         protected
325          String WeaponName =
326        	null;
327 	
328  		/**
329          * 
330 			Name of the weapon that caused this damage.
331 		 
332          */
333         public  String getWeaponName()
334  	 {
335     					return WeaponName;
336     				}
337     			
338     	
339 	    /**
340          * 
341 			If this damage is causing the player to burn. TODO
342 		 
343          */
344         protected
345          boolean Flaming =
346        	false;
347 	
348  		/**
349          * 
350 			If this damage is causing the player to burn. TODO
351 		 
352          */
353         public  boolean isFlaming()
354  	 {
355     					return Flaming;
356     				}
357     			
358     	
359 	    /**
360          * 
361 			If this damage was caused by world - falling into lava, or falling down.
362 		 
363          */
364         protected
365          boolean CausedByWorld =
366        	false;
367 	
368  		/**
369          * 
370 			If this damage was caused by world - falling into lava, or falling down.
371 		 
372          */
373         public  boolean isCausedByWorld()
374  	 {
375     					return CausedByWorld;
376     				}
377     			
378     	
379 	    /**
380          * 
381 			If the damage is direct. TODO
382 		 
383          */
384         protected
385          boolean DirectDamage =
386        	false;
387 	
388  		/**
389          * 
390 			If the damage is direct. TODO
391 		 
392          */
393         public  boolean isDirectDamage()
394  	 {
395     					return DirectDamage;
396     				}
397     			
398     	
399 	    /**
400          * 
401 			If this damage was caused by bullet.
402 		 
403          */
404         protected
405          boolean BulletHit =
406        	false;
407 	
408  		/**
409          * 
410 			If this damage was caused by bullet.
411 		 
412          */
413         public  boolean isBulletHit()
414  	 {
415     					return BulletHit;
416     				}
417     			
418     	
419 	    /**
420          * 
421 			If this damage was caused by vehicle running over us.
422 		 
423          */
424         protected
425          boolean VehicleHit =
426        	false;
427 	
428  		/**
429          * 
430 			If this damage was caused by vehicle running over us.
431 		 
432          */
433         public  boolean isVehicleHit()
434  	 {
435     					return VehicleHit;
436     				}
437     			
438  		
439  	    public String toString() {
440             return
441             	super.toString() + "[" +
442             	
443 		              			"Id = " + String.valueOf(getId()
444  	) + " | " + 
445 		              		
446 		              			"Killer = " + String.valueOf(getKiller()
447  	) + " | " + 
448 		              		
449 		              			"KilledPawn = " + String.valueOf(getKilledPawn()
450  	) + " | " + 
451 		              		
452 		              			"DamageType = " + String.valueOf(getDamageType()
453  	) + " | " + 
454 		              		
455 		              			"DeathString = " + String.valueOf(getDeathString()
456  	) + " | " + 
457 		              		
458 		              			"WeaponName = " + String.valueOf(getWeaponName()
459  	) + " | " + 
460 		              		
461 		              			"Flaming = " + String.valueOf(isFlaming()
462  	) + " | " + 
463 		              		
464 		              			"CausedByWorld = " + String.valueOf(isCausedByWorld()
465  	) + " | " + 
466 		              		
467 		              			"DirectDamage = " + String.valueOf(isDirectDamage()
468  	) + " | " + 
469 		              		
470 		              			"BulletHit = " + String.valueOf(isBulletHit()
471  	) + " | " + 
472 		              		
473 		              			"VehicleHit = " + String.valueOf(isVehicleHit()
474  	) + " | " + 
475 		              		
476 				"]";           		
477         }
478  	
479  		
480  		public String toHtmlString() {
481  			return super.toString() + "[<br/>" +
482             	
483 		              			"<b>Id</b> = " + String.valueOf(getId()
484  	) + " <br/> " + 
485 		              		
486 		              			"<b>Killer</b> = " + String.valueOf(getKiller()
487  	) + " <br/> " + 
488 		              		
489 		              			"<b>KilledPawn</b> = " + String.valueOf(getKilledPawn()
490  	) + " <br/> " + 
491 		              		
492 		              			"<b>DamageType</b> = " + String.valueOf(getDamageType()
493  	) + " <br/> " + 
494 		              		
495 		              			"<b>DeathString</b> = " + String.valueOf(getDeathString()
496  	) + " <br/> " + 
497 		              		
498 		              			"<b>WeaponName</b> = " + String.valueOf(getWeaponName()
499  	) + " <br/> " + 
500 		              		
501 		              			"<b>Flaming</b> = " + String.valueOf(isFlaming()
502  	) + " <br/> " + 
503 		              		
504 		              			"<b>CausedByWorld</b> = " + String.valueOf(isCausedByWorld()
505  	) + " <br/> " + 
506 		              		
507 		              			"<b>DirectDamage</b> = " + String.valueOf(isDirectDamage()
508  	) + " <br/> " + 
509 		              		
510 		              			"<b>BulletHit</b> = " + String.valueOf(isBulletHit()
511  	) + " <br/> " + 
512 		              		
513 		              			"<b>VehicleHit</b> = " + String.valueOf(isVehicleHit()
514  	) + " <br/> " + 
515 		              		
516 				"<br/>]";     
517 		}
518  	 
519  	    public String toJsonLiteral() {
520             return "PlayerKilled(null, "
521             		
522                    + ")";
523         }
524  	
525  		
526  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
527         	
528 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
529 		
530 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
531 	        
532 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
533  	
534 		}
535