Skip to content

Commit 687cae2

Browse files
committed
Improvements to 16561 command card parsing.
1 parent 508ab22 commit 687cae2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

sc2reader/readers.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -558,19 +558,18 @@ def command_card(self, buffer, frames, type, code, pid, flag, atype):
558558
ability = ability << 8 | ability_flags
559559

560560
if ability_flags & 0x10:
561-
# ability(3), coordinates (4), ?? (4)
562-
location = buffer.read_coordinate()
563-
buffer.skip(4)
564-
return LocationAbilityEvent(frames, pid, type, code, ability, location)
561+
x = buffer.read_short(BIG_ENDIAN)/256.0
562+
buffer.read(bits=5) # what is this for?
563+
y = buffer.read_short(BIG_ENDIAN)/256.0
564+
buffer.read(bits=5) # I'll just assume we should do it again
565+
buffer.read_hex(4)
566+
return LocationAbilityEvent(frames, pid, type, code, ability, (x,y))
565567

566568
elif ability_flags & 0x20:
567569
# ability(3), object id (4), object type (2), ?? (10)
568570
code = buffer.read_short() # code??
569-
obj_id = buffer.read_object_id()
570-
obj_type = buffer.read_object_type()
571-
target = (obj_id, obj_type,)
572-
switch = buffer.read_byte()
573-
buffer.read_hex(9)
571+
target = (buffer.read_object_id(), buffer.read_object_type())
572+
buffer.read_hex(10)
574573
return TargetAbilityEvent(frames, pid, type, code, ability, target)
575574

576575
else:

0 commit comments

Comments
 (0)