View Javadoc

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. Message sent when the bot configuration
35  		changed - each agent has a lot of parameters affecting his state
36  		in the environment. See each property for the details.
37  	
38                            Corresponding GameBots message is
39                            CONFCH.
40                        
41               */
42              
43              public class
44              ConfigChange
45                      extends GBObjectUpdate
46                  
47  	            	implements IGBWorldObjectEvent, IWorldObject
48  
49              {
50              
51              /**
52                Creates new instance of command ConfigChange.
53                
54  		Asynchronous message. Message sent when the bot configuration
55  		changed - each agent has a lot of parameters affecting his state
56  		in the environment. See each property for the details.
57  	Corresponding GameBots message for this command is
58                .
59                    @param Id Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end.
60                    @param BotId Unique Id of the bot.
61                    @param ManualSpawn 
62  			True if we have to spawn the bot manually after each death
63  		
64                    @param AutoTrace 
65  			True if the bot is using auto ray tracing (is provided with
66  			synchronous ATR messages). See ATR messages for more
67  			details.
68  		
69                    @param Name The bot's name.
70                    @param SpeedMultiplier 
71  			Bots default speed will be multiplied by this number. Ranges from 0.1 to 2 (default, can be set in ini in [GameBotsUDK.RemoteBot] MaxSpeed).
72  		
73                    @param RotationRate 
74  			Bot rotation rate. Default rotation rate is: (Pitch=3072,Yaw=60000,Roll=2048) and may be configured in ini file in [GameBotsUDK.RemoteBot] DefaultRotationRate. (pitch - up/down, yaw - left/right, roll - equivalent of doing a cartwheel)
75  		
76                    @param Invulnerable 
77  			If bot is invulnerable (cannot die) or not.
78  		
79                    @param VisionTime 
80  			The delay between two synchronous batches (can range from
81  			0.1 to 2 seconds).
82  		
83                    @param ShowDebug 
84  			If some additional debug information will be shown in the
85  			UDK server console window.
86  		
87                    @param ShowFocalPoint 
88  			If true an actor visualizing the location the bot is
89  			actually looking at will appear in the game.
90  		
91                    @param DrawTraceLines 
92  			if the GB should draw lines representing the auto ray traces
93  			of the bot (for more information see ATR message).
94  		
95                    @param SynchronousOff 
96  			It informs if sending of all GB synchronous messages is
97  			enabled or disabled.
98  		
99                    @param AutoPickupOff 
100 			It enables/disables automatic pickup of the bot. If true the items can be picked up through PICK command.
101 		
102                   @param Action 
103 			Name of current BDI action.
104 		
105               */
106              public ConfigChange(
107                 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) {
108                     
109                     this.Id = Id;
110                 
111                     this.BotId = BotId;
112                 
113                     this.ManualSpawn = ManualSpawn;
114                 
115                     this.AutoTrace = AutoTrace;
116                 
117                     this.Name = Name;
118                 
119                     this.SpeedMultiplier = SpeedMultiplier;
120                 
121                     this.RotationRate = RotationRate;
122                 
123                     this.Invulnerable = Invulnerable;
124                 
125                     this.VisionTime = VisionTime;
126                 
127                     this.ShowDebug = ShowDebug;
128                 
129                     this.ShowFocalPoint = ShowFocalPoint;
130                 
131                     this.DrawTraceLines = DrawTraceLines;
132                 
133                     this.SynchronousOff = SynchronousOff;
134                 
135                     this.AutoPickupOff = AutoPickupOff;
136                 
137                     this.Action = Action;
138                 
139                 }
140 
141             
142     	/** Example how the message looks like - used during parser tests. */
143     	public static final String PROTOTYPE =
144     		"CONFCH {Id unreal_id} {BotId unreal_id} {ManualSpawn False} {AutoTrace False} {Name text} {SpeedMultiplier 0} {RotationRate 0,0,0} {Invulnerable False} {VisionTime 0} {ShowDebug False} {ShowFocalPoint False} {DrawTraceLines False} {SynchronousOff False} {AutoPickupOff False} {Action text}";
145     
146 
147             /////// Properties BEGIN
148             
149         /**
150         Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end. */
151         protected
152          UnrealId Id =
153         	null;
154 
155         
156         /**
157         Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end. */
158         public
159         UnrealId getId() {
160             return
161          Id;
162         }
163         
164 
165         
166         /**
167         Unique Id of the bot. */
168         protected
169          UnrealId BotId =
170         	null;
171 
172         
173         /**
174         Unique Id of the bot. */
175         public
176         UnrealId getBotId() {
177             return
178          BotId;
179         }
180         
181 
182         
183         /**
184         
185 			True if we have to spawn the bot manually after each death
186 		 */
187         protected
188          boolean ManualSpawn =
189         	false;
190 
191         
192         /**
193         
194 			True if we have to spawn the bot manually after each death
195 		 */
196         public
197         boolean isManualSpawn() {
198             return
199          ManualSpawn;
200         }
201         
202 
203         
204         /**
205         
206 			True if the bot is using auto ray tracing (is provided with
207 			synchronous ATR messages). See ATR messages for more
208 			details.
209 		 */
210         protected
211          boolean AutoTrace =
212         	false;
213 
214         
215         /**
216         
217 			True if the bot is using auto ray tracing (is provided with
218 			synchronous ATR messages). See ATR messages for more
219 			details.
220 		 */
221         public
222         boolean isAutoTrace() {
223             return
224          AutoTrace;
225         }
226         
227 
228         
229         /**
230         The bot's name. */
231         protected
232          String Name =
233         	null;
234 
235         
236         /**
237         The bot's name. */
238         public
239         String getName() {
240             return
241          Name;
242         }
243         
244 
245         
246         /**
247         
248 			Bots default speed will be multiplied by this number. Ranges from 0.1 to 2 (default, can be set in ini in [GameBotsUDK.RemoteBot] MaxSpeed).
249 		 */
250         protected
251          double SpeedMultiplier =
252         	0;
253 
254         
255         /**
256         
257 			Bots default speed will be multiplied by this number. Ranges from 0.1 to 2 (default, can be set in ini in [GameBotsUDK.RemoteBot] MaxSpeed).
258 		 */
259         public
260         double getSpeedMultiplier() {
261             return
262          SpeedMultiplier;
263         }
264         
265 
266         
267         /**
268         
269 			Bot rotation rate. Default rotation rate is: (Pitch=3072,Yaw=60000,Roll=2048) and may be configured in ini file in [GameBotsUDK.RemoteBot] DefaultRotationRate. (pitch - up/down, yaw - left/right, roll - equivalent of doing a cartwheel)
270 		 */
271         protected
272          Rotation RotationRate =
273         	null;
274 
275         
276         /**
277         
278 			Bot rotation rate. Default rotation rate is: (Pitch=3072,Yaw=60000,Roll=2048) and may be configured in ini file in [GameBotsUDK.RemoteBot] DefaultRotationRate. (pitch - up/down, yaw - left/right, roll - equivalent of doing a cartwheel)
279 		 */
280         public
281         Rotation getRotationRate() {
282             return
283          RotationRate;
284         }
285         
286 
287         
288         /**
289         
290 			If bot is invulnerable (cannot die) or not.
291 		 */
292         protected
293          boolean Invulnerable =
294         	false;
295 
296         
297         /**
298         
299 			If bot is invulnerable (cannot die) or not.
300 		 */
301         public
302         boolean isInvulnerable() {
303             return
304          Invulnerable;
305         }
306         
307 
308         
309         /**
310         
311 			The delay between two synchronous batches (can range from
312 			0.1 to 2 seconds).
313 		 */
314         protected
315          double VisionTime =
316         	0;
317 
318         
319         /**
320         
321 			The delay between two synchronous batches (can range from
322 			0.1 to 2 seconds).
323 		 */
324         public
325         double getVisionTime() {
326             return
327          VisionTime;
328         }
329         
330 
331         
332         /**
333         
334 			If some additional debug information will be shown in the
335 			UDK server console window.
336 		 */
337         protected
338          boolean ShowDebug =
339         	false;
340 
341         
342         /**
343         
344 			If some additional debug information will be shown in the
345 			UDK server console window.
346 		 */
347         public
348         boolean isShowDebug() {
349             return
350          ShowDebug;
351         }
352         
353 
354         
355         /**
356         
357 			If true an actor visualizing the location the bot is
358 			actually looking at will appear in the game.
359 		 */
360         protected
361          boolean ShowFocalPoint =
362         	false;
363 
364         
365         /**
366         
367 			If true an actor visualizing the location the bot is
368 			actually looking at will appear in the game.
369 		 */
370         public
371         boolean isShowFocalPoint() {
372             return
373          ShowFocalPoint;
374         }
375         
376 
377         
378         /**
379         
380 			if the GB should draw lines representing the auto ray traces
381 			of the bot (for more information see ATR message).
382 		 */
383         protected
384          boolean DrawTraceLines =
385         	false;
386 
387         
388         /**
389         
390 			if the GB should draw lines representing the auto ray traces
391 			of the bot (for more information see ATR message).
392 		 */
393         public
394         boolean isDrawTraceLines() {
395             return
396          DrawTraceLines;
397         }
398         
399 
400         
401         /**
402         
403 			It informs if sending of all GB synchronous messages is
404 			enabled or disabled.
405 		 */
406         protected
407          boolean SynchronousOff =
408         	false;
409 
410         
411         /**
412         
413 			It informs if sending of all GB synchronous messages is
414 			enabled or disabled.
415 		 */
416         public
417         boolean isSynchronousOff() {
418             return
419          SynchronousOff;
420         }
421         
422 
423         
424         /**
425         
426 			It enables/disables automatic pickup of the bot. If true the items can be picked up through PICK command.
427 		 */
428         protected
429          boolean AutoPickupOff =
430         	false;
431 
432         
433         /**
434         
435 			It enables/disables automatic pickup of the bot. If true the items can be picked up through PICK command.
436 		 */
437         public
438         boolean isAutoPickupOff() {
439             return
440          AutoPickupOff;
441         }
442         
443 
444         
445         /**
446         
447 			Name of current BDI action.
448 		 */
449         protected
450          String Action =
451         	null;
452 
453         
454         /**
455         
456 			Name of current BDI action.
457 		 */
458         public
459         String getAction() {
460             return
461          Action;
462         }
463         
464 
465         
466             /////// Properties END
467 
468             /////// Extra Java code BEGIN
469 
470             	/////// Additional code from xslt BEGIN
471             		
472        							protected double Time = 0;
473 
474        							protected double getTime() {
475        								return Time;
476        							}
477 
478        							protected void setTime(double time) {
479        								this.Time = time;
480        							}
481 
482        							public double getLastSeenTime() {
483        								return Time;
484        							}
485        						
486        					
487        					public ILocalWorldObject getLocal() {
488        						return null;
489        					}
490        					
491        					public ISharedWorldObject getShared() {
492        						return null;
493        					}
494        					
495        					public IStaticWorldObject getStatic() {
496        						return null;
497        					}
498        					
499        					@Override
500        					public long getSimTime() {
501        						return (long)getLastSeenTime();
502        					}
503 
504        					public boolean equals(Object obj) {
505 	                      if (!(obj instanceof ConfigChange)) return false;
506 	                      ConfigChange cast = (ConfigChange)obj;
507 	                      if (this.getId() != null) return this.getId().equals(cast.getId());
508 	                      else return cast.getId() == null;
509 	                    }
510 
511 	                    public int hashCode() {
512 	                      if (getId() != null) return getId().hashCode();
513 	                      return 0;
514 	                    }
515 
516             		
517 
518 
519             	/////// Additional code from xslt END
520 
521 	            /////// Extra Java from XML BEGIN
522             		
523             	/////// Extra Java from XML END
524 
525             /////// Extra Java code END
526 
527             
528 
529             /**
530               * Cloning constructor.
531               */
532              public ConfigChange(ConfigChange original) {
533                 
534                      this.Id=original.Id;
535                 
536                      this.BotId=original.BotId;
537                 
538                      this.ManualSpawn=original.ManualSpawn;
539                 
540                      this.AutoTrace=original.AutoTrace;
541                 
542                      this.Name=original.Name;
543                 
544                      this.SpeedMultiplier=original.SpeedMultiplier;
545                 
546                      this.RotationRate=original.RotationRate;
547                 
548                      this.Invulnerable=original.Invulnerable;
549                 
550                      this.VisionTime=original.VisionTime;
551                 
552                      this.ShowDebug=original.ShowDebug;
553                 
554                      this.ShowFocalPoint=original.ShowFocalPoint;
555                 
556                      this.DrawTraceLines=original.DrawTraceLines;
557                 
558                      this.SynchronousOff=original.SynchronousOff;
559                 
560                      this.AutoPickupOff=original.AutoPickupOff;
561                 
562                      this.Action=original.Action;
563                 
564              }
565 
566              
567                  /**
568                   * Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
569                   */
570 	             public ConfigChange() {
571 	             }
572              
573 
574 	    		/**
575 	    		 * Here we save the original object for which this object is an update.
576 	    		 */
577 	    		private IWorldObject orig = null;
578 
579 	            public IWorldObjectUpdateResult update(IWorldObject obj) {
580 		            if(obj == null) {
581 		               orig = this;
582 		               return new IWorldObjectUpdateResult.WorldObjectUpdateResult(cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result.CREATED, this);
583 		            }
584 		            orig = obj;
585 		            // typecast
586 		            ConfigChange  o = (ConfigChange)obj;
587 
588 		            boolean updated = false;
589 
590 		            
591 		    					if (o.ManualSpawn != ManualSpawn) {
592 		    					    o.ManualSpawn=ManualSpawn;
593 		    						updated = true;
594 		    					}
595 		    				
596 		    					if (o.AutoTrace != AutoTrace) {
597 		    					    o.AutoTrace=AutoTrace;
598 		    						updated = true;
599 		    					}
600 		    				
601 		    					if (!SafeEquals.equals(o.Name, Name)) {
602 		    						o.Name=Name;
603 		    						updated = true;
604 		    					}
605 		    				
606 		    					if (o.SpeedMultiplier != SpeedMultiplier) {
607 		    					    o.SpeedMultiplier=SpeedMultiplier;
608 		    						updated = true;
609 		    					}
610 		    				
611                                 if (!SafeEquals.equals(o.RotationRate, RotationRate)) {
612 		    						o.RotationRate=RotationRate;
613 		    						updated = true;
614 		    					}
615                             
616 		    					if (o.Invulnerable != Invulnerable) {
617 		    					    o.Invulnerable=Invulnerable;
618 		    						updated = true;
619 		    					}
620 		    				
621 		    					if (o.VisionTime != VisionTime) {
622 		    					    o.VisionTime=VisionTime;
623 		    						updated = true;
624 		    					}
625 		    				
626 		    					if (o.ShowDebug != ShowDebug) {
627 		    					    o.ShowDebug=ShowDebug;
628 		    						updated = true;
629 		    					}
630 		    				
631 		    					if (o.ShowFocalPoint != ShowFocalPoint) {
632 		    					    o.ShowFocalPoint=ShowFocalPoint;
633 		    						updated = true;
634 		    					}
635 		    				
636 		    					if (o.DrawTraceLines != DrawTraceLines) {
637 		    					    o.DrawTraceLines=DrawTraceLines;
638 		    						updated = true;
639 		    					}
640 		    				
641 		    					if (o.SynchronousOff != SynchronousOff) {
642 		    					    o.SynchronousOff=SynchronousOff;
643 		    						updated = true;
644 		    					}
645 		    				
646 		    					if (o.AutoPickupOff != AutoPickupOff) {
647 		    					    o.AutoPickupOff=AutoPickupOff;
648 		    						updated = true;
649 		    					}
650 		    				
651 		    					if (!SafeEquals.equals(o.Action, Action)) {
652 		    						o.Action=Action;
653 		    						updated = true;
654 		    					}
655 		    				
656 								o.Time = Time;
657 							
658 
659 		            if (updated) {
660 		                return new IWorldObjectUpdateResult.WorldObjectUpdateResult(cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result.UPDATED, o);
661 		            } else {
662 		            	return new IWorldObjectUpdateResult.WorldObjectUpdateResult(cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result.SAME, o);
663 		            }
664 		        }
665 
666 	            /**
667 	             * Returns original object (if method update() has already been called, for bot-programmer that is always true
668 	             * as the original object is updated and then the event is propagated).
669 	             */
670 		        public IWorldObject getObject() {
671 		            if (orig == null) return this;
672 		            return orig;
673 		        }
674 	        
675 
676                  
677             public String toString() {
678                 return
679                 
680                 		super.toString() + " | " +
681                 		
682 				               "Id = " +
683 				               String.valueOf(Id) + " | " +
684 				            
685 				               "BotId = " +
686 				               String.valueOf(BotId) + " | " +
687 				            
688 				               "ManualSpawn = " +
689 				               String.valueOf(ManualSpawn) + " | " +
690 				            
691 				               "AutoTrace = " +
692 				               String.valueOf(AutoTrace) + " | " +
693 				            
694 				               "Name = " +
695 				               String.valueOf(Name) + " | " +
696 				            
697 				               "SpeedMultiplier = " +
698 				               String.valueOf(SpeedMultiplier) + " | " +
699 				            
700 				               "RotationRate = " +
701 				               String.valueOf(RotationRate) + " | " +
702 				            
703 				               "Invulnerable = " +
704 				               String.valueOf(Invulnerable) + " | " +
705 				            
706 				               "VisionTime = " +
707 				               String.valueOf(VisionTime) + " | " +
708 				            
709 				               "ShowDebug = " +
710 				               String.valueOf(ShowDebug) + " | " +
711 				            
712 				               "ShowFocalPoint = " +
713 				               String.valueOf(ShowFocalPoint) + " | " +
714 				            
715 				               "DrawTraceLines = " +
716 				               String.valueOf(DrawTraceLines) + " | " +
717 				            
718 				               "SynchronousOff = " +
719 				               String.valueOf(SynchronousOff) + " | " +
720 				            
721 				               "AutoPickupOff = " +
722 				               String.valueOf(AutoPickupOff) + " | " +
723 				            
724 				               "Action = " +
725 				               String.valueOf(Action) + " | " +
726 				             "";
727                 	
728              }
729 
730              public String toHtmlString() {
731                 return super.toString() +
732             
733             "<b>Id</b> : " +
734             String.valueOf(Id) +
735             " <br/> " +
736             
737             "<b>BotId</b> : " +
738             String.valueOf(BotId) +
739             " <br/> " +
740             
741             "<b>ManualSpawn</b> : " +
742             String.valueOf(ManualSpawn) +
743             " <br/> " +
744             
745             "<b>AutoTrace</b> : " +
746             String.valueOf(AutoTrace) +
747             " <br/> " +
748             
749             "<b>Name</b> : " +
750             String.valueOf(Name) +
751             " <br/> " +
752             
753             "<b>SpeedMultiplier</b> : " +
754             String.valueOf(SpeedMultiplier) +
755             " <br/> " +
756             
757             "<b>RotationRate</b> : " +
758             String.valueOf(RotationRate) +
759             " <br/> " +
760             
761             "<b>Invulnerable</b> : " +
762             String.valueOf(Invulnerable) +
763             " <br/> " +
764             
765             "<b>VisionTime</b> : " +
766             String.valueOf(VisionTime) +
767             " <br/> " +
768             
769             "<b>ShowDebug</b> : " +
770             String.valueOf(ShowDebug) +
771             " <br/> " +
772             
773             "<b>ShowFocalPoint</b> : " +
774             String.valueOf(ShowFocalPoint) +
775             " <br/> " +
776             
777             "<b>DrawTraceLines</b> : " +
778             String.valueOf(DrawTraceLines) +
779             " <br/> " +
780             
781             "<b>SynchronousOff</b> : " +
782             String.valueOf(SynchronousOff) +
783             " <br/> " +
784             
785             "<b>AutoPickupOff</b> : " +
786             String.valueOf(AutoPickupOff) +
787             " <br/> " +
788             
789             "<b>Action</b> : " +
790             String.valueOf(Action) +
791             " <br/> " +
792              "";
793              }
794 
795              
796              
797              }
798 
799