no implicit any
parent
206e5852a0
commit
8a9f6096ee
|
|
@ -9,8 +9,10 @@
|
|||
"@types/bonjour": "^3.5.8",
|
||||
"@types/chai": "^4.2.19",
|
||||
"@types/faker": "^5.5.6",
|
||||
"@types/fs-extra": "^9.0.11",
|
||||
"@types/mocha": "^8.2.2",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@types/ws": "^7.4.5",
|
||||
"bonjour": "^3.5.0",
|
||||
"chai": "^4.3.4",
|
||||
"chalk": "^4.1.1",
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { render, Renderable, setTitle, start } from './ui/UI.js';
|
|||
import { ready } from './multiplayer/mDNS.js';
|
||||
import faker from 'faker';
|
||||
|
||||
let game = null;
|
||||
let game: Game = null;
|
||||
|
||||
export class Game extends Frigid implements Tickable, Renderable {
|
||||
pawns: Pawn[] = [];
|
||||
|
|
@ -47,7 +47,7 @@ export class Game extends Frigid implements Tickable, Renderable {
|
|||
});
|
||||
}
|
||||
|
||||
advanceSelection(number) {
|
||||
advanceSelection(number: number) {
|
||||
let index = this.pawns.indexOf(this.selected);
|
||||
this.selected = this.pawns[Math.min(Math.max(index + number, 0), this.pawns.length - 1)];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export class TaskList extends Serializable implements Renderable {
|
|||
this.tasks = [...this.tasks, task];
|
||||
}
|
||||
|
||||
removeTask(task) {
|
||||
removeTask(task: TaskState<any>) {
|
||||
this.tasks = this.tasks.filter(v => v !== task);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ export default class Time extends Serializable implements Renderable {
|
|||
setTimeout(this.doTick.bind(this), 0);
|
||||
}
|
||||
|
||||
advanceTime(seconds) {
|
||||
advanceTime(seconds: number) {
|
||||
this.minute += seconds / 60;
|
||||
this.normalize()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export type GiftMessage = {
|
|||
|
||||
export default network;
|
||||
|
||||
export async function ready(name) {
|
||||
export async function ready(name: string) {
|
||||
const port = await getPort({port: getPort.makeRange(52300, 52399)});
|
||||
mdns.publish({
|
||||
type: 'dfi',
|
||||
|
|
@ -39,7 +39,7 @@ export async function ready(name) {
|
|||
const wss = new WebSocket.Server({ port });
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('message', function incoming(message) {
|
||||
const {pawns: pawnJsons, from} = JSON.parse(message);
|
||||
const {pawns: pawnJsons, from} = JSON.parse(message.toString());
|
||||
const pawns = [];
|
||||
for(const pawnJson of pawnJsons) {
|
||||
const pawn: Pawn = Pawn.fromJson(pawnJson);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export class Item<Data> extends Serializable {
|
|||
id: ItemID = '';
|
||||
props: Map<string, PropertyValue> = new Map();
|
||||
|
||||
setName(name) {
|
||||
setName(name: string) {
|
||||
this.name = name;
|
||||
this.register(false);
|
||||
return this;
|
||||
|
|
@ -35,7 +35,7 @@ export class Item<Data> extends Serializable {
|
|||
}
|
||||
|
||||
setProperty(prop: ItemProperty, value: any) {
|
||||
this.props[prop.name] = value;
|
||||
this.props.set(prop.name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
declare module "neo-blessed";
|
||||
|
|
@ -25,7 +25,7 @@ export class GiftPopup {
|
|||
tags: true,
|
||||
...boxStyle(),
|
||||
});
|
||||
this.box.on('keypress', (evt, key) => {
|
||||
this.box.on('keypress', (evt: {}, key: {full: string}) => {
|
||||
if(key.full === 'enter') {
|
||||
this.send();
|
||||
} if(key.full === 'escape' || key.full === 'enter') {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { View } from './View.js';
|
|||
import { ActionsView } from './view/ActionsView.js';
|
||||
import { tasks } from '@tasks';
|
||||
|
||||
const clamp = (min, max, value) => Math.min(Math.max(value, min), max);
|
||||
const clamp = (min: number, max: number, value: number) => Math.min(Math.max(value, min), max);
|
||||
|
||||
// TODO move KeypressAcceptor to ui something idk
|
||||
export interface KeypressAcceptor {
|
||||
|
|
@ -46,7 +46,7 @@ export class Menu implements Renderable {
|
|||
}
|
||||
|
||||
constructor() {
|
||||
panels.right.on('keypress', (evt, key) => {
|
||||
panels.right.on('keypress', (evt: {}, key: {full: string}) => {
|
||||
|
||||
if (key.full === 'left') {
|
||||
this.regressView();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export class PawnDetails {
|
|||
tags: true,
|
||||
...boxStyle(),
|
||||
});
|
||||
this.box.on('keypress', (evt, key) => {
|
||||
this.box.on('keypress', (evt: {}, key: {full: string}) => {
|
||||
if(key.full === 'escape' || key.full === 'enter') {
|
||||
Game.current.clock.start();
|
||||
panels.screen.remove(this.box);
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import { panels } from './UI.js';
|
|||
export class Popup {
|
||||
box;
|
||||
|
||||
static show(content) {
|
||||
static show(content: string) {
|
||||
new Popup(content)
|
||||
}
|
||||
|
||||
private constructor(content) {
|
||||
private constructor(content: string) {
|
||||
this.box = blessed.box({
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
|
|
@ -21,7 +21,7 @@ export class Popup {
|
|||
tags: true,
|
||||
...boxStyle(),
|
||||
});
|
||||
this.box.on('keypress', (evt, key) => {
|
||||
this.box.on('keypress', (evt: {}, key: {full: string}) => {
|
||||
if(key.full === 'escape' || key.full === 'enter') {
|
||||
Game.current.clock.start();
|
||||
panels.screen.remove(this.box);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export function start() {
|
|||
|
||||
process.stdout.write(ansi.cursor.hide);
|
||||
|
||||
screen.key(['C-c'], function(ch, key) {
|
||||
screen.key(['C-c'], function() {
|
||||
process.stdout.write(ansi.cursor.show);
|
||||
setTimeout(_ => {
|
||||
process.exit(0);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export class ActionsView extends View {
|
|||
this.name = 'Actions';
|
||||
}
|
||||
|
||||
keypress(key) {
|
||||
keypress(key: {full: string}) {
|
||||
if(key.full === 'up') {
|
||||
this.actionIdx --;
|
||||
} else if (key.full === 'down') {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
"@tasks": ["./src/registries/Tasks"],
|
||||
"@items": ["./src/registries/Items"],
|
||||
"@game": ["./src/Game"]
|
||||
}
|
||||
},
|
||||
"noImplicitAny": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
|
|
|
|||
14
yarn.lock
14
yarn.lock
|
|
@ -35,6 +35,13 @@
|
|||
version "5.5.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/faker/-/faker-5.5.6.tgz#039b700a9d8ad9150ecc842bf5e717e2027b6f75"
|
||||
|
||||
"@types/fs-extra@^9.0.11":
|
||||
version "9.0.11"
|
||||
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.11.tgz#8cc99e103499eab9f347dbc6ca4e99fb8d2c2b87"
|
||||
integrity sha512-mZsifGG4QeQ7hlkhO56u7zt/ycBgGxSVsFI/6lGTU34VtwkiqrrSDgw0+ygs8kFGWcXnFQWMrzF2h7TtDFNixA==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/minimatch@^3.0.3", "@types/minimatch@^3.0.4":
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
|
||||
|
|
@ -53,6 +60,13 @@
|
|||
version "8.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.0.tgz#215c231dff736d5ba92410e6d602050cce7e273f"
|
||||
|
||||
"@types/ws@^7.4.5":
|
||||
version "7.4.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.5.tgz#8ff0f7efcd8fea19f51f9dd66cb8b498d172a752"
|
||||
integrity sha512-8mbDgtc8xpxDDem5Gwj76stBDJX35KQ3YBoayxlqUQcL5BZUthiqP/VQ4PQnLHqM4PmlbyO74t98eJpURO+gPA==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@ungap/promise-all-settled@1.1.2":
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44"
|
||||
|
|
|
|||
Loading…
Reference in New Issue