Q版头像增加#喵喵设置 开关设置

This commit is contained in:
Kokomi 2023-02-20 05:24:17 +08:00
parent d02a675649
commit f42c53de22
8 changed files with 66 additions and 14 deletions

View File

@ -3,9 +3,9 @@
* MiaoApi面板服务更新
* 使用新版接口获取面板,大幅提高响应速度
* 使用statsIds存储圣遗物数据能够更精确的计算角色属性
* `#面板`、`#角色`等页面使用Q版头像(@QuAn_),可在#喵喵设置 中关闭
* 部分已知问题调整或优化
* 圣遗物、天赋更新策略及更新逻辑优化
* `#面板`、`#角色`等页面使用Q版头像
* 面板更新的提醒文案逻辑优化
# 2.3.0

View File

@ -34,16 +34,10 @@ const ProfileStat = {
})
if (avatarRet.length === 0) {
e.reply(`暂未获得#${uid}角色数据请绑定CK或 #更新面板`)
e.reply(player.getErrMsg() || `查询失败,暂未获得#${uid}角色数据请绑定CK或 #更新面板`)
return true
}
let talentNotice = []
if (!mys.isSelfCookie) {
talentNotice.push('未绑定CK信息可能展示不完全')
}
let faceChar = Character.get(player.face || avatarRet[0]?.id)
let imgs = faceChar.imgs
let face = {
@ -72,8 +66,7 @@ const ProfileStat = {
updateTime: player.getUpdateTime(),
isSelfCookie: e.isSelfCookie,
face,
avatars: avatarRet,
talentNotice
avatars: avatarRet
}, { e, scale: 1.4 })
}
}

View File

@ -119,6 +119,11 @@ export const cfgSchema = {
key: '图片',
def: true
},
qFace: {
title: 'Q版角色头像',
key: '卡通头像',
def: true
},
charPicSe: {
title: '小清新角色图',
key: '小清新',

View File

@ -6,7 +6,7 @@
* */
import lodash from 'lodash'
import Base from './Base.js'
import { Data, Format } from '../components/index.js'
import { Data, Format, Cfg } from '../components/index.js'
import CharImg from './character/CharImg.js'
import CharTalent from './character/CharTalent.js'
import CharId from './character/CharId.js'
@ -232,7 +232,11 @@ class Character extends Base {
if (!this._imgs[cacheId]) {
this._imgs[cacheId] = CharImg.getImgs(this.name, costumeIdx, this.isTraveler ? this.elem : '', this.source === 'amber' ? 'png' : 'webp')
}
return this._imgs[cacheId]
let imgs = this._imgs[cacheId]
return {
...imgs,
qFace: Cfg.get('qFace') ? imgs.qFace : imgs.face
}
}
// 基于角色名获取Character

View File

@ -76,6 +76,25 @@ export default class MysApi {
}
}
static async checkRetCode (retcode) {
switch (retcode) {
case -1:
case -100:
case 1001:
case 10001:
case 10103:
return 'CK失效或报错'
case 1008:
return '请先去米游社绑定角色'
case 10101:
return '查询已达今日上限'
case 10102:
return '请先去米游社绑定角色或公开数据'
case 1034:
return '米游社查询遇到验证码,请稍后再试'
}
}
async getMysApi (e, targetType = 'all', option = {}) {
if (this.mys) {
return this.mys
@ -110,6 +129,9 @@ export default class MysApi {
if (!ret) {
return false
}
if (ret.retcode !== 0) {
e._retcode = ret.retcode
}
return ret.data || ret
}

View File

@ -325,4 +325,8 @@ export default class Player extends Base {
}
return avatarRet
}
getErrMsg () {
return MysAvatar.getErrMsg(this.e)
}
}

View File

@ -28,7 +28,8 @@ let MiaoData = {
let talentRet = MiaoData.getTalentNew(char.id, ds.talent)
avatar.setAvatar({
...ds,
elem: talentRet.elem
elem: talentRet.elem,
talent: talentRet.talent
}, 'miao')
return avatar
},

View File

@ -4,6 +4,28 @@ import { chestInfo } from '../../resources/meta/info/index.js'
import moment from 'moment'
const MysAvatar = {
getErrMsg (e) {
if (!e._retcode) {
return false
}
switch (e._retcode * 1) {
case -1:
case -100:
case 1001:
case 10001:
case 10103:
return 'CK失效或报错'
case 1008:
return '请先去米游社绑定角色'
case 10101:
return '查询已达今日上限'
case 10102:
return '请先去米游社绑定角色或公开数据'
case 1034:
return '米游社查询遇到验证码,请稍后再试'
}
return false
},
needRefresh (time, force = 0, forceMap = {}) {
if (!time || force === 2) {
@ -27,7 +49,8 @@ const MysAvatar = {
* @returns {Promise<boolean>}
*/
async refreshMysDetail (player, force = 0) {
let mys = player?.e?._mys
let e = player.e || {}
let mys = e?._mys
if (!mys) {
return false
}