const fs = require('fs') const base = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/' function patch(file, pairs) { const p = base + file let c = fs.readFileSync(p, 'utf8') for (const [from, to] of pairs) { if (!c.includes(from)) { console.log('MISS in', file, '::', from.slice(0, 70).replace(/\n/g, '\\n')) continue } c = c.replace(from, to) } fs.writeFileSync(p, c, 'utf8') } patch('renderer/src/panel/Panel.tsx', [ // 导入普通名映射 [ "import { FLAVOR_HINTS, FLAVOR_LABELS, type Flavor } from '../../../shared/flavor'", "import {\n FLAVOR_HINTS,\n FLAVOR_LABELS,\n NORMAL_CAT_LABELS,\n NORMAL_ITEM_NAMES,\n NORMAL_JOB_NAMES,\n type Flavor\n} from '../../../shared/flavor'" ], // effectText 按风味 [ `function effectText(item: Item): string { return Object.entries(item.effects) .map(([k, v]) => \`\${EFFECT_LABEL[k] ?? k} \${v > 0 ? '+' : ''}\${v}\`) .join(' · ') }`, `function effectText(item: Item, flavor: Flavor): string { return Object.entries(item.effects) .map(([k, v]) => { const label = FLAVOR_LABELS[flavor][k as StatKey] ?? k return \`\${label} \${v > 0 ? '+' : ''}\${v}\` }) .join(' · ') }` ], // 组件内风味助手 [ ` const level = useMemo(() => (state ? levelOf(state.exp) : 1), [state])`, ` const level = useMemo(() => (state ? levelOf(state.exp) : 1), [state]) const itemName = (i: Item): string => (flavor === 'normal' ? (NORMAL_ITEM_NAMES[i.id] ?? i.name) : i.name) const jobName = (id: string): string => (flavor === 'normal' ? (NORMAL_JOB_NAMES[id] ?? id) : id) const catLabel = (c: ItemCategory): string => flavor === 'normal' ? NORMAL_CAT_LABELS[c] : CATEGORY_LABEL[c] function statusLine(): string { if (flavor === 'normal') { if (job) return '工作中 · ' + jobName(job.id) const s = state.stats if (s.electron < 20) return '有点累了' if (s.oxidation > 70) return '想洗个澡了' if (s.satiety < 20) return '肚子饿了' if (s.paraffin < 20) return '有点渴' if (s.mood > 75) return '心情不错' return '一切正常' } return statusText(state.stats, job) }` ], // 头部状态 [ ` {statusText(state.stats, job)}`, ` {statusLine()}` ], // 投喂卡 [ `
新建时会锁定人物立绘与文本风格:预设化拟角色用化学风格,导入角色用普通桌宠风格。
` ], // newSkin 状态 [ " const [newProfile, setNewProfile] = useState('')", " const [newProfile, setNewProfile] = useState('')\n const [newSkin, setNewSkin] = useState('xiaona')" ], // 存档行:显示名字 + 重命名 [ `