一些已知问题修正

This commit is contained in:
Kokomi 2023-05-31 03:16:44 +08:00
parent bf80f783dd
commit c06233e86a
7 changed files with 145 additions and 86 deletions

View File

@ -122,12 +122,13 @@ export async function refreshRank (e) {
return true return true
} }
e.reply('面板数据刷新中,等待时间可能较长,请耐心等待...') e.reply('面板数据刷新中,等待时间可能较长,请耐心等待...')
let game = e.isSr ? 'sr' : 'gs'
await ProfileRank.resetRank(groupId) await ProfileRank.resetRank(groupId)
let groupUids = await Common.getGroupUids(e) let groupUids = await Common.getGroupUids(e, game)
let count = 0 let count = 0
for (let qq in groupUids) { for (let qq in groupUids) {
for (let { uid, type } of groupUids[qq]) { for (let { uid, type } of groupUids[qq]) {
let player = new Player(uid) let player = new Player(uid, game)
let profiles = player.getProfiles() let profiles = player.getProfiles()
// 刷新rankLimit // 刷新rankLimit
await ProfileRank.setUidInfo({ uid, profiles, qq, uidType: type }) await ProfileRank.setUidInfo({ uid, profiles, qq, uidType: type })

View File

@ -7,9 +7,26 @@ const CharTalent = {
for (let i = 1; i <= 15; i++) { for (let i = 1; i <= 15; i++) {
lvs.push('Lv' + 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('<br>')
}
}
})
})
}
return await Common.render('wiki/character-talent', { return await Common.render('wiki/character-talent', {
saveId: `${mode}-${char.id}`, saveId: `${mode}-${char.id}`,
...char.getData(), ...char.getData(),
game: char.game,
detail: char.getDetail(), detail: char.getDetail(),
imgs: char.getImgs(), imgs: char.getImgs(),
mode, mode,
@ -18,6 +35,9 @@ const CharTalent = {
}, { e, scale: 1.1 }) }, { e, scale: 1.1 })
}, },
getLineData (char) { getLineData (char) {
if (char.isSr) {
return []
}
let ret = [] let ret = []
const attrMap = { const attrMap = {
atkPct: '大攻击', atkPct: '大攻击',
@ -43,6 +63,45 @@ const CharTalent = {
label: `成长·${attrMap[ga.key]}` label: `成长·${attrMap[ga.key]}`
}) })
return ret 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('<br>'),
tables: tableRet
}
} }
} }

View File

