@@ -105,31 +105,31 @@ def __init__(self, frame, pid, data):
105105def create_command_event (frame , pid , data ):
106106 ability_type = data ['data' ][0 ]
107107 if ability_type == 'None' :
108- return AbilityEvent (frame , pid , data )
108+ return BasicCommandEvent (frame , pid , data )
109109
110110 elif ability_type == 'TargetUnit' :
111- return TargetAbilityEvent (frame , pid , data )
111+ return TargetUnitCommandEvent (frame , pid , data )
112112
113113 elif ability_type == 'TargetPoint' :
114- return LocationAbilityEvent (frame , pid , data )
114+ return TargetPointCommandEvent (frame , pid , data )
115115
116116 elif ability_type == 'Data' :
117- return SelfAbilityEvent (frame , pid , data )
117+ return DataCommandEvent (frame , pid , data )
118118
119119
120120@loggable
121- class AbilityEvent (GameEvent ):
121+ class CommandEvent (GameEvent ):
122122 """
123123 Ability events are generated when ever a player in the game issues a command
124124 to a unit or group of units. They are split into three subclasses of ability,
125125 each with their own set of associated data. The attributes listed below are
126126 shared across all ability event types.
127127
128- See :class:`LocationAbilityEvent `, :class:`TargetAbilityEvent `, and :class:`SelfAbilityEvent`
129- for individual details.
128+ See :class:`TargetPointCommandEvent `, :class:`TargetUnitCommandEvent `, and
129+ :class:`DataCommandEvent` for individual details.
130130 """
131131 def __init__ (self , frame , pid , data ):
132- super (AbilityEvent , self ).__init__ (frame , pid )
132+ super (CommandEvent , self ).__init__ (frame , pid )
133133
134134 #: Flags on the command???
135135 self .flags = data ['flags' ]
@@ -235,25 +235,38 @@ def __str__(self):
235235 return string
236236
237237
238- class LocationAbilityEvent ( AbilityEvent ):
238+ class BasicCommandEvent ( CommandEvent ):
239239 """
240- Extends :class:`AbilityEvent`
240+ Extends :class:`CommandEvent`
241+
242+ This event is recorded for events that have no extra information recorded.
243+
244+ Note that like all CommandEvents, the event will be recorded regardless
245+ of whether or not the command was successful.
246+ """
247+ def __init__ (self , frame , pid , data ):
248+ super (TargetPointCommandEvent , self ).__init__ (frame , pid , data )
249+
250+
251+ class TargetPointCommandEvent (CommandEvent ):
252+ """
253+ Extends :class:`CommandEvent`
241254
242255 This event is recorded when ever a player issues a command that targets a location
243256 and NOT a unit. Commands like Psistorm, Attack Move, Fungal Growth, and EMP fall
244257 under this category.
245258
246- Note that like all AbilityEvents , the event will be recorded regardless
259+ Note that like all CommandEvents , the event will be recorded regardless
247260 of whether or not the command was successful.
248261 """
249262 def __init__ (self , frame , pid , data ):
250- super (LocationAbilityEvent , self ).__init__ (frame , pid , data )
263+ super (TargetPointCommandEvent , self ).__init__ (frame , pid , data )
251264
252265 #: The x coordinate of the target. Available for TargetPoint and TargetUnit type events.
253- self .x = self .ability_type_data ['point' ].get ('x' , 0 )/ 4096.0
266+ self .x = self .ability_type_data ['point' ].get ('x' , 0 ) / 4096.0
254267
255268 #: The y coordinate of the target. Available for TargetPoint and TargetUnit type events.
256- self .y = self .ability_type_data ['point' ].get ('y' , 0 )/ 4096.0
269+ self .y = self .ability_type_data ['point' ].get ('y' , 0 ) / 4096.0
257270
258271 #: The z coordinate of the target. Available for TargetPoint and TargetUnit type events.
259272 self .z = self .ability_type_data ['point' ].get ('z' , 0 )
@@ -262,18 +275,19 @@ def __init__(self, frame, pid, data):
262275 self .location = (self .x , self .y , self .z )
263276
264277
265- class TargetAbilityEvent ( AbilityEvent ):
278+ class TargetUnitCommandEvent ( CommandEvent ):
266279 """
267- Extends :class:`AbilityEvent `
280+ Extends :class:`CommandEvent `
268281
269- TargetAbilityEvents are recorded when ever a player issues a command that targets a unit.
282+ This event is recorded when ever a player issues a command that targets a unit.
270283 The location of the target unit at the time of the command is also recorded. Commands like
271284 Chronoboost, Transfuse, and Snipe fall under this category.
272285
273- Note that all AbilityEvents are recorded regardless of whether or not the command was successful.
286+ Note that like all CommandEvents, the event will be recorded regardless
287+ of whether or not the command was successful.
274288 """
275289 def __init__ (self , frame , pid , data ):
276- super (TargetAbilityEvent , self ).__init__ (frame , pid , data )
290+ super (TargetUnitCommandEvent , self ).__init__ (frame , pid , data )
277291
278292 #: Flags set on the target unit. Available for TargetUnit type events
279293 self .target_flags = self .ability_type_data .get ('flags' , None )
@@ -301,10 +315,10 @@ def __init__(self, frame, pid, data):
301315 self .upkeep_player_id = self .ability_type_data .get ('upkeep_player_id' , None )
302316
303317 #: The x coordinate of the target. Available for TargetPoint and TargetUnit type events.
304- self .x = self .ability_type_data ['point' ].get ('x' , 0 )/ 4096.0
318+ self .x = self .ability_type_data ['point' ].get ('x' , 0 ) / 4096.0
305319
306320 #: The y coordinate of the target. Available for TargetPoint and TargetUnit type events.
307- self .y = self .ability_type_data ['point' ].get ('y' , 0 )/ 4096.0
321+ self .y = self .ability_type_data ['point' ].get ('y' , 0 ) / 4096.0
308322
309323 #: The z coordinate of the target. Available for TargetPoint and TargetUnit type events.
310324 self .z = self .ability_type_data ['point' ].get ('z' , 0 )
@@ -313,17 +327,18 @@ def __init__(self, frame, pid, data):
313327 self .location = (self .x , self .y , self .z )
314328
315329
316- class SelfAbilityEvent ( AbilityEvent ):
330+ class DataCommandEvent ( CommandEvent ):
317331 """
318- Extends :class:`AbilityEvent `
332+ Extends :class:`CommandEvent `
319333
320- SelfAbilityEvents are recorded when ever a player issues a command that has no target. Commands
334+ DataCommandEvent are recorded when ever a player issues a command that has no target. Commands
321335 like Burrow, SeigeMode, Train XYZ, and Stop fall under this category.
322336
323- Note that all AbilityEvents are recorded regardless of whether or not the command was successful.
337+ Note that like all CommandEvents, the event will be recorded regardless
338+ of whether or not the command was successful.
324339 """
325340 def __init__ (self , frame , pid , data ):
326- super (SelfAbilityEvent , self ).__init__ (frame , pid , data )
341+ super (DataCommandEvent , self ).__init__ (frame , pid , data )
327342
328343 #: Other target data. Available for Data type events.
329344 self .target_data = self .ability_type_data .get ('data' , None )
0 commit comments