1 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2
3
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
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 public abstract class GameInfo
30 extends
31 InfoMessage
32 implements IWorldEvent, IWorldChangeEvent, ICompositeWorldObject
33
34 {
35
36
37 public static final String PROTOTYPE =
38 "NFO {Gametype text} {Level text} {WeaponStay False} {TimeLimit 0} {FragLimit 0} {GoalTeamScore null} {MaxTeams 0} {MaxTeamSize 0} {RedBaseLocation 0,0,0} {BlueBaseLocation 0,0,0} {FirstDomPointLocation 0,0,0} {SecondDomPointLocation 0,0,0} {GamePaused False} {BotsPaused False} {FactoryLocation 0,0,0} {FactoryRadius 0} {DisperserLocation 0,0,0} {DisperserRadius 0} {FactoryAdrenalineCount 0} {FactorySpawnType text} ";
39
40
41
42
43
44
45 public GameInfo()
46 {
47 }
48
49
50
51
52 public static final UnrealId GameInfoId = UnrealId.get("GameInfoId");
53
54
55 public UnrealId getId() {
56 return cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo.GameInfoId;
57 }
58
59
60 protected long SimTime;
61
62
63
64
65 @Override
66 public long getSimTime() {
67 return SimTime;
68 }
69
70
71
72
73 protected void setSimTime(long SimTime) {
74 this.SimTime = SimTime;
75 }
76
77
78
79
80
81
82
83 public abstract String getGametype()
84 ;
85
86
87
88
89 public abstract String getLevel()
90 ;
91
92
93
94
95
96
97 public abstract boolean isWeaponStay()
98 ;
99
100
101
102
103
104
105
106 public abstract double getTimeLimit()
107 ;
108
109
110
111
112
113
114 public abstract int getFragLimit()
115 ;
116
117
118
119
120
121
122
123 public abstract long getGoalTeamScore()
124 ;
125
126
127
128
129
130
131
132
133 public abstract int getMaxTeams()
134 ;
135
136
137
138
139
140
141
142 public abstract int getMaxTeamSize()
143 ;
144
145
146
147
148
149
150 public abstract Location getRedBaseLocation()
151 ;
152
153
154
155
156
157
158 public abstract Location getBlueBaseLocation()
159 ;
160
161
162
163
164
165
166 public abstract Location getFirstDomPointLocation()
167 ;
168
169
170
171
172
173
174 public abstract Location getSecondDomPointLocation()
175 ;
176
177
178
179
180
181
182 public abstract boolean isGamePaused()
183 ;
184
185
186
187
188
189
190
191 public abstract boolean isBotsPaused()
192 ;
193
194
195
196
197
198
199 public abstract Location getFactoryLocation()
200 ;
201
202
203
204
205
206
207 public abstract double getFactoryRadius()
208 ;
209
210
211
212
213
214
215 public abstract Location getDisperserLocation()
216 ;
217
218
219
220
221
222
223 public abstract double getDisperserRadius()
224 ;
225
226
227
228
229
230
231 public abstract double getFactoryAdrenalineCount()
232 ;
233
234
235
236
237
238
239 public abstract String getFactorySpawnType()
240 ;
241
242
243 public static class GameInfoUpdate
244 extends GBObjectUpdate implements ICompositeWorldObjectUpdatedEvent, IGBWorldObjectEvent {
245 private GameInfo object;
246 private long time;
247 private ITeamId teamId;
248
249 public GameInfoUpdate
250 (GameInfo source, long eventTime, ITeamId teamId) {
251 this.object = source;
252 this.time = eventTime;
253 this.teamId = teamId;
254 }
255
256
257
258
259 @Override
260 public long getSimTime() {
261 return time;
262 }
263
264 @Override
265 public IWorldObject getObject() {
266 return object;
267 }
268
269 @Override
270 public WorldObjectId getId() {
271 return object.getId();
272 }
273
274 @Override
275 public ILocalWorldObjectUpdatedEvent getLocalEvent() {
276 return new GameInfoLocalImpl.GameInfoLocalUpdate
277 ((GameInfoLocal)object.getLocal(), time);
278 }
279
280 @Override
281 public ISharedWorldObjectUpdatedEvent getSharedEvent() {
282 return new GameInfoSharedImpl.GameInfoSharedUpdate
283 ((GameInfoShared)object.getShared(), time, teamId);
284 }
285
286 @Override
287 public IStaticWorldObjectUpdatedEvent getStaticEvent() {
288 return new GameInfoStaticImpl.GameInfoStaticUpdate
289 ((GameInfoStatic)object.getStatic(), time);
290 }
291
292 }
293
294
295 public String toString() {
296 return
297 super.toString() + "[" +
298
299 "Gametype = " + String.valueOf(getGametype()
300 ) + " | " +
301
302 "Level = " + String.valueOf(getLevel()
303 ) + " | " +
304
305 "WeaponStay = " + String.valueOf(isWeaponStay()
306 ) + " | " +
307
308 "TimeLimit = " + String.valueOf(getTimeLimit()
309 ) + " | " +
310
311 "FragLimit = " + String.valueOf(getFragLimit()
312 ) + " | " +
313
314 "GoalTeamScore = " + String.valueOf(getGoalTeamScore()
315 ) + " | " +
316
317 "MaxTeams = " + String.valueOf(getMaxTeams()
318 ) + " | " +
319
320 "MaxTeamSize = " + String.valueOf(getMaxTeamSize()
321 ) + " | " +
322
323 "RedBaseLocation = " + String.valueOf(getRedBaseLocation()
324 ) + " | " +
325
326 "BlueBaseLocation = " + String.valueOf(getBlueBaseLocation()
327 ) + " | " +
328
329 "FirstDomPointLocation = " + String.valueOf(getFirstDomPointLocation()
330 ) + " | " +
331
332 "SecondDomPointLocation = " + String.valueOf(getSecondDomPointLocation()
333 ) + " | " +
334
335 "GamePaused = " + String.valueOf(isGamePaused()
336 ) + " | " +
337
338 "BotsPaused = " + String.valueOf(isBotsPaused()
339 ) + " | " +
340
341 "FactoryLocation = " + String.valueOf(getFactoryLocation()
342 ) + " | " +
343
344 "FactoryRadius = " + String.valueOf(getFactoryRadius()
345 ) + " | " +
346
347 "DisperserLocation = " + String.valueOf(getDisperserLocation()
348 ) + " | " +
349
350 "DisperserRadius = " + String.valueOf(getDisperserRadius()
351 ) + " | " +
352
353 "FactoryAdrenalineCount = " + String.valueOf(getFactoryAdrenalineCount()
354 ) + " | " +
355
356 "FactorySpawnType = " + String.valueOf(getFactorySpawnType()
357 ) + " | " +
358
359 "]";
360 }
361
362
363 public String toHtmlString() {
364 return super.toString() + "[<br/>" +
365
366 "<b>Gametype</b> = " + String.valueOf(getGametype()
367 ) + " <br/> " +
368
369 "<b>Level</b> = " + String.valueOf(getLevel()
370 ) + " <br/> " +
371
372 "<b>WeaponStay</b> = " + String.valueOf(isWeaponStay()
373 ) + " <br/> " +
374
375 "<b>TimeLimit</b> = " + String.valueOf(getTimeLimit()
376 ) + " <br/> " +
377
378 "<b>FragLimit</b> = " + String.valueOf(getFragLimit()
379 ) + " <br/> " +
380
381 "<b>GoalTeamScore</b> = " + String.valueOf(getGoalTeamScore()
382 ) + " <br/> " +
383
384 "<b>MaxTeams</b> = " + String.valueOf(getMaxTeams()
385 ) + " <br/> " +
386
387 "<b>MaxTeamSize</b> = " + String.valueOf(getMaxTeamSize()
388 ) + " <br/> " +
389
390 "<b>RedBaseLocation</b> = " + String.valueOf(getRedBaseLocation()
391 ) + " <br/> " +
392
393 "<b>BlueBaseLocation</b> = " + String.valueOf(getBlueBaseLocation()
394 ) + " <br/> " +
395
396 "<b>FirstDomPointLocation</b> = " + String.valueOf(getFirstDomPointLocation()
397 ) + " <br/> " +
398
399 "<b>SecondDomPointLocation</b> = " + String.valueOf(getSecondDomPointLocation()
400 ) + " <br/> " +
401
402 "<b>GamePaused</b> = " + String.valueOf(isGamePaused()
403 ) + " <br/> " +
404
405 "<b>BotsPaused</b> = " + String.valueOf(isBotsPaused()
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 public String toJsonLiteral() {
430 return "GameInfo(null, "
431
432 + ")";
433 }
434
435
436
437
438
439
440
441
442
443
444 }
445