@ -14,14 +14,14 @@ const Common = {
console.log('down file') console.log('down file')
}, },
async getNoteQQUids (e) { async getNoteQQUids (e, game='gs') {
let ret = {} let ret = {}
if (Version.isV3) { if (Version.isV3) {
if (e.runtime) { if (e.runtime) {
let noteCks = await e.runtime?.gsCfg?.getBingCk() || {} let noteCks = await e.runtime?.gsCfg?.getBingCk(game) || {}
lodash.forEach(noteCks, (cks, qq) => { lodash.forEach(noteCks.ck, (ck, _qq) => {
lodash.forEach(cks, (ck) => { let qq = ck.qq || _qq
let { qq, uid } = ck let uid = ck.uid
if (qq && uid) { if (qq && uid) {
ret[qq] = ret[qq] || [] ret[qq] = ret[qq] || []
if (!ret[qq].includes(uid)) { if (!ret[qq].includes(uid)) {
@ -29,7 +29,6 @@ const Common = {
} }
} }
}) })
})
} }
} else { } else {
lodash.forEach(global.NoteCookie || {}, (ck) => { lodash.forEach(global.NoteCookie || {}, (ck) => {
@ -43,7 +42,11 @@ const Common = {
return ret 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) { if (Version.isV3) {
return await redis.get(`Yz:genshin:mys:qq-uid:${qq}`) return await redis.get(`Yz:genshin:mys:qq-uid:${qq}`)
} else { } else {
@ -51,9 +54,9 @@ const Common = {
} }
}, },
async getGroupUids (e) { async getGroupUids (e, game = 'gs') {
// 获取ck用户列表 // 获取ck用户列表
let noteUids = await Common.getNoteQQUids(e) let noteUids = await Common.getNoteQQUids(e, game)
let ret = {} let ret = {}
let uidMap = {} let uidMap = {}
@ -78,7 +81,7 @@ const Common = {
if (ret[qq]) { if (ret[qq]) {
continue continue
} }
let uid = await Common.getBindUid(qq) let uid = await Common.getBindUid(qq, e.runtime, game)
if (uid && !uidMap[uid]) { if (uid && !uidMap[uid]) {
ret[qq] = [{ ret[qq] = [{
uid, uid,

View File

@ -1,5 +1,5 @@
{{set ds = $data[0] || false }} {{set ds = $data[0] || false }}
{{set {_res_path, icon,lvs,type} = $data[1]}} {{set {_res_path, icon,lvs,type,game,minLv,maxLv} = $data[1]}}
<div class="talent-line"> <div class="talent-line">
<div class="talent-icon"> <div class="talent-icon">
@ -9,7 +9,7 @@
<div class="talent-name">{{ds.name}}</div> <div class="talent-name">{{ds.name}}</div>
<div class="talent-desc"> <div class="talent-desc">
{{each ds.desc d}} {{each ds.desc d}}
{{ if d[0] === "<" }} {{ if d[0] === "<" || game==='sr' }}
{{@d}} {{@d}}
{{else if d!=""}} {{else if d!=""}}
<p>{{d}}</p> <p>{{d}}</p>
@ -31,9 +31,9 @@
</div> </div>
<table class="talent-table cont-table"> <table class="talent-table cont-table">
<tr class="tr"> <tr class="tr">
<td class="th"></td> <td class="th">{{minLv}} {{maxLv}}</td>
{{each lvs lv idx}} {{each lvs lv idx}}
{{if (type=="a" && idx>4 && idx<11) || (type!="a" && idx>4 && idx < 13)}} {{if idx+1 >= minLv && idx+1 <= maxLv }}
<td class="th lv">{{lv}}</td> <td class="th lv">{{lv}}</td>
{{/if}} {{/if}}
{{/each}} {{/each}}
@ -49,7 +49,7 @@
</td> </td>
{{each tr.values v idx}} {{each tr.values v idx}}
{{if (type=="a" && idx>4 && idx<11) || (type!="a" && idx>4 && idx < 13)}} {{if idx+1 >= minLv && idx+1 <= maxLv }}
<td class="td">{{v}}</td> <td class="td">{{v}}</td>
{{/if}} {{/if}}
{{/each}} {{/each}}

View File

@ -5,7 +5,7 @@
export const usefulAttr = { export const usefulAttr = {
景元: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 }, 景元: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
希儿: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 }, 希儿: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
布洛妮娅: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 0, cdmg: 100, stance: 0, heal: 0, recharge: 100, effPct: 0, effDef: 0, dmg: 100 }, 布洛妮娅: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 75, cdmg: 100, stance: 0, heal: 0, recharge: 100, effPct: 0, effDef: 0, dmg: 100 },
杰帕德: { hp: 50, atk: 0, def: 100, speed: 100, cpct: 0, cdmg: 0, stance: 0, heal: 0, recharge: 100, effPct: 50, effDef: 50, dmg: 0 }, 杰帕德: { hp: 50, atk: 0, def: 100, speed: 100, cpct: 0, cdmg: 0, stance: 0, heal: 0, recharge: 100, effPct: 50, effDef: 50, dmg: 0 },
姬子: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 50, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 }, 姬子: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 50, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
瓦尔特: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 }, 瓦尔特: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
@ -15,7 +15,7 @@ export const usefulAttr = {
三月七: { hp: 50, atk: 0, def: 100, speed: 100, cpct: 0, cdmg: 0, stance: 0, heal: 0, recharge: 100, effPct: 50, effDef: 50, dmg: 0 }, 三月七: { hp: 50, atk: 0, def: 100, speed: 100, cpct: 0, cdmg: 0, stance: 0, heal: 0, recharge: 100, effPct: 50, effDef: 50, dmg: 0 },
丹恒: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 }, 丹恒: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
阿兰: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 }, 阿兰: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
艾丝妲: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 0, cdmg: 0, stance: 75, heal: 0, recharge: 100, effPct: 0, effDef: 0, dmg: 100 }, 艾丝妲: { hp: 0, atk: 75, def: 0, speed: 100, cpct: 75, cdmg: 75, stance: 100, heal: 0, recharge: 100, effPct: 0, effDef: 0, dmg: 100 },
黑塔: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 }, 黑塔: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
希露瓦: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 }, 希露瓦: { hp: 0, atk: 75, def: 0, speed: 75, cpct: 100, cdmg: 100, stance: 0, heal: 0, recharge: 50, effPct: 0, effDef: 0, dmg: 100 },
娜塔莎: { hp: 100, atk: 0, def: 50, speed: 75, cpct: 0, cdmg: 0, stance: 0, heal: 100, recharge: 75, effPct: 0, effDef: 50, dmg: 0 }, 娜塔莎: { hp: 100, atk: 0, def: 50, speed: 75, cpct: 0, cdmg: 0, stance: 0, heal: 100, recharge: 75, effPct: 0, effDef: 50, dmg: 0 },

View File

@ -6,7 +6,7 @@ let alias = {
佩拉: '佩菈', 佩拉: '佩菈',
停云: '', 停云: '',
克拉拉: '', 克拉拉: '',
卡夫卡: '亲妈', 卡夫卡: '亲妈,卡芙卡',
姬子: '', 姬子: '',
娜塔莎: '纳塔莎,纳塔沙,纳塔沙', 娜塔莎: '纳塔莎,纳塔沙,纳塔沙',
布洛妮娅: '大鸭鸭,鸭鸭,板鸭,布洛尼亚,布洛妮亚,布洛尼娅', 布洛妮娅: '大鸭鸭,鸭鸭,板鸭,布洛尼亚,布洛妮亚,布洛尼娅',
@ -16,7 +16,7 @@ let alias = {
景元: '景原,景源,神君发射器', 景元: '景原,景源,神君发射器',
杰帕德: '', 杰帕德: '',
桑博: '桑柏,桑伯', 桑博: '桑柏,桑伯',
瓦尔特: '老杨,杨叔,瓦尔特杨', 瓦尔特: '老杨,杨叔,瓦尔特杨,第一律者,手搓黑洞',
白露: '小龙人', 白露: '小龙人',
素裳: '', 素裳: '',
罗刹: '罗沙,罗杀', 罗刹: '罗沙,罗杀',
@ -25,7 +25,7 @@ let alias = {
银狼: '小鸭鸭,小板鸭,黑客,骇客,骇兔', 银狼: '小鸭鸭,小板鸭,黑客,骇客,骇兔',
阿兰: '', 阿兰: '',
青雀: '赌神,赌圣,青鹊', 青雀: '赌神,赌圣,青鹊',
黑塔: '' 黑塔: '转圈圈'
} }
let aliasMap = {} let aliasMap = {}

View File

@ -5,18 +5,11 @@
{{/block}} {{/block}}
{{block 'main'}} {{block 'main'}}
<div class="head-box" style="background-image:url('{{_res_path}}{{imgs.card}}')"> <div class="head-box" style="background-image:url('{{_res_path}}{{imgs.card}}')">
<div class="head"> <div class="head">
<img src="{{_res_path}}{{imgs.qFace||imgs.face}}"/> <img src="{{_res_path}}{{imgs.qFace||imgs.face}}"/>
</div> </div>
<!-- <div class="head-astro">{{astro}}</div>
<div class="head-icon">
<img src="{{City}}" />
<img src="{{Weapon}}" />
<img src="{{Element}}" />
</div>
-->
<div class="head-detail"> <div class="head-detail">
<div class="name">{{title}}·{{name}}</div> <div class="name">{{title}}·{{name}}</div>
<div class="desc">{{@desc}}</div> <div class="desc">{{@desc}}</div>
@ -43,12 +36,15 @@
{{/if}} {{/if}}
</div> </div>
{{if mode == "talent"}} {{if mode == "talent"}}
{{each detail.talent talent type}} {{each detail.talent talent type}}
<div class="talent-box elem-bg"> <div class="talent-box elem-bg">
<div class="talent-detail cont"> <div class="talent-detail cont">
<% include(_tpl_path+'/talent-detail.html', [talent, {_res_path,lvs,type,icon:imgs[type]}]) %> {{set minLv = game === 'gs' ? 4 : (type==='a'?1:4) }}
{{set maxLv = game === 'gs' ? (type==='a'?11:13) : (type==='a'?9:12)}}
<% include(_tpl_path+'/talent-detail.html', [talent, {_res_path,lvs,type,icon:imgs[type],minLv,maxLv,game}]) %>
</div> </div>
</div> </div>
{{/each}} {{/each}}
@ -56,7 +52,7 @@
<div class="talent-box elem-bg"> <div class="talent-box elem-bg">
<div class="talent-detail passive-talent"> <div class="talent-detail passive-talent">
{{each detail.passive pass idx}} {{each detail.passive pass idx}}
<% include(_tpl_path+'/talent-detail.html', [pass, {_res_path,icon:imgs['passive'+idx]}]) %> <% include(_tpl_path+'/talent-detail.html', [pass, {_res_path,icon:imgs['passive'+idx],game}]) %>
{{/each}} {{/each}}
</div> </div>
</div> </div>
@ -66,7 +62,7 @@
<div class="talent-box elem-bg"> <div class="talent-box elem-bg">
<div class="talent-detail"> <div class="talent-detail">
{{each detail.cons con idx}} {{each detail.cons con idx}}
<% include(_tpl_path+'/talent-detail.html', [con, {_res_path,lvs,type,icon:imgs['cons'+idx]}]) %> <% include(_tpl_path+'/talent-detail.html', [con, {_res_path,lvs,type,icon:imgs['cons'+idx],game}]) %>
{{/each}} {{/each}}
</div> </div>
</div> </div>