コード例 #1
0
ファイル: actions.py プロジェクト: happyleavesaoc/aoc-mgz
    "player_id"/Byte
)

build = "build"/Struct(
    "selected"/Byte,
    "player_id"/Int16ul,
    "x"/Float32l,
    "y"/Float32l,
    "building_type"/Int32ul,
    Padding(4),
    "sprite_id"/Int32ul,
    Array(lambda ctx: ctx.selected, "unit_ids"/Int32ul)
)

game = "game"/Struct(
    "mode"/GameActionModeEnum("mode_id"/Byte),
    "player_id"/Byte,
    Padding(1),
    "diplomacy"/If(this.mode == 'diplomacy', Struct(
        "target_player_id"/Byte,
        Padding(3),
        "stance_float"/Float32l,
        "stance"/DiplomacyStanceEnum("stance_id"/Byte),
    )),
    "speed"/If(this.mode == 'speed', Struct(
        Padding(4),
        "speed"/Float32l,
        Padding(1)
    )),
    "instant_build"/If(this.mode == 'instant_build', Struct(
        Padding(9)
コード例 #2
0
ファイル: actions.py プロジェクト: philipp94831/aoc-mgz
    Array(lambda ctx: ctx.selected, "unit_ids" / Int32ul))

save = "save" / Struct("exited" / Flag, "player_id" / Byte,
                       "filename" / CString(encoding='latin1'),
                       Padding(lambda ctx: ctx._._.length - 23),
                       "checksum" / Int32ul)

chapter = "chapter" / Struct("player_id" / Byte)

build = "build" / Struct(
    "selected" / Byte, "player_id" / Int16ul, "x" / Float32l, "y" / Float32l,
    UnitAdapter("building_type" / Int32ul), Padding(4), "sprite_id" / Int32ul,
    Array(lambda ctx: ctx.selected, "unit_ids" / Int32ul))

game = "game" / Struct(
    "mode" / GameActionModeEnum("mode_id" / Byte), "player_id" / Byte,
    Padding(1), "diplomacy" / If(
        this.mode == 'diplomacy',
        Struct(
            "target_player_id" / Byte,
            Padding(3),
            "stance_float" / Float32l,
            "stance" / DiplomacyStanceEnum("stance_id" / Byte),
        )), "speed" / If(this.mode == 'speed',
                         Struct(Padding(4), "speed" / Float32l, Padding(1))),
    "instant_build" / If(this.mode == 'instant_build', Struct(Padding(9))),
    "quick_build" /
    If(this.mode == 'quick_build', Struct(
        "status" / Flag,
        Padding(8),
    )), "allied_victory" /