forked from noxious/server
Compare commits
75 Commits
feature/sp
...
v0.0.4
Author | SHA1 | Date | |
---|---|---|---|
62e31c10d7 | |||
35fe0e6faa | |||
bcc5c0bca3 | |||
2de92ca51c | |||
2cdcfa7e56 | |||
ee4eca6db3 | |||
daca3d306d | |||
47d38e36dd | |||
14b4726546 | |||
394ad13341 | |||
fe18f8b54e | |||
11f177c901 | |||
e1f9f8e523 | |||
10c8e493a7 | |||
9a5aa9a53d | |||
2d5a445af0 | |||
af43faf8f2 | |||
cbaadc0c26 | |||
1ed9c2a61f | |||
b46989d3af | |||
30310bf0cf | |||
a28b1b9bee | |||
ccdc39e74b | |||
df860cb7d7 | |||
5e46597e7d | |||
aebe21f140 | |||
d4c1098a5e | |||
8b9afdf956 | |||
5f02aca6e4 | |||
e824f0f558 | |||
13252e056f | |||
50f595f718 | |||
a7726387af | |||
cff5fed4f7 | |||
52b8a9b7ad | |||
f5e7d10fb4 | |||
fae428f239 | |||
37f2cd90e6 | |||
3265bf7823 | |||
209f474575 | |||
733a1c4956 | |||
7e2c5eb529 | |||
b2f7d45a1f | |||
8b0746958e | |||
0c607fe39d | |||
aae125c6c6 | |||
4ace8c1e84 | |||
cf3b274cd3 | |||
10fd2064ba | |||
9ba8be51ab | |||
1686a7a9a0 | |||
b82e2fd0fd | |||
71dd1f240d | |||
f2917e67e3 | |||
9ea12ee458 | |||
67a4c6763b | |||
f0c0456121 | |||
4992ef69d4 | |||
765a0468bc | |||
ba96ae7dd4 | |||
9baffd1327 | |||
a14074afcf | |||
6b03937c39 | |||
89f8137dc3 | |||
53c232d0a3 | |||
a5d8cf5ef9 | |||
90559e8388 | |||
925721be8a | |||
70aa7345e0 | |||
a5ca524bb4 | |||
3b6c11090f | |||
f6a4bd3369 | |||
ccf43556a5 | |||
1be4a70fed | |||
f0bfa0b983 |
17
.dockerignore
Normal file
17
.dockerignore
Normal file
@ -0,0 +1,17 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
.git
|
||||
.gitignore
|
||||
README.md
|
||||
.env
|
||||
.env.*
|
||||
docker-compose*
|
||||
*.md
|
||||
coverage
|
||||
.vscode
|
||||
.idea
|
||||
dist
|
||||
build
|
||||
temp
|
@ -6,10 +6,10 @@ JWT_SECRET="secret"
|
||||
CLIENT_URL="http://localhost:5173"
|
||||
|
||||
# Database configuration
|
||||
REDIS_URL="redis://@127.0.0.1:6379/4"
|
||||
DB_HOST="localhost"
|
||||
DB_USER="root"
|
||||
DB_PASS=""
|
||||
REDIS_URL="redis://@redis:6379/4"
|
||||
DB_HOST="mariadb"
|
||||
DB_USER="mariadb"
|
||||
DB_PASS="mariadb"
|
||||
DB_PORT="3306"
|
||||
DB_NAME="game"
|
||||
|
||||
|
41
Dockerfile
41
Dockerfile
@ -1,41 +1,16 @@
|
||||
# Use the official Node.js 22.4.1 image
|
||||
FROM node:22.4.1-alpine
|
||||
FROM node:lts-alpine
|
||||
|
||||
# Install Redis and tmux
|
||||
RUN apk add --no-cache redis tmux
|
||||
# Install packages
|
||||
RUN apk update
|
||||
RUN apk add --no-cache tmux coreutils
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /usr/src/
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Copy package.json and package-lock.json (if available)
|
||||
COPY package*.json ./
|
||||
|
||||
# Install application dependencies
|
||||
RUN npm install
|
||||
RUN npm ci
|
||||
|
||||
# Copy prisma schema
|
||||
COPY prisma ./prisma/
|
||||
|
||||
# Generate Prisma client
|
||||
RUN npx prisma generate
|
||||
|
||||
# Copy the rest of your application code to the container
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Expose the ports your Node.js application and Redis will listen on
|
||||
EXPOSE 80 6379
|
||||
|
||||
# Create a shell script to run Redis, run migrations, and start the application in a tmux session
|
||||
RUN echo '#!/bin/sh' > /usr/src/start.sh && \
|
||||
echo 'redis-server --daemonize yes' >> /usr/src/start.sh && \
|
||||
echo 'npx prisma migrate deploy' >> /usr/src/start.sh && \
|
||||
echo 'tmux new-session -d -s nodeapp "node dist/server.js"' >> /usr/src/start.sh && \
|
||||
echo 'echo "App is running in tmux session. Attach with: tmux attach-session -t nodeapp"' >> /usr/src/start.sh && \
|
||||
echo 'tail -f /dev/null' >> /usr/src/start.sh && \
|
||||
chmod +x /usr/src/start.sh
|
||||
|
||||
# Use the shell script as the entry point
|
||||
CMD ["/usr/src/start.sh"]
|
||||
# Modify CMD to use tmux
|
||||
CMD npx mikro-orm-esm migration:up && npm run start
|
@ -14,7 +14,7 @@ This is the server for the Noxious game.
|
||||
2. Install dependencies with `npm install`
|
||||
3. Copy the `.env.example` file to `.env` and fill in the required variables
|
||||
4. Extract assets.zip to the `public` folder
|
||||
5. After MySQL and Redis are running, run `npx mikro-orm migration:up` to create the database schema
|
||||
5. After MySQL and Redis are running, run `npx mikro-orm-esm migration:up` to create the database schema
|
||||
6. Run the server with `npm run dev`
|
||||
7. Write `init` in the console to import default data and restart the server
|
||||
8. Write `tiles` in the console to fix tile sizes
|
||||
@ -39,15 +39,15 @@ MikroORM is used as the ORM for the server.
|
||||
|
||||
### Create init. migrations
|
||||
|
||||
Run `npx mikro-orm migration:create --initial` to create a new initial migration.
|
||||
Run `npx mikro-orm-esm migration:create --initial` to create a new initial migration.
|
||||
|
||||
### Create migrations
|
||||
|
||||
Run `npx 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.
|
||||
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.
|
||||
|
||||
### Apply migrations
|
||||
|
||||
Run `npx mikro-orm migration:up` to apply all pending migrations.
|
||||
Run `npx mikro-orm-esm migration:up` to apply all pending migrations.
|
||||
|
||||
### Import default data
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"schemaVersion": 2,
|
||||
"dockerfilePath" :"./Dockerfile"
|
||||
}
|
94
docker-compose.yml
Normal file
94
docker-compose.yml
Normal file
@ -0,0 +1,94 @@
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "${PORT}:${PORT}"
|
||||
environment:
|
||||
- ENV=${ENV}
|
||||
- HOST=${HOST}
|
||||
- PORT=${PORT}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- CLIENT_URL=${CLIENT_URL}
|
||||
- REDIS_URL=${REDIS_URL}
|
||||
- DB_HOST=${DB_HOST}
|
||||
- DB_USER=${DB_USER}
|
||||
- DB_PASS=${DB_PASS}
|
||||
- DB_PORT=${DB_PORT}
|
||||
- DB_NAME=${DB_NAME}
|
||||
- ALLOW_DIAGONAL_MOVEMENT=${ALLOW_DIAGONAL_MOVEMENT}
|
||||
- DEFAULT_CHARACTER_ZONE=${DEFAULT_CHARACTER_ZONE}
|
||||
- DEFAULT_CHARACTER_POS_X=${DEFAULT_CHARACTER_POS_X}
|
||||
- DEFAULT_CHARACTER_POS_Y=${DEFAULT_CHARACTER_POS_Y}
|
||||
- SMTP_HOST=${SMTP_HOST}
|
||||
- SMTP_PORT=${SMTP_PORT}
|
||||
- SMTP_USER=${SMTP_USER}
|
||||
- SMTP_PASSWORD=${SMTP_PASSWORD}
|
||||
volumes:
|
||||
- app-public:/user/src/app/public
|
||||
- app-logs:/user/src/app/logs
|
||||
depends_on:
|
||||
- mariadb
|
||||
- redis
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- app-network
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.app.rule=Host(`${HOST}`)"
|
||||
- "traefik.http.routers.app.entrypoints=websecure"
|
||||
- "traefik.http.routers.app.tls.certresolver=le"
|
||||
- "traefik.http.services.app.loadbalancer.server.port=${PORT}"
|
||||
- "traefik.http.routers.app.middlewares=websocket"
|
||||
|
||||
traefik:
|
||||
image: traefik:v3.3.3
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- traefik_data:/data
|
||||
- ./traefik.toml:/etc/traefik/traefik.toml
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
mariadb:
|
||||
image: mariadb:lts
|
||||
environment:
|
||||
- MARIADB_USER=${DB_USER}
|
||||
- MARIADB_PASSWORD=${DB_PASS}
|
||||
- MARIADB_DATABASE=${DB_NAME}
|
||||
- MARIADB_RANDOM_ROOT_PASSWORD=yes
|
||||
volumes:
|
||||
- mariadb-data:/var/lib/mysql
|
||||
ports:
|
||||
- "${DB_PORT}:3306"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- app-network
|
||||
command: [ 'mariadbd', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci' ]
|
||||
|
||||
redis:
|
||||
image: redis:7.4.2-alpine
|
||||
command: redis-server --appendonly yes
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
app-public:
|
||||
app-logs:
|
||||
mariadb-data:
|
||||
redis-data:
|
||||
traefik_data:
|
@ -1,104 +0,0 @@
|
||||
import { Migration } from '@mikro-orm/migrations';
|
||||
|
||||
export class Migration20250128165214 extends Migration {
|
||||
|
||||
override async up(): Promise<void> {
|
||||
this.addSql(`create table \`map\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`width\` int not null default 10, \`height\` int not null default 10, \`tiles\` json null, \`pvp\` tinyint(1) not null default false, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
|
||||
this.addSql(`create table \`map_effect\` (\`id\` varchar(255) not null, \`map_id\` varchar(255) not null, \`effect\` varchar(255) not null, \`strength\` int not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`map_effect\` add index \`map_effect_map_id_index\`(\`map_id\`);`);
|
||||
|
||||
this.addSql(`create table \`map_event_tile\` (\`id\` varchar(255) not null, \`map_id\` varchar(255) not null, \`type\` enum('BLOCK', 'TELEPORT', 'NPC', 'ITEM') not null, \`position_x\` int not null, \`position_y\` int not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`map_event_tile\` add index \`map_event_tile_map_id_index\`(\`map_id\`);`);
|
||||
|
||||
this.addSql(`create table \`map_event_tile_teleport\` (\`id\` varchar(255) not null, \`map_event_tile_id\` varchar(255) not null, \`to_map_id\` varchar(255) not null, \`to_rotation\` int not null, \`to_position_x\` int not null, \`to_position_y\` int not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`map_event_tile_teleport\` add unique \`map_event_tile_teleport_map_event_tile_id_unique\`(\`map_event_tile_id\`);`);
|
||||
this.addSql(`alter table \`map_event_tile_teleport\` add index \`map_event_tile_teleport_to_map_id_index\`(\`to_map_id\`);`);
|
||||
|
||||
this.addSql(`create table \`map_object\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`tags\` json null, \`origin_x\` numeric(10,2) not null default 0, \`origin_y\` numeric(10,2) not null default 0, \`frame_rate\` int not null default 0, \`frame_width\` int not null default 0, \`frame_height\` int not null default 0, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
|
||||
this.addSql(`create table \`placed_map_object\` (\`id\` varchar(255) not null, \`map_id\` varchar(255) not null, \`map_object_id\` varchar(255) not null, \`is_rotated\` tinyint(1) not null default false, \`position_x\` int not null default 0, \`position_y\` int not null default 0, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`placed_map_object\` add index \`placed_map_object_map_id_index\`(\`map_id\`);`);
|
||||
this.addSql(`alter table \`placed_map_object\` add index \`placed_map_object_map_object_id_index\`(\`map_object_id\`);`);
|
||||
|
||||
this.addSql(`create table \`sprite\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
|
||||
this.addSql(`create table \`item\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`description\` varchar(255) not null default '', \`item_type\` enum('WEAPON', 'HELMET', 'CHEST', 'LEGS', 'BOOTS', 'GLOVES', 'RING', 'NECKLACE') not null, \`stackable\` tinyint(1) not null default false, \`rarity\` enum('COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY') not null default 'COMMON', \`sprite_id\` varchar(255) null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`item\` add index \`item_sprite_id_index\`(\`sprite_id\`);`);
|
||||
|
||||
this.addSql(`create table \`character_type\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`gender\` enum('MALE', 'FEMALE') not null, \`race\` enum('HUMAN', 'ELF', 'DWARF', 'ORC', 'GOBLIN') not null, \`is_selectable\` tinyint(1) not null default false, \`sprite_id\` varchar(255) null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`character_type\` add index \`character_type_sprite_id_index\`(\`sprite_id\`);`);
|
||||
|
||||
this.addSql(`create table \`character_hair\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`gender\` varchar(255) not null default 'MALE', \`is_selectable\` tinyint(1) not null default false, \`sprite_id\` varchar(255) null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`character_hair\` add index \`character_hair_sprite_id_index\`(\`sprite_id\`);`);
|
||||
|
||||
this.addSql(`create table \`sprite_action\` (\`id\` varchar(255) not null, \`sprite_id\` varchar(255) not null, \`action\` varchar(255) not null, \`sprites\` json null, \`origin_x\` numeric(5,2) not null default 0, \`origin_y\` numeric(5,2) not null default 0, \`frame_width\` int not null default 0, \`frame_height\` int not null default 0, \`frame_rate\` int not null default 0, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`sprite_action\` add index \`sprite_action_sprite_id_index\`(\`sprite_id\`);`);
|
||||
|
||||
this.addSql(`create table \`tile\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`tags\` json null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
|
||||
this.addSql(`create table \`user\` (\`id\` varchar(255) not null, \`username\` varchar(255) not null, \`email\` varchar(255) not null, \`password\` varchar(255) not null, \`online\` tinyint(1) not null default false, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`user\` add unique \`user_username_unique\`(\`username\`);`);
|
||||
this.addSql(`alter table \`user\` add unique \`user_email_unique\`(\`email\`);`);
|
||||
|
||||
this.addSql(`create table \`password_reset_token\` (\`id\` varchar(255) not null, \`user_id\` varchar(255) not null, \`token\` varchar(255) not null, \`created_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`password_reset_token\` add index \`password_reset_token_user_id_index\`(\`user_id\`);`);
|
||||
this.addSql(`alter table \`password_reset_token\` add unique \`password_reset_token_token_unique\`(\`token\`);`);
|
||||
|
||||
this.addSql(`create table \`character\` (\`id\` varchar(255) not null, \`user_id\` varchar(255) not null, \`name\` varchar(255) not null, \`online\` tinyint(1) not null default false, \`role\` varchar(255) not null default 'player', \`map_id\` varchar(255) not null, \`position_x\` int not null default 0, \`position_y\` int not null default 0, \`rotation\` int not null default 0, \`character_type_id\` varchar(255) null, \`character_hair_id\` varchar(255) null, \`alignment\` int not null default 50, \`hitpoints\` int not null default 100, \`mana\` int not null default 100, \`level\` int not null default 1, \`experience\` int not null default 0, \`strength\` int not null default 10, \`dexterity\` int not null default 10, \`intelligence\` int not null default 10, \`wisdom\` int not null default 10, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`character\` add index \`character_user_id_index\`(\`user_id\`);`);
|
||||
this.addSql(`alter table \`character\` add unique \`character_name_unique\`(\`name\`);`);
|
||||
this.addSql(`alter table \`character\` add index \`character_map_id_index\`(\`map_id\`);`);
|
||||
this.addSql(`alter table \`character\` add index \`character_character_type_id_index\`(\`character_type_id\`);`);
|
||||
this.addSql(`alter table \`character\` add index \`character_character_hair_id_index\`(\`character_hair_id\`);`);
|
||||
|
||||
this.addSql(`create table \`chat\` (\`id\` varchar(255) not null, \`character_id\` varchar(255) not null, \`map_id\` varchar(255) not null, \`message\` varchar(255) not null, \`created_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`chat\` add index \`chat_character_id_index\`(\`character_id\`);`);
|
||||
this.addSql(`alter table \`chat\` add index \`chat_map_id_index\`(\`map_id\`);`);
|
||||
|
||||
this.addSql(`create table \`character_item\` (\`id\` varchar(255) not null, \`character_id\` varchar(255) not null, \`item_id\` varchar(255) not null, \`quantity\` int not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`character_item\` add index \`character_item_character_id_index\`(\`character_id\`);`);
|
||||
this.addSql(`alter table \`character_item\` add index \`character_item_item_id_index\`(\`item_id\`);`);
|
||||
|
||||
this.addSql(`create table \`character_equipment\` (\`id\` varchar(255) not null, \`slot\` enum('HEAD', 'BODY', 'ARMS', 'LEGS', 'NECK', 'RING') not null, \`character_id\` varchar(255) not null, \`character_item_id\` varchar(255) not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
this.addSql(`alter table \`character_equipment\` add index \`character_equipment_character_id_index\`(\`character_id\`);`);
|
||||
this.addSql(`alter table \`character_equipment\` add index \`character_equipment_character_item_id_index\`(\`character_item_id\`);`);
|
||||
|
||||
this.addSql(`create table \`world\` (\`date\` datetime not null, \`rain_percentage\` int not null default 0, \`fog_density\` int not null default 0, primary key (\`date\`)) default character set utf8mb4 engine = InnoDB;`);
|
||||
|
||||
this.addSql(`alter table \`map_effect\` add constraint \`map_effect_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`);
|
||||
|
||||
this.addSql(`alter table \`map_event_tile\` add constraint \`map_event_tile_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`);
|
||||
|
||||
this.addSql(`alter table \`map_event_tile_teleport\` add constraint \`map_event_tile_teleport_map_event_tile_id_foreign\` foreign key (\`map_event_tile_id\`) references \`map_event_tile\` (\`id\`) on update cascade on delete cascade;`);
|
||||
this.addSql(`alter table \`map_event_tile_teleport\` add constraint \`map_event_tile_teleport_to_map_id_foreign\` foreign key (\`to_map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`);
|
||||
|
||||
this.addSql(`alter table \`placed_map_object\` add constraint \`placed_map_object_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`);
|
||||
this.addSql(`alter table \`placed_map_object\` add constraint \`placed_map_object_map_object_id_foreign\` foreign key (\`map_object_id\`) references \`map_object\` (\`id\`) on update cascade on delete cascade;`);
|
||||
|
||||
this.addSql(`alter table \`item\` add constraint \`item_sprite_id_foreign\` foreign key (\`sprite_id\`) references \`sprite\` (\`id\`) on update cascade on delete set null;`);
|
||||
|
||||
this.addSql(`alter table \`character_type\` add constraint \`character_type_sprite_id_foreign\` foreign key (\`sprite_id\`) references \`sprite\` (\`id\`) on update cascade on delete set null;`);
|
||||
|
||||
this.addSql(`alter table \`character_hair\` add constraint \`character_hair_sprite_id_foreign\` foreign key (\`sprite_id\`) references \`sprite\` (\`id\`) on update cascade on delete set null;`);
|
||||
|
||||
this.addSql(`alter table \`sprite_action\` add constraint \`sprite_action_sprite_id_foreign\` foreign key (\`sprite_id\`) references \`sprite\` (\`id\`) on update cascade on delete cascade;`);
|
||||
|
||||
this.addSql(`alter table \`password_reset_token\` add constraint \`password_reset_token_user_id_foreign\` foreign key (\`user_id\`) references \`user\` (\`id\`) on update cascade on delete cascade;`);
|
||||
|
||||
this.addSql(`alter table \`character\` add constraint \`character_user_id_foreign\` foreign key (\`user_id\`) references \`user\` (\`id\`) on update cascade on delete cascade;`);
|
||||
this.addSql(`alter table \`character\` add constraint \`character_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade;`);
|
||||
this.addSql(`alter table \`character\` add constraint \`character_character_type_id_foreign\` foreign key (\`character_type_id\`) references \`character_type\` (\`id\`) on update cascade on delete set null;`);
|
||||
this.addSql(`alter table \`character\` add constraint \`character_character_hair_id_foreign\` foreign key (\`character_hair_id\`) references \`character_hair\` (\`id\`) on update cascade on delete set null;`);
|
||||
|
||||
this.addSql(`alter table \`chat\` add constraint \`chat_character_id_foreign\` foreign key (\`character_id\`) references \`character\` (\`id\`) on update cascade on delete cascade;`);
|
||||
this.addSql(`alter table \`chat\` add constraint \`chat_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`);
|
||||
|
||||
this.addSql(`alter table \`character_item\` add constraint \`character_item_character_id_foreign\` foreign key (\`character_id\`) references \`character\` (\`id\`) on update cascade on delete cascade;`);
|
||||
this.addSql(`alter table \`character_item\` add constraint \`character_item_item_id_foreign\` foreign key (\`item_id\`) references \`item\` (\`id\`) on update cascade on delete cascade;`);
|
||||
|
||||
this.addSql(`alter table \`character_equipment\` add constraint \`character_equipment_character_id_foreign\` foreign key (\`character_id\`) references \`character\` (\`id\`) on update cascade on delete cascade;`);
|
||||
this.addSql(`alter table \`character_equipment\` add constraint \`character_equipment_character_item_id_foreign\` foreign key (\`character_item_id\`) references \`character_item\` (\`id\`) on update cascade on delete cascade;`);
|
||||
}
|
||||
|
||||
}
|
363
package-lock.json
generated
363
package-lock.json
generated
@ -5,6 +5,7 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@mikro-orm/cli": "^6.4.2",
|
||||
"@mikro-orm/core": "^6.4.2",
|
||||
"@mikro-orm/mariadb": "^6.4.2",
|
||||
"@mikro-orm/migrations": "^6.4.2",
|
||||
@ -20,6 +21,7 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"nodemailer": "^6.9.15",
|
||||
"pino": "^9.3.2",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"sharp": "^0.33.4",
|
||||
"socket.io": "^4.7.5",
|
||||
"ts-node": "^10.9.2",
|
||||
@ -27,7 +29,6 @@
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mikro-orm/cli": "^6.4.2",
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/jsonwebtoken": "^9.0.6",
|
||||
@ -503,13 +504,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/config-array": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.1.tgz",
|
||||
"integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==",
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.2.tgz",
|
||||
"integrity": "sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@eslint/object-schema": "^2.1.5",
|
||||
"@eslint/object-schema": "^2.1.6",
|
||||
"debug": "^4.3.1",
|
||||
"minimatch": "^3.1.2"
|
||||
},
|
||||
@ -542,9 +543,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/core": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz",
|
||||
"integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==",
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.11.0.tgz",
|
||||
"integrity": "sha512-DWUB2pksgNEb6Bz2fggIy1wh6fGgZP4Xyy/Mt0QZPiloKKXerbqq9D3SBQTlCRYOrcRPu4vuz+CGjwdfqxnoWA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
@ -603,9 +604,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "9.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.19.0.tgz",
|
||||
"integrity": "sha512-rbq9/g38qjfqFLOVPvwjIvFFdNziEC5S65jmjPw5r6A//QH+W91akh9irMwjDN8zKUTak6W9EsAv4m/7Wnw0UQ==",
|
||||
"version": "9.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.20.0.tgz",
|
||||
"integrity": "sha512-iZA07H9io9Wn836aVTytRaNqh00Sad+EamwOVJT12GTLw1VGMFV/4JaME+JjLtr9fiGaoWgYnS54wrfWsSs4oQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@ -613,9 +614,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/object-schema": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz",
|
||||
"integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==",
|
||||
"version": "2.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz",
|
||||
"integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
@ -636,6 +637,19 @@
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/plugin-kit/node_modules/@eslint/core": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz",
|
||||
"integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/core": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
||||
@ -1073,7 +1087,6 @@
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@jercle/yargonaut/-/yargonaut-1.1.5.tgz",
|
||||
"integrity": "sha512-zBp2myVvBHp1UaJsNTyS6q4UDKT7eRiqTS4oNTS6VQMd6mpxYOdbeK4pY279cDCdakGy6hG0J3ejoXZVsPwHqw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"chalk": "^4.1.2",
|
||||
@ -1107,15 +1120,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mikro-orm/cli": {
|
||||
"version": "6.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/cli/-/cli-6.4.4.tgz",
|
||||
"integrity": "sha512-GgYpwZFLndijNa1YxPtGeHyqQM3uwXxxoXEh7qbG2MDggkpt8VYGMj66NLjykNv25meARCEdijE02DpVZh8eoQ==",
|
||||
"dev": true,
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/cli/-/cli-6.4.5.tgz",
|
||||
"integrity": "sha512-Ujmpy6ZFs//2TYzi0Q1tzmrOjq+SwtkT7Iv1RUsniaF21N6R71qhQnSHdkJgVuaGGE5a6Qyp52mDWSwW4qb9EQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jercle/yargonaut": "1.1.5",
|
||||
"@mikro-orm/core": "6.4.4",
|
||||
"@mikro-orm/knex": "6.4.4",
|
||||
"@mikro-orm/core": "6.4.5",
|
||||
"@mikro-orm/knex": "6.4.5",
|
||||
"fs-extra": "11.3.0",
|
||||
"tsconfig-paths": "4.2.0",
|
||||
"yargs": "17.7.2"
|
||||
@ -1129,9 +1141,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mikro-orm/core": {
|
||||
"version": "6.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/core/-/core-6.4.4.tgz",
|
||||
"integrity": "sha512-1Ff+fJX7pZFaZt9ebFxPW2w8yDp/uz2VhSMqqop1538VRvTqHseTRI+2Tmm9oX5pm5y5YS7+FdgnyAx6FLWjHg==",
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/core/-/core-6.4.5.tgz",
|
||||
"integrity": "sha512-9/CZ5oSbf4P1oBZA2HHKzuxh5yYKDNUZZq/RvJmzMdJDgV8fpTt26po/7J6UytABqZp9yXj1jXc+Kqv73vGGOA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dataloader": "2.2.3",
|
||||
@ -1139,7 +1151,7 @@
|
||||
"esprima": "4.0.1",
|
||||
"fs-extra": "11.3.0",
|
||||
"globby": "11.1.0",
|
||||
"mikro-orm": "6.4.4",
|
||||
"mikro-orm": "6.4.5",
|
||||
"reflect-metadata": "0.2.2"
|
||||
},
|
||||
"engines": {
|
||||
@ -1150,9 +1162,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mikro-orm/knex": {
|
||||
"version": "6.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/knex/-/knex-6.4.4.tgz",
|
||||
"integrity": "sha512-lzTce9SrdD3zO9mQP0MXqXTPM1+X7DXP19SgFnhygLEcBfWPgx1iRxjxOWbLjdM6p41p0Fh+5W73bwF/4jrIfQ==",
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/knex/-/knex-6.4.5.tgz",
|
||||
"integrity": "sha512-5D4NGD9bxmROUf8MVhR4mmZjzQtuM/Sg+eOnfOPzVaIkvuQItE4zR0Bg7gRr1XSgZ/OcJ/6q2ZoXH1HxSjykkw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fs-extra": "11.3.0",
|
||||
@ -1181,12 +1193,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mikro-orm/mariadb": {
|
||||
"version": "6.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/mariadb/-/mariadb-6.4.4.tgz",
|
||||
"integrity": "sha512-mxTGdOPOyNR7kh18CL2xcFexFkYpyD6jIAQFJlUAmKrXEHpkcOuY8fIHGw8fqJW9eVfBjdNqyDEDjz9iAxFxLA==",
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/mariadb/-/mariadb-6.4.5.tgz",
|
||||
"integrity": "sha512-fXyMZ5x1MIkQ+N7TyLgc5SjECpXRF+g0G6dvyYexdyoAo80RWPKksoZzRBrEDDbmMg8eEtpkqJ4bm29szuJijA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@mikro-orm/knex": "6.4.4",
|
||||
"@mikro-orm/knex": "6.4.5",
|
||||
"mariadb": "3.4.0"
|
||||
},
|
||||
"engines": {
|
||||
@ -1197,12 +1209,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mikro-orm/migrations": {
|
||||
"version": "6.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/migrations/-/migrations-6.4.4.tgz",
|
||||
"integrity": "sha512-eeN91BjV4RDizWu5r+z2taVhFivbLmj04udkJ4ZGrrYGB+DIH6nb7zqLKiLbKvHUknXkzNX10wEPOuav/wW+Kg==",
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/migrations/-/migrations-6.4.5.tgz",
|
||||
"integrity": "sha512-cMvBLJGVXNT4iUsgjtMi3wtU9I3AtrI+JF68VFUc6tGkHgt3SS2rfrAw5MNAQaa47NXo9OfUWda4/MbRlV0VjA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@mikro-orm/knex": "6.4.4",
|
||||
"@mikro-orm/knex": "6.4.5",
|
||||
"fs-extra": "11.3.0",
|
||||
"umzug": "3.8.2"
|
||||
},
|
||||
@ -1214,12 +1226,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mikro-orm/mysql": {
|
||||
"version": "6.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/mysql/-/mysql-6.4.4.tgz",
|
||||
"integrity": "sha512-OnSsYnr/o8TLjmFXtwI2anuAyNj5Nrgde2uUY5pECGnUkN2jH9+8AdXQmlgljodYNmZrc04QbhbvG65PjL0LsA==",
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/mysql/-/mysql-6.4.5.tgz",
|
||||
"integrity": "sha512-DAVroZqmXyAgIUXdiTCSRC3wG00FxE8FTi6YqcI0tE5SptJxc2t87lloRoU0oqzrwwKrlIDuBQ8le/opeiogkQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@mikro-orm/knex": "6.4.4",
|
||||
"@mikro-orm/knex": "6.4.5",
|
||||
"mysql2": "3.12.0"
|
||||
},
|
||||
"engines": {
|
||||
@ -1230,9 +1242,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@mikro-orm/reflection": {
|
||||
"version": "6.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/reflection/-/reflection-6.4.4.tgz",
|
||||
"integrity": "sha512-qNScd9vlQdbu5o34N834QGpXTH0OEgjZKZbZYqDzBbEzvMbz4VByXFiMFo0kw39/y2+RlB+hrH7kPfcAYIYQxA==",
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@mikro-orm/reflection/-/reflection-6.4.5.tgz",
|
||||
"integrity": "sha512-2yXbwAEKRmsJ0+Yt/6lAG+NCRgHdSOGTlzWmLvow+PfCUjSubfUM6rlowBchOAH+7swmsUFmHeeKWV6YG2SeMg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"globby": "11.1.0",
|
||||
@ -1366,15 +1378,15 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library": {
|
||||
"version": "5.10.2",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.10.2.tgz",
|
||||
"integrity": "sha512-xOF/2gVJZTfjTxbo4BDj9RtQq/HFnrrKdtem4JkyRLnwsRz2UDTg8gA1/et10fBx5RxmZD9bYVGST69W8ME5OQ==",
|
||||
"version": "5.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.11.0.tgz",
|
||||
"integrity": "sha512-I8+VzG9A0F3nH2rLpPd7hF8F7l5Xb7D+ldrWVZYegXM6CsKkvWc670RlgK3WX8/AseZfXA/vVrh0bpXe2Y2UDQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ajv": "~8.13.0",
|
||||
"ajv-draft-04": "~1.0.0",
|
||||
"ajv-formats": "~3.0.1",
|
||||
"fs-extra": "~7.0.1",
|
||||
"fs-extra": "~11.3.0",
|
||||
"import-lazy": "~4.0.0",
|
||||
"jju": "~1.4.0",
|
||||
"resolve": "~1.22.1",
|
||||
@ -1419,35 +1431,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/fs-extra": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
|
||||
"integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6 <7 || >=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/json-schema-traverse": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
|
||||
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/jsonfile": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
|
||||
"integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
|
||||
"license": "MIT",
|
||||
"optionalDependencies": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
@ -1475,22 +1464,13 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/node-core-library/node_modules/universalify": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/terminal": {
|
||||
"version": "0.14.5",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.14.5.tgz",
|
||||
"integrity": "sha512-TEOpNwwmsZVrkp0omnuTUTGZRJKTr6n6m4OITiNjkqzLAkcazVpwR1SOtBg6uzpkIBLgrcNHETqI8rbw3uiUfw==",
|
||||
"version": "0.14.6",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.14.6.tgz",
|
||||
"integrity": "sha512-4nMUy4h0u5PGXVG71kEA9uYI3l8GjVqewoHOFONiM6fuqS51ORdaJZ5ZXB2VZEGUyfg1TOTSy88MF2cdAy+lqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rushstack/node-core-library": "5.10.2",
|
||||
"@rushstack/node-core-library": "5.11.0",
|
||||
"supports-color": "~8.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
@ -1518,12 +1498,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/ts-command-line": {
|
||||
"version": "4.23.3",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.23.3.tgz",
|
||||
"integrity": "sha512-HazKL8fv4HMQMzrKJCrOrhyBPPdzk7iajUXgsASwjQ8ROo1cmgyqxt/k9+SdmrNLGE1zATgRqMUH3s/6smbRMA==",
|
||||
"version": "4.23.4",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.23.4.tgz",
|
||||
"integrity": "sha512-pqmzDJCm0TS8VyeqnzcJ7ncwXgiLDQ6LVmXXfqv2nPL6VIz+UpyTpNVfZRJpyyJ+UDxqob1vIj2liaUfBjv8/A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rushstack/terminal": "0.14.5",
|
||||
"@rushstack/terminal": "0.14.6",
|
||||
"@types/argparse": "1.0.38",
|
||||
"argparse": "~1.0.9",
|
||||
"string-argv": "~0.3.1"
|
||||
@ -1545,9 +1525,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@ts-morph/common": {
|
||||
"version": "0.26.0",
|
||||
"resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.26.0.tgz",
|
||||
"integrity": "sha512-/RmKAtctStXqM5nECMQ46duT74Hoig/DBzhWXGHcodlDNrgRbsbwwHqSKFNbca6z9Xt/CUWMeXOsC9QEN1+rqw==",
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.26.1.tgz",
|
||||
"integrity": "sha512-Sn28TGl/4cFpcM+jwsH1wLncYq3FtN/BIpem+HOygfBWPT5pAeS5dB4VFVzV8FbnOKHpDLZmvAl4AjPEev5idA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-glob": "^3.3.2",
|
||||
@ -1717,9 +1697,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.17.16",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.16.tgz",
|
||||
"integrity": "sha512-vOTpLduLkZXePLxHiHsBLp98mHGnl8RptV4YAO3HfKO5UHjDvySGbxKtpYfy8Sx5+WKcgc45qNreJJRVM3L6mw==",
|
||||
"version": "20.17.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.17.tgz",
|
||||
"integrity": "sha512-/WndGO4kIfMicEQLTi/mDANUu/iVUhT7KboZPdEqqHQ4aTS+3qT3U5gIqWDFV+XouorjfgGqvKILJeHhuQgFYg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.19.2"
|
||||
@ -1773,21 +1753,21 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "8.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.22.0.tgz",
|
||||
"integrity": "sha512-4Uta6REnz/xEJMvwf72wdUnC3rr4jAQf5jnTkeRQ9b6soxLxhDEbS/pfMPoJLDfFPNVRdryqWUIV/2GZzDJFZw==",
|
||||
"version": "8.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.23.0.tgz",
|
||||
"integrity": "sha512-vBz65tJgRrA1Q5gWlRfvoH+w943dq9K1p1yDBY2pc+a1nbBLZp7fB9+Hk8DaALUbzjqlMfgaqlVPT1REJdkt/w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.10.0",
|
||||
"@typescript-eslint/scope-manager": "8.22.0",
|
||||
"@typescript-eslint/type-utils": "8.22.0",
|
||||
"@typescript-eslint/utils": "8.22.0",
|
||||
"@typescript-eslint/visitor-keys": "8.22.0",
|
||||
"@typescript-eslint/scope-manager": "8.23.0",
|
||||
"@typescript-eslint/type-utils": "8.23.0",
|
||||
"@typescript-eslint/utils": "8.23.0",
|
||||
"@typescript-eslint/visitor-keys": "8.23.0",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.3.1",
|
||||
"natural-compare": "^1.4.0",
|
||||
"ts-api-utils": "^2.0.0"
|
||||
"ts-api-utils": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@ -1803,16 +1783,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "8.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.22.0.tgz",
|
||||
"integrity": "sha512-MqtmbdNEdoNxTPzpWiWnqNac54h8JDAmkWtJExBVVnSrSmi9z+sZUt0LfKqk9rjqmKOIeRhO4fHHJ1nQIjduIQ==",
|
||||
"version": "8.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.23.0.tgz",
|
||||
"integrity": "sha512-h2lUByouOXFAlMec2mILeELUbME5SZRN/7R9Cw2RD2lRQQY08MWMM+PmVVKKJNK1aIwqTo9t/0CvOxwPbRIE2Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.22.0",
|
||||
"@typescript-eslint/types": "8.22.0",
|
||||
"@typescript-eslint/typescript-estree": "8.22.0",
|
||||
"@typescript-eslint/visitor-keys": "8.22.0",
|
||||
"@typescript-eslint/scope-manager": "8.23.0",
|
||||
"@typescript-eslint/types": "8.23.0",
|
||||
"@typescript-eslint/typescript-estree": "8.23.0",
|
||||
"@typescript-eslint/visitor-keys": "8.23.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@ -1828,14 +1808,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "8.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.22.0.tgz",
|
||||
"integrity": "sha512-/lwVV0UYgkj7wPSw0o8URy6YI64QmcOdwHuGuxWIYznO6d45ER0wXUbksr9pYdViAofpUCNJx/tAzNukgvaaiQ==",
|
||||
"version": "8.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.23.0.tgz",
|
||||
"integrity": "sha512-OGqo7+dXHqI7Hfm+WqkZjKjsiRtFUQHPdGMXzk5mYXhJUedO7e/Y7i8AK3MyLMgZR93TX4bIzYrfyVjLC+0VSw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.22.0",
|
||||
"@typescript-eslint/visitor-keys": "8.22.0"
|
||||
"@typescript-eslint/types": "8.23.0",
|
||||
"@typescript-eslint/visitor-keys": "8.23.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@ -1846,16 +1826,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "8.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.22.0.tgz",
|
||||
"integrity": "sha512-NzE3aB62fDEaGjaAYZE4LH7I1MUwHooQ98Byq0G0y3kkibPJQIXVUspzlFOmOfHhiDLwKzMlWxaNv+/qcZurJA==",
|
||||
"version": "8.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.23.0.tgz",
|
||||
"integrity": "sha512-iIuLdYpQWZKbiH+RkCGc6iu+VwscP5rCtQ1lyQ7TYuKLrcZoeJVpcLiG8DliXVkUxirW/PWlmS+d6yD51L9jvA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "8.22.0",
|
||||
"@typescript-eslint/utils": "8.22.0",
|
||||
"@typescript-eslint/typescript-estree": "8.23.0",
|
||||
"@typescript-eslint/utils": "8.23.0",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^2.0.0"
|
||||
"ts-api-utils": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@ -1870,9 +1850,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "8.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.22.0.tgz",
|
||||
"integrity": "sha512-0S4M4baNzp612zwpD4YOieP3VowOARgK2EkN/GBn95hpyF8E2fbMT55sRHWBq+Huaqk3b3XK+rxxlM8sPgGM6A==",
|
||||
"version": "8.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.23.0.tgz",
|
||||
"integrity": "sha512-1sK4ILJbCmZOTt9k4vkoulT6/y5CHJ1qUYxqpF1K/DBAd8+ZUL4LlSCxOssuH5m4rUaaN0uS0HlVPvd45zjduQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@ -1884,20 +1864,20 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "8.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.22.0.tgz",
|
||||
"integrity": "sha512-SJX99NAS2ugGOzpyhMza/tX+zDwjvwAtQFLsBo3GQxiGcvaKlqGBkmZ+Y1IdiSi9h4Q0Lr5ey+Cp9CGWNY/F/w==",
|
||||
"version": "8.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.23.0.tgz",
|
||||
"integrity": "sha512-LcqzfipsB8RTvH8FX24W4UUFk1bl+0yTOf9ZA08XngFwMg4Kj8A+9hwz8Cr/ZS4KwHrmo9PJiLZkOt49vPnuvQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.22.0",
|
||||
"@typescript-eslint/visitor-keys": "8.22.0",
|
||||
"@typescript-eslint/types": "8.23.0",
|
||||
"@typescript-eslint/visitor-keys": "8.23.0",
|
||||
"debug": "^4.3.4",
|
||||
"fast-glob": "^3.3.2",
|
||||
"is-glob": "^4.0.3",
|
||||
"minimatch": "^9.0.4",
|
||||
"semver": "^7.6.0",
|
||||
"ts-api-utils": "^2.0.0"
|
||||
"ts-api-utils": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@ -1911,16 +1891,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "8.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.22.0.tgz",
|
||||
"integrity": "sha512-T8oc1MbF8L+Bk2msAvCUzjxVB2Z2f+vXYfcucE2wOmYs7ZUwco5Ep0fYZw8quNwOiw9K8GYVL+Kgc2pETNTLOg==",
|
||||
"version": "8.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.23.0.tgz",
|
||||
"integrity": "sha512-uB/+PSo6Exu02b5ZEiVtmY6RVYO7YU5xqgzTIVZwTHvvK3HsL8tZZHFaTLFtRG3CsV4A5mhOv+NZx5BlhXPyIA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@typescript-eslint/scope-manager": "8.22.0",
|
||||
"@typescript-eslint/types": "8.22.0",
|
||||
"@typescript-eslint/typescript-estree": "8.22.0"
|
||||
"@typescript-eslint/scope-manager": "8.23.0",
|
||||
"@typescript-eslint/types": "8.23.0",
|
||||
"@typescript-eslint/typescript-estree": "8.23.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@ -1935,13 +1915,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "8.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.22.0.tgz",
|
||||
"integrity": "sha512-AWpYAXnUgvLNabGTy3uBylkgZoosva/miNd1I8Bz3SjotmQPbVqhO4Cczo8AsZ44XVErEBPr/CRSgaj8sG7g0w==",
|
||||
"version": "8.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.23.0.tgz",
|
||||
"integrity": "sha512-oWWhcWDLwDfu++BGTZcmXWqpwtkwb5o7fxUIGksMQQDSdPW9prsSnfIOZMlsj4vBOSrcnjIUZMiIjODgGosFhQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.22.0",
|
||||
"@typescript-eslint/types": "8.23.0",
|
||||
"eslint-visitor-keys": "^4.2.0"
|
||||
},
|
||||
"engines": {
|
||||
@ -2072,7 +2052,6 @@
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@ -2082,7 +2061,6 @@
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
@ -2400,9 +2378,9 @@
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/bullmq": {
|
||||
"version": "5.39.0",
|
||||
"resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.39.0.tgz",
|
||||
"integrity": "sha512-aS+wtZsjW4/9mv2iZRynkSvEXCFS5h3Ko+OgArJco5rEgTE7v/TehDKv6gYEsKVbavOgiNlUNjgEhWhrzDSLBg==",
|
||||
"version": "5.40.2",
|
||||
"resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.40.2.tgz",
|
||||
"integrity": "sha512-Cn4NUpwGAF4WnuXR2kTZCTAUEUHajSCn/IqiDG9ry1kVvAwwwg1Ati3J5HN2uZjqD5PBfNDXYnsc2+0PzakDwg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cron-parser": "^4.9.0",
|
||||
@ -2485,7 +2463,6 @@
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
@ -2540,7 +2517,6 @@
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
|
||||
"integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"string-width": "^4.2.0",
|
||||
@ -2959,7 +2935,6 @@
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
@ -3235,18 +3210,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "9.19.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.19.0.tgz",
|
||||
"integrity": "sha512-ug92j0LepKlbbEv6hD911THhoRHmbdXt2gX+VDABAW/Ir7D3nqKdv5Pf5vtlyY6HQMTEP2skXY43ueqTCWssEA==",
|
||||
"version": "9.20.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.20.0.tgz",
|
||||
"integrity": "sha512-aL4F8167Hg4IvsW89ejnpTwx+B/UQRzJPGgbIOl+4XqffWsahVVsLEWoZvnrVuwpWmnRd7XeXmQI1zlKcFDteA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
"@eslint/config-array": "^0.19.0",
|
||||
"@eslint/core": "^0.10.0",
|
||||
"@eslint/core": "^0.11.0",
|
||||
"@eslint/eslintrc": "^3.2.0",
|
||||
"@eslint/js": "9.19.0",
|
||||
"@eslint/js": "9.20.0",
|
||||
"@eslint/plugin-kit": "^0.2.5",
|
||||
"@humanfs/node": "^0.16.6",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
@ -3771,9 +3746,9 @@
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/fastq": {
|
||||
"version": "1.18.0",
|
||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz",
|
||||
"integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==",
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz",
|
||||
"integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"reusify": "^1.0.4"
|
||||
@ -3783,7 +3758,6 @@
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/figlet/-/figlet-1.8.0.tgz",
|
||||
"integrity": "sha512-chzvGjd+Sp7KUvPHZv6EXV5Ir3Q7kYNpCr4aHrRW79qFtTefmQZNny+W1pW9kf5zeE6dikku2W50W/wAH2xWgw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"figlet": "bin/index.js"
|
||||
@ -4004,7 +3978,6 @@
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
@ -4317,9 +4290,9 @@
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/import-fresh": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
||||
"integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
|
||||
"integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@ -4383,9 +4356,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/ioredis": {
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.4.2.tgz",
|
||||
"integrity": "sha512-0SZXGNGZ+WzISQ67QDyZ2x0+wVxjjUndtD8oSeik/4ajifeiRufed8fCb8QW8VMyi4MXcS+UO1k/0NGhvq1PAg==",
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.5.0.tgz",
|
||||
"integrity": "sha512-7CutT89g23FfSa8MDoIFs2GYYa0PaNiW/OrT+nRyjRXHDZd17HmIgy+reOQ/yhh72NznNjGuS8kbCAcA4Ro4mw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ioredis/commands": "^1.1.1",
|
||||
@ -4489,13 +4462,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-boolean-object": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.1.tgz",
|
||||
"integrity": "sha512-l9qO6eFlUETHtuihLcYOaLKByJ1f+N4kthcU9YjHy3N+B3hWv0y/2Nd0mu/7lTFnRQHTrSdXF50HQ3bl5fEnng==",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz",
|
||||
"integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"call-bound": "^1.0.3",
|
||||
"has-tostringtag": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
@ -4597,7 +4570,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@ -4792,13 +4764,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-weakref": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.0.tgz",
|
||||
"integrity": "sha512-SXM8Nwyys6nT5WP6pltOwKytLV7FqQ4UiibxVmW+EIosHcmCqkkjViTb5SNssDlkCiEYRP1/pdWUKVvZBmsR2Q==",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz",
|
||||
"integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2"
|
||||
"call-bound": "^1.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@ -4882,7 +4854,6 @@
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"json5": "lib/cli.js"
|
||||
@ -5195,9 +5166,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mariadb/node_modules/@types/node": {
|
||||
"version": "22.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.12.0.tgz",
|
||||
"integrity": "sha512-Fll2FZ1riMjNmlmJOdAyY5pUbkftXslB5DgEzlIuNaiWhXd00FhWxVC/r4yV/4wBb9JfImTu+jiSvXTkJ7F/gA==",
|
||||
"version": "22.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.1.tgz",
|
||||
"integrity": "sha512-jK8uzQlrvXqEU91UxiK5J7pKHyzgnI1Qnl0QDHIgVGuolJhRb9EEl28Cj9b3rGR8B2lhFCtvIm5os8lFnO/1Ew==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.20.0"
|
||||
@ -5280,9 +5251,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mikro-orm": {
|
||||
"version": "6.4.4",
|
||||
"resolved": "https://registry.npmjs.org/mikro-orm/-/mikro-orm-6.4.4.tgz",
|
||||
"integrity": "sha512-nHV0lZnPUwidqeVyJwBegKDW9KwTxfH5yNp0aGSud9EI0mFkjK/M4EVfh+vwg/y6gdSIu9UnwDORYP2hJw96dQ==",
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/mikro-orm/-/mikro-orm-6.4.5.tgz",
|
||||
"integrity": "sha512-CFQf87MG4c1N3J/3ELtmwFKXHBzp62o/da7dt43V9cGXygBs65KSk3EBCAdyd5VYNtu/09mt/rztanQSWNWzog==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 18.12.0"
|
||||
@ -5340,7 +5311,6 @@
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
@ -5578,9 +5548,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.3",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz",
|
||||
"integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==",
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@ -5779,7 +5749,6 @@
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parent-require/-/parent-require-1.0.0.tgz",
|
||||
"integrity": "sha512-2MXDNZC4aXdkkap+rBBMv0lUsfJqvX5/2FiYYnfCnorZt3Pk06/IOR5KeaoghgS2w07MLWgjbsnyaq6PdHn2LQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
@ -5905,9 +5874,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/possible-typed-array-names": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz",
|
||||
"integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
|
||||
"integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@ -6159,7 +6128,6 @@
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@ -6338,9 +6306,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.7.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.0.tgz",
|
||||
"integrity": "sha512-DrfFnPzblFmNrIZzg5RzHegbiRWg7KMR7btwi2yjHwx06zsUbO5g613sVwEV7FTwmzJu+Io0lJe2GJ3LxqpvBQ==",
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz",
|
||||
"integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
@ -6790,7 +6758,6 @@
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
@ -6864,7 +6831,6 @@
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
@ -6877,7 +6843,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
|
||||
"integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
@ -6900,7 +6865,6 @@
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
@ -6980,9 +6944,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/ts-api-utils": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz",
|
||||
"integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.1.tgz",
|
||||
"integrity": "sha512-dnlgjFSVetynI8nzgJ+qF62efpglpWRk8isUEWZGWlJYySCTD6aKvbUDu+zbPeDakk3bg5H4XpitHukgfL1m9w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@ -7049,7 +7013,6 @@
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz",
|
||||
"integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"json5": "^2.2.2",
|
||||
@ -7445,7 +7408,6 @@
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
||||
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
@ -7484,7 +7446,6 @@
|
||||
"version": "5.0.8",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
@ -7500,7 +7461,6 @@
|
||||
"version": "17.7.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
||||
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cliui": "^8.0.1",
|
||||
@ -7519,7 +7479,6 @@
|
||||
"version": "21.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
|
||||
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
|
22
package.json
22
package.json
@ -1,18 +1,34 @@
|
||||
{
|
||||
"type": "module",
|
||||
"tsNode": true,
|
||||
"scripts": {
|
||||
"start": "node dist/server.js",
|
||||
"start": "tsx src/server.ts",
|
||||
"dev": "nodemon --exec tsx src/server.ts",
|
||||
"build": "tsc",
|
||||
"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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mikro-orm/core": "^6.4.2",
|
||||
"@mikro-orm/mariadb": "^6.4.2",
|
||||
"@mikro-orm/migrations": "^6.4.2",
|
||||
"@mikro-orm/mysql": "^6.4.2",
|
||||
"@mikro-orm/reflection": "^6.4.2",
|
||||
"@mikro-orm/cli": "^6.4.2",
|
||||
"@types/ioredis": "^4.28.10",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"bullmq": "^5.13.2",
|
||||
@ -23,6 +39,7 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"nodemailer": "^6.9.15",
|
||||
"pino": "^9.3.2",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"sharp": "^0.33.4",
|
||||
"socket.io": "^4.7.5",
|
||||
"ts-node": "^10.9.2",
|
||||
@ -30,7 +47,6 @@
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mikro-orm/cli": "^6.4.2",
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/jsonwebtoken": "^9.0.6",
|
||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
import fs from 'fs'
|
||||
|
||||
import { Response } from 'express'
|
||||
import type { Response } from 'express'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import type { TSocket } from '#application/types'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import { TSocket } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
|
||||
@ -25,12 +26,13 @@ export abstract class BaseEvent {
|
||||
|
||||
protected emitError(message: string): void {
|
||||
this.socket.emit('notification', { title: 'Server message', message })
|
||||
this.logger.error('character:connect error', `Player ${this.socket.userId}: ${message}`)
|
||||
this.logger.error('Base event error', `Player ${this.socket.userId}: ${message}`)
|
||||
}
|
||||
|
||||
protected handleError(context: string, error: unknown): void {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error)
|
||||
this.emitError(`${context}: ${errorMessage}`)
|
||||
this.logger.error('character:connect error', errorMessage)
|
||||
console.log(error)
|
||||
const errorMessage = error instanceof Error ? error.message : error && typeof error === 'object' && 'toString' in error ? error.toString() : String(error)
|
||||
this.socket.emit('notification', { title: 'Server message', message: `Server error occured. Please contact the server administrator.` })
|
||||
this.logger.error('Base event error', errorMessage)
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { EntityManager } from '@mikro-orm/core'
|
||||
|
||||
import Database from '../database'
|
||||
|
||||
import Database from '#application/database'
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
|
||||
export abstract class BaseRepository {
|
||||
|
@ -2,9 +2,10 @@ 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 { Command } from '#application/types'
|
||||
|
||||
export class CommandRegistry {
|
||||
private readonly commands: Map<string, Command> = new Map()
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { MikroORM } from '@mikro-orm/mysql'
|
||||
|
||||
import Logger, { LoggerType } from './logger'
|
||||
import config from '../../mikro-orm.config'
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import config from '#root/mikro-orm.config'
|
||||
|
||||
class Database {
|
||||
private static orm: MikroORM
|
||||
|
@ -1,4 +1,5 @@
|
||||
import pino from 'pino'
|
||||
const logger = pino.pino
|
||||
|
||||
export enum LoggerType {
|
||||
HTTP = 'http',
|
||||
@ -13,13 +14,13 @@ export enum LoggerType {
|
||||
}
|
||||
|
||||
class Logger {
|
||||
private instances: Map<LoggerType, ReturnType<typeof pino>> = new Map()
|
||||
private instances: Map<LoggerType, pino.Logger> = new Map()
|
||||
|
||||
private getLogger(type: LoggerType): ReturnType<typeof pino> {
|
||||
private getLogger(type: LoggerType): pino.Logger {
|
||||
if (!this.instances.has(type)) {
|
||||
this.instances.set(
|
||||
type,
|
||||
pino({
|
||||
logger({
|
||||
level: process.env.LOG_LEVEL || 'debug',
|
||||
transport: {
|
||||
target: 'pino/file',
|
||||
|
@ -2,10 +2,11 @@ import fs from 'fs'
|
||||
|
||||
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 { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import { CharacterHair } from '#entities/characterHair'
|
||||
import { CharacterType } from '#entities/characterType'
|
||||
@ -64,12 +65,12 @@ export default class InitCommand extends BaseCommand {
|
||||
.setFrameWidth(
|
||||
(await sharp(Storage.getPublicPath('map_objects', mapObject))
|
||||
.metadata()
|
||||
.then((metadata) => metadata.height)) ?? 0
|
||||
.then((metadata) => metadata.width)) ?? 0
|
||||
)
|
||||
.setFrameHeight(
|
||||
(await sharp(Storage.getPublicPath('map_objects', mapObject))
|
||||
.metadata()
|
||||
.then((metadata) => metadata.width)) ?? 0
|
||||
.then((metadata) => metadata.height)) ?? 0
|
||||
)
|
||||
|
||||
await newMapObject.save()
|
||||
@ -95,7 +96,7 @@ export default class InitCommand extends BaseCommand {
|
||||
])
|
||||
.setOriginX(0)
|
||||
.setOriginY(0)
|
||||
.setFrameWidth(64)
|
||||
.setFrameWidth(28)
|
||||
.setFrameHeight(94)
|
||||
.setFrameRate(0)
|
||||
.setSprite(characterSprite)
|
||||
@ -115,8 +116,8 @@ export default class InitCommand extends BaseCommand {
|
||||
])
|
||||
.setOriginX(0)
|
||||
.setOriginY(0)
|
||||
.setFrameWidth(64)
|
||||
.setFrameHeight(94)
|
||||
.setFrameWidth(26)
|
||||
.setFrameHeight(93)
|
||||
.setFrameRate(0)
|
||||
.setSprite(characterSprite)
|
||||
.save()
|
||||
@ -156,8 +157,8 @@ export default class InitCommand extends BaseCommand {
|
||||
])
|
||||
.setOriginX(0)
|
||||
.setOriginY(0)
|
||||
.setFrameWidth(64)
|
||||
.setFrameHeight(94)
|
||||
.setFrameWidth(36)
|
||||
.setFrameHeight(102)
|
||||
.setFrameRate(7)
|
||||
.setSprite(characterSprite)
|
||||
.save()
|
||||
@ -197,12 +198,80 @@ export default class InitCommand extends BaseCommand {
|
||||
])
|
||||
.setOriginX(0)
|
||||
.setOriginY(0)
|
||||
.setFrameWidth(64)
|
||||
.setFrameHeight(94)
|
||||
.setFrameWidth(34)
|
||||
.setFrameHeight(101)
|
||||
.setFrameRate(7)
|
||||
.setSprite(characterSprite)
|
||||
.save()
|
||||
|
||||
const attackRightDownAction = new SpriteAction()
|
||||
await attackRightDownAction
|
||||
.setAction('attack_right_down')
|
||||
.setSprites([
|
||||
{
|
||||
url: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAABnCAYAAAD1wenSAAAG9UlEQVR4nNVaP2gbVxj/STaqsBECyegaCJyhEbdIIC81LtSLancpGpKxpmhKTCiIOhDo4sG7Ah0KzSbcLCltB5PJxhAMIXiygwRFnAcdBMKpsogQEorBcofT9/Teuz+6s+WhPxDo7p6+3/ve+/6+Uyj/83NMG4m9nSv63i5sh2Zvg2BrfRlqVoNRrePZ3s5VeNoExdwi1KyGaDoDNasBAKZKAgCJlIJoOoO5hXl2b+okAASCWyMhGNX67ZL0Wz32/VZIeIJbI5ERyE94J+PRLmyHbkxCwou5RSzlV23PS2UX8qbpj4QcLJFSmJPJJvr8twwGeg2l8i4T7FsTIqDZE8FMMi2Mm4MOIINfnvyAUnkXK5KciRufSCmMwA0zyTTmFuYRTVtEjzaf+iPh41AQOE0msAn3Wz1cnuueY2RtrhXq+63eaB/EezKspW5cj8RNqBs8l2tl8zELcsNO17fQUnnXP8lAr0G7/wAnh0e4aBrCs0ebT21WRPePMvf8k5AWK5uPcXJ4ZBP08l3DRvTyXcMmx5Ok3TQx0GsArE2kJSNBd77/xlGob5J2YTtUOW0wbdSshoumgWGni49v/2Dj+O90ffLtV8K9idZF2hjVOiOKQMU/Pz4UxvHxbCC5kfdycdrwgY+MYG5hnn0ITqY90ePbhe3Qs/1jABA2f9jpot/q2T7DThel8i5+//NX/ySEymlDIKL9kT+yqQMBwkoxt8iICM4JzNKCX7ZAYaWYWwQw1komBazgKO9LIBKa+VJ+lRkDZcxSeRfF3CKMah1a2sqUvtIvn9speRHUrAYV41yztb7MhJLJe2rCC+eFAuMU3G/1WDSIpjNs9gTe5G0klBEBsKXgMdBrGOgQfCcxclRBTkpxXi65cEisLLMZy2mVZm5wBDRmoNegZjW0D132hNY+sbJsFQjQWZiI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J/oeH7+OaddN4L9McM54tkZwiy4heq7DQNHah6zzxNQ4eGFOtsuXWynJCPJu6rlIQqXfeQ8MnMy3zJ8EMk0/8H7K0PiqjDvQPfCjLwMFEmRhUQtd15HNW3pde25RzYZxmwVwhkGbc8JANKlEq1Bi9relrGLQVQt9xvVc2JnjhwGPAf4fZfvtBkeH/pRRskFBmvLC07RNpkKlDf51yzdlBIR1Mv6xYRpC1D6itbXPPdBUCutpEmE01obMt+94PsbQwyZYQ0GT6S6sWNQERkKz6hz9AsM5+xZoRW1rb8JkjLhF9EC02GJ2TtNbrOed1L2hSku+EbTb2Ygsji3HQmTFL930TPqoNSeDCbFcrCuZHhHTYSjyESj0GZzuKrRz8LdercyFA7n1/zBqyVFNEsoSerKm6gGQR5Dl96iqRB+t9oQeGXLtyi9D+rtYwUcNakSwAAAABJRU5ErkJggg==',
|
||||
offset: {
|
||||
x: 17,
|
||||
y: 3
|
||||
}
|
||||
}
|
||||
])
|
||||
.setOriginX(0)
|
||||
.setOriginY(0)
|
||||
.setFrameWidth(69)
|
||||
.setFrameHeight(111)
|
||||
.setFrameRate(5)
|
||||
.setSprite(characterSprite)
|
||||
.save()
|
||||
|
||||
const attackLeftUpAction = new SpriteAction()
|
||||
await attackLeftUpAction
|
||||
.setAction('attack_left_up')
|
||||
.setSprites([
|
||||
{
|
||||
url: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAABjCAYAAABnuwu+AAAGeklEQVR4nO2av2sbSRTHv7KDYqQYgySk5DCsIdK5scGuTAi4EVZ1+C8wh8vjSqc6DlwYrnTgyusEFzjSmlQRbtwEVxbIzUYKeMEk2UVeTsgWjiDyFas3ntmd3ZnVD1f3IGDtTOYzb+fNm+/MbKL8218gyxwd3AGAu72fwBRthgfuri1hd22JwacKJWAmX5gmS4QCQCZfgLG6/DBQ8vKhgADnKQDMlVYeBPoI8F6tLjAsyOJE/CPdigTbq2wEhuLs+ATVGNNNgKZy6WEEXwSAe5UNlMoVPHn+VC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gpXzdGtrC4e1GvDlX/yBIJhgh18eew8Ky1BJfK3ksLOzA9u28XutJil9zDoHADWuTrV+gfXyJltbd9eWUD06uFNCC4UCisUiisUiXr58iVarhWKxyMpbrRb727bvX7G7vZ/gxRifp5WBxAPCftOzQiEoN62GyU7jaKXRit7FxUUsLi5Kn9Fzf2d48587KqE8jP6WdSDK/CesE0+DMovt6bhGJ6y8KaFv375lf19eXqLVauHy8lKow//O2mqtHDllsraJWu0+Kvkp4bdWqxVZzh9qKefpq2ffcPjmjfBsa2sLtm0HOlOr1ZANtBA8K9TKSG92vG0fHQdIE9Owg9UQZ62GyU5elND18ibbFK/DS22vnn0L3M1FJX1/2UjRm8kXUCpXMFdawVxpBcm8gVK5ElrfdWzhfEkL6peQdLbPb/+lsKFs8R9ojSxB6Z4mhfsbC9ntlex05UEy0kShsp341KGj2thbxalAeUEW9wxiZCigvvKYChQQxTVJEEDUProHIyPP00Gn650TIv54x4L6txhJGMJvXRtpyvhfIwF1zu9Hho5rE4PGmU5aUNlJ5jimhNJCzYPH/Zon1no6qU+HlFDy0L9Qk4SZClRmvHIYBRwLygsx2TnuVKCTsv+hzGR3a1OHTsO05IrOehnnazzto9dBp6tcM+lyQHXDHAmlOxqrYUae//FfXel82qlUDu72fuL10cEdJBfxbFsBIAnD+wijodZKWnKFVwPkgexbF10bOXoHna7wuVccG0kNWg0TxirYtTRwf+br34tOBEpjvAcA3KkowahOVBsJ/kvmOCaLTt3vQf8DHb+mhueQ5GsAAAAASUVORK5CYII=',
|
||||
offset: {
|
||||
x: 2,
|
||||
y: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
url: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAABdCAYAAABZy21jAAAGA0lEQVR4nM2aPWgbSRTH/5KDYmQLgWSkhDOsIFpUnA1yZULAjbBKd3dVOFQeV8pVOHAhuNKGK9MJLnBwpcoIN4YUac4GpRFSwAsCZxdnOeMPEkGsK+Q3mtXO7M7s6uD+jaQZ7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Pgt449ffhxKbngLEen/2uDaQ511KBHPzs4qz09PT1WFlmqaXaEyGf2dz+eRz+eVZ1GjmVba+Un2gMG6/HW1NlDKx8E6LPqnt9ttth0p52Ao39vbE8THx8eGEd2wt/KZuIl6PXVHAIhj9wbSSWJn+mEMy5tv/8O7jx+VZ4uLiwD8jVrJAWDj+eM0kT88werCXBoONMgr1FZFs+RhuYTOzm3jjeePlf0yajSxuX1LPJJygNLgE+SCgnLu1T+/SMt3qZSMGk22ZGQraADY3N7H6sKcOJoid9NXo6tEZxcRxWvKS+gYkPNnmhuuVGSHRVZiixurC3POGtRKTgjLJePwknIXV1kuhBmqb8adil6CfKbou80585ZsELJ5iW/qZyXPBQVRncmqKdm8FzkHWwphw9AT0Qm0nHn5ncn75xfoSn+PCie5TupTZMmwjrme2BMx56Yjk3OQw8K9yOU0mVSPWtoY5PKRlAwKqxQpbVcJTnIdtkn0GRqWnOtIQ0Jh2Ec9S2477vMRYSWn8X5YfGac3+ou6KOeVe4q/2RkgxAvKq+H3xMJ9Y7xHtWAQR6WS87aEjArOxtGWqFyHJcrO1sYFoGLbhNzr9QrNDknydWqg04SAw2VZOidhQ/oXgM4sb53kuvjHZZLSnblcz1M8BpznzhyZ/JcULiTAYOcSr+J/ORIl65e5KPeeY5E3j+/UPKU+0DxlqjRRFiGuDagU+m7nvEqd3ObtepgDQCk0wr5wmMUNwSkqxzCff77g47/AX/tU4BIJmZXAAAAAElFTkSuQmCC',
|
||||
offset: {
|
||||
x: 6,
|
||||
y: 1
|
||||
}
|
||||
}
|
||||
])
|
||||
.setOriginX(0)
|
||||
.setOriginY(0)
|
||||
.setFrameWidth(34)
|
||||
.setFrameHeight(100)
|
||||
.setFrameRate(5)
|
||||
.setSprite(characterSprite)
|
||||
.save()
|
||||
|
||||
const characterType = new CharacterType()
|
||||
await characterType
|
||||
.setId('75b70c78-17f0-44c0-a4fa-15043cb95be0')
|
||||
@ -233,7 +302,7 @@ export default class InitCommand extends BaseCommand {
|
||||
])
|
||||
.setOriginX(0.5)
|
||||
.setOriginY(5.34)
|
||||
.setFrameWidth(64)
|
||||
.setFrameWidth(24)
|
||||
.setFrameHeight(18)
|
||||
.setFrameRate(0)
|
||||
.setSprite(hairSprite)
|
||||
@ -253,7 +322,7 @@ export default class InitCommand extends BaseCommand {
|
||||
])
|
||||
.setOriginX(0.5)
|
||||
.setOriginY(4.34)
|
||||
.setFrameWidth(64)
|
||||
.setFrameWidth(24)
|
||||
.setFrameHeight(22)
|
||||
.setFrameRate(0)
|
||||
.setSprite(hairSprite)
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Request, Response } from 'express'
|
||||
import jwt from 'jsonwebtoken'
|
||||
|
||||
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'
|
||||
|
@ -1,11 +1,12 @@
|
||||
import fs from 'fs'
|
||||
|
||||
import { Request, Response } from 'express'
|
||||
import sharp from 'sharp'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import { BaseController } from '#application/base/baseController'
|
||||
import Storage from '#application/storage'
|
||||
import { UUID } from '#application/types'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
@ -26,7 +27,7 @@ export class AvatarController extends BaseController {
|
||||
* @param res
|
||||
*/
|
||||
public async getByName(req: Request, res: Response) {
|
||||
const character = await this.characterRepository.getByName(req.params.characterName)
|
||||
const character = await this.characterRepository.getByName(req.params.characterName!)
|
||||
if (!character?.characterType) {
|
||||
return this.sendError(res, 'Character or character type not found', 404)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Request, Response } from 'express'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import { BaseController } from '#application/base/baseController'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Request, Response } from 'express'
|
||||
import type { Request, Response } from 'express'
|
||||
|
||||
import { BaseController } from '#application/base/baseController'
|
||||
import Storage from '#application/storage'
|
||||
@ -12,6 +12,10 @@ export class TexturesController extends BaseController {
|
||||
public async download(req: Request, res: Response) {
|
||||
const { type, spriteId, file } = req.params
|
||||
|
||||
if (!type || !file) {
|
||||
return this.sendError(res, 'Invalid request', 400)
|
||||
}
|
||||
|
||||
const texture = type === 'sprites' && spriteId ? Storage.getPublicPath(type, spriteId, file) : Storage.getPublicPath(type, file)
|
||||
|
||||
this.sendFile(res, texture)
|
||||
|
@ -1,16 +1,17 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { CharacterEquipment } from '#entities/characterEquipment'
|
||||
import { CharacterHair } from '#entities/characterHair'
|
||||
import { CharacterItem } from '#entities/characterItem'
|
||||
import { CharacterType } from '#entities/characterType'
|
||||
import { Chat } from '#entities/chat'
|
||||
import { Map } from '#entities/map'
|
||||
import { User } from '#entities/user'
|
||||
|
||||
export class BaseCharacter extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
@ -28,7 +29,7 @@ export class BaseCharacter extends BaseEntity {
|
||||
@Property()
|
||||
role = 'player'
|
||||
|
||||
@OneToMany(() => Chat, (chat) => chat.character)
|
||||
@OneToMany({ mappedBy: 'character' })
|
||||
chats = new Collection<Chat>(this)
|
||||
|
||||
// Position - @TODO: Update to spawn point when current map is not found
|
||||
|
@ -2,11 +2,12 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import { CharacterItem } from '#entities/characterItem'
|
||||
|
||||
export class BaseCharacterEquipment extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
|
@ -2,9 +2,10 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
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 { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import { CharacterEquipment } from '#entities/characterEquipment'
|
||||
import { Item } from '#entities/item'
|
||||
|
||||
export class BaseCharacterItem extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
|
@ -2,9 +2,10 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
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 { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import { Map } from '#entities/map'
|
||||
|
||||
export class BaseChat extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
|
@ -2,9 +2,10 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
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 { UUID } from '#application/types'
|
||||
import { CharacterItem } from '#entities/characterItem'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { MapEffect } from '#entities/mapEffect'
|
||||
import { MapEventTile } from '#entities/mapEventTile'
|
||||
import { PlacedMapObject } from '#entities/placedMapObject'
|
||||
|
||||
export class BaseMap extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
@ -22,7 +23,7 @@ export class BaseMap extends BaseEntity {
|
||||
height = 10
|
||||
|
||||
@Property({ type: 'json', nullable: true })
|
||||
tiles?: any
|
||||
tiles: Array<Array<string>> = []
|
||||
|
||||
@Property()
|
||||
pvp = false
|
||||
@ -33,13 +34,13 @@ export class BaseMap extends BaseEntity {
|
||||
@Property()
|
||||
updatedAt = new Date()
|
||||
|
||||
@OneToMany(() => MapEffect, (effect) => effect.map, { orphanRemoval: true })
|
||||
@OneToMany({ mappedBy: 'map', orphanRemoval: true })
|
||||
mapEffects = new Collection<MapEffect>(this)
|
||||
|
||||
@OneToMany(() => MapEventTile, (tile) => tile.map, { orphanRemoval: true })
|
||||
@OneToMany({ mappedBy: 'map', orphanRemoval: true })
|
||||
mapEventTiles = new Collection<MapEventTile>(this)
|
||||
|
||||
@OneToMany(() => PlacedMapObject, (placedMapObject) => placedMapObject.map, { orphanRemoval: true })
|
||||
@OneToMany({ mappedBy: 'map', orphanRemoval: true })
|
||||
placedMapObjects = new Collection<PlacedMapObject>(this)
|
||||
|
||||
setId(id: UUID) {
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { Map } from '#entities/map'
|
||||
|
||||
export class BaseMapEffect extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, Enum, ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { Map } from '#entities/map'
|
||||
import { MapEventTileTeleport } from '#entities/mapEventTileTeleport'
|
||||
|
||||
export class BaseMapEventTile extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
@ -24,7 +25,7 @@ export class BaseMapEventTile extends BaseEntity {
|
||||
@Property()
|
||||
positionY!: number
|
||||
|
||||
@OneToOne(() => MapEventTileTeleport, (teleport) => teleport.mapEventTile, { eager: true })
|
||||
@OneToOne({ eager: true })
|
||||
teleport?: MapEventTileTeleport
|
||||
|
||||
setId(id: UUID) {
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { Map } from '#entities/map'
|
||||
import { MapEventTile } from '#entities/mapEventTile'
|
||||
|
||||
export class BaseMapEventTileTeleport extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
|
@ -2,8 +2,9 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
|
||||
export class BaseMapObject extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { User } from '#entities/user'
|
||||
|
||||
export class BasePasswordResetToken extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { Map } from '#entities/map'
|
||||
import { MapObject } from '#entities/mapObject'
|
||||
|
||||
//@TODO : Rename mapObject
|
||||
|
||||
export class BasePlacedMapObject extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
|
@ -2,8 +2,9 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
import { SpriteAction } from '#entities/spriteAction'
|
||||
|
||||
export class BaseSprite extends BaseEntity {
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
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'
|
||||
import { UUID } from '#application/types'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
|
||||
export interface SpriteImage {
|
||||
url: string
|
||||
|
@ -2,8 +2,9 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
|
||||
export class BaseTile extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
|
@ -3,8 +3,9 @@ import { randomUUID } from 'node:crypto'
|
||||
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 { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import { PasswordResetToken } from '#entities/passwordResetToken'
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import TeleportService from '#services/teleportService'
|
||||
import TeleportService from '#services/characterTeleportService'
|
||||
|
||||
interface CharacterConnectPayload {
|
||||
characterId: UUID
|
||||
|
@ -4,6 +4,7 @@ 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'
|
||||
|
||||
@ -19,35 +20,39 @@ export default class CharacterCreateEvent extends BaseEvent {
|
||||
|
||||
const userRepository = new UserRepository()
|
||||
const characterRepository = new CharacterRepository()
|
||||
const characterTypeRepository = new CharacterTypeRepository()
|
||||
const mapRepository = new MapRepository()
|
||||
|
||||
const user = await userRepository.getById(this.socket.userId!)
|
||||
|
||||
if (!user) {
|
||||
return this.socket.emit('notification', { message: 'User not found' })
|
||||
return this.socket.emit('notification', { title: 'Error', message: 'You are not logged in' })
|
||||
}
|
||||
|
||||
// Check if character name already exists
|
||||
const characterExists = await characterRepository.getByName(data.name)
|
||||
|
||||
if (characterExists) {
|
||||
return this.socket.emit('notification', { message: 'Character name already exists' })
|
||||
return this.socket.emit('notification', { title: 'Error', message: 'Character name already exists' })
|
||||
}
|
||||
|
||||
let characters: Character[] = await characterRepository.getByUserId(user.getId())
|
||||
|
||||
if (characters.length >= 4) {
|
||||
return this.socket.emit('notification', { message: 'You can only have 4 characters' })
|
||||
return this.socket.emit('notification', { title: 'Error', message: 'You can only create 4 characters' })
|
||||
}
|
||||
|
||||
// @TODO: Change to default location
|
||||
const map = await mapRepository.getFirst()
|
||||
|
||||
// @TODO: Change to selected character type
|
||||
const characterType = await characterTypeRepository.getFirst()
|
||||
|
||||
const newCharacter = new Character()
|
||||
await newCharacter.setName(data.name).setUser(user).setMap(map!).save()
|
||||
await newCharacter.setName(data.name).setUser(user).setMap(map!).setCharacterType(characterType).save()
|
||||
|
||||
if (!newCharacter) {
|
||||
return this.socket.emit('notification', { message: 'Failed to create character. Please try again (later).' })
|
||||
return this.socket.emit('notification', { title: 'Error', message: 'Failed to create character. Please try again (later).' })
|
||||
}
|
||||
|
||||
characters = [...characters, newCharacter]
|
||||
@ -59,9 +64,9 @@ export default class CharacterCreateEvent extends BaseEvent {
|
||||
} catch (error: any) {
|
||||
this.logger.error(`character:create error: ${error.message}`)
|
||||
if (error instanceof ZodError) {
|
||||
return this.socket.emit('notification', { message: error.issues[0].message })
|
||||
return this.socket.emit('notification', { title: 'Error', message: error.issues[0]!.message })
|
||||
}
|
||||
return this.socket.emit('notification', { message: 'Could not create character. Please try again (later).' })
|
||||
return this.socket.emit('notification', { title: 'Error', message: 'Could not create character. Please try again (later).' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import MapRepository from '#repositories/mapRepository'
|
||||
import TeleportService from '#services/characterTeleportService'
|
||||
import ChatService from '#services/chatService'
|
||||
import TeleportService from '#services/teleportService'
|
||||
|
||||
type TypePayload = {
|
||||
message: string
|
||||
|
@ -1,12 +1,13 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
|
||||
interface IPayload {
|
||||
id: UUID
|
||||
}
|
||||
|
||||
export default class characterHairDeleteEvent extends BaseEvent {
|
||||
export default class CharacterHairDeleteEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
this.socket.on('gm:characterHair:remove', this.handleEvent.bind(this))
|
||||
}
|
||||
@ -15,13 +16,16 @@ export default class characterHairDeleteEvent extends BaseEvent {
|
||||
try {
|
||||
if (!(await this.isCharacterGM())) return
|
||||
|
||||
const characterHair = await CharacterHairRepository.getById(data.id)
|
||||
await (await CharacterHairRepository.getById(data.id))?.delete()
|
||||
const characterHairRepository = new CharacterHairRepository()
|
||||
const characterHair = await characterHairRepository.getById(data.id)
|
||||
if (!characterHair) return callback(false)
|
||||
|
||||
await characterHair.delete()
|
||||
|
||||
return callback(true)
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting character type ${data.id}: ${error instanceof Error ? error.message : String(error)}`)
|
||||
callback(false)
|
||||
this.logger.error(`Error deleting character hair ${data.id}: ${error instanceof Error ? error.message : String(error)}`)
|
||||
return callback(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { CharacterGender } from '#application/enums'
|
||||
import { UUID } from '#application/types'
|
||||
import CharacterHairRepository from '#repositories/characterHairRepository'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
|
||||
interface IPayload {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { CharacterGender, CharacterRace } from '#application/enums'
|
||||
import { UUID } from '#application/types'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { ItemRarity, ItemType } from '#application/enums'
|
||||
import { Item } from '#entities/item'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
|
||||
export default class ItemCreateEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
@ -10,8 +12,12 @@ export default class ItemCreateEvent extends BaseEvent {
|
||||
try {
|
||||
if (!(await this.isCharacterGM())) return
|
||||
|
||||
const spriteRepository = new SpriteRepository()
|
||||
const sprite = await spriteRepository.getFirst()
|
||||
if (!sprite) return callback(false)
|
||||
|
||||
const newItem = new Item()
|
||||
await newItem.setName('New Item').setItemType('WEAPON').setStackable(false).setRarity('COMMON').setSprite(null).save()
|
||||
await newItem.setName('New Item').setItemType(ItemType.WEAPON).setStackable(false).setRarity(ItemRarity.COMMON).setSprite(sprite).save()
|
||||
|
||||
return callback(true, newItem)
|
||||
} catch (error) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import ItemRepository from '#repositories/itemRepository'
|
||||
|
||||
interface IPayload {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { ItemType, ItemRarity } from '#application/enums'
|
||||
import { UUID } from '#application/types'
|
||||
import ItemRepository from '#repositories/itemRepository'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
import fs from 'fs'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import Storage from '#application/storage'
|
||||
import { UUID } from '#application/types'
|
||||
import MapObjectRepository from '#repositories/mapObjectRepository'
|
||||
|
||||
interface IPayload {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import MapObjectRepository from '#repositories/mapObjectRepository'
|
||||
|
||||
type Payload = {
|
||||
@ -27,19 +28,19 @@ export default class MapObjectUpdateEvent extends BaseEvent {
|
||||
const mapObject = await mapObjectRepository.getById(data.id)
|
||||
if (!mapObject) return callback(false)
|
||||
|
||||
await mapObject
|
||||
.setName(data.name)
|
||||
.setTags(data.tags)
|
||||
.setOriginX(data.originX)
|
||||
.setOriginY(data.originY)
|
||||
.setFrameRate(data.frameRate)
|
||||
.setFrameWidth(data.frameWidth)
|
||||
.setFrameHeight(data.frameHeight)
|
||||
.save()
|
||||
if (data.name !== undefined) mapObject.name = data.name
|
||||
if (data.tags !== undefined) mapObject.tags = data.tags
|
||||
if (data.originX !== undefined) mapObject.originX = data.originX
|
||||
if (data.originY !== undefined) mapObject.originY = data.originY
|
||||
if (data.frameRate !== undefined) mapObject.frameRate = data.frameRate
|
||||
if (data.frameWidth !== undefined) mapObject.frameWidth = data.frameWidth
|
||||
if (data.frameHeight !== undefined) mapObject.frameHeight = data.frameHeight
|
||||
|
||||
await mapObject.save()
|
||||
|
||||
return callback(true)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
this.socket.emit('notification', { title: 'Error', message: 'Failed to update mapObject.' })
|
||||
return callback(false)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
import fs from 'fs'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import Storage from '#application/storage'
|
||||
import { UUID } from '#application/types'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
|
||||
type Payload = {
|
||||
|
@ -1,10 +1,13 @@
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import SpriteRepository from '#repositories/spriteRepository'
|
||||
import { SpriteAction } from '#entities/spriteAction'
|
||||
import sharp from 'sharp'
|
||||
import fs from 'fs'
|
||||
|
||||
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: {
|
||||
@ -59,7 +62,7 @@ export default class SpriteUpdateEvent extends BaseEvent {
|
||||
|
||||
// First verify all sprite sheets can be generated
|
||||
for (const actionData of data.spriteActions) {
|
||||
if (!await this.generateSpriteSheet(actionData.sprites, sprite.getId(), actionData.action)) {
|
||||
if (!(await this.generateSpriteSheet(actionData.sprites, sprite.getId(), actionData.action))) {
|
||||
return callback(false)
|
||||
}
|
||||
}
|
||||
@ -74,13 +77,13 @@ export default class SpriteUpdateEvent extends BaseEvent {
|
||||
// Create new actions
|
||||
for (const actionData of data.spriteActions) {
|
||||
// Process images and calculate dimensions
|
||||
const imageData = await Promise.all(actionData.sprites.map(sprite => this.processImage(sprite)))
|
||||
const effectiveDimensions = imageData.map(dimensions => this.calculateEffectiveDimensions(dimensions))
|
||||
|
||||
const imageData = await Promise.all(actionData.sprites.map((sprite) => this.processImage(sprite)))
|
||||
const effectiveDimensions = imageData.map((dimensions) => this.calculateEffectiveDimensions(dimensions))
|
||||
|
||||
// Calculate total height needed for the sprite sheet
|
||||
const maxHeight = Math.max(...effectiveDimensions.map(d => d.height))
|
||||
const maxTop = Math.max(...effectiveDimensions.map(d => d.top))
|
||||
const maxBottom = Math.max(...effectiveDimensions.map(d => d.bottom))
|
||||
const maxHeight = Math.max(...effectiveDimensions.map((d) => d.height))
|
||||
const maxTop = Math.max(...effectiveDimensions.map((d) => d.top))
|
||||
const maxBottom = Math.max(...effectiveDimensions.map((d) => d.bottom))
|
||||
const totalHeight = maxHeight + maxTop + maxBottom
|
||||
|
||||
const spriteAction = new SpriteAction()
|
||||
@ -111,14 +114,14 @@ export default class SpriteUpdateEvent extends BaseEvent {
|
||||
if (!sprites.length) return true
|
||||
|
||||
// Process all images and get their dimensions
|
||||
const imageData = await Promise.all(sprites.map(sprite => this.processImage(sprite)))
|
||||
const effectiveDimensions = imageData.map(dimensions => this.calculateEffectiveDimensions(dimensions))
|
||||
const imageData = await Promise.all(sprites.map((sprite) => this.processImage(sprite)))
|
||||
const effectiveDimensions = imageData.map((dimensions) => this.calculateEffectiveDimensions(dimensions))
|
||||
|
||||
// Calculate maximum dimensions
|
||||
const maxWidth = Math.max(...effectiveDimensions.map(d => d.width))
|
||||
const maxHeight = Math.max(...effectiveDimensions.map(d => d.height))
|
||||
const maxTop = Math.max(...effectiveDimensions.map(d => d.top))
|
||||
const maxBottom = Math.max(...effectiveDimensions.map(d => d.bottom))
|
||||
const maxWidth = Math.max(...effectiveDimensions.map((d) => d.width))
|
||||
const maxHeight = Math.max(...effectiveDimensions.map((d) => d.height))
|
||||
const maxTop = Math.max(...effectiveDimensions.map((d) => d.top))
|
||||
const maxBottom = Math.max(...effectiveDimensions.map((d) => d.bottom))
|
||||
|
||||
// Calculate total height needed
|
||||
const totalHeight = maxHeight + maxTop + maxBottom
|
||||
@ -142,9 +145,9 @@ export default class SpriteUpdateEvent extends BaseEvent {
|
||||
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
||||
}
|
||||
})
|
||||
.composite([{ input: buffer, left, top: verticalOffset }])
|
||||
.png()
|
||||
.toBuffer()
|
||||
.composite([{ input: buffer, left, top: verticalOffset }])
|
||||
.png()
|
||||
.toBuffer()
|
||||
})
|
||||
)
|
||||
|
||||
@ -157,15 +160,15 @@ export default class SpriteUpdateEvent extends BaseEvent {
|
||||
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
||||
}
|
||||
})
|
||||
.composite(
|
||||
processedImages.map((buffer, index) => ({
|
||||
input: buffer,
|
||||
left: index * maxWidth,
|
||||
top: 0
|
||||
}))
|
||||
)
|
||||
.png()
|
||||
.toBuffer()
|
||||
.composite(
|
||||
processedImages.map((buffer, index) => ({
|
||||
input: buffer,
|
||||
left: index * maxWidth,
|
||||
top: 0
|
||||
}))
|
||||
)
|
||||
.png()
|
||||
.toBuffer()
|
||||
|
||||
// Ensure directory exists
|
||||
const dir = `public/sprites/${spriteId}`
|
||||
@ -207,10 +210,10 @@ export default class SpriteUpdateEvent extends BaseEvent {
|
||||
if (!sprites.length) return 0
|
||||
|
||||
// Process all images and get their dimensions
|
||||
const imageData = await Promise.all(sprites.map(sprite => this.processImage(sprite)))
|
||||
const effectiveDimensions = imageData.map(dimensions => this.calculateEffectiveDimensions(dimensions))
|
||||
const imageData = await Promise.all(sprites.map((sprite) => this.processImage(sprite)))
|
||||
const effectiveDimensions = imageData.map((dimensions) => this.calculateEffectiveDimensions(dimensions))
|
||||
|
||||
// Calculate maximum width needed
|
||||
return Math.max(...effectiveDimensions.map(d => d.width))
|
||||
return Math.max(...effectiveDimensions.map((d) => d.width))
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
import fs from 'fs/promises'
|
||||
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import Storage from '#application/storage'
|
||||
import { UUID } from '#application/types'
|
||||
import TileRepository from '#repositories/tileRepository'
|
||||
|
||||
type Payload = {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import TileRepository from '#repositories/tileRepository'
|
||||
|
||||
type Payload = {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import type { MapCacheT } from '#entities/map'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { Map, MapCacheT } from '#entities/map'
|
||||
import { Map } from '#entities/map'
|
||||
|
||||
type Payload = {
|
||||
name: string
|
||||
@ -18,6 +20,16 @@ export default class MapCreateEvent extends BaseEvent {
|
||||
|
||||
this.logger.info(`GM ${(await this.getCharacter())!.getId()} has created a new map via map editor.`)
|
||||
|
||||
if (data.name === '') {
|
||||
this.socket.emit('notification', { title: 'Error', message: 'Map name cannot be empty.' })
|
||||
return callback(false)
|
||||
}
|
||||
|
||||
if (data.width < 1 || data.height < 1) {
|
||||
this.socket.emit('notification', { title: 'Error', message: 'Map width and height must be greater than 0.' })
|
||||
return callback(false)
|
||||
}
|
||||
|
||||
const map = new Map()
|
||||
await map
|
||||
.setName(data.name)
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import MapRepository from '#repositories/mapRepository'
|
||||
|
||||
type Payload = {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { UUID } from '#application/types'
|
||||
import { Map } from '#entities/map'
|
||||
import MapRepository from '#repositories/mapRepository'
|
||||
|
||||
@ -25,13 +26,14 @@ export default class MapRequestEvent extends BaseEvent {
|
||||
|
||||
const mapRepository = new MapRepository()
|
||||
const map = await mapRepository.getById(data.mapId)
|
||||
await mapRepository.getEntityManager().populate(map!, mapRepository.POPULATE_MAP_EDITOR as any)
|
||||
|
||||
if (!map) {
|
||||
this.logger.info(`User ${(await this.getCharacter())!.getId()} tried to request map ${data.mapId} but it does not exist.`)
|
||||
return callback(null)
|
||||
}
|
||||
|
||||
await mapRepository.getEntityManager().populate(map, mapRepository.POPULATE_MAP_EDITOR as any)
|
||||
|
||||
return callback(map)
|
||||
} catch (error: any) {
|
||||
this.logger.error('gm:map:request error', error.message)
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { MapEventTileType } from '#application/enums'
|
||||
import { UUID } from '#application/types'
|
||||
import { Map } from '#entities/map'
|
||||
import { MapEffect } from '#entities/mapEffect'
|
||||
import { MapEventTile } from '#entities/mapEventTile'
|
||||
@ -62,9 +63,11 @@ export default class MapUpdateEvent extends BaseEvent {
|
||||
if (data.tiles.length > data.height) {
|
||||
data.tiles = data.tiles.slice(0, data.height)
|
||||
}
|
||||
|
||||
for (let i = 0; i < data.tiles.length; i++) {
|
||||
if (data.tiles[i].length > data.width) {
|
||||
data.tiles[i] = data.tiles[i].slice(0, data.width)
|
||||
const row = data.tiles[i]
|
||||
if (row !== undefined && row.length > data.width) {
|
||||
data.tiles[i] = row.slice(0, data.width)
|
||||
}
|
||||
}
|
||||
|
||||
|
20
src/events/map/characterAttack.ts
Normal file
20
src/events/map/characterAttack.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import CharacterAttackService from '#services/characterAttackService'
|
||||
|
||||
export default class CharacterMove extends BaseEvent {
|
||||
private readonly characterAttackService = CharacterAttackService
|
||||
|
||||
public listen(): void {
|
||||
this.socket.on('map:character:attack', this.handleEvent.bind(this))
|
||||
}
|
||||
|
||||
private async handleEvent(data: any, callback: (response: any) => void): Promise<void> {
|
||||
try {
|
||||
console.log('attack', this.socket.characterId)
|
||||
await this.characterAttackService.attack(this.socket.characterId!)
|
||||
} catch (error) {
|
||||
this.logger.error('map:character:attack error', error)
|
||||
return callback(false)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,16 @@
|
||||
import type { MapEventTileWithTeleport } from '#application/types'
|
||||
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { MapEventTileWithTeleport } from '#application/types'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import MapCharacter from '#models/mapCharacter'
|
||||
import MapEventTileRepository from '#repositories/mapEventTileRepository'
|
||||
import CharacterService from '#services/characterService'
|
||||
import TeleportService from '#services/teleportService'
|
||||
import CharacterService from '#services/characterMoveService'
|
||||
import TeleportService from '#services/characterTeleportService'
|
||||
|
||||
export default class CharacterMove extends BaseEvent {
|
||||
private readonly characterService = CharacterService
|
||||
private readonly MOVEMENT_CANCEL_DELAY = 250
|
||||
private movementTimeouts: Map<string, NodeJS.Timeout> = new Map()
|
||||
|
||||
public listen(): void {
|
||||
this.socket.on('map:character:move', this.handleEvent.bind(this))
|
||||
@ -20,65 +23,103 @@ export default class CharacterMove extends BaseEvent {
|
||||
return
|
||||
}
|
||||
|
||||
// If already moving, cancel current movement and wait for it to fully stop
|
||||
// Clear any existing movement timeout
|
||||
const existingTimeout = this.movementTimeouts.get(this.socket.characterId!)
|
||||
if (existingTimeout) {
|
||||
clearTimeout(existingTimeout)
|
||||
this.movementTimeouts.delete(this.socket.characterId!)
|
||||
}
|
||||
|
||||
// If already moving, cancel current movement
|
||||
if (mapCharacter.isMoving) {
|
||||
mapCharacter.isMoving = false
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
mapCharacter.currentPath = null
|
||||
|
||||
// Add small delay before starting new movement
|
||||
await new Promise((resolve) => {
|
||||
const timeout = setTimeout(resolve, this.MOVEMENT_CANCEL_DELAY)
|
||||
this.movementTimeouts.set(this.socket.characterId!, timeout)
|
||||
})
|
||||
}
|
||||
|
||||
// Validate target position is within reasonable range
|
||||
const currentX = mapCharacter.character.positionX
|
||||
const currentY = mapCharacter.character.positionY
|
||||
const distance = Math.sqrt(Math.pow(positionX - currentX, 2) + Math.pow(positionY - currentY, 2))
|
||||
|
||||
if (distance > 20) {
|
||||
// Maximum allowed distance
|
||||
this.io.in(mapCharacter.character.map.id).emit('map:character:moveError', 'Target position too far')
|
||||
return
|
||||
}
|
||||
|
||||
const path = await this.characterService.calculatePath(mapCharacter.character, positionX, positionY)
|
||||
if (!path) {
|
||||
if (!path?.length) {
|
||||
this.io.in(mapCharacter.character.map.id).emit('map:character:moveError', 'No valid path found')
|
||||
return
|
||||
}
|
||||
|
||||
// Start new movement
|
||||
mapCharacter.isMoving = true
|
||||
mapCharacter.currentPath = path // Add this property to MapCharacter class
|
||||
mapCharacter.currentPath = path
|
||||
await this.moveAlongPath(mapCharacter, path)
|
||||
}
|
||||
|
||||
private async moveAlongPath(mapCharacter: MapCharacter, path: Array<{ positionX: number; positionY: number }>): Promise<void> {
|
||||
const character = mapCharacter.getCharacter()
|
||||
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
if (!mapCharacter.isMoving || mapCharacter.currentPath !== path) {
|
||||
return
|
||||
try {
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
if (!mapCharacter.isMoving || mapCharacter.currentPath !== path) {
|
||||
return
|
||||
}
|
||||
|
||||
const [start, end] = [path[i], path[i + 1]]
|
||||
|
||||
if (!start || !end) {
|
||||
this.logger.error('Invalid path step detected')
|
||||
break
|
||||
}
|
||||
|
||||
// Validate each step
|
||||
if (Math.abs(end.positionX - start.positionX) > 1 || Math.abs(end.positionY - start.positionY) > 1) {
|
||||
this.logger.error('Invalid path step detected')
|
||||
break
|
||||
}
|
||||
|
||||
character.setRotation(CharacterService.calculateRotation(start.positionX, start.positionY, end.positionX, end.positionY))
|
||||
|
||||
const mapEventTileRepository = new MapEventTileRepository()
|
||||
const mapEventTile = await mapEventTileRepository.getEventTileByMapIdAndPosition(character.getMap().getId(), Math.floor(end.positionX), Math.floor(end.positionY))
|
||||
|
||||
if (mapEventTile?.type === 'BLOCK') break
|
||||
if (mapEventTile?.type === 'TELEPORT' && mapEventTile.teleport) {
|
||||
await this.handleTeleportMapEventTile(mapEventTile as MapEventTileWithTeleport)
|
||||
return
|
||||
}
|
||||
|
||||
// Update position first
|
||||
character.setPositionX(end.positionX).setPositionY(end.positionY)
|
||||
|
||||
// Then emit with the same properties
|
||||
this.io.in(character.map.id).emit('map:character:move', {
|
||||
characterId: character.id,
|
||||
positionX: character.getPositionX(),
|
||||
positionY: character.getPositionY(),
|
||||
rotation: character.getRotation(),
|
||||
isMoving: true
|
||||
})
|
||||
|
||||
await this.characterService.applyMovementDelay()
|
||||
}
|
||||
|
||||
const [start, end] = [path[i], path[i + 1]]
|
||||
character.setRotation(CharacterService.calculateRotation(start.positionX, start.positionY, end.positionX, end.positionY))
|
||||
|
||||
const mapEventTileRepository = new MapEventTileRepository()
|
||||
const mapEventTile = await mapEventTileRepository.getEventTileByMapIdAndPosition(character.getMap().getId(), Math.floor(end.positionX), Math.floor(end.positionY))
|
||||
|
||||
if (mapEventTile?.type === 'BLOCK') break
|
||||
if (mapEventTile?.type === 'TELEPORT' && mapEventTile.teleport) {
|
||||
await this.handleMapEventTile(mapEventTile as MapEventTileWithTeleport)
|
||||
return
|
||||
} finally {
|
||||
if (mapCharacter.isMoving && mapCharacter.currentPath === path) {
|
||||
this.finalizeMovement(mapCharacter)
|
||||
}
|
||||
|
||||
// Update position first
|
||||
character.setPositionX(end.positionX).setPositionY(end.positionY)
|
||||
|
||||
// Then emit with the same properties
|
||||
this.io.in(character.map.id).emit('map:character:move', {
|
||||
characterId: character.id,
|
||||
positionX: character.getPositionX(),
|
||||
positionY: character.getPositionY(),
|
||||
rotation: character.getRotation(),
|
||||
isMoving: true
|
||||
})
|
||||
|
||||
await this.characterService.applyMovementDelay()
|
||||
}
|
||||
|
||||
if (mapCharacter.isMoving && mapCharacter.currentPath === path) {
|
||||
this.finalizeMovement(mapCharacter)
|
||||
}
|
||||
}
|
||||
|
||||
private async handleMapEventTile(mapEventTile: MapEventTileWithTeleport): Promise<void> {
|
||||
private async handleTeleportMapEventTile(mapEventTile: MapEventTileWithTeleport): Promise<void> {
|
||||
if (mapEventTile.getTeleport()) {
|
||||
await TeleportService.teleportCharacter(this.socket.characterId!, {
|
||||
targetMapId: mapEventTile.getTeleport()!.getToMap().getId(),
|
||||
@ -96,7 +137,7 @@ export default class CharacterMove extends BaseEvent {
|
||||
positionX: mapCharacter.character.positionX,
|
||||
positionY: mapCharacter.character.positionY,
|
||||
rotation: mapCharacter.character.rotation,
|
||||
isMoving: false
|
||||
isMoving: mapCharacter.isMoving
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Server as SocketServer } from 'socket.io'
|
||||
|
||||
import { TSocket } from '#application/types'
|
||||
import type { TSocket } from '#application/types'
|
||||
|
||||
export default class SomeJob {
|
||||
constructor(private params: any) {}
|
||||
|
@ -28,6 +28,11 @@ export class ConsoleManager {
|
||||
private async processCommand(commandLine: string): Promise<void> {
|
||||
const [cmd, ...args] = commandLine.trim().split(' ')
|
||||
|
||||
if (!cmd) {
|
||||
console.log('No command provided')
|
||||
return
|
||||
}
|
||||
|
||||
if (cmd === 'exit') {
|
||||
this.prompt.close()
|
||||
return
|
||||
|
@ -61,6 +61,7 @@ class DateManager {
|
||||
|
||||
if (timeOnlyPattern.test(timeString)) {
|
||||
const [hours, minutes] = timeString.split(':').map(Number)
|
||||
if (!hours || !minutes) return null
|
||||
const newDate = new Date(this.currentDate)
|
||||
newDate.setHours(hours, minutes)
|
||||
return newDate
|
||||
|
@ -1,5 +1,6 @@
|
||||
import cors from 'cors'
|
||||
import { Application } from 'express'
|
||||
|
||||
import type { Application } from 'express'
|
||||
|
||||
import config from '#application/config'
|
||||
import { AuthController } from '#controllers/auth'
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import { UUID } from '#application/types'
|
||||
import { Map } from '#entities/map'
|
||||
import LoadedMap from '#models/loadedMap'
|
||||
import MapCharacter from '#models/mapCharacter'
|
||||
|
@ -4,14 +4,15 @@ import { Job, Queue, Worker } from 'bullmq'
|
||||
import IORedis from 'ioredis'
|
||||
import { Server as SocketServer } from 'socket.io'
|
||||
|
||||
import type { TSocket } from '#application/types'
|
||||
|
||||
import config from '#application/config'
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import Storage from '#application/storage'
|
||||
import { TSocket } from '#application/types'
|
||||
import SocketManager from '#managers/socketManager'
|
||||
|
||||
class QueueManager {
|
||||
private connection!: IORedis
|
||||
private connection!: IORedis.Redis
|
||||
private queue!: Queue
|
||||
private worker!: Worker
|
||||
private io!: SocketServer
|
||||
@ -20,7 +21,7 @@ class QueueManager {
|
||||
public async boot() {
|
||||
this.io = SocketManager.getIO()
|
||||
|
||||
this.connection = new IORedis(config.REDIS_URL, {
|
||||
this.connection = new IORedis.Redis(config.REDIS_URL, {
|
||||
maxRetriesPerRequest: null
|
||||
})
|
||||
|
||||
|
@ -2,12 +2,13 @@ import fs from 'fs'
|
||||
import { Server as HTTPServer } from 'http'
|
||||
import { pathToFileURL } from 'url'
|
||||
|
||||
import { Application } from 'express'
|
||||
import { Server as SocketServer } from 'socket.io'
|
||||
|
||||
import type { TSocket, UUID } from '#application/types'
|
||||
import type { Application } from 'express'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import Storage from '#application/storage'
|
||||
import { TSocket, UUID } from '#application/types'
|
||||
import { Authentication } from '#middleware/authentication'
|
||||
|
||||
class SocketManager {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { User } from '@prisma/client'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import { User } from '#entities/user'
|
||||
|
||||
type TLoggedInUsers = {
|
||||
users: User[]
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { verify } from 'jsonwebtoken'
|
||||
import jwt from 'jsonwebtoken'
|
||||
|
||||
import type { TSocket } from '#application/types'
|
||||
|
||||
import config from '#application/config'
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import { TSocket } from '#application/types'
|
||||
|
||||
class SocketAuthenticator {
|
||||
private socket: TSocket
|
||||
@ -39,7 +40,7 @@ class SocketAuthenticator {
|
||||
}
|
||||
|
||||
private verifyToken(token: string): void {
|
||||
verify(token, config.JWT_SECRET, (err: any, decoded: any) => {
|
||||
jwt.verify(token, config.JWT_SECRET, (err: any, decoded: any) => {
|
||||
if (err) {
|
||||
this.logger.error('Invalid token')
|
||||
return this.next(new Error('Authentication error'))
|
||||
|
2079
src/migrations/.snapshot-game.json
Normal file
2079
src/migrations/.snapshot-game.json
Normal file
File diff suppressed because it is too large
Load Diff
162
src/migrations/Migration20250207212301.ts
Normal file
162
src/migrations/Migration20250207212301.ts
Normal file
@ -0,0 +1,162 @@
|
||||
import { Migration } from '@mikro-orm/migrations'
|
||||
|
||||
export class Migration20250207212301 extends Migration {
|
||||
override async up(): Promise<void> {
|
||||
this.addSql(
|
||||
`create table \`map\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`width\` int not null default 10, \`height\` int not null default 10, \`tiles\` json null, \`pvp\` tinyint(1) not null default false, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
`create table \`map_effect\` (\`id\` varchar(255) not null, \`map_id\` varchar(255) not null, \`effect\` varchar(255) not null, \`strength\` int not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`map_effect\` add index \`map_effect_map_id_index\`(\`map_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`map_event_tile\` (\`id\` varchar(255) not null, \`map_id\` varchar(255) not null, \`type\` enum('BLOCK', 'TELEPORT', 'NPC', 'ITEM') not null, \`position_x\` int not null, \`position_y\` int not null, \`teleport_id\` varchar(255) null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`map_event_tile\` add index \`map_event_tile_map_id_index\`(\`map_id\`);`)
|
||||
this.addSql(`alter table \`map_event_tile\` add unique \`map_event_tile_teleport_id_unique\`(\`teleport_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`map_event_tile_teleport\` (\`id\` varchar(255) not null, \`map_event_tile_id\` varchar(255) not null, \`to_map_id\` varchar(255) not null, \`to_rotation\` int not null, \`to_position_x\` int not null, \`to_position_y\` int not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`map_event_tile_teleport\` add unique \`map_event_tile_teleport_map_event_tile_id_unique\`(\`map_event_tile_id\`);`)
|
||||
this.addSql(`alter table \`map_event_tile_teleport\` add index \`map_event_tile_teleport_to_map_id_index\`(\`to_map_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`map_object\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`tags\` json null, \`origin_x\` numeric(10,2) not null default 0, \`origin_y\` numeric(10,2) not null default 0, \`frame_rate\` int not null default 0, \`frame_width\` int not null default 0, \`frame_height\` int not null default 0, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
`create table \`placed_map_object\` (\`id\` varchar(255) not null, \`map_id\` varchar(255) not null, \`map_object_id\` varchar(255) not null, \`is_rotated\` tinyint(1) not null default false, \`position_x\` int not null default 0, \`position_y\` int not null default 0, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`placed_map_object\` add index \`placed_map_object_map_id_index\`(\`map_id\`);`)
|
||||
this.addSql(`alter table \`placed_map_object\` add index \`placed_map_object_map_object_id_index\`(\`map_object_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`sprite\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
`create table \`item\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`description\` varchar(255) not null default '', \`item_type\` enum('WEAPON', 'HELMET', 'CHEST', 'LEGS', 'BOOTS', 'GLOVES', 'RING', 'NECKLACE') not null, \`stackable\` tinyint(1) not null default false, \`rarity\` enum('COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY') not null default 'COMMON', \`sprite_id\` varchar(255) null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`item\` add index \`item_sprite_id_index\`(\`sprite_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`character_type\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`gender\` enum('MALE', 'FEMALE') not null, \`race\` enum('HUMAN', 'ELF', 'DWARF', 'ORC', 'GOBLIN') not null, \`is_selectable\` tinyint(1) not null default false, \`sprite_id\` varchar(255) null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`character_type\` add index \`character_type_sprite_id_index\`(\`sprite_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`character_hair\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`gender\` varchar(255) not null default 'MALE', \`is_selectable\` tinyint(1) not null default false, \`sprite_id\` varchar(255) null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`character_hair\` add index \`character_hair_sprite_id_index\`(\`sprite_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`sprite_action\` (\`id\` varchar(255) not null, \`sprite_id\` varchar(255) not null, \`action\` varchar(255) not null, \`sprites\` json null, \`origin_x\` numeric(5,2) not null default 0, \`origin_y\` numeric(5,2) not null default 0, \`frame_width\` int not null default 0, \`frame_height\` int not null default 0, \`frame_rate\` int not null default 0, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`sprite_action\` add index \`sprite_action_sprite_id_index\`(\`sprite_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`tile\` (\`id\` varchar(255) not null, \`name\` varchar(255) not null, \`tags\` json null, \`created_at\` datetime not null, \`updated_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
`create table \`user\` (\`id\` varchar(255) not null, \`username\` varchar(255) not null, \`email\` varchar(255) not null, \`password\` varchar(255) not null, \`online\` tinyint(1) not null default false, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`user\` add unique \`user_username_unique\`(\`username\`);`)
|
||||
this.addSql(`alter table \`user\` add unique \`user_email_unique\`(\`email\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`password_reset_token\` (\`id\` varchar(255) not null, \`user_id\` varchar(255) not null, \`token\` varchar(255) not null, \`created_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`password_reset_token\` add index \`password_reset_token_user_id_index\`(\`user_id\`);`)
|
||||
this.addSql(`alter table \`password_reset_token\` add unique \`password_reset_token_token_unique\`(\`token\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`character\` (\`id\` varchar(255) not null, \`user_id\` varchar(255) not null, \`name\` varchar(255) not null, \`online\` tinyint(1) not null default false, \`role\` varchar(255) not null default 'player', \`map_id\` varchar(255) not null, \`position_x\` int not null default 0, \`position_y\` int not null default 0, \`rotation\` int not null default 0, \`character_type_id\` varchar(255) null, \`character_hair_id\` varchar(255) null, \`alignment\` int not null default 50, \`hitpoints\` int not null default 100, \`mana\` int not null default 100, \`level\` int not null default 1, \`experience\` int not null default 0, \`strength\` int not null default 10, \`dexterity\` int not null default 10, \`intelligence\` int not null default 10, \`wisdom\` int not null default 10, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`character\` add index \`character_user_id_index\`(\`user_id\`);`)
|
||||
this.addSql(`alter table \`character\` add unique \`character_name_unique\`(\`name\`);`)
|
||||
this.addSql(`alter table \`character\` add index \`character_map_id_index\`(\`map_id\`);`)
|
||||
this.addSql(`alter table \`character\` add index \`character_character_type_id_index\`(\`character_type_id\`);`)
|
||||
this.addSql(`alter table \`character\` add index \`character_character_hair_id_index\`(\`character_hair_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`chat\` (\`id\` varchar(255) not null, \`character_id\` varchar(255) not null, \`map_id\` varchar(255) not null, \`message\` varchar(255) not null, \`created_at\` datetime not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`chat\` add index \`chat_character_id_index\`(\`character_id\`);`)
|
||||
this.addSql(`alter table \`chat\` add index \`chat_map_id_index\`(\`map_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`character_item\` (\`id\` varchar(255) not null, \`character_id\` varchar(255) not null, \`item_id\` varchar(255) not null, \`quantity\` int not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`character_item\` add index \`character_item_character_id_index\`(\`character_id\`);`)
|
||||
this.addSql(`alter table \`character_item\` add index \`character_item_item_id_index\`(\`item_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`character_equipment\` (\`id\` varchar(255) not null, \`slot\` enum('HEAD', 'BODY', 'ARMS', 'LEGS', 'NECK', 'RING') not null, \`character_id\` varchar(255) not null, \`character_item_id\` varchar(255) not null, primary key (\`id\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
this.addSql(`alter table \`character_equipment\` add index \`character_equipment_character_id_index\`(\`character_id\`);`)
|
||||
this.addSql(`alter table \`character_equipment\` add index \`character_equipment_character_item_id_index\`(\`character_item_id\`);`)
|
||||
|
||||
this.addSql(
|
||||
`create table \`world\` (\`date\` datetime not null, \`rain_percentage\` int not null default 0, \`fog_density\` int not null default 0, primary key (\`date\`)) default character set utf8mb4 engine = InnoDB;`
|
||||
)
|
||||
|
||||
this.addSql(`alter table \`map_effect\` add constraint \`map_effect_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`)
|
||||
|
||||
this.addSql(`alter table \`map_event_tile\` add constraint \`map_event_tile_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`)
|
||||
this.addSql(
|
||||
`alter table \`map_event_tile\` add constraint \`map_event_tile_teleport_id_foreign\` foreign key (\`teleport_id\`) references \`map_event_tile_teleport\` (\`id\`) on update cascade on delete set null;`
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
`alter table \`map_event_tile_teleport\` add constraint \`map_event_tile_teleport_map_event_tile_id_foreign\` foreign key (\`map_event_tile_id\`) references \`map_event_tile\` (\`id\`) on update cascade on delete cascade;`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table \`map_event_tile_teleport\` add constraint \`map_event_tile_teleport_to_map_id_foreign\` foreign key (\`to_map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`
|
||||
)
|
||||
|
||||
this.addSql(`alter table \`placed_map_object\` add constraint \`placed_map_object_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`)
|
||||
this.addSql(
|
||||
`alter table \`placed_map_object\` add constraint \`placed_map_object_map_object_id_foreign\` foreign key (\`map_object_id\`) references \`map_object\` (\`id\`) on update cascade on delete cascade;`
|
||||
)
|
||||
|
||||
this.addSql(`alter table \`item\` add constraint \`item_sprite_id_foreign\` foreign key (\`sprite_id\`) references \`sprite\` (\`id\`) on update cascade on delete set null;`)
|
||||
|
||||
this.addSql(`alter table \`character_type\` add constraint \`character_type_sprite_id_foreign\` foreign key (\`sprite_id\`) references \`sprite\` (\`id\`) on update cascade on delete set null;`)
|
||||
|
||||
this.addSql(`alter table \`character_hair\` add constraint \`character_hair_sprite_id_foreign\` foreign key (\`sprite_id\`) references \`sprite\` (\`id\`) on update cascade on delete set null;`)
|
||||
|
||||
this.addSql(`alter table \`sprite_action\` add constraint \`sprite_action_sprite_id_foreign\` foreign key (\`sprite_id\`) references \`sprite\` (\`id\`) on update cascade on delete cascade;`)
|
||||
|
||||
this.addSql(
|
||||
`alter table \`password_reset_token\` add constraint \`password_reset_token_user_id_foreign\` foreign key (\`user_id\`) references \`user\` (\`id\`) on update cascade on delete cascade;`
|
||||
)
|
||||
|
||||
this.addSql(`alter table \`character\` add constraint \`character_user_id_foreign\` foreign key (\`user_id\`) references \`user\` (\`id\`) on update cascade on delete cascade;`)
|
||||
this.addSql(`alter table \`character\` add constraint \`character_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade;`)
|
||||
this.addSql(
|
||||
`alter table \`character\` add constraint \`character_character_type_id_foreign\` foreign key (\`character_type_id\`) references \`character_type\` (\`id\`) on update cascade on delete set null;`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table \`character\` add constraint \`character_character_hair_id_foreign\` foreign key (\`character_hair_id\`) references \`character_hair\` (\`id\`) on update cascade on delete set null;`
|
||||
)
|
||||
|
||||
this.addSql(`alter table \`chat\` add constraint \`chat_character_id_foreign\` foreign key (\`character_id\`) references \`character\` (\`id\`) on update cascade on delete cascade;`)
|
||||
this.addSql(`alter table \`chat\` add constraint \`chat_map_id_foreign\` foreign key (\`map_id\`) references \`map\` (\`id\`) on update cascade on delete cascade;`)
|
||||
|
||||
this.addSql(
|
||||
`alter table \`character_item\` add constraint \`character_item_character_id_foreign\` foreign key (\`character_id\`) references \`character\` (\`id\`) on update cascade on delete cascade;`
|
||||
)
|
||||
this.addSql(`alter table \`character_item\` add constraint \`character_item_item_id_foreign\` foreign key (\`item_id\`) references \`item\` (\`id\`) on update cascade on delete cascade;`)
|
||||
|
||||
this.addSql(
|
||||
`alter table \`character_equipment\` add constraint \`character_equipment_character_id_foreign\` foreign key (\`character_id\`) references \`character\` (\`id\`) on update cascade on delete cascade;`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table \`character_equipment\` add constraint \`character_equipment_character_item_id_foreign\` foreign key (\`character_item_id\`) references \`character_item\` (\`id\`) on update cascade on delete cascade;`
|
||||
)
|
||||
}
|
||||
}
|
@ -3,12 +3,12 @@ import { Migrator } from '@mikro-orm/migrations'
|
||||
import { defineConfig, MySqlDriver } from '@mikro-orm/mysql'
|
||||
import { TsMorphMetadataProvider } from '@mikro-orm/reflection'
|
||||
|
||||
import serverConfig from './src/application/config'
|
||||
import serverConfig from '#application/config'
|
||||
|
||||
export default defineConfig({
|
||||
extensions: [Migrator],
|
||||
metadataProvider: TsMorphMetadataProvider,
|
||||
entities: ['./src/entities/*.js'],
|
||||
entities: ['./dist/entities/*.js'],
|
||||
entitiesTs: ['./src/entities/*.ts'],
|
||||
driver: MySqlDriver,
|
||||
host: serverConfig.DB_HOST,
|
||||
@ -21,7 +21,7 @@ export default defineConfig({
|
||||
allowPublicKeyRetrieval: true
|
||||
},
|
||||
migrations: {
|
||||
path: './migrations',
|
||||
pathTs: './migrations',
|
||||
path: './dist/migrations',
|
||||
pathTs: './src/migrations'
|
||||
}
|
||||
})
|
||||
})
|
@ -1,8 +1,8 @@
|
||||
import MapCharacter from './mapCharacter'
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import { Map } from '#entities/map'
|
||||
import MapCharacter from '#models/mapCharacter'
|
||||
import MapEventTileRepository from '#repositories/mapEventTileRepository'
|
||||
|
||||
class LoadedMap {
|
||||
@ -47,7 +47,7 @@ class LoadedMap {
|
||||
// Set the grid values based on the event tiles, these are strings
|
||||
eventTiles.forEach((eventTile) => {
|
||||
if (eventTile.type === 'BLOCK') {
|
||||
grid[eventTile.positionY][eventTile.positionX] = 1
|
||||
grid[eventTile.positionY]![eventTile.positionX] = 1
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import { TSocket, UUID } from '#application/types'
|
||||
import type { TSocket, UUID } from '#application/types'
|
||||
|
||||
import { Character } from '#entities/character'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import SocketManager from '#managers/socketManager'
|
||||
import TeleportService from '#services/teleportService'
|
||||
import TeleportService from '#services/characterTeleportService'
|
||||
|
||||
class MapCharacter {
|
||||
public readonly character: Character
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { CharacterHair } from '#entities/characterHair'
|
||||
|
||||
class CharacterHairRepository extends BaseRepository {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
|
||||
class CharacterRepository extends BaseRepository {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { CharacterType } from '#entities/characterType'
|
||||
|
||||
class CharacterTypeRepository extends BaseRepository {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { Chat } from '#entities/chat'
|
||||
|
||||
class ChatRepository extends BaseRepository {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { Item } from '#entities/item'
|
||||
|
||||
class ItemRepository extends BaseRepository {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { MapEventTile } from '#entities/mapEventTile'
|
||||
|
||||
class MapEventTileRepository extends BaseRepository {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { MapObject } from '#entities/mapObject'
|
||||
|
||||
class MapObjectRepository extends BaseRepository {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { Map } from '#entities/map'
|
||||
import { MapEventTile } from '#entities/mapEventTile'
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { PasswordResetToken } from '#entities/passwordResetToken'
|
||||
|
||||
class PasswordResetTokenRepository extends BaseRepository {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
|
||||
class SpriteRepository extends BaseRepository {
|
||||
@ -23,6 +24,18 @@ class SpriteRepository extends BaseRepository {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
async getFirst(populate?: any): Promise<Sprite | null> {
|
||||
try {
|
||||
const repository = this.getEntityManager().getRepository(Sprite)
|
||||
const result = await repository.findOne({ id: { $exists: true } }, { populate })
|
||||
if (result) result.setEntityManager(this.getEntityManager())
|
||||
|
||||
return result
|
||||
} catch (error: any) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default SpriteRepository
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { FilterValue } from '@mikro-orm/core'
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { unduplicateArray } from '#application/utilities'
|
||||
import { Map } from '#entities/map'
|
||||
import { Tile } from '#entities/tile'
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
import { User } from '#entities/user'
|
||||
|
||||
class UserRepository extends BaseRepository {
|
||||
|
@ -1,7 +1,10 @@
|
||||
import 'reflect-metadata'
|
||||
import { createServer as httpServer, Server as HTTPServer } from 'http'
|
||||
|
||||
import cors from 'cors'
|
||||
import express, { Application } from 'express'
|
||||
import express from 'express'
|
||||
|
||||
import type { Application } from 'express'
|
||||
|
||||
import config from '#application/config'
|
||||
import Database from '#application/database'
|
||||
|
35
src/services/characterAttackService.ts
Normal file
35
src/services/characterAttackService.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseService } from '#application/base/baseService'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import SocketManager from '#managers/socketManager'
|
||||
|
||||
class CharacterAttackService extends BaseService {
|
||||
private readonly ATTACK_DELAY_MS = 1000
|
||||
|
||||
public async applyAttackDelay(): Promise<void> {
|
||||
await new Promise((resolve) => setTimeout(resolve, this.ATTACK_DELAY_MS))
|
||||
}
|
||||
|
||||
public async attack(characterId: UUID): Promise<boolean> {
|
||||
const io = SocketManager.getIO()
|
||||
const socket = SocketManager.getSocketByCharacterId(characterId)
|
||||
const character = MapManager.getCharacterById(characterId)
|
||||
|
||||
if (!socket) {
|
||||
this.logger.error(`Attack failed - Missing socket for character ${characterId}`)
|
||||
return false
|
||||
}
|
||||
|
||||
if (!character) {
|
||||
this.logger.error(`Attack failed - Character ${characterId} not found in MapManager`)
|
||||
return false
|
||||
}
|
||||
|
||||
// Emit attack event
|
||||
io.in(character.character.map.id).emit('map:character:attack', character.character.id)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
export default new CharacterAttackService()
|
@ -1,17 +1,15 @@
|
||||
import { BaseService } from '#application/base/baseService'
|
||||
import config from '#application/config'
|
||||
import { Character } from '#entities/character'
|
||||
import { Map } from '#entities/map'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import SocketManager from '#managers/socketManager'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
import MapRepository from '#repositories/mapRepository'
|
||||
|
||||
type Position = { positionX: number; positionY: number }
|
||||
export type Node = Position & { parent?: Node; g: number; h: number; f: number }
|
||||
|
||||
class CharacterService extends BaseService {
|
||||
private readonly MOVEMENT_DELAY_MS = 250
|
||||
class CharacterMoveService extends BaseService {
|
||||
private readonly MOVEMENT_DELAY_MS = 200
|
||||
private readonly MAX_PATH_LENGTH = 20 // Limit maximum path length
|
||||
|
||||
private readonly DIRECTIONS = [
|
||||
{ x: 0, y: -1 }, // Up
|
||||
{ x: 0, y: 1 }, // Down
|
||||
@ -32,6 +30,7 @@ class CharacterService extends BaseService {
|
||||
return null
|
||||
}
|
||||
|
||||
// Ensure we're working with valid coordinates
|
||||
const start: Position = {
|
||||
positionX: Math.floor(character.positionX),
|
||||
positionY: Math.floor(character.positionY)
|
||||
@ -42,7 +41,26 @@ class CharacterService extends BaseService {
|
||||
positionY: Math.floor(targetY)
|
||||
}
|
||||
|
||||
return this.findPath(start, end, grid)
|
||||
// Don't calculate path if start and end are the same
|
||||
if (start.positionX === end.positionX && start.positionY === end.positionY) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Add maximum distance check
|
||||
const directDistance = Math.sqrt(Math.pow(targetX - character.positionX, 2) + Math.pow(targetY - character.positionY, 2))
|
||||
|
||||
if (directDistance > this.MAX_PATH_LENGTH) {
|
||||
return null
|
||||
}
|
||||
|
||||
const path = this.findPath(start, end, grid)
|
||||
|
||||
// Validate path length
|
||||
if (path.length > this.MAX_PATH_LENGTH) {
|
||||
return path.slice(0, this.MAX_PATH_LENGTH)
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
public calculateRotation(X1: number, Y1: number, X2: number, Y2: number): number {
|
||||
@ -115,15 +133,15 @@ class CharacterService extends BaseService {
|
||||
return (
|
||||
pos.positionX >= 0 &&
|
||||
pos.positionY >= 0 &&
|
||||
pos.positionX < grid[0].length &&
|
||||
pos.positionX < grid[0]!.length &&
|
||||
pos.positionY < grid.length &&
|
||||
(grid[pos.positionY][pos.positionX] === 0 || (pos.positionX === end.positionX && pos.positionY === end.positionY))
|
||||
(grid[pos.positionY]![pos.positionX] === 0 || (pos.positionX === end.positionX && pos.positionY === end.positionY))
|
||||
)
|
||||
}
|
||||
|
||||
private getDistance(a: Position, b: Position): number {
|
||||
const dx = Math.abs(a.positionX - b.positionX),
|
||||
dy = Math.abs(a.positionY - b.positionY)
|
||||
const dx = Math.abs(a.positionX - b.positionX)
|
||||
const dy = Math.abs(a.positionY - b.positionY)
|
||||
// Manhattan distance for straight paths, then Euclidean for diagonals
|
||||
return dx + dy + (Math.sqrt(2) - 2) * Math.min(dx, dy)
|
||||
}
|
||||
@ -137,4 +155,4 @@ class CharacterService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
export default new CharacterService()
|
||||
export default new CharacterMoveService()
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import Logger, { LoggerType } from '#application/logger'
|
||||
import { UUID } from '#application/types'
|
||||
import { Character } from '#entities/character'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import SocketManager from '#managers/socketManager'
|
||||
@ -15,7 +16,7 @@ interface TeleportOptions {
|
||||
character?: Character
|
||||
}
|
||||
|
||||
class TeleportService {
|
||||
class CharacterTeleportService {
|
||||
private readonly logger = Logger.type(LoggerType.GAME)
|
||||
|
||||
public async teleportCharacter(characterId: UUID, options: TeleportOptions): Promise<boolean> {
|
||||
@ -99,4 +100,4 @@ class TeleportService {
|
||||
}
|
||||
}
|
||||
|
||||
export default new TeleportService()
|
||||
export default new CharacterTeleportService()
|
@ -1,5 +1,6 @@
|
||||
import type { UUID } from '#application/types'
|
||||
|
||||
import { BaseService } from '#application/base/baseService'
|
||||
import { UUID } from '#application/types'
|
||||
import { Chat } from '#entities/chat'
|
||||
import SocketManager from '#managers/socketManager'
|
||||
import CharacterRepository from '#repositories/characterRepository'
|
||||
|
59
traefik.toml
Normal file
59
traefik.toml
Normal file
@ -0,0 +1,59 @@
|
||||
[entryPoints]
|
||||
[entryPoints.web]
|
||||
address = ":80"
|
||||
[entryPoints.web.http.redirections.entryPoint]
|
||||
to = "websecure"
|
||||
scheme = "https"
|
||||
|
||||
[entryPoints.websecure]
|
||||
address = ":443"
|
||||
|
||||
[providers.docker]
|
||||
endpoint = "unix:///var/run/docker.sock"
|
||||
exposedByDefault = false
|
||||
|
||||
[certificatesResolvers.le.acme]
|
||||
email = "your-email@example.com"
|
||||
storage = "/data/acme.json"
|
||||
[certificatesResolvers.le.acme.tlsChallenge]
|
||||
|
||||
[api]
|
||||
dashboard = true
|
||||
|
||||
[ping] # Health check
|
||||
entryPoint = "websecure"
|
||||
|
||||
[http.routers.api]
|
||||
rule = "PathPrefix(`/api`)"
|
||||
service = "api"
|
||||
entryPoints = ["websecure"]
|
||||
|
||||
[http.services.api.loadBalancer]
|
||||
[[http.services.api.loadBalancer.servers]]
|
||||
url = "http://app:${PORT}"
|
||||
|
||||
# Added for websocket
|
||||
[http.services.app.loadBalancer]
|
||||
sticky = true
|
||||
[[http.services.app.loadBalancer.servers]]
|
||||
url = "http://app:${PORT}"
|
||||
|
||||
# Added for websocket
|
||||
[http.routers.app]
|
||||
rule = "Host(`${HOST}`)"
|
||||
entrypoints = ["websecure"]
|
||||
service = "app"
|
||||
|
||||
[http.routers.app.tls]
|
||||
certresolver = "le"
|
||||
|
||||
[http.routers.app.middlewares]
|
||||
# Enable websockets
|
||||
- "websocket"
|
||||
|
||||
[http.middlewares]
|
||||
[http.middlewares.websocket.headers]
|
||||
accessControlAllowHeaders = ["Origin", "Content-Type", "Accept", "Authorization"]
|
||||
accessControlAllowMethods = ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]
|
||||
accessControlAllowOrigin = ["*"]
|
||||
accessControlExposeHeaders = ["Content-Length", "Content-Range"]
|
@ -1,43 +1,51 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Enable latest features
|
||||
"lib": ["ESNext"],
|
||||
"target": "ESNext",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"moduleDetection": "force",
|
||||
"allowJs": true,
|
||||
"declaration": true,
|
||||
|
||||
// Best practices
|
||||
"strict": true,
|
||||
// Base options
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"allowJs": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleDetection": "force",
|
||||
"isolatedModules": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"lib": ["es2022"],
|
||||
"target": "es2022",
|
||||
|
||||
// Strictness
|
||||
"strict": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
|
||||
// Transpiling with TypeScript
|
||||
"module": "NodeNext",
|
||||
"baseUrl": "./src",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"sourceMap": true,
|
||||
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"#application/*": ["./src/application/*"],
|
||||
"#commands/*": ["./src/commands/*"],
|
||||
"#entities/*": ["./src/entities/*"],
|
||||
"#controllers/*": ["./src/controllers/*"],
|
||||
"#jobs/*": ["./src/jobs/*"],
|
||||
"#managers/*": ["./src/managers/*"],
|
||||
"#middleware/*": ["./src/middleware/*"],
|
||||
"#models/*": ["./src/models/*"],
|
||||
"#repositories/*": ["./src/repositories/*"],
|
||||
"#services/*": ["./src/services/*"],
|
||||
"#events/*": ["./src/events/*"]
|
||||
"#root/*": ["./*"],
|
||||
"#application/*": ["application/*"],
|
||||
"#commands/*": ["commands/*"],
|
||||
"#entities/*": ["entities/*"],
|
||||
"#controllers/*": ["controllers/*"],
|
||||
"#jobs/*": ["jobs/*"],
|
||||
"#managers/*": ["managers/*"],
|
||||
"#middleware/*": ["middleware/*"],
|
||||
"#models/*": ["models/*"],
|
||||
"#repositories/*": ["repositories/*"],
|
||||
"#services/*": ["services/*"],
|
||||
"#events/*": ["events/*"]
|
||||
},
|
||||
|
||||
// Specify multiple folders that act like './node_modules/@types'
|
||||
"typeRoots": ["./node_modules/@types"],
|
||||
|
||||
// Other options
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
},
|
||||
"include": ["**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
Reference in New Issue
Block a user