1
2 /**
3 IMPORTANT !!!
4
5 DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbcommands 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.gbcommands;
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 Will change the specified attribute of the bot. This command can
35 be issued also by bot on the bot itself (in this case Id
36 attribute is not parsed). Issuing by bot is allowed just when
37 the game has allowed cheating (bAllowCheats = True in GameBotsUDK.ini
38 file).
39
40 Corresponding GameBots command is
41 CHATTR.
42
43 */
44
45 public class
46 ChangeAttribute extends
47 CommandMessage
48
49 {
50
51 /**
52 Creates new instance of command ChangeAttribute.
53
54 Will change the specified attribute of the bot. This command can
55 be issued also by bot on the bot itself (in this case Id
56 attribute is not parsed). Issuing by bot is allowed just when
57 the game has allowed cheating (bAllowCheats = True in GameBotsUDK.ini
58 file).
59 Corresponding GameBots message for this command is
60 CHATTR.
61 @param Id
62 Id of the target bot. Not used if sent as a command for the
63 bot.
64
65 @param Health Sets the bot health.
66 */
67 public ChangeAttribute(
68 UnrealId Id, int Health) {
69
70 this.Id = Id;
71
72 this.Health = Health;
73
74 }
75
76
77 /**
78 Creates new instance of command ChangeAttribute.
79
80 Will change the specified attribute of the bot. This command can
81 be issued also by bot on the bot itself (in this case Id
82 attribute is not parsed). Issuing by bot is allowed just when
83 the game has allowed cheating (bAllowCheats = True in GameBotsUDK.ini
84 file).
85 Corresponding GameBots message for this command is
86 CHATTR.
87 <p></p>WARNING: this is empty-command constructor, you have to use setters to fill it up!
88 */
89 public ChangeAttribute() {
90 }
91
92
93 /////// Properties BEGIN
94
95 /**
96
97 Id of the target bot. Not used if sent as a command for the
98 bot.
99 */
100 protected
101 UnrealId Id =
102 null;
103
104
105 /**
106
107 Id of the target bot. Not used if sent as a command for the
108 bot.
109 */
110 public
111 UnrealId getId() {
112 return
113 Id;
114 }
115
116
117
118 /**
119
120 Id of the target bot. Not used if sent as a command for the
121 bot.
122 */
123 public ChangeAttribute setId(UnrealId Id) {
124 this.Id = Id;
125 return this;
126 }
127
128 /**
129 Sets the bot health. */
130 protected
131 int Health =
132 0;
133
134
135 /**
136 Sets the bot health. */
137 public
138 int getHealth() {
139 return
140 Health;
141 }
142
143
144
145 /**
146 Sets the bot health. */
147 public ChangeAttribute setHealth(int Health) {
148 this.Health = Health;
149 return this;
150 }
151
152 /////// Properties END
153
154 /////// Extra Java code BEGIN
155
156 /////// Additional code from xslt BEGIN
157
158
159
160 /////// Additional code from xslt END
161
162 /////// Extra Java from XML BEGIN
163
164 /////// Extra Java from XML END
165
166 /////// Extra Java code END
167
168
169
170 /**
171 * Cloning constructor.
172 */
173 public ChangeAttribute(ChangeAttribute original) {
174
175 this.Id=original.Id;
176
177 this.Health=original.Health;
178
179 }
180
181
182
183
184 public String toString() {
185 return
186
187 toMessage();
188
189 }
190
191 public String toHtmlString() {
192 return super.toString() +
193
194 "<b>Id</b> : " +
195 String.valueOf(Id) +
196 " <br/> " +
197
198 "<b>Health</b> : " +
199 String.valueOf(Health) +
200 " <br/> " +
201 "";
202 }
203
204
205
206 public String toMessage() {
207 StringBuffer buf = new StringBuffer();
208 buf.append("CHATTR");
209
210 if (Id != null) {
211 buf.append(" {Id " + Id.getStringId() + "}");
212 }
213
214 buf.append(" {Health " + Health + "}");
215
216 return buf.toString();
217 }
218
219 }
220
221