加面板图开关,面板相关一些已知Bug修复

This commit is contained in:
Kokomi 2023-02-23 01:48:44 +08:00
parent 4f79e42214
commit 276dba9b7e
9 changed files with 41 additions and 17 deletions

View File

@ -160,9 +160,7 @@ let ProfileDetail = {
let artisDetail = profile.getArtisMark()
let artisKeyTitle = ProfileArtis.getArtisKeyTitle()
let costumeSplash = profile.costumeSplash
// 渲染图像
let msgRes = await Common.render('character/profile-detail', {
let renderData = {
save_id: uid,
uid,
data: profile.getData('name,abbr,cons,level,weapon,talent,dataSource,updateTime,imgs,costumeSplash'),
@ -175,12 +173,14 @@ let ProfileDetail = {
mode,
wCfg,
changeProfile: e._profileMsg
}, { e, scale: 1.6, retMsgId: true })
}
// 渲染图像
let msgRes = await Common.render('character/profile-detail', renderData, { e, scale: 1.6, retMsgId: true })
if (msgRes && msgRes.message_id) {
// 如果消息发送成功就将message_id和图片路径存起来3小时过期
await redis.set(`miao:original-picture:${msgRes.message_id}`, JSON.stringify({
type: 'profile',
img: costumeSplash
img: renderData?.data?.costumeSplash
}), { EX: 3600 * 3 })
}
return true

View File

@ -21,6 +21,9 @@ export default async function (path, params, cfg) {
sys: {
scale: Cfg.scale(cfg.scale || 1),
copyright: `Created By Yunzai-Bot<span class="version">${Version.yunzai}</span> & Miao-Plugin<span class="version">${Version.version}</span>`
},
pageGotoParams: {
waitUntil: 'networkidle2'
}
}
}

View File

@ -76,6 +76,12 @@ export const cfgSchema = {
input: (n) => n * 1 === 1 ? 1 : 2,
desc: '面板服务优先选择1自动具备有效Token时优先喵喵Api否则Enka2Enka服务优先'
},
costumeSplash: {
title: '使用自定义面板插图',
key: '面板图',
def: true,
desc: '开启彩蛋图(三皇冠/ACE/满命)及自定义面板图,关闭使用官方立绘'
},
teamCalc: {
title: '组队加成伤害',
key: '组队',

View File

@ -90,6 +90,9 @@ export default class MysApi {
}
let e = this.e
let mys = await this.getMysApi(e, api, { log: false })
if (!mys) {
return false
}
let mysInfo = this.mysInfo || {}
// 暂时先在plugin侧阻止错误防止刷屏
e._original_reply = e._original_reply || e.reply

View File

@ -27,7 +27,7 @@ export default class Player extends Base {
}
this.uid = uid
this.reload()
return this._cache()
return this._cache(100)
}
get hasProfile () {

View File

@ -1,6 +1,6 @@
import lodash from 'lodash'
import AvatarData from './AvatarData.js'
import { Data } from '../components/index.js'
import { Data, Cfg } from '../components/index.js'
import { ProfileArtis, ProfileDmg } from './index.js'
import AttrCalc from './profile/AttrCalc.js'
import CharImg from './character/CharImg.js'
@ -18,14 +18,18 @@ export default class ProfileData extends AvatarData {
return this.isProfile
}
get imgs(){
return this.char.getImgs(this.costume)
get imgs () {
return this.char.getImgs(this.costume) || {}
}
get costumeSplash () {
let costume = this._costume
costume = this.char.checkCostume(costume) ? '2' : ''
if (!Cfg.get('costumeSplash', true)) {
return this.char.getImgs(this._costume).splash
}
let nPath = `meta/character/${this.name}`
let isSuper = false
let talent = this.talent ? lodash.map(this.talent, (ds) => ds.original).join('') : ''

View File

@ -193,10 +193,15 @@ export default class ProfileDmg extends Base {
detail = detailMap[0]
}
if (lodash.isFunction(detail)) {
let { attr } = DmgAttr.calcAttr({ originalAttr, buffs, meta })
let ds = lodash.merge({ talent }, DmgAttr.getDs(attr, meta))
detail = detail({ ...ds, attr, profile })
}
dmgDetail = {
title: detail.title,
userIdx: detail.userIdx,
basicRet: lodash.merge({}, ret[detail.userIdx]),
userIdx: detail.userIdx || defDmgIdx,
basicRet: lodash.merge({}, ret[detail.userIdx] || ret[defDmgIdx]),
attr: []
}

View File

@ -241,8 +241,10 @@ let ArtisMark = {
hasAttr (artis) {
for (let idx = 1; idx <= 5; idx++) {
let ds = artis[idx]
if (ds && (!ds.name || !ds.main || !ds.attrs || !ds?.main?.key)) {
return false
if (ds) {
if (!ds.name || !ds.main || !ds.attrs || !ds?.main?.key) {
return false
}
}
}
return true

View File

@ -8,7 +8,8 @@
{{set dataSource = data.dataSource}}
{{set talentMap = {a: '普攻', e: '战技', q: '爆发'} }}
{{set {imgs,costumeSplash} = data }}
{{set {imgs, costumeSplash} = data }}
{{set imgs = imgs || {} }}
{{block 'main'}}
<div class="basic">
@ -142,7 +143,7 @@
<!-- 【 伤害表格 】 -->
{{ set {dmgRet, dmgCfg, enemyName, dmgMsg, dmgData} = dmgCalc }}
{{ set {dmgRet, dmgCfg, enemyLv, enemyName, dmgMsg, dmgData} = dmgCalc }}
<div>
{{if mode === "profile"}}
<div class="cont">
@ -152,7 +153,7 @@
</div>
{{/if}}
{{if dmgData.length > 0}}
{{if dmgData?.length > 0}}
<div class="dmg-cont dmg-list cont">
<div class="cont-title">
伤害计算<span>目标为{{enemyLv}}级{{enemyName||'小宝'}},如需调整等级可使用 #敌人等级{{enemyLv}} 来进行设置</span>
@ -188,7 +189,7 @@
<!-- 【 伤害变化详情 】 -->
<div>
{{if mode === "dmg"}}
{{if dmgCfg && dmgCfg.attr && dmgCfg.attr.length>0 && dmgRet && dmgRet.length >3}}
{{if dmgCfg && dmgCfg.attr && dmgCfg.attr.length>0 && dmgRet}}
<div class="dmg-calc dmg-cont cont">
<div class="cont-title">
词条伤害计算<span>#{{data.abbr}}伤害{{dmgCfg.userIdx+1}}: 当前计算为[{{dmgCfg.title}}]</span>