From aafbdc658e60b9c8857272046e96b9edb4aa1d52 Mon Sep 17 00:00:00 2001 From: Terncode Date: Wed, 5 Aug 2026 19:01:45 +0200 Subject: [PATCH] Lint code --- package.json | 3 +- src/ts/bootstrap-common.ts | 7 +- src/ts/client/buttonActions.ts | 22 +- src/ts/client/game.ts | 2 +- src/ts/client/gameLoop.ts | 2 +- src/ts/client/input/gamepad.ts | 4 +- src/ts/client/input/keyboard.ts | 6 +- src/ts/client/input/mouse.ts | 14 +- src/ts/client/input/touch.ts | 8 +- src/ts/client/loadSprites.ts | 12 +- src/ts/common/clientActionsTemplate.ts | 2 +- src/ts/common/commonInterfaces.ts | 2 +- src/ts/common/ponyInfo.ts | 12 +- src/ts/common/stringUtils.ts | 6 +- .../admin-account-details.ts | 2 +- src/ts/components/admin/pipes/translitPipe.ts | 2 +- .../admin/shared/ua-info/ua-info.ts | 2 +- src/ts/components/app/help/help.ts | 4 +- src/ts/components/services/adminModel.ts | 2 +- src/ts/components/services/audio.ts | 6 +- src/ts/components/services/model.ts | 2 +- .../services/rollbarErrorHandler.ts | 2 +- .../character-preview/character-preview.ts | 2 +- src/ts/components/shared/chat-box/chat-box.ts | 4 +- src/ts/components/shared/chat-log/chat-log.ts | 10 +- .../components/shared/directives/dropdown.ts | 2 +- .../components/shared/directives/focusTrap.ts | 2 +- src/ts/components/shared/shared.module.ts | 2 +- .../shared/sign-in-box/sign-in-box.ts | 2 +- .../tools/shared/tools-frame/tools-frame.ts | 2 +- .../tools/tools-animation/tools-animation.ts | 4 +- .../tools/tools-regions/tools-regions.ts | 2 +- src/ts/generated/gamepad-mappings.ts | 72 ++-- src/ts/graphics/webgl/shader.ts | 4 +- src/ts/server/api/admin.ts | 16 +- src/ts/server/config.ts | 2 +- src/ts/server/controllerUtils.ts | 30 +- .../controllers/collectableController.ts | 2 +- src/ts/server/controllers/plantController.ts | 4 +- src/ts/server/routes/auth.ts | 6 +- src/ts/server/server.ts | 2 +- src/ts/server/stats.ts | 12 +- src/ts/tests/common/compressPony.spec.ts | 402 +++++++++--------- .../tests/graphics/spriteSheetUtils.spec.ts | 2 +- src/ts/tools/create-sprites.ts | 2 +- src/ts/tools/name-tester.ts | 2 +- 46 files changed, 357 insertions(+), 357 deletions(-) diff --git a/package.json b/package.json index 80f70fe..bf52b38 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "start": "node pony-town.js --login --admin --game", "startlocal": "node pony-town.js --login --admin --game --local", "start-inspect": "node --inspect pony-town.js --login --admin --game --local", - "lint": "tslint -c tslint.json src/ts/**/*.ts", + "lint": "eslint \"src/ts/**/*.ts\"", + "lint-fix": "eslint \"src/ts/**/*.ts\" --fix", "dev": "gulp dev", "dev-sprites": "gulp dev --sprites", "sw-generate": "workbox generateSW workbox-config.js && gulp patchWebWorker", diff --git a/src/ts/bootstrap-common.ts b/src/ts/bootstrap-common.ts index aceda07..f749016 100644 --- a/src/ts/bootstrap-common.ts +++ b/src/ts/bootstrap-common.ts @@ -9,11 +9,10 @@ import './client/polyfils'; import { enableProdMode } from '@angular/core'; if (document.body.getAttribute('data-debug') !== 'true' || localStorage.production) { - enableProdMode(); + enableProdMode(); } - if (typeof module !== 'undefined' && (module as any).hot) { - (module as any).hot.accept(); -} \ No newline at end of file + (module as any).hot.accept(); +} diff --git a/src/ts/client/buttonActions.ts b/src/ts/client/buttonActions.ts index fb14c03..fe526e7 100644 --- a/src/ts/client/buttonActions.ts +++ b/src/ts/client/buttonActions.ts @@ -198,17 +198,17 @@ export function createDefaultButtonActions(): ButtonActionSlot[] { ExpressionExtra.Zzz | ExpressionExtra.Cry | ExpressionExtra.Hearts | ExpressionExtra.Blush)) }, ] : [ - { action: getActionAction('boop') }, - { action: getActionAction('down') }, - { action: getActionAction('up') }, - { action: getActionAction('turn-head') }, - { action: getActionAction('magic') }, - { action: expressionButtonAction(undefined) }, - { action: expressionButtonAction(createExpression(Eye.Closed, Eye.Closed, Muzzle.Smile)) }, - { action: expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral3, Muzzle.Smile)) }, - { action: expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral, Muzzle.Scrunch, Iris.Forward, Iris.Up)) }, - { action: expressionButtonAction(createExpression(Eye.Angry, Eye.Angry, Muzzle.Scrunch)) }, - ]; + { action: getActionAction('boop') }, + { action: getActionAction('down') }, + { action: getActionAction('up') }, + { action: getActionAction('turn-head') }, + { action: getActionAction('magic') }, + { action: expressionButtonAction(undefined) }, + { action: expressionButtonAction(createExpression(Eye.Closed, Eye.Closed, Muzzle.Smile)) }, + { action: expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral3, Muzzle.Smile)) }, + { action: expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral, Muzzle.Scrunch, Iris.Forward, Iris.Up)) }, + { action: expressionButtonAction(createExpression(Eye.Angry, Eye.Angry, Muzzle.Scrunch)) }, + ]; } export function serializeActions(slots: ButtonActionSlot[]): string { diff --git a/src/ts/client/game.ts b/src/ts/client/game.ts index f3a2a4b..7353193 100644 --- a/src/ts/client/game.ts +++ b/src/ts/client/game.ts @@ -338,7 +338,7 @@ export class PonyTownGame implements Game { } apply = (func: () => void) => { return this.zone.run(func); - } + }; applyChanges = () => this.zone.run(() => { }); private getScale() { const defaultScale = pixelRatio() > 1 ? 3 : 2; diff --git a/src/ts/client/gameLoop.ts b/src/ts/client/gameLoop.ts index bba9313..97836f7 100644 --- a/src/ts/client/gameLoop.ts +++ b/src/ts/client/gameLoop.ts @@ -1,4 +1,4 @@ -import { isError } from "../common/utils"; +import { isError } from '../common/utils'; export interface Game { fps: number; diff --git a/src/ts/client/input/gamepad.ts b/src/ts/client/input/gamepad.ts index 8cb0148..85b60ac 100644 --- a/src/ts/client/input/gamepad.ts +++ b/src/ts/client/input/gamepad.ts @@ -133,12 +133,12 @@ export class GamePadController implements InputController { } private gamepadconnected = (e: Event) => { this.gamepadIndex = (e as GamepadEvent).gamepad.index; - } + }; private gamepaddisconnected = (e: Event) => { if (this.gamepadIndex === (e as GamepadEvent).gamepad.index) { this.scanGamepads(); } - } + }; } function readAxis(manager: InputManager, keyX: Key, keyY: Key, axisX: number, axisY: number, zeroed: boolean): boolean { diff --git a/src/ts/client/input/keyboard.ts b/src/ts/client/input/keyboard.ts index fb477ce..175742c 100644 --- a/src/ts/client/input/keyboard.ts +++ b/src/ts/client/input/keyboard.ts @@ -70,7 +70,7 @@ export class KeyboardController implements InputController { this.stack.push(code); } } - } + }; private keyup = (e: KeyboardEvent) => { let code = fixKeyCode(e.keyCode); @@ -89,8 +89,8 @@ export class KeyboardController implements InputController { } removeItem(this.stack, code); - } + }; private blur = () => { this.manager.clear(); - } + }; } diff --git a/src/ts/client/input/mouse.ts b/src/ts/client/input/mouse.ts index 16c9b66..fbf15a2 100644 --- a/src/ts/client/input/mouse.ts +++ b/src/ts/client/input/mouse.ts @@ -49,7 +49,7 @@ export class MouseController implements InputController { this.manager.setValue(Key.MOUSE_X, Math.floor(e.clientX - rect.left)); this.manager.setValue(Key.MOUSE_Y, Math.floor(e.clientY - rect.top)); } - } + }; private mousedown = (e: MouseEvent) => { e.preventDefault(); e.stopPropagation(); @@ -61,29 +61,29 @@ export class MouseController implements InputController { if (button) { this.manager.setValue(button, 1); } - } + }; private mouseup = (e: MouseEvent) => { const button = MOUSE_BUTTONS[e.button]; if (button) { this.manager.setValue(button, 0); } - } + }; private mousewheel: any = (e: WheelEvent) => { this.manager.addValue(Key.MOUSE_WHEEL_X, clamp(e.deltaX, -1, 1)); this.manager.addValue(Key.MOUSE_WHEEL_Y, clamp(e.deltaY, -1, 1)); - } + }; private contextmenu = (e: Event) => { e.preventDefault(); e.stopPropagation(); - } + }; private click = (e: Event) => { e.preventDefault(); e.stopPropagation(); - } + }; private blur = () => { for (const button of MOUSE_BUTTONS) { this.manager.setValue(button, 0); } - } + }; } diff --git a/src/ts/client/input/touch.ts b/src/ts/client/input/touch.ts index e8123e3..328975e 100644 --- a/src/ts/client/input/touch.ts +++ b/src/ts/client/input/touch.ts @@ -152,7 +152,7 @@ export class TouchController implements InputController { this.touch2Id = touch.identifier; } } - } + }; private touchmove = (e: any) => { e.preventDefault(); e.stopPropagation(); @@ -165,7 +165,7 @@ export class TouchController implements InputController { this.manager.setValue(Key.MOUSE_Y, this.touchCurrent.y); this.updateInput(); } - } + }; private touchend = (e: any) => { e.preventDefault(); e.stopPropagation(); @@ -188,10 +188,10 @@ export class TouchController implements InputController { this.manager.setValue(Key.TOUCH_SECOND_CLICK, 1); this.touch2Id = -1; } - } + }; private blur = () => { this.reset(); - } + }; private getTouchXY(touch: Touch) { const { left, top } = this.element!.getBoundingClientRect(); diff --git a/src/ts/client/loadSprites.ts b/src/ts/client/loadSprites.ts index 60dc4c5..6da423f 100644 --- a/src/ts/client/loadSprites.ts +++ b/src/ts/client/loadSprites.ts @@ -1,9 +1,9 @@ -import { noop, once } from "lodash"; -import { getUrl } from "./rev"; -import { spriteSheets } from "../generated/sprites"; -import { createCanvas, loadImage } from "../common/canvasUtils"; -import { createFonts } from "../common/fonts"; -import { SpriteSheet } from "../common/interfaces"; +import { noop, once } from 'lodash'; +import { getUrl } from './rev'; +import { spriteSheets } from '../generated/sprites'; +import { createCanvas, loadImage } from '../common/canvasUtils'; +import { createFonts } from '../common/fonts'; +import { SpriteSheet } from '../common/interfaces'; export function createSpriteUtils() { createFonts(); diff --git a/src/ts/common/clientActionsTemplate.ts b/src/ts/common/clientActionsTemplate.ts index 746feb0..fd91e64 100644 --- a/src/ts/common/clientActionsTemplate.ts +++ b/src/ts/common/clientActionsTemplate.ts @@ -33,7 +33,7 @@ export class ClientActionsTemplate implements SocketClient { left(_reason: LeaveReason) {} @Method({ binary: [BinNotificationId, BinEntityId, Bin.Str, Bin.Str, Bin.Str, Bin.U8] }) addNotification(_id: number, _entityId: number, _name: string, _message: string, _note: string, _flags: NotificationFlags) {} - + @Method({ binary: [BinNotificationId] }) removeNotification(_id: number) { } @Method({ binary: [BinEntityId, BinEntityId] }) diff --git a/src/ts/common/commonInterfaces.ts b/src/ts/common/commonInterfaces.ts index 1875484..9313aac 100644 --- a/src/ts/common/commonInterfaces.ts +++ b/src/ts/common/commonInterfaces.ts @@ -31,4 +31,4 @@ export const enum MapFlags { EditableEntities = 2, EditableTiles = 4, EdibleGrass = 8, -} \ No newline at end of file +} diff --git a/src/ts/common/ponyInfo.ts b/src/ts/common/ponyInfo.ts index c518968..996f190 100644 --- a/src/ts/common/ponyInfo.ts +++ b/src/ts/common/ponyInfo.ts @@ -294,12 +294,12 @@ function syncLockedBasePonyInfo( getFillOf2(info.backMane, defaultColor), getFillOf2(info.tail, defaultColor), ], [ - info.coatOutline, - info.eyeColorRight, - getOutlineOf2(info.mane, defaultColor), - getOutlineOf2(info.backMane, defaultColor), - getOutlineOf2(info.tail, defaultColor), - ]); + info.coatOutline, + info.eyeColorRight, + getOutlineOf2(info.mane, defaultColor), + getOutlineOf2(info.backMane, defaultColor), + getOutlineOf2(info.tail, defaultColor), + ]); return info; } diff --git a/src/ts/common/stringUtils.ts b/src/ts/common/stringUtils.ts index 2b26bac..c63a498 100644 --- a/src/ts/common/stringUtils.ts +++ b/src/ts/common/stringUtils.ts @@ -123,7 +123,7 @@ export function isValid(c: number): boolean { || (c >= 0x231a && c <= 0x231b) || (c >= 0x23e9 && c <= 0x23fa) // emoji || (c >= 0x1f900 && c <= 0x1f9ff) // Supplemental Symbols and Pictographs || otherValid.has(c) // other symbols - ; + ; } export function isValid2(c: number): boolean { @@ -156,13 +156,13 @@ export function isValid2(c: number): boolean { || (c >= 0x1f0a0 && c <= 0x1f0ae) || (c >= 0x1f0b1 && c <= 0x1f0bf) || (c >= 0x1f0c1 && c <= 0x1f0cf) || (c >= 0x1f0d1 && c <= 0x1f0df) || (c >= 0x1f0e0 && c <= 0x1f0f5) // Playing Cards || (c >= 0x1f1e6 && c <= 0x1f1ff) // Enclosed Alphanumeric Supplement (regional indicators) - ; + ; } function isInvalid(c: number): boolean { return c === 0x1f595 // middle finger emoji || c === 0x00ad // soft hyphen - ; + ; } function isValidForName(c: number): boolean { diff --git a/src/ts/components/admin/admin-account-details/admin-account-details.ts b/src/ts/components/admin/admin-account-details/admin-account-details.ts index 9c2d647..0e723cd 100644 --- a/src/ts/components/admin/admin-account-details/admin-account-details.ts +++ b/src/ts/components/admin/admin-account-details/admin-account-details.ts @@ -437,7 +437,7 @@ export class AdminAccountDetails implements OnInit, OnDestroy { } highlighCharacter = (char: Character | undefined): boolean => { return !!char && includes(this.ponyNames, char.name.toLowerCase()); - } + }; clearSessions() { if (this.account) { this.clearingSessions = true; diff --git a/src/ts/components/admin/pipes/translitPipe.ts b/src/ts/components/admin/pipes/translitPipe.ts index a09930d..c08f4a4 100644 --- a/src/ts/components/admin/pipes/translitPipe.ts +++ b/src/ts/components/admin/pipes/translitPipe.ts @@ -7,7 +7,7 @@ import { transliterate } from 'transliteration'; }) export class TranslitPipe implements PipeTransform { transform(value: string) { - if (!value || /^[a-z0-9-_.,\[\]!@#$%^&*{}|\/\\ ]+$/i.test(value)) + if (!value || /^[a-z0-9-_.,[]!@#$%^&*{}|\/\\ ]+$/i.test(value)) return undefined; const translit = transliterate(value); diff --git a/src/ts/components/admin/shared/ua-info/ua-info.ts b/src/ts/components/admin/shared/ua-info/ua-info.ts index ddd31c5..2aca737 100644 --- a/src/ts/components/admin/shared/ua-info/ua-info.ts +++ b/src/ts/components/admin/shared/ua-info/ua-info.ts @@ -8,7 +8,7 @@ function icon(value: string | undefined, defaultValue: any): any { const extensions = { browser: [ - [/(Amigo|YaBrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION] + [/(Amigo|YaBrowser)\/([\w.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION] ], }; diff --git a/src/ts/components/app/help/help.ts b/src/ts/components/app/help/help.ts index a774710..00bd448 100644 --- a/src/ts/components/app/help/help.ts +++ b/src/ts/components/app/help/help.ts @@ -27,8 +27,8 @@ export class Help { ngAfterViewInit() { this.route.fragment.subscribe(f => { - const element = document.querySelector("#" + f); + const element = document.querySelector('#' + f); if (element) setTimeout(() => element.scrollIntoView(), 10); - }) + }); } } diff --git a/src/ts/components/services/adminModel.ts b/src/ts/components/services/adminModel.ts index c27643f..2cda65d 100644 --- a/src/ts/components/services/adminModel.ts +++ b/src/ts/components/services/adminModel.ts @@ -79,7 +79,7 @@ export class AdminModel { console.error(error); this.error = error.message; return undefined; - } + }; private checkError = (promise: Promise) => promise.catch(this.handleError) as Promise; private running = true; private initializedLive = false; diff --git a/src/ts/components/services/audio.ts b/src/ts/components/services/audio.ts index df99594..c15cbd9 100644 --- a/src/ts/components/services/audio.ts +++ b/src/ts/components/services/audio.ts @@ -43,9 +43,9 @@ function getTracks(season: Season, holiday: Holiday, map: MapType) { 'trees-winter', 'reindeer-winter', ] : [ - 'trees', - 'reindeer', - ]), + 'trees', + 'reindeer', + ]), 'season', 'ambient', 'building', diff --git a/src/ts/components/services/model.ts b/src/ts/components/services/model.ts index 74b2dec..246f9b1 100644 --- a/src/ts/components/services/model.ts +++ b/src/ts/components/services/model.ts @@ -467,7 +467,7 @@ export class Model { this.pending = true; - const alert = !!this.accountAlert ? 'y' : ''; + const alert = this.accountAlert ? 'y' : ''; return this.post('/api/game/join', { version, ponyId, serverId, alert, url: location.href }) .finally(() => this.pending = false); diff --git a/src/ts/components/services/rollbarErrorHandler.ts b/src/ts/components/services/rollbarErrorHandler.ts index b303e85..0802696 100644 --- a/src/ts/components/services/rollbarErrorHandler.ts +++ b/src/ts/components/services/rollbarErrorHandler.ts @@ -57,4 +57,4 @@ export class RollbarErrorHandler implements ErrorHandler { } } } -} \ No newline at end of file +} diff --git a/src/ts/components/shared/character-preview/character-preview.ts b/src/ts/components/shared/character-preview/character-preview.ts index 2df07ed..12aa384 100644 --- a/src/ts/components/shared/character-preview/character-preview.ts +++ b/src/ts/components/shared/character-preview/character-preview.ts @@ -102,7 +102,7 @@ export class CharacterPreview implements OnDestroy, OnChanges, AfterViewInit { this.lastFrame = now; this.tryDraw(); } - } + }; private tryDraw() { try { this.draw(); diff --git a/src/ts/components/shared/chat-box/chat-box.ts b/src/ts/components/shared/chat-box/chat-box.ts index 6846013..34b7c47 100644 --- a/src/ts/components/shared/chat-box/chat-box.ts +++ b/src/ts/components/shared/chat-box/chat-box.ts @@ -248,10 +248,10 @@ export class ChatBox implements AfterViewInit, OnDestroy { private say(message: string, chatType: ChatType, entityId: number): boolean { this.game.lastChatMessageType = chatType; if (message.toLowerCase().startsWith('/shrug')) { - var rawMessage = message.substring(6); + let rawMessage = message.substring(6); return !!this.game.send(server => server.say(entityId, ((rawMessage !== '') ? rawMessage + ' ' : '') + `¯\\_(ツ)_/¯`, - chatType)); + chatType)); } else { return !!this.game.send(server => server.say(entityId, message, chatType)); } diff --git a/src/ts/components/shared/chat-log/chat-log.ts b/src/ts/components/shared/chat-log/chat-log.ts index ff842a0..52ef72f 100644 --- a/src/ts/components/shared/chat-log/chat-log.ts +++ b/src/ts/components/shared/chat-log/chat-log.ts @@ -694,17 +694,17 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck { scrollHandler = () => { this.scrollingToEnd = true; this.scroll.nativeElement.scrollTop = 99999; - } + }; clickNameHandler = (message: ChatLogMessage) => { this.zone.run(() => this.nameClick.emit(message)); - } + }; clickLabel = (message: ChatLogMessage) => { this.zone.run(() => { if (message.label) { this.toggleType.emit(message.label); } }); - } + }; private clearList() { removeAllNodes(this.linesElement); } @@ -772,12 +772,12 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck { return findEntityFromMessages(id, this.whisper) || findEntityFromMessages(id, this.party) || findEntityFromMessages(id, this.local); - } + }; private findEntityFromMessagesByName = (name: string): FakeEntity | undefined => { return findEntityFromMessagesByName(name, this.game.playerId, this.whisper) || findEntityFromMessagesByName(name, this.game.playerId, this.party) || findEntityFromMessagesByName(name, this.game.playerId, this.local); - } + }; } function findEntityFromMessages(id: number, messages: ChatLogMessage[]): FakeEntity | undefined { diff --git a/src/ts/components/shared/directives/dropdown.ts b/src/ts/components/shared/directives/dropdown.ts index be90679..4b64f41 100644 --- a/src/ts/components/shared/directives/dropdown.ts +++ b/src/ts/components/shared/directives/dropdown.ts @@ -199,7 +199,7 @@ export class Dropdown { } else if (this.autoClose && e.keyCode === 27) { // esc this.close(); } - } + }; private canvasCloseHandler: any = () => this.close(); } diff --git a/src/ts/components/shared/directives/focusTrap.ts b/src/ts/components/shared/directives/focusTrap.ts index e8d7380..6057903 100644 --- a/src/ts/components/shared/directives/focusTrap.ts +++ b/src/ts/components/shared/directives/focusTrap.ts @@ -54,5 +54,5 @@ export class FocusTrap implements OnInit, OnDestroy { this.lastActiveElement.focus(); } } - } + }; } diff --git a/src/ts/components/shared/shared.module.ts b/src/ts/components/shared/shared.module.ts index 1942fd2..596d719 100644 --- a/src/ts/components/shared/shared.module.ts +++ b/src/ts/components/shared/shared.module.ts @@ -166,4 +166,4 @@ const declarations = [ exports: [declarations] }) export class SharedModule { -} \ No newline at end of file +} diff --git a/src/ts/components/shared/sign-in-box/sign-in-box.ts b/src/ts/components/shared/sign-in-box/sign-in-box.ts index 78e065c..e6a615b 100644 --- a/src/ts/components/shared/sign-in-box/sign-in-box.ts +++ b/src/ts/components/shared/sign-in-box/sign-in-box.ts @@ -30,7 +30,7 @@ export class SignInBox implements OnInit { .then(data => { this.mocks = data; }) - .catch(noop) + .catch(noop); } async createNew() { const name = prompt('Account name'); diff --git a/src/ts/components/tools/shared/tools-frame/tools-frame.ts b/src/ts/components/tools/shared/tools-frame/tools-frame.ts index 9a7a2ef..b169cc4 100644 --- a/src/ts/components/tools/shared/tools-frame/tools-frame.ts +++ b/src/ts/components/tools/shared/tools-frame/tools-frame.ts @@ -32,7 +32,7 @@ export class ToolsFrame { if (this.popoverIsOpen) { this.togglePopover(); } - } + }; togglePopover() { const rect = (this.element.nativeElement as HTMLElement).getBoundingClientRect(); this.placement = (rect.left < (window.innerWidth / 2)) ? 'right' : 'left'; diff --git a/src/ts/components/tools/tools-animation/tools-animation.ts b/src/ts/components/tools/tools-animation/tools-animation.ts index 5cb3506..4fb7171 100644 --- a/src/ts/components/tools/tools-animation/tools-animation.ts +++ b/src/ts/components/tools/tools-animation/tools-animation.ts @@ -472,8 +472,8 @@ export class ToolsAnimation implements OnInit, OnDestroy { } } else { const frames = this.headAnimation.frames - .map(f => [f.duration, '[' + compressHeadFrame(f).join(', ') + ']']) - .map(([repeat, frame]) => parseInt(`${repeat}`, 10) > 1 ? `...repeat(${repeat}, ${frame})` : frame); + .map(f => [f.duration, '[' + compressHeadFrame(f).join(', ') + ']']) + .map(([repeat, frame]) => parseInt(`${repeat}`, 10) > 1 ? `...repeat(${repeat}, ${frame})` : frame); console.log(`frames: [\n${frames.map(x => `\t${x}`).join(',\n')}\n]`); } } diff --git a/src/ts/components/tools/tools-regions/tools-regions.ts b/src/ts/components/tools/tools-regions/tools-regions.ts index 183879d..9b5e88b 100644 --- a/src/ts/components/tools/tools-regions/tools-regions.ts +++ b/src/ts/components/tools/tools-regions/tools-regions.ts @@ -170,5 +170,5 @@ export class ToolsRegions implements OnInit, OnDestroy { this.player.y += dy * delta * PONY_SPEED_TROT; this.update(); } - } + }; } diff --git a/src/ts/generated/gamepad-mappings.ts b/src/ts/generated/gamepad-mappings.ts index b4ed477..a772294 100644 --- a/src/ts/generated/gamepad-mappings.ts +++ b/src/ts/generated/gamepad-mappings.ts @@ -179,96 +179,96 @@ export const GAMEPAD_MAPPINGS: GamepadMapping[] = [ browser('Chrome', 'Logitech Logitech Dual Action (Vendor: 046d Product: c216)', 'Linux'), browser('Firefox', '046d-c216-Logitech Logitech Dual Action', 'Linux'), ], - axes(0, 1, 2, 3, index(4), index(5)), - buttons(1, 2, 0, 3, 8, 9, axisDirection(5, 1), axisDirection(4, -1), axisDirection(4, 1), axisDirection(5, -1), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), + axes(0, 1, 2, 3, index(4), index(5)), + buttons(1, 2, 0, 3, 8, 9, axisDirection(5, 1), axisDirection(4, -1), axisDirection(4, 1), axisDirection(5, -1), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), gamepad('Logitech F310 (DirectInput) Chrome Windows/OSX', [ browser('Chrome', 'Logitech Dual Action (STANDARD GAMEPAD Vendor: 046d Product: c216)', 'Mac OS X'), browser('Chrome', 'Logitech Dual Action (STANDARD GAMEPAD Vendor: 046d Product: c216)', 'Windows NT'), ], - axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), - buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), + axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), + buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), gamepad('Logitech F310 (DirectInput) Firefox OSX', [ browser('Firefox', '46d-c216-Logitech Dual Action', 'Mac OS X'), ], - axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), - buttons(1, 2, 0, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(2, 1), axisDirection(1, -1), axisDirection(1, 1), axisDirection(2, -1), index(6), 5, 11, axisDirection(4, 1), axisDirection(3, -1), undefined, axisDirection(4, -1), index(7), undefined)), + axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), + buttons(1, 2, 0, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(2, 1), axisDirection(1, -1), axisDirection(1, 1), axisDirection(2, -1), index(6), 5, 11, axisDirection(4, 1), axisDirection(3, -1), undefined, axisDirection(4, -1), index(7), undefined)), gamepad('Logitech F310 (DirectInput) Firefox Windows', [ browser('Firefox', '046d-c216-Logitech Dual Action', 'Windows NT'), ], - axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), - buttons(1, 2, 0, 3, 8, 9, index(14), index(15), index(16), index(13), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), + axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), + buttons(1, 2, 0, 3, 8, 9, index(14), index(15), index(16), index(13), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), gamepad('Logitech F310 (XInput) Chrome Linux', [ browser('Chrome', 'Logitech Gamepad F310 (STANDARD GAMEPAD Vendor: 046d Product: c21d)', 'Linux'), ], - axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), - buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), + axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), + buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), gamepad('Logitech F310 (XInput) Firefox Linux', [ browser('Firefox', '046d-c21d-Logitech Gamepad F310', 'Linux'), ], - axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), - buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), + axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), + buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), gamepad('PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268) Chrome OSX Linux', [ browser('Chrome', 'PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268)', 'Mac OS X'), browser('Chrome', 'Sony PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268)', 'Linux'), ], - axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), - buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), + axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), + buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), gamepad('054c-0268-Sony PLAYSTATION(R)3 Controller Firefox Linux', [ browser('Firefox', '054c-0268-Sony PLAYSTATION(R)3 Controller', 'Linux'), ], - axes(0, 1, 2, 3, index(6), index(7), index(12), index(13)), - buttons(14, 13, 15, 12, 0, 3, index(6), index(7), index(5), index(4), 10, 1, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(8), 11, 2, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(9), 16)), + axes(0, 1, 2, 3, index(6), index(7), index(12), index(13)), + buttons(14, 13, 15, 12, 0, 3, index(6), index(7), index(5), index(4), 10, 1, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(8), 11, 2, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(9), 16)), gamepad('PS4 Chrome Linux', [ browser('Chrome', 'Sony Computer Entertainment Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)', 'Linux'), ], - axes(0, 1, 2, 3, positiveNegative(15, 14), positiveNegative(13, 12), positive(6), positive(7)), - buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), + axes(0, 1, 2, 3, positiveNegative(15, 14), positiveNegative(13, 12), positive(6), positive(7)), + buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), gamepad('PS4 Chrome Windows/OSX', [ browser('Chrome', 'Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)', 'Windows NT'), browser('Chrome', 'Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)', 'Mac OS X'), ], - axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), - buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), + axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), + buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), gamepad('PS4 Firefox Linux', [ browser('Firefox', '054c-05c4-Sony Computer Entertainment Wireless Controller', 'Linux'), ], - axes(0, 1, 2, 5, index(6), index(7), index(3), index(4)), - buttons(1, 2, 0, 3, 8, 9, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(5, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(5, -1), index(7), 12)), + axes(0, 1, 2, 5, index(6), index(7), index(3), index(4)), + buttons(1, 2, 0, 3, 8, 9, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(5, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(5, -1), index(7), 12)), gamepad('PS4 Firefox OSX', [ browser('Firefox', '54c-5c4-Wireless Controller', 'Mac OS X'), ], - axes(0, 1, 2, 5, index(6), index(7)), - buttons(0, 1, 2, 3, 8, 9, index(15), index(16), index(17), index(14), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(5, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(5, -1), index(7), 12)), + axes(0, 1, 2, 5, index(6), index(7)), + buttons(0, 1, 2, 3, 8, 9, index(15), index(16), index(17), index(14), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(5, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(5, -1), index(7), 12)), gamepad('XBone Chrome Linux', [ browser('Chrome', 'Microsoft Controller (Vendor: 045e Product: 02d1)', 'Linux'), ], - axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), - buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), + axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), + buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), gamepad('Xbox One Chrome OSX Linux', [ browser('Chrome', '©Microsoft Corporation Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e)', 'Linux'), browser('Chrome', 'Xbox One Controller (STANDARD GAMEPAD Vendor: 02d1 Product: 045e)', 'Mac OS X'), ], - axes(0, 1, 2, 3), - buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), + axes(0, 1, 2, 3), + buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), gamepad('Xbone Firefox Linux', [ browser('Firefox', '045e-02d1-Microsoft X-Box One pad', 'Linux'), ], - axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), - buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), + axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), + buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), gamepad('Xbox 360 Chrome Windows/OSX', [ browser('Chrome', 'Xbox 360 Controller (STANDARD GAMEPAD Vendor: 028e Product: 045e)', 'Mac OS X'), browser('Chrome', 'Xbox 360 Controller (XInput STANDARD GAMEPAD)', 'Windows NT'), ], - axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), - buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), + axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), + buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), gamepad('Xbox 360 Firefox Linux', [ browser('Firefox', '045e-028e-Microsoft X-Box 360 pad', 'Linux'), ], - axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), - buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), + axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), + buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), gamepad('Xbox 360 FF Windows', [ browser('Firefox', 'xinput', 'Windows NT'), ], - axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), - buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), + axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), + buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), ]; diff --git a/src/ts/graphics/webgl/shader.ts b/src/ts/graphics/webgl/shader.ts index 7131e2d..f8b612f 100644 --- a/src/ts/graphics/webgl/shader.ts +++ b/src/ts/graphics/webgl/shader.ts @@ -56,7 +56,7 @@ export class Shader { const attribs = vertexCode.match(/^attribute [a-zA-Z0-9_]+ ([a-zA-Z0-9_]+)/mg)!; - for (var i = 0; i < attribs.length; ++i) { + for (let i = 0; i < attribs.length; ++i) { const [, name] = /attribute [a-zA-Z0-9_]+ ([a-zA-Z0-9_]+)/.exec(attribs[i])!; gl.bindAttribLocation(program, i, name); } @@ -121,4 +121,4 @@ export function disposeShaderProgramData(gl: WebGLRenderingContext, data: Shader } catch (e) { DEVELOPMENT && console.error(e); } -} \ No newline at end of file +} diff --git a/src/ts/server/api/admin.ts b/src/ts/server/api/admin.ts index 15a501c..a6fb996 100644 --- a/src/ts/server/api/admin.ts +++ b/src/ts/server/api/admin.ts @@ -116,7 +116,7 @@ export async function getChat(search: string, date: string, caseInsensitive: boo const options = { maxBuffer: 1 * 1024 * 1024 }; // 1MB async function fetchChatlog(lines: number) { - const logFile = paths.pathTo('logs', `info.${format(date, 'yyyyMMdd')}.log`) + const logFile = paths.pathTo('logs', `info.${format(date, 'yyyyMMdd')}.log`); const { stdout } = await execAsync(`grep ${flags}"${query}" "${logFile}" | tail -n ${lines}`, options); return stdout; } @@ -243,13 +243,13 @@ export async function getAccountDetails(accountId: ID): Promise invitesSent: invitesSent!.map(convertInvite), state: account.state || {}, } : { - merges: [], - banLog: [], - supporterLog: [], - invitesReceived: [], - invitesSent: [], - state: {}, - }; + merges: [], + banLog: [], + supporterLog: [], + invitesReceived: [], + invitesSent: [], + state: {}, + }; } export async function getOtherStats(service: AdminService): Promise { diff --git a/src/ts/server/config.ts b/src/ts/server/config.ts index 29c94e4..52f675b 100644 --- a/src/ts/server/config.ts +++ b/src/ts/server/config.ts @@ -96,7 +96,7 @@ if (!DEVELOPMENT && !TESTS && || INSECURE_RANDOM_VALUES.includes(config.secret) || INSECURE_RANDOM_VALUES.includes(config.token))) { console.error( -` + ` ================================================================================ WARNING! WARNING! WARNING! diff --git a/src/ts/server/controllerUtils.ts b/src/ts/server/controllerUtils.ts index 05d0030..d8b17ee 100644 --- a/src/ts/server/controllerUtils.ts +++ b/src/ts/server/controllerUtils.ts @@ -115,25 +115,25 @@ export function createWoodenFenceMaker(world: World, map: ServerMap) { ...repeat(2, entities.woodenFencePole4), entities.woodenFencePole5, ], [ - ...repeat(5, entities.woodenFenceBeamH1), - ...repeat(5, entities.woodenFenceBeamH2), - ...repeat(5, entities.woodenFenceBeamH3), - entities.woodenFenceBeamH4, - entities.woodenFenceBeamH5, - entities.woodenFenceBeamH6, - ], [ - entities.woodenFenceBeamV1, - entities.woodenFenceBeamV2, - entities.woodenFenceBeamV3, - ]); + ...repeat(5, entities.woodenFenceBeamH1), + ...repeat(5, entities.woodenFenceBeamH2), + ...repeat(5, entities.woodenFenceBeamH3), + entities.woodenFenceBeamH4, + entities.woodenFenceBeamH5, + entities.woodenFenceBeamH6, + ], [ + entities.woodenFenceBeamV1, + entities.woodenFenceBeamV2, + entities.woodenFenceBeamV3, + ]); } export function createStoneWallFenceMaker(world: World, map: ServerMap) { return createFenceMaker(world, map, 2, [ entities.stoneWallPole1, ], [ - entities.stoneWallBeamH1, - ], [ - entities.stoneWallBeamV1, - ]); + entities.stoneWallBeamH1, + ], [ + entities.stoneWallBeamV1, + ]); } diff --git a/src/ts/server/controllers/collectableController.ts b/src/ts/server/controllers/collectableController.ts index 0b43133..034334c 100644 --- a/src/ts/server/controllers/collectableController.ts +++ b/src/ts/server/controllers/collectableController.ts @@ -68,5 +68,5 @@ export class CollectableController implements Controller { this.pick(client, entity); } } - } + }; } diff --git a/src/ts/server/controllers/plantController.ts b/src/ts/server/controllers/plantController.ts index 6505d86..5edf007 100644 --- a/src/ts/server/controllers/plantController.ts +++ b/src/ts/server/controllers/plantController.ts @@ -25,8 +25,8 @@ export class PlantController implements Controller { private interact: Interact = (entity, client) => { this.world.removeEntity(entity, this.map); removeItem(this.plants, entity); - this.config.onPick && this.config.onPick(entity, client); - } + this.config?.onPick?.(entity, client); + }; private nextSpawn = 0; constructor(private world: World, private map: ServerMap, private config: PlantConfig) { } diff --git a/src/ts/server/routes/auth.ts b/src/ts/server/routes/auth.ts index 536046e..322a9fc 100644 --- a/src/ts/server/routes/auth.ts +++ b/src/ts/server/routes/auth.ts @@ -350,7 +350,7 @@ export function authRoutes( app.post('/create-account', wrap(server, async (data) => { const accountCount = await Account.countDocuments(); - + const account = await Account.create({ name: data.body.name, roles: accountCount === 0 ? ['superadmin'] : undefined @@ -359,11 +359,11 @@ export function authRoutes( return [account._id.toString(), account.name]; })); - passport.use(new LocalStrategy((login, _pass, done) => + passport.use(new LocalStrategy((login, _pass, done) => Account.findById(login) .then(data => done(undefined, data as any)) .catch(e => done(e))) - ); + ); app.get('/local', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/failed-login' })); } diff --git a/src/ts/server/server.ts b/src/ts/server/server.ts index 2173d13..806ad8b 100644 --- a/src/ts/server/server.ts +++ b/src/ts/server/server.ts @@ -160,7 +160,7 @@ app.use(require('cookie-parser')()); if (args.login || args.admin) { passport.serializeUser((account, done) => done(null, (account as IAccount)._id.toString())); - passport.deserializeUser(async (id, done) => { + passport.deserializeUser(async (id, done) => { try { const account = await Account.findById(id).exec(); done(undefined, account && !isBanned(account) ? account : false); diff --git a/src/ts/server/stats.ts b/src/ts/server/stats.ts index efedc82..7ee87a1 100644 --- a/src/ts/server/stats.ts +++ b/src/ts/server/stats.ts @@ -84,19 +84,19 @@ export class StatsTracker { this.logStat( url || (req.baseUrl + req.path), typeof result === 'string' ? result.length : JSON.stringify(result).length); } - } + }; logSwearing = () => { this.dailySwearing++; - } + }; logSpamming = () => { this.dailySpamming++; - } + }; logRecvStats = (id: number, name: string, binary: boolean, size: number) => { this.logSocketStats(this.recvStats, id, name, binary, size); - } + }; logSendStats = (id: number, name: string, binary: boolean, size: number) => { this.logSocketStats(this.sendStats, id, name, binary, size); - } + }; private logSocketStats(stats: (SocketStats | undefined)[], id: number, name: string, binary: boolean, size: number) { const entry = stats[id] || (stats[id] = { id, @@ -112,7 +112,7 @@ export class StatsTracker { lastHourSize: new ByteSize(), }); - if (!!binary) { + if (binary) { entry.countBin++; } else { entry.countStr++; diff --git a/src/ts/tests/common/compressPony.spec.ts b/src/ts/tests/common/compressPony.spec.ts index 7b8499c..33ff3f9 100644 --- a/src/ts/tests/common/compressPony.spec.ts +++ b/src/ts/tests/common/compressPony.spec.ts @@ -201,24 +201,24 @@ describe('compressPony', () => { lockEyeColor: true, lockCoatOutline: true, }, { - customOutlines: true, - lockEyes: true, - lockEyeColor: true, - lockCoatOutline: true, - coatOutline: undefined, - eyeColorLeft: undefined, - eyeOpennessLeft: undefined, - eyeWhitesLeft: undefined, - eyelashColorLeft: undefined, - })); + customOutlines: true, + lockEyes: true, + lockEyeColor: true, + lockCoatOutline: true, + coatOutline: undefined, + eyeColorLeft: undefined, + eyeOpennessLeft: undefined, + eyeWhitesLeft: undefined, + eyelashColorLeft: undefined, + })); it('removes lockBackLegAccessory', test({ lockBackLegAccessory: true }, { - coatOutline: undefined, - eyeWhitesLeft: undefined, - eyelashColorLeft: undefined, - })); + coatOutline: undefined, + eyeWhitesLeft: undefined, + eyelashColorLeft: undefined, + })); it('set', test({ customOutlines: true, @@ -243,19 +243,19 @@ describe('compressPony', () => { pattern: 1 } }, { - customOutlines: true, - lockCoatOutline: false, - eyeWhitesLeft: undefined, - eyelashColorLeft: undefined, - tail: { - type: 1, - pattern: 1, - fills: [BLACK, BLACK, BLACK, BLACK, BLACK], - lockFills: [false, false, false, false, false, false], - outlines: [BLACK, BLACK, BLACK, BLACK, BLACK], - lockOutlines: [false, false, false, false, false, true], - } - })); + customOutlines: true, + lockCoatOutline: false, + eyeWhitesLeft: undefined, + eyelashColorLeft: undefined, + tail: { + type: 1, + pattern: 1, + fills: [BLACK, BLACK, BLACK, BLACK, BLACK], + lockFills: [false, false, false, false, false, false], + outlines: [BLACK, BLACK, BLACK, BLACK, BLACK], + lockOutlines: [false, false, false, false, false, true], + } + })); it('missing set color', test({ customOutlines: true, @@ -268,29 +268,29 @@ describe('compressPony', () => { lockOutlines: [false, false, false, false, false, true], } }, { - customOutlines: true, - lockCoatOutline: false, - eyeWhitesLeft: undefined, - eyelashColorLeft: undefined, - tail: { - type: 1, - pattern: 1, - fills: [RED, BLUE, BLACK, ORANGE, CYAN], - lockFills: [false, false, false, false, false, false], - outlines: [RED, BLACK, RED, RED, RED], - lockOutlines: [false, false, false, false, false, true], - } - })); + customOutlines: true, + lockCoatOutline: false, + eyeWhitesLeft: undefined, + eyelashColorLeft: undefined, + tail: { + type: 1, + pattern: 1, + fills: [RED, BLUE, BLACK, ORANGE, CYAN], + lockFills: [false, false, false, false, false, false], + outlines: [RED, BLACK, RED, RED, RED], + lockOutlines: [false, false, false, false, false, true], + } + })); it('cm', test({ cm: [undefined, RED, undefined, BLUE] as any, }, { - cm: [TRANSPARENT, RED, TRANSPARENT, BLUE], - cmFlip: false, - coatOutline: undefined, - eyeWhitesLeft: undefined, - eyelashColorLeft: undefined, - })); + cm: [TRANSPARENT, RED, TRANSPARENT, BLUE], + cmFlip: false, + coatOutline: undefined, + eyeWhitesLeft: undefined, + eyelashColorLeft: undefined, + })); }); describe('decompressPony()', () => { @@ -345,51 +345,51 @@ describe('compressPony', () => { it('eyeColorLeft', test({ eyeColorLeft: 'ff00ff', }, { - coatFill: '000000', - coatOutline: '000000', - eyeColorLeft: 'ff00ff', - eyeColorRight: '000000', - })); + coatFill: '000000', + coatOutline: '000000', + eyeColorLeft: 'ff00ff', + eyeColorRight: '000000', + })); it('eyeColorLeft + eyeColorRight', test({ eyeColorLeft: 'ff00ff', eyeColorRight: '00ff00', }, { - coatFill: '000000', - coatOutline: '000000', - eyeColorLeft: 'ff00ff', - eyeColorRight: '00ff00', - })); + coatFill: '000000', + coatOutline: '000000', + eyeColorLeft: 'ff00ff', + eyeColorRight: '00ff00', + })); it('eyeColorLeft + eyeColorRight (locked)', test({ lockEyeColor: true, eyeColorLeft: '00ff00', eyeColorRight: 'ff00ff', }, { - lockEyes: false, - lockEyeColor: true, - customOutlines: false, - coatFill: '000000', - coatOutline: '000000', - eyeColorLeft: 'ff00ff', - eyeColorRight: 'ff00ff', - })); + lockEyes: false, + lockEyeColor: true, + customOutlines: false, + coatFill: '000000', + coatOutline: '000000', + eyeColorLeft: 'ff00ff', + eyeColorRight: 'ff00ff', + })); it('eyeshadow', test({ eyeshadow: true, eyeshadowColor: 'ff00ff', }, { - eyeshadow: true, - eyeshadowColor: 'ff00ff', - coatFill: '000000', - coatOutline: '000000', - eyeColorLeft: '000000', - eyeColorRight: '000000', - eyeWhites: 'ffffff', - lockEyes: false, - lockEyeColor: false, - customOutlines: false, - })); + eyeshadow: true, + eyeshadowColor: 'ff00ff', + coatFill: '000000', + coatOutline: '000000', + eyeColorLeft: '000000', + eyeColorRight: '000000', + eyeWhites: 'ffffff', + lockEyes: false, + lockEyeColor: false, + customOutlines: false, + })); it('cm', test({ cm: ['ff0000', '', '00ff00'] }, { cm: ['ff0000', '', '00ff00'], cmFlip: false })); @@ -397,9 +397,9 @@ describe('compressPony', () => { cm: ['ff0000', '', '00ff00'], cmFlip: true, }, { - cm: ['ff0000', '', '00ff00'], - cmFlip: true, - })); + cm: ['ff0000', '', '00ff00'], + cmFlip: true, + })); it('all locked', test({ tail: { @@ -409,15 +409,15 @@ describe('compressPony', () => { lockFills: [true, true, true, true, true, true], } }, { - tail: { - type: 2, - pattern: 1, - fills: [undefined, undefined, undefined, undefined, undefined, undefined], - lockFills: [true, true, true, true, true, true], - outlines: [undefined, undefined, undefined, undefined, undefined, undefined], - lockOutlines: [true, true, true, true, true, true], - } - })); + tail: { + type: 2, + pattern: 1, + fills: [undefined, undefined, undefined, undefined, undefined, undefined], + lockFills: [true, true, true, true, true, true], + outlines: [undefined, undefined, undefined, undefined, undefined, undefined], + lockOutlines: [true, true, true, true, true, true], + } + })); it('set', test({ mane: { @@ -427,15 +427,15 @@ describe('compressPony', () => { lockFills: [false, false, false, false, false, false], } }, { - mane: { - type: 1, - pattern: 1, - fills: ['f0f0f0', 'ff0000', 'fff000', 'ff0f00', 'ff00f0', 'ff000f'], - lockFills: [false, false, false, false, false, false], - outlines: ['a8a8a8', 'b30000', 'b3a800', 'b30b00', 'b300a8', 'b3000a'], - lockOutlines: [true, true, true, true, true, true], - } - })); + mane: { + type: 1, + pattern: 1, + fills: ['f0f0f0', 'ff0000', 'fff000', 'ff0f00', 'ff00f0', 'ff000f'], + lockFills: [false, false, false, false, false, false], + outlines: ['a8a8a8', 'b30000', 'b3a800', 'b30b00', 'b300a8', 'b3000a'], + lockOutlines: [true, true, true, true, true, true], + } + })); it('0 colors', test({ ears: { @@ -445,15 +445,15 @@ describe('compressPony', () => { lockFills: [false], } }, { - ears: { - type: 0, - pattern: 0, - fills: ['000000'], - lockFills: [false, false, false, false, false, false], - outlines: ['000000', undefined, undefined, undefined, undefined, undefined], - lockOutlines: [true, true, true, true, true, true], - } - })); + ears: { + type: 0, + pattern: 0, + fills: ['000000'], + lockFills: [false, false, false, false, false, false], + outlines: ['000000', undefined, undefined, undefined, undefined, undefined], + lockOutlines: [true, true, true, true, true, true], + } + })); it('extraAccessory', test({ extraAccessory: { @@ -463,15 +463,15 @@ describe('compressPony', () => { lockFills: [false, false, false, false, false], } }, { - extraAccessory: { - type: 0, - pattern: 0, - fills: ['f0f0f0', 'ff0000', 'fff000', 'ff0f00', 'ff00f0'], - lockFills: [false, false, false, false, false, false], - outlines: ['a8a8a8', 'b30000', 'b3a800', 'b30b00', 'b300a8', undefined], - lockOutlines: [true, true, true, true, true, true], - } - })); + extraAccessory: { + type: 0, + pattern: 0, + fills: ['f0f0f0', 'ff0000', 'fff000', 'ff0f00', 'ff00f0'], + lockFills: [false, false, false, false, false, false], + outlines: ['a8a8a8', 'b30000', 'b3a800', 'b30b00', 'b300a8', undefined], + lockOutlines: [true, true, true, true, true, true], + } + })); it('neckAccessory', test({ neckAccessory: { type: 0, pattern: 0 } @@ -491,23 +491,23 @@ describe('compressPony', () => { lockFills: [true, false, true], }, }, { - mane: { - type: 1, - pattern: 0, - fills: ['ff0000'], - lockFills: [false, false, false, false, false, false], - outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], - lockOutlines: [true, true, true, true, true, true], - }, - backMane: { - type: 15, - pattern: 1, - fills: ['ff0000', '00ff00', 'ff0000'], - lockFills: [true, false, true, false, false, false], - outlines: ['b30000', '00b300', 'b30000', undefined, undefined, undefined], - lockOutlines: [true, true, true, true, true, true], - }, - })); + mane: { + type: 1, + pattern: 0, + fills: ['ff0000'], + lockFills: [false, false, false, false, false, false], + outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], + lockOutlines: [true, true, true, true, true, true], + }, + backMane: { + type: 15, + pattern: 1, + fills: ['ff0000', '00ff00', 'ff0000'], + lockFills: [true, false, true, false, false, false], + outlines: ['b30000', '00b300', 'b30000', undefined, undefined, undefined], + lockOutlines: [true, true, true, true, true, true], + }, + })); it('locked back hooves', test({ frontHooves: { @@ -521,23 +521,23 @@ describe('compressPony', () => { lockFills: [true], } }, { - frontHooves: { - type: 0, - pattern: 0, - fills: ['ff0000'], - lockFills: [false, false, false, false, false, false], - outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], - lockOutlines: [true, true, true, true, true, true], - }, - backHooves: { - type: 1, - pattern: 0, - fills: ['ff0000'], - lockFills: [true, false, false, false, false, false], - outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], - lockOutlines: [true, true, true, true, true, true], - } - })); + frontHooves: { + type: 0, + pattern: 0, + fills: ['ff0000'], + lockFills: [false, false, false, false, false, false], + outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], + lockOutlines: [true, true, true, true, true, true], + }, + backHooves: { + type: 1, + pattern: 0, + fills: ['ff0000'], + lockFills: [true, false, false, false, false, false], + outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], + lockOutlines: [true, true, true, true, true, true], + } + })); it('back mane', test({ mane: { @@ -552,23 +552,23 @@ describe('compressPony', () => { lockFills: [false, false, true, true, true, true], } }, { - mane: { - type: 3, - pattern: 1, - fills: ['000000', 'ffffff', '000000', '000000', '000000', '000000'], - lockFills: [false, false, false, false, false, false], - outlines: ['000000', 'b3b3b3', '000000', '000000', '000000', '000000'], - lockOutlines: [true, true, true, true, true, true], - }, - backMane: { - type: 2, - pattern: 1, - fills: ['ffffff', 'ff0000', 'ffffff', 'ffffff', 'ffffff', 'ffffff'], - lockFills: [false, false, true, true, true, true], - outlines: ['b3b3b3', 'b30000', 'b3b3b3', 'b3b3b3', 'b3b3b3', 'b3b3b3'], - lockOutlines: [true, true, true, true, true, true], - } - })); + mane: { + type: 3, + pattern: 1, + fills: ['000000', 'ffffff', '000000', '000000', '000000', '000000'], + lockFills: [false, false, false, false, false, false], + outlines: ['000000', 'b3b3b3', '000000', '000000', '000000', '000000'], + lockOutlines: [true, true, true, true, true, true], + }, + backMane: { + type: 2, + pattern: 1, + fills: ['ffffff', 'ff0000', 'ffffff', 'ffffff', 'ffffff', 'ffffff'], + lockFills: [false, false, true, true, true, true], + outlines: ['b3b3b3', 'b30000', 'b3b3b3', 'b3b3b3', 'b3b3b3', 'b3b3b3'], + lockOutlines: [true, true, true, true, true, true], + } + })); it('chest accessory (adds default sleeve if missing)', test({ chestAccessory: { @@ -577,23 +577,23 @@ describe('compressPony', () => { fills: ['ff0000', '00ff00', '0000ff'], } }, { - chestAccessory: { - type: 2, - pattern: 8, - fills: ['ff0000', '00ff00', '0000ff'], - lockFills: [false, false, false, false, false, false], - outlines: ['b30000', '00b300', '0000b3', undefined, undefined, undefined], - lockOutlines: [true, true, true, true, true, true], - }, - sleeveAccessory: { - type: 0, - pattern: 0, - fills: ['ff0000', 'ff0000', 'ff0000', 'ff0000', 'ff0000', 'ff0000'], - lockFills: [true, true, true, true, true, true], - outlines: ['b30000', 'b30000', 'b30000', 'b30000', 'b30000', 'b30000'], - lockOutlines: [true, true, true, true, true, true], - } - })); + chestAccessory: { + type: 2, + pattern: 8, + fills: ['ff0000', '00ff00', '0000ff'], + lockFills: [false, false, false, false, false, false], + outlines: ['b30000', '00b300', '0000b3', undefined, undefined, undefined], + lockOutlines: [true, true, true, true, true, true], + }, + sleeveAccessory: { + type: 0, + pattern: 0, + fills: ['ff0000', 'ff0000', 'ff0000', 'ff0000', 'ff0000', 'ff0000'], + lockFills: [true, true, true, true, true, true], + outlines: ['b30000', 'b30000', 'b30000', 'b30000', 'b30000', 'b30000'], + lockOutlines: [true, true, true, true, true, true], + } + })); it('back leg accessory', test({ backLegAccessory: { @@ -603,16 +603,16 @@ describe('compressPony', () => { lockFills: [false], } }, { - lockBackLegAccessory: false, - backLegAccessory: { - type: 1, - pattern: 0, - fills: ['ff0000'], - lockFills: [false, false, false, false, false, false], - outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], - lockOutlines: [true, true, true, true, true, true], - } - })); + lockBackLegAccessory: false, + backLegAccessory: { + type: 1, + pattern: 0, + fills: ['ff0000'], + lockFills: [false, false, false, false, false, false], + outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], + lockOutlines: [true, true, true, true, true, true], + } + })); it('cm (with undefined)', test({ cm: [ @@ -623,15 +623,15 @@ describe('compressPony', () => { , , 'fde9cd', , ] as any }, { - cm: [ - '', '', '', 'fde9cd', '', - 'fde9cd', '', '', '', '', - '', '', 'fde9cd', '', 'fde9cd', - '', '', '', '', '', - '', '', 'fde9cd' - ], - cmFlip: false, - })); + cm: [ + '', '', '', 'fde9cd', '', + 'fde9cd', '', '', '', '', + '', '', 'fde9cd', '', 'fde9cd', + '', '', '', '', '', + '', '', 'fde9cd' + ], + cmFlip: false, + })); it('back leg accessory (editable)', () => { const data = compressPonyString({ diff --git a/src/ts/tests/graphics/spriteSheetUtils.spec.ts b/src/ts/tests/graphics/spriteSheetUtils.spec.ts index f0d369d..f7ff0f4 100644 --- a/src/ts/tests/graphics/spriteSheetUtils.spec.ts +++ b/src/ts/tests/graphics/spriteSheetUtils.spec.ts @@ -45,7 +45,7 @@ describe('spriteSheetUtils', () => { const createTexture = stub().returns({}); const sheet: SpriteSheet[] = [ { sprites: [undefined] as any, src: 'foo', data: createImageData(), - isSingleChannel: false, texture: undefined, palette: false }, + isSingleChannel: false, texture: undefined, palette: false }, ]; createTexturesForSpriteSheets({} as any, sheet, createTexture); diff --git a/src/ts/tools/create-sprites.ts b/src/ts/tools/create-sprites.ts index 2bf7057..8a521be 100644 --- a/src/ts/tools/create-sprites.ts +++ b/src/ts/tools/create-sprites.ts @@ -140,7 +140,7 @@ function getEyesFromPsd({ objects2, sprites }: Result, eyesPsd: Psd, irisesPsd: // const mirrored = (get: ByIndexGetter): ByIndexGetter => (canvas, index) => mirrorCanvas(get(canvas, index), -15); - const palette = [0, WHITE, BLACK]; // + const palette = [0, WHITE, BLACK]; // const getEye = (get: ByIndexGetter) => (i: number) => bases.map(base => { const s = addSprite(sprites, get(shadow, i), undefined, palette); diff --git a/src/ts/tools/name-tester.ts b/src/ts/tools/name-tester.ts index fdc5cba..f58ba03 100644 --- a/src/ts/tools/name-tester.ts +++ b/src/ts/tools/name-tester.ts @@ -24,7 +24,7 @@ function ignore(code: number): boolean { || (code >= 0x0250 && code <= 0x02AF) // IPA Extensions || (code >= 0x2460 && code <= 0x24FF) // Enclosed Alphanumerics || (code >= 0x2300 && code <= 0x23FF) // Miscellaneous Technical - ; + ; } charsToCodes(CHARS + ROMAJI + EMOJI).forEach(code => existing.add(code));