调整部分模块的引用方式

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
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

View File

@ -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({

View File

@ -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',

View File

@ -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'

View File

@ -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 = {

View File

@ -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*$/

View File

@ -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',

View File

@ -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) {

View File

@ -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'

View File

@ -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',

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 lodash from 'lodash'
import HelpTheme from './HelpTheme.js'

View File

@ -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) {

View File

@ -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',

View File

@ -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',

View File

@ -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'
/*
* 角色圣遗物面板

View File

@ -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: '圣遗物',

View File

@ -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

View File

@ -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'

View File

@ -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 = {
/**

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 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')

View File

@ -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) {

View File

@ -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) {

View File

@ -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',

View File

@ -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()

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 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 || '')

View File

@ -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')

View File

@ -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'

View File

@ -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, // 米游社《原神》专属工具一览

View File

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

View File

@ -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) {

View File

@ -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 = /^(?:#|喵喵)?(.*)(天赋|技能|命座|命之座|资料|图鉴|照片|写真|图片|图像)$/

View File

@ -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 = {
/**

View File

@ -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下的系统文件`)

View File

@ -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,

View File

@ -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)

View File

@ -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'

View File

@ -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')

View File

@ -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'

View File

@ -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 {

View File

@ -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'

View File

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

View File

@ -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)

View File

@ -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] = {

View File

@ -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) {

View File

@ -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 () {

View File

@ -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'

View File

@ -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'

View File

@ -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 = {}) {

View File

@ -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) {

View File

@ -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')

View File

@ -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)
}

View File

@ -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]
}

View File

@ -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'
// 别名表

View File

@ -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 = {

View File

@ -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 },

View File

@ -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 = ''

View File

@ -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',

View File

@ -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',

View File

@ -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 = {

View File

@ -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'

View File

@ -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 = {

View File

@ -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'

View File

@ -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 = {
// 计算并返回指定属性值

View File

@ -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 = {

View File

@ -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": {}

View File

@ -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 = {

View File

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

View File

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

View File

@ -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层。",
"在繁绘隅穹效果结束时,该效果将被移除。"
]
}

View File

@ -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秒。"
]
}
],

View File

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

View File

@ -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: '豪华宝箱',

View File

@ -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,

View File

@ -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))

View File

@ -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/'

View File

@ -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)

View File

@ -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)

View File

@ -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], // 琴

View File

@ -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')

View File

@ -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'