diff --git a/apps/profile.js b/apps/profile.js index 09914753..34f290a4 100644 --- a/apps/profile.js +++ b/apps/profile.js @@ -72,7 +72,7 @@ app.reg({ profileStat: { name: '面板练度统计', fn: ProfileStat.stat, - rule: /^#(面板|喵喵)练度统计$/, + rule: /^#(星铁|原神)?(面板|喵喵)?练度统计$/, yzRule: /^#*(我的)*(武器|角色|练度|五|四|5|4|星)+(汇总|统计|列表)(force|五|四|5|4|星)*[ |0-9]*$/, yzCheck: () => Cfg.get('profileStat', false) }, @@ -94,7 +94,7 @@ app.reg({ refreshTalent: { name: '强制刷新天赋', fn: ProfileStat.refreshTalent, - rule: /^#(强制)?(刷新|更新)(所有|角色)*(天赋|技能)$/ + rule: /^#(星铁|原神)?(强制)?(刷新|更新)(所有|角色)*(天赋|技能)$/ }, profileHelp: { diff --git a/apps/profile/ProfileStat.js b/apps/profile/ProfileStat.js index f947e909..cd839572 100644 --- a/apps/profile/ProfileStat.js +++ b/apps/profile/ProfileStat.js @@ -13,23 +13,32 @@ const ProfileStat = { }, async refreshTalent (e) { + let game = /星铁/.test(e.msg) ? 'sr' : 'gs' + e.isSr = game === 'sr' + let mys = await MysApi.init(e) if (!mys || !mys.uid) return false - let player = Player.create(e) + let player = Player.create(e, game) let refreshCount = await player.refreshTalent('', 2) - if (refreshCount) { + if (refreshCount && !e.isSr) { e.reply(`角色天赋更新成功,共${refreshCount}个角色\n你现在可以通过【#练度统计】【#天赋统计】来查看角色信息了...`) + } else if (e.isSr) { + e.reply(`角色天赋更新成功,共${refreshCount}个角色\n你现在可以通过【*练度统计】来查看角色信息了...`) } else { e.reply('角色天赋未能更新...') } }, // 渲染 - // isAvatarList true:角色列表 false练度统计 + // mode stat:练度统计 avatar:角色列表 talent:天赋统计 async render (e, mode = 'stat') { + let game = /星铁/.test(e.msg) ? 'sr' : 'gs' + e.isSr = game === 'sr' + e.game = game + // 缓存时间,单位小时 - let msg = e.msg.replace('#', '').trim() + let msg = e.msg.replace(/#星铁|#/, '').trim() if (msg === '角色统计' || msg === '武器统计') { // 暂时避让一下抽卡分析的关键词 return false @@ -39,13 +48,12 @@ const ProfileStat = { mode = 'talent' } - let mys = await MysApi.init(e) if (!mys || !mys.uid) return false const uid = mys.uid - let player = Player.create(e) + let player = Player.create(e, game) let avatarRet = await player.refreshAndGetAvatarData({ index: 2, @@ -112,7 +120,6 @@ const ProfileStat = { goldCount: '金卡总数' } - let tpl = mode === 'avatar' ? 'character/avatar-list' : 'character/profile-stat' return await Common.render(tpl, { save_id: uid, @@ -123,7 +130,8 @@ const ProfileStat = { face, mode, week, - avatars: avatarRet + avatars: avatarRet, + game }, { e, scale: 1.4 }) } } diff --git a/models/Avatar.js b/models/Avatar.js index 18d14a2e..23453adc 100644 --- a/models/Avatar.js +++ b/models/Avatar.js @@ -206,7 +206,7 @@ export default class Avatar extends Base { level: ds.level || ds.lv || 1, promote: lodash.isUndefined(ds.promote) ? Attr.calcPromote(ds.level || ds.lv || 1) : (ds.promote || 0), affix: ds.affix, - ...w.getData('star,abbr,type,img') + ...w.getData('star,abbr,type,img,imgs') } if (this.weapon.level < 20) { this.weapon.promote = 0 diff --git a/models/MysApi.js b/models/MysApi.js index 62d71cf6..05491759 100644 --- a/models/MysApi.js +++ b/models/MysApi.js @@ -3,7 +3,7 @@ import { Version } from '#miao' import { Button } from '#miao.models' export default class MysApi { - constructor (e, uid, mysInfo) { + constructor(e, uid, mysInfo) { this.e = e this.mysInfo = mysInfo this.ckInfo = mysInfo.ckInfo @@ -82,7 +82,7 @@ export default class MysApi { if (this.mys) { return this.mys } - this.mys = await e.runtime.getMysApi(targetType, option) + this.mys = await e.runtime.getMysApi(targetType, option, e.isSr) return this.mys } @@ -146,6 +146,7 @@ export default class MysApi { } async getDetail (id) { + if (this.e.isSr) { return await this.getData('detail', { avatar_id: id, tab_from: 'TabOwned' }) } return await this.getData('detail', { avatar_id: id }) } diff --git a/models/Player.js b/models/Player.js index 2520b242..e3c41a8f 100644 --- a/models/Player.js +++ b/models/Player.js @@ -17,7 +17,7 @@ Data.createDir('/data/PlayerData/gs', 'root') Data.createDir('/data/PlayerData/sr', 'root') export default class Player extends Base { - constructor (uid, game = 'gs') { + constructor(uid, game = 'gs') { super() uid = uid?._mys?.uid || uid?.uid || uid if (!uid) { @@ -381,6 +381,9 @@ export default class Player extends Base { let { talent } = avatar let ds = avatar.getDetail() ds.aeq = talent?.a?.original + talent?.e?.original + talent?.q?.original || 3 + if (avatar.game === 'sr') { + ds.aeq = talent?.a?.original + talent?.e?.original + talent?.q?.original + talent?.t?.original || 4 + } avatarRet[ds.id] = ds let profile = avatar.getProfile() @@ -407,6 +410,4 @@ export default class Player extends Base { } return avatarRet } - - } diff --git a/models/Weapon.js b/models/Weapon.js index 6ed3711f..0f5d72ee 100644 --- a/models/Weapon.js +++ b/models/Weapon.js @@ -1,12 +1,11 @@ import Base from './Base.js' import { Data, Format, Meta } from '#miao' +import lodash from 'lodash' let weaponSet -import lodash from 'lodash' - class Weapon extends Base { - constructor (meta, game = 'gs') { + constructor(meta, game = 'gs') { if (!meta || !meta.name) { return false } @@ -309,7 +308,6 @@ class Weapon extends Base { if (!tables[ds.idx]) return true ds.data[ds.key] = tables[ds.idx] } else if (ds.refine) { - lodash.forEach(ds.refine, (r, key) => { ds.data[key] = ({ refine }) => r[refine] * (ds.buffCount || 1) }) diff --git a/models/avatar/MysAvatar.js b/models/avatar/MysAvatar.js index ee60630b..844cc239 100644 --- a/models/avatar/MysAvatar.js +++ b/models/avatar/MysAvatar.js @@ -17,13 +17,6 @@ const MysAvatar = { return force } return force - // 暂时不处理ck变更 - player._info = 0 - player._mys = 0 - player.forEachAvatar((avatar) => { - avatar._talent = 0 - }) - return 2 }, /** * 更新米游社角色信息 @@ -241,7 +234,8 @@ const MysAvatar = { let id = char.id let talent = {} let talentRes = await mys.getDetail(id) - if (talentRes && talentRes.skill_list) { + let game = avatar.game + if (game === 'gs' && talentRes && talentRes.skill_list) { let talentList = lodash.orderBy(talentRes.skill_list, ['id'], ['asc']) for (let val of talentList) { let { max_level: maxLv, level_current: lv } = val @@ -257,6 +251,27 @@ const MysAvatar = { talent.q = lv } } + } else if (game === 'sr' && talentRes && talentRes.skills) { + let talentList = lodash.orderBy(talentRes.skills, ['point_id'], ['asc']) + for (let val of talentList) { + let { cur_level: lv, anchor } = val + if (anchor.includes('Point01')) { + talent.a = lv + continue + } + if (anchor.includes('Point02')) { + talent.e = lv + continue + } + if (anchor.includes('Point03')) { + talent.q = lv + continue + } + if (anchor.includes('Point04')) { + talent.t = lv + continue + } + } } let ret = char.getAvatarTalent(talent, avatar.cons, 'original') avatar.setTalent(ret, 'original', true) diff --git a/resources/character/imgs/bg-02.jpg b/resources/character/imgs/bg-02.jpg new file mode 100644 index 00000000..7ddfa5eb Binary files /dev/null and b/resources/character/imgs/bg-02.jpg differ diff --git a/resources/character/imgs/main-02.png b/resources/character/imgs/main-02.png new file mode 100644 index 00000000..e902e863 Binary files /dev/null and b/resources/character/imgs/main-02.png differ diff --git a/resources/character/profile-stat.css b/resources/character/profile-stat.css index 9417735e..d901b6e6 100644 --- a/resources/character/profile-stat.css +++ b/resources/character/profile-stat.css @@ -1,11 +1,3 @@ -body { - background: url('./imgs/bg-01.jpg') left center; - background-size: 100% auto; -} -.container { - background: url('./imgs/main-01.png') center -25px no-repeat; - background-size: 100% auto; -} .head-box { margin-top: 0; } @@ -266,6 +258,10 @@ body { .cont .tr .lv5.talent-plus { color: #b70000; } +.cont .tr .lv5.crown-sr { + background: url("../common/item/crown-sr-o.png") center center no-repeat rgba(255, 36, 26, 0.55); + background-size: contain; +} .cont .td-artis { width: 115px; text-align: left; @@ -392,4 +388,3 @@ body { .cont-notice span { margin-left: 5px; } -/*# sourceMappingURL=profile-stat.css.map */ \ No newline at end of file diff --git a/resources/character/profile-stat.html b/resources/character/profile-stat.html index ec084c5d..c903782b 100644 --- a/resources/character/profile-stat.html +++ b/resources/character/profile-stat.html @@ -1,14 +1,41 @@ {{extend defaultLayout}} +{{set isSr = game === 'sr'}} + {{block 'css'}} - +{{if isSr}} + +{{else}} + +{{/if}} + {{/block}} - {{block 'main'}} +
-
#面板练度统计
-
UID:{{uid}} 共{{avatars.length }}名角色
+
{{isSr?'*':'#'}}面板练度统计
+
UID:{{uid}} 共{{avatars.length}}名角色
@@ -17,23 +44,28 @@
#
角色
Lv
-
命座
+
{{isSr?'星魂':'命座'}}
+ {{if !isSr}}
好感
+ {{/if}}
A
E
Q
+ {{if isSr}} +
T
+ {{/if}} {{if mode === 'talent'}}
周本
天赋书
{{else}} -
武器
-
圣遗物
+
{{isSr?'光锥':'武器'}}
+
{{isSr?'遗器':'圣遗物'}}
{{/if}}
{{each avatars avatar idx}} {{set talent = avatar.talent}} {{set weapon = avatar.weapon}} - {{set tk = ['a','e','q'] }} + {{set tk = isSr?['a','e','q','t']:['a','e','q']}}
{{idx+1}}
@@ -49,15 +81,26 @@
{{avatar.cons}}
+ {{if !isSr}}
+ {{/if}} {{set talentLvMap = [0,1,1,1,2,2,3,3,3,4,5] }} + {{set talentALvMap = [0,1,1,2,3,4,5]}} {{each tk talentKey}} {{set curr = (avatar.talent||{})[talentKey] || {original:1,level:'-'} }} -
+ {{if isSr && talentKey === 'a'}} +
{{curr.level}}
+ {{else}} +
+ {{curr.level}} +
+ {{/if}} {{/each}} {{if mode === 'talent'}} {{set m = avatar.materials || {} }} @@ -81,7 +124,8 @@
{{weapon.level}}
- +
{{weapon.affix}} {{weapon.abbr}} @@ -118,19 +162,19 @@ {{if ut.profile || ut.mys}} 数据更新时间 {{if ut.profile}} - #更新面板: {{ut.profile}} + {{isSr?'*':'#'}}更新面板: {{ut.profile}} {{/if}} {{if ut.mys}} 米游社: {{ut.mys}}
- 天赋数据每2小时最多更新一次,可通过#刷新天赋来强制刷新天赋数据,需具备有效CK + 天赋数据每2小时最多更新一次,可通过{{isSr?'*':'#'}}刷新天赋来强制刷新天赋数据,需具备有效CK
{{/if}} {{else}} - 未绑定CK或CK失效,信息可能不完全。发送#体力帮助查看CK绑定方法,发送#更新面板更新游戏内角色展柜信息 + 未绑定CK或CK失效,信息可能不完全。发送#体力帮助查看CK绑定方法,发送{{isSr?'*':'#'}}更新面板更新游戏内角色展柜信息 {{/if}}
-{{/block}} +{{/block}} \ No newline at end of file diff --git a/resources/character/profile-stat.less b/resources/character/profile-stat.less index bd233786..17486886 100644 --- a/resources/character/profile-stat.less +++ b/resources/character/profile-stat.less @@ -1,13 +1,3 @@ -body { - background: url('./imgs/bg-01.jpg') left center; - background-size: 100% auto; -} - -.container { - background: url('./imgs/main-01.png') center -25px no-repeat; - background-size: 100% auto; -} - .head-box { margin-top: 0; } @@ -57,7 +47,8 @@ body { font-size: 14px; background: none; - .cons, .level { + .cons, + .level { height: 22px; line-height: 22px; display: inline-block; @@ -89,7 +80,7 @@ body { background: rgba(0, 0, 0, .4); font-weight: bold; - & > div { + &>div { box-shadow: 0 0 1px 0 rgba(255, 255, 255, .7); text-align: center; } @@ -107,7 +98,7 @@ body { box-shadow: 0 0 1px 0 rgba(100, 100, 100, .3) inset; } - .star(@s, @color, @color2:#333) { + .star(@s, @color, @color2: #333) { .td.star@{s} { background: @color; @@ -116,6 +107,7 @@ body { } } } + .star(1, rgba(200, 200, 200, 0.35)); .star(2, rgba(168, 255, 133, 0.35)); .star(3, rgba(137, 168, 255, 0.35)); @@ -125,7 +117,7 @@ body { &.thead { background: rgba(0, 0, 0, 0.5) !important; - & > div { + &>div { color: #d3bc8e !important; } } @@ -138,7 +130,7 @@ body { background: rgba(240, 240, 240, 1); } - & > div { + &>div { text-align: center; height: 36px; vertical-align: middle; @@ -248,9 +240,7 @@ body { } } - .td-talent { - - } + .td-talent {} .talent-plus { font-weight: bold; @@ -259,7 +249,7 @@ body { text-shadow: 0px 0px 1px #fff; } - .lv(@lv, @c1, @c2:#333) { + .lv(@lv, @c1, @c2: #333) { .lv@{lv} { background: @c1; @@ -268,6 +258,7 @@ body { } } } + .lv(1, rgba(60, 63, 65, .3)); .lv(2, rgba(23, 184, 58, .5), #005800); .lv(3, rgba(27, 128, 212, .5)); @@ -280,6 +271,11 @@ body { &.talent-plus { color: #b70000; } + + &.crown-sr { + background: url("../common/item/crown-sr-o.png") center center no-repeat rgba(255, 36, 26, .55); + background-size: contain; + } } @@ -298,7 +294,9 @@ body { text-align: left; &.class- { - &ACE, &MAX { + + &ACE, + &MAX { background: rgba(255, 228, 180, .5); .artis-mark-class { @@ -306,7 +304,8 @@ body { } } - &SSS, &SS { + &SSS, + &SS { background: rgba(223, 190, 255, .5); .artis-mark-class { @@ -314,7 +313,8 @@ body { } } - &S, &A { + &S, + &A { background: rgba(190, 208, 255, .5); .artis-mark-class { @@ -322,7 +322,9 @@ body { } } - &B, &C, &D { + &B, + &C, + &D { background: rgba(171, 171, 171, .5); .artis-mark-class { @@ -410,7 +412,8 @@ body { text-align: left !important; } - .td-weekly, .td-material { + .td-weekly, + .td-material { &.today { background: rgba(255, 212, 132, 0.35); @@ -442,4 +445,4 @@ body { span { margin-left: 5px; } -} +} \ No newline at end of file diff --git a/resources/common/item/crown-sr-o.png b/resources/common/item/crown-sr-o.png new file mode 100644 index 00000000..d656167a Binary files /dev/null and b/resources/common/item/crown-sr-o.png differ