diff --git a/apps/stat.js b/apps/stat.js index 9eab80ea..2f26ab21 100644 --- a/apps/stat.js +++ b/apps/stat.js @@ -35,9 +35,9 @@ app.reg({ desc: '上传深渊' }, RoleCombatSummary: { - rule: /^#*(喵喵|上传|本期)*(幻想|剧诗|幻想真境剧诗)[ |0-9]*(数据)?$/, + rule: /^#*(喵喵)*(幻想|幻境|剧诗|幻想真境剧诗)[ |0-9]*(数据)?$/, fn: RoleCombatSummary, - desc: '上传幻想真境剧诗' + desc: '幻想真境剧诗' } }) export default app diff --git a/apps/stat/RoleCombatSummary.js b/apps/stat/RoleCombatSummary.js index eeffcd47..58c4abb8 100644 --- a/apps/stat/RoleCombatSummary.js +++ b/apps/stat/RoleCombatSummary.js @@ -1,10 +1,9 @@ import lodash from 'lodash' -import HutaoApi from './HutaoApi.js' import { Cfg, Common, Data } from '#miao' -import { Role, Character, MysApi, Player } from '#miao.models' +import { RoleCombat, MysApi, Player } from '#miao.models' export async function RoleCombatSummary (e) { - let isMatch = /^#(喵喵|上传)(幻想|剧诗|幻想真境剧诗)(数据)?$/.test(e.original_msg || e.msg || '') + let isMatch = /^#(喵喵)*(幻想|幻境|剧诗|幻想真境剧诗)(数据)?$/.test(e.original_msg || e.msg || '') if (!Cfg.get('uploadRoleCombat', false) && !isMatch) { return false } @@ -15,7 +14,6 @@ export async function RoleCombatSummary (e) { } return false } - let ret = {} let uid = mys.uid let player = Player.create(e) let resDetail, resRole @@ -27,15 +25,6 @@ export async function RoleCombatSummary (e) { e.reply('暂未获得本期幻想真境剧诗挑战数据...') return true } - // TODO: What if CK is not used? - // else if (lvs && lvs.battles && lvs.battles.length === 0) { - // if (!mys.isSelfCookie) { - // if (isMatch) { - // e.reply(`请绑定ck后再使用${e.original_msg || e.msg}`) - // } - // return false - // } - // } resDetail = await mys.getCharacter() if (!resDetail || !resRole || !resDetail.avatars || resDetail.avatars.length <= 3) { @@ -44,102 +33,28 @@ export async function RoleCombatSummary (e) { } delete resDetail._res delete resRole._res - - // TOOD: upload HuTao API - ret = lvs - // ret = await HutaoApi.uploadData({ - // uid, - // resDetail, - // resRole: resRole - // }) } catch (err) { // console.log(err); } + // 更新player信息 player.setMysCharData(resDetail) - // TODO: HuTao API -// if (ret && ret.retcode === 0) { -// let stat = [] -// if (ret.data) { - if (resRole.data.length === 0) { - e.reply('暂未获得本期深渊挑战数据...') - return true - } - let role = new Role(resRole.data[0]) - let roleData = role.getData() - let ownAvatarIds = role.getOwnAvatars() - // let overview = ret.info || (await HutaoApi.getOverview())?.data || {} - // let addMsg = function (title, ds) { - // let tmp = {} - // if (!ds) { - // return false - // } - // if (!ds.avatarId && !ds.id) { - // return false - // } - // let char = Character.get(ds.avatarId || ds.id) - // tmp.title = title - // tmp.id = char.id - // tmp.value = `${(ds.value / 10000).toFixed(1)} W` - // let msg = [] - // tmp.msg = msg - // let pct = (percent, name) => { - // if (percent < 0.2) { - // msg.push({ - // title: '少于', - // value: (Math.max(0.1, 100 - percent * 100)).toFixed(1), - // name - // }) - // } else { - // msg.push({ - // title: '超过', - // value: (Math.min(99.9, percent * 100)).toFixed(1), - // name - // }) - // } - // } - // if (ds.percent) { - // pct(ds.percent, char.abbr) - // pct(ds.percentTotal, '总记录') - // } else { - // msg.push({ - // txt: '暂无统计信息' - // }) - // } - // stat.push(tmp) - // } - // addMsg('最强一击', ret.data?.damage || abyssData?.stat?.dmg || {}) - // addMsg('最高承伤', ret.data?.takeDamage || abyssData?.stat.takeDmg || {}) - // let abyssStat = abyssData?.stat || {} - // lodash.forEach({ defeat: '最多击破', e: '元素战技', q: '元素爆发' }, (title, key) => { - // if (abyssStat[key]) { - // stat.push({ - // title, - // id: abyssStat[key]?.id || 0, - // value: `${abyssStat[key]?.value}次` - // }) - // } else { - // stat.push({}) - // } - // }) - // await player.refreshTalent(avatarIds) - let ownAvatarData = player.getAvatarData(ownAvatarIds) - let otherAvatarData = role.getOtherAvatarsData() - - let avatarData = lodash.merge(ownAvatarData, otherAvatarData) - return await Common.render('stat/role-summary', { - role: roleData, - avatars: avatarData, - save_id: uid, - uid - }, { e, scale: 1.2 }) -// } else { -// e.reply('暂未获得本期深渊挑战数据...') -// return true -// } -// } else { -// e.reply(`${ret.message || '上传失败'},请稍后重试...`) -// } - return true + if (resRole.data.length === 0) { + e.reply('暂未获得本期深渊挑战数据...') + return true + } + let role = new RoleCombat(resRole.data[0]) + let roleData = role.getData() + let ownAvatarIds = role.getOwnAvatars() + let ownAvatarData = player.getAvatarData(ownAvatarIds) + let otherAvatarData = role.getOtherAvatarsData() + + let avatarData = lodash.merge(ownAvatarData, otherAvatarData) + return await Common.render('stat/role-summary', { + role: roleData, + avatars: avatarData, + save_id: uid, + uid + }, { e, scale: 1.2 }) } diff --git a/config/system/cfg_system.js b/config/system/cfg_system.js index a59036aa..821dc716 100644 --- a/config/system/cfg_system.js +++ b/config/system/cfg_system.js @@ -20,7 +20,7 @@ export const cfgSchema = { def: false, miao: true }, - uploadRoleCombat: { + roleCombat: { title: '#幻想', key: '幻想真境剧诗', def: false, diff --git a/models/Role.js b/models/RoleCombat.js similarity index 69% rename from models/Role.js rename to models/RoleCombat.js index 2396f3de..d5c326cd 100644 --- a/models/Role.js +++ b/models/RoleCombat.js @@ -5,51 +5,47 @@ import lodash from 'lodash' import moment from 'moment' -import Base from '../models/Base.js' -import Character from '../models/Character.js' +import Base from './Base.js' +import Character from './Character.js' import { Data } from '#miao' moment.locale('zh-cn') -export default class Role extends Base { +export default class RoleCombat extends Base { constructor (data) { super() this.rounds = {} lodash.forEach(data.detail.rounds_data, (round) => { let tmp = { - 'is_get_medal': round.is_get_medal, - 'choice_cards': round.choice_cards, - 'buffs': round.buffs, + is_get_medal: round.is_get_medal, + choice_cards: round.choice_cards, + buffs: round.buffs } let time = moment(new Date(round.finish_time * 1000)) tmp.finish_time = time.format('MM-DD HH:mm:ss') let avatars = [] lodash.forEach(round.avatars, (avatar) => { avatars.push({ - 'avatar_id': avatar.avatar_id.toString(), - 'name': avatar.name, - 'avatar_type': avatar.avatar_type, - 'level': avatar.level, + avatar_id: avatar.avatar_id.toString(), + name: avatar.name, + avatar_type: avatar.avatar_type, + level: avatar.level }) // avatar_type: // - 1: self // - 2: trial // - 3: friend support }) - + tmp.avatars = avatars this.rounds[round.round_id] = tmp }) this.stat = data.stat - this.schedule = data.schedule - let st = moment(new Date(data.schedule.start_time * 1000)) - this.start_time = st.format('YYYY.MM.DD') - st = moment(new Date(data.schedule.end_time * 1000)) - this.end_time = st.format('YYYY.MM.DD') + this.month = data.schedule.start_date_time.month } getData () { - return Data.getData(this, 'rounds,stat,schedule,start_time,end_time') + return Data.getData(this, 'rounds,stat,month') } getOwnAvatars () { @@ -70,8 +66,8 @@ export default class Role extends Base { lodash.forEach(round.avatars || [], (avatar) => { if (avatar.avatar_id && avatar.avatar_type != 1) { let character = new Character({ - 'id': +avatar.avatar_id, - 'name': avatar.name + id: +avatar.avatar_id, + name: avatar.name }) let detailInfo = character.getDetail() ret[avatar.avatar_id] = { @@ -88,7 +84,7 @@ export default class Role extends Base { face: character.face, qFace: character.qFace, side: character.side, - gacha: character.gacha, + gacha: character.gacha } } }) diff --git a/models/index.js b/models/index.js index 4e8c8cf7..f55166f1 100644 --- a/models/index.js +++ b/models/index.js @@ -4,7 +4,7 @@ import Character from './Character.js' import Artifact from './Artifact.js' import ArtifactSet from './ArtifactSet.js' import Abyss from './Abyss.js' -import Role from './Role.js' +import RoleCombat from './RoleCombat.js' import Player from './Player.js' import Avatar from './Avatar.js' import ProfileDmg from './ProfileDmg.js' @@ -31,7 +31,7 @@ for (let game of ['gs', 'sr']) { export { Base, Abyss, - Role, + RoleCombat, Button, Character, Artifact, diff --git a/resources/stat/imgs/medal.png b/resources/stat/imgs/medal.png new file mode 100644 index 00000000..a989179b Binary files /dev/null and b/resources/stat/imgs/medal.png differ diff --git a/resources/stat/imgs/nomedal.png b/resources/stat/imgs/nomedal.png new file mode 100644 index 00000000..6efeca72 Binary files /dev/null and b/resources/stat/imgs/nomedal.png differ diff --git a/resources/stat/imgs/role/buffs/1.png b/resources/stat/imgs/role/buffs/1.png deleted file mode 100644 index e1c2392c..00000000 Binary files a/resources/stat/imgs/role/buffs/1.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/10.png b/resources/stat/imgs/role/buffs/10.png deleted file mode 100644 index 79db453a..00000000 Binary files a/resources/stat/imgs/role/buffs/10.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/11.png b/resources/stat/imgs/role/buffs/11.png deleted file mode 100644 index b835b6e8..00000000 Binary files a/resources/stat/imgs/role/buffs/11.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/12.png b/resources/stat/imgs/role/buffs/12.png deleted file mode 100644 index 26eb5a70..00000000 Binary files a/resources/stat/imgs/role/buffs/12.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/13.png b/resources/stat/imgs/role/buffs/13.png deleted file mode 100644 index b012e559..00000000 Binary files a/resources/stat/imgs/role/buffs/13.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/14.png b/resources/stat/imgs/role/buffs/14.png deleted file mode 100644 index e403dcd2..00000000 Binary files a/resources/stat/imgs/role/buffs/14.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/15.png b/resources/stat/imgs/role/buffs/15.png deleted file mode 100644 index 14cab484..00000000 Binary files a/resources/stat/imgs/role/buffs/15.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/2.png b/resources/stat/imgs/role/buffs/2.png deleted file mode 100644 index 527bae87..00000000 Binary files a/resources/stat/imgs/role/buffs/2.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/23.png b/resources/stat/imgs/role/buffs/23.png deleted file mode 100644 index a1888eed..00000000 Binary files a/resources/stat/imgs/role/buffs/23.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/24.png b/resources/stat/imgs/role/buffs/24.png deleted file mode 100644 index 9efd0d90..00000000 Binary files a/resources/stat/imgs/role/buffs/24.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/25.png b/resources/stat/imgs/role/buffs/25.png deleted file mode 100644 index 87af2651..00000000 Binary files a/resources/stat/imgs/role/buffs/25.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/26.png b/resources/stat/imgs/role/buffs/26.png deleted file mode 100644 index 9287fd14..00000000 Binary files a/resources/stat/imgs/role/buffs/26.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/3.png b/resources/stat/imgs/role/buffs/3.png deleted file mode 100644 index f819e970..00000000 Binary files a/resources/stat/imgs/role/buffs/3.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/4.png b/resources/stat/imgs/role/buffs/4.png deleted file mode 100644 index 6af7baaf..00000000 Binary files a/resources/stat/imgs/role/buffs/4.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/6.png b/resources/stat/imgs/role/buffs/6.png deleted file mode 100644 index 44643839..00000000 Binary files a/resources/stat/imgs/role/buffs/6.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/8.png b/resources/stat/imgs/role/buffs/8.png deleted file mode 100644 index 3522ebfc..00000000 Binary files a/resources/stat/imgs/role/buffs/8.png and /dev/null differ diff --git a/resources/stat/imgs/role/buffs/9.png b/resources/stat/imgs/role/buffs/9.png deleted file mode 100644 index df1191e5..00000000 Binary files a/resources/stat/imgs/role/buffs/9.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/1.png b/resources/stat/imgs/role/choice_cards/1.png deleted file mode 100644 index c51249ae..00000000 Binary files a/resources/stat/imgs/role/choice_cards/1.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/1001.png b/resources/stat/imgs/role/choice_cards/1001.png deleted file mode 100644 index c9d7739e..00000000 Binary files a/resources/stat/imgs/role/choice_cards/1001.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/1002.png b/resources/stat/imgs/role/choice_cards/1002.png deleted file mode 100644 index c9d7739e..00000000 Binary files a/resources/stat/imgs/role/choice_cards/1002.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/1003.png b/resources/stat/imgs/role/choice_cards/1003.png deleted file mode 100644 index c9d7739e..00000000 Binary files a/resources/stat/imgs/role/choice_cards/1003.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/1004.png b/resources/stat/imgs/role/choice_cards/1004.png deleted file mode 100644 index c9d7739e..00000000 Binary files a/resources/stat/imgs/role/choice_cards/1004.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/2001.png b/resources/stat/imgs/role/choice_cards/2001.png deleted file mode 100644 index 7e727ebe..00000000 Binary files a/resources/stat/imgs/role/choice_cards/2001.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/2002.png b/resources/stat/imgs/role/choice_cards/2002.png deleted file mode 100644 index 7e727ebe..00000000 Binary files a/resources/stat/imgs/role/choice_cards/2002.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/2003.png b/resources/stat/imgs/role/choice_cards/2003.png deleted file mode 100644 index 7e727ebe..00000000 Binary files a/resources/stat/imgs/role/choice_cards/2003.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/2004.png b/resources/stat/imgs/role/choice_cards/2004.png deleted file mode 100644 index 7e727ebe..00000000 Binary files a/resources/stat/imgs/role/choice_cards/2004.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/3.png b/resources/stat/imgs/role/choice_cards/3.png deleted file mode 100644 index c51249ae..00000000 Binary files a/resources/stat/imgs/role/choice_cards/3.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/3002.png b/resources/stat/imgs/role/choice_cards/3002.png deleted file mode 100644 index e14d85b6..00000000 Binary files a/resources/stat/imgs/role/choice_cards/3002.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/4.png b/resources/stat/imgs/role/choice_cards/4.png deleted file mode 100644 index c51249ae..00000000 Binary files a/resources/stat/imgs/role/choice_cards/4.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/5.png b/resources/stat/imgs/role/choice_cards/5.png deleted file mode 100644 index c51249ae..00000000 Binary files a/resources/stat/imgs/role/choice_cards/5.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/6.png b/resources/stat/imgs/role/choice_cards/6.png deleted file mode 100644 index c51249ae..00000000 Binary files a/resources/stat/imgs/role/choice_cards/6.png and /dev/null differ diff --git a/resources/stat/imgs/role/choice_cards/7.png b/resources/stat/imgs/role/choice_cards/7.png deleted file mode 100644 index c51249ae..00000000 Binary files a/resources/stat/imgs/role/choice_cards/7.png and /dev/null differ diff --git a/resources/stat/imgs/role/star/nostar.png b/resources/stat/imgs/role/star/nostar.png deleted file mode 100644 index adbfac82..00000000 Binary files a/resources/stat/imgs/role/star/nostar.png and /dev/null differ diff --git a/resources/stat/imgs/role/star/star.png b/resources/stat/imgs/role/star/star.png deleted file mode 100644 index cfac3369..00000000 Binary files a/resources/stat/imgs/role/star/star.png and /dev/null differ diff --git a/resources/stat/role-summary.css b/resources/stat/role-summary.css index 7a39c688..7155ad11 100644 --- a/resources/stat/role-summary.css +++ b/resources/stat/role-summary.css @@ -44,9 +44,6 @@ body, width: 175px; height: 90px; } -.role-stat .cont.best-record { - width: 120px; -} .role-stat .cont.star-display { width: 230px; } @@ -93,39 +90,7 @@ body, width: 25px; height: 25px; background-size: cover; -} -.avatar-banner { - height: 100px; - width: 175px; - background-repeat: no-repeat; - background-size: 100% auto; - background-position: 0 10%; -} -.role-data { - display: flex; - padding: 0 6px; -} -.role-data .role-item { - color: #fff; - margin: 5px; -} -.role-data .role-item .info { - text-align: center; - text-shadow: 0 0 1px #000, 1px 1px 3px #000; -} -.role-data .role-item .info strong { - display: block; - font-weight: normal; - font-family: Number, "印品南征北战NZBZ体", NZBZ, "汉仪文黑-65W", YS, PingFangSC-Medium, "PingFang SC", sans-serif; -} -.role-data .role-item .info span { - font-size: 24px; - display: block; -} -.role-data .role-item .info span:after { - content: "次"; - font-size: 15px; - margin-left: 2px; + margin-top: 4px; } .role-title { margin: -3px 0 8px; @@ -133,6 +98,7 @@ body, align-items: flex-end; } .role-title strong { + margin-left: 3px; color: #d3bc8e; font-size: 18px; font-family: Number, "印品南征北战NZBZ体", NZBZ, "汉仪文黑-65W", YS, PingFangSC-Medium, "PingFang SC", sans-serif; @@ -140,8 +106,8 @@ body, margin-right: 10px; } .role-title .role-star { - width: 25px; - height: 25px; + width: 20px; + height: 20px; background-size: cover; } .role-floor-team { @@ -190,13 +156,8 @@ body, .role-buff .role-choice-cards-container .role-choice-cards-content .role-content-container { width: 40px; display: flex; - flex-direction: column; - align-items: center; - margin-right: 5px; -} -.role-buff .role-choice-cards-container .role-choice-cards-content .role-content-container-2 { - width: 65px; - display: flex; + margin-top: 5px; + margin-left: 5px; flex-direction: column; align-items: center; margin-right: 5px; @@ -208,139 +169,7 @@ body, background-color: black; border-radius: 50%; } -.role-buff .role-choice-cards-container .role-choice-cards-content .role-content-name { - width: 100%; - color: rgba(100, 100, 100, 0.5); - text-align: center; - font-size: 9px; -} .role-buff .role-choice-cards-container + .role-choice-cards-container { margin-top: 4%; /* 两个子元素之间的间距4% */ } -.role-detail { - display: flex; - width: calc(100% + 40px); - margin: 10px -15px -10px; -} -.role-level { - padding: 5px 10px 7px; - width: 33%; - box-shadow: 0 0 1px 0 #fff; -} -.role-level:nth-child(even) { - background: rgba(255, 255, 255, 0.1); -} -.role-level .info { - margin-bottom: 5px; - display: flex; - padding-left: 8px; -} -.role-level .title { - font-size: 16px; - white-space: nowrap; - font-weight: bold; -} -.role-level .star { - height: 18px; - display: inline-block; - background: url(./imgs/star.png); - background-size: 18px 18px; - margin-left: 5px; -} -.role-level .star.star1 { - width: 18px; - margin-right: 36px; -} -.role-level .star.star2 { - width: 36px; - margin-right: 18px; -} -.role-level .star.star3 { - width: 54px; - margin-right: 0; -} -.role-level .time { - text-align: right; - width: 60%; - color: #aaa; - font-size: 14px; -} -.role-level .avatars { - display: flex; - width: 100%; -} -.role-level .avatars .avatar-list { - display: flex; - position: relative; -} -.role-level .avatars .avatar-list.up { - padding-right: 15px; -} -.role-level .avatars .avatar-list.up:after { - content: ""; - display: block; - position: absolute; - width: 1px; - height: 16px; - background: rgba(255, 255, 255, 0.3); - right: 8px; - top: 50%; - margin-top: -8px; -} -.role-level .avatars .avatar-icon { - width: 33px; - height: 33px; - border-radius: 50%; - margin-right: 2px; -} -.role-level .avatars .avatar-icon .img { - background-size: auto 100%; - background-position: center; - width: 29px; - height: 29px; - margin: 2px; -} -.role-notice .cont-body { - font-size: 16px; -} -.avatar-banner.avatar-枫原万叶, -.img.wide.avatar-枫原万叶 { - background-position: 0 -13%; -} -.avatar-banner.avatar-九条裟罗, -.img.wide.avatar-九条裟罗 { - background-position: 0 0; -} -.avatar-banner.avatar-香菱, -.img.wide.avatar-香菱 { - background-position: 0 -16%; -} -.avatar-banner.avatar-行秋, -.img.wide.avatar-行秋 { - background-position: 0 -16%; -} -.avatar-banner.avatar-甘雨, -.img.wide.avatar-甘雨 { - background-position: 0 -8%; -} -.avatar-banner.avatar-刻晴, -.img.wide.avatar-刻晴 { - background-position: 0 -5%; -} -.avatar-banner.avatar-神里绫华, -.img.wide.avatar-神里绫华 { - background-position: 0 13%; -} -.avatar-banner.avatar-班尼特, -.img.wide.avatar-班尼特 { - background-position: 0 15%; -} -.avatar-banner.avatar-五郎, -.img.wide.avatar-五郎 { - background-position: 0 15%; -} -.avatar-banner.avatar-托马, -.img.wide.avatar-托马 { - background-position: 0 -5%; -} diff --git a/resources/stat/role-summary.html b/resources/stat/role-summary.html index e616aace..3e5fbde8 100644 --- a/resources/stat/role-summary.html +++ b/resources/stat/role-summary.html @@ -9,22 +9,12 @@ {{block 'main'}} {{ set difficultyName = {1:'简单', 2:'普通', 3:'困难'} }}