fix: align reserved turn commands with legacy

This commit is contained in:
2026-07-25 14:16:59 +00:00
parent 36d11acdfa
commit 1fef287b6b
23 changed files with 816 additions and 189 deletions
+168 -17
View File
@@ -2,20 +2,173 @@ import { LiteHashDRBG, RandUtil } from '@sammo-ts/common';
import { simpleSerialize } from '../war/utils.js';
const DEFAULT_FIRST_NAMES = [
'가', '간', '감', '강', '고', '공', '공손', '곽', '관', '괴', '교', '금', '노', '뇌', '능', '도', '동',
'두', '등', '마', '맹', '문', '미', '반', '방', '부', '비', '사', '사마', '서', '설', '성', '소', '손',
'송', '순', '신', '심', '악', '안', '양', '엄', '여', '염', '오', '왕', '요', '우', '원', '위', '유',
'육', '윤', '이', '장', '저', '전', '정', '제갈', '조', '종', '주', '진', '채', '태사', '하', '하후',
'학', '한', '향', '허', '호', '화', '황', '공손', '손', '왕', '유', '장', '조',
export const LEGACY_RANDOM_GENERAL_FIRST_NAMES = [
'가',
'',
'',
'',
'',
'공',
'공손',
'곽',
'관',
'괴',
'교',
'금',
'노',
'뇌',
'능',
'도',
'동',
'두',
'등',
'마',
'맹',
'문',
'미',
'반',
'방',
'부',
'비',
'사',
'사마',
'서',
'설',
'성',
'소',
'손',
'송',
'순',
'신',
'심',
'악',
'안',
'양',
'엄',
'여',
'염',
'오',
'왕',
'요',
'우',
'원',
'위',
'유',
'육',
'윤',
'이',
'장',
'저',
'전',
'정',
'제갈',
'조',
'종',
'주',
'진',
'채',
'태사',
'하',
'하후',
'학',
'한',
'향',
'허',
'호',
'화',
'황',
'공손',
'손',
'왕',
'유',
'장',
'조',
] as const;
const DEFAULT_LAST_NAMES = [
'가', '간', '강', '거', '건', '검', '견', '경', '공', '광', '권', '규', '녕', '단', '대', '도', '등',
'람', '량', '례', '로', '료', '모', '민', '박', '범', '보', '비', '사', '상', '색', '서', '소', '속',
'송', '수', '순', '습', '승', '양', '연', '영', '온', '옹', '완', '우', '웅', '월', '위', '유', '윤',
'융', '이', '익', '임', '정', '제', '조', '주', '준', '지', '찬', '책', '충', '탁', '택', '통', '패',
'평', '포', '합', '해', '혁', '현', '화', '환', '회', '횡', '후', '훈', '휴', '흠', '흥',
export const LEGACY_RANDOM_GENERAL_LAST_NAMES = [
'가',
'',
'',
'',
'',
'검',
'견',
'경',
'공',
'광',
'권',
'규',
'녕',
'단',
'대',
'도',
'등',
'람',
'량',
'례',
'로',
'료',
'모',
'민',
'박',
'범',
'보',
'비',
'사',
'상',
'색',
'서',
'소',
'속',
'송',
'수',
'순',
'습',
'승',
'양',
'연',
'영',
'온',
'옹',
'완',
'우',
'웅',
'월',
'위',
'유',
'윤',
'융',
'이',
'익',
'임',
'정',
'제',
'조',
'주',
'준',
'지',
'찬',
'책',
'충',
'탁',
'택',
'통',
'패',
'평',
'포',
'합',
'해',
'혁',
'현',
'화',
'환',
'회',
'횡',
'후',
'훈',
'휴',
'흠',
'흥',
] as const;
const readNameParts = (value: unknown, fallback: readonly string[]): string[] => {
@@ -31,9 +184,9 @@ export const buildAuctionAlias = (
hiddenSeed: string | number,
configConst: Record<string, unknown> = {}
): string => {
const firstNames = readNameParts(configConst.randGenFirstName, DEFAULT_FIRST_NAMES);
const firstNames = readNameParts(configConst.randGenFirstName, LEGACY_RANDOM_GENERAL_FIRST_NAMES);
const middleNames = readNameParts(configConst.randGenMiddleName, ['']);
const lastNames = readNameParts(configConst.randGenLastName, DEFAULT_LAST_NAMES);
const lastNames = readNameParts(configConst.randGenLastName, LEGACY_RANDOM_GENERAL_LAST_NAMES);
const pool: string[] = [];
for (const first of firstNames) {
for (const middle of middleNames) {
@@ -42,9 +195,7 @@ export const buildAuctionAlias = (
}
}
}
const shuffled = new RandUtil(
new LiteHashDRBG(simpleSerialize(hiddenSeed, 'obfuscatedNamePool'))
).shuffle(pool);
const shuffled = new RandUtil(new LiteHashDRBG(simpleSerialize(hiddenSeed, 'obfuscatedNamePool'))).shuffle(pool);
const normalizedId = Math.max(0, Math.floor(generalId));
const duplicateIndex = Math.floor(normalizedId / shuffled.length);
const name = shuffled[normalizedId % shuffled.length] ?? `익명${normalizedId}`;