행성 Level 1~100 수치표 적용 · 행성 컬러 마스터
This commit is contained in:
@@ -51,8 +51,23 @@ export const fnAuthOnCreate = functionsV1.auth.user().onCreate(async (user) => {
|
||||
|
||||
/** 행성 생성 화면이 고르는 값 — 앱 `PlanetCreateScreen.shapes` · `.colors` 와 같은 키(C-50). */
|
||||
export const PLANET_SHAPES = ['shape1', 'shape2', 'shape3', 'shape4', 'shape5', 'shape6'];
|
||||
/**
|
||||
* 컬러 **기본 목록** — Figma 「행성 색 선택」 명세 `2066:17910`(흰 · 검 · 하늘 · 초록 · 노랑 · 주황 · 빨강 · 보라).
|
||||
* 10/3 통합회신 #6 「최신 Figma 팬덤컬러를 기본으로 하고 발주사가 컬러 항목을 추가할 수 있는 구조, 특정 8색 고정 적용
|
||||
* 안 함」에 따라 실제 허용 목록은 컬러 마스터 `config/planetColors.colors[{key, hex, visible}]` 가 정한다
|
||||
* (Firestore 설계서 §2.17 · C-115). 마스터가 없을 때만 이 목록을 쓴다.
|
||||
*/
|
||||
export const PLANET_COLORS = ['white', 'black', 'blue', 'green', 'gold', 'orange', 'red', 'purple'];
|
||||
|
||||
/** 생성 화면이 고를 수 있는(노출 중인) 컬러 키 — 마스터의 `visible !== false` 항목. */
|
||||
export async function planetColorKeys(): Promise<string[]> {
|
||||
const raw = (await getFirestore().doc('config/planetColors').get()).get('colors');
|
||||
if (!Array.isArray(raw)) return PLANET_COLORS;
|
||||
const keys = raw.filter((c) => c && typeof c.key === 'string' && c.key && c.visible !== false)
|
||||
.map((c) => c.key as string);
|
||||
return keys.length > 0 ? keys : PLANET_COLORS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 운영값 기본 — 🟡 `config/policy` 가 덮는다.
|
||||
* - 성운 전환: 원장 B-10 「10명 이상 + 1,000 POP 이상 + 기본 목표 7일」.
|
||||
@@ -344,7 +359,7 @@ export const fnPlanetCreate = onCall(async (req) => {
|
||||
const fandomId = str(req.data, 'fandomId');
|
||||
const planetType = str(req.data, 'planetType');
|
||||
const colorKey = str(req.data, 'colorKey');
|
||||
if (!PLANET_SHAPES.includes(planetType) || !PLANET_COLORS.includes(colorKey)) {
|
||||
if (!PLANET_SHAPES.includes(planetType) || !(await planetColorKeys()).includes(colorKey)) {
|
||||
throw new HttpsError('invalid-argument', '행성 형태 또는 색이 올바르지 않습니다.');
|
||||
}
|
||||
const db = getFirestore();
|
||||
@@ -375,10 +390,18 @@ export const fnPlanetCreate = onCall(async (req) => {
|
||||
colorKey,
|
||||
createdAt: FieldValue.serverTimestamp(),
|
||||
});
|
||||
// 수치표 v1.4 「레벨 진행 기준점」 — 생성 시점 누적 POP 을 저장하고 이후 증가분부터 Lv.1→2 진행도에
|
||||
// 반영한다. 성운 기여 POP 은 growthPop 에 그대로 남는다(「소멸·초기화 없음」).
|
||||
const birthPop = Number(fandom.growthPop ?? 0);
|
||||
tx.update(fandomRef, {
|
||||
stage: 1,
|
||||
level: 1,
|
||||
levelPop: 0,
|
||||
growthPopAtBirth: birthPop,
|
||||
levelCountedGrowthPop: birthPop,
|
||||
planetType,
|
||||
colorKey,
|
||||
stageChangedAt: FieldValue.serverTimestamp(),
|
||||
updatedAt: FieldValue.serverTimestamp(),
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user