View Javadoc

1   
2               /**
3               IMPORTANT !!!
4   
5               DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbinfomessages BY
6               THE JavaClassesGenerator.xslt. MODIFY THESE FILES INSTEAD OF THIS ONE.
7   
8               IMPORTANT END !!!
9               */
10              package
11              cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages;
12  	    		import java.util.*;
13      import javax.vecmath.*;
14      import cz.cuni.amis.pogamut.base.communication.messages.*;
15      import cz.cuni.amis.pogamut.base.communication.worldview.*;
16      import cz.cuni.amis.pogamut.base.communication.worldview.event.*;
17      import cz.cuni.amis.pogamut.base.communication.worldview.object.*;
18      import cz.cuni.amis.pogamut.base.communication.translator.event.*;
19      import cz.cuni.amis.pogamut.base3d.worldview.object.*;
20      import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;
21      import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
22      import cz.cuni.amis.pogamut.udk.communication.messages.*;
23      import cz.cuni.amis.pogamut.udk.communication.worldview.objects.*;
24      import cz.cuni.amis.pogamut.udk.communication.translator.itemdescriptor.*;
25      import cz.cuni.amis.pogamut.udk.communication.messages.ItemType.Category;
26      import cz.cuni.amis.utils.exception.*;
27      import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;
28      import cz.cuni.amis.utils.SafeEquals;
29      import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;
30      
31              
32              /**
33                
34  		Asynchronous message. Comes when we have picked up an item. This does not mean the item will be added to 
35  		our inventory (for example Adrenaline or Health pickup just raise our stats).
36  	
37                            Corresponding GameBots message is
38                            IPK.
39                        
40               */
41              
42              public class
43              ItemPickedUp
44                      extends GBEvent
45                  
46  	            	implements IWorldEvent, IWorldChangeEvent, ILocated
47  
48              {
49              
50              /**
51                Creates new instance of command ItemPickedUp.
52                
53  		Asynchronous message. Comes when we have picked up an item. This does not mean the item will be added to 
54  		our inventory (for example Adrenaline or Health pickup just raise our stats).
55  	Corresponding GameBots message for this command is
56                .
57                    @param Id 
58  			Unique Id of the item. This Id represents just item on the
59  			map, not in our inventory.
60  		
61                    @param InventoryId 
62  			Unique Id of the item in our inventory - use this Id to do changeweapons etc.
63  			Unreal has different Ids for items in map and actual item in bot's inventory.
64  			If the item does not go into our inventory nothing will be here (null).
65  		
66                    @param Location Location of the item.
67                    @param Amount 
68  			If this item is some ammo or health pack, here we can find
69  			out how much of the attribute this item will add. Works also for weapons - will hold primary ammo amount.
70  		
71                    @param AmountSec 
72  			Only sent if this item is a weapon. Holds secondary ammo amount.
73  		
74                    @param Type 
75  			Class of the item (e.g. xWeapons.FlakCannonPickup).
76  		
77                    @param Descriptor 
78  			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
79  		
80                    @param Dropped 
81  			Whether it is a regular item or dropped by player or bot.
82  		
83                */
84               public ItemPickedUp(
85                  UnrealId Id,  UnrealId InventoryId,  Location Location,  int Amount,  int AmountSec,  ItemType Type,  ItemDescriptor Descriptor,  Boolean Dropped) {
86                      
87                      this.Id = Id;
88                  
89                      this.InventoryId = InventoryId;
90                  
91                      this.Location = Location;
92                  
93                      this.Amount = Amount;
94                  
95                      this.AmountSec = AmountSec;
96                  
97                      this.Type = Type;
98                  
99                      this.Descriptor = Descriptor;
100                 
101                     this.Dropped = Dropped;
102                 
103                 }
104 
105             
106     	/** Example how the message looks like - used during parser tests. */
107     	public static final String PROTOTYPE =
108     		"IPK {Id unreal_id} {InventoryId unreal_id} {Location 0,0,0} {Amount 0} {AmountSec 0} {Type xWeapons.FlakCannonPickup} {Dropped False}";
109     
110 
111             /////// Properties BEGIN
112             
113         /**
114         
115 			Unique Id of the item. This Id represents just item on the
116 			map, not in our inventory.
117 		 */
118         protected
119          UnrealId Id =
120         	null;
121 
122         
123         /**
124         
125 			Unique Id of the item. This Id represents just item on the
126 			map, not in our inventory.
127 		 */
128         public
129         UnrealId getId() {
130             return
131          Id;
132         }
133         
134 
135         
136         /**
137         
138 			Unique Id of the item in our inventory - use this Id to do changeweapons etc.
139 			Unreal has different Ids for items in map and actual item in bot's inventory.
140 			If the item does not go into our inventory nothing will be here (null).
141 		 */
142         protected
143          UnrealId InventoryId =
144         	null;
145 
146         
147         /**
148         
149 			Unique Id of the item in our inventory - use this Id to do changeweapons etc.
150 			Unreal has different Ids for items in map and actual item in bot's inventory.
151 			If the item does not go into our inventory nothing will be here (null).
152 		 */
153         public
154         UnrealId getInventoryId() {
155             return
156          InventoryId;
157         }
158         
159 
160         
161         /**
162         Location of the item. */
163         protected
164          Location Location =
165         	null;
166 
167         
168         /**
169         Location of the item. */
170         public
171         Location getLocation() {
172             return
173          Location;
174         }
175         
176 
177         
178         /**
179         
180 			If this item is some ammo or health pack, here we can find
181 			out how much of the attribute this item will add. Works also for weapons - will hold primary ammo amount.
182 		 */
183         protected
184          int Amount =
185         	0;
186 
187         
188         /**
189         
190 			If this item is some ammo or health pack, here we can find
191 			out how much of the attribute this item will add. Works also for weapons - will hold primary ammo amount.
192 		 */
193         public
194         int getAmount() {
195             return
196          Amount;
197         }
198         
199 
200         
201         /**
202         
203 			Only sent if this item is a weapon. Holds secondary ammo amount.
204 		 */
205         protected
206          int AmountSec =
207         	0;
208 
209         
210         /**
211         
212 			Only sent if this item is a weapon. Holds secondary ammo amount.
213 		 */
214         public
215         int getAmountSec() {
216             return
217          AmountSec;
218         }
219         
220 
221         
222         /**
223         
224 			Class of the item (e.g. xWeapons.FlakCannonPickup).
225 		 */
226         protected
227          ItemType Type =
228         	null;
229 
230         
231         /**
232         
233 			Class of the item (e.g. xWeapons.FlakCannonPickup).
234 		 */
235         public
236         ItemType getType() {
237             return
238          Type;
239         }
240         
241 
242         
243         /**
244         
245 			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
246 		 */
247         protected
248          ItemDescriptor Descriptor =
249         	null;
250 
251         
252         /**
253         
254 			Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor. 
255 		 */
256         public
257         ItemDescriptor getDescriptor() {
258             return
259          Descriptor;
260         }
261         
262 
263         
264         /**
265         
266 			Whether it is a regular item or dropped by player or bot.
267 		 */
268         protected
269          Boolean Dropped =
270         	null;
271 
272         
273         /**
274         
275 			Whether it is a regular item or dropped by player or bot.
276 		 */
277         public
278         Boolean isDropped() {
279             return
280          Dropped;
281         }
282         
283 
284         
285             /////// Properties END
286 
287             /////// Extra Java code BEGIN
288 
289             	/////// Additional code from xslt BEGIN
290             		
291        					public long getSimTime() {
292        						// NOT IMPLEMENTED FOR UDK
293        						return 0;
294        					}
295             		
296 
297 
298             	/////// Additional code from xslt END
299 
300 	            /////// Extra Java from XML BEGIN
301             		
302             	/////// Extra Java from XML END
303 
304             /////// Extra Java code END
305 
306             
307 
308             /**
309               * Cloning constructor.
310               */
311              public ItemPickedUp(ItemPickedUp original) {
312                 
313                      this.Id=original.Id;
314                 
315                      this.InventoryId=original.InventoryId;
316                 
317                      this.Location=original.Location;
318                 
319                      this.Amount=original.Amount;
320                 
321                      this.AmountSec=original.AmountSec;
322                 
323                      this.Type=original.Type;
324                 
325                      this.Descriptor=original.Descriptor;
326                 
327                      this.Dropped=original.Dropped;
328                 
329              }
330 
331              
332                  /**
333                   * Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
334                   */
335 	             public ItemPickedUp() {
336 	             }
337              
338 
339                  
340             public String toString() {
341                 return
342                 
343                 		super.toString() + " | " +
344                 		
345 				               "Id = " +
346 				               String.valueOf(Id) + " | " +
347 				            
348 				               "InventoryId = " +
349 				               String.valueOf(InventoryId) + " | " +
350 				            
351 				               "Location = " +
352 				               String.valueOf(Location) + " | " +
353 				            
354 				               "Amount = " +
355 				               String.valueOf(Amount) + " | " +
356 				            
357 				               "AmountSec = " +
358 				               String.valueOf(AmountSec) + " | " +
359 				            
360 				               "Type = " +
361 				               String.valueOf(Type) + " | " +
362 				            
363 				               "Dropped = " +
364 				               String.valueOf(Dropped) + " | " +
365 				             "";
366                 	
367              }
368 
369              public String toHtmlString() {
370                 return super.toString() +
371             
372             "<b>Id</b> : " +
373             String.valueOf(Id) +
374             " <br/> " +
375             
376             "<b>InventoryId</b> : " +
377             String.valueOf(InventoryId) +
378             " <br/> " +
379             
380             "<b>Location</b> : " +
381             String.valueOf(Location) +
382             " <br/> " +
383             
384             "<b>Amount</b> : " +
385             String.valueOf(Amount) +
386             " <br/> " +
387             
388             "<b>AmountSec</b> : " +
389             String.valueOf(AmountSec) +
390             " <br/> " +
391             
392             "<b>Type</b> : " +
393             String.valueOf(Type) +
394             " <br/> " +
395             
396             "<b>Descriptor</b> : " +
397             String.valueOf(Descriptor) +
398             " <br/> " +
399             
400             "<b>Dropped</b> : " +
401             String.valueOf(Dropped) +
402             " <br/> " +
403              "";
404              }
405 
406              
407              
408              }
409 
410