Skip to content

Commit 1c730ab

Browse files
committed
Parse out the ability for 'location move' events.
These events are probably misnamed with this new knowledge and should be renamed once its better understood what they represent.
1 parent a8e804f commit 1c730ab

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

sc2reader/parsers.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,16 @@ def command_card(self, buffer, frames, type, code, pid, flag, atype):
160160
return AbilityEvent(frames,pid,type,code,ability)
161161

162162
def location_move(self, buffer, frames, type, code, pid, flag, atype):
163-
h = buffer.read_hex(2)
164-
hinge = buffer.read_byte()
165-
if hinge & 0x20:
166-
"\t%s - %s" % (hex(hinge),buffer.read_hex(9))
167-
elif hinge & 0x40:
168-
"\t%s - %s" % (hex(hinge),buffer.read_hex(18))
169-
elif hinge < 0x10:
170-
pass
163+
ability = buffer.read_short()
164+
ability = ability << 8 | buffer.read_byte()
165+
if ability & 0x20:
166+
buffer.read_hex(9)
167+
elif ability & 0x40:
168+
buffer.read_hex(18)
171169
else:
172170
pass
173171

174-
return UnknownLocationAbilityEvent(frames, pid, type, code, None)
172+
return UnknownLocationAbilityEvent(frames, pid, type, code, ability)
175173

176174
def right_click_target(self, buffer, frames, type, code, pid, flag, atype):
177175
# ability (2), object id (4), object type (2), ?? (10)
@@ -225,20 +223,19 @@ def parse_ability_event(self, buffer, frames, type, code, pid):
225223
raise ParseError()
226224

227225
class ActionParser_19595(ActionParser_18574):
226+
228227
def location_move(self, buffer, frames, type, code, pid, flag, atype):
229-
h = buffer.read_hex(2)
230-
hinge = buffer.read_byte()
231-
if hinge & 0x20:
232-
"\t%s - %s" % (hex(hinge),buffer.read_hex(9))
233-
elif hinge & 0x40:
228+
ability = buffer.read_short()
229+
ability = ability << 8 | buffer.read_byte()
230+
if ability & 0x20:
231+
buffer.read_hex(9)
232+
elif ability & 0x40:
234233
# extra byte
235-
"\t%s - %s" % (hex(hinge),buffer.read_hex(19))
236-
elif hinge < 0x10:
237-
pass
234+
buffer.read_hex(19)
238235
else:
239236
pass
240237

241-
return UnknownLocationAbilityEvent(frames, pid, type, code, None)
238+
return UnknownLocationAbilityEvent(frames, pid, type, code, ability)
242239

243240
def right_click_target(self, buffer, frames, type, code, pid, flag, atype):
244241
# ability (2), object id (4), object type (2), ?? (10)

0 commit comments

Comments
 (0)