Greatly improved server code base
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import { BaseCommand } from '#application/base/baseCommand'
|
||||
|
||||
type CommandInput = string[]
|
||||
|
||||
export default class AlertCommand {
|
||||
constructor(private readonly io: Server) {}
|
||||
|
||||
export default class AlertCommand extends BaseCommand {
|
||||
public execute(input: CommandInput): void {
|
||||
const message: string = input.join(' ') ?? null
|
||||
if (!message) return console.log('message is required')
|
||||
|
@ -3,6 +3,7 @@ import fs from 'fs'
|
||||
import sharp from 'sharp'
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import { BaseCommand } from '#application/base/baseCommand'
|
||||
import { CharacterGender, CharacterRace } from '#application/enums'
|
||||
import { getPublicPath } from '#application/storage'
|
||||
import { UUID } from '#application/types'
|
||||
@ -23,9 +24,7 @@ import ZoneRepository from '#repositories/zoneRepository'
|
||||
// @TODO : Replace this with seeding
|
||||
// https://mikro-orm.io/docs/seeding
|
||||
|
||||
export default class InitCommand {
|
||||
constructor(private readonly io: Server) {}
|
||||
|
||||
export default class InitCommand extends BaseCommand {
|
||||
public async execute(): Promise<void> {
|
||||
// Assets
|
||||
await this.importTiles()
|
||||
|
@ -1,12 +1,11 @@
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import { BaseCommand } from '#application/base/baseCommand'
|
||||
import ZoneManager from '#managers/zoneManager'
|
||||
|
||||
type CommandInput = string[]
|
||||
|
||||
export default class ListZonesCommand {
|
||||
constructor(private readonly io: Server) {}
|
||||
|
||||
export default class ListZonesCommand extends BaseCommand {
|
||||
public execute(input: CommandInput): void {
|
||||
console.log(ZoneManager.getLoadedZones())
|
||||
}
|
||||
|
@ -4,12 +4,11 @@ import path from 'path'
|
||||
import sharp from 'sharp'
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import { BaseCommand } from '#application/base/baseCommand'
|
||||
import { commandLogger } from '#application/logger'
|
||||
import { getPublicPath } from '#application/storage'
|
||||
|
||||
export default class TilesCommand {
|
||||
constructor(private readonly io: Server) {}
|
||||
|
||||
export default class TilesCommand extends BaseCommand {
|
||||
public async execute(): Promise<void> {
|
||||
// Get all tiles
|
||||
const tilesDir = getPublicPath('tiles')
|
||||
|
Reference in New Issue
Block a user