From 29e1c446a748ce498264fa062f3f8f520eff80bc Mon Sep 17 00:00:00 2001 From: Kokomi <102026640+yoimiya-kokomi@users.noreply.github.com> Date: Wed, 8 Mar 2023 01:52:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=83=A8=E5=88=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E7=9A=84=E5=BC=95=E7=94=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +- apps/admin.js | 2 +- apps/character.js | 2 +- apps/character/AvatarCard.js | 4 +- apps/character/AvatarWife.js | 4 +- apps/character/ImgUpload.js | 4 +- apps/gacha.js | 2 +- apps/gacha/Gacha.js | 4 +- apps/gacha/GachaData.js | 4 +- apps/help.js | 2 +- apps/help/Help.js | 2 +- apps/help/HelpTheme.js | 4 +- apps/poke.js | 2 +- apps/profile.js | 2 +- apps/profile/ProfileArtis.js | 4 +- apps/profile/ProfileChange.js | 4 +- apps/profile/ProfileCommon.js | 4 +- apps/profile/ProfileDetail.js | 4 +- apps/profile/ProfileList.js | 4 +- apps/profile/ProfileRank.js | 6 +- apps/profile/ProfileStat.js | 4 +- apps/profile/ProfileUtils.js | 4 +- apps/stat.js | 2 +- apps/stat/AbyssStat.js | 4 +- apps/stat/AbyssSummary.js | 6 +- apps/stat/AbyssTeam.js | 6 +- apps/stat/HutaoApi.js | 2 +- apps/wiki/Calendar.js | 7 +- apps/wiki/CharMaterial.js | 2 +- apps/wiki/CharTalent.js | 2 +- apps/wiki/CharWiki.js | 6 +- apps/wiki/CharWikiData.js | 4 +- components/Data.js | 16 +- components/Format.js | 2 +- components/cfg/CfgData.js | 2 +- index.js | 2 +- models/Abyss.js | 2 +- models/Artifact.js | 2 +- models/AvatarArtis.js | 2 +- models/AvatarData.js | 2 +- models/Base.js | 2 +- models/Character.js | 8 +- models/Material.js | 6 +- models/MysApi.js | 2 +- models/Player.js | 4 +- models/ProfileArtis.js | 2 +- models/ProfileData.js | 2 +- models/ProfileDmg.js | 2 +- models/ProfileRank.js | 2 +- models/ProfileServ.js | 2 +- models/Weapon.js | 4 +- models/character/CharCfg.js | 4 +- models/character/CharId.js | 2 +- models/character/CharMeta.js | 2 +- models/material/MaterialMeta.js | 2 +- models/player/EnkaApi.js | 2 +- models/player/MggApi.js | 2 +- models/player/MiaoApi.js | 2 +- models/player/MysAvatar.js | 5 +- models/player/Profile.js | 2 +- models/profile/ArtisMark.js | 2 +- models/profile/AttrCalc.js | 2 +- models/profile/DmgAttr.js | 2 +- models/profile/DmgBuffs.js | 6 +- package.json | 9 +- resources/meta/artifact/index.js | 4 +- resources/meta/artifact/meta.js | 2 +- resources/meta/character/卡维/data.json | 2 +- resources/meta/character/卡维/detail.json | 246 ++++++++++---------- resources/meta/character/白术/detail.json | 6 +- resources/meta/character/米卡/data.json | 2 +- resources/meta/info/index.js | 6 +- resources/meta/weapon/index.js | 6 +- tools/ambr.js | 14 +- tools/artis-data.js | 8 +- tools/char-data.js | 31 ++- tools/dmg-calc-tool.js | 4 +- tools/sprider/CharDataAmber.js | 2 +- tools/sprider/ImgDown.js | 2 +- tools/weapon-data.js | 18 +- 80 files changed, 295 insertions(+), 287 deletions(-) diff --git a/README.md b/README.md index 266dd187..4b6c7af3 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,11 @@ Miao-Plugin 是一个 Yunzai-Bot 的升级插件,提供包括角色查询等 ``` // 使用gitee git clone https://gitee.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/ -pnpm add image-size -w +pnpm install -P // 使用github git clone https://github.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/ -pnpm add image-size -w +pnpm install -P ``` 进行安装。安装完毕后,管理员只需发送 `#喵喵更新` 即可自动更新 miao-plugin。 @@ -37,7 +37,7 @@ pnpm add image-size -w 推荐直接使用 V3-Yunzai 搭配 miao-plugin 使用。(不能做V2钉子户——喵佬) [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 diff --git a/apps/admin.js b/apps/admin.js index c0379406..6afaca92 100644 --- a/apps/admin.js +++ b/apps/admin.js @@ -1,7 +1,7 @@ import fs from 'fs' import lodash from 'lodash' 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 app = App.init({ diff --git a/apps/character.js b/apps/character.js index 65e87e91..88a38a9d 100644 --- a/apps/character.js +++ b/apps/character.js @@ -1,8 +1,8 @@ -import { App } from '../components/index.js' import { uploadCharacterImg } from './character/ImgUpload.js' import { getOriginalPicture } from './profile/ProfileUtils.js' import Avatar from './character/AvatarCard.js' import Wife from './character/AvatarWife.js' +import { App } from '#miao' let app = App.init({ id: 'character', diff --git a/apps/character/AvatarCard.js b/apps/character/AvatarCard.js index 6fe2d0e7..27254675 100644 --- a/apps/character/AvatarCard.js +++ b/apps/character/AvatarCard.js @@ -1,5 +1,5 @@ -import { Character, MysApi, Player } from '../../models/index.js' -import { Cfg, Common } from '../../components/index.js' +import { Character, MysApi, Player } from '#miao.models' +import { Cfg, Common } from '#miao' import lodash from 'lodash' import { segment } from 'oicq' import moment from 'moment' diff --git a/apps/character/AvatarWife.js b/apps/character/AvatarWife.js index ec8900cb..8e39207b 100644 --- a/apps/character/AvatarWife.js +++ b/apps/character/AvatarWife.js @@ -1,7 +1,7 @@ // #老婆 import lodash from 'lodash' -import { Common } from '../../components/index.js' -import { Character, MysApi, Player } from '../../models/index.js' +import { Common } from '#miao' +import { Character, MysApi, Player } from '#miao.models' import Avatar from './AvatarCard.js' const relationMap = { diff --git a/apps/character/ImgUpload.js b/apps/character/ImgUpload.js index f883dd03..091ba1e1 100644 --- a/apps/character/ImgUpload.js +++ b/apps/character/ImgUpload.js @@ -5,8 +5,8 @@ import { segment } from 'oicq' import MD5 from 'md5' import fetch from 'node-fetch' import lodash from 'lodash' -import { Cfg, Data } from '../../components/index.js' -import { Character } from '../../models/index.js' +import { Cfg, Data } from '#miao' +import { Character } from '#miao.models' const resPath = process.cwd() + '/plugins/miao-plugin/resources/' let regex = /^#?\s*(?:喵喵)?(?:上传|添加)(.+)(?:照片|写真|图片|图像)\s*$/ diff --git a/apps/gacha.js b/apps/gacha.js index eca38694..7ae93ddc 100644 --- a/apps/gacha.js +++ b/apps/gacha.js @@ -1,5 +1,5 @@ -import { App, Cfg } from '../components/index.js' import Gacha from './gacha/Gacha.js' +import { App, Cfg } from '#miao' let app = App.init({ id: 'gacha', diff --git a/apps/gacha/Gacha.js b/apps/gacha/Gacha.js index 5bcb3873..d4b7f2b7 100644 --- a/apps/gacha/Gacha.js +++ b/apps/gacha/Gacha.js @@ -1,7 +1,7 @@ -import { Common } from '../../components/index.js' +import { Common } from '#miao' import { getTargetUid } from '../profile/ProfileCommon.js' import GachaData from './GachaData.js' -import { Character, Player } from '../../models/index.js' +import { Character, Player } from '#miao.models' let Gacha = { async detail (e) { diff --git a/apps/gacha/GachaData.js b/apps/gacha/GachaData.js index c392bc0b..791f13b1 100644 --- a/apps/gacha/GachaData.js +++ b/apps/gacha/GachaData.js @@ -1,6 +1,6 @@ import lodash from 'lodash' -import { Data } from '../../components/index.js' -import { Character, Weapon } from '../../models/index.js' +import { Data } from '#miao' +import { Character, Weapon } from '#miao.models' import { poolDetail } from '../../resources/meta/info/index.js' import moment from 'moment' diff --git a/apps/help.js b/apps/help.js index f0c4bd07..7531d6ea 100644 --- a/apps/help.js +++ b/apps/help.js @@ -1,5 +1,5 @@ -import { App } from '../components/index.js' import Help from './help/Help.js' +import { App } from '#miao' let app = App.init({ id: 'help', diff --git a/apps/help/Help.js b/apps/help/Help.js index 581d4416..93e04e02 100644 --- a/apps/help/Help.js +++ b/apps/help/Help.js @@ -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 lodash from 'lodash' import HelpTheme from './HelpTheme.js' diff --git a/apps/help/HelpTheme.js b/apps/help/HelpTheme.js index 7d36a5ec..16043481 100644 --- a/apps/help/HelpTheme.js +++ b/apps/help/HelpTheme.js @@ -1,6 +1,6 @@ import lodash from 'lodash' import fs from 'fs' -import { Data } from '../../components/index.js' +import { Data } from '#miao' let HelpTheme = { async getThemeCfg (theme, exclude) { @@ -29,7 +29,7 @@ let HelpTheme = { return { main: `${resPath}${name}/main.png`, 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) { diff --git a/apps/poke.js b/apps/poke.js index 898d55ec..c0ff13f4 100644 --- a/apps/poke.js +++ b/apps/poke.js @@ -1,5 +1,5 @@ -import { App } from '../components/index.js' import Wife from './character/AvatarWife.js' +import { App } from '#miao' let app = App.init({ id: 'poke', diff --git a/apps/profile.js b/apps/profile.js index 85f0c361..b8ae227b 100644 --- a/apps/profile.js +++ b/apps/profile.js @@ -1,4 +1,3 @@ -import { App, Cfg } from '../components/index.js' import { profileHelp } from './profile/ProfileCommon.js' import { profileArtisList } from './profile/ProfileArtis.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 { enemyLv } from './profile/ProfileUtils.js' import { groupRank, resetRank, refreshRank, manageRank } from './profile/ProfileRank.js' +import { App, Cfg } from '#miao' let app = App.init({ id: 'profile', diff --git a/apps/profile/ProfileArtis.js b/apps/profile/ProfileArtis.js index 3bb9308c..bc71e5ad 100644 --- a/apps/profile/ProfileArtis.js +++ b/apps/profile/ProfileArtis.js @@ -3,9 +3,9 @@ * * */ import lodash from 'lodash' -import { Cfg, Common } from '../../components/index.js' +import { Cfg, Common } from '#miao' import { getTargetUid, profileHelp, getProfileRefresh } from './ProfileCommon.js' -import { Artifact, Character, ProfileArtis, Player } from '../../models/index.js' +import { Artifact, Character, ProfileArtis, Player } from '#miao.models' /* * 角色圣遗物面板 diff --git a/apps/profile/ProfileChange.js b/apps/profile/ProfileChange.js index 7facb7a4..b8da18f4 100644 --- a/apps/profile/ProfileChange.js +++ b/apps/profile/ProfileChange.js @@ -2,8 +2,8 @@ * 面板数据替换相关逻辑 */ import lodash from 'lodash' -import { Data } from '../../components/index.js' -import { Character, ProfileData, Weapon, Player } from '../../models/index.js' +import { Data } from '#miao' +import { Character, ProfileData, Weapon, Player } from '#miao.models' const keyMap = { artis: '圣遗物', diff --git a/apps/profile/ProfileCommon.js b/apps/profile/ProfileCommon.js index ae03bf4e..21e3b72c 100644 --- a/apps/profile/ProfileCommon.js +++ b/apps/profile/ProfileCommon.js @@ -2,8 +2,8 @@ * 面板公共方法及处理 * */ import { segment } from 'oicq' -import { Version } from '../../components/index.js' -import { Character, MysApi, Player } from '../../models/index.js' +import { Version } from '#miao' +import { Character, MysApi, Player } from '#miao.models' /* * 获取面板查询的 目标uid diff --git a/apps/profile/ProfileDetail.js b/apps/profile/ProfileDetail.js index 6f7138e3..ba14804a 100644 --- a/apps/profile/ProfileDetail.js +++ b/apps/profile/ProfileDetail.js @@ -1,8 +1,8 @@ import lodash from 'lodash' import { getTargetUid, getProfileRefresh } from './ProfileCommon.js' import ProfileList from './ProfileList.js' -import { Cfg, Common, Format } from '../../components/index.js' -import { MysApi, ProfileRank, ProfileArtis, Character, Weapon } from '../../models/index.js' +import { Cfg, Common, Format } from '#miao' +import { MysApi, ProfileRank, ProfileArtis, Character, Weapon } from '#miao.models' import ProfileChange from './ProfileChange.js' import { profileArtis } from './ProfileArtis.js' diff --git a/apps/profile/ProfileList.js b/apps/profile/ProfileList.js index 98b4c714..e3b6fb09 100644 --- a/apps/profile/ProfileList.js +++ b/apps/profile/ProfileList.js @@ -1,7 +1,7 @@ import lodash from 'lodash' import { getTargetUid } from './ProfileCommon.js' -import { ProfileRank, Player, Character } from '../../models/index.js' -import { Common, Data } from '../../components/index.js' +import { Common, Data } from '#miao' +import { ProfileRank, Player, Character } from '#miao.models' const ProfileList = { /** diff --git a/apps/profile/ProfileRank.js b/apps/profile/ProfileRank.js index b2ffbdd2..53941215 100644 --- a/apps/profile/ProfileRank.js +++ b/apps/profile/ProfileRank.js @@ -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 ProfileDetail from './ProfileDetail.js' +import { Data, Common, Format } from '#miao' +import { Character, ProfileRank, ProfileDmg, Player } from '#miao.models' export async function groupRank (e) { const groupRank = Common.cfg('groupRank') diff --git a/apps/profile/ProfileStat.js b/apps/profile/ProfileStat.js index a47cac1c..f297984b 100644 --- a/apps/profile/ProfileStat.js +++ b/apps/profile/ProfileStat.js @@ -1,5 +1,5 @@ -import { Common } from '../../components/index.js' -import { MysApi, Player, Character } from '../../models/index.js' +import { Common } from '#miao' +import { MysApi, Player, Character } from '#miao.models' const ProfileStat = { async stat (e) { diff --git a/apps/profile/ProfileUtils.js b/apps/profile/ProfileUtils.js index ff0b9877..2546d029 100644 --- a/apps/profile/ProfileUtils.js +++ b/apps/profile/ProfileUtils.js @@ -1,6 +1,6 @@ import { segment } from 'oicq' -import { MysApi } from '../../models/index.js' -import { Cfg } from '../../components/index.js' +import { Cfg } from '#miao' +import { MysApi } from '#miao.models' /** 获取角色卡片的原图 */ export async function getOriginalPicture (e) { diff --git a/apps/stat.js b/apps/stat.js index 324119f7..6909948a 100644 --- a/apps/stat.js +++ b/apps/stat.js @@ -2,10 +2,10 @@ * 胡桃数据库的统计 * * */ -import { App } from '../components/index.js' import { ConsStat, AbyssPct } from './stat/AbyssStat.js' import { AbyssTeam } from './stat/AbyssTeam.js' import { AbyssSummary } from './stat/AbyssSummary.js' +import { App } from '#miao' let app = App.init({ id: 'stat', diff --git a/apps/stat/AbyssStat.js b/apps/stat/AbyssStat.js index 11374c7a..c3222d77 100644 --- a/apps/stat/AbyssStat.js +++ b/apps/stat/AbyssStat.js @@ -1,7 +1,7 @@ import HutaoApi from './HutaoApi.js' import lodash from 'lodash' -import { Character } from '../../models/index.js' -import { Common } from '../../components/index.js' +import { Common } from '#miao' +import { Character } from '#miao.models' export async function ConsStat (e) { let consData = await HutaoApi.getCons() diff --git a/apps/stat/AbyssSummary.js b/apps/stat/AbyssSummary.js index 99ff4023..91d3f113 100644 --- a/apps/stat/AbyssSummary.js +++ b/apps/stat/AbyssSummary.js @@ -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 HutaoApi from './HutaoApi.js' +import { Cfg, Common, Data } from '#miao' +import { Abyss, Character, MysApi, Player } from '#miao.models' export async function AbyssSummary (e) { let isMatch = /^#(喵喵|上传)深渊(数据)?$/.test(e.original_msg || e.msg || '') diff --git a/apps/stat/AbyssTeam.js b/apps/stat/AbyssTeam.js index c025a9e3..ea7a8832 100644 --- a/apps/stat/AbyssTeam.js +++ b/apps/stat/AbyssTeam.js @@ -1,7 +1,7 @@ -import { Character, MysApi, Player } from '../../models/index.js' -import HutaoApi from './HutaoApi.js' 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) { let mys = await MysApi.init(e, 'cookie') diff --git a/apps/stat/HutaoApi.js b/apps/stat/HutaoApi.js index 668d055d..db95db75 100644 --- a/apps/stat/HutaoApi.js +++ b/apps/stat/HutaoApi.js @@ -5,7 +5,7 @@ * */ import fetch from 'node-fetch' -import { Data } from '../../components/index.js' +import { Data } from '#miao' const host = 'http://miaoapi.cn/api/hutao' diff --git a/apps/wiki/Calendar.js b/apps/wiki/Calendar.js index 87e98284..41dc54a2 100644 --- a/apps/wiki/Calendar.js +++ b/apps/wiki/Calendar.js @@ -1,8 +1,9 @@ +import lodash from 'lodash' import fetch from 'node-fetch' import moment from 'moment' -import { Character, Material } from '../../models/index.js' -import { Common, Data, Cfg } from '../../components/index.js' -import lodash from 'lodash' +import { Common, Data, Cfg } from '#miao' +import { Character, Material } from '#miao.models' + const ignoreIds = [495, // 有奖问卷调查开启! 1263, // 米游社《原神》专属工具一览 diff --git a/apps/wiki/CharMaterial.js b/apps/wiki/CharMaterial.js index 1e06ac02..26cccb58 100644 --- a/apps/wiki/CharMaterial.js +++ b/apps/wiki/CharMaterial.js @@ -1,4 +1,4 @@ -import { Common } from '../../components/index.js' +import { Common } from '#miao' const CharMaterial = { async render ({ e, char }) { diff --git a/apps/wiki/CharTalent.js b/apps/wiki/CharTalent.js index 4483672c..4bf4b5fa 100644 --- a/apps/wiki/CharTalent.js +++ b/apps/wiki/CharTalent.js @@ -1,5 +1,5 @@ -import { Common, Format } from '../../components/index.js' import lodash from 'lodash' +import { Common, Format } from '#miao' const CharTalent = { async render (e, mode, char) { diff --git a/apps/wiki/CharWiki.js b/apps/wiki/CharWiki.js index 72563638..6739675f 100644 --- a/apps/wiki/CharWiki.js +++ b/apps/wiki/CharWiki.js @@ -1,10 +1,10 @@ -import { Cfg, Common } from '../../components/index.js' -import { Character } from '../../models/index.js' +import lodash from 'lodash' import { segment } from 'oicq' import CharTalent from './CharTalent.js' -import lodash from 'lodash' import CharWikiData from './CharWikiData.js' import CharMaterial from './CharMaterial.js' +import { Cfg, Common } from '#miao' +import { Character } from '#miao.models' const wikiReg = /^(?:#|喵喵)?(.*)(天赋|技能|命座|命之座|资料|图鉴|照片|写真|图片|图像)$/ diff --git a/apps/wiki/CharWikiData.js b/apps/wiki/CharWikiData.js index a6a35e84..fad1a7e8 100644 --- a/apps/wiki/CharWikiData.js +++ b/apps/wiki/CharWikiData.js @@ -1,7 +1,7 @@ import HutaoApi from '../stat/HutaoApi.js' import lodash from 'lodash' -import { Format } from '../../components/index.js' -import { ArtifactSet, Weapon } from '../../models/index.js' +import { Format } from '#miao' +import { ArtifactSet, Weapon } from '#miao.models' let CharWikiData = { /** diff --git a/components/Data.js b/components/Data.js index c963c08d..67387a15 100644 --- a/components/Data.js +++ b/components/Data.js @@ -3,10 +3,14 @@ import fs from 'fs' const _path = process.cwd() const getRoot = (root = '') => { - if (root === 'root' || root === 'yunzai') { + if (!root) { root = `${_path}/` - } else if (!root) { + } else if (root === 'root' || root === 'yunzai') { + root = `${_path}/` + } else if (root === 'miao') { root = `${_path}/plugins/miao-plugin/` + } else { + root = `${_path}/plugins/${root}/` } return root } @@ -51,7 +55,7 @@ let Data = { /* * 写JSON * */ - writeJSON (cfg, data, space = '\t', root = '') { + writeJSON (cfg, data, root = '', space = 2) { if (arguments.length > 1) { return Data.writeJSON({ name: cfg, @@ -72,6 +76,7 @@ let Data = { } return fs.writeFileSync(`${root}/${name}`, data) }, + delFile (file, root = '') { root = getRoot(root) try { @@ -84,6 +89,7 @@ let Data = { } return false }, + async getCacheJSON (key) { try { let txt = await redis.get(key) @@ -138,8 +144,8 @@ let Data = { }, async importCfg (key) { - let sysCfg = await Data.importModule(`config/system/${key}_system.js`) - let diyCfg = await Data.importModule(`config/${key}.js`) + let sysCfg = await Data.importModule(`config/system/${key}_system.js`, 'miao') + let diyCfg = await Data.importModule(`config/${key}.js`, 'miao') if (diyCfg.isSys) { console.error(`miao-plugin: config/${key}.js无效,已忽略`) console.error(`如需配置请复制config/${key}_default.js为config/${key}.js,请勿复制config/system下的系统文件`) diff --git a/components/Format.js b/components/Format.js index f82bced3..3ebc439d 100644 --- a/components/Format.js +++ b/components/Format.js @@ -1,6 +1,6 @@ import lodash from 'lodash' import Elem from './common/Elem.js' -import { Cfg } from '../components/index.js' +import { Cfg } from '#miao' let Format = { ...Elem, diff --git a/components/cfg/CfgData.js b/components/cfg/CfgData.js index 856732a4..a5dbd2e6 100644 --- a/components/cfg/CfgData.js +++ b/components/cfg/CfgData.js @@ -21,7 +21,7 @@ let cfgData = { }, 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(cfgGroup.cfg, (cfgItem, cfgKey) => { ret[cfgKey] = Data.def(ret[cfgKey], cfgItem.def) diff --git a/index.js b/index.js index ed2235a6..07b23694 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -import { Data, Version } from './components/index.js' +import { Data, Version } from '#miao' import fs from 'fs' export * from './apps/index.js' diff --git a/models/Abyss.js b/models/Abyss.js index a102ca85..8e96731d 100644 --- a/models/Abyss.js +++ b/models/Abyss.js @@ -5,7 +5,7 @@ import lodash from 'lodash' import moment from 'moment' import Base from '../models/Base.js' -import { Data } from '../components/index.js' +import { Data } from '#miao' moment.locale('zh-cn') diff --git a/models/Artifact.js b/models/Artifact.js index d2dfe700..7d9a9fc5 100644 --- a/models/Artifact.js +++ b/models/Artifact.js @@ -2,7 +2,7 @@ * 圣遗物 * */ import Base from './Base.js' -import { Format } from '../components/index.js' +import { Format } from '#miao' import { ArtifactSet } from './index.js' import { artiMap, attrMap, mainIdMap, attrIdMap } from '../resources/meta/artifact/index.js' import lodash from 'lodash' diff --git a/models/AvatarArtis.js b/models/AvatarArtis.js index fc133477..570d9779 100644 --- a/models/AvatarArtis.js +++ b/models/AvatarArtis.js @@ -4,7 +4,7 @@ import lodash from 'lodash' import Base from './Base.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' export default class AvatarArtis extends Base { diff --git a/models/AvatarData.js b/models/AvatarData.js index 3cdbb7c3..4b74ef1b 100644 --- a/models/AvatarData.js +++ b/models/AvatarData.js @@ -2,7 +2,7 @@ import lodash from 'lodash' import Base from './Base.js' import moment from 'moment' 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 Profile from './player/Profile.js' diff --git a/models/Base.js b/models/Base.js index 4e17afb2..1dba13a3 100644 --- a/models/Base.js +++ b/models/Base.js @@ -4,7 +4,7 @@ * 使用Proxy实现meta数据的getter * 对Character等可复用设置实例缓存,提高性能 * */ -import { Data } from '../components/index.js' +import { Data } from '#miao' let cacheMap = {} let reFn = {} diff --git a/models/Character.js b/models/Character.js index 372e14b9..97b155ff 100644 --- a/models/Character.js +++ b/models/Character.js @@ -6,7 +6,7 @@ * */ import lodash from 'lodash' 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 CharTalent from './character/CharTalent.js' import CharId from './character/CharId.js' @@ -16,7 +16,7 @@ import CharCfg from './character/CharCfg.js' let { wifeMap, idSort, idMap } = CharId 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 { @@ -253,9 +253,9 @@ class Character extends Base { try { if (this.isTraveler) { - this._detail = Data.readJSON(`${path}/旅行者/${this.elem}/detail.json`) + this._detail = Data.readJSON(`${path}/旅行者/${this.elem}/detail.json`,'miao') } else { - this._detail = Data.readJSON(`${path}/${this.name}/detail.json`) + this._detail = Data.readJSON(`${path}/${this.name}/detail.json`,'miao') } } catch (e) { console.log(e) diff --git a/models/Material.js b/models/Material.js index f2d1606f..689fccf1 100644 --- a/models/Material.js +++ b/models/Material.js @@ -3,11 +3,11 @@ * */ import lodash from 'lodash' import Base from './Base.js' -import { Data } from '../components/index.js' +import { Data } from '#miao' import MaterialMeta from './material/MaterialMeta.js' -let data = Data.readJSON('resources/meta/material/data.json') -let abbr = await Data.importDefault('resources/meta/material/abbr.js') +let data = Data.readJSON('resources/meta/material/data.json','miao') +let abbr = await Data.importDefault('resources/meta/material/abbr.js', 'miao') let mMap = {} let getItem = (ds) => { mMap[ds.name] = { diff --git a/models/MysApi.js b/models/MysApi.js index c490b2fb..1cbe8c60 100644 --- a/models/MysApi.js +++ b/models/MysApi.js @@ -1,5 +1,5 @@ import { User } from './index.js' -import { Version } from '../components/index.js' +import { Version } from '#miao' export default class MysApi { constructor (e, uid, mysInfo) { diff --git a/models/Player.js b/models/Player.js index adbb0fba..53f9f5bc 100644 --- a/models/Player.js +++ b/models/Player.js @@ -6,7 +6,7 @@ */ import lodash from 'lodash' import Base from './Base.js' -import { Data } from '../components/index.js' +import { Data } from '#miao' import { AvatarData, ProfileRank, Character } from './index.js' import MysAvatar from './player/MysAvatar.js' @@ -104,7 +104,7 @@ export default class Player extends Base { if (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 () { diff --git a/models/ProfileArtis.js b/models/ProfileArtis.js index 90000da9..1fae4a0c 100644 --- a/models/ProfileArtis.js +++ b/models/ProfileArtis.js @@ -4,7 +4,7 @@ import lodash from 'lodash' import AvatarArtis from './AvatarArtis.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 { attrMap } from '../resources/meta/artifact/index.js' import CharArtis from './profile/CharArtis.js' diff --git a/models/ProfileData.js b/models/ProfileData.js index eecb856a..4ebb7478 100644 --- a/models/ProfileData.js +++ b/models/ProfileData.js @@ -1,6 +1,6 @@ import lodash from 'lodash' import AvatarData from './AvatarData.js' -import { Data, Cfg } from '../components/index.js' +import { Data, Cfg } from '#miao' import { ProfileArtis, ProfileDmg } from './index.js' import AttrCalc from './profile/AttrCalc.js' import CharImg from './character/CharImg.js' diff --git a/models/ProfileDmg.js b/models/ProfileDmg.js index 9a88e0ee..b4d1daba 100644 --- a/models/ProfileDmg.js +++ b/models/ProfileDmg.js @@ -6,7 +6,7 @@ import { attrMap } from '../resources/meta/artifact/index.js' import DmgBuffs from './profile/DmgBuffs.js' import DmgAttr from './profile/DmgAttr.js' import DmgCalc from './profile/DmgCalc.js' -import { Common } from '../components/index.js' +import { Common } from '#miao' export default class ProfileDmg extends Base { constructor (profile = {}) { diff --git a/models/ProfileRank.js b/models/ProfileRank.js index 2778eeec..6df0147e 100644 --- a/models/ProfileRank.js +++ b/models/ProfileRank.js @@ -1,6 +1,6 @@ import lodash from 'lodash' import moment from 'moment' -import { Cfg, Common, Data } from '../components/index.js' +import { Cfg, Common, Data } from '#miao' export default class ProfileRank { constructor (data) { diff --git a/models/ProfileServ.js b/models/ProfileServ.js index 98f9bd3e..03f90ad9 100644 --- a/models/ProfileServ.js +++ b/models/ProfileServ.js @@ -1,6 +1,6 @@ import lodash from 'lodash' import Base from './Base.js' -import { Data, Cfg } from '../components/index.js' +import { Data, Cfg } from '#miao' let { sysCfg, diyCfg } = await Data.importCfg('profile') diff --git a/models/Weapon.js b/models/Weapon.js index db73285d..57d1d763 100644 --- a/models/Weapon.js +++ b/models/Weapon.js @@ -1,5 +1,5 @@ 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 lodash from 'lodash' @@ -83,7 +83,7 @@ class Weapon extends Base { } const path = 'resources/meta/weapon' 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) { console.log(e) } diff --git a/models/character/CharCfg.js b/models/character/CharCfg.js index 1800312a..aea51976 100644 --- a/models/character/CharCfg.js +++ b/models/character/CharCfg.js @@ -1,4 +1,4 @@ -import { Data } from '../../components/index.js' +import { Data } from '#miao' import lodash from 'lodash' import fs from 'fs' @@ -28,7 +28,7 @@ let cfgMap = { return fs.existsSync(`${charPath}/${char}/${file}.js`) }, 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) { return cfg[module] } diff --git a/models/character/CharId.js b/models/character/CharId.js index 875d406d..fcc4d898 100644 --- a/models/character/CharId.js +++ b/models/character/CharId.js @@ -2,7 +2,7 @@ * 角色别名及角色ID相关 * */ import lodash from 'lodash' -import { Data, Format } from '../../components/index.js' +import { Data, Format } from '#miao' import { charPosIdx } from './CharMeta.js' // 别名表 diff --git a/models/character/CharMeta.js b/models/character/CharMeta.js index 0781f75c..5d13c1b9 100644 --- a/models/character/CharMeta.js +++ b/models/character/CharMeta.js @@ -3,7 +3,7 @@ * */ import lodash from 'lodash' import { Material } from '../index.js' -import { Format } from '../../components/index.js' +import { Format } from '#miao' // 角色排序 export const charPosIdx = { diff --git a/models/material/MaterialMeta.js b/models/material/MaterialMeta.js index 42af1fe5..2aed5dc1 100644 --- a/models/material/MaterialMeta.js +++ b/models/material/MaterialMeta.js @@ -1,5 +1,5 @@ import lodash from 'lodash' -import { Data } from '../../components/index.js' +import { Data } from '#miao' const talentMeta = { 自由: { week: 1, city: '蒙德', cid: 1 }, diff --git a/models/player/EnkaApi.js b/models/player/EnkaApi.js index d5c61181..52f37b4e 100644 --- a/models/player/EnkaApi.js +++ b/models/player/EnkaApi.js @@ -1,6 +1,6 @@ import lodash from 'lodash' -import { Data } from '../../components/index.js' import EnkaData from './EnkaData.js' +import { Data } from '#miao' let HttpsProxyAgent = '' diff --git a/models/player/MggApi.js b/models/player/MggApi.js index 410a4069..a0688a81 100644 --- a/models/player/MggApi.js +++ b/models/player/MggApi.js @@ -1,6 +1,6 @@ import lodash from 'lodash' -import { Data } from '../../components/index.js' import EnkaData from './EnkaData.js' +import { Data } from '#miao' export default { id: 'mgg', diff --git a/models/player/MiaoApi.js b/models/player/MiaoApi.js index de03f2ff..2187002c 100644 --- a/models/player/MiaoApi.js +++ b/models/player/MiaoApi.js @@ -1,6 +1,6 @@ import lodash from 'lodash' -import { Data } from '../../components/index.js' import MiaoData from './MiaoData.js' +import { Data } from '#miao' export default { key: 'miao', diff --git a/models/player/MysAvatar.js b/models/player/MysAvatar.js index 2c3dd714..e0092550 100644 --- a/models/player/MysAvatar.js +++ b/models/player/MysAvatar.js @@ -1,7 +1,8 @@ import lodash from 'lodash' -import { Data } from '../../components/index.js' -import { chestInfo } from '../../resources/meta/info/index.js' import moment from 'moment' +import { Data } from '#miao' +import { chestInfo } from '../../resources/meta/info/index.js' + const MysAvatar = { diff --git a/models/player/Profile.js b/models/player/Profile.js index 506da25f..92bdb367 100644 --- a/models/player/Profile.js +++ b/models/player/Profile.js @@ -1,5 +1,5 @@ import { ProfileReq, ProfileServ } from '../index.js' -import { Cfg, Data } from '../../components/index.js' +import { Cfg, Data } from '#miao' import MysAvatar from './MysAvatar.js' import enkaApi from './EnkaApi.js' diff --git a/models/profile/ArtisMark.js b/models/profile/ArtisMark.js index 28a8d87c..37de1041 100644 --- a/models/profile/ArtisMark.js +++ b/models/profile/ArtisMark.js @@ -1,5 +1,5 @@ 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' let ArtisMark = { diff --git a/models/profile/AttrCalc.js b/models/profile/AttrCalc.js index 690e6a07..b499af83 100644 --- a/models/profile/AttrCalc.js +++ b/models/profile/AttrCalc.js @@ -4,7 +4,7 @@ */ 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 { weaponBuffs } from '../../resources/meta/weapon/index.js' import lodash from 'lodash' diff --git a/models/profile/DmgAttr.js b/models/profile/DmgAttr.js index 88f4b0a6..111c28c3 100644 --- a/models/profile/DmgAttr.js +++ b/models/profile/DmgAttr.js @@ -4,7 +4,7 @@ import { attrMap } from '../../resources/meta/artifact/index.js' import lodash from 'lodash' import DmgMastery from './DmgMastery.js' -import { Format } from '../../components/index.js' +import { Format } from '#miao' let DmgAttr = { // 计算并返回指定属性值 diff --git a/models/profile/DmgBuffs.js b/models/profile/DmgBuffs.js index 1e950e1a..731fcd1a 100644 --- a/models/profile/DmgBuffs.js +++ b/models/profile/DmgBuffs.js @@ -2,7 +2,7 @@ * 伤害计算 - Buff计算 * */ import lodash from 'lodash' -import { Data } from '../../components/index.js' +import { Data } from '#miao' import { ProfileArtis } from '../index.js' let weaponBuffs = {} @@ -10,8 +10,8 @@ let artisBuffs = {} // lazy load setTimeout(async function init () { - weaponBuffs = (await Data.importModule('resources/meta/weapon/index.js')).weaponBuffs || {} - artisBuffs = (await Data.importModule('resources/meta/artifact/index.js')).calc || {} + weaponBuffs = (await Data.importModule('resources/meta/weapon/index.js', 'miao')).weaponBuffs || {} + artisBuffs = (await Data.importModule('resources/meta/artifact/index.js', 'miao')).calc || {} }) let DmgBuffs = { diff --git a/package.json b/package.json index d93f5b67..0feebe9b 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,13 @@ "dependencies": { "image-size": "^1.0.2" }, - "peerDependencies": { - "image-size": "^1.0.2" - }, "devDependencies": { + "cheerio": "1.0.0-rc.12", + "request": "^2.88.2" + }, + "imports": { + "#miao": "./components/index.js", + "#miao.models": "./models/index.js" }, "pnpm": { "patchedDependencies": {} diff --git a/resources/meta/artifact/index.js b/resources/meta/artifact/index.js index fdcd4fc1..bed17b28 100644 --- a/resources/meta/artifact/index.js +++ b/resources/meta/artifact/index.js @@ -1,11 +1,11 @@ -import { Data } from '../../../components/index.js' +import { Data } from '#miao' import lodash from 'lodash' import calc from './calc.js' let artiSetMap = {} 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) => { let artiSet = { diff --git a/resources/meta/artifact/meta.js b/resources/meta/artifact/meta.js index 93d6ff86..a1a002fb 100644 --- a/resources/meta/artifact/meta.js +++ b/resources/meta/artifact/meta.js @@ -1,5 +1,5 @@ import lodash from 'lodash' -import { Format } from '../../../components/index.js' +import { Format } from '#miao' export const abbr = { 炽烈的炎之魔女: '魔女', diff --git a/resources/meta/character/卡维/data.json b/resources/meta/character/卡维/data.json index 8a4286e7..bcdcc0ae 100644 --- a/resources/meta/character/卡维/data.json +++ b/resources/meta/character/卡维/data.json @@ -2,7 +2,7 @@ "id": 10000081, "name": "卡维", "abbr": "卡维", - "title": "天穹之境", + "title": "天穹之镜", "star": 4, "elem": "dendro", "allegiance": "???", diff --git a/resources/meta/character/卡维/detail.json b/resources/meta/character/卡维/detail.json index 55af1d55..78869f7a 100644 --- a/resources/meta/character/卡维/detail.json +++ b/resources/meta/character/卡维/detail.json @@ -20,21 +20,21 @@ "unit": "", "isSame": false, "values": [ - "80.57%", - "87.13%", - "93.69%", - "103.05%", - "109.61%", - "117.11%", - "127.41%", - "137.72%", - "148.02%", - "159.26%", - "170.51%", - "181.75%", - "192.99%", - "204.23%", - "215.48%" + "76.19%", + "82.39%", + "88.59%", + "97.45%", + "103.65%", + "110.73%", + "120.48%", + "130.22%", + "139.97%", + "150.6%", + "161.23%", + "171.86%", + "182.49%", + "193.12%", + "203.75%" ] }, { @@ -42,21 +42,21 @@ "unit": "", "isSame": false, "values": [ - "73.68%", - "79.68%", - "85.67%", - "94.24%", - "100.24%", - "107.09%", - "116.52%", - "125.94%", - "135.36%", - "145.64%", - "155.92%", - "166.21%", - "176.49%", - "186.77%", - "197.05%" + "69.64%", + "75.31%", + "80.98%", + "89.07%", + "94.74%", + "101.22%", + "110.13%", + "119.03%", + "127.94%", + "137.66%", + "147.37%", + "157.09%", + "166.81%", + "176.53%", + "186.24%" ] }, { @@ -64,21 +64,21 @@ "unit": "", "isSame": false, "values": [ - "92.39%", - "99.91%", - "107.43%", - "118.17%", - "125.69%", - "134.28%", - "146.1%", - "157.92%", - "169.74%", - "182.63%", - "195.52%", - "208.41%", - "221.3%", - "234.19%", - "247.08%" + "84.26%", + "91.12%", + "97.98%", + "107.78%", + "114.63%", + "122.47%", + "133.25%", + "144.03%", + "154.81%", + "166.56%", + "178.32%", + "190.08%", + "201.83%", + "213.59%", + "225.35%" ] }, { @@ -86,21 +86,21 @@ "unit": "", "isSame": false, "values": [ - "110.77%", - "119.78%", - "128.8%", - "141.68%", - "150.69%", - "161%", - "175.17%", - "189.33%", - "203.5%", - "218.96%", - "234.41%", - "249.87%", - "265.32%", - "280.78%", - "296.24%" + "102.69%", + "111.05%", + "119.4%", + "131.35%", + "139.7%", + "149.26%", + "162.39%", + "175.53%", + "188.66%", + "202.99%", + "217.32%", + "231.65%", + "245.97%", + "260.3%", + "274.63%" ] }, { @@ -419,72 +419,72 @@ "talentData": { "a": { "一段伤害": [ - 80.57, - 87.13, - 93.69, - 103.05, - 109.61, - 117.11, - 127.41, - 137.72, - 148.02, - 159.26, - 170.51, - 181.75, - 192.99, - 204.23, - 215.48 + 76.19, + 82.39, + 88.59, + 97.45, + 103.65, + 110.73, + 120.48, + 130.22, + 139.97, + 150.6, + 161.23, + 171.86, + 182.49, + 193.12, + 203.75 ], "二段伤害": [ - 73.68, - 79.68, - 85.67, - 94.24, - 100.24, - 107.09, - 116.52, - 125.94, - 135.36, - 145.64, - 155.92, - 166.21, - 176.49, - 186.77, - 197.05 + 69.64, + 75.31, + 80.98, + 89.07, + 94.74, + 101.22, + 110.13, + 119.03, + 127.94, + 137.66, + 147.37, + 157.09, + 166.81, + 176.53, + 186.24 ], "三段伤害": [ - 92.39, - 99.91, - 107.43, - 118.17, - 125.69, - 134.28, - 146.1, - 157.92, - 169.74, - 182.63, - 195.52, - 208.41, - 221.3, - 234.19, - 247.08 + 84.26, + 91.12, + 97.98, + 107.78, + 114.63, + 122.47, + 133.25, + 144.03, + 154.81, + 166.56, + 178.32, + 190.08, + 201.83, + 213.59, + 225.35 ], "四段伤害": [ - 110.77, - 119.78, - 128.8, - 141.68, - 150.69, - 161, - 175.17, - 189.33, - 203.5, - 218.96, - 234.41, - 249.87, - 265.32, - 280.78, - 296.24 + 102.69, + 111.05, + 119.4, + 131.35, + 139.7, + 149.26, + 162.39, + 175.53, + 188.66, + 202.99, + 217.32, + 231.65, + 245.97, + 260.3, + 274.63 ], "重击循环伤害": [ 53.15, @@ -754,7 +754,7 @@ "6": { "name": "天园的理想", "desc": [ - "在繁绘隅穹持续期间,卡维的普通攻击、重击与下落攻击命中敌人时,将在敌人的位置释放天圆之光,造成卡维攻击力61.8%的草元素范围伤害,并使影响范围内的所有草原核迸发。该效果每3秒最多触发一次。" + "在繁绘隅穹持续期间,卡维的普通攻击、重击或下落攻击命中敌人时,将在敌人的位置释放天园之光,造成卡维攻击力61.8%的草元素范围伤害,并使影响范围内的所有草原核迸发。该效果每3秒最多触发一次。" ] } }, @@ -762,7 +762,7 @@ { "name": "预算师的技艺", "desc": [ - "制作景观/建筑/庭院类摆设时,有100%概率返还部分材料。" + "制作景观、建筑、庭院类摆设时,有100%概率返还部分材料。" ] }, { @@ -774,7 +774,7 @@ { "name": "工艺家的奇想", "desc": [ - "在繁绘隅穹持续期间,卡维在普通攻击、重击与下落攻击命中敌人后,元素精通将提升25点。该效果每0.1秒至多触发一次,至多叠加4层。", + "在繁绘隅穹持续期间,卡维在普通攻击、重击或下落攻击命中敌人后,元素精通将提升25点。该效果每0.1秒至多触发一次,至多叠加4层。", "在繁绘隅穹效果结束时,该效果将被移除。" ] } diff --git a/resources/meta/character/白术/detail.json b/resources/meta/character/白术/detail.json index 2ef20f55..d2091bfc 100644 --- a/resources/meta/character/白术/detail.json +++ b/resources/meta/character/白术/detail.json @@ -274,7 +274,7 @@ "name": "愈气全形论", "desc": [ "进入脉摄宣明状态,产生无郤气护盾。", - "在脉摄宣明状态下,每2秒将产生新的无郤气护盾。", + "在脉摄宣明状态下,每2.5秒将产生新的无郤气护盾。", "无郤气护盾在以下情况下,将会为当前场上自己的角色恢复生命值,回复量受益于白术的生命值上限,并释放灵气脉攻击敌人,造成草元素伤害:", "·当角色处于无郤气护盾的庇护下时,并产生新的无郤气护盾;", "·无郤气护盾的效果结束,或因伤害破碎。", @@ -1016,7 +1016,7 @@ "name": "动静精明", "desc": [ "队伍中自己的当前场上角色在攻击命中附近的敌人时,白术将释放游丝徵灵·切。", - "游丝徵灵·切能够进行1次攻击,造成300%草元素伤害与太素诊要的游丝徵灵20%回复量。", + "游丝徵灵·切将在进行至多1次攻击后返回,造成白术攻击力300%的草元素伤害与太素诊要游丝徵灵的20%回复量。", "通过这种方式造成的伤害视为元素战技伤害。", "每6秒至多触发一次。" ] @@ -1065,7 +1065,7 @@ { "name": "在地为化", "desc": [ - "受到愈气全形论治疗的角色,将获得「木运之岁」效果:基于白术生命值上限不超过50000点的部分,每1000点将使该角色触发的燃烧、绽放、超绽放、烈绽放反应造成的伤害提升2%,超激化、蔓激化反应带来的伤害提升0.8%,持续6秒。" + "受到无郤气护盾治疗的角色,将获得「木运之岁」效果:基于白术生命值上限不超过50000点的部分,每1000点将使该角色触发的燃烧、绽放、超绽放、烈绽放反应造成的伤害提升2%,超激化、蔓激化反应带来的伤害提升0.8%,持续6秒。" ] } ], diff --git a/resources/meta/character/米卡/data.json b/resources/meta/character/米卡/data.json index f3d9111a..d006a954 100644 --- a/resources/meta/character/米卡/data.json +++ b/resources/meta/character/米卡/data.json @@ -40,5 +40,5 @@ "talent": "「诗文」的哲学", "weekly": "无心的渊镜" }, - "eta": 1677636000000 + "eta": 1679364000000 } \ No newline at end of file diff --git a/resources/meta/info/index.js b/resources/meta/info/index.js index 2a6ea3c4..f3ddcab0 100644 --- a/resources/meta/info/index.js +++ b/resources/meta/info/index.js @@ -4,15 +4,15 @@ export * from './pool.js' export const chestInfo = { common: { title: '普通宝箱', - max: 2542 + max: 2547 }, exquisite: { title: '精致宝箱', - max: 1594 + max: 1596 }, precious: { title: '珍贵宝箱', - max: 488 + max: 489 }, luxurious: { title: '豪华宝箱', diff --git a/resources/meta/weapon/index.js b/resources/meta/weapon/index.js index 39649e88..f217d571 100644 --- a/resources/meta/weapon/index.js +++ b/resources/meta/weapon/index.js @@ -1,4 +1,4 @@ -import { Data } from '../../../components/index.js' +import { Data } from '#miao' import lodash from 'lodash' import { weaponType, abbr, alias, weaponSet } from './meta.js' @@ -28,12 +28,12 @@ const attr = function (key, start, _step) { for (let type in weaponType) { // 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) calc = lodash.extend(calc, typeRet) // 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) => { data[ds.name] = { id: ds.id, diff --git a/tools/ambr.js b/tools/ambr.js index fd1f309e..de2c231d 100644 --- a/tools/ambr.js +++ b/tools/ambr.js @@ -4,7 +4,7 @@ import lodash from 'lodash' import fetch from 'node-fetch' import ImgDownloader from './sprider/ImgDown.js' import CharData from './sprider/CharDataAmber.js' -import { Data } from '../components/index.js' +import { Data } from '#miao' import tId from './sprider/TalentId.js' import testData from './test.js' @@ -49,16 +49,16 @@ let getCharData = async function (id, key, name = '', _id = id) { function checkName (name) { let charPath = `resources/meta/character/${name}/` - Data.createDir(charPath) + Data.createDir(charPath, 'miao') if (name === '旅行者') { for (let idx in tElems) { - Data.createDir(`${charPath}${tElems[idx]}/icons`) + Data.createDir(`${charPath}${tElems[idx]}/icons`, 'miao') } } else { - Data.createDir(`${charPath}/icons`) + Data.createDir(`${charPath}/icons`, 'miao') } - Data.createDir(`${charPath}/imgs`) - let data = Data.readJSON(`${charPath}/data.json`) + Data.createDir(`${charPath}/imgs`, 'miao') + let data = Data.readJSON(`${charPath}/data.json`, 'miao') return data.ver * 1 > 1 } @@ -72,7 +72,7 @@ async function saveCharData (id) { return } - Data.createDir(`resources/meta/character/${name}/`) + Data.createDir(`resources/meta/character/${name}/`, 'miao') let charPath = `${_path}/plugins/miao-plugin/resources/meta/character/${name}/` fs.writeFileSync(`${charPath}data.json`, JSON.stringify(data, '', 2)) diff --git a/tools/artis-data.js b/tools/artis-data.js index 81804592..47f58cfd 100644 --- a/tools/artis-data.js +++ b/tools/artis-data.js @@ -1,7 +1,7 @@ import fs from 'fs' import cheerio from 'cheerio' import fetch from 'node-fetch' -import { Data } from '../components/index.js' +import { Data } from '#miao' import lodash from 'lodash' import request from 'request' import HttpsProxyAgent from 'https-proxy-agent' @@ -96,7 +96,7 @@ async function down (sets = '') { } ds.sets = await getSets(ds.id) 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) => { imgs.push({ @@ -105,8 +105,8 @@ async function down (sets = '') { }) }) } - Data.createDir('resources/meta/artifact') - Data.writeJSON('resources/meta/artifact/data.json', ret) + Data.createDir('resources/meta/artifact', 'miao') + Data.writeJSON('resources/meta/artifact/data.json', ret, 'miao') const _path = process.cwd() const _root = _path + '/plugins/miao-plugin/' diff --git a/tools/char-data.js b/tools/char-data.js index aac51b0c..6ffcbecb 100644 --- a/tools/char-data.js +++ b/tools/char-data.js @@ -3,13 +3,13 @@ import lodash from 'lodash' import fetch from 'node-fetch' import ImgDownloader from './sprider/ImgDown.js' import CharData from './sprider/CharData.js' -import { Data } from '../components/index.js' +import { Data } from '#miao' import HttpsProxyAgent from 'https-proxy-agent' let agent = new HttpsProxyAgent('http://localhost:4780') -let mData = Data.readJSON('/resources/meta/material/data.json') -let tId = Data.readJSON('/tools/meta/talent.json') +let mData = Data.readJSON('/resources/meta/material/data.json', 'miao') +let tId = Data.readJSON('/tools/meta/talent.json', 'miao') const tElems = ['anemo', 'geo', 'electro', 'dendro'] @@ -135,16 +135,16 @@ let getCharData = async function (id, key, name = '', _id = id) { function checkName (name) { let charPath = `resources/meta/character/${name}/` - Data.createDir(charPath) + Data.createDir(charPath, 'miao') if (name === '旅行者') { for (let idx in tElems) { - Data.createDir(`${charPath}${tElems[idx]}/icons`) + Data.createDir(`${charPath}${tElems[idx]}/icons`, 'miao') } } else { - Data.createDir(`${charPath}/icons`) + Data.createDir(`${charPath}/icons`, 'miao') } - Data.createDir(`${charPath}/imgs`) - let data = Data.readJSON(`${charPath}/data.json`) + Data.createDir(`${charPath}/imgs`, 'miao') + let data = Data.readJSON(`${charPath}/data.json`, 'miao') 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 } 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 }) + Data.writeJSON({ path: charPath, name: 'data.json', data, rn: true, root: 'miao' }) 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 }) + Data.writeJSON({ path: charPath, name: 'detail.json', data: details[0], rn: true, root: 'miao' }) } else if (data.id === 20000000) { for (let idx in details) { 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 }) + Data.writeJSON({ path: `${charPath}/${detail.elem}`, name: 'detail.json', data: detail, rn: true, root: 'miao' }) } } @@ -206,7 +203,7 @@ async function down (name = '', force = false) { } 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 = { @@ -289,8 +286,8 @@ let eta = { 瑶瑶: '2023-01-18', 艾尔海森: '2023-01-18', 迪希雅: '2023-03-01', - 米卡: '2023-03-01', + 米卡: '2023-03-21', 卡维: '2023-04-12', 白术: '2023-04-12' } -await down('卡维,白术', true) +await down('米卡,卡维,白术', true) diff --git a/tools/dmg-calc-tool.js b/tools/dmg-calc-tool.js index 12c1d949..042b73c5 100644 --- a/tools/dmg-calc-tool.js +++ b/tools/dmg-calc-tool.js @@ -1,6 +1,6 @@ // eslint-disable-next-line no-unused-vars -import { Data } from '../components/index.js' -import { ProfileDmg } from '../models/index.js' +import { Data } from '#miao' +import { ProfileDmg } from '#miao.models' export async function calcDmg (inputData, enemyLv = 86) { let dmg = new ProfileDmg(inputData) diff --git a/tools/sprider/CharDataAmber.js b/tools/sprider/CharDataAmber.js index 7bd40eeb..437ca3db 100644 --- a/tools/sprider/CharDataAmber.js +++ b/tools/sprider/CharDataAmber.js @@ -1,6 +1,6 @@ import abbr from './abbr.js' import lodash from 'lodash' -import { Data } from '../../components/index.js' +import { Data } from '#miao' let costumes = { 琴: [200301], // 琴 diff --git a/tools/sprider/ImgDown.js b/tools/sprider/ImgDown.js index e6e56e6b..a73325a6 100644 --- a/tools/sprider/ImgDown.js +++ b/tools/sprider/ImgDown.js @@ -1,6 +1,6 @@ import fs from 'fs' import request from 'request' -import { Data } from '../../components/index.js' +import { Data } from '#miao' import HttpsProxyAgent from 'https-proxy-agent' let agent = new HttpsProxyAgent('http://localhost:4780') diff --git a/tools/weapon-data.js b/tools/weapon-data.js index 24d48acf..6ee875f7 100644 --- a/tools/weapon-data.js +++ b/tools/weapon-data.js @@ -1,7 +1,7 @@ import fetch from 'node-fetch' import cheerio from 'cheerio' import lodash from 'lodash' -import { Data } from '../components/index.js' +import { Data } from '#miao' import fs from 'fs' import request from 'request' import WeaponData from './sprider/WeaponData.js' @@ -10,11 +10,11 @@ import ImgDownloader from './sprider/ImgDown.js' let ret = {} const types = ['sword', 'claymore', 'polearm', 'bow', 'catalyst'] 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 weaponIdMap = Data.readJSON('tools/meta/weapon.json') +let mData = Data.readJSON('resources/meta/material/data.json', 'miao') +let weaponIdMap = Data.readJSON('tools/meta/weapon.json', 'miao') let getWeaponTypeData = async function (type) { let url = `https://genshin.honeyhunterworld.com/fam_${type}/?lang=CHS` @@ -91,8 +91,8 @@ async function down (t, n) { continue } await getWeaponTypeData(type) - Data.createDir(`resources/meta/weapon/${type}`) - Data.writeJSON({ name: `resources/meta/weapon/${type}/data.json`, data: ret[type], rn: true }) + Data.createDir(`resources/meta/weapon/${type}`, 'miao') + Data.writeJSON({ name: `resources/meta/weapon/${type}/data.json`, data: ret[type], rn: true, root: 'miao' }) let imgs = [] await Data.asyncPool(6, lodash.keys(ret[type]), async (name) => { @@ -100,9 +100,9 @@ async function down (t, n) { return } 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) - 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({ 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'