diff --git a/apps/profile/ProfileRank.js b/apps/profile/ProfileRank.js
index 9c5abb57..6956f94f 100644
--- a/apps/profile/ProfileRank.js
+++ b/apps/profile/ProfileRank.js
@@ -122,12 +122,13 @@ export async function refreshRank (e) {
return true
}
e.reply('面板数据刷新中,等待时间可能较长,请耐心等待...')
+ let game = e.isSr ? 'sr' : 'gs'
await ProfileRank.resetRank(groupId)
- let groupUids = await Common.getGroupUids(e)
+ let groupUids = await Common.getGroupUids(e, game)
let count = 0
for (let qq in groupUids) {
for (let { uid, type } of groupUids[qq]) {
- let player = new Player(uid)
+ let player = new Player(uid, game)
let profiles = player.getProfiles()
// 刷新rankLimit
await ProfileRank.setUidInfo({ uid, profiles, qq, uidType: type })
diff --git a/apps/wiki/CharTalent.js b/apps/wiki/CharTalent.js
index 4bf4b5fa..1b97569c 100644
--- a/apps/wiki/CharTalent.js
+++ b/apps/wiki/CharTalent.js
@@ -7,9 +7,26 @@ const CharTalent = {
for (let i = 1; i <= 15; i++) {
lvs.push('Lv' + i)
}
+ let detail = lodash.extend({}, char.getDetail())
+ if (char.game === 'sr') {
+ lodash.forEach(['cons', 'talent', 'treeData'], (key) => {
+ lodash.forEach(detail[key], (ds, idx) => {
+ if (ds.desc) {
+ if (key === 'talent') {
+ let desc = CharTalent.getDesc(ds.desc, ds.tables, idx === 'a' ? 5 : 8)
+ ds.desc = desc.desc
+ ds.tables = desc.tables
+ } else if (ds.desc.split) {
+ ds.desc = ds.desc.split('
')
+ }
+ }
+ })
+ })
+ }
return await Common.render('wiki/character-talent', {
saveId: `${mode}-${char.id}`,
...char.getData(),
+ game: char.game,
detail: char.getDetail(),
imgs: char.getImgs(),
mode,
@@ -18,6 +35,9 @@ const CharTalent = {
}, { e, scale: 1.1 })
},
getLineData (char) {
+ if (char.isSr) {
+ return []
+ }
let ret = []
const attrMap = {
atkPct: '大攻击',
@@ -43,6 +63,45 @@ const CharTalent = {
label: `成长·${attrMap[ga.key]}`
})
return ret
+ },
+ // 获取精炼描述
+ getDesc (desc, tables, lv = 5) {
+ let reg = /\$(\d)\[[i|f1]\](\%?)/g
+ let ret
+
+ let idxFormat = {}
+ while ((ret = reg.exec(desc)) !== null) {
+ let idx = ret[1]
+ let pct = ret[2]
+ let value = tables?.[idx - 1]?.values[lv - 1]
+ if (value) {
+ if (pct === '%') {
+ idxFormat[idx - 1] = 'percent'
+ value = Format.percent(value)
+ } else {
+ idxFormat[idx - 1] = 'comma'
+ value = Format.comma(value)
+ }
+ value = value + ` (lv${lv})`
+ desc = desc.replaceAll(ret[0], value)
+ }
+ }
+ let tableRet = []
+ lodash.forEach(tables, (ds, idx) => {
+ let values = []
+ lodash.forEach(ds.values, (v) => {
+ values.push(Format[idxFormat[idx] || 'comma'](v))
+ })
+ tableRet.push({
+ name: ds.name,
+ isSame: ds.isSame,
+ values
+ })
+ })
+ return {
+ desc: desc.split('
'),
+ tables: tableRet
+ }
}
}
diff --git a/components/Common.js b/components/Common.js
index 2b243358..f11fa4f6 100644
--- a/components/Common.js
+++ b/components/Common.js
@@ -14,21 +14,20 @@ const Common = {
console.log('down file')
},
- async getNoteQQUids (e) {
+ async getNoteQQUids (e, game='gs') {
let ret = {}
if (Version.isV3) {
if (e.runtime) {
- let noteCks = await e.runtime?.gsCfg?.getBingCk() || {}
- lodash.forEach(noteCks, (cks, qq) => {
- lodash.forEach(cks, (ck) => {
- let { qq, uid } = ck
- if (qq && uid) {
- ret[qq] = ret[qq] || []
- if (!ret[qq].includes(uid)) {
- ret[qq].push(uid)
- }
+ let noteCks = await e.runtime?.gsCfg?.getBingCk(game) || {}
+ lodash.forEach(noteCks.ck, (ck, _qq) => {
+ let qq = ck.qq || _qq
+ let uid = ck.uid
+ if (qq && uid) {
+ ret[qq] = ret[qq] || []
+ if (!ret[qq].includes(uid)) {
+ ret[qq].push(uid)
}
- })
+ }
})
}
} else {
@@ -43,7 +42,11 @@ const Common = {
return ret
},
- async getBindUid (qq) {
+ async getBindUid (qq, runtime, game = 'gs') {
+ if (Version.isMiao && runtime.NoteUser) {
+ let user = await runtime.NoteUser.create(qq)
+ return user ? user.getUid(game) : false
+ }
if (Version.isV3) {
return await redis.get(`Yz:genshin:mys:qq-uid:${qq}`)
} else {
@@ -51,9 +54,9 @@ const Common = {
}
},
- async getGroupUids (e) {
+ async getGroupUids (e, game = 'gs') {
// 获取ck用户列表
- let noteUids = await Common.getNoteQQUids(e)
+ let noteUids = await Common.getNoteQQUids(e, game)
let ret = {}
let uidMap = {}
@@ -78,7 +81,7 @@ const Common = {
if (ret[qq]) {
continue
}
- let uid = await Common.getBindUid(qq)
+ let uid = await Common.getBindUid(qq, e.runtime, game)
if (uid && !uidMap[uid]) {
ret[qq] = [{
uid,
diff --git a/resources/common/tpl/talent-detail.html b/resources/common/tpl/talent-detail.html
index 77d2e75a..838a0785 100644
--- a/resources/common/tpl/talent-detail.html
+++ b/resources/common/tpl/talent-detail.html
@@ -1,61 +1,61 @@
{{set ds = $data[0] || false }}
-{{set {_res_path, icon,lvs,type} = $data[1]}}
+{{set {_res_path, icon,lvs,type,game,minLv,maxLv} = $data[1]}}
{{d}}
- {{/if}} - {{/each}} -{{d}}
+ {{/if}} + {{/each}}- {{each lvs lv idx}} - {{if (type=="a" && idx>4 && idx<11) || (type!="a" && idx>4 && idx < 13)}} - | {{lv}} | - {{/if}} - {{/each}} -
- {{tr.name}} - {{if tr.unit}} - ({{tr.unit}}) - {{/if}} - | - - {{each tr.values v idx}} - {{if (type=="a" && idx>4 && idx<11) || (type!="a" && idx>4 && idx < 13)}} -{{v}} | - {{/if}} - {{/each}} - {{/if}} -
{{minLv}} {{maxLv}} | + {{each lvs lv idx}} + {{if idx+1 >= minLv && idx+1 <= maxLv }} +{{lv}} | + {{/if}} + {{/each}} +
+ {{tr.name}} + {{if tr.unit}} + ({{tr.unit}}) + {{/if}} + | + + {{each tr.values v idx}} + {{if idx+1 >= minLv && idx+1 <= maxLv }} +{{v}} | + {{/if}} + {{/each}} + {{/if}} +