1
2 /**
3 IMPORTANT !!!
4
5 DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbinfomessages BY
6 THE JavaClassesGenerator.xslt. MODIFY THESE FILES INSTEAD OF THIS ONE.
7
8 IMPORTANT END !!!
9 */
10 package
11 cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages;
12 import java.util.*;
13 import javax.vecmath.*;
14 import cz.cuni.amis.pogamut.base.communication.messages.*;
15 import cz.cuni.amis.pogamut.base.communication.worldview.*;
16 import cz.cuni.amis.pogamut.base.communication.worldview.event.*;
17 import cz.cuni.amis.pogamut.base.communication.worldview.object.*;
18 import cz.cuni.amis.pogamut.base.communication.translator.event.*;
19 import cz.cuni.amis.pogamut.base3d.worldview.object.*;
20 import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;
21 import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
22 import cz.cuni.amis.pogamut.udk.communication.messages.*;
23 import cz.cuni.amis.pogamut.udk.communication.worldview.objects.*;
24 import cz.cuni.amis.pogamut.udk.communication.translator.itemdescriptor.*;
25 import cz.cuni.amis.pogamut.udk.communication.messages.ItemType.Category;
26 import cz.cuni.amis.utils.exception.*;
27 import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;
28 import cz.cuni.amis.utils.SafeEquals;
29 import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;
30
31
32 /**
33
34 Asynchronous message. Send when the bot changed weapon. Here we will export
35 the status of the old weapon - of the weapon that was changed. So we can have
36 correct info about weapons in our inventory. This could be a problem without
37 this message because of synchronous batch delay.
38
39 Corresponding GameBots message is
40 WUP.
41
42 */
43
44 public class
45 WeaponUpdate
46 extends GBEvent
47
48 implements IWorldEvent, IWorldChangeEvent
49
50 {
51
52 /**
53 Creates new instance of command WeaponUpdate.
54
55 Asynchronous message. Send when the bot changed weapon. Here we will export
56 the status of the old weapon - of the weapon that was changed. So we can have
57 correct info about weapons in our inventory. This could be a problem without
58 this message because of synchronous batch delay.
59 Corresponding GameBots message for this command is
60 .
61 @param Id
62 Unique Id of the weapon, based on the inventory weapon's
63 name (this is different from the Id of the weapon that can
64 be picked up in the map).
65
66 @param PrimaryAmmo
67 Holding primary ammo of the old weapon (that was changed).
68
69 @param SecondaryAmmo
70 Holding secondary ammo of the old weapon (that was changed)
71
72 @param InventoryType
73 Class of the weapon in the inventory. Matches InventoryType in the item class (ITC) message.
74
75 */
76 public WeaponUpdate(
77 UnrealId Id, int PrimaryAmmo, int SecondaryAmmo, String InventoryType) {
78
79 this.Id = Id;
80
81 this.PrimaryAmmo = PrimaryAmmo;
82
83 this.SecondaryAmmo = SecondaryAmmo;
84
85 this.InventoryType = InventoryType;
86
87 }
88
89
90 /** Example how the message looks like - used during parser tests. */
91 public static final String PROTOTYPE =
92 "WUP {Id unreal_id} {PrimaryAmmo 0} {SecondaryAmmo 0} {InventoryType text}";
93
94
95 /////// Properties BEGIN
96
97 /**
98
99 Unique Id of the weapon, based on the inventory weapon's
100 name (this is different from the Id of the weapon that can
101 be picked up in the map).
102 */
103 protected
104 UnrealId Id =
105 null;
106
107
108 /**
109
110 Unique Id of the weapon, based on the inventory weapon's
111 name (this is different from the Id of the weapon that can
112 be picked up in the map).
113 */
114 public
115 UnrealId getId() {
116 return
117 Id;
118 }
119
120
121
122 /**
123
124 Holding primary ammo of the old weapon (that was changed).
125 */
126 protected
127 int PrimaryAmmo =
128 0;
129
130
131 /**
132
133 Holding primary ammo of the old weapon (that was changed).
134 */
135 public
136 int getPrimaryAmmo() {
137 return
138 PrimaryAmmo;
139 }
140
141
142
143 /**
144
145 Holding secondary ammo of the old weapon (that was changed)
146 */
147 protected
148 int SecondaryAmmo =
149 0;
150
151
152 /**
153
154 Holding secondary ammo of the old weapon (that was changed)
155 */
156 public
157 int getSecondaryAmmo() {
158 return
159 SecondaryAmmo;
160 }
161
162
163
164 /**
165
166 Class of the weapon in the inventory. Matches InventoryType in the item class (ITC) message.
167 */
168 protected
169 String InventoryType =
170 null;
171
172
173 /**
174
175 Class of the weapon in the inventory. Matches InventoryType in the item class (ITC) message.
176 */
177 public
178 String getInventoryType() {
179 return
180 InventoryType;
181 }
182
183
184
185 /////// Properties END
186
187 /////// Extra Java code BEGIN
188
189 /////// Additional code from xslt BEGIN
190
191 public long getSimTime() {
192 // NOT IMPLEMENTED FOR UDK
193 return 0;
194 }
195
196
197
198 /////// Additional code from xslt END
199
200 /////// Extra Java from XML BEGIN
201
202 /////// Extra Java from XML END
203
204 /////// Extra Java code END
205
206
207
208 /**
209 * Cloning constructor.
210 */
211 public WeaponUpdate(WeaponUpdate original) {
212
213 this.Id=original.Id;
214
215 this.PrimaryAmmo=original.PrimaryAmmo;
216
217 this.SecondaryAmmo=original.SecondaryAmmo;
218
219 this.InventoryType=original.InventoryType;
220
221 }
222
223
224 /**
225 * Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
226 */
227 public WeaponUpdate() {
228 }
229
230
231
232 public String toString() {
233 return
234
235 super.toString() + " | " +
236
237 "Id = " +
238 String.valueOf(Id) + " | " +
239
240 "PrimaryAmmo = " +
241 String.valueOf(PrimaryAmmo) + " | " +
242
243 "SecondaryAmmo = " +
244 String.valueOf(SecondaryAmmo) + " | " +
245
246 "InventoryType = " +
247 String.valueOf(InventoryType) + " | " +
248 "";
249
250 }
251
252 public String toHtmlString() {
253 return super.toString() +
254
255 "<b>Id</b> : " +
256 String.valueOf(Id) +
257 " <br/> " +
258
259 "<b>PrimaryAmmo</b> : " +
260 String.valueOf(PrimaryAmmo) +
261 " <br/> " +
262
263 "<b>SecondaryAmmo</b> : " +
264 String.valueOf(SecondaryAmmo) +
265 " <br/> " +
266
267 "<b>InventoryType</b> : " +
268 String.valueOf(InventoryType) +
269 " <br/> " +
270 "";
271 }
272
273
274
275 }
276
277