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=event]+classtype[@name=impl] BEGIN
13
14 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] END
15
16 /**
17 *
18 Definition of the event HELLO_BOT.
19
20 *
21 * <p></p><p></p>
22 * Complete message documentation:
23 *
24 Asynchronous message. Sent for bot connection. First message
25 from UT2004, part of handshake.
26
27 */
28 public class HelloBotHandshake
29 extends InfoMessage
30 implements IWorldEvent, IWorldChangeEvent
31
32 {
33
34 /** Example how the message looks like - used during parser tests. */
35 public static final String PROTOTYPE =
36 "HELLO_BOT {ServerFull False} {Game text} {Version text} ";
37
38
39
40 /**
41 * Parameter-less contructor for the message.
42 */
43 public HelloBotHandshake()
44 {
45 }
46
47
48
49
50 /**
51 * Creates new instance of the message HelloBotHandshake.
52 *
53 Asynchronous message. Sent for bot connection. First message
54 from UT2004, part of handshake.
55
56 * Corresponding GameBots message
57 *
58 * is
59 * HELLO_BOT.
60 *
61 *
62 *
63 * @param ServerFull
64 If it is true, connection will be terminated afterwards.
65
66 *
67 *
68 *
69 * @param Game
70 Name of the Unreal Tournament version these GameBots are running on (UT2004, UE2, UDK, UT3...).
71
72 *
73 *
74 *
75 * @param Version
76 Version number of GameBots.
77
78 *
79 *
80 */
81 public HelloBotHandshake(
82 boolean ServerFull, String Game, String Version
83 ) {
84
85 this.ServerFull = ServerFull;
86
87 this.Game = Game;
88
89 this.Version = Version;
90
91 }
92
93 /**
94 * Cloning constructor from the full message.
95 *
96 * @param original
97 */
98 public HelloBotHandshake(HelloBotHandshake original) {
99
100 this.ServerFull = original.isServerFull()
101 ;
102
103 this.Game = original.getGame()
104 ;
105
106 this.Version = original.getVersion()
107 ;
108
109 this.SimTime = original.getSimTime();
110 }
111
112
113 protected long SimTime;
114
115 /**
116 * Simulation time in MILLI SECONDS !!!
117 */
118 @Override
119 public long getSimTime() {
120 return SimTime;
121 }
122
123 /**
124 * Used by Yylex to slip correct time of the object or programmatically.
125 */
126 protected void setSimTime(long SimTime) {
127 this.SimTime = SimTime;
128 }
129
130
131 /**
132 *
133 If it is true, connection will be terminated afterwards.
134
135 */
136 protected
137 boolean ServerFull =
138 false;
139
140 /**
141 *
142 If it is true, connection will be terminated afterwards.
143
144 */
145 public boolean isServerFull()
146 {
147 return ServerFull;
148 }
149
150
151 /**
152 *
153 Name of the Unreal Tournament version these GameBots are running on (UT2004, UE2, UDK, UT3...).
154
155 */
156 protected
157 String Game =
158 null;
159
160 /**
161 *
162 Name of the Unreal Tournament version these GameBots are running on (UT2004, UE2, UDK, UT3...).
163
164 */
165 public String getGame()
166 {
167 return Game;
168 }
169
170
171 /**
172 *
173 Version number of GameBots.
174
175 */
176 protected
177 String Version =
178 null;
179
180 /**
181 *
182 Version number of GameBots.
183
184 */
185 public String getVersion()
186 {
187 return Version;
188 }
189
190
191 public String toString() {
192 return
193 super.toString() + "[" +
194
195 "ServerFull = " + String.valueOf(isServerFull()
196 ) + " | " +
197
198 "Game = " + String.valueOf(getGame()
199 ) + " | " +
200
201 "Version = " + String.valueOf(getVersion()
202 ) + " | " +
203
204 "]";
205 }
206
207
208 public String toHtmlString() {
209 return super.toString() + "[<br/>" +
210
211 "<b>ServerFull</b> = " + String.valueOf(isServerFull()
212 ) + " <br/> " +
213
214 "<b>Game</b> = " + String.valueOf(getGame()
215 ) + " <br/> " +
216
217 "<b>Version</b> = " + String.valueOf(getVersion()
218 ) + " <br/> " +
219
220 "<br/>]";
221 }
222
223 public String toJsonLiteral() {
224 return "hellobothandshake( "
225 +
226 String.valueOf(isServerFull()
227 )
228 + ", " +
229 (getGame()
230 == null ? "null" :
231 "\"" + getGame()
232 + "\""
233 )
234 + ", " +
235 (getVersion()
236 == null ? "null" :
237 "\"" + getVersion()
238 + "\""
239 )
240
241 + ")";
242 }
243
244
245 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
246
247 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
248
249 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
250
251 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
252
253 }
254