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=shared]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=shared]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the shared 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 GameInfoShared 
30    						extends InfoMessage
31    						implements ISharedWorldObject
32    						
33  	    {
34   	
35      	
36      	
37      	/**
38      	 * Parameter-less contructor for the message.
39      	 */
40  		public GameInfoShared()
41  		{
42  		}
43  		
44  				// abstract definition of the shared-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  	    						public static final Token WeaponStayPropertyToken = Tokens.get("WeaponStay");
73  	    					
74  	    						public static final Token TimeLimitPropertyToken = Tokens.get("TimeLimit");
75  	    					
76  	    						public static final Token FragLimitPropertyToken = Tokens.get("FragLimit");
77  	    					
78  	    						public static final Token GoalTeamScorePropertyToken = Tokens.get("GoalTeamScore");
79  	    					
80  	    						public static final Token MaxTeamSizePropertyToken = Tokens.get("MaxTeamSize");
81  	    					
82  	    						public static final Token GamePausedPropertyToken = Tokens.get("GamePaused");
83  	    					
84  	    						public static final Token BotsPausedPropertyToken = Tokens.get("BotsPaused");
85  	    						
86  							
87  							public static final Set<Token> SharedPropertyTokens;
88  	
89  							static {
90  								Set<Token> tokens = new HashSet<Token>();
91  								
92  									tokens.add(WeaponStayPropertyToken);
93  								
94  									tokens.add(TimeLimitPropertyToken);
95  								
96  									tokens.add(FragLimitPropertyToken);
97  								
98  									tokens.add(GoalTeamScorePropertyToken);
99  								
100 									tokens.add(MaxTeamSizePropertyToken);
101 								
102 									tokens.add(GamePausedPropertyToken);
103 								
104 									tokens.add(BotsPausedPropertyToken);
105 								
106 								SharedPropertyTokens = Collections.unmodifiableSet(tokens);
107 							}
108 	    				
109 	    			
110 	    				@Override
111 		    			public abstract 
112 		    			GameInfoShared clone();
113 		    			
114 						@Override
115 						public Class getCompositeClass() {
116 							return GameInfo.class;
117 						}
118 	
119 						
120 		    			
121  		/**
122          * 
123 			If true respawned weapons will stay on the ground after picked up (but bot cannot pickup same weapon twice).
124 		 
125          */
126         public abstract boolean isWeaponStay()
127  	;
128 		    			
129  		/**
130          * 
131 			Maximum time game will last (if tied at end may goe to
132 			"sudden death overtime" - depends on the game type).
133 		 
134          */
135         public abstract double getTimeLimit()
136  	;
137 		    			
138  		/**
139          * 
140 			Number of kills needed to win game (BotDeathMatch only).
141 		 
142          */
143         public abstract int getFragLimit()
144  	;
145 		    			
146  		/**
147          * 
148 			Number of points a team needs to win the game (BotTeamGame,
149 			BotCTFGame, BotDoubleDomination).
150 		 
151          */
152         public abstract long getGoalTeamScore()
153  	;
154 		    			
155  		/**
156          * 
157 			Max number of players per side (BotTeamGame, BotCTFGame,
158 			BotDoubleDomination).
159 		 
160          */
161         public abstract int getMaxTeamSize()
162  	;
163 		    			
164  		/**
165          * 
166 			If the game is paused - nobody can move.
167 		 
168          */
169         public abstract boolean isGamePaused()
170  	;
171 		    			
172  		/**
173          * 
174 			If the game is paused just for bots - human controlled
175 			players can normally move.
176 		 
177          */
178         public abstract boolean isBotsPaused()
179  	;
180 		    			
181  		
182  	    public String toString() {
183             return
184             	super.toString() + "[" +
185             	
186 		              			"WeaponStay = " + String.valueOf(isWeaponStay()
187  	) + " | " + 
188 		              		
189 		              			"TimeLimit = " + String.valueOf(getTimeLimit()
190  	) + " | " + 
191 		              		
192 		              			"FragLimit = " + String.valueOf(getFragLimit()
193  	) + " | " + 
194 		              		
195 		              			"GoalTeamScore = " + String.valueOf(getGoalTeamScore()
196  	) + " | " + 
197 		              		
198 		              			"MaxTeamSize = " + String.valueOf(getMaxTeamSize()
199  	) + " | " + 
200 		              		
201 		              			"GamePaused = " + String.valueOf(isGamePaused()
202  	) + " | " + 
203 		              		
204 		              			"BotsPaused = " + String.valueOf(isBotsPaused()
205  	) + " | " + 
206 		              		
207 				"]";           		
208         }
209  	
210  		
211  		public String toHtmlString() {
212  			return super.toString() + "[<br/>" +
213             	
214 		              			"<b>WeaponStay</b> = " + String.valueOf(isWeaponStay()
215  	) + " <br/> " + 
216 		              		
217 		              			"<b>TimeLimit</b> = " + String.valueOf(getTimeLimit()
218  	) + " <br/> " + 
219 		              		
220 		              			"<b>FragLimit</b> = " + String.valueOf(getFragLimit()
221  	) + " <br/> " + 
222 		              		
223 		              			"<b>GoalTeamScore</b> = " + String.valueOf(getGoalTeamScore()
224  	) + " <br/> " + 
225 		              		
226 		              			"<b>MaxTeamSize</b> = " + String.valueOf(getMaxTeamSize()
227  	) + " <br/> " + 
228 		              		
229 		              			"<b>GamePaused</b> = " + String.valueOf(isGamePaused()
230  	) + " <br/> " + 
231 		              		
232 		              			"<b>BotsPaused</b> = " + String.valueOf(isBotsPaused()
233  	) + " <br/> " + 
234 		              		
235 				"<br/>]";     
236 		}
237  	
238  		
239  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
240         	
241 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
242 		
243 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---
244 	        
245 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=abstract]) ---        	            	
246  	
247 		}
248