@@ -105,31 +105,31 @@ def __init__(self, frame, pid, data):
105
105
def create_command_event (frame , pid , data ):
106
106
ability_type = data ['data' ][0 ]
107
107
if ability_type == 'None' :
108
- return AbilityEvent (frame , pid , data )
108
+ return BasicCommandEvent (frame , pid , data )
109
109
110
110
elif ability_type == 'TargetUnit' :
111
- return TargetAbilityEvent (frame , pid , data )
111
+ return TargetUnitCommandEvent (frame , pid , data )
112
112
113
113
elif ability_type == 'TargetPoint' :
114
- return LocationAbilityEvent (frame , pid , data )
114
+ return TargetPointCommandEvent (frame , pid , data )
115
115
116
116
elif ability_type == 'Data' :
117
- return SelfAbilityEvent (frame , pid , data )
117
+ return DataCommandEvent (frame , pid , data )
118
118
119
119
120
120
@loggable
121
- class AbilityEvent (GameEvent ):
121
+ class CommandEvent (GameEvent ):
122
122
"""
123
123
Ability events are generated when ever a player in the game issues a command
124
124
to a unit or group of units. They are split into three subclasses of ability,
125
125
each with their own set of associated data. The attributes listed below are
126
126
shared across all ability event types.
127
127
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.
130
130
"""
131
131
def __init__ (self , frame , pid , data ):
132
- super (AbilityEvent , self ).__init__ (frame , pid )
132
+ super (CommandEvent , self ).__init__ (frame , pid )
133
133
134
134
#: Flags on the command???
135
135
self .flags = data ['flags' ]
@@ -235,25 +235,38 @@ def __str__(self):
235
235
return string
236
236
237
237
238
- class LocationAbilityEvent ( AbilityEvent ):
238
+ class BasicCommandEvent ( CommandEvent ):
239
239
"""
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`
241
254
242
255
This event is recorded when ever a player issues a command that targets a location
243
256
and NOT a unit. Commands like Psistorm, Attack Move, Fungal Growth, and EMP fall
244
257
under this category.
245
258
246
- Note that like all AbilityEvents , the event will be recorded regardless
259
+ Note that like all CommandEvents , the event will be recorded regardless
247
260
of whether or not the command was successful.
248
261
"""
249
262
def __init__ (self , frame , pid , data ):
250
- super (LocationAbilityEvent , self ).__init__ (frame , pid , data )
263
+ super (TargetPointCommandEvent , self ).__init__ (frame , pid , data )
251
264
252
265
#: 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
254
267
255
268
#: 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
257
270
258
271
#: The z coordinate of the target. Available for TargetPoint and TargetUnit type events.
259
272
self .z = self .ability_type_data ['point' ].get ('z' , 0 )
@@ -262,18 +275,19 @@ def __init__(self, frame, pid, data):
262
275
self .location = (self .x , self .y , self .z )
263
276
264
277
265
- class TargetAbilityEvent ( AbilityEvent ):
278
+ class TargetUnitCommandEvent ( CommandEvent ):
266
279
"""
267
- Extends :class:`AbilityEvent `
280
+ Extends :class:`CommandEvent `
268
281
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.
270
283
The location of the target unit at the time of the command is also recorded. Commands like
271
284
Chronoboost, Transfuse, and Snipe fall under this category.
272
285
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.
274
288
"""
275
289
def __init__ (self , frame , pid , data ):
276
- super (TargetAbilityEvent , self ).__init__ (frame , pid , data )
290
+ super (TargetUnitCommandEvent , self ).__init__ (frame , pid , data )
277
291
278
292
#: Flags set on the target unit. Available for TargetUnit type events
279
293
self .target_flags = self .ability_type_data .get ('flags' , None )
@@ -301,10 +315,10 @@ def __init__(self, frame, pid, data):
301
315
self .upkeep_player_id = self .ability_type_data .get ('upkeep_player_id' , None )
302
316
303
317
#: 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
305
319
306
320
#: 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
308
322
309
323
#: The z coordinate of the target. Available for TargetPoint and TargetUnit type events.
310
324
self .z = self .ability_type_data ['point' ].get ('z' , 0 )
@@ -313,17 +327,18 @@ def __init__(self, frame, pid, data):
313
327
self .location = (self .x , self .y , self .z )
314
328
315
329
316
- class SelfAbilityEvent ( AbilityEvent ):
330
+ class DataCommandEvent ( CommandEvent ):
317
331
"""
318
- Extends :class:`AbilityEvent `
332
+ Extends :class:`CommandEvent `
319
333
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
321
335
like Burrow, SeigeMode, Train XYZ, and Stop fall under this category.
322
336
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.
324
339
"""
325
340
def __init__ (self , frame , pid , data ):
326
- super (SelfAbilityEvent , self ).__init__ (frame , pid , data )
341
+ super (DataCommandEvent , self ).__init__ (frame , pid , data )
327
342
328
343
#: Other target data. Available for Data type events.
329
344
self .target_data = self .ability_type_data .get ('data' , None )
0 commit comments