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=base]+classtype[@name=message] BEGIN
13
14 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=base]+classtype[@name=message] END
15
16 /**
17 *
18 Implementation of the GameBots2004 message CONFCH contains also its Local/Shared/Static subpart class definitions..
19
20 *
21 * <p></p><p></p>
22 * Complete message documentation:
23 *
24 Asynchronous message. Message sent when the bot configuration
25 changed - each agent has a lot of parameters affecting his state
26 in the environment. See each property for the details.
27
28 */
29 public class ConfigChangeMessage
30 extends
31 ConfigChange
32 implements IWorldObjectUpdatedEvent, ICompositeWorldObjectUpdatedEvent
33
34 {
35
36
37
38 /**
39 * Parameter-less contructor for the message.
40 */
41 public ConfigChangeMessage()
42 {
43 }
44
45
46
47
48 /**
49 * Creates new instance of the message ConfigChange.
50 *
51 Asynchronous message. Message sent when the bot configuration
52 changed - each agent has a lot of parameters affecting his state
53 in the environment. See each property for the details.
54
55 * Corresponding GameBots message
56 *
57 * is
58 * CONFCH.
59 *
60 *
61 *
62 * @param Id Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end.
63 *
64 *
65 *
66 * @param BotId Unique Id of the bot.
67 *
68 *
69 *
70 * @param ManualSpawn
71 True if we have to spawn the bot manually after each death
72
73 *
74 *
75 *
76 * @param AutoTrace
77 True if the bot is using auto ray tracing (is provided with
78 synchronous ATR messages). See ATR messages for more
79 details.
80
81 *
82 *
83 *
84 * @param Name The bot's name.
85 *
86 *
87 *
88 * @param SpeedMultiplier
89 Bots default speed will be multiplied by this number. Ranges from 0.1 to 2 (default, can be set in ini in [GameBots2004.RemoteBot] MaxSpeed).
90
91 *
92 *
93 *
94 * @param RotationRate
95 Bot rotation rate. Default rotation rate is: (Pitch=3072,Yaw=60000,Roll=2048) and may be configured in ini file in [GameBots2004.RemoteBot] DefaultRotationRate. (pitch - up/down, yaw - left/right, roll - equivalent of doing a cartwheel)
96
97 *
98 *
99 *
100 * @param Invulnerable
101 If bot is invulnerable (cannot die) or not.
102
103 *
104 *
105 *
106 * @param VisionTime
107 The delay between two synchronous batches (can range from
108 0.1 to 2 seconds).
109
110 *
111 *
112 *
113 * @param ShowDebug
114 If some additional debug information will be shown in the
115 UT2004 server console window.
116
117 *
118 *
119 *
120 * @param ShowFocalPoint
121 If true an actor visualizing the location the bot is
122 actually looking at will appear in the game.
123
124 *
125 *
126 *
127 * @param DrawTraceLines
128 if the GB should draw lines representing the auto ray traces
129 of the bot (for more information see ATR message).
130
131 *
132 *
133 *
134 * @param SynchronousOff
135 It informs if sending of all GB synchronous messages is
136 enabled or disabled.
137
138 *
139 *
140 *
141 * @param AutoPickupOff
142 It enables/disables automatic pickup of the bot. If true the items can be picked up through PICK command.
143
144 *
145 *
146 *
147 * @param Action
148 Name of current BDI action.
149
150 *
151 *
152 */
153 public ConfigChangeMessage(
154 UnrealId Id, UnrealId BotId, boolean ManualSpawn, boolean AutoTrace, String Name, double SpeedMultiplier, Rotation RotationRate, boolean Invulnerable, double VisionTime, boolean ShowDebug, boolean ShowFocalPoint, boolean DrawTraceLines, boolean SynchronousOff, boolean AutoPickupOff, String Action
155 ) {
156
157 this.Id = Id;
158
159 this.BotId = BotId;
160
161 this.ManualSpawn = ManualSpawn;
162
163 this.AutoTrace = AutoTrace;
164
165 this.Name = Name;
166
167 this.SpeedMultiplier = SpeedMultiplier;
168
169 this.RotationRate = RotationRate;
170
171 this.Invulnerable = Invulnerable;
172
173 this.VisionTime = VisionTime;
174
175 this.ShowDebug = ShowDebug;
176
177 this.ShowFocalPoint = ShowFocalPoint;
178
179 this.DrawTraceLines = DrawTraceLines;
180
181 this.SynchronousOff = SynchronousOff;
182
183 this.AutoPickupOff = AutoPickupOff;
184
185 this.Action = Action;
186
187 }
188
189 /**
190 * Cloning constructor from the full message.
191 *
192 * @param original
193 */
194 public ConfigChangeMessage(ConfigChangeMessage original) {
195
196 this.Id = original.getId()
197 ;
198
199 this.BotId = original.getBotId()
200 ;
201
202 this.ManualSpawn = original.isManualSpawn()
203 ;
204
205 this.AutoTrace = original.isAutoTrace()
206 ;
207
208 this.Name = original.getName()
209 ;
210
211 this.SpeedMultiplier = original.getSpeedMultiplier()
212 ;
213
214 this.RotationRate = original.getRotationRate()
215 ;
216
217 this.Invulnerable = original.isInvulnerable()
218 ;
219
220 this.VisionTime = original.getVisionTime()
221 ;
222
223 this.ShowDebug = original.isShowDebug()
224 ;
225
226 this.ShowFocalPoint = original.isShowFocalPoint()
227 ;
228
229 this.DrawTraceLines = original.isDrawTraceLines()
230 ;
231
232 this.SynchronousOff = original.isSynchronousOff()
233 ;
234
235 this.AutoPickupOff = original.isAutoPickupOff()
236 ;
237
238 this.Action = original.getAction()
239 ;
240
241 this.TeamId = original.getTeamId();
242
243 this.SimTime = original.getSimTime();
244 }
245
246
247 protected ITeamId TeamId;
248
249 /**
250 * Used by Yylex to slip corretn TeamId.
251 */
252 protected void setTeamId(ITeamId TeamId) {
253 this.TeamId = TeamId;
254 }
255
256 public ITeamId getTeamId() {
257 return TeamId;
258 }
259
260
261
262
263 /**
264 * Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end.
265 */
266 protected
267 UnrealId Id =
268 null;
269
270
271 /**
272 * Whether property 'Id' was received from GB2004.
273 */
274 protected boolean Id_Set = false;
275
276 @Override
277
278 /**
279 * Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end.
280 */
281 public UnrealId getId()
282 {
283 return Id;
284 }
285
286
287 /**
288 * Unique Id of the bot.
289 */
290 protected
291 UnrealId BotId =
292 null;
293
294
295 /**
296 * Whether property 'BotId' was received from GB2004.
297 */
298 protected boolean BotId_Set = false;
299
300 @Override
301
302 /**
303 * Unique Id of the bot.
304 */
305 public UnrealId getBotId()
306 {
307 return BotId;
308 }
309
310
311 /**
312 *
313 True if we have to spawn the bot manually after each death
314
315 */
316 protected
317 boolean ManualSpawn =
318 false;
319
320
321 /**
322 * Whether property 'ManualSpawn' was received from GB2004.
323 */
324 protected boolean ManualSpawn_Set = false;
325
326 @Override
327
328 /**
329 *
330 True if we have to spawn the bot manually after each death
331
332 */
333 public boolean isManualSpawn()
334 {
335 return ManualSpawn;
336 }
337
338
339 /**
340 *
341 True if the bot is using auto ray tracing (is provided with
342 synchronous ATR messages). See ATR messages for more
343 details.
344
345 */
346 protected
347 boolean AutoTrace =
348 false;
349
350
351 /**
352 * Whether property 'AutoTrace' was received from GB2004.
353 */
354 protected boolean AutoTrace_Set = false;
355
356 @Override
357
358 /**
359 *
360 True if the bot is using auto ray tracing (is provided with
361 synchronous ATR messages). See ATR messages for more
362 details.
363
364 */
365 public boolean isAutoTrace()
366 {
367 return AutoTrace;
368 }
369
370
371 /**
372 * The bot's name.
373 */
374 protected
375 String Name =
376 null;
377
378
379 /**
380 * Whether property 'Name' was received from GB2004.
381 */
382 protected boolean Name_Set = false;
383
384 @Override
385
386 /**
387 * The bot's name.
388 */
389 public String getName()
390 {
391 return Name;
392 }
393
394
395 /**
396 *
397 Bots default speed will be multiplied by this number. Ranges from 0.1 to 2 (default, can be set in ini in [GameBots2004.RemoteBot] MaxSpeed).
398
399 */
400 protected
401 double SpeedMultiplier =
402 0;
403
404
405 /**
406 * Whether property 'SpeedMultiplier' was received from GB2004.
407 */
408 protected boolean SpeedMultiplier_Set = false;
409
410 @Override
411
412 /**
413 *
414 Bots default speed will be multiplied by this number. Ranges from 0.1 to 2 (default, can be set in ini in [GameBots2004.RemoteBot] MaxSpeed).
415
416 */
417 public double getSpeedMultiplier()
418 {
419 return SpeedMultiplier;
420 }
421
422
423 /**
424 *
425 Bot rotation rate. Default rotation rate is: (Pitch=3072,Yaw=60000,Roll=2048) and may be configured in ini file in [GameBots2004.RemoteBot] DefaultRotationRate. (pitch - up/down, yaw - left/right, roll - equivalent of doing a cartwheel)
426
427 */
428 protected
429 Rotation RotationRate =
430 null;
431
432
433 /**
434 * Whether property 'RotationRate' was received from GB2004.
435 */
436 protected boolean RotationRate_Set = false;
437
438 @Override
439
440 /**
441 *
442 Bot rotation rate. Default rotation rate is: (Pitch=3072,Yaw=60000,Roll=2048) and may be configured in ini file in [GameBots2004.RemoteBot] DefaultRotationRate. (pitch - up/down, yaw - left/right, roll - equivalent of doing a cartwheel)
443
444 */
445 public Rotation getRotationRate()
446 {
447 return RotationRate;
448 }
449
450
451 /**
452 *
453 If bot is invulnerable (cannot die) or not.
454
455 */
456 protected
457 boolean Invulnerable =
458 false;
459
460
461 /**
462 * Whether property 'Invulnerable' was received from GB2004.
463 */
464 protected boolean Invulnerable_Set = false;
465
466 @Override
467
468 /**
469 *
470 If bot is invulnerable (cannot die) or not.
471
472 */
473 public boolean isInvulnerable()
474 {
475 return Invulnerable;
476 }
477
478
479 /**
480 *
481 The delay between two synchronous batches (can range from
482 0.1 to 2 seconds).
483
484 */
485 protected
486 double VisionTime =
487 0;
488
489
490 /**
491 * Whether property 'VisionTime' was received from GB2004.
492 */
493 protected boolean VisionTime_Set = false;
494
495 @Override
496
497 /**
498 *
499 The delay between two synchronous batches (can range from
500 0.1 to 2 seconds).
501
502 */
503 public double getVisionTime()
504 {
505 return VisionTime;
506 }
507
508
509 /**
510 *
511 If some additional debug information will be shown in the
512 UT2004 server console window.
513
514 */
515 protected
516 boolean ShowDebug =
517 false;
518
519
520 /**
521 * Whether property 'ShowDebug' was received from GB2004.
522 */
523 protected boolean ShowDebug_Set = false;
524
525 @Override
526
527 /**
528 *
529 If some additional debug information will be shown in the
530 UT2004 server console window.
531
532 */
533 public boolean isShowDebug()
534 {
535 return ShowDebug;
536 }
537
538
539 /**
540 *
541 If true an actor visualizing the location the bot is
542 actually looking at will appear in the game.
543
544 */
545 protected
546 boolean ShowFocalPoint =
547 false;
548
549
550 /**
551 * Whether property 'ShowFocalPoint' was received from GB2004.
552 */
553 protected boolean ShowFocalPoint_Set = false;
554
555 @Override
556
557 /**
558 *
559 If true an actor visualizing the location the bot is
560 actually looking at will appear in the game.
561
562 */
563 public boolean isShowFocalPoint()
564 {
565 return ShowFocalPoint;
566 }
567
568
569 /**
570 *
571 if the GB should draw lines representing the auto ray traces
572 of the bot (for more information see ATR message).
573
574 */
575 protected
576 boolean DrawTraceLines =
577 false;
578
579
580 /**
581 * Whether property 'DrawTraceLines' was received from GB2004.
582 */
583 protected boolean DrawTraceLines_Set = false;
584
585 @Override
586
587 /**
588 *
589 if the GB should draw lines representing the auto ray traces
590 of the bot (for more information see ATR message).
591
592 */
593 public boolean isDrawTraceLines()
594 {
595 return DrawTraceLines;
596 }
597
598
599 /**
600 *
601 It informs if sending of all GB synchronous messages is
602 enabled or disabled.
603
604 */
605 protected
606 boolean SynchronousOff =
607 false;
608
609
610 /**
611 * Whether property 'SynchronousOff' was received from GB2004.
612 */
613 protected boolean SynchronousOff_Set = false;
614
615 @Override
616
617 /**
618 *
619 It informs if sending of all GB synchronous messages is
620 enabled or disabled.
621
622 */
623 public boolean isSynchronousOff()
624 {
625 return SynchronousOff;
626 }
627
628
629 /**
630 *
631 It enables/disables automatic pickup of the bot. If true the items can be picked up through PICK command.
632
633 */
634 protected
635 boolean AutoPickupOff =
636 false;
637
638
639 /**
640 * Whether property 'AutoPickupOff' was received from GB2004.
641 */
642 protected boolean AutoPickupOff_Set = false;
643
644 @Override
645
646 /**
647 *
648 It enables/disables automatic pickup of the bot. If true the items can be picked up through PICK command.
649
650 */
651 public boolean isAutoPickupOff()
652 {
653 return AutoPickupOff;
654 }
655
656
657 /**
658 *
659 Name of current BDI action.
660
661 */
662 protected
663 String Action =
664 null;
665
666
667 /**
668 * Whether property 'Action' was received from GB2004.
669 */
670 protected boolean Action_Set = false;
671
672 @Override
673
674 /**
675 *
676 Name of current BDI action.
677
678 */
679 public String getAction()
680 {
681 return Action;
682 }
683
684
685 private ConfigChangeLocal localPart = null;
686
687 @Override
688 public ConfigChangeLocal
689 getLocal() {
690 if (localPart != null) return localPart;
691 return localPart = new
692 ConfigChangeLocalMessage();
693 }
694
695 private ConfigChangeShared sharedPart = null;
696
697 @Override
698 public ConfigChangeShared
699 getShared() {
700 if (sharedPart != null) return sharedPart;
701 return sharedPart = new
702 ConfigChangeSharedMessage();
703 }
704
705 private ConfigChangeStatic staticPart = null;
706
707 @Override
708 public ConfigChangeStatic
709 getStatic() {
710 if (staticPart != null) return staticPart;
711 return staticPart = new
712 ConfigChangeStaticMessage();
713 }
714
715 /**
716 *
717 Implementation of the local part of the GameBots2004 message CONFCH, used
718 to facade CONFCHMessage.
719
720 *
721 * <p></p><p></p>
722 * Complete message documentation:
723 *
724 Asynchronous message. Message sent when the bot configuration
725 changed - each agent has a lot of parameters affecting his state
726 in the environment. See each property for the details.
727
728 */
729 public class ConfigChangeLocalMessage
730 extends
731 ConfigChangeLocal
732 {
733
734 @Override
735 public
736 ConfigChangeLocalMessage clone() {
737 return this;
738 }
739
740 public ConfigChangeLocalMessage getLocal() {
741 return this;
742 }
743 public ISharedWorldObject getShared() {
744 throw new UnsupportedOperationException("Could not return LOCAL as SHARED");
745 }
746 public IStaticWorldObject getStatic() {
747 throw new UnsupportedOperationException("Could not return LOCAL as STATIC");
748 }
749
750 /**
751 * Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end.
752 */
753 public UnrealId getId()
754 {
755 return Id;
756 }
757
758 /**
759 * Unique Id of the bot.
760 */
761 public UnrealId getBotId()
762 {
763 return BotId;
764 }
765
766 /**
767 *
768 True if we have to spawn the bot manually after each death
769
770 */
771 public boolean isManualSpawn()
772 {
773 return ManualSpawn;
774 }
775
776 /**
777 *
778 True if the bot is using auto ray tracing (is provided with
779 synchronous ATR messages). See ATR messages for more
780 details.
781
782 */
783 public boolean isAutoTrace()
784 {
785 return AutoTrace;
786 }
787
788 /**
789 * The bot's name.
790 */
791 public String getName()
792 {
793 return Name;
794 }
795
796 /**
797 *
798 Bots default speed will be multiplied by this number. Ranges from 0.1 to 2 (default, can be set in ini in [GameBots2004.RemoteBot] MaxSpeed).
799
800 */
801 public double getSpeedMultiplier()
802 {
803 return SpeedMultiplier;
804 }
805
806 /**
807 *
808 Bot rotation rate. Default rotation rate is: (Pitch=3072,Yaw=60000,Roll=2048) and may be configured in ini file in [GameBots2004.RemoteBot] DefaultRotationRate. (pitch - up/down, yaw - left/right, roll - equivalent of doing a cartwheel)
809
810 */
811 public Rotation getRotationRate()
812 {
813 return RotationRate;
814 }
815
816 /**
817 *
818 If bot is invulnerable (cannot die) or not.
819
820 */
821 public boolean isInvulnerable()
822 {
823 return Invulnerable;
824 }
825
826 /**
827 *
828 The delay between two synchronous batches (can range from
829 0.1 to 2 seconds).
830
831 */
832 public double getVisionTime()
833 {
834 return VisionTime;
835 }
836
837 /**
838 *
839 If some additional debug information will be shown in the
840 UT2004 server console window.
841
842 */
843 public boolean isShowDebug()
844 {
845 return ShowDebug;
846 }
847
848 /**
849 *
850 If true an actor visualizing the location the bot is
851 actually looking at will appear in the game.
852
853 */
854 public boolean isShowFocalPoint()
855 {
856 return ShowFocalPoint;
857 }
858
859 /**
860 *
861 if the GB should draw lines representing the auto ray traces
862 of the bot (for more information see ATR message).
863
864 */
865 public boolean isDrawTraceLines()
866 {
867 return DrawTraceLines;
868 }
869
870 /**
871 *
872 It informs if sending of all GB synchronous messages is
873 enabled or disabled.
874
875 */
876 public boolean isSynchronousOff()
877 {
878 return SynchronousOff;
879 }
880
881 /**
882 *
883 It enables/disables automatic pickup of the bot. If true the items can be picked up through PICK command.
884
885 */
886 public boolean isAutoPickupOff()
887 {
888 return AutoPickupOff;
889 }
890
891 /**
892 *
893 Name of current BDI action.
894
895 */
896 public String getAction()
897 {
898 return Action;
899 }
900
901
902 public String toString() {
903 return
904 super.toString() + "[" +
905
906 "Id = " + String.valueOf(getId()
907 ) + " | " +
908
909 "BotId = " + String.valueOf(getBotId()
910 ) + " | " +
911
912 "ManualSpawn = " + String.valueOf(isManualSpawn()
913 ) + " | " +
914
915 "AutoTrace = " + String.valueOf(isAutoTrace()
916 ) + " | " +
917
918 "Name = " + String.valueOf(getName()
919 ) + " | " +
920
921 "SpeedMultiplier = " + String.valueOf(getSpeedMultiplier()
922 ) + " | " +
923
924 "RotationRate = " + String.valueOf(getRotationRate()
925 ) + " | " +
926
927 "Invulnerable = " + String.valueOf(isInvulnerable()
928 ) + " | " +
929
930 "VisionTime = " + String.valueOf(getVisionTime()
931 ) + " | " +
932
933 "ShowDebug = " + String.valueOf(isShowDebug()
934 ) + " | " +
935
936 "ShowFocalPoint = " + String.valueOf(isShowFocalPoint()
937 ) + " | " +
938
939 "DrawTraceLines = " + String.valueOf(isDrawTraceLines()
940 ) + " | " +
941
942 "SynchronousOff = " + String.valueOf(isSynchronousOff()
943 ) + " | " +
944
945 "AutoPickupOff = " + String.valueOf(isAutoPickupOff()
946 ) + " | " +
947
948 "Action = " + String.valueOf(getAction()
949 ) + " | " +
950
951 "]";
952 }
953
954
955 public String toHtmlString() {
956 return super.toString() + "[<br/>" +
957
958 "<b>Id</b> = " + String.valueOf(getId()
959 ) + " <br/> " +
960
961 "<b>BotId</b> = " + String.valueOf(getBotId()
962 ) + " <br/> " +
963
964 "<b>ManualSpawn</b> = " + String.valueOf(isManualSpawn()
965 ) + " <br/> " +
966
967 "<b>AutoTrace</b> = " + String.valueOf(isAutoTrace()
968 ) + " <br/> " +
969
970 "<b>Name</b> = " + String.valueOf(getName()
971 ) + " <br/> " +
972
973 "<b>SpeedMultiplier</b> = " + String.valueOf(getSpeedMultiplier()
974 ) + " <br/> " +
975
976 "<b>RotationRate</b> = " + String.valueOf(getRotationRate()
977 ) + " <br/> " +
978
979 "<b>Invulnerable</b> = " + String.valueOf(isInvulnerable()
980 ) + " <br/> " +
981
982 "<b>VisionTime</b> = " + String.valueOf(getVisionTime()
983 ) + " <br/> " +
984
985 "<b>ShowDebug</b> = " + String.valueOf(isShowDebug()
986 ) + " <br/> " +
987
988 "<b>ShowFocalPoint</b> = " + String.valueOf(isShowFocalPoint()
989 ) + " <br/> " +
990
991 "<b>DrawTraceLines</b> = " + String.valueOf(isDrawTraceLines()
992 ) + " <br/> " +
993
994 "<b>SynchronousOff</b> = " + String.valueOf(isSynchronousOff()
995 ) + " <br/> " +
996
997 "<b>AutoPickupOff</b> = " + String.valueOf(isAutoPickupOff()
998 ) + " <br/> " +
999
1000 "<b>Action</b> = " + String.valueOf(getAction()
1001 ) + " <br/> " +
1002
1003 "<br/>]";
1004 }
1005
1006
1007 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
1008
1009 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
1010
1011 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=local+classtype[@name=message]) ---
1012
1013 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=local+classtype[@name=message]) ---
1014
1015 }
1016
1017 /**
1018 *
1019 Implementation of the static part of the GameBots2004 message CONFCH, used
1020 to facade CONFCHMessage.
1021
1022 *
1023 * <p></p><p></p>
1024 * Complete message documentation:
1025 *
1026 Asynchronous message. Message sent when the bot configuration
1027 changed - each agent has a lot of parameters affecting his state
1028 in the environment. See each property for the details.
1029
1030 */
1031 public class ConfigChangeStaticMessage
1032 extends
1033 ConfigChangeStatic
1034 {
1035
1036 @Override
1037 public
1038 ConfigChangeStaticMessage clone() {
1039 return this;
1040 }
1041
1042 /**
1043 * Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end.
1044 */
1045 public UnrealId getId()
1046 {
1047 return Id;
1048 }
1049
1050
1051 @Override
1052 public boolean isDifferentFrom(IStaticWorldObject other)
1053 {
1054 if (other == null) //early fail
1055 {
1056 return true;
1057 }
1058 else if (other == this) //early out
1059 {
1060 return false;
1061 }
1062 else
1063 {
1064 ConfigChangeStatic obj = (ConfigChangeStatic) other;
1065
1066
1067 if ( !(
1068 AdvancedEquals.equalsOrNull(this.getId()
1069 , obj.getId()
1070 )
1071 ) )
1072 {
1073 System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class ConfigChangeStatic");
1074 return true;
1075 }
1076
1077 }
1078 return false;
1079 }
1080
1081
1082 public String toString() {
1083 return
1084 super.toString() + "[" +
1085
1086 "Id = " + String.valueOf(getId()
1087 ) + " | " +
1088
1089 "]";
1090 }
1091
1092
1093 public String toHtmlString() {
1094 return super.toString() + "[<br/>" +
1095
1096 "<b>Id</b> = " + String.valueOf(getId()
1097 ) + " <br/> " +
1098
1099 "<br/>]";
1100 }
1101
1102
1103 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
1104
1105 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
1106
1107 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=static+classtype[@name=message]) ---
1108
1109 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=static+classtype[@name=message]) ---
1110
1111 }
1112
1113 /**
1114 *
1115 Implementation of the shared part of the GameBots2004 message CONFCH, used
1116 to facade CONFCHMessage.
1117
1118 *
1119 * <p></p><p></p>
1120 * Complete message documentation:
1121 *
1122 Asynchronous message. Message sent when the bot configuration
1123 changed - each agent has a lot of parameters affecting his state
1124 in the environment. See each property for the details.
1125
1126 */
1127 public class ConfigChangeSharedMessage
1128 extends
1129 ConfigChangeShared
1130 {
1131
1132
1133
1134 public ConfigChangeSharedMessage()
1135 {
1136
1137 }
1138
1139 @Override
1140 public
1141 ConfigChangeSharedMessage clone() {
1142 return this;
1143 }
1144
1145
1146
1147
1148 protected HashMap<PropertyId, ISharedProperty> propertyMap = new HashMap<PropertyId, ISharedProperty>(
1149 0
1150 );
1151
1152 @Override
1153 public ISharedProperty getProperty(PropertyId id) {
1154 return propertyMap.get(id);
1155 }
1156
1157 @Override
1158 public Map<PropertyId, ISharedProperty> getProperties() {
1159 return propertyMap;
1160 }
1161
1162
1163
1164 /**
1165 * Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end.
1166 */
1167 public UnrealId getId()
1168 {
1169 return Id;
1170 }
1171
1172
1173 public String toString() {
1174 return
1175 super.toString() + "[" +
1176
1177 "Id = " + String.valueOf(getId()
1178 ) + " | " +
1179
1180 "]";
1181 }
1182
1183
1184 public String toHtmlString() {
1185 return super.toString() + "[<br/>" +
1186
1187 "<b>Id</b> = " + String.valueOf(getId()
1188 ) + " <br/> " +
1189
1190 "<br/>]";
1191 }
1192
1193
1194 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
1195
1196 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
1197
1198 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=message]) ---
1199
1200 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=shared+classtype[@name=message]) ---
1201
1202 }
1203
1204
1205
1206
1207 @Override
1208 public IWorldObjectUpdateResult<IWorldObject> update(IWorldObject object) {
1209 if (object == null)
1210 {
1211 return new IWorldObjectUpdateResult.WorldObjectUpdateResult(IWorldObjectUpdateResult.Result.CREATED, this);
1212 }
1213 if (!( object instanceof ConfigChangeMessage) ) {
1214 throw new PogamutException("Can't update different class than ConfigChangeMessage, got class " + object.getClass().getSimpleName() + "!", this);
1215 }
1216 ConfigChangeMessage toUpdate = (ConfigChangeMessage)object;
1217
1218 boolean updated = false;
1219
1220 // UPDATING LOCAL PROPERTIES
1221
1222 if (!SafeEquals.equals(toUpdate.BotId, getBotId()
1223 )) {
1224 toUpdate.BotId=getBotId()
1225 ;
1226 updated = true;
1227 }
1228
1229 if (toUpdate.ManualSpawn != isManualSpawn()
1230 ) {
1231 toUpdate.ManualSpawn=isManualSpawn()
1232 ;
1233 updated = true;
1234 }
1235
1236 if (toUpdate.AutoTrace != isAutoTrace()
1237 ) {
1238 toUpdate.AutoTrace=isAutoTrace()
1239 ;
1240 updated = true;
1241 }
1242
1243 if (!SafeEquals.equals(toUpdate.Name, getName()
1244 )) {
1245 toUpdate.Name=getName()
1246 ;
1247 updated = true;
1248 }
1249
1250 if (toUpdate.SpeedMultiplier != getSpeedMultiplier()
1251 ) {
1252 toUpdate.SpeedMultiplier=getSpeedMultiplier()
1253 ;
1254 updated = true;
1255 }
1256
1257 if (!SafeEquals.equals(toUpdate.RotationRate, getRotationRate()
1258 )) {
1259 toUpdate.RotationRate=getRotationRate()
1260 ;
1261 updated = true;
1262 }
1263
1264 if (toUpdate.Invulnerable != isInvulnerable()
1265 ) {
1266 toUpdate.Invulnerable=isInvulnerable()
1267 ;
1268 updated = true;
1269 }
1270
1271 if (toUpdate.VisionTime != getVisionTime()
1272 ) {
1273 toUpdate.VisionTime=getVisionTime()
1274 ;
1275 updated = true;
1276 }
1277
1278 if (toUpdate.ShowDebug != isShowDebug()
1279 ) {
1280 toUpdate.ShowDebug=isShowDebug()
1281 ;
1282 updated = true;
1283 }
1284
1285 if (toUpdate.ShowFocalPoint != isShowFocalPoint()
1286 ) {
1287 toUpdate.ShowFocalPoint=isShowFocalPoint()
1288 ;
1289 updated = true;
1290 }
1291
1292 if (toUpdate.DrawTraceLines != isDrawTraceLines()
1293 ) {
1294 toUpdate.DrawTraceLines=isDrawTraceLines()
1295 ;
1296 updated = true;
1297 }
1298
1299 if (toUpdate.SynchronousOff != isSynchronousOff()
1300 ) {
1301 toUpdate.SynchronousOff=isSynchronousOff()
1302 ;
1303 updated = true;
1304 }
1305
1306 if (toUpdate.AutoPickupOff != isAutoPickupOff()
1307 ) {
1308 toUpdate.AutoPickupOff=isAutoPickupOff()
1309 ;
1310 updated = true;
1311 }
1312
1313 if (!SafeEquals.equals(toUpdate.Action, getAction()
1314 )) {
1315 toUpdate.Action=getAction()
1316 ;
1317 updated = true;
1318 }
1319
1320
1321 // UPDATING SHARED PROPERTIES
1322
1323
1324 // UPDATE TIME
1325 toUpdate.SimTime = SimTime;
1326
1327 if (updated) {
1328 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IWorldObject>(IWorldObjectUpdateResult.Result.UPDATED, toUpdate);
1329 } else {
1330 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<IWorldObject>(IWorldObjectUpdateResult.Result.SAME, toUpdate);
1331 }
1332 }
1333
1334 @Override
1335 public ILocalWorldObjectUpdatedEvent getLocalEvent() {
1336 return new ConfigChangeLocalImpl.ConfigChangeLocalUpdate
1337 (this.getLocal(), SimTime);
1338 }
1339
1340 @Override
1341 public ISharedWorldObjectUpdatedEvent getSharedEvent() {
1342 return new ConfigChangeSharedImpl.ConfigChangeSharedUpdate
1343 (this.getShared(), SimTime, this.getTeamId());
1344 }
1345
1346 @Override
1347 public IStaticWorldObjectUpdatedEvent getStaticEvent() {
1348 return new ConfigChangeStaticImpl.ConfigChangeStaticUpdate
1349 (this.getStatic(), SimTime);
1350 }
1351
1352
1353 public String toString() {
1354 return
1355 super.toString() + "[" +
1356
1357 "Id = " + String.valueOf(getId()
1358 ) + " | " +
1359
1360 "BotId = " + String.valueOf(getBotId()
1361 ) + " | " +
1362
1363 "ManualSpawn = " + String.valueOf(isManualSpawn()
1364 ) + " | " +
1365
1366 "AutoTrace = " + String.valueOf(isAutoTrace()
1367 ) + " | " +
1368
1369 "Name = " + String.valueOf(getName()
1370 ) + " | " +
1371
1372 "SpeedMultiplier = " + String.valueOf(getSpeedMultiplier()
1373 ) + " | " +
1374
1375 "RotationRate = " + String.valueOf(getRotationRate()
1376 ) + " | " +
1377
1378 "Invulnerable = " + String.valueOf(isInvulnerable()
1379 ) + " | " +
1380
1381 "VisionTime = " + String.valueOf(getVisionTime()
1382 ) + " | " +
1383
1384 "ShowDebug = " + String.valueOf(isShowDebug()
1385 ) + " | " +
1386
1387 "ShowFocalPoint = " + String.valueOf(isShowFocalPoint()
1388 ) + " | " +
1389
1390 "DrawTraceLines = " + String.valueOf(isDrawTraceLines()
1391 ) + " | " +
1392
1393 "SynchronousOff = " + String.valueOf(isSynchronousOff()
1394 ) + " | " +
1395
1396 "AutoPickupOff = " + String.valueOf(isAutoPickupOff()
1397 ) + " | " +
1398
1399 "Action = " + String.valueOf(getAction()
1400 ) + " | " +
1401
1402 "]";
1403 }
1404
1405
1406 public String toHtmlString() {
1407 return super.toString() + "[<br/>" +
1408
1409 "<b>Id</b> = " + String.valueOf(getId()
1410 ) + " <br/> " +
1411
1412 "<b>BotId</b> = " + String.valueOf(getBotId()
1413 ) + " <br/> " +
1414
1415 "<b>ManualSpawn</b> = " + String.valueOf(isManualSpawn()
1416 ) + " <br/> " +
1417
1418 "<b>AutoTrace</b> = " + String.valueOf(isAutoTrace()
1419 ) + " <br/> " +
1420
1421 "<b>Name</b> = " + String.valueOf(getName()
1422 ) + " <br/> " +
1423
1424 "<b>SpeedMultiplier</b> = " + String.valueOf(getSpeedMultiplier()
1425 ) + " <br/> " +
1426
1427 "<b>RotationRate</b> = " + String.valueOf(getRotationRate()
1428 ) + " <br/> " +
1429
1430 "<b>Invulnerable</b> = " + String.valueOf(isInvulnerable()
1431 ) + " <br/> " +
1432
1433 "<b>VisionTime</b> = " + String.valueOf(getVisionTime()
1434 ) + " <br/> " +
1435
1436 "<b>ShowDebug</b> = " + String.valueOf(isShowDebug()
1437 ) + " <br/> " +
1438
1439 "<b>ShowFocalPoint</b> = " + String.valueOf(isShowFocalPoint()
1440 ) + " <br/> " +
1441
1442 "<b>DrawTraceLines</b> = " + String.valueOf(isDrawTraceLines()
1443 ) + " <br/> " +
1444
1445 "<b>SynchronousOff</b> = " + String.valueOf(isSynchronousOff()
1446 ) + " <br/> " +
1447
1448 "<b>AutoPickupOff</b> = " + String.valueOf(isAutoPickupOff()
1449 ) + " <br/> " +
1450
1451 "<b>Action</b> = " + String.valueOf(getAction()
1452 ) + " <br/> " +
1453
1454 "<br/>]";
1455 }
1456
1457
1458 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
1459
1460 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
1461
1462 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=base+classtype[@name=message]) ---
1463
1464 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=base+classtype[@name=message]) ---
1465
1466 }
1467