mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
修改puppeteer的截图时机,一些底层修改
This commit is contained in:
parent
de2da29559
commit
cecc16d574
@ -12,7 +12,7 @@ const importV3 = async function (file, def, key = 'default') {
|
||||
|
||||
let MysInfo = await importV3('/plugins/genshin/model/mys/mysInfo.js')
|
||||
let plugin = await importV3('lib/plugins/plugin.js', _plugin)
|
||||
let puppeteer = await importV3('/lib/puppeteer/puppeteer.js', _puppeteer)
|
||||
let puppeteer = _puppeteer
|
||||
export {
|
||||
plugin,
|
||||
MysInfo,
|
||||
|
@ -112,9 +112,11 @@ class Puppeteer {
|
||||
let start = Date.now()
|
||||
try {
|
||||
this.shoting.push(name)
|
||||
|
||||
const page = await this.browser.newPage()
|
||||
await page.goto(`file://${_path}${lodash.trim(savePath, '.')}`)
|
||||
page.setCacheEnabled(true)
|
||||
await page.goto(`file://${_path}${lodash.trim(savePath, '.')}`, {
|
||||
waitUntil: 'domcontentloaded'
|
||||
})
|
||||
let body = await page.$('#container') || await page.$('body')
|
||||
await page.waitForSelector('#container')
|
||||
await page.waitForTimeout(100)
|
||||
|
@ -2,18 +2,34 @@ import { Data } from '../components/index.js'
|
||||
|
||||
let cacheMap = {}
|
||||
let reFn = {}
|
||||
let metaMap = {}
|
||||
|
||||
export default class Base {
|
||||
constructor () {
|
||||
let proxy = new Proxy(this, {
|
||||
get (self, key, receiver) {
|
||||
if (self._uuid && key === 'meta') {
|
||||
return metaMap[self._uuid]
|
||||
}
|
||||
if (key in self) {
|
||||
return Reflect.get(self, key, receiver)
|
||||
}
|
||||
if (self._get) {
|
||||
return self._get.call(receiver, key)
|
||||
}
|
||||
return (self._meta || self._data || self.meta || {})[key]
|
||||
if (self._uuid) {
|
||||
return (metaMap[self._uuid] || {})[key]
|
||||
} else {
|
||||
return (self.meta || {})[key]
|
||||
}
|
||||
},
|
||||
set (target, key, newValue) {
|
||||
if (target._uuid && key === 'meta') {
|
||||
metaMap[target._uuid] = newValue
|
||||
return true
|
||||
} else {
|
||||
return Reflect.set(target, key, newValue)
|
||||
}
|
||||
}
|
||||
})
|
||||
return proxy
|
||||
@ -50,30 +66,18 @@ export default class Base {
|
||||
|
||||
// 设置超时时间
|
||||
_expire (time = 10 * 60) {
|
||||
this._delCache()
|
||||
if (time > 0) {
|
||||
let id = this._uuid
|
||||
reFn[id] && clearTimeout(reFn[id])
|
||||
if (time > 0) {
|
||||
if (id) {
|
||||
reFn[id] = setTimeout(() => {
|
||||
reFn[id] && clearTimeout(reFn[id])
|
||||
delete reFn[id]
|
||||
delete cacheMap[id]
|
||||
delete metaMap[id]
|
||||
}, time * 1000)
|
||||
}
|
||||
return cacheMap[id]
|
||||
} else {
|
||||
return this._delCache()
|
||||
}
|
||||
}
|
||||
|
||||
// 删除缓存
|
||||
_delCache () {
|
||||
let id = this._uuid
|
||||
let ret = reFn[id] || false
|
||||
if (id) {
|
||||
reFn[id] && clearTimeout(reFn[id])
|
||||
delete reFn[id]
|
||||
}
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class Character extends Base {
|
||||
}
|
||||
|
||||
getAttrList () {
|
||||
let meta = this.meta
|
||||
let { meta } = this
|
||||
return CharMeta.getAttrList(meta.baseAttr, meta.growAttr, this.elemName)
|
||||
}
|
||||
|
||||
@ -92,18 +92,8 @@ class Character extends Base {
|
||||
return CharMeta.getMaterials(this)
|
||||
}
|
||||
|
||||
// 获取基础数据
|
||||
get baseAttr () {
|
||||
return this.meta.baseAttr
|
||||
}
|
||||
|
||||
// 获取成长数据
|
||||
get growAttr () {
|
||||
return this.meta.growAttr
|
||||
}
|
||||
|
||||
get birthday () {
|
||||
let birth = this.meta.birth
|
||||
let birth = this.birth
|
||||
if (!birth) {
|
||||
return ''
|
||||
}
|
||||
|
6
resources/meta/character/甘雨/artis.js
Normal file
6
resources/meta/character/甘雨/artis.js
Normal file
@ -0,0 +1,6 @@
|
||||
export default function ({ artis, rule, def }) {
|
||||
if (artis.is('冰套4')) {
|
||||
return rule('永冻甘雨', { atk: 75, cp: 100, cd: 100, dmg: 100, recharge: 75 })
|
||||
}
|
||||
return def({ atk: 75, cp: 100, cd: 100, mastery: 75, dmg: 100 })
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
export default function ({ attr, artis, rule, def }) {
|
||||
if (attr.cpct * 2 + attr.cdmg >= 180 && artis.mainAttr(4) === 'dmg') {
|
||||
if (attr.cpct * 2 + attr.cdmg >= 180 && artis.is('dmg', 4)) {
|
||||
return rule('暴力芭芭拉', { hp: 50, atk: 75, cp: 100, cd: 100, mastery: 75, dmg: 100, recharge: 30, heal: 50 })
|
||||
}
|
||||
return def({ hp: 100, atk: 50, cp: 50, cd: 50, dmg: 80, recharge: 55, heal: 100 })
|
||||
|
@ -50,15 +50,11 @@ export const usefulAttr = {
|
||||
五郎: { hp: 0, atk: 50, def: 100, cp: 50, cd: 50, mastery: 0, dmg: 25, phy: 0, recharge: 90, heal: 0 },
|
||||
班尼特: { hp: 100, atk: 50, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 80, phy: 0, recharge: 55, heal: 100 },
|
||||
枫原万叶: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 100, dmg: 100, phy: 0, recharge: 55, heal: 0 },
|
||||
雷电将军: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 75, phy: 0, recharge: 90, heal: 0 },
|
||||
'雷电将军-高精': { hp: 0, atk: 90, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 90, phy: 0, recharge: 90, heal: 0 },
|
||||
行秋: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 75, heal: 0 },
|
||||
钟离: { hp: 80, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 50, recharge: 55, heal: 0 },
|
||||
神里绫华: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 30, heal: 0 },
|
||||
香菱: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 55, heal: 0 },
|
||||
胡桃: { hp: 80, atk: 50, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 0, heal: 0 },
|
||||
甘雨: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 0, heal: 0 },
|
||||
'甘雨-永冻': { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 55, heal: 0 },
|
||||
温迪: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 55, heal: 0 },
|
||||
珊瑚宫心海: { hp: 100, atk: 50, def: 0, cp: 0, cd: 0, mastery: 0, dmg: 100, phy: 0, recharge: 55, heal: 100 },
|
||||
莫娜: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 75, heal: 0 },
|
||||
@ -78,8 +74,6 @@ export const usefulAttr = {
|
||||
刻晴: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 100, recharge: 0, heal: 0 },
|
||||
托马: { hp: 100, atk: 50, def: 0, cp: 50, cd: 50, mastery: 0, dmg: 75, phy: 0, recharge: 90, heal: 0 },
|
||||
迪卢克: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 0, heal: 0 },
|
||||
芭芭拉: { hp: 100, atk: 50, def: 0, cp: 50, cd: 50, mastery: 0, dmg: 80, phy: 0, recharge: 55, heal: 100 },
|
||||
'芭芭拉-暴力': { hp: 50, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 30, heal: 50 },
|
||||
诺艾尔: { hp: 0, atk: 50, def: 90, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 70, heal: 0 },
|
||||
旅行者: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 0, dmg: 100, phy: 0, recharge: 55, heal: 0 },
|
||||
重云: { hp: 0, atk: 75, def: 0, cp: 100, cd: 100, mastery: 75, dmg: 100, phy: 0, recharge: 55, heal: 0 },
|
||||
|
Loading…
Reference in New Issue
Block a user