Skip to content

five-on-it / packages/protocol/src/cops / parseCops

Function: parseCops() ​

parseCops(text): { bounties: { list: object[]; on: boolean; }; cop?: { budget: number; costs: number[]; cuff?: { client: number; progress: number; }; dispatcher: boolean; last?: { answer: "rate" | "cooldown" | "failed" | "budget" | "ok" | "notCop" | "dispatcherOnly" | "noSuspect" | "noRoad" | "noBuilding" | "room"; n: number; order: "swat" | "roadblock" | "drone" | "cruiser"; }; max: number; ready: number[]; suspects: object[]; units: object[]; }; transports: object[]; type: "cops"; } | undefined

Defined in: packages/protocol/src/cops.ts:219

Parses a text frame as a player's view of the cops; undefined when it is not one.

Parameters ​

text ​

string

Returns ​

Type Literal ​

{ bounties: { list: object[]; on: boolean; }; cop?: { budget: number; costs: number[]; cuff?: { client: number; progress: number; }; dispatcher: boolean; last?: { answer: "rate" | "cooldown" | "failed" | "budget" | "ok" | "notCop" | "dispatcherOnly" | "noSuspect" | "noRoad" | "noBuilding" | "room"; n: number; order: "swat" | "roadblock" | "drone" | "cruiser"; }; max: number; ready: number[]; suspects: object[]; units: object[]; }; transports: object[]; type: "cops"; }

bounties ​

bounties: object

Whether their bounty board is on, and the room's bounties when it is.

bounties.list ​

list: object[]

bounties.on ​

on: boolean

cop? ​

optional cop?: object

Their dispatch, when they play the police.

cop.budget ​

budget: number = count

The team's budget now and at most (points).

cop.costs ​

costs: number[]

What each order costs (points), in COP_ORDERS' order.

cop.cuff? ​

optional cuff?: object

The cuffs under way: the robber's client id and how far along (0 to 1).

cop.cuff.client ​

client: number

cop.cuff.progress ​

progress: number

cop.dispatcher ​

dispatcher: boolean

Whether they took the Dispatcher's role (P2: orders at a point of the map).

cop.last? ​

optional last?: object

The answer to the cop's last order, and its number (one more each order).

cop.last.answer ​

answer: "rate" | "cooldown" | "failed" | "budget" | "ok" | "notCop" | "dispatcherOnly" | "noSuspect" | "noRoad" | "noBuilding" | "room"

cop.last.n ​

n: number = count

cop.last.order ​

order: "swat" | "roadblock" | "drone" | "cruiser"

cop.max ​

max: number = count

cop.ready ​

ready: number[]

The seconds before each order is the team's again, in COP_ORDERS' order.

cop.suspects ​

suspects: object[]

The robbers the police know of: where they last placed them (m), their stars, how long ago (s).

cop.units ​

units: object[]

The backup the team called that is still out: what, where (m), its seconds left.

transports ​

transports: object[]

The transports they ride or could stop.

type ​

type: "cops"


undefined