forked from noxious/server
Compare commits
22 Commits
feature/mo
...
feature/#3
Author | SHA1 | Date | |
---|---|---|---|
47be8597bf | |||
2ce9bbdedd | |||
3f8d36db5a | |||
fc91eb9873 | |||
606328dbef | |||
b508370eec | |||
22b776ef0f | |||
f76bf3df1f | |||
7da0323153 | |||
26405433a8 | |||
4e7e13d6f4 | |||
785a232776 | |||
14d296e5a9 | |||
8cca44a3b4 | |||
d75ed7a44f | |||
e21c03ee3b | |||
deac2892fb | |||
e40a56825a | |||
c47339dfcd | |||
fef0ae6e28 | |||
bebd5876da | |||
fedb5c154b |
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@ -0,0 +1 @@
|
||||
migrations
|
@ -4,5 +4,8 @@
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"printWidth": 200,
|
||||
"trailingComma": "none"
|
||||
"trailingComma": "none",
|
||||
"plugins": ["@ianvs/prettier-plugin-sort-imports"],
|
||||
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy", "classProperties"],
|
||||
"importOrderCaseSensitive": false
|
||||
}
|
@ -39,15 +39,15 @@ MikroORM is used as the ORM for the server.
|
||||
|
||||
### Create init. migrations
|
||||
|
||||
Run `npx mikro-orm-esm migration:create --initial` to create a new initial migration.
|
||||
Run `npm run mikro-orm migration:create --initial` to create a new initial migration.
|
||||
|
||||
### Create migrations
|
||||
|
||||
Run `npx mikro-orm-esm migration:create` to create a new migration. You do this when you want to add a new table or change an existing one.
|
||||
Run `npm run mikro-orm migration:create` to create a new migration. You do this when you want to add a new table or change an existing one.
|
||||
|
||||
### Apply migrations
|
||||
|
||||
Run `npx mikro-orm-esm migration:up` to apply all pending migrations.
|
||||
Run `npm run mikro-orm migration:up` to apply all pending migrations.
|
||||
|
||||
### Import default data
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
import eslint from '@eslint/js';
|
||||
import tseslint from '@typescript-eslint/eslint-plugin';
|
||||
import tsparser from '@typescript-eslint/parser';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
|
||||
export default [
|
||||
eslint.configs.recommended,
|
||||
{
|
||||
files: ['**/*.ts'],
|
||||
languageOptions: {
|
||||
parser: tsparser,
|
||||
parserOptions: {
|
||||
project: './tsconfig.json',
|
||||
ecmaVersion: 2023,
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
'@typescript-eslint': tseslint,
|
||||
'import': importPlugin,
|
||||
},
|
||||
rules: {
|
||||
...tseslint.configs['recommended'].rules,
|
||||
...tseslint.configs['recommended-requiring-type-checking'].rules,
|
||||
'import/order': ['error', {
|
||||
'groups': [
|
||||
'builtin',
|
||||
'external',
|
||||
'internal',
|
||||
['parent', 'sibling'],
|
||||
'index',
|
||||
'object',
|
||||
'type'
|
||||
],
|
||||
'newlines-between': 'always',
|
||||
'alphabetize': {
|
||||
'order': 'asc',
|
||||
'caseInsensitive': true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
];
|
3233
package-lock.json
generated
3233
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@ -5,22 +5,7 @@
|
||||
"start": "tsx src/server.ts",
|
||||
"dev": "nodemon --exec tsx src/server.ts",
|
||||
"format": "prettier --write src/",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix"
|
||||
},
|
||||
"imports": {
|
||||
"#root/*": "./src/*.js",
|
||||
"#application/*": "./src/application/*.js",
|
||||
"#commands/*": "./src/commands/*.js",
|
||||
"#entities/*": "./src/entities/*.js",
|
||||
"#controllers/*": "./src/controllers/*.js",
|
||||
"#jobs/*": "./src/jobs/*.js",
|
||||
"#managers/*": "./src/managers/*.js",
|
||||
"#middleware/*": "./src/middleware/*.js",
|
||||
"#models/*": "./src/models/*.js",
|
||||
"#repositories/*": "./src/repositories/*.js",
|
||||
"#services/*": "./src/services/*.js",
|
||||
"#events/*": "./src/events/*.js"
|
||||
"mikro-orm": "tsx ./node_modules/.bin/mikro-orm-esm"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mikro-orm/cli": "^6.4.2",
|
||||
@ -44,22 +29,18 @@
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"sharp": "^0.33.4",
|
||||
"socket.io": "^4.7.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.5.3",
|
||||
"utf-8-validate": "^6.0.5",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-node": "^10.9.2",
|
||||
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/jsonwebtoken": "^9.0.6",
|
||||
"@types/node": "^20.14.11",
|
||||
"@types/nodemailer": "^6.4.16",
|
||||
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
||||
"@typescript-eslint/parser": "^8.18.2",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"nodemon": "^3.1.4",
|
||||
"prettier": "^3.3.3",
|
||||
"tsx": "^4.19.2"
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
|
||||
export abstract class BaseCommand {
|
||||
protected readonly logger = Logger.type(LoggerType.COMMAND)
|
||||
constructor(readonly io: Server) {}
|
||||
|
@ -1,9 +1,7 @@
|
||||
import fs from 'fs'
|
||||
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
import type { Response } from 'express'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
|
||||
export abstract class BaseController {
|
||||
protected readonly logger = Logger.type(LoggerType.HTTP)
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import Database from '@/application/database'
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
import { EntityManager } from '@mikro-orm/core'
|
||||
|
||||
import Database from '#application/database'
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
|
||||
export abstract class BaseEntity {
|
||||
protected readonly logger = Logger.type(LoggerType.ENTITY)
|
||||
protected entityManager?: EntityManager
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
import type { TSocket } from '@/application/types'
|
||||
import { Character } from '@/entities/character'
|
||||
import MapManager from '@/managers/mapManager'
|
||||
import type MapCharacter from '@/models/mapCharacter'
|
||||
import CharacterRepository from '@/repositories/characterRepository'
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import type { TSocket } from '#application/types'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import { Character } from '#entities/character'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
|
||||
export abstract class BaseEvent {
|
||||
protected readonly logger = Logger.type(LoggerType.GAME)
|
||||
private lastActionTimes: Map<string, number> = new Map()
|
||||
@ -29,9 +29,15 @@ export abstract class BaseEvent {
|
||||
return false
|
||||
}
|
||||
|
||||
protected getMapCharacter(): MapCharacter | null {
|
||||
if (!this.socket.characterId) return null
|
||||
return MapManager.getCharacterById(this.socket.characterId)
|
||||
}
|
||||
|
||||
protected async getCharacter(): Promise<Character | null> {
|
||||
if (!this.socket.characterId) return null
|
||||
const characterRepository = new CharacterRepository()
|
||||
return characterRepository.getById(this.socket.characterId!)
|
||||
return characterRepository.getById(this.socket.characterId)
|
||||
}
|
||||
|
||||
protected async isCharacterGM(): Promise<boolean> {
|
||||
|
@ -1,8 +1,7 @@
|
||||
import Database from '@/application/database'
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
import { EntityManager } from '@mikro-orm/core'
|
||||
|
||||
import Database from '#application/database'
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
|
||||
export abstract class BaseRepository {
|
||||
protected readonly logger = Logger.type(LoggerType.REPOSITORY)
|
||||
private entityManager?: EntityManager
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
|
||||
export abstract class BaseService {
|
||||
protected readonly logger = Logger.type(LoggerType.GAME)
|
||||
|
@ -6,7 +6,7 @@ class config {
|
||||
// Server configuration
|
||||
static ENV: string = process.env.ENV || 'development'
|
||||
static HOST: string = process.env.HOST || '0.0.0.0'
|
||||
static PORT: number = process.env.PORT ? parseInt(process.env.PORT) : 6969
|
||||
static PORT: number = process.env.PORT ? parseInt(process.env.PORT) : 4000
|
||||
static JWT_SECRET: string = process.env.JWT_SECRET || 'secret'
|
||||
static CLIENT_URL: string = process.env.CLIENT_URL ? process.env.CLIENT_URL : 'https://noxious.gg'
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import { pathToFileURL } from 'url'
|
||||
|
||||
import type { Command } from '#application/types'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import Storage from '#application/storage'
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
import Storage from '@/application/storage'
|
||||
import type { Command } from '@/application/types'
|
||||
|
||||
export class CommandRegistry {
|
||||
private readonly commands: Map<string, Command> = new Map()
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import * as readline from 'readline'
|
||||
|
||||
export class ConsolePrompt {
|
||||
@ -11,7 +10,7 @@ export class ConsolePrompt {
|
||||
output: process.stdout
|
||||
})
|
||||
|
||||
this.rl.on(SocketEvent.CLOSE, () => {
|
||||
this.rl.on('close', () => {
|
||||
this.isClosed = true
|
||||
})
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
|
||||
export class LogReader {
|
||||
private logger = Logger.type(LoggerType.CONSOLE)
|
||||
@ -61,7 +59,7 @@ export class LogReader {
|
||||
end: newPosition
|
||||
})
|
||||
|
||||
stream.on(SocketEvent.DATA, (data) => {
|
||||
stream.on('data', (data) => {
|
||||
console.log(`[${filename}]`)
|
||||
console.log(data.toString()) //
|
||||
})
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { MikroORM } from '@mikro-orm/mariadb'
|
||||
// import { MikroORM } from '@mikro-orm/mysql'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import config from '#root/mikro-orm.config'
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
import config from '@/root/mikro-orm.config'
|
||||
import { MikroORM } from '@mikro-orm/mariadb'
|
||||
|
||||
class Database {
|
||||
private static orm: MikroORM
|
||||
|
@ -51,7 +51,7 @@ export enum SocketEvent {
|
||||
MAP_CHARACTER_JOIN = '3',
|
||||
MAP_CHARACTER_LEAVE = '2',
|
||||
MAP_CHARACTER_MOVE = '1',
|
||||
CHAT_MESSAGE = '0',
|
||||
CHAT_MESSAGE = '0'
|
||||
}
|
||||
|
||||
export enum ItemType {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import pino from 'pino'
|
||||
|
||||
const logger = pino.pino
|
||||
|
||||
export enum LoggerType {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
import config from '#application/config'
|
||||
import config from '@/application/config'
|
||||
|
||||
class Storage {
|
||||
private readonly baseDir: string
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { Character } from '@/entities/character'
|
||||
import { MapEventTile } from '@/entities/mapEventTile'
|
||||
import { MapEventTileTeleport } from '@/entities/mapEventTileTeleport'
|
||||
import { Server, Socket } from 'socket.io'
|
||||
|
||||
import { Character } from '#entities/character'
|
||||
import { MapEventTile } from '#entities/mapEventTile'
|
||||
import { MapEventTileTeleport } from '#entities/mapEventTileTeleport'
|
||||
|
||||
export type UUID = `${string}-${string}-${string}-${string}-${string}`
|
||||
|
||||
export type TSocket = Socket & {
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseCommand } from '@/application/base/baseCommand'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import { BaseCommand } from '#application/base/baseCommand'
|
||||
|
||||
type CommandInput = string[]
|
||||
|
||||
export default class AlertCommand extends BaseCommand {
|
||||
|
@ -1,26 +1,23 @@
|
||||
wimport fs from 'fs'
|
||||
|
||||
import fs from 'fs'
|
||||
import { BaseCommand } from '@/application/base/baseCommand'
|
||||
import { CharacterGender, CharacterRace } from '@/application/enums'
|
||||
import Storage from '@/application/storage'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Character } from '@/entities/character'
|
||||
import { CharacterHair } from '@/entities/characterHair'
|
||||
import { CharacterType } from '@/entities/characterType'
|
||||
import { Map } from '@/entities/map'
|
||||
import { MapEffect } from '@/entities/mapEffect'
|
||||
import { MapObject } from '@/entities/mapObject'
|
||||
import { Sprite } from '@/entities/sprite'
|
||||
import { SpriteAction } from '@/entities/spriteAction'
|
||||
import { Tile } from '@/entities/tile'
|
||||
import { User } from '@/entities/user'
|
||||
import CharacterHairRepository from '@/repositories/characterHairRepository'
|
||||
import CharacterTypeRepository from '@/repositories/characterTypeRepository'
|
||||
import MapRepository from '@/repositories/mapRepository'
|
||||
import sharp from 'sharp'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseCommand } from '#application/base/baseCommand'
|
||||
import { CharacterGender, CharacterRace } from '#application/enums'
|
||||
import Storage from '#application/storage'
|
||||
import { Character } from '#entities/character'
|
||||
import { CharacterHair } from '#entities/characterHair'
|
||||
import { CharacterType } from '#entities/characterType'
|
||||
import { Map } from '#entities/map'
|
||||
import { MapEffect } from '#entities/mapEffect'
|
||||
import { MapObject } from '#entities/mapObject'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
import { SpriteAction } from '#entities/spriteAction'
|
||||
import { Tile } from '#entities/tile'
|
||||
import { User } from '#entities/user'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
import MapRepository from '#repositories/mapRepository'
|
||||
|
||||
// @TODO : Replace this with seeding
|
||||
// https://mikro-orm.io/docs/seeding
|
||||
|
||||
@ -355,7 +352,7 @@ export default class InitCommand extends BaseCommand {
|
||||
.setUser(user)
|
||||
.setName('root')
|
||||
.setRole('gm')
|
||||
.setMap((await this.mapRepository.getFirst())!)
|
||||
.setMap(await this.mapRepository.getFirst())
|
||||
.setCharacterType(await this.characterTypeRepository.getFirst())
|
||||
.setCharacterHair(await this.characterHairRepository.getFirst())
|
||||
.save()
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { BaseCommand } from '#application/base/baseCommand'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import { BaseCommand } from '@/application/base/baseCommand'
|
||||
import MapManager from '@/managers/mapManager'
|
||||
|
||||
type CommandInput = string[]
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
import fs from 'fs'
|
||||
|
||||
import { BaseCommand } from '@/application/base/baseCommand'
|
||||
import Storage from '@/application/storage'
|
||||
import sharp from 'sharp'
|
||||
|
||||
import { BaseCommand } from '#application/base/baseCommand'
|
||||
import Storage from '#application/storage'
|
||||
|
||||
export default class TilesCommand extends BaseCommand {
|
||||
public async execute(): Promise<void> {
|
||||
// Get all tiles
|
||||
|
@ -1,11 +1,9 @@
|
||||
import jwt from 'jsonwebtoken'
|
||||
|
||||
import { BaseController } from '@/application/base/baseController'
|
||||
import config from '@/application/config'
|
||||
import { loginAccountSchema, newPasswordSchema, registerAccountSchema, resetPasswordSchema } from '@/application/zodTypes'
|
||||
import UserService from '@/services/userService'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import { BaseController } from '#application/base/baseController'
|
||||
import config from '#application/config'
|
||||
import { loginAccountSchema, registerAccountSchema, resetPasswordSchema, newPasswordSchema } from '#application/zodTypes'
|
||||
import UserService from '#services/userService'
|
||||
import jwt from 'jsonwebtoken'
|
||||
|
||||
export class AuthController extends BaseController {
|
||||
/**
|
||||
|
@ -1,15 +1,12 @@
|
||||
import fs from 'fs'
|
||||
|
||||
import sharp from 'sharp'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import { BaseController } from '@/application/base/baseController'
|
||||
import Storage from '@/application/storage'
|
||||
import type { UUID } from '@/application/types'
|
||||
import CharacterHairRepository from '@/repositories/characterHairRepository'
|
||||
import CharacterRepository from '@/repositories/characterRepository'
|
||||
import CharacterTypeRepository from '@/repositories/characterTypeRepository'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import { BaseController } from '#application/base/baseController'
|
||||
import Storage from '#application/storage'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
import sharp from 'sharp'
|
||||
|
||||
interface AvatarOptions {
|
||||
characterTypeId: UUID
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { BaseController } from '@/application/base/baseController'
|
||||
import CharacterHairRepository from '@/repositories/characterHairRepository'
|
||||
import CharacterTypeRepository from '@/repositories/characterTypeRepository'
|
||||
import MapObjectRepository from '@/repositories/mapObjectRepository'
|
||||
import MapRepository from '@/repositories/mapRepository'
|
||||
import SpriteRepository from '@/repositories/spriteRepository'
|
||||
import TileRepository from '@/repositories/tileRepository'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import { BaseController } from '#application/base/baseController'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
import MapObjectRepository from '#repositories/mapObjectRepository'
|
||||
import MapRepository from '#repositories/mapRepository'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
import TileRepository from '#repositories/tileRepository'
|
||||
|
||||
export class CacheController extends BaseController {
|
||||
/**
|
||||
* Serve a list of tiles and send as JSON
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { BaseController } from '@/application/base/baseController'
|
||||
import Storage from '@/application/storage'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import { BaseController } from '#application/base/baseController'
|
||||
import Storage from '#application/storage'
|
||||
|
||||
export class TexturesController extends BaseController {
|
||||
/**
|
||||
* Download texture
|
||||
|
@ -1,18 +1,15 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { CharacterEquipment } from '@/entities/characterEquipment'
|
||||
import type { CharacterHair } from '@/entities/characterHair'
|
||||
import type { CharacterItem } from '@/entities/characterItem'
|
||||
import type { CharacterType } from '@/entities/characterType'
|
||||
import type { Chat } from '@/entities/chat'
|
||||
import type { Map } from '@/entities/map'
|
||||
import type { User } from '@/entities/user'
|
||||
import { Collection, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { CharacterEquipment } from '#entities/characterEquipment'
|
||||
import type { CharacterHair } from '#entities/characterHair'
|
||||
import type { CharacterItem } from '#entities/characterItem'
|
||||
import type { CharacterType } from '#entities/characterType'
|
||||
import type { Chat } from '#entities/chat'
|
||||
import type { Map } from '#entities/map'
|
||||
import type { User } from '#entities/user'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BaseCharacter extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,14 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import { CharacterEquipmentSlotType } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { Character } from '@/entities/character'
|
||||
import type { CharacterItem } from '@/entities/characterItem'
|
||||
import { Enum, ManyToOne, PrimaryKey } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { Character } from '#entities/character'
|
||||
import type { CharacterItem } from '#entities/characterItem'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { CharacterEquipmentSlotType } from '#application/enums'
|
||||
|
||||
export class BaseCharacterEquipment extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,14 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import { CharacterGender } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Character } from '@/entities/character'
|
||||
import { Sprite } from '@/entities/sprite'
|
||||
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { CharacterGender } from '#application/enums'
|
||||
import { Character } from '#entities/character'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
|
||||
export class BaseCharacterHair extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,13 +1,10 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { Character } from '@/entities/character'
|
||||
import type { Item } from '@/entities/item'
|
||||
import { ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { Character } from '#entities/character'
|
||||
import type { Item } from '#entities/item'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BaseCharacterItem extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,14 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import { CharacterGender, CharacterRace } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Character } from '@/entities/character'
|
||||
import { Sprite } from '@/entities/sprite'
|
||||
import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { CharacterGender, CharacterRace } from '#application/enums'
|
||||
import { Character } from '#entities/character'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
|
||||
export class BaseCharacterType extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,13 +1,10 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { Character } from '@/entities/character'
|
||||
import type { Map } from '@/entities/map'
|
||||
import { ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { Character } from '#entities/character'
|
||||
import type { Map } from '#entities/map'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BaseChat extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,14 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import { ItemRarity, ItemType } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { CharacterItem } from '@/entities/characterItem'
|
||||
import { Sprite } from '@/entities/sprite'
|
||||
import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { ItemType, ItemRarity } from '#application/enums'
|
||||
import { CharacterItem } from '#entities/characterItem'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
|
||||
export class BaseItem extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,14 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { MapEffect } from '@/entities/mapEffect'
|
||||
import type { MapEventTile } from '@/entities/mapEventTile'
|
||||
import type { PlacedMapObject } from '@/entities/placedMapObject'
|
||||
import { Collection, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { MapEffect } from '#entities/mapEffect'
|
||||
import type { MapEventTile } from '#entities/mapEventTile'
|
||||
import type { PlacedMapObject } from '#entities/placedMapObject'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BaseMap extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,12 +1,9 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { Map } from '@/entities/map'
|
||||
import { ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { Map } from '#entities/map'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BaseMapEffect extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,14 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import { MapEventTileType } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { Map } from '@/entities/map'
|
||||
import type { MapEventTileTeleport } from '@/entities/mapEventTileTeleport'
|
||||
import { Enum, ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { Map } from '#entities/map'
|
||||
import type { MapEventTileTeleport } from '#entities/mapEventTileTeleport'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { MapEventTileType } from '#application/enums'
|
||||
|
||||
export class BaseMapEventTile extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,13 +1,10 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { Map } from '@/entities/map'
|
||||
import type { MapEventTile } from '@/entities/mapEventTile'
|
||||
import { ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { Map } from '#entities/map'
|
||||
import type { MapEventTile } from '#entities/mapEventTile'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BaseMapEventTileTeleport extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BaseMapObject extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
@ -13,8 +10,11 @@ export class BaseMapObject extends BaseEntity {
|
||||
@Property()
|
||||
name!: string
|
||||
|
||||
@Property({ type: 'json', nullable: true })
|
||||
tags?: any
|
||||
@Property({ type: 'json' })
|
||||
tags: string[] = []
|
||||
|
||||
@Property({ type: 'json' })
|
||||
pivotPoints: { x: number; y: number; }[] = []
|
||||
|
||||
@Property({ type: 'decimal', precision: 10, scale: 2 })
|
||||
originX = 0
|
||||
@ -64,6 +64,15 @@ export class BaseMapObject extends BaseEntity {
|
||||
return this.tags
|
||||
}
|
||||
|
||||
setPivotPoints(pivotPoints: { x: number; y: number; }[]) {
|
||||
this.pivotPoints = pivotPoints
|
||||
return this
|
||||
}
|
||||
|
||||
getPivotPoints() {
|
||||
return this.pivotPoints
|
||||
}
|
||||
|
||||
setOriginX(originX: number) {
|
||||
this.originX = originX
|
||||
return this
|
||||
|
@ -1,12 +1,9 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { User } from '@/entities/user'
|
||||
import { ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { User } from '#entities/user'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BasePasswordResetToken extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,13 +1,10 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { Map } from '@/entities/map'
|
||||
import type { MapObject } from '@/entities/mapObject'
|
||||
import { ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { Map } from '#entities/map'
|
||||
import type { MapObject } from '#entities/mapObject'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BasePlacedMapObject extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,12 +1,9 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { SpriteAction } from '@/entities/spriteAction'
|
||||
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { SpriteAction } from '#entities/spriteAction'
|
||||
|
||||
export class BaseSprite extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,12 +1,9 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import type { Sprite } from '@/entities/sprite'
|
||||
import { ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { Sprite } from '#entities/sprite'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export interface SpriteImage {
|
||||
url: string
|
||||
offset: {
|
||||
|
@ -1,11 +1,8 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BaseTile extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,14 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Character } from '@/entities/character'
|
||||
import { PasswordResetToken } from '@/entities/passwordResetToken'
|
||||
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
import bcrypt from 'bcryptjs'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { Character } from '#entities/character'
|
||||
import { PasswordResetToken } from '#entities/passwordResetToken'
|
||||
|
||||
export class BaseUser extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { BaseEntity } from '@/application/base/baseEntity'
|
||||
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
|
||||
export class BaseWorld extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
date = new Date()
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseCharacter } from '@/entities/base/character'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseCharacter } from '#entities/base/character'
|
||||
|
||||
@Entity()
|
||||
export class Character extends BaseCharacter {}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseCharacterEquipment } from '@/entities/base/characterEquipment'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseCharacterEquipment } from '#entities/base/characterEquipment'
|
||||
|
||||
@Entity()
|
||||
export class CharacterEquipment extends BaseCharacterEquipment {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { BaseCharacterHair } from '@/entities/base/characterHair'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseCharacterHair } from '#entities/base/characterHair'
|
||||
|
||||
@Entity()
|
||||
export class CharacterHair extends BaseCharacterHair {
|
||||
public async cache() {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseCharacterItem } from '@/entities/base/characterItem'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseCharacterItem } from '#entities/base/characterItem'
|
||||
|
||||
@Entity()
|
||||
export class CharacterItem extends BaseCharacterItem {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { BaseCharacterType } from '@/entities/base/characterType'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseCharacterType } from '#entities/base/characterType'
|
||||
|
||||
@Entity()
|
||||
export class CharacterType extends BaseCharacterType {
|
||||
public async cache() {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseChat } from '@/entities/base/chat'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseChat } from '#entities/base/chat'
|
||||
|
||||
@Entity()
|
||||
export class Chat extends BaseChat {}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseItem } from '@/entities/base/item'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseItem } from '#entities/base/item'
|
||||
|
||||
@Entity()
|
||||
export class Item extends BaseItem {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { BaseMap } from '@/entities/base/map'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseMap } from '#entities/base/map'
|
||||
|
||||
export type MapCacheT = ReturnType<Map['cache']> | {}
|
||||
|
||||
@Entity()
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseMapEffect } from '@/entities/base/mapEffect'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseMapEffect } from '#entities/base/mapEffect'
|
||||
|
||||
@Entity()
|
||||
export class MapEffect extends BaseMapEffect {}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseMapEventTile } from '@/entities/base/mapEventTile'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseMapEventTile } from '#entities/base/mapEventTile'
|
||||
|
||||
@Entity()
|
||||
export class MapEventTile extends BaseMapEventTile {}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseMapEventTileTeleport } from '@/entities/base/mapEventTileTeleport'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseMapEventTileTeleport } from '#entities/base/mapEventTileTeleport'
|
||||
|
||||
@Entity()
|
||||
export class MapEventTileTeleport extends BaseMapEventTileTeleport {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { BaseMapObject } from '@/entities/base/mapObject'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseMapObject } from '#entities/base/mapObject'
|
||||
|
||||
@Entity()
|
||||
export class MapObject extends BaseMapObject {
|
||||
public async cache() {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BasePasswordResetToken } from '@/entities/base/passwordResetToken'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BasePasswordResetToken } from '#entities/base/passwordResetToken'
|
||||
|
||||
@Entity()
|
||||
export class PasswordResetToken extends BasePasswordResetToken {}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BasePlacedMapObject } from '@/entities/base/placedMapObject'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BasePlacedMapObject } from '#entities/base/placedMapObject'
|
||||
|
||||
@Entity()
|
||||
export class PlacedMapObject extends BasePlacedMapObject {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { BaseSprite } from '@/entities/base/sprite'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseSprite } from '#entities/base/sprite'
|
||||
|
||||
@Entity()
|
||||
export class Sprite extends BaseSprite {
|
||||
public async cache() {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseSpriteAction } from '@/entities/base/spriteAction'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseSpriteAction } from '#entities/base/spriteAction'
|
||||
|
||||
@Entity()
|
||||
export class SpriteAction extends BaseSpriteAction {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { BaseTile } from '@/entities/base/tile'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseTile } from '#entities/base/tile'
|
||||
|
||||
@Entity()
|
||||
export class Tile extends BaseTile {
|
||||
public async cache() {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseUser } from '@/entities/base/user'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseUser } from '#entities/base/user'
|
||||
|
||||
@Entity()
|
||||
export class User extends BaseUser {}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { BaseWorld } from '@/entities/base/world'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { BaseWorld } from '#entities/base/world'
|
||||
|
||||
@Entity()
|
||||
export class World extends BaseWorld {}
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import TeleportService from '#services/characterTeleportService'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import MapManager from '@/managers/mapManager'
|
||||
import CharacterHairRepository from '@/repositories/characterHairRepository'
|
||||
import CharacterRepository from '@/repositories/characterRepository'
|
||||
import TeleportService from '@/services/characterTeleportService'
|
||||
|
||||
interface CharacterConnectPayload {
|
||||
characterId: UUID
|
||||
@ -27,7 +26,7 @@ export default class CharacterConnectEvent extends BaseEvent {
|
||||
return
|
||||
}
|
||||
|
||||
const character = await this.characterRepository.getByUserAndId(this.socket.userId!, data.characterId)
|
||||
const character = await this.characterRepository.getByUserAndId(this.socket.userId, data.characterId)
|
||||
|
||||
if (!character) {
|
||||
this.emitError('Character not found or does not belong to this user')
|
||||
@ -63,7 +62,7 @@ export default class CharacterConnectEvent extends BaseEvent {
|
||||
}
|
||||
|
||||
private async checkForActiveCharacters(): Promise<boolean> {
|
||||
const characters = await this.characterRepository.getByUserId(this.socket.userId!)
|
||||
const characters = await this.characterRepository.getByUserId(this.socket.userId)
|
||||
return characters?.some((char) => MapManager.getCharacterById(char.id)) ?? false
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { ZodError, z } from 'zod'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { ZCharacterCreate } from '#application/zodTypes'
|
||||
import { Character } from '#entities/character'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
import MapRepository from '#repositories/mapRepository'
|
||||
import UserRepository from '#repositories/userRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { ZCharacterCreate } from '@/application/zodTypes'
|
||||
import { Character } from '@/entities/character'
|
||||
import CharacterRepository from '@/repositories/characterRepository'
|
||||
import CharacterTypeRepository from '@/repositories/characterTypeRepository'
|
||||
import MapRepository from '@/repositories/mapRepository'
|
||||
import UserRepository from '@/repositories/userRepository'
|
||||
import { z, ZodError } from 'zod'
|
||||
|
||||
const MAX_CHARACTERS = 4
|
||||
|
||||
@ -33,7 +32,7 @@ export default class CharacterCreateEvent extends BaseEvent {
|
||||
}
|
||||
|
||||
private async createCharacter(data: z.infer<typeof ZCharacterCreate>): Promise<void> {
|
||||
const user = await this.userRepository.getById(this.socket.userId!)
|
||||
const user = await this.userRepository.getById(this.socket.userId)
|
||||
if (!user) {
|
||||
throw new Error('You are not logged in')
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { Character } from '#entities/character'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Character } from '@/entities/character'
|
||||
import CharacterRepository from '@/repositories/characterRepository'
|
||||
|
||||
type TypePayload = {
|
||||
characterId: UUID
|
||||
@ -21,8 +20,8 @@ export default class CharacterDeleteEvent extends BaseEvent {
|
||||
private async handleEvent(data: TypePayload, callback: (response: TypeResponse) => void): Promise<any> {
|
||||
try {
|
||||
const characterRepository = new CharacterRepository()
|
||||
await (await characterRepository.getByUserAndId(this.socket.userId!, data.characterId))?.delete()
|
||||
const characters: Character[] = await characterRepository.getByUserId(this.socket.userId!)
|
||||
await (await characterRepository.getByUserAndId(this.socket.userId, data.characterId))?.delete()
|
||||
const characters: Character[] = await characterRepository.getByUserId(this.socket.userId)
|
||||
|
||||
this.socket.emit(SocketEvent.CHARACTER_LIST, characters)
|
||||
} catch (error: any) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { Character } from '#entities/character'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { Character } from '@/entities/character'
|
||||
import CharacterRepository from '@/repositories/characterRepository'
|
||||
|
||||
export default class CharacterListEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
@ -11,7 +11,7 @@ export default class CharacterListEvent extends BaseEvent {
|
||||
private async handleEvent(data: any): Promise<void> {
|
||||
try {
|
||||
const characterRepository = new CharacterRepository()
|
||||
let characters: Character[] = await characterRepository.getByUserId(this.socket.userId!)
|
||||
let characters: Character[] = await characterRepository.getByUserId(this.socket.userId)
|
||||
|
||||
this.socket.emit(SocketEvent.CHARACTER_LIST, characters)
|
||||
} catch (error: any) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import ChatService from '#services/chatService'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import CharacterRepository from '@/repositories/characterRepository'
|
||||
import ChatService from '@/services/chatService'
|
||||
|
||||
type TypePayload = {
|
||||
message: string
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import DateManager from '#managers/dateManager'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import ChatService from '#services/chatService'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import DateManager from '@/managers/dateManager'
|
||||
import CharacterRepository from '@/repositories/characterRepository'
|
||||
import ChatService from '@/services/chatService'
|
||||
|
||||
type TypePayload = {
|
||||
message: string
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import MapRepository from '#repositories/mapRepository'
|
||||
import TeleportService from '#services/characterTeleportService'
|
||||
import ChatService from '#services/chatService'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import MapManager from '@/managers/mapManager'
|
||||
import MapRepository from '@/repositories/mapRepository'
|
||||
import TeleportService from '@/services/characterTeleportService'
|
||||
import ChatService from '@/services/chatService'
|
||||
|
||||
type TypePayload = {
|
||||
message: string
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import WeatherManager from '#managers/weatherManager'
|
||||
import ChatService from '#services/chatService'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import WeatherManager from '@/managers/weatherManager'
|
||||
import ChatService from '@/services/chatService'
|
||||
|
||||
type TypePayload = {
|
||||
message: string
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import WeatherManager from '#managers/weatherManager'
|
||||
import ChatService from '#services/chatService'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import WeatherManager from '@/managers/weatherManager'
|
||||
import ChatService from '@/services/chatService'
|
||||
|
||||
type TypePayload = {
|
||||
message: string
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import MapRepository from '#repositories/mapRepository'
|
||||
import ChatService from '#services/chatService'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import MapManager from '@/managers/mapManager'
|
||||
import ChatService from '@/services/chatService'
|
||||
|
||||
type TypePayload = {
|
||||
message: string
|
||||
@ -15,26 +14,17 @@ export default class ChatMessageEvent extends BaseEvent {
|
||||
|
||||
private async handleEvent(data: TypePayload, callback: (response: boolean) => void): Promise<void> {
|
||||
try {
|
||||
if (!data.message || ChatService.isCommand(data.message)) {
|
||||
return callback(false)
|
||||
}
|
||||
if (!data.message || ChatService.isCommand(data.message)) return
|
||||
|
||||
const mapCharacter = MapManager.getCharacterById(this.socket.characterId!)
|
||||
if (!mapCharacter) {
|
||||
this.logger.error('chat:message error', 'Character not found')
|
||||
return callback(false)
|
||||
return
|
||||
}
|
||||
|
||||
const character = mapCharacter.character
|
||||
|
||||
const mapRepository = new MapRepository()
|
||||
const map = await mapRepository.getById(character.map.id)
|
||||
if (!map) {
|
||||
this.logger.error('chat:message error', 'Map not found')
|
||||
return callback(false)
|
||||
}
|
||||
|
||||
if (await ChatService.sendMapMessage(character.getId(), map.getId(), data.message)) {
|
||||
if (await ChatService.sendMapMessage(character.getId(), data.message)) {
|
||||
return callback(true)
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import MapManager from '@/managers/mapManager'
|
||||
|
||||
export default class DisconnectEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
this.socket.on(SocketEvent.DISCONNECT, this.handleEvent.bind(this))
|
||||
this.socket.on('disconnect', this.handleEvent.bind(this))
|
||||
}
|
||||
|
||||
private async handleEvent(): Promise<void> {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { CharacterHair } from '#entities/characterHair'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { CharacterHair } from '@/entities/characterHair'
|
||||
|
||||
export default class CharacterHairCreateEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import CharacterHairRepository from '@/repositories/characterHairRepository'
|
||||
|
||||
interface IPayload {
|
||||
id: UUID
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { CharacterHair } from '#entities/characterHair'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { CharacterHair } from '@/entities/characterHair'
|
||||
import CharacterHairRepository from '@/repositories/characterHairRepository'
|
||||
|
||||
interface IPayload {}
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { CharacterGender } from '#application/enums'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { CharacterGender, SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import CharacterHairRepository from '@/repositories/characterHairRepository'
|
||||
import SpriteRepository from '@/repositories/spriteRepository'
|
||||
|
||||
type Payload = {
|
||||
id: UUID
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { CharacterType } from '#entities/characterType'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { CharacterType } from '@/entities/characterType'
|
||||
|
||||
export default class CharacterTypeCreateEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import CharacterTypeRepository from '@/repositories/characterTypeRepository'
|
||||
|
||||
interface IPayload {
|
||||
id: UUID
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { CharacterType } from '#entities/characterType'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { CharacterType } from '@/entities/characterType'
|
||||
import CharacterTypeRepository from '@/repositories/characterTypeRepository'
|
||||
|
||||
interface IPayload {}
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { CharacterGender, CharacterRace } from '#application/enums'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { CharacterGender, CharacterRace, SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import CharacterTypeRepository from '@/repositories/characterTypeRepository'
|
||||
import SpriteRepository from '@/repositories/spriteRepository'
|
||||
|
||||
type Payload = {
|
||||
id: UUID
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { ItemRarity, ItemType } from '#application/enums'
|
||||
import { Item } from '#entities/item'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { ItemRarity, ItemType, SocketEvent } from '@/application/enums'
|
||||
import { Item } from '@/entities/item'
|
||||
import SpriteRepository from '@/repositories/spriteRepository'
|
||||
|
||||
export default class ItemCreateEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import ItemRepository from '#repositories/itemRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import ItemRepository from '@/repositories/itemRepository'
|
||||
|
||||
interface IPayload {
|
||||
id: UUID
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { Item } from '#entities/item'
|
||||
import ItemRepository from '#repositories/itemRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { Item } from '@/entities/item'
|
||||
import ItemRepository from '@/repositories/itemRepository'
|
||||
|
||||
interface IPayload {}
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { ItemType, ItemRarity } from '#application/enums'
|
||||
import ItemRepository from '#repositories/itemRepository'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { ItemRarity, ItemType, SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import ItemRepository from '@/repositories/itemRepository'
|
||||
import SpriteRepository from '@/repositories/spriteRepository'
|
||||
|
||||
type Payload = {
|
||||
id: UUID
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { MapObject } from '#entities/mapObject'
|
||||
import MapObjectRepository from '#repositories/mapObjectRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { MapObject } from '@/entities/mapObject'
|
||||
import MapObjectRepository from '@/repositories/mapObjectRepository'
|
||||
|
||||
interface IPayload {}
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import fs from 'fs'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import Storage from '#application/storage'
|
||||
import MapObjectRepository from '#repositories/mapObjectRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import Storage from '@/application/storage'
|
||||
import type { UUID } from '@/application/types'
|
||||
import MapObjectRepository from '@/repositories/mapObjectRepository'
|
||||
|
||||
interface IPayload {
|
||||
mapObjectId: UUID
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import MapObjectRepository from '#repositories/mapObjectRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import MapObjectRepository from '@/repositories/mapObjectRepository'
|
||||
|
||||
type Payload = {
|
||||
id: UUID
|
||||
name: string
|
||||
tags: string[]
|
||||
pivotPoints: { x: number; y: number; }[]
|
||||
originX: number
|
||||
originY: number
|
||||
frameRate: number
|
||||
@ -31,6 +31,7 @@ export default class MapObjectUpdateEvent extends BaseEvent {
|
||||
|
||||
if (data.name !== undefined) mapObject.name = data.name
|
||||
if (data.tags !== undefined) mapObject.tags = data.tags
|
||||
if (data.pivotPoints !== undefined) mapObject.pivotPoints = data.pivotPoints
|
||||
if (data.originX !== undefined) mapObject.originX = data.originX
|
||||
if (data.originY !== undefined) mapObject.originY = data.originY
|
||||
if (data.frameRate !== undefined) mapObject.frameRate = data.frameRate
|
||||
|
@ -1,13 +1,11 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import fs from 'fs/promises'
|
||||
import { writeFile } from 'node:fs/promises'
|
||||
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import Storage from '@/application/storage'
|
||||
import { MapObject } from '@/entities/mapObject'
|
||||
import sharp from 'sharp'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import Storage from '#application/storage'
|
||||
import { MapObject } from '#entities/mapObject'
|
||||
|
||||
interface IObjectData {
|
||||
[key: string]: Buffer
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Sprite } from '@/entities/sprite'
|
||||
import SpriteRepository from '@/repositories/spriteRepository'
|
||||
|
||||
interface CopyPayload {
|
||||
id: UUID
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import fs from 'fs/promises'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import Storage from '#application/storage'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import Storage from '@/application/storage'
|
||||
import { Sprite } from '@/entities/sprite'
|
||||
|
||||
export default class SpriteCreateEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import fs from 'fs'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import Storage from '#application/storage'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import Storage from '@/application/storage'
|
||||
import type { UUID } from '@/application/types'
|
||||
import SpriteRepository from '@/repositories/spriteRepository'
|
||||
|
||||
type Payload = {
|
||||
id: UUID
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import { Sprite } from '@/entities/sprite'
|
||||
import SpriteRepository from '@/repositories/spriteRepository'
|
||||
|
||||
interface IPayload {}
|
||||
|
||||
|
@ -1,14 +1,11 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import fs from 'fs'
|
||||
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { SpriteAction } from '@/entities/spriteAction'
|
||||
import SpriteRepository from '@/repositories/spriteRepository'
|
||||
import sharp from 'sharp'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { SpriteAction } from '#entities/spriteAction'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
|
||||
interface SpriteImage {
|
||||
url: string
|
||||
offset: {
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import fs from 'fs/promises'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import Storage from '#application/storage'
|
||||
import TileRepository from '#repositories/tileRepository'
|
||||
import { BaseEvent } from '@/application/base/baseEvent'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import Storage from '@/application/storage'
|
||||
import type { UUID } from '@/application/types'
|
||||
import TileRepository from '@/repositories/tileRepository'
|
||||
|
||||
type Payload = {
|
||||
id: UUID
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user