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 class InitedMessageLocalImpl
30 extends
31 InitedMessageLocal
32 {
33
34
35
36
37
38
39 public InitedMessageLocalImpl()
40 {
41 }
42
43
44
45
46
47
48 public InitedMessageLocalImpl(InitedMessage original) {
49
50 this.BotId = original.getBotId()
51 ;
52
53 this.HealthStart = original.getHealthStart()
54 ;
55
56 this.HealthFull = original.getHealthFull()
57 ;
58
59 this.HealthMax = original.getHealthMax()
60 ;
61
62 this.AdrenalineStart = original.getAdrenalineStart()
63 ;
64
65 this.AdrenalineMax = original.getAdrenalineMax()
66 ;
67
68 this.ShieldStrengthStart = original.getShieldStrengthStart()
69 ;
70
71 this.ShieldStrengthMax = original.getShieldStrengthMax()
72 ;
73
74 this.MaxMultiJump = original.getMaxMultiJump()
75 ;
76
77 this.DamageScaling = original.getDamageScaling()
78 ;
79
80 this.GroundSpeed = original.getGroundSpeed()
81 ;
82
83 this.WaterSpeed = original.getWaterSpeed()
84 ;
85
86 this.AirSpeed = original.getAirSpeed()
87 ;
88
89 this.LadderSpeed = original.getLadderSpeed()
90 ;
91
92 this.AccelRate = original.getAccelRate()
93 ;
94
95 this.JumpZ = original.getJumpZ()
96 ;
97
98 this.MultiJumpBoost = original.getMultiJumpBoost()
99 ;
100
101 this.MaxFallSpeed = original.getMaxFallSpeed()
102 ;
103
104 this.DodgeSpeedFactor = original.getDodgeSpeedFactor()
105 ;
106
107 this.DodgeSpeedZ = original.getDodgeSpeedZ()
108 ;
109
110 this.AirControl = original.getAirControl()
111 ;
112
113 this.SimTime = original.getSimTime();
114 }
115
116
117
118
119
120
121 public InitedMessageLocalImpl(InitedMessageLocalImpl original) {
122
123 this.BotId = original.getBotId()
124 ;
125
126 this.HealthStart = original.getHealthStart()
127 ;
128
129 this.HealthFull = original.getHealthFull()
130 ;
131
132 this.HealthMax = original.getHealthMax()
133 ;
134
135 this.AdrenalineStart = original.getAdrenalineStart()
136 ;
137
138 this.AdrenalineMax = original.getAdrenalineMax()
139 ;
140
141 this.ShieldStrengthStart = original.getShieldStrengthStart()
142 ;
143
144 this.ShieldStrengthMax = original.getShieldStrengthMax()
145 ;
146
147 this.MaxMultiJump = original.getMaxMultiJump()
148 ;
149
150 this.DamageScaling = original.getDamageScaling()
151 ;
152
153 this.GroundSpeed = original.getGroundSpeed()
154 ;
155
156 this.WaterSpeed = original.getWaterSpeed()
157 ;
158
159 this.AirSpeed = original.getAirSpeed()
160 ;
161
162 this.LadderSpeed = original.getLadderSpeed()
163 ;
164
165 this.AccelRate = original.getAccelRate()
166 ;
167
168 this.JumpZ = original.getJumpZ()
169 ;
170
171 this.MultiJumpBoost = original.getMultiJumpBoost()
172 ;
173
174 this.MaxFallSpeed = original.getMaxFallSpeed()
175 ;
176
177 this.DodgeSpeedFactor = original.getDodgeSpeedFactor()
178 ;
179
180 this.DodgeSpeedZ = original.getDodgeSpeedZ()
181 ;
182
183 this.AirControl = original.getAirControl()
184 ;
185
186 this.SimTime = original.getSimTime();
187 }
188
189
190
191
192
193
194 public InitedMessageLocalImpl(InitedMessageLocal original) {
195
196 this.BotId = original.getBotId()
197 ;
198
199 this.HealthStart = original.getHealthStart()
200 ;
201
202 this.HealthFull = original.getHealthFull()
203 ;
204
205 this.HealthMax = original.getHealthMax()
206 ;
207
208 this.AdrenalineStart = original.getAdrenalineStart()
209 ;
210
211 this.AdrenalineMax = original.getAdrenalineMax()
212 ;
213
214 this.ShieldStrengthStart = original.getShieldStrengthStart()
215 ;
216
217 this.ShieldStrengthMax = original.getShieldStrengthMax()
218 ;
219
220 this.MaxMultiJump = original.getMaxMultiJump()
221 ;
222
223 this.DamageScaling = original.getDamageScaling()
224 ;
225
226 this.GroundSpeed = original.getGroundSpeed()
227 ;
228
229 this.WaterSpeed = original.getWaterSpeed()
230 ;
231
232 this.AirSpeed = original.getAirSpeed()
233 ;
234
235 this.LadderSpeed = original.getLadderSpeed()
236 ;
237
238 this.AccelRate = original.getAccelRate()
239 ;
240
241 this.JumpZ = original.getJumpZ()
242 ;
243
244 this.MultiJumpBoost = original.getMultiJumpBoost()
245 ;
246
247 this.MaxFallSpeed = original.getMaxFallSpeed()
248 ;
249
250 this.DodgeSpeedFactor = original.getDodgeSpeedFactor()
251 ;
252
253 this.DodgeSpeedZ = original.getDodgeSpeedZ()
254 ;
255
256 this.AirControl = original.getAirControl()
257 ;
258
259 }
260
261
262 public UnrealId getId() {
263 return cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage.InitedMessageId;
264 }
265
266
267 @Override
268 public void setSimTime(long SimTime) {
269 super.setSimTime(SimTime);
270 }
271
272 @Override
273 public
274 InitedMessageLocalImpl clone() {
275 return new
276 InitedMessageLocalImpl(this);
277 }
278
279
280
281
282
283
284
285
286 protected
287 UnrealId BotId =
288 null;
289
290
291
292
293
294
295 public UnrealId getBotId()
296 {
297 return BotId;
298 }
299
300
301
302
303
304
305
306 protected
307 int HealthStart =
308 0;
309
310
311
312
313
314
315 public int getHealthStart()
316 {
317 return HealthStart;
318 }
319
320
321
322
323
324
325
326 protected
327 int HealthFull =
328 0;
329
330
331
332
333
334
335 public int getHealthFull()
336 {
337 return HealthFull;
338 }
339
340
341
342
343
344
345
346 protected
347 int HealthMax =
348 0;
349
350
351
352
353
354
355 public int getHealthMax()
356 {
357 return HealthMax;
358 }
359
360
361
362
363
364
365
366 protected
367 double AdrenalineStart =
368 0;
369
370
371
372
373
374
375 public double getAdrenalineStart()
376 {
377 return AdrenalineStart;
378 }
379
380
381
382
383
384
385
386 protected
387 double AdrenalineMax =
388 0;
389
390
391
392
393
394
395 public double getAdrenalineMax()
396 {
397 return AdrenalineMax;
398 }
399
400
401
402
403
404
405
406 protected
407 int ShieldStrengthStart =
408 0;
409
410
411
412
413
414
415 public int getShieldStrengthStart()
416 {
417 return ShieldStrengthStart;
418 }
419
420
421
422
423
424
425
426 protected
427 int ShieldStrengthMax =
428 0;
429
430
431
432
433
434
435 public int getShieldStrengthMax()
436 {
437 return ShieldStrengthMax;
438 }
439
440
441
442
443
444
445
446 protected
447 int MaxMultiJump =
448 0;
449
450
451
452
453
454
455 public int getMaxMultiJump()
456 {
457 return MaxMultiJump;
458 }
459
460
461
462
463
464
465
466 protected
467 double DamageScaling =
468 0;
469
470
471
472
473
474
475 public double getDamageScaling()
476 {
477 return DamageScaling;
478 }
479
480
481
482
483
484
485
486 protected
487 double GroundSpeed =
488 0;
489
490
491
492
493
494
495 public double getGroundSpeed()
496 {
497 return GroundSpeed;
498 }
499
500
501
502
503
504
505
506 protected
507 double WaterSpeed =
508 0;
509
510
511
512
513
514
515 public double getWaterSpeed()
516 {
517 return WaterSpeed;
518 }
519
520
521
522
523
524
525
526 protected
527 double AirSpeed =
528 0;
529
530
531
532
533
534
535 public double getAirSpeed()
536 {
537 return AirSpeed;
538 }
539
540
541
542
543
544
545
546 protected
547 double LadderSpeed =
548 0;
549
550
551
552
553
554
555 public double getLadderSpeed()
556 {
557 return LadderSpeed;
558 }
559
560
561
562
563
564
565
566 protected
567 double AccelRate =
568 0;
569
570
571
572
573
574
575 public double getAccelRate()
576 {
577 return AccelRate;
578 }
579
580
581
582
583
584
585
586 protected
587 double JumpZ =
588 0;
589
590
591
592
593
594
595 public double getJumpZ()
596 {
597 return JumpZ;
598 }
599
600
601
602
603
604
605
606 protected
607 double MultiJumpBoost =
608 0;
609
610
611
612
613
614
615 public double getMultiJumpBoost()
616 {
617 return MultiJumpBoost;
618 }
619
620
621
622
623
624
625
626 protected
627 double MaxFallSpeed =
628 0;
629
630
631
632
633
634
635 public double getMaxFallSpeed()
636 {
637 return MaxFallSpeed;
638 }
639
640
641
642
643
644
645
646 protected
647 double DodgeSpeedFactor =
648 0;
649
650
651
652
653
654
655 public double getDodgeSpeedFactor()
656 {
657 return DodgeSpeedFactor;
658 }
659
660
661
662
663
664
665
666 protected
667 double DodgeSpeedZ =
668 0;
669
670
671
672
673
674
675 public double getDodgeSpeedZ()
676 {
677 return DodgeSpeedZ;
678 }
679
680
681
682
683
684
685
686 protected
687 double AirControl =
688 0;
689
690
691
692
693
694
695 public double getAirControl()
696 {
697 return AirControl;
698 }
699
700
701
702
703
704 public InitedMessageLocalImpl getLocal() {
705 return this;
706 }
707 public ISharedWorldObject getShared() {
708 throw new UnsupportedOperationException("Could not return LOCAL as SHARED");
709 }
710 public IStaticWorldObject getStatic() {
711 throw new UnsupportedOperationException("Could not return LOCAL as STATIC");
712 }
713
714 public static class InitedMessageLocalUpdate
715 implements ILocalWorldObjectUpdatedEvent, IGBWorldObjectEvent
716 {
717 protected long time;
718
719 protected InitedMessageLocal data = null;
720
721 public InitedMessageLocalUpdate
722 (InitedMessageLocal moverLocal, long time)
723 {
724 this.data = moverLocal;
725 this.time = time;
726 }
727
728 @Override
729 public IWorldObjectUpdateResult<ILocalWorldObject> update(
730 ILocalWorldObject object)
731 {
732 if ( object == null)
733 {
734 data = new InitedMessageLocalImpl(data);
735 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.CREATED, data);
736 }
737 if ( object instanceof InitedMessageLocalImpl )
738 {
739 InitedMessageLocalImpl toUpdate = (InitedMessageLocalImpl)object;
740
741 boolean updated = false;
742
743
744
745 if (!SafeEquals.equals(toUpdate.BotId, data.getBotId()
746 )) {
747 toUpdate.BotId=data.getBotId()
748 ;
749 updated = true;
750 }
751
752 if (toUpdate.HealthStart != data.getHealthStart()
753 ) {
754 toUpdate.HealthStart=data.getHealthStart()
755 ;
756 updated = true;
757 }
758
759 if (toUpdate.HealthFull != data.getHealthFull()
760 ) {
761 toUpdate.HealthFull=data.getHealthFull()
762 ;
763 updated = true;
764 }
765
766 if (toUpdate.HealthMax != data.getHealthMax()
767 ) {
768 toUpdate.HealthMax=data.getHealthMax()
769 ;
770 updated = true;
771 }
772
773 if (toUpdate.AdrenalineStart != data.getAdrenalineStart()
774 ) {
775 toUpdate.AdrenalineStart=data.getAdrenalineStart()
776 ;
777 updated = true;
778 }
779
780 if (toUpdate.AdrenalineMax != data.getAdrenalineMax()
781 ) {
782 toUpdate.AdrenalineMax=data.getAdrenalineMax()
783 ;
784 updated = true;
785 }
786
787 if (toUpdate.ShieldStrengthStart != data.getShieldStrengthStart()
788 ) {
789 toUpdate.ShieldStrengthStart=data.getShieldStrengthStart()
790 ;
791 updated = true;
792 }
793
794 if (toUpdate.ShieldStrengthMax != data.getShieldStrengthMax()
795 ) {
796 toUpdate.ShieldStrengthMax=data.getShieldStrengthMax()
797 ;
798 updated = true;
799 }
800
801 if (toUpdate.MaxMultiJump != data.getMaxMultiJump()
802 ) {
803 toUpdate.MaxMultiJump=data.getMaxMultiJump()
804 ;
805 updated = true;
806 }
807
808 if (toUpdate.DamageScaling != data.getDamageScaling()
809 ) {
810 toUpdate.DamageScaling=data.getDamageScaling()
811 ;
812 updated = true;
813 }
814
815 if (toUpdate.GroundSpeed != data.getGroundSpeed()
816 ) {
817 toUpdate.GroundSpeed=data.getGroundSpeed()
818 ;
819 updated = true;
820 }
821
822 if (toUpdate.WaterSpeed != data.getWaterSpeed()
823 ) {
824 toUpdate.WaterSpeed=data.getWaterSpeed()
825 ;
826 updated = true;
827 }
828
829 if (toUpdate.AirSpeed != data.getAirSpeed()
830 ) {
831 toUpdate.AirSpeed=data.getAirSpeed()
832 ;
833 updated = true;
834 }
835
836 if (toUpdate.LadderSpeed != data.getLadderSpeed()
837 ) {
838 toUpdate.LadderSpeed=data.getLadderSpeed()
839 ;
840 updated = true;
841 }
842
843 if (toUpdate.AccelRate != data.getAccelRate()
844 ) {
845 toUpdate.AccelRate=data.getAccelRate()
846 ;
847 updated = true;
848 }
849
850 if (toUpdate.JumpZ != data.getJumpZ()
851 ) {
852 toUpdate.JumpZ=data.getJumpZ()
853 ;
854 updated = true;
855 }
856
857 if (toUpdate.MultiJumpBoost != data.getMultiJumpBoost()
858 ) {
859 toUpdate.MultiJumpBoost=data.getMultiJumpBoost()
860 ;
861 updated = true;
862 }
863
864 if (toUpdate.MaxFallSpeed != data.getMaxFallSpeed()
865 ) {
866 toUpdate.MaxFallSpeed=data.getMaxFallSpeed()
867 ;
868 updated = true;
869 }
870
871 if (toUpdate.DodgeSpeedFactor != data.getDodgeSpeedFactor()
872 ) {
873 toUpdate.DodgeSpeedFactor=data.getDodgeSpeedFactor()
874 ;
875 updated = true;
876 }
877
878 if (toUpdate.DodgeSpeedZ != data.getDodgeSpeedZ()
879 ) {
880 toUpdate.DodgeSpeedZ=data.getDodgeSpeedZ()
881 ;
882 updated = true;
883 }
884
885 if (toUpdate.AirControl != data.getAirControl()
886 ) {
887 toUpdate.AirControl=data.getAirControl()
888 ;
889 updated = true;
890 }
891
892
893 data = toUpdate;
894
895 if ( updated )
896 {
897 toUpdate.SimTime = this.time;
898 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.UPDATED, data);
899 }
900
901 return new IWorldObjectUpdateResult.WorldObjectUpdateResult<ILocalWorldObject>(IWorldObjectUpdateResult.Result.SAME, data);
902 }
903 throw new PogamutException("Unsupported object type for update. Expected InitedMessageLocalImpl for object " + object.getId() +", not object of class " + object.getClass().getSimpleName() + ".", this);
904 }
905
906
907
908
909 @Override
910 public long getSimTime() {
911 return this.time;
912 }
913
914 @Override
915 public IWorldObject getObject() {
916 return data;
917 }
918
919 @Override
920 public WorldObjectId getId() {
921 return data.getId();
922 }
923
924 }
925
926
927 public String toString() {
928 return
929 super.toString() + "[" +
930
931 "BotId = " + String.valueOf(getBotId()
932 ) + " | " +
933
934 "HealthStart = " + String.valueOf(getHealthStart()
935 ) + " | " +
936
937 "HealthFull = " + String.valueOf(getHealthFull()
938 ) + " | " +
939
940 "HealthMax = " + String.valueOf(getHealthMax()
941 ) + " | " +
942
943 "AdrenalineStart = " + String.valueOf(getAdrenalineStart()
944 ) + " | " +
945
946 "AdrenalineMax = " + String.valueOf(getAdrenalineMax()
947 ) + " | " +
948
949 "ShieldStrengthStart = " + String.valueOf(getShieldStrengthStart()
950 ) + " | " +
951
952 "ShieldStrengthMax = " + String.valueOf(getShieldStrengthMax()
953 ) + " | " +
954
955 "MaxMultiJump = " + String.valueOf(getMaxMultiJump()
956 ) + " | " +
957
958 "DamageScaling = " + String.valueOf(getDamageScaling()
959 ) + " | " +
960
961 "GroundSpeed = " + String.valueOf(getGroundSpeed()
962 ) + " | " +
963
964 "WaterSpeed = " + String.valueOf(getWaterSpeed()
965 ) + " | " +
966
967 "AirSpeed = " + String.valueOf(getAirSpeed()
968 ) + " | " +
969
970 "LadderSpeed = " + String.valueOf(getLadderSpeed()
971 ) + " | " +
972
973 "AccelRate = " + String.valueOf(getAccelRate()
974 ) + " | " +
975
976 "JumpZ = " + String.valueOf(getJumpZ()
977 ) + " | " +
978
979 "MultiJumpBoost = " + String.valueOf(getMultiJumpBoost()
980 ) + " | " +
981
982 "MaxFallSpeed = " + String.valueOf(getMaxFallSpeed()
983 ) + " | " +
984
985 "DodgeSpeedFactor = " + String.valueOf(getDodgeSpeedFactor()
986 ) + " | " +
987
988 "DodgeSpeedZ = " + String.valueOf(getDodgeSpeedZ()
989 ) + " | " +
990
991 "AirControl = " + String.valueOf(getAirControl()
992 ) + " | " +
993
994 "]";
995 }
996
997
998 public String toHtmlString() {
999 return super.toString() + "[<br/>" +
1000
1001 "<b>BotId</b> = " + String.valueOf(getBotId()
1002 ) + " <br/> " +
1003
1004 "<b>HealthStart</b> = " + String.valueOf(getHealthStart()
1005 ) + " <br/> " +
1006
1007 "<b>HealthFull</b> = " + String.valueOf(getHealthFull()
1008 ) + " <br/> " +
1009
1010 "<b>HealthMax</b> = " + String.valueOf(getHealthMax()
1011 ) + " <br/> " +
1012
1013 "<b>AdrenalineStart</b> = " + String.valueOf(getAdrenalineStart()
1014 ) + " <br/> " +
1015
1016 "<b>AdrenalineMax</b> = " + String.valueOf(getAdrenalineMax()
1017 ) + " <br/> " +
1018
1019 "<b>ShieldStrengthStart</b> = " + String.valueOf(getShieldStrengthStart()
1020 ) + " <br/> " +
1021
1022 "<b>ShieldStrengthMax</b> = " + String.valueOf(getShieldStrengthMax()
1023 ) + " <br/> " +
1024
1025 "<b>MaxMultiJump</b> = " + String.valueOf(getMaxMultiJump()
1026 ) + " <br/> " +
1027
1028 "<b>DamageScaling</b> = " + String.valueOf(getDamageScaling()
1029 ) + " <br/> " +
1030
1031 "<b>GroundSpeed</b> = " + String.valueOf(getGroundSpeed()
1032 ) + " <br/> " +
1033
1034 "<b>WaterSpeed</b> = " + String.valueOf(getWaterSpeed()
1035 ) + " <br/> " +
1036
1037 "<b>AirSpeed</b> = " + String.valueOf(getAirSpeed()
1038 ) + " <br/> " +
1039
1040 "<b>LadderSpeed</b> = " + String.valueOf(getLadderSpeed()
1041 ) + " <br/> " +
1042
1043 "<b>AccelRate</b> = " + String.valueOf(getAccelRate()
1044 ) + " <br/> " +
1045
1046 "<b>JumpZ</b> = " + String.valueOf(getJumpZ()
1047 ) + " <br/> " +
1048
1049 "<b>MultiJumpBoost</b> = " + String.valueOf(getMultiJumpBoost()
1050 ) + " <br/> " +
1051
1052 "<b>MaxFallSpeed</b> = " + String.valueOf(getMaxFallSpeed()
1053 ) + " <br/> " +
1054
1055 "<b>DodgeSpeedFactor</b> = " + String.valueOf(getDodgeSpeedFactor()
1056 ) + " <br/> " +
1057
1058 "<b>DodgeSpeedZ</b> = " + String.valueOf(getDodgeSpeedZ()
1059 ) + " <br/> " +
1060
1061 "<b>AirControl</b> = " + String.valueOf(getAirControl()
1062 ) + " <br/> " +
1063
1064 "<br/>]";
1065 }
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076 }
1077