/*
    Hurry Curry! - a game about cooking
    Copyright (C) 2026 Hurry Curry! Contributors

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, version 3 of the License only.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

*/

import { System } from "./system.ts";
import { player_controller, send } from "./main.ts";

const QUICK_COMMANDS: { [key: string]: string } = {
    "Numpad1": "/start junior",
    "Numpad2": "/start -b simple -b dishwasher -b waiter",
    "Numpad3": "/start sophomore",
    "Numpad4": "/start debug",
    "Numpad5": "/start 5star",
    "Numpad6": "/start campaign/lobby",
    "Numpad8": "/start-tutorial plate:seared-patty,sliced-bun",
    "Numpad9": "/start-tutorial plate:sliced-bun",
    "Numpad7": "/end-tutorial",
    "Numpad0": "/end",
    "NumpadEnter": "/r",
}

export class SQuickCommands extends System {
    override input(ev: KeyboardEvent, down: boolean): boolean {
        if (down && ev.code in QUICK_COMMANDS) {
            send({ player: player_controller.my_id!, type: "communicate", message: { text: QUICK_COMMANDS[ev.code] } })
            return true
        }
        return false
    }
}