调整部分模块的引用方式

This commit is contained in:
Kokomi 2023-03-08 01:52:11 +08:00
parent 422b782cae
commit 29e1c446a7
80 changed files with 295 additions and 287 deletions

View File

@ -15,11 +15,11 @@ Miao-Plugin 是一个 Yunzai-Bot 的升级插件,提供包括角色查询等
``` ```
// 使用gitee // 使用gitee
git clone https://gitee.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/ git clone https://gitee.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/
pnpm add image-size -w pnpm install -P
// 使用github // 使用github
git clone https://github.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/ git clone https://github.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/
pnpm add image-size -w pnpm install -P
``` ```
进行安装。安装完毕后,管理员只需发送 `#喵喵更新` 即可自动更新 miao-plugin。 进行安装。安装完毕后,管理员只需发送 `#喵喵更新` 即可自动更新 miao-plugin。
@ -37,7 +37,7 @@ pnpm add image-size -w
推荐直接使用 V3-Yunzai 搭配 miao-plugin 使用。不能做V2钉子户——喵佬 推荐直接使用 V3-Yunzai 搭配 miao-plugin 使用。不能做V2钉子户——喵佬
[issue#13](https://github.com/yoimiya-kokomi/miao-plugin/issues/74) : 如启动时报 Cannot find package 'image-size' [issue#13](https://github.com/yoimiya-kokomi/miao-plugin/issues/74) : 如启动时报 Cannot find package 'image-size'
的错误直接在yunzai根目录下`pnpm add image-size -w` 或使用cnpm、npm等包管理工具安装image-size库即可 的错误直接在yunzai根目录下`pnpm install -P` 或使用cnpm、npm等包管理工具安装image-size库即可
### V2-Yunzai ### V2-Yunzai

View File

@ -1,7 +1,7 @@
import fs from 'fs' import fs from 'fs'
import lodash from 'lodash' import lodash from 'lodash'
import { exec } from 'child_process' import { exec } from 'child_process'
import { Cfg, Common, Data, App } from '../components/index.js' import { Cfg, Common, Data, App } from '#miao'
let keys = lodash.map(Cfg.getCfgSchemaMap(), (i) => i.key) let keys = lodash.map(Cfg.getCfgSchemaMap(), (i) => i.key)
let app = App.init({ let app = App.init({

View File

@ -1,8 +1,8 @@
import { App } from '../components/index.js'
import { uploadCharacterImg } from './character/ImgUpload.js' import { uploadCharacterImg } from './character/ImgUpload.js'
import { getOriginalPicture } from './profile/ProfileUtils.js' import { getOriginalPicture } from './profile/ProfileUtils.js'
import Avatar from './character/AvatarCard.js' import Avatar from './character/AvatarCard.js'
import Wife from './character/AvatarWife.js' import Wife from './character/AvatarWife.js'
import { App } from '#miao'
let app = App.init({ let app = App.init({
id: 'character', id: 'character',

View File

@ -1,5 +1,5 @@
import { Character, MysApi, Player } from '../../models/index.js' import { Character, MysApi, Player } from '#miao.models'
import { Cfg, Common } from '../../components/index.js' import { Cfg, Common } from '#miao'
import lodash from 'lodash' import lodash from 'lodash'
import { segment } from 'oicq' import { segment } from 'oicq'
import moment from 'moment' import moment from 'moment'

View File

@ -1,7 +1,7 @@
// #老婆 // #老婆
import lodash from 'lodash' import lodash from 'lodash'
import { Common } from '../../components/index.js' import { Common } from '#miao'
import { Character, MysApi, Player } from '../../models/index.js' import { Character, MysApi, Player } from '#miao.models'
import Avatar from './AvatarCard.js' import Avatar from './AvatarCard.js'
const relationMap = { const relationMap = {

View File

@ -5,8 +5,8 @@ import { segment } from 'oicq'
import MD5 from 'md5' import MD5 from 'md5'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import lodash from 'lodash' import lodash from 'lodash'
import { Cfg, Data } from '../../components/index.js' import { Cfg, Data } from '#miao'
import { Character } from '../../models/index.js' import { Character } from '#miao.models'
const resPath = process.cwd() + '/plugins/miao-plugin/resources/' const resPath = process.cwd() + '/plugins/miao-plugin/resources/'
let regex = /^#?\s*(?:喵喵)?(?:上传|添加)(.+)(?:照片|写真|图片|图像)\s*$/ let regex = /^#?\s*(?:喵喵)?(?:上传|添加)(.+)(?:照片|写真|图片|图像)\s*$/

View File

@ -1,5 +1,5 @@
import { App, Cfg } from '../components/index.js'
import Gacha from './gacha/Gacha.js' import Gacha from './gacha/Gacha.js'
import { App, Cfg } from '#miao'
let app = App.init({ let app = App.init({
id: 'gacha', id: 'gacha',

View File

@ -1,7 +1,7 @@
import { Common } from '../../components/index.js' import { Common } from '#miao'
import { getTargetUid } from '../profile/ProfileCommon.js' import { getTargetUid } from '../profile/ProfileCommon.js'
import GachaData from './GachaData.js' import GachaData from './GachaData.js'
import { Character, Player } from '../../models/index.js' import { Character, Player } from '#miao.models'
let Gacha = { let Gacha = {
async detail (e) { async detail (e) {

View File

@ -1,6 +1,6 @@
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../../components/index.js' import { Data } from '#miao'
import { Character, Weapon } from '../../models/index.js' import { Character, Weapon } from '#miao.models'
import { poolDetail } from '../../resources/meta/info/index.js' import { poolDetail } from '../../resources/meta/info/index.js'
import moment from 'moment' import moment from 'moment'

View File

@ -1,5 +1,5 @@
import { App } from '../components/index.js'
import Help from './help/Help.js' import Help from './help/Help.js'
import { App } from '#miao'
let app = App.init({ let app = App.init({
id: 'help', id: 'help',

View File

@ -1,4 +1,4 @@
import { Cfg, Common, Data, Version } from '../../components/index.js' import { Cfg, Common, Data, Version } from '#miao'
import fs from 'fs' import fs from 'fs'
import lodash from 'lodash' import lodash from 'lodash'
import HelpTheme from './HelpTheme.js' import HelpTheme from './HelpTheme.js'

View File

@ -1,6 +1,6 @@
import lodash from 'lodash' import lodash from 'lodash'
import fs from 'fs' import fs from 'fs'
import { Data } from '../../components/index.js' import { Data } from '#miao'
let HelpTheme = { let HelpTheme = {
async getThemeCfg (theme, exclude) { async getThemeCfg (theme, exclude) {
@ -29,7 +29,7 @@ let HelpTheme = {
return { return {
main: `${resPath}${name}/main.png`, main: `${resPath}${name}/main.png`,
bg: fs.existsSync(`${dirPath}${name}/bg.jpg`) ? `${resPath}${name}/bg.jpg` : `${resPath}default/bg.jpg`, bg: fs.existsSync(`${dirPath}${name}/bg.jpg`) ? `${resPath}${name}/bg.jpg` : `${resPath}default/bg.jpg`,
style: (await Data.importModule(`resources/help/theme/${name}/config.js`)).style || {} style: (await Data.importModule(`resources/help/theme/${name}/config.js`, 'miao')).style || {}
} }
}, },
async getThemeData (diyStyle, sysStyle) { async getThemeData (diyStyle, sysStyle) {

View File

@ -1,5 +1,5 @@
import { App } from '../components/index.js'
import Wife from './character/AvatarWife.js' import Wife from './character/AvatarWife.js'
import { App } from '#miao'
let app = App.init({ let app = App.init({
id: 'poke', id: 'poke',

View File

@ -1,4 +1,3 @@
import { App, Cfg } from '../components/index.js'
import { profileHelp } from './profile/ProfileCommon.js' import { profileHelp } from './profile/ProfileCommon.js'
import { profileArtisList } from './profile/ProfileArtis.js' import { profileArtisList } from './profile/ProfileArtis.js'
import ProfileDetail from './profile/ProfileDetail.js' import ProfileDetail from './profile/ProfileDetail.js'
@ -7,6 +6,7 @@ import ProfileList from './profile/ProfileList.js'
import { uploadCharacterImg, delProfileImg, profileImgList } from './character/ImgUpload.js' import { uploadCharacterImg, delProfileImg, profileImgList } from './character/ImgUpload.js'
import { enemyLv } from './profile/ProfileUtils.js' import { enemyLv } from './profile/ProfileUtils.js'
import { groupRank, resetRank, refreshRank, manageRank } from './profile/ProfileRank.js' import { groupRank, resetRank, refreshRank, manageRank } from './profile/ProfileRank.js'
import { App, Cfg } from '#miao'
let app = App.init({ let app = App.init({
id: 'profile', id: 'profile',

View File

@ -3,9 +3,9 @@
* *
* */ * */
import lodash from 'lodash' import lodash from 'lodash'
import { Cfg, Common } from '../../components/index.js' import { Cfg, Common } from '#miao'
import { getTargetUid, profileHelp, getProfileRefresh } from './ProfileCommon.js' import { getTargetUid, profileHelp, getProfileRefresh } from './ProfileCommon.js'
import { Artifact, Character, ProfileArtis, Player } from '../../models/index.js' import { Artifact, Character, ProfileArtis, Player } from '#miao.models'
/* /*
* 角色圣遗物面板 * 角色圣遗物面板

View File

@ -2,8 +2,8 @@
* 面板数据替换相关逻辑 * 面板数据替换相关逻辑
*/ */
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../../components/index.js' import { Data } from '#miao'
import { Character, ProfileData, Weapon, Player } from '../../models/index.js' import { Character, ProfileData, Weapon, Player } from '#miao.models'
const keyMap = { const keyMap = {
artis: '圣遗物', artis: '圣遗物',

View File

@ -2,8 +2,8 @@
* 面板公共方法及处理 * 面板公共方法及处理
* */ * */
import { segment } from 'oicq' import { segment } from 'oicq'
import { Version } from '../../components/index.js' import { Version } from '#miao'
import { Character, MysApi, Player } from '../../models/index.js' import { Character, MysApi, Player } from '#miao.models'
/* /*
* 获取面板查询的 目标uid * 获取面板查询的 目标uid

View File

@ -1,8 +1,8 @@
import lodash from 'lodash' import lodash from 'lodash'
import { getTargetUid, getProfileRefresh } from './ProfileCommon.js' import { getTargetUid, getProfileRefresh } from './ProfileCommon.js'
import ProfileList from './ProfileList.js' import ProfileList from './ProfileList.js'
import { Cfg, Common, Format } from '../../components/index.js' import { Cfg, Common, Format } from '#miao'
import { MysApi, ProfileRank, ProfileArtis, Character, Weapon } from '../../models/index.js' import { MysApi, ProfileRank, ProfileArtis, Character, Weapon } from '#miao.models'
import ProfileChange from './ProfileChange.js' import ProfileChange from './ProfileChange.js'
import { profileArtis } from './ProfileArtis.js' import { profileArtis } from './ProfileArtis.js'

View File

@ -1,7 +1,7 @@
import lodash from 'lodash' import lodash from 'lodash'
import { getTargetUid } from './ProfileCommon.js' import { getTargetUid } from './ProfileCommon.js'
import { ProfileRank, Player, Character } from '../../models/index.js' import { Common, Data } from '#miao'
import { Common, Data } from '../../components/index.js' import { ProfileRank, Player, Character } from '#miao.models'
const ProfileList = { const ProfileList = {
/** /**

View File

@ -1,7 +1,7 @@
import { Character, ProfileRank, ProfileDmg, Player } from '../../models/index.js'
import ProfileDetail from './ProfileDetail.js'
import { Data, Common, Format } from '../../components/index.js'
import lodash from 'lodash' import lodash from 'lodash'
import ProfileDetail from './ProfileDetail.js'
import { Data, Common, Format } from '#miao'
import { Character, ProfileRank, ProfileDmg, Player } from '#miao.models'
export async function groupRank (e) { export async function groupRank (e) {
const groupRank = Common.cfg('groupRank') const groupRank = Common.cfg('groupRank')

View File

@ -1,5 +1,5 @@
import { Common } from '../../components/index.js' import { Common } from '#miao'
import { MysApi, Player, Character } from '../../models/index.js' import { MysApi, Player, Character } from '#miao.models'
const ProfileStat = { const ProfileStat = {
async stat (e) { async stat (e) {

View File

@ -1,6 +1,6 @@
import { segment } from 'oicq' import { segment } from 'oicq'
import { MysApi } from '../../models/index.js' import { Cfg } from '#miao'
import { Cfg } from '../../components/index.js' import { MysApi } from '#miao.models'
/** 获取角色卡片的原图 */ /** 获取角色卡片的原图 */
export async function getOriginalPicture (e) { export async function getOriginalPicture (e) {

View File

@ -2,10 +2,10 @@
* 胡桃数据库的统计 * 胡桃数据库的统计
* *
* */ * */
import { App } from '../components/index.js'
import { ConsStat, AbyssPct } from './stat/AbyssStat.js' import { ConsStat, AbyssPct } from './stat/AbyssStat.js'
import { AbyssTeam } from './stat/AbyssTeam.js' import { AbyssTeam } from './stat/AbyssTeam.js'
import { AbyssSummary } from './stat/AbyssSummary.js' import { AbyssSummary } from './stat/AbyssSummary.js'
import { App } from '#miao'
let app = App.init({ let app = App.init({
id: 'stat', id: 'stat',

View File

@ -1,7 +1,7 @@
import HutaoApi from './HutaoApi.js' import HutaoApi from './HutaoApi.js'
import lodash from 'lodash' import lodash from 'lodash'
import { Character } from '../../models/index.js' import { Common } from '#miao'
import { Common } from '../../components/index.js' import { Character } from '#miao.models'
export async function ConsStat (e) { export async function ConsStat (e) {
let consData = await HutaoApi.getCons() let consData = await HutaoApi.getCons()

View File

@ -1,7 +1,7 @@
import { Cfg, Common, Data } from '../../components/index.js'
import { Abyss, Character, MysApi, Player } from '../../models/index.js'
import HutaoApi from './HutaoApi.js'
import lodash from 'lodash' import lodash from 'lodash'
import HutaoApi from './HutaoApi.js'
import { Cfg, Common, Data } from '#miao'
import { Abyss, Character, MysApi, Player } from '#miao.models'
export async function AbyssSummary (e) { export async function AbyssSummary (e) {
let isMatch = /^#(喵喵|上传)深渊(数据)?$/.test(e.original_msg || e.msg || '') let isMatch = /^#(喵喵|上传)深渊(数据)?$/.test(e.original_msg || e.msg || '')

View File

@ -1,7 +1,7 @@
import { Character, MysApi, Player } from '../../models/index.js'
import HutaoApi from './HutaoApi.js'
import lodash from 'lodash' import lodash from 'lodash'
import { Common } from '../../components/index.js' import HutaoApi from './HutaoApi.js'
import { Common } from '#miao'
import { Character, MysApi, Player } from '#miao.models'
export async function AbyssTeam (e) { export async function AbyssTeam (e) {
let mys = await MysApi.init(e, 'cookie') let mys = await MysApi.init(e, 'cookie')

View File

@ -5,7 +5,7 @@
* */ * */
import fetch from 'node-fetch' import fetch from 'node-fetch'
import { Data } from '../../components/index.js' import { Data } from '#miao'
const host = 'http://miaoapi.cn/api/hutao' const host = 'http://miaoapi.cn/api/hutao'

View File

@ -1,8 +1,9 @@
import lodash from 'lodash'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import moment from 'moment' import moment from 'moment'
import { Character, Material } from '../../models/index.js' import { Common, Data, Cfg } from '#miao'
import { Common, Data, Cfg } from '../../components/index.js' import { Character, Material } from '#miao.models'
import lodash from 'lodash'
const ignoreIds = [495, // 有奖问卷调查开启! const ignoreIds = [495, // 有奖问卷调查开启!
1263, // 米游社《原神》专属工具一览 1263, // 米游社《原神》专属工具一览

View File

@ -1,4 +1,4 @@
import { Common } from '../../components/index.js' import { Common } from '#miao'
const CharMaterial = { const CharMaterial = {
async render ({ e, char }) { async render ({ e, char }) {

View File

@ -1,5 +1,5 @@
import { Common, Format } from '../../components/index.js'
import lodash from 'lodash' import lodash from 'lodash'
import { Common, Format } from '#miao'
const CharTalent = { const CharTalent = {
async render (e, mode, char) { async render (e, mode, char) {

View File

@ -1,10 +1,10 @@
import { Cfg, Common } from '../../components/index.js' import lodash from 'lodash'
import { Character } from '../../models/index.js'
import { segment } from 'oicq' import { segment } from 'oicq'
import CharTalent from './CharTalent.js' import CharTalent from './CharTalent.js'
import lodash from 'lodash'
import CharWikiData from './CharWikiData.js' import CharWikiData from './CharWikiData.js'
import CharMaterial from './CharMaterial.js' import CharMaterial from './CharMaterial.js'
import { Cfg, Common } from '#miao'
import { Character } from '#miao.models'
const wikiReg = /^(?:#|喵喵)?(.*)(天赋|技能|命座|命之座|资料|图鉴|照片|写真|图片|图像)$/ const wikiReg = /^(?:#|喵喵)?(.*)(天赋|技能|命座|命之座|资料|图鉴|照片|写真|图片|图像)$/

View File

@ -1,7 +1,7 @@
import HutaoApi from '../stat/HutaoApi.js' import HutaoApi from '../stat/HutaoApi.js'
import lodash from 'lodash' import lodash from 'lodash'
import { Format } from '../../components/index.js' import { Format } from '#miao'
import { ArtifactSet, Weapon } from '../../models/index.js' import { ArtifactSet, Weapon } from '#miao.models'
let CharWikiData = { let CharWikiData = {
/** /**

View File

@ -3,10 +3,14 @@ import fs from 'fs'
const _path = process.cwd() const _path = process.cwd()
const getRoot = (root = '') => { const getRoot = (root = '') => {
if (root === 'root' || root === 'yunzai') { if (!root) {
root = `${_path}/` root = `${_path}/`
} else if (!root) { } else if (root === 'root' || root === 'yunzai') {
root = `${_path}/`
} else if (root === 'miao') {
root = `${_path}/plugins/miao-plugin/` root = `${_path}/plugins/miao-plugin/`
} else {
root = `${_path}/plugins/${root}/`
} }
return root return root
} }
@ -51,7 +55,7 @@ let Data = {
/* /*
* 写JSON * 写JSON
* */ * */
writeJSON (cfg, data, space = '\t', root = '') { writeJSON (cfg, data, root = '', space = 2) {
if (arguments.length > 1) { if (arguments.length > 1) {
return Data.writeJSON({ return Data.writeJSON({
name: cfg, name: cfg,
@ -72,6 +76,7 @@ let Data = {
} }
return fs.writeFileSync(`${root}/${name}`, data) return fs.writeFileSync(`${root}/${name}`, data)
}, },
delFile (file, root = '') { delFile (file, root = '') {
root = getRoot(root) root = getRoot(root)
try { try {
@ -84,6 +89,7 @@ let Data = {
} }
return false return false
}, },
async getCacheJSON (key) { async getCacheJSON (key) {
try { try {
let txt = await redis.get(key) let txt = await redis.get(key)
@ -138,8 +144,8 @@ let Data = {
}, },
async importCfg (key) { async importCfg (key) {
let sysCfg = await Data.importModule(`config/system/${key}_system.js`) let sysCfg = await Data.importModule(`config/system/${key}_system.js`, 'miao')
let diyCfg = await Data.importModule(`config/${key}.js`) let diyCfg = await Data.importModule(`config/${key}.js`, 'miao')
if (diyCfg.isSys) { if (diyCfg.isSys) {
console.error(`miao-plugin: config/${key}.js无效已忽略`) console.error(`miao-plugin: config/${key}.js无效已忽略`)
console.error(`如需配置请复制config/${key}_default.js为config/${key}.js请勿复制config/system下的系统文件`) console.error(`如需配置请复制config/${key}_default.js为config/${key}.js请勿复制config/system下的系统文件`)

View File

@ -1,6 +1,6 @@
import lodash from 'lodash' import lodash from 'lodash'
import Elem from './common/Elem.js' import Elem from './common/Elem.js'
import { Cfg } from '../components/index.js' import { Cfg } from '#miao'
let Format = { let Format = {
...Elem, ...Elem,

View File

@ -21,7 +21,7 @@ let cfgData = {
}, },
async getCfg () { async getCfg () {
let ret = lodash.toPlainObject(await Data.importModule('/config/cfg.js')) let ret = lodash.toPlainObject(await Data.importModule('/config/cfg.js', 'miao'))
lodash.forEach(cfgSchema, (cfgGroup) => { lodash.forEach(cfgSchema, (cfgGroup) => {
lodash.forEach(cfgGroup.cfg, (cfgItem, cfgKey) => { lodash.forEach(cfgGroup.cfg, (cfgItem, cfgKey) => {
ret[cfgKey] = Data.def(ret[cfgKey], cfgItem.def) ret[cfgKey] = Data.def(ret[cfgKey], cfgItem.def)

View File

@ -1,4 +1,4 @@
import { Data, Version } from './components/index.js' import { Data, Version } from '#miao'
import fs from 'fs' import fs from 'fs'
export * from './apps/index.js' export * from './apps/index.js'

View File

@ -5,7 +5,7 @@
import lodash from 'lodash' import lodash from 'lodash'
import moment from 'moment' import moment from 'moment'
import Base from '../models/Base.js' import Base from '../models/Base.js'
import { Data } from '../components/index.js' import { Data } from '#miao'
moment.locale('zh-cn') moment.locale('zh-cn')

View File

@ -2,7 +2,7 @@
* 圣遗物 * 圣遗物
* */ * */
import Base from './Base.js' import Base from './Base.js'
import { Format } from '../components/index.js' import { Format } from '#miao'
import { ArtifactSet } from './index.js' import { ArtifactSet } from './index.js'
import { artiMap, attrMap, mainIdMap, attrIdMap } from '../resources/meta/artifact/index.js' import { artiMap, attrMap, mainIdMap, attrIdMap } from '../resources/meta/artifact/index.js'
import lodash from 'lodash' import lodash from 'lodash'

View File

@ -4,7 +4,7 @@
import lodash from 'lodash' import lodash from 'lodash'
import Base from './Base.js' import Base from './Base.js'
import { Artifact, ArtifactSet } from './index.js' import { Artifact, ArtifactSet } from './index.js'
import { Format, Data } from '../components/index.js' import { Format, Data } from '#miao'
import ArtisMark from './profile/ArtisMark.js' import ArtisMark from './profile/ArtisMark.js'
export default class AvatarArtis extends Base { export default class AvatarArtis extends Base {

View File

@ -2,7 +2,7 @@ import lodash from 'lodash'
import Base from './Base.js' import Base from './Base.js'
import moment from 'moment' import moment from 'moment'
import { Character, AvatarArtis, ProfileData, Weapon } from './index.js' import { Character, AvatarArtis, ProfileData, Weapon } from './index.js'
import { Data } from '../components/index.js' import { Data } from '#miao'
import AttrCalc from './profile/AttrCalc.js' import AttrCalc from './profile/AttrCalc.js'
import Profile from './player/Profile.js' import Profile from './player/Profile.js'

View File

@ -4,7 +4,7 @@
* 使用Proxy实现meta数据的getter * 使用Proxy实现meta数据的getter
* 对Character等可复用设置实例缓存提高性能 * 对Character等可复用设置实例缓存提高性能
* */ * */
import { Data } from '../components/index.js' import { Data } from '#miao'
let cacheMap = {} let cacheMap = {}
let reFn = {} let reFn = {}

View File

@ -6,7 +6,7 @@
* */ * */
import lodash from 'lodash' import lodash from 'lodash'
import Base from './Base.js' import Base from './Base.js'
import { Data, Format, Cfg } from '../components/index.js' import { Data, Format, Cfg } from '#miao'
import CharImg from './character/CharImg.js' import CharImg from './character/CharImg.js'
import CharTalent from './character/CharTalent.js' import CharTalent from './character/CharTalent.js'
import CharId from './character/CharId.js' import CharId from './character/CharId.js'
@ -16,7 +16,7 @@ import CharCfg from './character/CharCfg.js'
let { wifeMap, idSort, idMap } = CharId let { wifeMap, idSort, idMap } = CharId
let getMeta = function (name) { let getMeta = function (name) {
return Data.readJSON(`resources/meta/character/${name}/data.json`) return Data.readJSON(`resources/meta/character/${name}/data.json`,'miao')
} }
class Character extends Base { class Character extends Base {
@ -253,9 +253,9 @@ class Character extends Base {
try { try {
if (this.isTraveler) { if (this.isTraveler) {
this._detail = Data.readJSON(`${path}/旅行者/${this.elem}/detail.json`) this._detail = Data.readJSON(`${path}/旅行者/${this.elem}/detail.json`,'miao')
} else { } else {
this._detail = Data.readJSON(`${path}/${this.name}/detail.json`) this._detail = Data.readJSON(`${path}/${this.name}/detail.json`,'miao')
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)

View File

@ -3,11 +3,11 @@
* */ * */
import lodash from 'lodash' import lodash from 'lodash'
import Base from './Base.js' import Base from './Base.js'
import { Data } from '../components/index.js' import { Data } from '#miao'
import MaterialMeta from './material/MaterialMeta.js' import MaterialMeta from './material/MaterialMeta.js'
let data = Data.readJSON('resources/meta/material/data.json') let data = Data.readJSON('resources/meta/material/data.json','miao')
let abbr = await Data.importDefault('resources/meta/material/abbr.js') let abbr = await Data.importDefault('resources/meta/material/abbr.js', 'miao')
let mMap = {} let mMap = {}
let getItem = (ds) => { let getItem = (ds) => {
mMap[ds.name] = { mMap[ds.name] = {

View File

@ -1,5 +1,5 @@
import { User } from './index.js' import { User } from './index.js'
import { Version } from '../components/index.js' import { Version } from '#miao'
export default class MysApi { export default class MysApi {
constructor (e, uid, mysInfo) { constructor (e, uid, mysInfo) {

View File

@ -6,7 +6,7 @@
*/ */
import lodash from 'lodash' import lodash from 'lodash'
import Base from './Base.js' import Base from './Base.js'
import { Data } from '../components/index.js' import { Data } from '#miao'
import { AvatarData, ProfileRank, Character } from './index.js' import { AvatarData, ProfileRank, Character } from './index.js'
import MysAvatar from './player/MysAvatar.js' import MysAvatar from './player/MysAvatar.js'
@ -104,7 +104,7 @@ export default class Player extends Base {
if (this._ck) { if (this._ck) {
ret._ck = this._ck ret._ck = this._ck
} }
Data.writeJSON(`/data/UserData/${this.uid}.json`, ret, '', 'root') Data.writeJSON(`/data/UserData/${this.uid}.json`, ret, 'root')
} }
del () { del () {

View File

@ -4,7 +4,7 @@
import lodash from 'lodash' import lodash from 'lodash'
import AvatarArtis from './AvatarArtis.js' import AvatarArtis from './AvatarArtis.js'
import { Artifact, ArtifactSet, Character } from './index.js' import { Artifact, ArtifactSet, Character } from './index.js'
import { Format } from '../components/index.js' import { Format } from '#miao'
import ArtisMark from './profile/ArtisMark.js' import ArtisMark from './profile/ArtisMark.js'
import { attrMap } from '../resources/meta/artifact/index.js' import { attrMap } from '../resources/meta/artifact/index.js'
import CharArtis from './profile/CharArtis.js' import CharArtis from './profile/CharArtis.js'

View File

@ -1,6 +1,6 @@
import lodash from 'lodash' import lodash from 'lodash'
import AvatarData from './AvatarData.js' import AvatarData from './AvatarData.js'
import { Data, Cfg } from '../components/index.js' import { Data, Cfg } from '#miao'
import { ProfileArtis, ProfileDmg } from './index.js' import { ProfileArtis, ProfileDmg } from './index.js'
import AttrCalc from './profile/AttrCalc.js' import AttrCalc from './profile/AttrCalc.js'
import CharImg from './character/CharImg.js' import CharImg from './character/CharImg.js'

View File

@ -6,7 +6,7 @@ import { attrMap } from '../resources/meta/artifact/index.js'
import DmgBuffs from './profile/DmgBuffs.js' import DmgBuffs from './profile/DmgBuffs.js'
import DmgAttr from './profile/DmgAttr.js' import DmgAttr from './profile/DmgAttr.js'
import DmgCalc from './profile/DmgCalc.js' import DmgCalc from './profile/DmgCalc.js'
import { Common } from '../components/index.js' import { Common } from '#miao'
export default class ProfileDmg extends Base { export default class ProfileDmg extends Base {
constructor (profile = {}) { constructor (profile = {}) {

View File

@ -1,6 +1,6 @@
import lodash from 'lodash' import lodash from 'lodash'
import moment from 'moment' import moment from 'moment'
import { Cfg, Common, Data } from '../components/index.js' import { Cfg, Common, Data } from '#miao'
export default class ProfileRank { export default class ProfileRank {
constructor (data) { constructor (data) {

View File

@ -1,6 +1,6 @@
import lodash from 'lodash' import lodash from 'lodash'
import Base from './Base.js' import Base from './Base.js'
import { Data, Cfg } from '../components/index.js' import { Data, Cfg } from '#miao'
let { sysCfg, diyCfg } = await Data.importCfg('profile') let { sysCfg, diyCfg } = await Data.importCfg('profile')

View File

@ -1,5 +1,5 @@
import Base from './Base.js' import Base from './Base.js'
import { Data } from '../components/index.js' import { Data } from '#miao'
import { weaponData, weaponAbbr, weaponAlias, weaponType, weaponSet } from '../resources/meta/weapon/index.js' import { weaponData, weaponAbbr, weaponAlias, weaponType, weaponSet } from '../resources/meta/weapon/index.js'
import lodash from 'lodash' import lodash from 'lodash'
@ -83,7 +83,7 @@ class Weapon extends Base {
} }
const path = 'resources/meta/weapon' const path = 'resources/meta/weapon'
try { try {
this._detail = Data.readJSON(`${path}/${this.type}/${this.name}/data.json`) this._detail = Data.readJSON(`${path}/${this.type}/${this.name}/data.json`,'miao')
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }

View File

@ -1,4 +1,4 @@
import { Data } from '../../components/index.js' import { Data } from '#miao'
import lodash from 'lodash' import lodash from 'lodash'
import fs from 'fs' import fs from 'fs'
@ -28,7 +28,7 @@ let cfgMap = {
return fs.existsSync(`${charPath}/${char}/${file}.js`) return fs.existsSync(`${charPath}/${char}/${file}.js`)
}, },
async getCfg (char, file, module = '') { async getCfg (char, file, module = '') {
let cfg = await Data.importModule(`resources/meta/character/${char}/${file}.js`) let cfg = await Data.importModule(`resources/meta/character/${char}/${file}.js`, 'miao')
if (module) { if (module) {
return cfg[module] return cfg[module]
} }

View File

@ -2,7 +2,7 @@
* 角色别名及角色ID相关 * 角色别名及角色ID相关
* */ * */
import lodash from 'lodash' import lodash from 'lodash'
import { Data, Format } from '../../components/index.js' import { Data, Format } from '#miao'
import { charPosIdx } from './CharMeta.js' import { charPosIdx } from './CharMeta.js'
// 别名表 // 别名表

View File

@ -3,7 +3,7 @@
* */ * */
import lodash from 'lodash' import lodash from 'lodash'
import { Material } from '../index.js' import { Material } from '../index.js'
import { Format } from '../../components/index.js' import { Format } from '#miao'
// 角色排序 // 角色排序
export const charPosIdx = { export const charPosIdx = {

View File

@ -1,5 +1,5 @@
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../../components/index.js' import { Data } from '#miao'
const talentMeta = { const talentMeta = {
自由: { week: 1, city: '蒙德', cid: 1 }, 自由: { week: 1, city: '蒙德', cid: 1 },

View File

@ -1,6 +1,6 @@
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../../components/index.js'
import EnkaData from './EnkaData.js' import EnkaData from './EnkaData.js'
import { Data } from '#miao'
let HttpsProxyAgent = '' let HttpsProxyAgent = ''

View File

@ -1,6 +1,6 @@
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../../components/index.js'
import EnkaData from './EnkaData.js' import EnkaData from './EnkaData.js'
import { Data } from '#miao'
export default { export default {
id: 'mgg', id: 'mgg',

View File

@ -1,6 +1,6 @@
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../../components/index.js'
import MiaoData from './MiaoData.js' import MiaoData from './MiaoData.js'
import { Data } from '#miao'
export default { export default {
key: 'miao', key: 'miao',

View File

@ -1,7 +1,8 @@
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../../components/index.js'
import { chestInfo } from '../../resources/meta/info/index.js'
import moment from 'moment' import moment from 'moment'
import { Data } from '#miao'
import { chestInfo } from '../../resources/meta/info/index.js'
const MysAvatar = { const MysAvatar = {

View File

@ -1,5 +1,5 @@
import { ProfileReq, ProfileServ } from '../index.js' import { ProfileReq, ProfileServ } from '../index.js'
import { Cfg, Data } from '../../components/index.js' import { Cfg, Data } from '#miao'
import MysAvatar from './MysAvatar.js' import MysAvatar from './MysAvatar.js'
import enkaApi from './EnkaApi.js' import enkaApi from './EnkaApi.js'

View File

@ -1,5 +1,5 @@
import lodash from 'lodash' import lodash from 'lodash'
import { Format } from '../../components/index.js' import { Format } from '#miao'
import { attrNameMap, mainAttr, subAttr, attrMap } from '../../resources/meta/artifact/index.js' import { attrNameMap, mainAttr, subAttr, attrMap } from '../../resources/meta/artifact/index.js'
let ArtisMark = { let ArtisMark = {

View File

@ -4,7 +4,7 @@
*/ */
import { Weapon, ProfileAttr } from '../index.js' import { Weapon, ProfileAttr } from '../index.js'
import { Format } from '../../components/index.js' import { Format } from '#miao'
import { calc as artisBuffs } from '../../resources/meta/artifact/index.js' import { calc as artisBuffs } from '../../resources/meta/artifact/index.js'
import { weaponBuffs } from '../../resources/meta/weapon/index.js' import { weaponBuffs } from '../../resources/meta/weapon/index.js'
import lodash from 'lodash' import lodash from 'lodash'

View File

@ -4,7 +4,7 @@
import { attrMap } from '../../resources/meta/artifact/index.js' import { attrMap } from '../../resources/meta/artifact/index.js'
import lodash from 'lodash' import lodash from 'lodash'
import DmgMastery from './DmgMastery.js' import DmgMastery from './DmgMastery.js'
import { Format } from '../../components/index.js' import { Format } from '#miao'
let DmgAttr = { let DmgAttr = {
// 计算并返回指定属性值 // 计算并返回指定属性值

View File

@ -2,7 +2,7 @@
* 伤害计算 - Buff计算 * 伤害计算 - Buff计算
* */ * */
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../../components/index.js' import { Data } from '#miao'
import { ProfileArtis } from '../index.js' import { ProfileArtis } from '../index.js'
let weaponBuffs = {} let weaponBuffs = {}
@ -10,8 +10,8 @@ let artisBuffs = {}
// lazy load // lazy load
setTimeout(async function init () { setTimeout(async function init () {
weaponBuffs = (await Data.importModule('resources/meta/weapon/index.js')).weaponBuffs || {} weaponBuffs = (await Data.importModule('resources/meta/weapon/index.js', 'miao')).weaponBuffs || {}
artisBuffs = (await Data.importModule('resources/meta/artifact/index.js')).calc || {} artisBuffs = (await Data.importModule('resources/meta/artifact/index.js', 'miao')).calc || {}
}) })
let DmgBuffs = { let DmgBuffs = {

View File

@ -9,10 +9,13 @@
"dependencies": { "dependencies": {
"image-size": "^1.0.2" "image-size": "^1.0.2"
}, },
"peerDependencies": {
"image-size": "^1.0.2"
},
"devDependencies": { "devDependencies": {
"cheerio": "1.0.0-rc.12",
"request": "^2.88.2"
},
"imports": {
"#miao": "./components/index.js",
"#miao.models": "./models/index.js"
}, },
"pnpm": { "pnpm": {
"patchedDependencies": {} "patchedDependencies": {}

View File

@ -1,11 +1,11 @@
import { Data } from '../../../components/index.js' import { Data } from '#miao'
import lodash from 'lodash' import lodash from 'lodash'
import calc from './calc.js' import calc from './calc.js'
let artiSetMap = {} let artiSetMap = {}
let artiMap = {} let artiMap = {}
let artis = Data.readJSON('resources/meta/artifact/data.json') let artis = Data.readJSON('resources/meta/artifact/data.json', 'miao')
lodash.forEach(artis, (ds) => { lodash.forEach(artis, (ds) => {
let artiSet = { let artiSet = {

View File

@ -1,5 +1,5 @@
import lodash from 'lodash' import lodash from 'lodash'
import { Format } from '../../../components/index.js' import { Format } from '#miao'
export const abbr = { export const abbr = {
炽烈的炎之魔女: '魔女', 炽烈的炎之魔女: '魔女',

View File

@ -2,7 +2,7 @@
"id": 10000081, "id": 10000081,
"name": "卡维", "name": "卡维",
"abbr": "卡维", "abbr": "卡维",
"title": "天穹之", "title": "天穹之",
"star": 4, "star": 4,
"elem": "dendro", "elem": "dendro",
"allegiance": "", "allegiance": "",

View File

@ -20,21 +20,21 @@
"unit": "", "unit": "",
"isSame": false, "isSame": false,
"values": [ "values": [
"80.57%", "76.19%",
"87.13%", "82.39%",
"93.69%", "88.59%",
"103.05%", "97.45%",
"109.61%", "103.65%",
"117.11%", "110.73%",
"127.41%", "120.48%",
"137.72%", "130.22%",
"148.02%", "139.97%",
"159.26%", "150.6%",
"170.51%", "161.23%",
"181.75%", "171.86%",
"192.99%", "182.49%",
"204.23%", "193.12%",
"215.48%" "203.75%"
] ]
}, },
{ {
@ -42,21 +42,21 @@
"unit": "", "unit": "",
"isSame": false, "isSame": false,
"values": [ "values": [
"73.68%", "69.64%",
"79.68%", "75.31%",
"85.67%", "80.98%",
"94.24%", "89.07%",
"100.24%", "94.74%",
"107.09%", "101.22%",
"116.52%", "110.13%",
"125.94%", "119.03%",
"135.36%", "127.94%",
"145.64%", "137.66%",
"155.92%", "147.37%",
"166.21%", "157.09%",
"176.49%", "166.81%",
"186.77%", "176.53%",
"197.05%" "186.24%"
] ]
}, },
{ {
@ -64,21 +64,21 @@
"unit": "", "unit": "",
"isSame": false, "isSame": false,
"values": [ "values": [
"92.39%", "84.26%",
"99.91%", "91.12%",
"107.43%", "97.98%",
"118.17%", "107.78%",
"125.69%", "114.63%",
"134.28%", "122.47%",
"146.1%", "133.25%",
"157.92%", "144.03%",
"169.74%", "154.81%",
"182.63%", "166.56%",
"195.52%", "178.32%",
"208.41%", "190.08%",
"221.3%", "201.83%",
"234.19%", "213.59%",
"247.08%" "225.35%"
] ]
}, },
{ {
@ -86,21 +86,21 @@
"unit": "", "unit": "",
"isSame": false, "isSame": false,
"values": [ "values": [
"110.77%", "102.69%",
"119.78%", "111.05%",
"128.8%", "119.4%",
"141.68%", "131.35%",
"150.69%", "139.7%",
"161%", "149.26%",
"175.17%", "162.39%",
"189.33%", "175.53%",
"203.5%", "188.66%",
"218.96%", "202.99%",
"234.41%", "217.32%",
"249.87%", "231.65%",
"265.32%", "245.97%",
"280.78%", "260.3%",
"296.24%" "274.63%"
] ]
}, },
{ {
@ -419,72 +419,72 @@
"talentData": { "talentData": {
"a": { "a": {
"一段伤害": [ "一段伤害": [
80.57, 76.19,
87.13, 82.39,
93.69, 88.59,
103.05, 97.45,
109.61, 103.65,
117.11, 110.73,
127.41, 120.48,
137.72, 130.22,
148.02, 139.97,
159.26, 150.6,
170.51, 161.23,
181.75, 171.86,
192.99, 182.49,
204.23, 193.12,
215.48 203.75
], ],
"二段伤害": [ "二段伤害": [
73.68, 69.64,
79.68, 75.31,
85.67, 80.98,
94.24, 89.07,
100.24, 94.74,
107.09, 101.22,
116.52, 110.13,
125.94, 119.03,
135.36, 127.94,
145.64, 137.66,
155.92, 147.37,
166.21, 157.09,
176.49, 166.81,
186.77, 176.53,
197.05 186.24
], ],
"三段伤害": [ "三段伤害": [
92.39, 84.26,
99.91, 91.12,
107.43, 97.98,
118.17, 107.78,
125.69, 114.63,
134.28, 122.47,
146.1, 133.25,
157.92, 144.03,
169.74, 154.81,
182.63, 166.56,
195.52, 178.32,
208.41, 190.08,
221.3, 201.83,
234.19, 213.59,
247.08 225.35
], ],
"四段伤害": [ "四段伤害": [
110.77, 102.69,
119.78, 111.05,
128.8, 119.4,
141.68, 131.35,
150.69, 139.7,
161, 149.26,
175.17, 162.39,
189.33, 175.53,
203.5, 188.66,
218.96, 202.99,
234.41, 217.32,
249.87, 231.65,
265.32, 245.97,
280.78, 260.3,
296.24 274.63
], ],
"重击循环伤害": [ "重击循环伤害": [
53.15, 53.15,
@ -754,7 +754,7 @@
"6": { "6": {
"name": "天园的理想", "name": "天园的理想",
"desc": [ "desc": [
"在繁绘隅穹持续期间,卡维的普通攻击、重击与下落攻击命中敌人时,将在敌人的位置释放天圆之光造成卡维攻击力61.8%的草元素范围伤害并使影响范围内的所有草原核迸发。该效果每3秒最多触发一次。" "在繁绘隅穹持续期间,卡维的普通攻击、重击或下落攻击命中敌人时,将在敌人的位置释放天园之光造成卡维攻击力61.8%的草元素范围伤害并使影响范围内的所有草原核迸发。该效果每3秒最多触发一次。"
] ]
} }
}, },
@ -762,7 +762,7 @@
{ {
"name": "预算师的技艺", "name": "预算师的技艺",
"desc": [ "desc": [
"制作景观/建筑/庭院类摆设时有100%概率返还部分材料。" "制作景观、建筑、庭院类摆设时有100%概率返还部分材料。"
] ]
}, },
{ {
@ -774,7 +774,7 @@
{ {
"name": "工艺家的奇想", "name": "工艺家的奇想",
"desc": [ "desc": [
"在繁绘隅穹持续期间,卡维在普通攻击、重击下落攻击命中敌人后元素精通将提升25点。该效果每0.1秒至多触发一次至多叠加4层。", "在繁绘隅穹持续期间,卡维在普通攻击、重击下落攻击命中敌人后元素精通将提升25点。该效果每0.1秒至多触发一次至多叠加4层。",
"在繁绘隅穹效果结束时,该效果将被移除。" "在繁绘隅穹效果结束时,该效果将被移除。"
] ]
} }

View File

@ -274,7 +274,7 @@
"name": "愈气全形论", "name": "愈气全形论",
"desc": [ "desc": [
"进入脉摄宣明状态,产生无郤气护盾。", "进入脉摄宣明状态,产生无郤气护盾。",
"在脉摄宣明状态下每2秒将产生新的无郤气护盾。", "在脉摄宣明状态下每2.5秒将产生新的无郤气护盾。",
"无郤气护盾在以下情况下,将会为当前场上自己的角色恢复生命值,回复量受益于白术的生命值上限,并释放灵气脉攻击敌人,造成草元素伤害:", "无郤气护盾在以下情况下,将会为当前场上自己的角色恢复生命值,回复量受益于白术的生命值上限,并释放灵气脉攻击敌人,造成草元素伤害:",
"·当角色处于无郤气护盾的庇护下时,并产生新的无郤气护盾;", "·当角色处于无郤气护盾的庇护下时,并产生新的无郤气护盾;",
"·无郤气护盾的效果结束,或因伤害破碎。", "·无郤气护盾的效果结束,或因伤害破碎。",
@ -1016,7 +1016,7 @@
"name": "动静精明", "name": "动静精明",
"desc": [ "desc": [
"队伍中自己的当前场上角色在攻击命中附近的敌人时,白术将释放游丝徵灵·切。", "队伍中自己的当前场上角色在攻击命中附近的敌人时,白术将释放游丝徵灵·切。",
"游丝徵灵·切能够进行1次攻击造成300%草元素伤害与太素诊要的游丝徵灵20%回复量。", "游丝徵灵·切将在进行至多1次攻击后返回造成白术攻击力300%的草元素伤害与太素诊要游丝徵灵的20%回复量。",
"通过这种方式造成的伤害视为元素战技伤害。", "通过这种方式造成的伤害视为元素战技伤害。",
"每6秒至多触发一次。" "每6秒至多触发一次。"
] ]
@ -1065,7 +1065,7 @@
{ {
"name": "在地为化", "name": "在地为化",
"desc": [ "desc": [
"受到愈气全形论治疗的角色将获得「木运之岁」效果基于白术生命值上限不超过50000点的部分每1000点将使该角色触发的燃烧、绽放、超绽放、烈绽放反应造成的伤害提升2%超激化、蔓激化反应带来的伤害提升0.8%持续6秒。" "受到无郤气护盾治疗的角色将获得「木运之岁」效果基于白术生命值上限不超过50000点的部分每1000点将使该角色触发的燃烧、绽放、超绽放、烈绽放反应造成的伤害提升2%超激化、蔓激化反应带来的伤害提升0.8%持续6秒。"
] ]
} }
], ],

View File

@ -40,5 +40,5 @@
"talent": "「诗文」的哲学", "talent": "「诗文」的哲学",
"weekly": "无心的渊镜" "weekly": "无心的渊镜"
}, },
"eta": 1677636000000 "eta": 1679364000000
} }

View File

@ -4,15 +4,15 @@ export * from './pool.js'
export const chestInfo = { export const chestInfo = {
common: { common: {
title: '普通宝箱', title: '普通宝箱',
max: 2542 max: 2547
}, },
exquisite: { exquisite: {
title: '精致宝箱', title: '精致宝箱',
max: 1594 max: 1596
}, },
precious: { precious: {
title: '珍贵宝箱', title: '珍贵宝箱',
max: 488 max: 489
}, },
luxurious: { luxurious: {
title: '豪华宝箱', title: '豪华宝箱',

View File

@ -1,4 +1,4 @@
import { Data } from '../../../components/index.js' import { Data } from '#miao'
import lodash from 'lodash' import lodash from 'lodash'
import { weaponType, abbr, alias, weaponSet } from './meta.js' import { weaponType, abbr, alias, weaponSet } from './meta.js'
@ -28,12 +28,12 @@ const attr = function (key, start, _step) {
for (let type in weaponType) { for (let type in weaponType) {
// calc // calc
let typeCalc = await Data.importDefault(`resources/meta/weapon/${type}/calc.js`) let typeCalc = await Data.importDefault(`resources/meta/weapon/${type}/calc.js`, 'miao')
let typeRet = typeCalc(step, attr) let typeRet = typeCalc(step, attr)
calc = lodash.extend(calc, typeRet) calc = lodash.extend(calc, typeRet)
// data // data
let typeData = await Data.readJSON(`resources/meta/weapon/${type}/data.json`) let typeData = await Data.readJSON(`resources/meta/weapon/${type}/data.json`,'miao')
lodash.forEach(typeData, (ds) => { lodash.forEach(typeData, (ds) => {
data[ds.name] = { data[ds.name] = {
id: ds.id, id: ds.id,

View File

@ -4,7 +4,7 @@ import lodash from 'lodash'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import ImgDownloader from './sprider/ImgDown.js' import ImgDownloader from './sprider/ImgDown.js'
import CharData from './sprider/CharDataAmber.js' import CharData from './sprider/CharDataAmber.js'
import { Data } from '../components/index.js' import { Data } from '#miao'
import tId from './sprider/TalentId.js' import tId from './sprider/TalentId.js'
import testData from './test.js' import testData from './test.js'
@ -49,16 +49,16 @@ let getCharData = async function (id, key, name = '', _id = id) {
function checkName (name) { function checkName (name) {
let charPath = `resources/meta/character/${name}/` let charPath = `resources/meta/character/${name}/`
Data.createDir(charPath) Data.createDir(charPath, 'miao')
if (name === '旅行者') { if (name === '旅行者') {
for (let idx in tElems) { for (let idx in tElems) {
Data.createDir(`${charPath}${tElems[idx]}/icons`) Data.createDir(`${charPath}${tElems[idx]}/icons`, 'miao')
} }
} else { } else {
Data.createDir(`${charPath}/icons`) Data.createDir(`${charPath}/icons`, 'miao')
} }
Data.createDir(`${charPath}/imgs`) Data.createDir(`${charPath}/imgs`, 'miao')
let data = Data.readJSON(`${charPath}/data.json`) let data = Data.readJSON(`${charPath}/data.json`, 'miao')
return data.ver * 1 > 1 return data.ver * 1 > 1
} }
@ -72,7 +72,7 @@ async function saveCharData (id) {
return return
} }
Data.createDir(`resources/meta/character/${name}/`) Data.createDir(`resources/meta/character/${name}/`, 'miao')
let charPath = `${_path}/plugins/miao-plugin/resources/meta/character/${name}/` let charPath = `${_path}/plugins/miao-plugin/resources/meta/character/${name}/`
fs.writeFileSync(`${charPath}data.json`, JSON.stringify(data, '', 2)) fs.writeFileSync(`${charPath}data.json`, JSON.stringify(data, '', 2))

View File

@ -1,7 +1,7 @@
import fs from 'fs' import fs from 'fs'
import cheerio from 'cheerio' import cheerio from 'cheerio'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import { Data } from '../components/index.js' import { Data } from '#miao'
import lodash from 'lodash' import lodash from 'lodash'
import request from 'request' import request from 'request'
import HttpsProxyAgent from 'https-proxy-agent' import HttpsProxyAgent from 'https-proxy-agent'
@ -96,7 +96,7 @@ async function down (sets = '') {
} }
ds.sets = await getSets(ds.id) ds.sets = await getSets(ds.id)
console.log(`arti ${ds.id}:${ds.name} Done`) console.log(`arti ${ds.id}:${ds.name} Done`)
Data.createDir(`resources/meta/artifact/imgs/${ds.name}`) Data.createDir(`resources/meta/artifact/imgs/${ds.name}`, 'miao')
lodash.forEach(ds.sets, (s, idx) => { lodash.forEach(ds.sets, (s, idx) => {
imgs.push({ imgs.push({
@ -105,8 +105,8 @@ async function down (sets = '') {
}) })
}) })
} }
Data.createDir('resources/meta/artifact') Data.createDir('resources/meta/artifact', 'miao')
Data.writeJSON('resources/meta/artifact/data.json', ret) Data.writeJSON('resources/meta/artifact/data.json', ret, 'miao')
const _path = process.cwd() const _path = process.cwd()
const _root = _path + '/plugins/miao-plugin/' const _root = _path + '/plugins/miao-plugin/'

View File

@ -3,13 +3,13 @@ import lodash from 'lodash'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import ImgDownloader from './sprider/ImgDown.js' import ImgDownloader from './sprider/ImgDown.js'
import CharData from './sprider/CharData.js' import CharData from './sprider/CharData.js'
import { Data } from '../components/index.js' import { Data } from '#miao'
import HttpsProxyAgent from 'https-proxy-agent' import HttpsProxyAgent from 'https-proxy-agent'
let agent = new HttpsProxyAgent('http://localhost:4780') let agent = new HttpsProxyAgent('http://localhost:4780')
let mData = Data.readJSON('/resources/meta/material/data.json') let mData = Data.readJSON('/resources/meta/material/data.json', 'miao')
let tId = Data.readJSON('/tools/meta/talent.json') let tId = Data.readJSON('/tools/meta/talent.json', 'miao')
const tElems = ['anemo', 'geo', 'electro', 'dendro'] const tElems = ['anemo', 'geo', 'electro', 'dendro']
@ -135,16 +135,16 @@ let getCharData = async function (id, key, name = '', _id = id) {
function checkName (name) { function checkName (name) {
let charPath = `resources/meta/character/${name}/` let charPath = `resources/meta/character/${name}/`
Data.createDir(charPath) Data.createDir(charPath, 'miao')
if (name === '旅行者') { if (name === '旅行者') {
for (let idx in tElems) { for (let idx in tElems) {
Data.createDir(`${charPath}${tElems[idx]}/icons`) Data.createDir(`${charPath}${tElems[idx]}/icons`, 'miao')
} }
} else { } else {
Data.createDir(`${charPath}/icons`) Data.createDir(`${charPath}/icons`, 'miao')
} }
Data.createDir(`${charPath}/imgs`) Data.createDir(`${charPath}/imgs`, 'miao')
let data = Data.readJSON(`${charPath}/data.json`) let data = Data.readJSON(`${charPath}/data.json`, 'miao')
return data.ver * 1 > 1 return data.ver * 1 > 1
} }
@ -169,16 +169,13 @@ async function saveCharData (id, key, name = '', force = false, _id = id) {
data.eta = new Date(`${eta[name]} 10:00:00`) * 1 data.eta = new Date(`${eta[name]} 10:00:00`) * 1
} }
let charPath = `/resources/meta/character/${name}/` let charPath = `/resources/meta/character/${name}/`
// fs.writeFileSync(`${charPath}data.json`, JSON.stringify(data, '', 2).replaceAll('\n', '\r\n')) Data.writeJSON({ path: charPath, name: 'data.json', data, rn: true, root: 'miao' })
Data.writeJSON({ path: charPath, name: 'data.json', data, rn: true })
if (details.length === 1) { if (details.length === 1) {
// fs.writeFileSync(`${charPath}detail.json`, JSON.stringify(details[0], '', 2).replaceAll('\n', '\r\n')) Data.writeJSON({ path: charPath, name: 'detail.json', data: details[0], rn: true, root: 'miao' })
Data.writeJSON({ path: charPath, name: 'detail.json', data: details[0], rn: true })
} else if (data.id === 20000000) { } else if (data.id === 20000000) {
for (let idx in details) { for (let idx in details) {
let detail = details[idx] let detail = details[idx]
// fs.writeFileSync(`${charPath}/${detail.elem}/detail.json`, JSON.stringify(detail, '', 2).replaceAll('\n', '\r\n')) Data.writeJSON({ path: `${charPath}/${detail.elem}`, name: 'detail.json', data: detail, rn: true, root: 'miao' })
Data.writeJSON({ path: `${charPath}/${detail.elem}`, name: 'detail.json', data: detail, rn: true })
} }
} }
@ -206,7 +203,7 @@ async function down (name = '', force = false) {
} }
await saveCharData(ds.id || id, ds.key, ds.name, force, id) await saveCharData(ds.id || id, ds.key, ds.name, force, id)
} }
Data.writeJSON({ name: '/resources/meta/material/data.json', data: mData, rn: true }) Data.writeJSON({ name: '/resources/meta/material/data.json', data: mData, rn: true, root: 'miao' })
} }
const charData = { const charData = {
@ -289,8 +286,8 @@ let eta = {
瑶瑶: '2023-01-18', 瑶瑶: '2023-01-18',
艾尔海森: '2023-01-18', 艾尔海森: '2023-01-18',
迪希雅: '2023-03-01', 迪希雅: '2023-03-01',
米卡: '2023-03-01', 米卡: '2023-03-21',
卡维: '2023-04-12', 卡维: '2023-04-12',
白术: '2023-04-12' 白术: '2023-04-12'
} }
await down('卡维,白术', true) await down('米卡,卡维,白术', true)

View File

@ -1,6 +1,6 @@
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
import { Data } from '../components/index.js' import { Data } from '#miao'
import { ProfileDmg } from '../models/index.js' import { ProfileDmg } from '#miao.models'
export async function calcDmg (inputData, enemyLv = 86) { export async function calcDmg (inputData, enemyLv = 86) {
let dmg = new ProfileDmg(inputData) let dmg = new ProfileDmg(inputData)

View File

@ -1,6 +1,6 @@
import abbr from './abbr.js' import abbr from './abbr.js'
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../../components/index.js' import { Data } from '#miao'
let costumes = { let costumes = {
: [200301], // 琴 : [200301], // 琴

View File

@ -1,6 +1,6 @@
import fs from 'fs' import fs from 'fs'
import request from 'request' import request from 'request'
import { Data } from '../../components/index.js' import { Data } from '#miao'
import HttpsProxyAgent from 'https-proxy-agent' import HttpsProxyAgent from 'https-proxy-agent'
let agent = new HttpsProxyAgent('http://localhost:4780') let agent = new HttpsProxyAgent('http://localhost:4780')

View File

@ -1,7 +1,7 @@
import fetch from 'node-fetch' import fetch from 'node-fetch'
import cheerio from 'cheerio' import cheerio from 'cheerio'
import lodash from 'lodash' import lodash from 'lodash'
import { Data } from '../components/index.js' import { Data } from '#miao'
import fs from 'fs' import fs from 'fs'
import request from 'request' import request from 'request'
import WeaponData from './sprider/WeaponData.js' import WeaponData from './sprider/WeaponData.js'
@ -10,11 +10,11 @@ import ImgDownloader from './sprider/ImgDown.js'
let ret = {} let ret = {}
const types = ['sword', 'claymore', 'polearm', 'bow', 'catalyst'] const types = ['sword', 'claymore', 'polearm', 'bow', 'catalyst']
for (let type of types) { for (let type of types) {
ret[type] = Data.readJSON(`resources/meta/weapon/${type}/data.json`) ret[type] = Data.readJSON(`resources/meta/weapon/${type}/data.json`, 'miao')
} }
let mData = Data.readJSON('resources/meta/material/data.json') let mData = Data.readJSON('resources/meta/material/data.json', 'miao')
let weaponIdMap = Data.readJSON('tools/meta/weapon.json') let weaponIdMap = Data.readJSON('tools/meta/weapon.json', 'miao')
let getWeaponTypeData = async function (type) { let getWeaponTypeData = async function (type) {
let url = `https://genshin.honeyhunterworld.com/fam_${type}/?lang=CHS` let url = `https://genshin.honeyhunterworld.com/fam_${type}/?lang=CHS`
@ -91,8 +91,8 @@ async function down (t, n) {
continue continue
} }
await getWeaponTypeData(type) await getWeaponTypeData(type)
Data.createDir(`resources/meta/weapon/${type}`) Data.createDir(`resources/meta/weapon/${type}`, 'miao')
Data.writeJSON({ name: `resources/meta/weapon/${type}/data.json`, data: ret[type], rn: true }) Data.writeJSON({ name: `resources/meta/weapon/${type}/data.json`, data: ret[type], rn: true, root: 'miao' })
let imgs = [] let imgs = []
await Data.asyncPool(6, lodash.keys(ret[type]), async (name) => { await Data.asyncPool(6, lodash.keys(ret[type]), async (name) => {
@ -100,9 +100,9 @@ async function down (t, n) {
return return
} }
let ds = ret[type][name] let ds = ret[type][name]
Data.createDir(`resources/meta/weapon/${type}/${ds.name}`) Data.createDir(`resources/meta/weapon/${type}/${ds.name}`, 'miao')
let data = await getWeaponData(type, ds) let data = await getWeaponData(type, ds)
Data.writeJSON({ name: `resources/meta/weapon/${type}/${ds.name}/data.json`, data, rn: true }) Data.writeJSON({ name: `resources/meta/weapon/${type}/${ds.name}/data.json`, data, rn: true, root: 'miao' })
lodash.forEach({ lodash.forEach({
icon: '', icon: '',
awaken: '_awaken_icon', awaken: '_awaken_icon',
@ -141,7 +141,7 @@ async function down (t, n) {
} }
}) })
} }
Data.writeJSON({ name: 'resources/meta/material/data.json', data: mData, rn: true }) Data.writeJSON({ name: 'resources/meta/material/data.json', data: mData, rn: true, root: 'miao' })
} }
// 'sword', 'claymore', 'polearm', 'bow', 'catalyst' // 'sword', 'claymore', 'polearm', 'bow', 'catalyst'