示例#1
0
def command_set_command_type(
        reader: ReplayReader) -> Dict[str, Union[str, int]]:
    return {
        "type": "set_command_type",
        "command_id": reader.read_uint(),
        "target_id": reader.read_int()
    }
示例#2
0
def command_warp_entity(
        reader: ReplayReader) -> Dict[str, Union[str, TYPE_VECTOR]]:
    return {
        "type": "warp_entity",
        "entity_id": reader.read_int(),
        "vector": _read_vector(reader)
    }
示例#3
0
def command_command_count_decrease(
        reader: ReplayReader) -> Dict[str, Union[str, int]]:
    return {
        "type": "command_count_decrease",
        "command_id": reader.read_uint(),
        "delta": reader.read_int()
    }
示例#4
0
def _parse_command_data(reader: ReplayReader) -> TYPE_COMMAND_DATA:
    command_id = reader.read_int()
    arg1 = reader.read(4)
    command_type = reader.read_byte()
    arg2 = reader.read(4)

    target = _parse_target(reader)

    arg3 = reader.read(1)
    formation = _parse_formation(reader)

    blueprint_id = reader.read_string()

    arg4 = reader.read(12)
    arg5 = None
    cells = reader.read_lua()
    if cells:
        arg5 = reader.read(1)

    return {
        "command_id": command_id,
        "command_type": command_type,
        "target": target,
        "formation": formation,
        "blueprint_id": blueprint_id,
        "cells": cells,
        "arg1": arg1,
        "arg2": arg2,
        "arg3": arg3,
        "arg4": arg4,
        "arg5": arg5
    }
示例#5
0
def _parse_formation(reader: ReplayReader) -> TYPE_FORMATION:
    formation = reader.read_int()
    if formation != -1:
        w = reader.read_float()
        position = _read_vector(reader)
        scale = reader.read_float()
        return {"w": w, "position": position, "scale": scale}
    return None
示例#6
0
def _parse_target(reader: ReplayReader) -> TYPE_TARGET:
    target = reader.read_byte()
    entity_id = None
    position = None
    if target == TargetType.Entity:
        entity_id = reader.read_int()
    elif target == TargetType.Position:
        position = _read_vector(reader)
    return {"target": target, "entity_id": entity_id, "position": position}
示例#7
0
def command_process_info_pair(
        reader: ReplayReader) -> Dict[str, Union[int, str]]:
    entity_id = reader.read_int()
    arg1 = reader.read_string()
    arg2 = reader.read_string()
    return {
        "type": "process_info_pair",
        "entity_id": entity_id,
        "arg1": arg1,
        "arg2": arg2
    }
示例#8
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
    }
示例#9
0
def command_destroy_entity(reader: ReplayReader) -> Dict[str, int]:
    return {"type": "destroy_entity", "entity_id": reader.read_int()}
示例#10
0
def command_remove_from_queue(reader: ReplayReader) -> Dict[str, int]:
    return {
        "type": "remove_from_queue",
        "command_id": reader.read_uint(),
        "unit_id": reader.read_int()
    }