Commit f7529ebb authored by nanahira's avatar nanahira

Merge branch 'master' into ai-play

parents e345b2ae 55f6e999
Pipeline #33381 failed with stages
in 9 minutes and 2 seconds
...@@ -726,12 +726,12 @@ class DataManager { ...@@ -726,12 +726,12 @@ class DataManager {
newScore.name = name; newScore.name = name;
return await this.saveRandomDuelScore(newScore); return await this.saveRandomDuelScore(newScore);
} }
async getRandomDuelScoreDisplay(name) { async getRandomDuelScoreDisplay(name, displayName) {
const score = await this.getRandomDuelScore(name); const score = await this.getRandomDuelScore(name);
if (!score) { if (!score) {
return `${name.split("$")[0]} \${random_score_blank}`; return `${displayName} \${random_score_blank}`;
} }
return score.getScoreText(); return score.getScoreText(displayName);
} }
async randomDuelPlayerWin(name) { async randomDuelPlayerWin(name) {
const score = await this.getOrCreateRandomDuelScore(name); const score = await this.getOrCreateRandomDuelScore(name);
......
...@@ -723,12 +723,12 @@ export class DataManager { ...@@ -723,12 +723,12 @@ export class DataManager {
newScore.name = name; newScore.name = name;
return await this.saveRandomDuelScore(newScore); return await this.saveRandomDuelScore(newScore);
} }
async getRandomDuelScoreDisplay(name: string) { async getRandomDuelScoreDisplay(name: string, displayName: string) {
const score = await this.getRandomDuelScore(name); const score = await this.getRandomDuelScore(name);
if(!score) { if(!score) {
return `${name.split("$")[0]} \${random_score_blank}`; return `${displayName} \${random_score_blank}`;
} }
return score.getScoreText(); return score.getScoreText(displayName);
} }
async randomDuelPlayerWin(name: string) { async randomDuelPlayerWin(name: string) {
const score = await this.getOrCreateRandomDuelScore(name); const score = await this.getOrCreateRandomDuelScore(name);
......
...@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); ...@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeDeck = exports.encodeDeck = void 0; exports.decodeDeck = exports.encodeDeck = void 0;
const assert_1 = __importDefault(require("assert")); const assert_1 = __importDefault(require("assert"));
function encodeDeck(deck) { function encodeDeck(deck) {
deck.main ??= [];
deck.side ??= [];
let pointer = 0; let pointer = 0;
const bufferSize = (2 + deck.main.length + deck.side.length) * 4; const bufferSize = (2 + deck.main.length + deck.side.length) * 4;
const buffer = Buffer.allocUnsafe(bufferSize); const buffer = Buffer.allocUnsafe(bufferSize);
......
...@@ -6,6 +6,8 @@ export interface Deck { ...@@ -6,6 +6,8 @@ export interface Deck {
} }
export function encodeDeck(deck: Deck) { export function encodeDeck(deck: Deck) {
deck.main ??= [];
deck.side ??= [];
let pointer = 0; let pointer = 0;
const bufferSize = (2 + deck.main.length + deck.side.length) * 4; const bufferSize = (2 + deck.main.length + deck.side.length) * 4;
const buffer = Buffer.allocUnsafe(bufferSize); const buffer = Buffer.allocUnsafe(bufferSize);
...@@ -40,4 +42,4 @@ export function decodeDeck(buffer: Buffer): Deck { ...@@ -40,4 +42,4 @@ export function decodeDeck(buffer: Buffer): Deck {
pointer += 4; pointer += 4;
} }
return {main, side}; return {main, side};
} }
\ No newline at end of file
...@@ -33,8 +33,7 @@ let RandomDuelScore = class RandomDuelScore extends CreateAndUpdateTimeBase_1.Cr ...@@ -33,8 +33,7 @@ let RandomDuelScore = class RandomDuelScore extends CreateAndUpdateTimeBase_1.Cr
++this.fleeCount; ++this.fleeCount;
this.lose(); this.lose();
} }
getScoreText() { getScoreText(displayName) {
const displayName = this.getDisplayName();
const total = this.winCount + this.loseCount; const total = this.winCount + this.loseCount;
if (this.winCount < 2 && total < 3) { if (this.winCount < 2 && total < 3) {
return `${displayName} \${random_score_not_enough}`; return `${displayName} \${random_score_not_enough}`;
......
...@@ -40,8 +40,7 @@ export class RandomDuelScore extends CreateAndUpdateTimeBase { ...@@ -40,8 +40,7 @@ export class RandomDuelScore extends CreateAndUpdateTimeBase {
this.lose(); this.lose();
} }
getScoreText() { getScoreText(displayName: string) {
const displayName = this.getDisplayName();
const total = this.winCount + this.loseCount; const total = this.winCount + this.loseCount;
if (this.winCount < 2 && total < 3) { if (this.winCount < 2 && total < 3) {
return `${displayName} \${random_score_not_enough}`; return `${displayName} \${random_score_not_enough}`;
...@@ -53,4 +52,4 @@ export class RandomDuelScore extends CreateAndUpdateTimeBase { ...@@ -53,4 +52,4 @@ export class RandomDuelScore extends CreateAndUpdateTimeBase {
return `\${random_score_part1}${displayName} \${random_score_part2} ${Math.ceil(this.winCount / total * 100)}\${random_score_part3} ${Math.ceil(this.fleeCount / total * 100)}\${random_score_part4}`; return `\${random_score_part1}${displayName} \${random_score_part2} ${Math.ceil(this.winCount / total * 100)}\${random_score_part3} ${Math.ceil(this.fleeCount / total * 100)}\${random_score_part4}`;
} }
} }
} }
\ No newline at end of file
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
"draw_count": 1, "draw_count": 1,
"time_limit": 180, "time_limit": 180,
"no_watch": false, "no_watch": false,
"auto_death": false "auto_death": false,
"bo5": false,
"sideins": false
}, },
"modules": { "modules": {
"welcome": "MyCard YGOPro Server", "welcome": "MyCard YGOPro Server",
...@@ -90,6 +92,7 @@ ...@@ -90,6 +92,7 @@
"record_match_scores": false, "record_match_scores": false,
"post_match_scores": false, "post_match_scores": false,
"post_match_accesskey": "123456", "post_match_accesskey": "123456",
"disable_chat": false,
"blank_pass_modes": { "blank_pass_modes": {
"S": true, "S": true,
"M": true, "M": true,
......
...@@ -211,6 +211,7 @@ ...@@ -211,6 +211,7 @@
"refresh_failed": "Refresh field failed.", "refresh_failed": "Refresh field failed.",
"banned_athletic_deck_part1": "Entertainment Mode does not allow top ", "banned_athletic_deck_part1": "Entertainment Mode does not allow top ",
"banned_athletic_deck_part2": " popular meta decks. Please change your deck.", "banned_athletic_deck_part2": " popular meta decks. Please change your deck.",
"chat_disabled": "Chat is disabled in this room.",
"using_athletic_deck": " is using a competitive deck." "using_athletic_deck": " is using a competitive deck."
}, },
"es-es": { "es-es": {
...@@ -571,6 +572,7 @@ ...@@ -571,6 +572,7 @@
"refresh_fail": "刷新场面失败。", "refresh_fail": "刷新场面失败。",
"banned_athletic_deck_part1": "娱乐匹配中禁止使用使用数前", "banned_athletic_deck_part1": "娱乐匹配中禁止使用使用数前",
"banned_athletic_deck_part2": "的竞技卡组。请更换卡组。", "banned_athletic_deck_part2": "的竞技卡组。请更换卡组。",
"chat_disabled": "本房间禁止聊天。",
"using_athletic_deck": " 正在使用竞技卡组。" "using_athletic_deck": " 正在使用竞技卡组。"
}, },
"ko-kr": { "ko-kr": {
......
...@@ -78,7 +78,8 @@ ...@@ -78,7 +78,8 @@
], ],
"STOC_HS_PlayerEnter": [ "STOC_HS_PlayerEnter": [
{"name": "name", "type": "unsigned short", "length": 20, "encoding": "UTF-16LE"}, {"name": "name", "type": "unsigned short", "length": 20, "encoding": "UTF-16LE"},
{"name": "pos", "type": "unsigned char"} {"name": "pos", "type": "unsigned char"},
{"name": "padding", "type": "unsigned char"}
], ],
"STOC_HS_PlayerChange": [ "STOC_HS_PlayerChange": [
{"name": "status", "type": "unsigned char"} {"name": "status", "type": "unsigned char"}
......
This diff is collapsed.
This diff is collapsed.
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