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 AIN.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Sent when we get new weapon or ammunition
25  		for weapon we do not have yet. Sent just once per weapon type or
26  		per new ammunition type (notify new object in our inventory, NOT
27  		pickup). 
28  		The Id of the object (Inventory Id) here is different from the object that is lying on the 
29  		ground and represents this item in the map (Pickup id).
30  		If you want to listen to every item pickup use ItemPickedUp message!
31  	
32           */
33   	public class AddInventoryMsg 
34    				extends InfoMessage
35      			implements IWorldEvent, IWorldChangeEvent
36      			
37  	    {
38   	
39      	/** Example how the message looks like - used during parser tests. */
40      	public static final String PROTOTYPE =
41      		"AIN {Id unreal_id}  {Type text}  {PickupType xWeapons.FlakCannonPickup}  {Sniping False}  {Melee False}  {PrimaryInitialAmmo 0}  {MaxPrimaryAmmo 0}  {SecondaryInitialAmmo 0}  {MaxSecondaryAmmo 0} ";
42      
43      	
44      	
45      	/**
46      	 * Parameter-less contructor for the message.
47      	 */
48  		public AddInventoryMsg()
49  		{
50  		}
51  	
52      	
53      	
54      	
55      	/**
56  		 * Creates new instance of the message AddInventoryMsg.
57  		 * 
58  		Asynchronous message. Sent when we get new weapon or ammunition
59  		for weapon we do not have yet. Sent just once per weapon type or
60  		per new ammunition type (notify new object in our inventory, NOT
61  		pickup). 
62  		The Id of the object (Inventory Id) here is different from the object that is lying on the 
63  		ground and represents this item in the map (Pickup id).
64  		If you want to listen to every item pickup use ItemPickedUp message!
65  	
66  		 * Corresponding GameBots message
67  		 *   
68  		 *   is
69  		 *   AIN.
70  		 * 
71   	  	 * 
72  		 *   
73  		 *     @param Id 
74  			A unique Id for this inventory item, assigned by the game.
75  			Unique, but based on a string describing the item type.
76  		
77  		 *   
78  		 * 
79  		 *   
80  		 *     @param Type 
81  			A string representing type (inventory type) of the object.
82  		
83  		 *   
84  		 * 
85  		 *   
86  		 *     @param Descriptor 
87  			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
88  		
89  		 *   
90  		 * 
91  		 *   
92  		 *     @param PickupType 
93  			We get this item if we pick up this pickup class in the map.
94  		
95  		 *   
96  		 * 
97  		 *   
98  		 *     @param Sniping 
99  			If the item is a weapon, contains information whether
100 			this weapon is good for sniping.
101 		
102 		 *   
103 		 * 
104 		 *   
105 		 *     @param Melee 
106 			If the item is a weapon, contains information whether
107 			this weapon is a melee weapon.
108 		
109 		 *   
110 		 * 
111 		 *   
112 		 *     @param PrimaryInitialAmmo 
113 			If the item is a weapon, contains information how much
114 			primary ammo the weapon initial has.
115 		
116 		 *   
117 		 * 
118 		 *   
119 		 *     @param MaxPrimaryAmmo 
120 			If the item is a weapon, contains information how much
121 			primary ammo the weapon may have.
122 		
123 		 *   
124 		 * 
125 		 *   
126 		 *     @param SecondaryInitialAmmo 
127 			If the item is a weapon, contains information how much
128 			secondary ammo the weapon initial has.
129 		
130 		 *   
131 		 * 
132 		 *   
133 		 *     @param MaxSecondaryAmmo 
134 			If the item is a weapon, contains information how much
135 			secondary ammo the weapon may have.
136 		
137 		 *   
138 		 * 
139 		 */
140 		public AddInventoryMsg(
141 			UnrealId Id,  String Type,  ItemDescriptor Descriptor,  ItemType PickupType,  Boolean Sniping,  Boolean Melee,  int PrimaryInitialAmmo,  int MaxPrimaryAmmo,  int SecondaryInitialAmmo,  int MaxSecondaryAmmo
142 		) {
143 			
144 					this.Id = Id;
145 				
146 					this.Type = Type;
147 				
148 					this.Descriptor = Descriptor;
149 				
150 					this.PickupType = PickupType;
151 				
152 					this.Sniping = Sniping;
153 				
154 					this.Melee = Melee;
155 				
156 					this.PrimaryInitialAmmo = PrimaryInitialAmmo;
157 				
158 					this.MaxPrimaryAmmo = MaxPrimaryAmmo;
159 				
160 					this.SecondaryInitialAmmo = SecondaryInitialAmmo;
161 				
162 					this.MaxSecondaryAmmo = MaxSecondaryAmmo;
163 				
164 		}
165     
166     	/**
167 		 * Cloning constructor from the full message.
168 		 *
169 		 * @param original
170 		 */
171 		public AddInventoryMsg(AddInventoryMsg original) {		
172 			
173 					this.Id = original.getId()
174  	;
175 				
176 					this.Type = original.getType()
177  	;
178 				
179 					this.Descriptor = original.getDescriptor()
180  	;
181 				
182 					this.PickupType = original.getPickupType()
183  	;
184 				
185 					this.Sniping = original.isSniping()
186  	;
187 				
188 					this.Melee = original.isMelee()
189  	;
190 				
191 					this.PrimaryInitialAmmo = original.getPrimaryInitialAmmo()
192  	;
193 				
194 					this.MaxPrimaryAmmo = original.getMaxPrimaryAmmo()
195  	;
196 				
197 					this.SecondaryInitialAmmo = original.getSecondaryInitialAmmo()
198  	;
199 				
200 					this.MaxSecondaryAmmo = original.getMaxSecondaryAmmo()
201  	;
202 				
203 			this.SimTime = original.getSimTime();			
204 		}
205 		
206 	   		
207 			protected long SimTime;
208 				
209 			/**
210 			 * Simulation time in MILLI SECONDS !!!
211 			 */	
212 			@Override
213 			public long getSimTime() {
214 				return SimTime;
215 			}
216 						
217 			/**
218 			 * Used by Yylex to slip correct time of the object or programmatically.
219 			 */
220 			protected void setSimTime(long SimTime) {
221 				this.SimTime = SimTime;
222 			}
223 	   	
224     	
225 	    /**
226          * 
227 			A unique Id for this inventory item, assigned by the game.
228 			Unique, but based on a string describing the item type.
229 		 
230          */
231         protected
232          UnrealId Id =
233        	null;
234 	
235  		/**
236          * 
237 			A unique Id for this inventory item, assigned by the game.
238 			Unique, but based on a string describing the item type.
239 		 
240          */
241         public  UnrealId getId()
242  	 {
243     					return Id;
244     				}
245     			
246     	
247 	    /**
248          * 
249 			A string representing type (inventory type) of the object.
250 		 
251          */
252         protected
253          String Type =
254        	null;
255 	
256  		/**
257          * 
258 			A string representing type (inventory type) of the object.
259 		 
260          */
261         public  String getType()
262  	 {
263     					return Type;
264     				}
265     			
266     	
267 	    /**
268          * 
269 			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
270 		 
271          */
272         protected
273          ItemDescriptor Descriptor =
274        	null;
275 	
276  		/**
277          * 
278 			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
279 		 
280          */
281         public  ItemDescriptor getDescriptor()
282  	 {
283     					return Descriptor;
284     				}
285     			
286     	
287 	    /**
288          * 
289 			We get this item if we pick up this pickup class in the map.
290 		 
291          */
292         protected
293          ItemType PickupType =
294        	null;
295 	
296  		/**
297          * 
298 			We get this item if we pick up this pickup class in the map.
299 		 
300          */
301         public  ItemType getPickupType()
302  	 {
303     					return PickupType;
304     				}
305     			
306     	
307 	    /**
308          * 
309 			If the item is a weapon, contains information whether
310 			this weapon is good for sniping.
311 		 
312          */
313         protected
314          Boolean Sniping =
315        	null;
316 	
317  		/**
318          * 
319 			If the item is a weapon, contains information whether
320 			this weapon is good for sniping.
321 		 
322          */
323         public  Boolean isSniping()
324  	 {
325     					return Sniping;
326     				}
327     			
328     	
329 	    /**
330          * 
331 			If the item is a weapon, contains information whether
332 			this weapon is a melee weapon.
333 		 
334          */
335         protected
336          Boolean Melee =
337        	null;
338 	
339  		/**
340          * 
341 			If the item is a weapon, contains information whether
342 			this weapon is a melee weapon.
343 		 
344          */
345         public  Boolean isMelee()
346  	 {
347     					return Melee;
348     				}
349     			
350     	
351 	    /**
352          * 
353 			If the item is a weapon, contains information how much
354 			primary ammo the weapon initial has.
355 		 
356          */
357         protected
358          int PrimaryInitialAmmo =
359        	0;
360 	
361  		/**
362          * 
363 			If the item is a weapon, contains information how much
364 			primary ammo the weapon initial has.
365 		 
366          */
367         public  int getPrimaryInitialAmmo()
368  	 {
369     					return PrimaryInitialAmmo;
370     				}
371     			
372     	
373 	    /**
374          * 
375 			If the item is a weapon, contains information how much
376 			primary ammo the weapon may have.
377 		 
378          */
379         protected
380          int MaxPrimaryAmmo =
381        	0;
382 	
383  		/**
384          * 
385 			If the item is a weapon, contains information how much
386 			primary ammo the weapon may have.
387 		 
388          */
389         public  int getMaxPrimaryAmmo()
390  	 {
391     					return MaxPrimaryAmmo;
392     				}
393     			
394     	
395 	    /**
396          * 
397 			If the item is a weapon, contains information how much
398 			secondary ammo the weapon initial has.
399 		 
400          */
401         protected
402          int SecondaryInitialAmmo =
403        	0;
404 	
405  		/**
406          * 
407 			If the item is a weapon, contains information how much
408 			secondary ammo the weapon initial has.
409 		 
410          */
411         public  int getSecondaryInitialAmmo()
412  	 {
413     					return SecondaryInitialAmmo;
414     				}
415     			
416     	
417 	    /**
418          * 
419 			If the item is a weapon, contains information how much
420 			secondary ammo the weapon may have.
421 		 
422          */
423         protected
424          int MaxSecondaryAmmo =
425        	0;
426 	
427  		/**
428          * 
429 			If the item is a weapon, contains information how much
430 			secondary ammo the weapon may have.
431 		 
432          */
433         public  int getMaxSecondaryAmmo()
434  	 {
435     					return MaxSecondaryAmmo;
436     				}
437     			
438  		
439  	    public String toString() {
440             return
441             	super.toString() + "[" +
442             	
443 		              			"Id = " + String.valueOf(getId()
444  	) + " | " + 
445 		              		
446 		              			"Type = " + String.valueOf(getType()
447  	) + " | " + 
448 		              		
449 		              			"PickupType = " + String.valueOf(getPickupType()
450  	) + " | " + 
451 		              		
452 		              			"Sniping = " + String.valueOf(isSniping()
453  	) + " | " + 
454 		              		
455 		              			"Melee = " + String.valueOf(isMelee()
456  	) + " | " + 
457 		              		
458 		              			"PrimaryInitialAmmo = " + String.valueOf(getPrimaryInitialAmmo()
459  	) + " | " + 
460 		              		
461 		              			"MaxPrimaryAmmo = " + String.valueOf(getMaxPrimaryAmmo()
462  	) + " | " + 
463 		              		
464 		              			"SecondaryInitialAmmo = " + String.valueOf(getSecondaryInitialAmmo()
465  	) + " | " + 
466 		              		
467 		              			"MaxSecondaryAmmo = " + String.valueOf(getMaxSecondaryAmmo()
468  	) + " | " + 
469 		              		
470 				"]";           		
471         }
472  	
473  		
474  		public String toHtmlString() {
475  			return super.toString() + "[<br/>" +
476             	
477 		              			"<b>Id</b> = " + String.valueOf(getId()
478  	) + " <br/> " + 
479 		              		
480 		              			"<b>Type</b> = " + String.valueOf(getType()
481  	) + " <br/> " + 
482 		              		
483 		              			"<b>PickupType</b> = " + String.valueOf(getPickupType()
484  	) + " <br/> " + 
485 		              		
486 		              			"<b>Sniping</b> = " + String.valueOf(isSniping()
487  	) + " <br/> " + 
488 		              		
489 		              			"<b>Melee</b> = " + String.valueOf(isMelee()
490  	) + " <br/> " + 
491 		              		
492 		              			"<b>PrimaryInitialAmmo</b> = " + String.valueOf(getPrimaryInitialAmmo()
493  	) + " <br/> " + 
494 		              		
495 		              			"<b>MaxPrimaryAmmo</b> = " + String.valueOf(getMaxPrimaryAmmo()
496  	) + " <br/> " + 
497 		              		
498 		              			"<b>SecondaryInitialAmmo</b> = " + String.valueOf(getSecondaryInitialAmmo()
499  	) + " <br/> " + 
500 		              		
501 		              			"<b>MaxSecondaryAmmo</b> = " + String.valueOf(getMaxSecondaryAmmo()
502  	) + " <br/> " + 
503 		              		
504 				"<br/>]";     
505 		}
506  	 
507  	    public String toJsonLiteral() {
508             return "AddInventoryMsg(null, "
509             		
510                    + ")";
511         }
512  	
513  		
514  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
515         	
516 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
517 		
518 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
519 	        
520 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
521  	
522 		}
523