diff --git a/CHANGELOG.md b/CHANGELOG.md index 3df0efd9..59b565c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 1.10.1 + +* `#刻晴面板`、`#芭芭拉圣遗物`支持展示角色时装 + * 如果角色装备了时装,面板的角色图会展示时装立绘 + * 需要重新`#更新面板`以获取时装数据 + # 1.10.0 * 新增`#面板练度统计`功能 diff --git a/apps/character/profile-artis.js b/apps/character/profile-artis.js index 4031fe01..1f22641c 100644 --- a/apps/character/profile-artis.js +++ b/apps/character/profile-artis.js @@ -36,6 +36,7 @@ export async function profileArtis (e) { uid, elem: char.elem, data: profile, + costume: profile.costume ? '2' : '', artis, totalMark, totalMarkClass, diff --git a/apps/character/profile-detail.js b/apps/character/profile-detail.js index 6cac5740..304a1d17 100644 --- a/apps/character/profile-detail.js +++ b/apps/character/profile-detail.js @@ -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 }) } diff --git a/apps/character/profile-list.js b/apps/character/profile-list.js index 00148884..9ba7ef4b 100644 --- a/apps/character/profile-list.js +++ b/apps/character/profile-list.js @@ -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++ diff --git a/components/Common.js b/components/Common.js index 8e1bab63..84774f08 100644 --- a/components/Common.js +++ b/components/Common.js @@ -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${Version.yunzai} & Miao-Plugin${Version.version}` } } + 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) { diff --git a/components/profile-data/enka-data.js b/components/profile-data/enka-data.js index 992a8f81..30fae6ca 100644 --- a/components/profile-data/enka-data.js +++ b/components/profile-data/enka-data.js @@ -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)) diff --git a/components/profile-data/miao-data.js b/components/profile-data/miao-data.js index c562cf6d..d7e04cef 100644 --- a/components/profile-data/miao-data.js +++ b/components/profile-data/miao-data.js @@ -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)) diff --git a/models/Character.js b/models/Character.js index 565bbd54..8f409ada 100644 --- a/models/Character.js +++ b/models/Character.js @@ -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) { diff --git a/models/ProfileData.js b/models/ProfileData.js index b38a4f28..8c5c03a9 100644 --- a/models/ProfileData.js +++ b/models/ProfileData.js @@ -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 () { diff --git a/resources/character/artis-mark.html b/resources/character/artis-mark.html index ac71f67d..07293ef2 100644 --- a/resources/character/artis-mark.html +++ b/resources/character/artis-mark.html @@ -13,7 +13,7 @@ {{block 'main'}}
+ style="background-image:url({{_res_path}}/meta/character/{{data.name}}/gacha_splash{{costume}}.png)">
{{data.name}}
UID {{uid}} - Lv.{{data.level}} diff --git a/resources/character/profile-detail.css b/resources/character/profile-detail.css index 7a3b3f55..b5e054d1 100644 --- a/resources/character/profile-detail.css +++ b/resources/character/profile-detail.css @@ -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 */ \ No newline at end of file diff --git a/resources/character/profile-detail.html b/resources/character/profile-detail.html index 700659fc..ddb44633 100644 --- a/resources/character/profile-detail.html +++ b/resources/character/profile-detail.html @@ -11,7 +11,7 @@ {{block 'main'}}
+ style="background-image:url({{_res_path}}/meta/character/{{name}}/gacha_splash{{costume}}.png)">
{{name}}
UID {{uid}} - Lv.{{data.level}} diff --git a/resources/character/profile-detail.less b/resources/character/profile-detail.less index 12fea444..820f6800 100644 --- a/resources/character/profile-detail.less +++ b/resources/character/profile-detail.less @@ -899,4 +899,28 @@ body { .char-班尼特 .main-pic { margin-left: -220px; -} \ No newline at end of file +} + +.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; +} diff --git a/resources/character/profile-list.html b/resources/character/profile-list.html index 95c8123e..d0f49cc9 100644 --- a/resources/character/profile-list.html +++ b/resources/character/profile-list.html @@ -23,7 +23,7 @@
+ style="background-image:url({{_res_path}}/meta/character/{{char.name}}/face{{char.costume}}.png)">
{{char.abbr}}
diff --git a/resources/meta/character/凝光/gacha_splash2.png b/resources/meta/character/凝光/gacha_splash2.png index 32bbed77..c621aba9 100644 Binary files a/resources/meta/character/凝光/gacha_splash2.png and b/resources/meta/character/凝光/gacha_splash2.png differ diff --git a/resources/meta/character/刻晴/gacha_splash2.png b/resources/meta/character/刻晴/gacha_splash2.png index 7702fb08..fdb7871a 100644 Binary files a/resources/meta/character/刻晴/gacha_splash2.png and b/resources/meta/character/刻晴/gacha_splash2.png differ diff --git a/resources/meta/character/提纳里/data.json b/resources/meta/character/提纳里/data.json index e34e703e..e5461a5e 100644 --- a/resources/meta/character/提纳里/data.json +++ b/resources/meta/character/提纳里/data.json @@ -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", diff --git a/resources/meta/character/柯莱/data.json b/resources/meta/character/柯莱/data.json index 2fd9d21d..01eaf0c0 100644 --- a/resources/meta/character/柯莱/data.json +++ b/resources/meta/character/柯莱/data.json @@ -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", diff --git a/resources/meta/character/空/gacha_splash.png b/resources/meta/character/空/gacha_splash.png new file mode 100644 index 00000000..631599c3 Binary files /dev/null and b/resources/meta/character/空/gacha_splash.png differ diff --git a/resources/meta/character/芭芭拉/gacha_splash2.png b/resources/meta/character/芭芭拉/gacha_splash2.png index fdbce844..17d56cdf 100644 Binary files a/resources/meta/character/芭芭拉/gacha_splash2.png and b/resources/meta/character/芭芭拉/gacha_splash2.png differ diff --git a/resources/meta/character/荧/gacha_splash.png b/resources/meta/character/荧/gacha_splash.png new file mode 100644 index 00000000..5ec0f73d Binary files /dev/null and b/resources/meta/character/荧/gacha_splash.png differ