miao-plugin/models/material/MaterialMeta.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

import lodash from 'lodash'
2023-03-07 17:52:11 +00:00
import { Data } from '#miao'
const talentMeta = {
自由: { week: 1, city: '蒙德', cid: 1 },
繁荣: { week: 1, city: '璃月', cid: 2 },
浮世: { week: 1, city: '稻妻', cid: 3 },
诤言: { week: 1, city: '须弥', cid: 4 },
2023-07-10 20:00:35 +00:00
公平: { week: 1, city: '枫丹', cid: 5 },
抗争: { week: 2, city: '蒙德', cid: 1 },
勤劳: { week: 2, city: '璃月', cid: 2 },
风雅: { week: 2, city: '稻妻', cid: 3 },
巧思: { week: 2, city: '须弥', cid: 4 },
2023-07-10 20:00:35 +00:00
正义: { week: 2, city: '枫丹', cid: 5 },
诗文: { week: 3, city: '蒙德', cid: 1 },
黄金: { week: 3, city: '璃月', cid: 2 },
天光: { week: 3, city: '稻妻', cid: 3 },
2023-07-10 20:00:35 +00:00
笃行: { week: 3, city: '须弥', cid: 4 },
秩序: { week: 3, city: '枫丹', cid: 5 }
}
const talentReg = new RegExp(`(${lodash.keys(talentMeta).join('|')})`)
let MaterialMeta = {
getTalentData (talent) {
talent = MaterialMeta.getTalentKey(talent)
return talentMeta[talent]
},
getTalentKey (name) {
return Data.regRet(talentReg, name, 1) || name
},
getTalentLabel (t) {
let key = MaterialMeta.getTalentKey(t)
let tm = MaterialMeta.getTalentData(key)
if (!tm) {
return t
}
return `${tm.city}·${key}`
},
getTalentWeek (t) {
let tm = MaterialMeta.getTalentData(t)
switch (tm.week) {
case 1:
return '周一/周四'
case 2:
return '周二/周五'
case 3:
return '周三/周六'
}
return ''
}
}
export default MaterialMeta