コード例 #1
0
def command_create_unit(
        reader: ReplayReader) -> Dict[str, Union[int, str, TYPE_VECTOR]]:
    army_index = reader.read_byte()
    blueprint_id = reader.read_string()
    x, y, heading = _read_vector(reader)
    return {
        "type": "create_unit",
        "army_index": army_index,
        "blueprint_id": blueprint_id,
        "vector": (x, y, heading)
    }
コード例 #2
0
def command_debug_command(
    reader: ReplayReader
) -> Dict[str, Union[str, TYPE_VECTOR, int, TYPE_ENTITY_IDS_SET]]:
    debug_command = reader.read_string()
    vector = _read_vector(reader)
    focus_army_index = reader.read_byte()
    unit_ids = _parse_entity_ids_set(reader)
    return {
        "type": "debug_command",
        "debug_command": debug_command,
        "vector": vector,
        "focus_army_index": focus_army_index,
        "entity_ids_set": unit_ids
    }
コード例 #3
0
def command_lua_sim_callback(
        reader: ReplayReader) -> Dict[str, Union[str, TYPE_LUA, bytes]]:
    lua_name = reader.read_string()
    lua = reader.read_lua()
    size = None
    data = None
    if lua:
        size = reader.read_int()
        data = reader.read(4 * size)
    else:
        data = reader.read(4 + 3)

    return {
        "type": "lua_sim_callback",
        "lua_name": lua_name,
        "lua": lua,
        "size": size,
        "data": data
    }
コード例 #4
0
def command_execute_lua_in_sim(reader: ReplayReader) -> Dict[str, str]:
    return {"type": "execute_lua_in_sim", "lua": reader.read_string()}