{"version":3,"sources":["../../src/types/game.ts"],"sourcesContent":["import { type BagType, Engine, type KickTable } from \"../engine\";\n\nexport namespace Game {\n  /** Handling config interface (test on TETR.IO for limits) */\n  export interface Handling {\n    arr: number;\n    das: number;\n    dcd: number;\n    sdf: number;\n    safelock: boolean;\n    cancel: boolean;\n    may20g: boolean;\n    irs: \"off\" | \"hold\" | \"tap\";\n    ihs: \"off\" | \"hold\" | \"tap\";\n  }\n\n  /** Game config preset */\n  export type Preset =\n    | \"default\"\n    | \"tetra league\"\n    | \"tetra league (season 1)\"\n    | \"enforced delays\"\n    | \"4wide\"\n    | \"100 battle royale\"\n    | \"classic\"\n    | \"arcade\"\n    | \"bombs\"\n    | \"quickplay\";\n\n  /** Way the garbage enters the board. `continuous` and `delayed` not yet supported */\n  export type GarbageEntry = \"instant\" | \"continuous\" | \"delayed\";\n  /** When garbage enters the board. only `combo blocking` is currently supported */\n  export type GarbageBlocking = \"combo blocking\" | \"limited blocking\" | \"none\";\n  /** Garbage target bonus not yet supported. Used in royale mode */\n  export type GarbageTargetBonus = \"offensive\" | \"defensive\" | \"none\";\n  /** Only `zero` passthrough supported */\n  export type Passthrough = \"zero\" | \"limited\" | \"consistent\" | \"full\";\n  /** Only `T-spins` supported */\n  export type SpinBonuses =\n    | \"T-spins\"\n    | \"T-spins+\"\n    | \"all\"\n    | \"all+\"\n    | \"all-mini\"\n    | \"all-mini+\"\n    | \"mini-only\"\n    | \"handheld\"\n    | \"stupid\"\n    | \"none\";\n  /** Whether decimal garbage is rounded down or weighted RNG rounding */\n  export type RoundingMode = \"down\" | \"rng\";\n  /** Only `multiplier` is currently supported */\n  export type ComboTable =\n    | \"none\"\n    | \"multiplier\"\n    | \"classic guideline\"\n    | \"modern guideline\";\n  /** Only `versus` supported. Client will run in `practice` but undoing is not yet implemented. */\n  export type GameMode = \"versus\" | \"royale\" | \"practice\";\n\n  /** Topout: Player tops themself out. Garbage smash: Player received garbage that causes them to top out. Winner: Player wins (does not die) */\n  export type GameOverReason = \"topout\" | \"garbagesmash\" | \"winner\";\n\n  export interface Options {\n    version: number;\n    seed_random: boolean;\n    seed: number;\n    g: number;\n    stock: number;\n    countdown: boolean;\n    countdown_count: number;\n    countdown_interval: number;\n    precountdown: number;\n    prestart: number;\n    mission: string;\n    mission_type: string;\n    zoominto: string;\n    slot_counter1: string;\n    slot_counter2: string;\n    slot_counter3: string;\n    slot_counter5: string;\n    slot_bar1: string;\n    display_fire: boolean;\n    display_username: boolean;\n    hasgarbage: boolean;\n    bgmnoreset: boolean;\n    neverstopbgm: boolean;\n    display_next: boolean;\n    display_hold: boolean;\n    infinite_hold: boolean;\n    gmargin: number;\n    gincrease: number;\n    garbagemultiplier: number;\n    garbagemargin: number;\n    garbageincrease: number;\n    garbagecap: number;\n    garbagecapincrease: number;\n    garbagecapmargin: number;\n    garbagecapmax: number;\n    garbageabsolutecap: boolean;\n    garbageholesize: number;\n    garbagephase: number;\n    garbagequeue: boolean;\n    garbageare: number;\n    garbageentry: GarbageEntry;\n    garbageblocking: GarbageBlocking;\n    garbagetargetbonus: GarbageTargetBonus;\n    garbagespecialbonus: boolean;\n    presets: Preset;\n    bagtype: BagType;\n    spinbonuses: SpinBonuses;\n    combotable: ComboTable;\n    kickset: KickTable;\n    nextcount: number;\n    allow_harddrop: boolean;\n    display_shadow: boolean;\n    locktime: number;\n    garbagespeed: number;\n    forfeit_time: number;\n    are: number;\n    lineclear_are: number;\n    infinitemovement: boolean;\n    lockresets: number;\n    allow180: boolean;\n    objective: {\n      type: string;\n    };\n    room_handling: boolean;\n    room_handling_arr: number;\n    room_handling_das: number;\n    room_handling_sdf: number;\n    manual_allowed: boolean;\n    b2bchaining: boolean;\n    allclears: boolean;\n    clutch: boolean;\n    nolockout: boolean;\n    passthrough: Passthrough;\n    can_undo: boolean;\n    can_retry: boolean;\n    retryisclear: boolean;\n    noextrawidth: boolean;\n    stride: boolean;\n    boardwidth: number;\n    boardheight: number;\n    new_payback: boolean;\n    messiness_change: number;\n    messiness_inner: number;\n    messiness_nosame: boolean;\n    messiness_timeout: number;\n  }\n\n  export interface ReadyOptions {\n    version: number;\n    seed: number;\n    seed_random: boolean;\n    are: number;\n    lineclear_are: number;\n    g: number;\n    gincrease: number;\n    gmargin: number;\n    gravitymay20g: boolean;\n    shielded: boolean;\n    hasgarbage: boolean;\n    usebombs: boolean;\n    garbagespeed: number;\n    garbagefavor: number;\n    garbagemultiplier: number;\n    receivemultiplier: number;\n    garbagemargin: number;\n    garbageincrease: number;\n    garbageholesize: number;\n    garbagephase: number;\n    garbagequeue: boolean;\n    garbageentry: GarbageEntry;\n    garbageare: number;\n    garbagecap: number;\n    garbagecapincrease: number;\n    garbagecapmargin: number;\n    garbagecapmax: number;\n    garbageabsolutecap: number;\n    garbageattackcap: number;\n    garbagetargetbonus: GarbageTargetBonus;\n    garbageblocking: GarbageBlocking;\n    garbagespecialbonus: boolean;\n    passthrough: Passthrough;\n    openerphase: number;\n    roundmode: RoundingMode;\n    spinbonuses: SpinBonuses;\n    combotable: ComboTable;\n    kickset: KickTable;\n    bagtype: BagType;\n    messiness_change: number;\n    messiness_inner: number;\n    messiness_center?: boolean;\n    messiness_nosame: boolean;\n    messiness_timeout: number;\n    b2bchaining: boolean;\n    b2bcharging: boolean;\n    b2bextras: boolean;\n    b2bcharge_at: number;\n    b2bcharge_base: number;\n    allclears: boolean;\n    allclear_garbage: number;\n    allclear_b2b: number;\n    allclear_b2b_sends: boolean;\n    allclear_b2b_dupes: boolean;\n    allclear_charges: boolean;\n    allow_harddrop: boolean;\n    allow180: boolean;\n    infinite_hold: boolean;\n    infinite_movement: boolean;\n    nextcount: number;\n    clutch: boolean;\n    no_szo: boolean;\n    nolockout: boolean;\n    manual_allowed: boolean;\n    new_payback: boolean;\n    can_undo: boolean;\n    boardwidth: number;\n    boardheight: number;\n    boardbuffer: number;\n    stock: number;\n    infinite_stock: boolean;\n    locktime: number;\n    lockresets: number;\n    prestart: number;\n    precountdown: number;\n    countdown: boolean;\n    countdown_count: number;\n    countdown_interval: number;\n    inverted: boolean;\n    mission: string;\n    mission_type: string;\n    no_mission_sound: boolean;\n    objective_type: string;\n    objective_count: number;\n    objective_time: number;\n    objective_result: string;\n    zoominto: string;\n    noextrawidth: boolean;\n    stride: boolean;\n    pro: boolean;\n    pro_alert: boolean;\n    pro_retry: boolean;\n    can_retry: boolean;\n    slot_counter1: string;\n    slot_counter2: string;\n    slot_counter3: string;\n    slot_counter4: string;\n    slot_counter5: string;\n    slot_bar1: string;\n    slot_bar2: string;\n    absolute_lines: boolean;\n    display_zen: boolean;\n    display_username: boolean;\n    display_fire: boolean;\n    display_replay: boolean;\n    display_next: boolean;\n    display_hold: boolean;\n    display_shadow: boolean;\n    levels: boolean;\n    masterlevels: boolean;\n    startinglevel: number;\n    levelspeed: number;\n    levelstatic: boolean;\n    levelstaticspeed: number;\n    levelgbase: number;\n    levelgspeed: number;\n    minoskin: {\n      z: string;\n      l: string;\n      o: string;\n      s: string;\n      i: string;\n      j: string;\n      t: string;\n      other: string;\n      ghost: string;\n    };\n    boardskin: string;\n    map: string;\n    handling: Handling;\n    room_handling: boolean;\n    room_handling_arr: number;\n    room_handling_das: number;\n    room_handling_sdf: number;\n    noreplay: boolean;\n    nosound: boolean;\n    bgmnoreset: boolean;\n    neverstopbgm: boolean;\n    song: string;\n    survivalmode: string;\n    survival_messiness: number;\n    survival_layer_amt: number;\n    survival_layer_non: boolean;\n    survival_layer_min: number;\n    survival_timer_itv: number;\n    survival_cap: number;\n    usezenconfig: boolean;\n    zenlevels: boolean;\n    zenlevel: number;\n    zenprogress: number;\n    nosiren: boolean;\n    anchorseed: boolean;\n    forfeit_time: number;\n    username: string;\n    latencymode: string;\n    fulloffset: number;\n    fullinterval: number;\n    fromretry: boolean;\n    retryisclear: boolean;\n    topoutisclear: boolean;\n    zenith: boolean;\n    zenith_expert: boolean;\n    zenith_doublehole: boolean;\n    zenith_volatile: boolean;\n    zenith_gravity: boolean;\n    zenith_messy: boolean;\n    zenith_invisible: boolean;\n    zenith_allspin: boolean;\n    zenith_duo: boolean;\n    zenith_mods: any[];\n    zenith_ally: any[];\n    zenith_allyexpert: boolean;\n    TEMP_zenith_rng: boolean;\n    TEMP_zenith_grace: string;\n  }\n\n  export interface Ready {\n    players: {\n      gameid: number;\n      userid: string;\n      options: ReadyOptions;\n      alive: boolean;\n      naturalorder: number;\n    }[];\n    isNew: boolean;\n  }\n\n  export namespace IGEs {\n    export type all = Target | AllowTargeting | Interaction | KEV;\n\n    export interface Target {\n      type: \"target\";\n      data: {\n        targets: number[];\n      };\n    }\n    export interface AllowTargeting {\n      type: \"allow_targeting\";\n      data: {\n        value: boolean;\n      };\n    }\n\n    export namespace Interactions {\n      export type all = Garbage | Targeted;\n\n      export interface Garbage {\n        type: \"garbage\";\n        frame: number;\n        gameid: number;\n        iid: number;\n        cid: number;\n        ackiid: number;\n        amt: number;\n        x: number;\n        y: number;\n        size: number;\n        zthalt?: any; //! IRRELEVANT (qp)\n      }\n\n      export interface Targeted {\n        // TODO: check this\n        type: \"targeted\";\n        value: boolean;\n      }\n    }\n\n    export interface Interaction {\n      type: \"interaction\" | \"interaction_confirm\";\n      data: Interactions.all;\n    }\n\n    export interface KEV {\n      type: \"kev\";\n      data: {\n        victim: {\n          gameid: number;\n        };\n        killer: {\n          gameid: number;\n        };\n        fire: number;\n      };\n    }\n  }\n\n  export interface IGEBase {\n    id: number;\n    frame: number;\n  }\n\n  export type IGE = IGEBase & IGEs.all;\n\n  export interface Leaderboard {\n    id: string;\n    username: string;\n    active: boolean;\n    naturalorder: number;\n    shadows: any[];\n    shadowedBy: (null | any)[];\n    wins: number;\n    stats: {\n      apm: number | null;\n      pps: number | null;\n      vsscore: number | null;\n      garbagesent: number;\n      garbagereceived: number;\n      kills: number;\n      altitude: number;\n      rank: number;\n      targetingfactor: number;\n      targetinggrace: number;\n      btb: number;\n      revives: number;\n      escapeartist: number;\n      blockrationing_app: number;\n      blockrationing_final: number;\n    };\n  }\n\n  export type Key =\n    | \"moveLeft\"\n    | \"moveRight\"\n    | \"rotateCW\"\n    | \"rotateCCW\"\n    | \"rotate180\"\n    | \"softDrop\"\n    | \"hardDrop\"\n    | \"hold\";\n  export namespace Replay {\n    export namespace Frames {\n      export type all =\n        | Start\n        | Full\n        | IGE\n        | Keypress\n        | End\n        | Strategy\n        | ManualTarget;\n\n      export interface Start {\n        type: \"start\";\n        data: {};\n      }\n\n      export interface Full {\n        type: \"full\";\n        data: {\n          game: {\n            board: BoardSquare[][];\n            bag: Mino[];\n            hold: {\n              piece: null | Mino;\n              locked: boolean;\n            };\n            g: number;\n            controlling: {\n              lShift: {\n                held: boolean;\n                arr: number;\n                das: number;\n                dir: -1;\n              };\n              rShift: {\n                held: boolean;\n                arr: number;\n                das: number;\n                dir: 1;\n              };\n              lastshift: 1 | -1;\n              inputSoftdrop: boolean;\n            };\n            falling: {\n              type: Mino;\n              x: number;\n              y: number;\n              r: number;\n              hy: number;\n              irs: number;\n              kick: number;\n              keys: number;\n              flags: number;\n              safelock: number;\n              locking: number;\n              lockresets: number;\n              rotresets: number;\n              skip: number[];\n            };\n            handling: Handling;\n            playing: boolean;\n          };\n\n          stats: {\n            lines: number;\n            level_lines: number;\n            level_lines_needed: number;\n            inputs: number;\n            holds: number;\n            score: number;\n            zenlevel: number;\n            zenprogress: number;\n            level: number;\n            combo: number;\n            topcombo: number;\n            combopower: number;\n            btb: number;\n            topbtb: number;\n            btbpower: number;\n            tspins: number;\n            piecesplaced: number;\n            clears: {\n              singles: number;\n              doubles: number;\n              triples: number;\n              quads: number;\n              pentas: number;\n              realtspins: number;\n              minitspins: number;\n              minitspinsingles: number;\n              tspinsingles: number;\n              minitspindoubles: number;\n              tspindoubles: number;\n              minitspintriples: number;\n              tspintriples: number;\n              minitspinquads: number;\n              tspinquads: number;\n              tspinpentas: number;\n              allclear: number;\n            };\n            garbage: {\n              sent: number;\n              sent_nomult: number;\n              maxspike: number;\n              maxspike_nomult: number;\n              received: number;\n              attack: number;\n              cleared: number;\n            };\n            kills: number;\n            finesse: {\n              combo: number;\n              faults: number;\n              perfectpieces: number;\n            };\n            zenith: {\n              altitude: number;\n              rank: number;\n              peakrank: number;\n              avgrankpts: number;\n              floor: number;\n              targetingfactor: number;\n              targetinggrace: number;\n              totalbonus: number;\n              revives: number;\n              revivesTotal: number;\n              revivesMaxOfBoth: number;\n              speedrun: boolean;\n              speedrun_seen: boolean;\n              splits: number[];\n            };\n          };\n\n          diyusi: number;\n        };\n      }\n\n      export interface IGE {\n        type: \"ige\";\n        data: IGEs.all;\n      }\n\n      export interface Keypress {\n        type: \"keydown\" | \"keyup\";\n        data: {\n          key: Key;\n          subframe: number;\n          hoisted?: boolean;\n        };\n      }\n\n      export interface End {\n        type: \"end\";\n        data: any; // TODO: type this\n      }\n\n      export interface Strategy {\n        type: \"strategy\";\n        /** Even, Eliminations, Random, and Payback (0, 1, 2, 3) */\n        data: 0 | 1 | 2 | 3;\n      }\n\n      export interface ManualTarget {\n        type: \"manual_target\";\n        data: number;\n      }\n    }\n\n    export type Frame = Frames.all & { frame: number };\n  }\n\n  export type Mino = \"s\" | \"z\" | \"j\" | \"l\" | \"i\" | \"t\" | \"o\";\n  export type BoardSquare = Mino | \"gb\" | null;\n\n  export namespace Client {\n    export type Event = Garbage | Frameset;\n\t\t/** @deprecated */\n\t\texport type Events = Event;\n\n    export interface Frameset {\n      type: \"frameset\";\n      provisioned: number;\n      frames: Game.Replay.Frame[];\n    }\n\n    export interface Garbage {\n      type: \"garbage\";\n      frame: number;\n      amount: number;\n      size: number;\n      column: number;\n    }\n  }\n\n  export type Target =\n    | {\n        strategy: \"even\" | \"elims\" | \"random\" | \"payback\";\n      }\n    | {\n        strategy: \"manual\";\n        target: number;\n      };\n\n  export namespace Tick {\n    export interface In {\n      gameid: number;\n      frame: number;\n      events: Client.Events[];\n      engine: Engine;\n    }\n\n    export interface Keypress {\n      type: \"keydown\" | \"keyup\";\n      frame: number;\n      data: {\n        key: Key;\n        /** The 1-digit decimal part of the frame (`.0 | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .9`) */\n        subframe: number;\n      };\n    }\n\n    export interface Out {\n      keys?: Keypress[];\n      runAfter?: (() => void)[];\n    }\n\n    export type Func = (data: In) => Promise<Out> | Out;\n  }\n}\n"],"names":[],"mappings":"AAEA,WA2pBC"}