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