#刻晴面板#芭芭拉圣遗物支持展示角色时装

This commit is contained in:
yoimiya-kokomi 2022-09-01 02:26:36 +08:00
parent 6c429b3e7b
commit 4f3cd1c93f
21 changed files with 107 additions and 29 deletions

View File

@ -1,3 +1,9 @@
# 1.10.1
* `#刻晴面板`、`#芭芭拉圣遗物`支持展示角色时装
* 如果角色装备了时装,面板的角色图会展示时装立绘
* 需要重新`#更新面板`以获取时装数据
# 1.10.0
* 新增`#面板练度统计`功能

View File

@ -36,6 +36,7 @@ export async function profileArtis (e) {
uid,
elem: char.elem,
data: profile,
costume: profile.costume ? '2' : '',
artis,
totalMark,
totalMarkClass,

View File

@ -13,6 +13,7 @@ export async function renderProfile (e, char, mode = 'profile', params = {}) {
e.reply('暂不支持主角的面板信息查看')
return true
}
if (char.isCustom) {
e.reply(`暂不支持自定义角色${char.name}的面板信息查看`)
return true
@ -93,11 +94,13 @@ export async function renderProfile (e, char, mode = 'profile', params = {}) {
basic.dmg = Format.comma(basic.dmg)
basic.avg = Format.comma(basic.avg)
}
const costume = profile.costume ? '2' : ''
// 渲染图像
return await Common.render('character/profile-detail', {
save_id: uid,
uid,
data: profile.getData('cons,level,weapon,dataSource,updateTime'),
costume,
attr,
cons: char.cons,
name: char.name,
@ -114,7 +117,7 @@ export async function renderProfile (e, char, mode = 'profile', params = {}) {
totalMarkClass,
usefulMark,
talentMap: { a: '普攻', e: '战技', q: '爆发' },
bodyClass: `char-${char.name}`,
bodyClass: `char-${char.name}${costume}`,
mode
}, { e, scale: 1.6 })
}

View File

@ -29,6 +29,7 @@ export async function profileList (e) {
tmp.source = profile.dataSource
tmp.level = profile.level || 1
tmp.isNew = 0
tmp.costume = profile.costume ? '2' : ''
if (newChar[char.name]) {
tmp.isNew = 1
newCount++

View File

@ -1,6 +1,7 @@
import Cfg from './Cfg.js'
import { Data, Version } from './index.js'
import { puppeteer } from '../adapter/index.js'
import fs from 'fs'
const plugin = 'miao-plugin'
const _path = process.cwd()
@ -27,6 +28,17 @@ export const render = async function (path, params, cfg) {
copyright: `Created By Yunzai-Bot<span class="version">${Version.yunzai}</span> & Miao-Plugin<span class="version">${Version.version}</span>`
}
}
if (global.debugView === 'web-debug') {
// debug下保存当前页面的渲染数据方便模板编写与调试
// 由于只用于调试开发者只关注自己当时开发的文件即可暂不考虑app及plugin的命名冲突
let saveDir = _path + '/data/ViewData/'
if (!fs.existsSync(saveDir)) {
fs.mkdirSync(saveDir)
}
let file = saveDir + tpl + '.json'
data._app = app
fs.writeFileSync(file, JSON.stringify(data))
}
let base64 = await puppeteer.screenshot(`miao-plugin/${app}/${tpl}`, data)
let ret = true
if (base64) {

View File

@ -41,6 +41,7 @@ let EnkaData = {
level: data.propMap['4001'].val * 1,
cons: data.talentIdList ? data.talentIdList.length : 0,
fetter: data.fetterInfo.expLevel,
costume: char.checkCostume(data.costumeId) ? data.costumeId : 0,
dataSource: 'enka'
})
profile.setAttr(EnkaData.getAttr(data.fightPropMap))

View File

@ -35,6 +35,7 @@ let MiaoData = {
level: ds.level,
cons: ds.constellationNum || 0,
fetter: ds.fetterLevel,
costume: char.checkCostume(ds.costumeID) ? ds.costumeID : 0,
dataSource: 'miao'
})
profile.setAttr(MiaoData.getAttr(ds.combatValue))

View File

@ -11,7 +11,7 @@ let wifeMap = {}
const _path = process.cwd()
const metaPath = `${_path}/plugins/miao-plugin/resources/meta/character/`
async function init() {
async function init () {
let { sysCfg, diyCfg } = await Data.importCfg('character')
lodash.forEach([diyCfg.customCharacters, sysCfg.characters], (roleIds) => {
lodash.forEach(roleIds || {}, (aliases, id) => {
@ -49,7 +49,7 @@ async function init() {
await init()
class Character extends Base {
constructor(name, id) {
constructor (name, id) {
super()
if (id * 1 === 10000005) {
@ -65,7 +65,7 @@ class Character extends Base {
this.id = id
}
get weaponType() {
get weaponType () {
const map = {
sword: '单手剑',
catalyst: '法器',
@ -77,15 +77,15 @@ class Character extends Base {
return map[weaponType.toLowerCase()] || ''
}
get isCustom() {
get isCustom () {
return !/10\d{6}/.test(this.id)
}
get abbr() {
get abbr () {
return abbrMap[this.name] || this.name
}
getCardImg(se = false, def = true) {
getCardImg (se = false, def = true) {
let name = this.name
let list = []
let addImg = function (charImgPath, disable = false) {
@ -130,7 +130,7 @@ class Character extends Base {
return ret
}
checkAvatars(avatars) {
checkAvatars (avatars) {
if (!lodash.includes([20000000, 10000005, 10000007], this.id * 1)) {
return
}
@ -150,7 +150,7 @@ class Character extends Base {
}
}
getAvatarTalent(talent = {}, cons = 0, mode = 'level') {
getAvatarTalent (talent = {}, cons = 0, mode = 'level') {
let ret = {}
let consTalent = this.getConsTalent()
lodash.forEach(['a', 'e', 'q'], (key) => {
@ -177,7 +177,6 @@ class Character extends Base {
level: (key !== 'a' && cons >= consTalent[key]) ? (level + 3) : level
}
}
})
if (this.id * 1 !== 10000033) {
let a = ret.a || {}
@ -193,7 +192,7 @@ class Character extends Base {
return ret
}
getConsTalent() {
getConsTalent () {
let talent = this.talent || false
if (!talent) {
return { e: 3, q: 5 }
@ -208,9 +207,20 @@ class Character extends Base {
}
}
checkWifeType(type) {
checkWifeType (type) {
return !!wifeMap[type][this.id]
}
checkCostume (id) {
return [
200301, // 琴
201401, // 芭芭拉
204201, // 刻晴
202701, // 凝光
201601, // 迪卢克
203101 // 菲谢尔
].includes(id * 1)
}
}
let getMeta = function (name) {

View File

@ -26,6 +26,7 @@ export default class ProfileData extends Base {
this.level = ds.lv || ds.level || 1
this.cons = ds.cons || 0
this.fetter = ds.fetter || 0
this.costume = ds.costume || 0
this.dataSource = ds.dataSource || 'enka'
this._time = ds._time || ds.updateTime || new Date() * 1
}
@ -91,7 +92,7 @@ export default class ProfileData extends Base {
// toJSON 供保存使用
toJSON () {
return this.getData('id,name,level,cons,fetter,attr,weapon,talent,artis,dataSource,_time')
return this.getData('id,name,level,cons,fetter,attr,weapon,talent,artis,dataSource,costume,_time')
}
get updateTime () {

View File

@ -13,7 +13,7 @@
{{block 'main'}}
<div class="basic">
<div class="main-pic"
style="background-image:url({{_res_path}}/meta/character/{{data.name}}/gacha_splash.png)"></div>
style="background-image:url({{_res_path}}/meta/character/{{data.name}}/gacha_splash{{costume}}.png)"></div>
<div class="detail">
<div class="char-name">{{data.name}}</div>
<div class="char-lv">UID {{uid}} - Lv.{{data.level}}

View File

@ -717,4 +717,22 @@ body {
.char-班尼特 .main-pic {
margin-left: -220px;
}
.char-柯莱 .main-pic {
margin-left: -210px;
}
.char-荧 .main-pic {
margin-left: -220px;
}
.char-空 .main-pic {
margin-left: -280px;
}
.char-迪卢克2 .main-pic {
margin-left: -280px;
}
.char-芭芭拉2 .main-pic {
margin-left: -200px;
}
.char-刻晴2 .main-pic {
margin-left: -220px;
}
/*# sourceMappingURL=profile-detail.css.map */

View File

@ -11,7 +11,7 @@
{{block 'main'}}
<div class="basic">
<div class="main-pic"
style="background-image:url({{_res_path}}/meta/character/{{name}}/gacha_splash.png)"></div>
style="background-image:url({{_res_path}}/meta/character/{{name}}/gacha_splash{{costume}}.png)"></div>
<div class="detail">
<div class="char-name">{{name}}</div>
<div class="char-lv">UID {{uid}} - Lv.{{data.level}}

View File

@ -899,4 +899,28 @@ body {
.char-班尼特 .main-pic {
margin-left: -220px;
}
}
.char-柯莱 .main-pic {
margin-left: -210px;
}
.char-荧 .main-pic {
margin-left: -220px;
}
.char-空 .main-pic {
margin-left: -280px;
}
.char-迪卢克2 .main-pic {
margin-left: -280px;
}
.char-芭芭拉2 .main-pic {
margin-left: -200px;
}
.char-刻晴2 .main-pic {
margin-left: -220px;
}

View File

@ -23,7 +23,7 @@
<div class="char-item {{char.isNew&&hasNew ?'new-char':''}}">
<div class="item-icon char-icon star{{char.star}}">
<span class="img"
style="background-image:url({{_res_path}}/meta/character/{{char.name}}/face.png)"></span>
style="background-image:url({{_res_path}}/meta/character/{{char.name}}/face{{char.costume}}.png)"></span>
</div>
<span class="name">{{char.abbr}}</span>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 KiB

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 KiB

After

Width:  |  Height:  |  Size: 743 KiB

View File

@ -1,17 +1,17 @@
{
"name": "提纳里",
"abbr": "提纳里",
"id": "",
"title": "测试角色",
"id": 10000069,
"title": "浅蔚轻行",
"star": 5,
"elem": "dendro",
"allegiance": "",
"weapon": "Bow",
"britydah": "1 January",
"britydah": "12-29",
"astro": "郭狐座",
"cncv": "",
"jpcv": "",
"desc": "测试角色",
"cncv": "莫然",
"jpcv": "小林沙苗",
"desc": "精通植物学的少年学者,现于道成林任巡林官一职。直率热忱,擅长教导脑瓜糊涂的人。",
"lvStat": {
"lvs": [
"1",

View File

@ -1,17 +1,17 @@
{
"name": "柯莱",
"abbr": "柯莱",
"id": "",
"title": "测试角色",
"id": 10000067,
"title": "萃念初蘖",
"star": 4,
"elem": "dendro",
"allegiance": "",
"weapon": "Bow",
"britydah": "1 January",
"britydah": "05-08",
"astro": "薮猫座",
"cncv": "",
"jpcv": "",
"desc": "测试角色",
"cncv": "秦文静",
"jpcv": "前川凉子",
"desc": "活跃于道成林的见习巡林员,热情的言行背后是一颗依旧稍显内向的心。",
"lvStat": {
"lvs": [
"1",

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 KiB

After

Width:  |  Height:  |  Size: 754 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 KiB