81 lines
1.6 KiB
JavaScript
81 lines
1.6 KiB
JavaScript
const fs = require('fs')
|
|
const p = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/shared/petState.ts'
|
|
let c = fs.readFileSync(p, 'utf8')
|
|
|
|
// 物品 emoji 图标(插入到每个物品对象的 name 前)
|
|
const icons = {
|
|
bread: '🍞',
|
|
riceball: '🍙',
|
|
bento: '🍱',
|
|
noodle: '🍜',
|
|
cake: '🍰',
|
|
chicken: '🍗',
|
|
soda: '🥤',
|
|
chalcanthite: '💎',
|
|
salt: '🧂',
|
|
oil: '🛢️',
|
|
oil_plus: '⚗️',
|
|
saline: '🧴',
|
|
coffee: '☕',
|
|
milktea: '🧋',
|
|
sodapop: '🥤',
|
|
fakeacid: '🧊',
|
|
alcohol: '🍶',
|
|
sandpaper: '🧽',
|
|
vitc: '💊',
|
|
ultrasonic: '🫧',
|
|
filter: '📄',
|
|
cuso4: '🔷',
|
|
litmus: '🔖',
|
|
tube: '🧪',
|
|
beaker: '🥛',
|
|
flask: '🏺',
|
|
cylinder: '📏',
|
|
lamp: '🔥',
|
|
stand: '🗄️',
|
|
condenser: '🌀',
|
|
crucible: '🥣',
|
|
funnel: '⏳',
|
|
book1: '📗',
|
|
book2: '📘',
|
|
book3: '📙',
|
|
book4: '📕',
|
|
book5: '📚',
|
|
book6: '📖',
|
|
book7: '🧠',
|
|
notebook: '📓',
|
|
bookmark: '🍂',
|
|
cucrystal: '🟦',
|
|
chlorine: '🧴',
|
|
cobaltglass: '🟪',
|
|
benzene: '💠',
|
|
copperwire: '🧵',
|
|
pencil: '✏️',
|
|
note: '📝',
|
|
flamepin: '🎇'
|
|
}
|
|
|
|
let count = 0
|
|
c = c.replace(/\{ id: '([a-z0-9_]+)', name: '/g, (m, id) => {
|
|
const icon = icons[id]
|
|
if (!icon) return m
|
|
count++
|
|
return `{ id: '${id}', icon: '${icon}', name: '`
|
|
})
|
|
console.log('items with icons:', count)
|
|
|
|
// Item 接口加 icon + descNormal
|
|
c = c.replace(
|
|
`export interface Item {
|
|
id: string
|
|
name: string`,
|
|
`export interface Item {
|
|
id: string
|
|
/** 列表前的 emoji 图标 */
|
|
icon?: string
|
|
name: string`
|
|
)
|
|
|
|
fs.writeFileSync(p, c, 'utf8')
|
|
console.log('icons patched')
|