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=local]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=local]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the local part of the GameBots2004 message SLF.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message. Information about your bot's state.
25  	
26           */
27   	public abstract class SelfLocal 
28    						extends InfoMessage
29    						implements ILocalWorldObject
30    						
31  	    {
32   	
33      	
34      	
35      	/**
36      	 * Parameter-less contructor for the message.
37      	 */
38  		public SelfLocal()
39  		{
40  		}
41  		
42  				// abstract definition of the local-part of the message, no more constructors is needed
43  			
44  	   		
45  			protected long SimTime;
46  				
47  			/**
48  			 * Simulation time in MILLI SECONDS !!!
49  			 */	
50  			@Override
51  			public long getSimTime() {
52  				return SimTime;
53  			}
54  						
55  			/**
56  			 * Used by Yylex to slip correct time of the object or programmatically.
57  			 */
58  			protected void setSimTime(long SimTime) {
59  				this.SimTime = SimTime;
60  			}
61  	   	
62  	    			
63  	    				@Override
64  		    			public abstract 
65  		    			SelfLocal clone();
66  		    			
67  						@Override
68  						public Class getCompositeClass() {
69  							return Self.class;
70  						}
71  	
72  						
73  		    			
74   		/**
75           * Unique Id of this self message instance. 
76           */
77          public abstract UnrealId getId()
78   	;
79  		    			
80   		/**
81           * Unique Id of this bot. 
82           */
83          public abstract UnrealId getBotId()
84   	;
85  		    			
86   		/**
87           * Human readable bot name. 
88           */
89          public abstract String getName()
90   	;
91  		    			
92   		/**
93           * If we are vehicle just these attr. are sent in SLF: "Id","Vehicle""Rotation", "Location","Velocity ","Name ","Team" ,"Health" 
94  	"Armor","Adrenaline", "FloorLocation", "FloorNormal". 
95           */
96          public abstract boolean isVehicle()
97   	;
98  		    			
99   		/**
100          * 
101 			An absolute location of the bot.
102 		 
103          */
104         public abstract Location getLocation()
105  	;
106 		    			
107  		/**
108          * 
109 			Absolute velocity of the bot as a vector of movement per one
110 			game second.
111 		 
112          */
113         public abstract Velocity getVelocity()
114  	;
115 		    			
116  		/**
117          * 
118 			Which direction the bot is facing in absolute terms.
119 		 
120          */
121         public abstract Rotation getRotation()
122  	;
123 		    			
124  		/**
125          * 
126 			What team the bot is on. 255 is no team. 0-3 are red,
127 			blue, green, gold in that order.
128 		 
129          */
130         public abstract int getTeam()
131  	;
132 		    			
133  		/**
134          * 
135 			Id of the weapon we are holding. This is unique Id of an
136 			item in our inventory and is different from the Id of the
137 			item we pick up from the ground! We can parse this string to
138 			look which weapon we hold. Weapon strings to look for
139 			include: "AssaultRifle", "ShieldGun", "FlakCannon",
140 			"BioRifle", "ShockRifle", "LinkGun", "SniperRifle",
141 			"RocketLauncher", "Minigun", "LightingGun", "Translocator".
142 			TODO: Look if this is all.
143 		 
144          */
145         public abstract String getWeapon()
146  	;
147 		    			
148  		/**
149          * If the bot is shooting or not. 
150          */
151         public abstract boolean isShooting()
152  	;
153 		    			
154  		/**
155          * 
156 			How much health the bot has left. Starts at 100, ranges from
157 			0 to 200.
158 		 
159          */
160         public abstract int getHealth()
161  	;
162 		    			
163  		/**
164          * 
165 			How much ammo the bot has left for current weapon primary
166 			mode.
167 		 
168          */
169         public abstract int getPrimaryAmmo()
170  	;
171 		    			
172  		/**
173          * 
174 			How much ammo the bot has left for current weapon secondary
175 			mode. Weapon does not have to support sec. fire mode.
176 		 
177          */
178         public abstract int getSecondaryAmmo()
179  	;
180 		    			
181  		/**
182          * How much adrenaline the bot has. 
183          */
184         public abstract int getAdrenaline()
185  	;
186 		    			
187  		/**
188          * 
189 			Combined size of high armor and low armor (or small armor). The high and low armor are tracked
190                         separately. Low armor is limited to 50 points, while the
191                         high armor can have up to 150 points. Both stacks can have a combined size of 150 points as well,
192                         so if low armor is already at 50 points, high armor can have
193                         100 points at max.
194 		 
195          */
196         public abstract int getArmor()
197  	;
198 		    			
199  		/**
200          * 
201 			Also refered to as a "low armor". Ranges from 0 to 50 points.
202 		 
203          */
204         public abstract int getSmallArmor()
205  	;
206 		    			
207  		/**
208          * 
209 			If we are firing in secondary firing mode. 
210 		 
211          */
212         public abstract boolean isAltFiring()
213  	;
214 		    			
215  		/**
216          * 
217 			If we are currently crouched.
218 		 
219          */
220         public abstract boolean isCrouched()
221  	;
222 		    			
223  		/**
224          * 
225 			If we are currently in walking mode.
226 		 
227          */
228         public abstract boolean isWalking()
229  	;
230 		    			
231  		/**
232          * 
233 			Holds current floor location under the bot.
234 		 
235          */
236         public abstract Location getFloorLocation()
237  	;
238 		    			
239  		/**
240          * 
241 			Holds current floor normal under the bot.
242 		 
243          */
244         public abstract Location getFloorNormal()
245  	;
246 		    			
247  		/**
248          * 
249 			Name of the current combo (None if no combo active).
250 			Can be xGame.ComboBerserk, xGame.ComboDefensive, xGame.ComboInvis or xGame.ComboSpeed.
251 			To trigger combo adrenaline needs to be at 100 (maximum) and no other combo can be active.
252 		 
253          */
254         public abstract String getCombo()
255  	;
256 		    			
257  		/**
258          * 
259 			Time when the UDamage effect expires. If the number is higher then the current
260 			time, it means the bot has UDamage effect active right now.
261 		 
262          */
263         public abstract double getUDamageTime()
264  	;
265 		    			
266  		/**
267          * 
268 			Name of the current BDI action.
269 		 
270          */
271         public abstract String getAction()
272  	;
273 		    			
274  		/**
275          * 
276 			For UE2. Holds left emoticon of the bot, "None" means none set.
277 		 
278          */
279         public abstract String getEmotLeft()
280  	;
281 		    			
282  		/**
283          * 
284 			For UE2. Holds center emoticon of the bot, "None" means none set.
285 		 
286          */
287         public abstract String getEmotCenter()
288  	;
289 		    			
290  		/**
291          * 
292 			For UE2. Holds right emoticon of the bot, "None" means none set.
293 		 
294          */
295         public abstract String getEmotRight()
296  	;
297 		    			
298  		/**
299          * 
300 			For UE2. Holds the bubble of the emoticon of the bot, "None" means none set.
301 		 
302          */
303         public abstract String getBubble()
304  	;
305 		    			
306  		/**
307          * 
308 			For UE2. Current played animation of the bot.
309 		 
310          */
311         public abstract String getAnim()
312  	;
313 		    			
314     	
315     	
316     	
317     	public SelfLocal getLocal() {
318 			return this;
319     	}
320 		public ISharedWorldObject getShared() {
321 		 	throw new UnsupportedOperationException("Could not return LOCAL");
322 		}
323 		public IStaticWorldObject getStatic() {
324 		    throw new UnsupportedOperationException("Could not return LOCAL");
325 		}
326  	
327  		
328  		
329  	    public String toString() {
330             return
331             	super.toString() + "[" +
332             	
333 		              			"Id = " + String.valueOf(getId()
334  	) + " | " + 
335 		              		
336 		              			"BotId = " + String.valueOf(getBotId()
337  	) + " | " + 
338 		              		
339 		              			"Name = " + String.valueOf(getName()
340  	) + " | " + 
341 		              		
342 		              			"Vehicle = " + String.valueOf(isVehicle()
343  	) + " | " + 
344 		              		
345 		              			"Location = " + String.valueOf(getLocation()
346  	) + " | " + 
347 		              		
348 		              			"Velocity = " + String.valueOf(getVelocity()
349  	) + " | " + 
350 		              		
351 		              			"Rotation = " + String.valueOf(getRotation()
352  	) + " | " + 
353 		              		
354 		              			"Team = " + String.valueOf(getTeam()
355  	) + " | " + 
356 		              		
357 		              			"Weapon = " + String.valueOf(getWeapon()
358  	) + " | " + 
359 		              		
360 		              			"Shooting = " + String.valueOf(isShooting()
361  	) + " | " + 
362 		              		
363 		              			"Health = " + String.valueOf(getHealth()
364  	) + " | " + 
365 		              		
366 		              			"PrimaryAmmo = " + String.valueOf(getPrimaryAmmo()
367  	) + " | " + 
368 		              		
369 		              			"SecondaryAmmo = " + String.valueOf(getSecondaryAmmo()
370  	) + " | " + 
371 		              		
372 		              			"Adrenaline = " + String.valueOf(getAdrenaline()
373  	) + " | " + 
374 		              		
375 		              			"Armor = " + String.valueOf(getArmor()
376  	) + " | " + 
377 		              		
378 		              			"SmallArmor = " + String.valueOf(getSmallArmor()
379  	) + " | " + 
380 		              		
381 		              			"AltFiring = " + String.valueOf(isAltFiring()
382  	) + " | " + 
383 		              		
384 		              			"Crouched = " + String.valueOf(isCrouched()
385  	) + " | " + 
386 		              		
387 		              			"Walking = " + String.valueOf(isWalking()
388  	) + " | " + 
389 		              		
390 		              			"FloorLocation = " + String.valueOf(getFloorLocation()
391  	) + " | " + 
392 		              		
393 		              			"FloorNormal = " + String.valueOf(getFloorNormal()
394  	) + " | " + 
395 		              		
396 		              			"Combo = " + String.valueOf(getCombo()
397  	) + " | " + 
398 		              		
399 		              			"UDamageTime = " + String.valueOf(getUDamageTime()
400  	) + " | " + 
401 		              		
402 		              			"Action = " + String.valueOf(getAction()
403  	) + " | " + 
404 		              		
405 		              			"EmotLeft = " + String.valueOf(getEmotLeft()
406  	) + " | " + 
407 		              		
408 		              			"EmotCenter = " + String.valueOf(getEmotCenter()
409  	) + " | " + 
410 		              		
411 		              			"EmotRight = " + String.valueOf(getEmotRight()
412  	) + " | " + 
413 		              		
414 		              			"Bubble = " + String.valueOf(getBubble()
415  	) + " | " + 
416 		              		
417 		              			"Anim = " + String.valueOf(getAnim()
418  	) + " | " + 
419 		              		
420 				"]";           		
421         }
422  	
423  		
424  		public String toHtmlString() {
425  			return super.toString() + "[<br/>" +
426             	
427 		              			"<b>Id</b> = " + String.valueOf(getId()
428  	) + " <br/> " + 
429 		              		
430 		              			"<b>BotId</b> = " + String.valueOf(getBotId()
431  	) + " <br/> " + 
432 		              		
433 		              			"<b>Name</b> = " + String.valueOf(getName()
434  	) + " <br/> " + 
435 		              		
436 		              			"<b>Vehicle</b> = " + String.valueOf(isVehicle()
437  	) + " <br/> " + 
438 		              		
439 		              			"<b>Location</b> = " + String.valueOf(getLocation()
440  	) + " <br/> " + 
441 		              		
442 		              			"<b>Velocity</b> = " + String.valueOf(getVelocity()
443  	) + " <br/> " + 
444 		              		
445 		              			"<b>Rotation</b> = " + String.valueOf(getRotation()
446  	) + " <br/> " + 
447 		              		
448 		              			"<b>Team</b> = " + String.valueOf(getTeam()
449  	) + " <br/> " + 
450 		              		
451 		              			"<b>Weapon</b> = " + String.valueOf(getWeapon()
452  	) + " <br/> " + 
453 		              		
454 		              			"<b>Shooting</b> = " + String.valueOf(isShooting()
455  	) + " <br/> " + 
456 		              		
457 		              			"<b>Health</b> = " + String.valueOf(getHealth()
458  	) + " <br/> " + 
459 		              		
460 		              			"<b>PrimaryAmmo</b> = " + String.valueOf(getPrimaryAmmo()
461  	) + " <br/> " + 
462 		              		
463 		              			"<b>SecondaryAmmo</b> = " + String.valueOf(getSecondaryAmmo()
464  	) + " <br/> " + 
465 		              		
466 		              			"<b>Adrenaline</b> = " + String.valueOf(getAdrenaline()
467  	) + " <br/> " + 
468 		              		
469 		              			"<b>Armor</b> = " + String.valueOf(getArmor()
470  	) + " <br/> " + 
471 		              		
472 		              			"<b>SmallArmor</b> = " + String.valueOf(getSmallArmor()
473  	) + " <br/> " + 
474 		              		
475 		              			"<b>AltFiring</b> = " + String.valueOf(isAltFiring()
476  	) + " <br/> " + 
477 		              		
478 		              			"<b>Crouched</b> = " + String.valueOf(isCrouched()
479  	) + " <br/> " + 
480 		              		
481 		              			"<b>Walking</b> = " + String.valueOf(isWalking()
482  	) + " <br/> " + 
483 		              		
484 		              			"<b>FloorLocation</b> = " + String.valueOf(getFloorLocation()
485  	) + " <br/> " + 
486 		              		
487 		              			"<b>FloorNormal</b> = " + String.valueOf(getFloorNormal()
488  	) + " <br/> " + 
489 		              		
490 		              			"<b>Combo</b> = " + String.valueOf(getCombo()
491  	) + " <br/> " + 
492 		              		
493 		              			"<b>UDamageTime</b> = " + String.valueOf(getUDamageTime()
494  	) + " <br/> " + 
495 		              		
496 		              			"<b>Action</b> = " + String.valueOf(getAction()
497  	) + " <br/> " + 
498 		              		
499 		              			"<b>EmotLeft</b> = " + String.valueOf(getEmotLeft()
500  	) + " <br/> " + 
501 		              		
502 		              			"<b>EmotCenter</b> = " + String.valueOf(getEmotCenter()
503  	) + " <br/> " + 
504 		              		
505 		              			"<b>EmotRight</b> = " + String.valueOf(getEmotRight()
506  	) + " <br/> " + 
507 		              		
508 		              			"<b>Bubble</b> = " + String.valueOf(getBubble()
509  	) + " <br/> " + 
510 		              		
511 		              			"<b>Anim</b> = " + String.valueOf(getAnim()
512  	) + " <br/> " + 
513 		              		
514 				"<br/>]";     
515 		}
516  	
517  		
518  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
519         	
520 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
521 		
522 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=local+classtype[@name=abstract]) ---
523 	        
524 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=local+classtype[@name=abstract]) ---        	            	
525  	
526 		}
527