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=static]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=static]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the static part of the GameBots2004 message NFO.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Sent as response to READY command.
25  		Information about the game. What type of game is it going to be,
26  		number of teams, maximum size of teams etc.
27  	
28           */
29   	public abstract class GameInfoStatic 
30    						extends InfoMessage
31    						implements IStaticWorldObject
32    						
33  	    {
34   	
35      	
36      	
37      	/**
38      	 * Parameter-less contructor for the message.
39      	 */
40  		public GameInfoStatic()
41  		{
42  		}
43  		
44  				// abstract definition of the static-part of the message, no more constructors is needed
45  			
46  						
47  						public static final UnrealId GameInfoId = UnrealId.get("GameInfoId");
48  					
49  						
50  						public UnrealId getId() {						
51  							return cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo.GameInfoId;
52  						}
53  					
54  	   		
55  			protected long SimTime;
56  				
57  			/**
58  			 * Simulation time in MILLI SECONDS !!!
59  			 */	
60  			@Override
61  			public long getSimTime() {
62  				return SimTime;
63  			}
64  						
65  			/**
66  			 * Used by Yylex to slip correct time of the object or programmatically.
67  			 */
68  			protected void setSimTime(long SimTime) {
69  				this.SimTime = SimTime;
70  			}
71  	   	
72  	    			
73  	    				@Override
74  		    			public abstract 
75  		    			GameInfoStatic clone();
76  		    			
77  						@Override
78  						public Class getCompositeClass() {
79  							return GameInfo.class;
80  						}
81  	
82  						
83  		    			
84   		/**
85           * 
86  			What you are playing (BotDeathMatch, BotTeamGame,
87  			BotCTFGame,BotDoubleDomination).
88  		 
89           */
90          public abstract String getGametype()
91   	;
92  		    			
93   		/**
94           * Name of map in game. 
95           */
96          public abstract String getLevel()
97   	;
98  		    			
99   		/**
100          * 
101 			Max number of teams. Valid team range will be 0 to (MaxTeams
102 			- 1) (BotTeamGame, BotCTFGame, BotDoubleDomination). Usually
103 			there will be two teams - 0 and 1.
104 		 
105          */
106         public abstract int getMaxTeams()
107  	;
108 		    			
109  		/**
110          * 
111 			Location of the base spawning the red flag (team 0) (BotCTFGame).
112 		 
113          */
114         public abstract Location getRedBaseLocation()
115  	;
116 		    			
117  		/**
118          * 
119 			Location of the base spawning the blue flag (team 1) (BotCTFGame).
120 		 
121          */
122         public abstract Location getBlueBaseLocation()
123  	;
124 		    			
125  		/**
126          * 
127 			Location of the first dom point (BotDoubleDomination).
128 		 
129          */
130         public abstract Location getFirstDomPointLocation()
131  	;
132 		    			
133  		/**
134          * 
135 			Location of the second dom point (BotDoubleDomination).
136 		 
137          */
138         public abstract Location getSecondDomPointLocation()
139  	;
140 		    			
141  		/**
142          * 
143 			Sent only in BotScenario game type. Location of the factory.
144 		 
145          */
146         public abstract Location getFactoryLocation()
147  	;
148 		    			
149  		/**
150          * 
151 			Sent only in BotScenario game type. Radius of the factory.
152 		 
153          */
154         public abstract double getFactoryRadius()
155  	;
156 		    			
157  		/**
158          * 
159 			Sent only in BotScenario game type. Location of the goal point where UDamagePack should be taken.
160 		 
161          */
162         public abstract Location getDisperserLocation()
163  	;
164 		    			
165  		/**
166          * 
167 			Sent only in BotScenario game type. Radius of the disperser point.
168 		 
169          */
170         public abstract double getDisperserRadius()
171  	;
172 		    			
173  		/**
174          * 
175 			Sent only in BotScenario game type. How much adrenaline we need to activate the factory.
176 		 
177          */
178         public abstract double getFactoryAdrenalineCount()
179  	;
180 		    			
181  		/**
182          * 
183 			Sent only in BotScenario game type. Pickup class our factory spawns when used properly. Item will be spawned at the bot's location.
184 		 
185          */
186         public abstract String getFactorySpawnType()
187  	;
188 		    			
189  		
190  		@Override
191  		public boolean isDifferentFrom(IStaticWorldObject other)
192  		{
193  			if (other == null) //early fail
194  			{
195  				return true;
196  			}
197  			else if (other == this) //early out
198  			{
199  				return false;
200  			}
201  			else
202  			{
203  				GameInfoStatic obj = (GameInfoStatic) other;
204 
205  				
206  						if ( !(
207  	 			AdvancedEquals.equalsOrNull(this.getGametype()
208  	, obj.getGametype()
209  	)
210  	 		) )
211 						{
212 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Gametype on object class GameInfoStatic");
213 							return true;
214 						}
215  					
216  						if ( !(
217  	 			AdvancedEquals.equalsOrNull(this.getLevel()
218  	, obj.getLevel()
219  	)
220  	 		) )
221 						{
222 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Level on object class GameInfoStatic");
223 							return true;
224 						}
225  					
226  						if ( !(this.getMaxTeams()
227  	
228  	 			== obj.getMaxTeams()
229  	) )
230 						{
231 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property MaxTeams on object class GameInfoStatic");
232 							return true;
233 						}
234  					
235  						if ( !(
236  	 			AdvancedEquals.equalsOrNull(this.getRedBaseLocation()
237  	, obj.getRedBaseLocation()
238  	)
239  	 		) )
240 						{
241 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property RedBaseLocation on object class GameInfoStatic");
242 							return true;
243 						}
244  					
245  						if ( !(
246  	 			AdvancedEquals.equalsOrNull(this.getBlueBaseLocation()
247  	, obj.getBlueBaseLocation()
248  	)
249  	 		) )
250 						{
251 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property BlueBaseLocation on object class GameInfoStatic");
252 							return true;
253 						}
254  					
255  						if ( !(
256  	 			AdvancedEquals.equalsOrNull(this.getFirstDomPointLocation()
257  	, obj.getFirstDomPointLocation()
258  	)
259  	 		) )
260 						{
261 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FirstDomPointLocation on object class GameInfoStatic");
262 							return true;
263 						}
264  					
265  						if ( !(
266  	 			AdvancedEquals.equalsOrNull(this.getSecondDomPointLocation()
267  	, obj.getSecondDomPointLocation()
268  	)
269  	 		) )
270 						{
271 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property SecondDomPointLocation on object class GameInfoStatic");
272 							return true;
273 						}
274  					
275  						if ( !(
276  	 			AdvancedEquals.equalsOrNull(this.getFactoryLocation()
277  	, obj.getFactoryLocation()
278  	)
279  	 		) )
280 						{
281 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FactoryLocation on object class GameInfoStatic");
282 							return true;
283 						}
284  					
285  						if ( !(this.getFactoryRadius()
286  	
287  	 			== obj.getFactoryRadius()
288  	) )
289 						{
290 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FactoryRadius on object class GameInfoStatic");
291 							return true;
292 						}
293  					
294  						if ( !(
295  	 			AdvancedEquals.equalsOrNull(this.getDisperserLocation()
296  	, obj.getDisperserLocation()
297  	)
298  	 		) )
299 						{
300 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DisperserLocation on object class GameInfoStatic");
301 							return true;
302 						}
303  					
304  						if ( !(this.getDisperserRadius()
305  	
306  	 			== obj.getDisperserRadius()
307  	) )
308 						{
309 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DisperserRadius on object class GameInfoStatic");
310 							return true;
311 						}
312  					
313  						if ( !(this.getFactoryAdrenalineCount()
314  	
315  	 			== obj.getFactoryAdrenalineCount()
316  	) )
317 						{
318 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FactoryAdrenalineCount on object class GameInfoStatic");
319 							return true;
320 						}
321  					
322  						if ( !(
323  	 			AdvancedEquals.equalsOrNull(this.getFactorySpawnType()
324  	, obj.getFactorySpawnType()
325  	)
326  	 		) )
327 						{
328 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property FactorySpawnType on object class GameInfoStatic");
329 							return true;
330 						}
331  					
332  			}
333  			return false;
334  		}
335  	 
336  		
337  	    public String toString() {
338             return
339             	super.toString() + "[" +
340             	
341 		              			"Gametype = " + String.valueOf(getGametype()
342  	) + " | " + 
343 		              		
344 		              			"Level = " + String.valueOf(getLevel()
345  	) + " | " + 
346 		              		
347 		              			"MaxTeams = " + String.valueOf(getMaxTeams()
348  	) + " | " + 
349 		              		
350 		              			"RedBaseLocation = " + String.valueOf(getRedBaseLocation()
351  	) + " | " + 
352 		              		
353 		              			"BlueBaseLocation = " + String.valueOf(getBlueBaseLocation()
354  	) + " | " + 
355 		              		
356 		              			"FirstDomPointLocation = " + String.valueOf(getFirstDomPointLocation()
357  	) + " | " + 
358 		              		
359 		              			"SecondDomPointLocation = " + String.valueOf(getSecondDomPointLocation()
360  	) + " | " + 
361 		              		
362 		              			"FactoryLocation = " + String.valueOf(getFactoryLocation()
363  	) + " | " + 
364 		              		
365 		              			"FactoryRadius = " + String.valueOf(getFactoryRadius()
366  	) + " | " + 
367 		              		
368 		              			"DisperserLocation = " + String.valueOf(getDisperserLocation()
369  	) + " | " + 
370 		              		
371 		              			"DisperserRadius = " + String.valueOf(getDisperserRadius()
372  	) + " | " + 
373 		              		
374 		              			"FactoryAdrenalineCount = " + String.valueOf(getFactoryAdrenalineCount()
375  	) + " | " + 
376 		              		
377 		              			"FactorySpawnType = " + String.valueOf(getFactorySpawnType()
378  	) + " | " + 
379 		              		
380 				"]";           		
381         }
382  	
383  		
384  		public String toHtmlString() {
385  			return super.toString() + "[<br/>" +
386             	
387 		              			"<b>Gametype</b> = " + String.valueOf(getGametype()
388  	) + " <br/> " + 
389 		              		
390 		              			"<b>Level</b> = " + String.valueOf(getLevel()
391  	) + " <br/> " + 
392 		              		
393 		              			"<b>MaxTeams</b> = " + String.valueOf(getMaxTeams()
394  	) + " <br/> " + 
395 		              		
396 		              			"<b>RedBaseLocation</b> = " + String.valueOf(getRedBaseLocation()
397  	) + " <br/> " + 
398 		              		
399 		              			"<b>BlueBaseLocation</b> = " + String.valueOf(getBlueBaseLocation()
400  	) + " <br/> " + 
401 		              		
402 		              			"<b>FirstDomPointLocation</b> = " + String.valueOf(getFirstDomPointLocation()
403  	) + " <br/> " + 
404 		              		
405 		              			"<b>SecondDomPointLocation</b> = " + String.valueOf(getSecondDomPointLocation()
406  	) + " <br/> " + 
407 		              		
408 		              			"<b>FactoryLocation</b> = " + String.valueOf(getFactoryLocation()
409  	) + " <br/> " + 
410 		              		
411 		              			"<b>FactoryRadius</b> = " + String.valueOf(getFactoryRadius()
412  	) + " <br/> " + 
413 		              		
414 		              			"<b>DisperserLocation</b> = " + String.valueOf(getDisperserLocation()
415  	) + " <br/> " + 
416 		              		
417 		              			"<b>DisperserRadius</b> = " + String.valueOf(getDisperserRadius()
418  	) + " <br/> " + 
419 		              		
420 		              			"<b>FactoryAdrenalineCount</b> = " + String.valueOf(getFactoryAdrenalineCount()
421  	) + " <br/> " + 
422 		              		
423 		              			"<b>FactorySpawnType</b> = " + String.valueOf(getFactorySpawnType()
424  	) + " <br/> " + 
425 		              		
426 				"<br/>]";     
427 		}
428  	
429  		
430  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
431         	
432 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
433 		
434 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---
435 	        
436 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---        	            	
437  	
438 		}
439