Example #1
0
def test_read_a():
    b = io.BytesIO(b"\x05aaax\x00?\x80\x00\x00TP\x06@")  # type: BinaryIO
    source = BinarySource(b)

    assert source.read_byte() == 5
    assert source.read_string() == "aaax"
    assert source.read_float() == 1
    source.skip(1)
    assert source.read_bool()
    assert source.read_short() == 1600
Example #2
0
def read_damage_reduction(source: BinarySource) -> Dict:
    return {
        "index": source.read_byte(),
        "multiplier": source.read_float(),
    }