import Sockette from 'sockette'; import { VNode } from 'snabbdom'; import * as cg from 'chessgroundx/types'; import { Step } from './messages'; import { Gating } from './gating'; import { Promotion } from './promotion'; import { ChessgroundController } from './cgCtrl'; import { JSONObject, PyChessModel } from './types'; import { IChatController } from './chat'; export declare abstract class GameController extends ChessgroundController implements IChatController { sock: Sockette; username: string; gameId: string; tournamentId: string; handicap: boolean; wplayer: string; bplayer: string; aiLevel: number; rated: string; base: number; inc: number; players: string[]; titles: string[]; ratings: string[]; wtitle: string; btitle: string; wrating: string; brating: string; gating: Gating; promotion: Promotion; turnColor: cg.Color; setupFen: string; prevPieces: cg.Pieces; premove: { orig: cg.Key; dest: cg.Key; metadata?: cg.SetPremoveMetadata; } | undefined; predrop: { role: cg.Role; key: cg.Key; } | undefined; preaction: boolean; steps: Step[]; promotions: string[]; status: number; pgn: string; ply: number; result: string; vplayer0: VNode; vplayer1: VNode; vmovelist: VNode | HTMLElement; gameControls: VNode; moveControls: VNode; ctableContainer: VNode | HTMLElement; clickDrop: cg.Piece | undefined; dests: cg.Dests; lastmove: cg.Key[]; spectator: boolean; animation: boolean; showDests: boolean; clickDropEnabled: boolean; autoPromote?: boolean; plyVari: number; constructor(el: HTMLElement, model: PyChessModel); getGround: () => import("chessgroundx/api").Api; setDests: () => void; abstract doSendMove(orig: cg.Orig, dest: cg.Key, promo: string): void; sendMove(orig: cg.Orig, dest: cg.Key, promo: string): void; goPly(ply: number, plyVari?: number): void; doSend: (message: JSONObject) => void; protected onMove: () => (orig: cg.Key, dest: cg.Key, capturedPiece: cg.Piece) => void; protected onDrop: () => (piece: cg.Piece, dest: cg.Key) => void; protected onSelect: () => (key: cg.Key) => void; protected pass: () => void; /** * Custom variant-specific logic to be triggered on move and alter state of board/pocket depending on variant rules. * TODO: contains also some ui logic - maybe good to split pure chess rules (which maybe can go to chess.ts?) * from rendering dialogs and * TODO: Unify this with analysisCtrl * */ protected onUserMove(orig: cg.Key, dest: cg.Key, meta: cg.MoveMetadata): void; /** * Variant specific logic for when dropping a piece from pocket is performed * todo: decreasing of pocket happens here as well even though virtually no variant ever has a drop rule that doesn't decrease pocket. * Only reason currently this is not in chessground is editor where we have a second "pocket" that serves as a palette * Also maybe nice ot think if ui+communication logic can be split out of here (same for onUserMove) so only chess rules remain? * */ protected onUserDrop(role: cg.Role, dest: cg.Key, meta: cg.MoveMetadata): void; private onMsgSpectators; private onMsgChat; private onMsgFullChat; private onMsgGameNotFound; private onMsgShutdown; protected onMessage(evt: MessageEvent): void; }