Commit e2323451 authored by nanahira's avatar nanahira

Merge branch 'master' into koishi

parents 2539137b 98cab0b1
Pipeline #17318 passed with stages
in 8 minutes and 57 seconds
......@@ -43,8 +43,11 @@ class AthleticChecker {
}
async checkAthletic(deck) {
try {
const athleticDecks = await this.getAthleticDecks();
const deckType = await this.getDeckType(deck);
if (deckType === '迷之卡组') {
return { success: true, athletic: 0, message: null };
}
const athleticDecks = await this.getAthleticDecks();
const athletic = athleticDecks.findIndex(d => d === deckType) + 1;
return { success: true, athletic, message: null };
}
......
......@@ -61,8 +61,11 @@ export class AthleticChecker {
}
async checkAthletic(deck: Deck): Promise<ReturnMessage> {
try {
const athleticDecks = await this.getAthleticDecks();
const deckType = await this.getDeckType(deck);
if (deckType === '迷之卡组') {
return { success: true, athletic: 0, message: null };
}
const athleticDecks = await this.getAthleticDecks();
const athletic = athleticDecks.findIndex(d => d === deckType) + 1;
return { success: true, athletic, message: null };
} catch (e) {
......
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
......
......@@ -31,12 +31,13 @@
"typeorm": "^0.2.29",
"underscore": "^1.11.0",
"underscore.string": "^3.3.6",
"ws": "^1.1.1"
"ws": "^8.9.0"
},
"devDependencies": {
"@types/bunyan": "^1.8.8",
"@types/node": "^17.0.19",
"@types/underscore": "^1.11.4",
"@types/ws": "^8.5.3",
"coffeescript": "^2.6.1",
"typescript": "^4.5.5"
}
......@@ -90,6 +91,15 @@
"integrity": "sha512-uO4CD2ELOjw8tasUrAhvnn2W4A0ZECOvMjCivJr4gA9pGgjv+qxKWY9GLTMVEK8ej85BxQOocUyE7hImmSQYcg==",
"dev": true
},
"node_modules/@types/ws": {
"version": "8.5.3",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
"integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
......@@ -1744,14 +1754,6 @@
"wrappy": "1"
}
},
"node_modules/options": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz",
"integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
......@@ -2656,11 +2658,6 @@
"node": ">=4.2.0"
}
},
"node_modules/ultron": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz",
"integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po="
},
"node_modules/underscore": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.11.0.tgz",
......@@ -2837,12 +2834,23 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"node_modules/ws": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/ws/-/ws-1.1.5.tgz",
"integrity": "sha512-o3KqipXNUdS7wpQzBHSe180lBGO60SoK0yVo3CYJgb2MkobuWuBX6dhkYP5ORCLd55y+SaflMOV5fqAB53ux4w==",
"dependencies": {
"options": ">=0.0.5",
"ultron": "1.0.x"
"version": "8.9.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz",
"integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/xml2js": {
......@@ -3116,6 +3124,15 @@
"integrity": "sha512-uO4CD2ELOjw8tasUrAhvnn2W4A0ZECOvMjCivJr4gA9pGgjv+qxKWY9GLTMVEK8ej85BxQOocUyE7hImmSQYcg==",
"dev": true
},
"@types/ws": {
"version": "8.5.3",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
"integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
......@@ -4411,11 +4428,6 @@
"wrappy": "1"
}
},
"options": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz",
"integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8="
},
"os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
......@@ -5093,11 +5105,6 @@
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
"dev": true
},
"ultron": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz",
"integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po="
},
"underscore": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.11.0.tgz",
......@@ -5239,13 +5246,10 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"ws": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/ws/-/ws-1.1.5.tgz",
"integrity": "sha512-o3KqipXNUdS7wpQzBHSe180lBGO60SoK0yVo3CYJgb2MkobuWuBX6dhkYP5ORCLd55y+SaflMOV5fqAB53ux4w==",
"requires": {
"options": ">=0.0.5",
"ultron": "1.0.x"
}
"version": "8.9.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz",
"integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==",
"requires": {}
},
"xml2js": {
"version": "0.4.23",
......
......@@ -33,7 +33,7 @@
"typeorm": "^0.2.29",
"underscore": "^1.11.0",
"underscore.string": "^3.3.6",
"ws": "^1.1.1"
"ws": "^8.9.0"
},
"license": "AGPL-3.0",
"scripts": {
......@@ -48,6 +48,7 @@
"@types/bunyan": "^1.8.8",
"@types/node": "^17.0.19",
"@types/underscore": "^1.11.4",
"@types/ws": "^8.5.3",
"coffeescript": "^2.6.1",
"typescript": "^4.5.5"
}
......
......@@ -16,8 +16,8 @@ init = (http_server, ROOM_all)->
server = new WebSocketServer
server: http_server
server.on 'connection', (connection) ->
connection.filter = url.parse(connection.upgradeReq.url, true).query.filter || 'waiting'
server.on 'connection', (connection, upgradeReq) ->
connection.filter = url.parse(upgradeReq.url, true).query.filter || 'waiting'
connection.send JSON.stringify
event: 'init'
data: room_data(room) for room in ROOM_all when room and room.established and (connection.filter == 'started' or !room.private) and ((room.duel_stage != 0) == (connection.filter == 'started'))
......
......@@ -1878,6 +1878,7 @@ class Room
log.warn("GET ATHLETIC FAIL", player.name, using_athletic.message)
else if using_athletic.athletic
ygopro.stoc_send_chat_to_room(room, "#{player.name}${using_athletic_deck}", ygopro.constants.COLORS.BABYBLUE)
return
))
await return
......
......@@ -2516,9 +2516,9 @@
side: side
}));
if (!using_athletic.success) {
return log.warn("GET ATHLETIC FAIL", player.name, using_athletic.message);
log.warn("GET ATHLETIC FAIL", player.name, using_athletic.message);
} else if (using_athletic.athletic) {
return ygopro.stoc_send_chat_to_room(room, `${player.name}\${using_athletic_deck}`, ygopro.constants.COLORS.BABYBLUE);
ygopro.stoc_send_chat_to_room(room, `${player.name}\${using_athletic_deck}`, ygopro.constants.COLORS.BABYBLUE);
}
}));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment