mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Lint code
This commit is contained in:
+2
-1
@@ -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",
|
||||
|
||||
@@ -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();
|
||||
(module as any).hot.accept();
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isError } from "../common/utils";
|
||||
import { isError } from '../common/utils';
|
||||
|
||||
export interface Game {
|
||||
fps: number;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -294,12 +294,12 @@ function syncLockedBasePonyInfo<T>(
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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]
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export class AdminModel {
|
||||
console.error(error);
|
||||
this.error = error.message;
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
private checkError = <T>(promise: Promise<T>) => promise.catch(this.handleError) as Promise<T | undefined>;
|
||||
private running = true;
|
||||
private initializedLive = false;
|
||||
|
||||
@@ -43,9 +43,9 @@ function getTracks(season: Season, holiday: Holiday, map: MapType) {
|
||||
'trees-winter',
|
||||
'reindeer-winter',
|
||||
] : [
|
||||
'trees',
|
||||
'reindeer',
|
||||
]),
|
||||
'trees',
|
||||
'reindeer',
|
||||
]),
|
||||
'season',
|
||||
'ambient',
|
||||
'building',
|
||||
|
||||
@@ -467,7 +467,7 @@ export class Model {
|
||||
|
||||
this.pending = true;
|
||||
|
||||
const alert = !!this.accountAlert ? 'y' : '';
|
||||
const alert = this.accountAlert ? 'y' : '';
|
||||
|
||||
return this.post<JoinResponse>('/api/game/join', { version, ponyId, serverId, alert, url: location.href })
|
||||
.finally(() => this.pending = false);
|
||||
|
||||
@@ -102,7 +102,7 @@ export class CharacterPreview implements OnDestroy, OnChanges, AfterViewInit {
|
||||
this.lastFrame = now;
|
||||
this.tryDraw();
|
||||
}
|
||||
}
|
||||
};
|
||||
private tryDraw() {
|
||||
try {
|
||||
this.draw();
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -199,7 +199,7 @@ export class Dropdown {
|
||||
} else if (this.autoClose && e.keyCode === 27) { // esc
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
private canvasCloseHandler: any = () => this.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,5 +54,5 @@ export class FocusTrap implements OnInit, OnDestroy {
|
||||
this.lastActiveElement.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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]`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,5 +170,5 @@ export class ToolsRegions implements OnInit, OnDestroy {
|
||||
this.player.y += dy * delta * PONY_SPEED_TROT;
|
||||
this.update();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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)),
|
||||
];
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<AccountDetails>
|
||||
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<OtherStats> {
|
||||
|
||||
@@ -96,7 +96,7 @@ if (!DEVELOPMENT && !TESTS &&
|
||||
|| INSECURE_RANDOM_VALUES.includes(config.secret)
|
||||
|| INSECURE_RANDOM_VALUES.includes(config.token))) {
|
||||
console.error(
|
||||
`
|
||||
`
|
||||
================================================================================
|
||||
WARNING! WARNING! WARNING!
|
||||
|
||||
|
||||
@@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -68,5 +68,5 @@ export class CollectableController implements Controller {
|
||||
this.pick(client, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ export function authRoutes(
|
||||
Account.findById(login)
|
||||
.then(data => done(undefined, data as any))
|
||||
.catch(e => done(e)))
|
||||
);
|
||||
);
|
||||
|
||||
app.get('/local', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/failed-login' }));
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ app.use(require('cookie-parser')());
|
||||
|
||||
if (args.login || args.admin) {
|
||||
passport.serializeUser<string>((account, done) => done(null, (account as IAccount)._id.toString()));
|
||||
passport.deserializeUser<string>(async (id, done) => {
|
||||
passport.deserializeUser<string>(async (id, done) => {
|
||||
try {
|
||||
const account = await Account.findById(id).exec();
|
||||
done(undefined, account && !isBanned(account) ? account : false);
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user