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 NFO 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 Asynchronous message. Sent as response to READY command.
26 Information about the game. What type of game is it going to be,
27 number of teams, maximum size of teams etc.
28
29 */
30 public class GameInfoCompositeImpl
31 extends GameInfo
32 {
33
34
35
36 /**
37 * Parameter-less contructor for the message.
38 */
39 public GameInfoCompositeImpl()
40 {
41 }
42
43
44 /**
45 * Composite-impl constructor. It assembles the message from its three fragments - local/shared/static.
46 *
47 * @param partLocal local-part of the message
48 * @param partShared shared-part of the message
49 * @param partStatic static-part of the message
50 */
51 public GameInfoCompositeImpl(
52 GameInfoLocalImpl partLocal,
53 GameInfoSharedImpl partShared,
54 GameInfoStaticImpl partStatic
55 ) {
56 this.partLocal = partLocal;
57 this.partShared = partShared;
58 this.partStatic = partStatic;
59 }
60
61 /**
62 * Cloning constructor.
63 *
64 * @param original
65 */
66 public GameInfoCompositeImpl(GameInfoCompositeImpl original) {
67 this.partLocal = partLocal;
68 this.partShared = partShared;
69 this.partStatic = partStatic;
70 }
71
72
73 public UnrealId getId() {
74 return cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo.GameInfoId;
75 }
76
77
78 @Override
79 public void setSimTime(long SimTime) {
80 super.setSimTime(SimTime);
81 }
82
83
84 protected
85 GameInfoStaticImpl
86 partStatic;
87
88 @Override
89 public GameInfoStatic getStatic() {
90 return partStatic;
91 }
92
93 protected
94 GameInfoLocalImpl
95 partLocal;
96
97 @Override
98 public GameInfoLocal getLocal() {
99 return partLocal;
100 }
101
102 GameInfoSharedImpl
103 partShared;
104
105 @Override
106 public GameInfoShared getShared() {
107 return partShared;
108 }
109
110
111
112 @Override
113
114 /**
115 *
116 What you are playing (BotDeathMatch, BotTeamGame,
117 BotCTFGame,BotDoubleDomination).
118
119 */
120 public String getGametype()
121 {
122 return
123
124 partStatic.
125 getGametype()
126 ;
127 }
128
129 @Override
130
131 /**
132 * Name of map in game.
133 */
134 public String getLevel()
135 {
136 return
137
138 partStatic.
139 getLevel()
140 ;
141 }
142
143 @Override
144
145 /**
146 *
147 If true respawned weapons will stay on the ground after picked up (but bot cannot pickup same weapon twice).
148
149 */
150 public boolean isWeaponStay()
151 {
152 return
153
154 partShared.
155 isWeaponStay()
156 ;
157 }
158
159 @Override
160
161 /**
162 *
163 Maximum time game will last (if tied at end may goe to
164 "sudden death overtime" - depends on the game type).
165
166 */
167 public double getTimeLimit()
168 {
169 return
170
171 partShared.
172 getTimeLimit()
173 ;
174 }
175
176 @Override
177
178 /**
179 *
180 Number of kills needed to win game (BotDeathMatch only).
181
182 */
183 public int getFragLimit()
184 {
185 return
186
187 partShared.
188 getFragLimit()
189 ;
190 }
191
192 @Override
193
194 /**
195 *
196 Number of points a team needs to win the game (BotTeamGame,
197 BotCTFGame, BotDoubleDomination).
198
199 */
200 public long getGoalTeamScore()
201 {
202 return
203
204 partShared.
205 getGoalTeamScore()
206 ;
207 }
208
209 @Override
210
211 /**
212 *
213 Max number of teams. Valid team range will be 0 to (MaxTeams
214 - 1) (BotTeamGame, BotCTFGame, BotDoubleDomination). Usually
215 there will be two teams - 0 and 1.
216
217 */
218 public int getMaxTeams()
219 {
220 return
221
222 partStatic.
223 getMaxTeams()
224 ;
225 }
226
227 @Override
228
229 /**
230 *
231 Max number of players per side (BotTeamGame, BotCTFGame,
232 BotDoubleDomination).
233
234 */
235 public int getMaxTeamSize()
236 {
237 return
238
239 partShared.
240 getMaxTeamSize()
241 ;
242 }
243
244 @Override
245
246 /**
247 *
248 Location of the base spawning the red flag (team 0) (BotCTFGame).
249
250 */
251 public Location getRedBaseLocation()
252 {
253 return
254
255 partStatic.
256 getRedBaseLocation()
257 ;
258 }
259
260 @Override
261
262 /**
263 *
264 Location of the base spawning the blue flag (team 1) (BotCTFGame).
265
266 */
267 public Location getBlueBaseLocation()
268 {
269 return
270
271 partStatic.
272 getBlueBaseLocation()
273 ;
274 }
275
276 @Override
277
278 /**
279 *
280 Location of the first dom point (BotDoubleDomination).
281
282 */
283 public Location getFirstDomPointLocation()
284 {
285 return
286
287 partStatic.
288 getFirstDomPointLocation()
289 ;
290 }
291
292 @Override
293
294 /**
295 *
296 Location of the second dom point (BotDoubleDomination).
297
298 */
299 public Location getSecondDomPointLocation()
300 {
301 return
302
303 partStatic.
304 getSecondDomPointLocation()
305 ;
306 }
307
308 @Override
309
310 /**
311 *
312 If the game is paused - nobody can move.
313
314 */
315 public boolean isGamePaused()
316 {
317 return
318
319 partShared.
320 isGamePaused()
321 ;
322 }
323
324 @Override
325
326 /**
327 *
328 If the game is paused just for bots - human controlled
329 players can normally move.
330
331 */
332 public boolean isBotsPaused()
333 {
334 return
335
336 partShared.
337 isBotsPaused()
338 ;
339 }
340
341 @Override
342
343 /**
344 *
345 Sent only in BotScenario game type. Location of the factory.
346
347 */
348 public Location getFactoryLocation()
349 {
350 return
351
352 partStatic.
353 getFactoryLocation()
354 ;
355 }
356
357 @Override
358
359 /**
360 *
361 Sent only in BotScenario game type. Radius of the factory.
362
363 */
364 public double getFactoryRadius()
365 {
366 return
367
368 partStatic.
369 getFactoryRadius()
370 ;
371 }
372
373 @Override
374
375 /**
376 *
377 Sent only in BotScenario game type. Location of the goal point where UDamagePack should be taken.
378
379 */
380 public Location getDisperserLocation()
381 {
382 return
383
384 partStatic.
385 getDisperserLocation()
386 ;
387 }
388
389 @Override
390
391 /**
392 *
393 Sent only in BotScenario game type. Radius of the disperser point.
394
395 */
396 public double getDisperserRadius()
397 {
398 return
399
400 partStatic.
401 getDisperserRadius()
402 ;
403 }
404
405 @Override
406
407 /**
408 *
409 Sent only in BotScenario game type. How much adrenaline we need to activate the factory.
410
411 */
412 public double getFactoryAdrenalineCount()
413 {
414 return
415
416 partStatic.
417 getFactoryAdrenalineCount()
418 ;
419 }
420
421 @Override
422
423 /**
424 *
425 Sent only in BotScenario game type. Pickup class our factory spawns when used properly. Item will be spawned at the bot's location.
426
427 */
428 public String getFactorySpawnType()
429 {
430 return
431
432 partStatic.
433 getFactorySpawnType()
434 ;
435 }
436
437
438 public String toString() {
439 return
440 super.toString() + "[" +
441
442 "Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
443
444 "]";
445 }
446
447
448 public String toHtmlString() {
449 return super.toString() + "[<br/>" +
450
451 "Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
452
453 "<br/>]";
454 }
455
456
457 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
458
459 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
460
461 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
462
463 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
464
465 }
466