@@ -702,21 +702,35 @@ def command_card(self, buffer, frames, type, code, pid, flag, atype):
702702
703703
704704class GameEventsReader_19595 (GameEventsReader_18574 ):
705- def location_move (self , buffer , frames , type , code , pid , flag , atype ):
705+ def command_card (self , buffer , frames , type , code , pid , flag , atype ):
706+ # Why only read 7 of the bits?
706707 ability = buffer .read_short (endian = BIG_ENDIAN )
707- ability = ability << 8 | buffer .read_byte ()
708+ ability = ability << 8 | buffer .shift (7 )
709+
708710 if ability & 0x20 :
709- buffer .read_hex (9 )
711+ # Can differ by up to (+/-1, +/-8) from sc2gears readings
712+ # See 18574 implementation for details
713+ x = buffer .read_short (BIG_ENDIAN )/ 256.0
714+ buffer .read (bits = 5 ) # we could do some creative addition here
715+ y = buffer .read_short (BIG_ENDIAN )/ 256.0
716+ buffer .shift (4 ) # we could do some creative addition here
717+ buffer .skip (4 )
718+ return LocationAbilityEvent (frames , pid , type , code , ability , (x ,y ))
719+
710720 elif ability & 0x40 :
711- # extra byte
712- buffer .read_hex (19 )
721+ # extra byte long
722+ buffer .read_short ()
723+ target = (buffer .read_int (BIG_ENDIAN ),buffer .read_short (BIG_ENDIAN ))
724+ buffer .skip (11 )
725+ return TargetAbilityEvent (frames , pid , type , code , ability , target )
726+
713727 else :
714728 pass
715729
716730 return UnknownLocationAbilityEvent (frames , pid , type , code , ability )
717731
718732 def right_click_target (self , buffer , frames , type , code , pid , flag , atype ):
719- # ability (2), object id (4), object type (2), ?? (10)
733+ # extra byte long
720734 ability = buffer .read_short (endian = BIG_ENDIAN )
721735 buffer .shift (1 ) # weird shift..
722736 target = (buffer .read_int (BIG_ENDIAN ), buffer .read_short (BIG_ENDIAN ))
0 commit comments