From ad78056255193cbf4a076d30b86825194e69d4e5 Mon Sep 17 00:00:00 2001 From: mengxinzxz <2223529500@qq.com> Date: Wed, 22 May 2024 08:33:57 +0800 Subject: [PATCH] bugfix --- noname/game/index.js | 1 + noname/library/element/player.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/noname/game/index.js b/noname/game/index.js index 3142dc603..55568e352 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -2793,6 +2793,7 @@ export class Game { lib.skill[skill] = content[1]; lib.character[skill] = content[2]; for (let i = 0; i < list.length; i++) { + if (!list[i]) continue; lib.translate[skill + ["", "_prefix", "_ab"][i]] = list[i]; } player.storage[skill] = content[4]; diff --git a/noname/library/element/player.js b/noname/library/element/player.js index c23b9d5cb..0c1df1e50 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -7315,7 +7315,7 @@ export class Player extends HTMLDivElement { cfg.source = this.name; } } - const list = cfg.caption ? [cfg.caption] : ["", "_prefix", "_ab"].map(str => "name" + str).filter(str => lib.translate[str]); + const list = cfg.caption ? [cfg.caption] : ["", "_prefix", "_ab"].map(str => lib.translate["name" + str]); game.broadcastAll( //TODO: 这里直接修改trashBin部分,后续需要修改为新写法 function (player, skill, list, cfg) { @@ -7338,6 +7338,7 @@ export class Player extends HTMLDivElement { lib.character[skill].trashBin.push("character:" + cfg.name); } for (let i = 0; i < list.length; i++) { + if (!list[i]) continue; lib.translate[skill + ["", "_prefix", "_ab"][i]] = list[i]; } player.storage[skill] = cfg;