一些已知问题修正

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
}
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 })

View File

@ -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('<br>')
}
}
})
})
}
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('<br>'),
tables: tableRet
}
}
}

View File

@ -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,

View File

@ -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]}}
<div class="talent-line">
<div class="talent-icon">
<img src="{{_res_path}}{{icon}}"/>
</div>
<div class="talent-info">
<div class="talent-name">{{ds.name}}</div>
<div class="talent-desc">
{{each ds.desc d}}
{{ if d[0] === "<" }}
{{@d}}
{{else if d!=""}}
<p>{{d}}</p>
{{/if}}
{{/each}}
</div>
<div class="talent-icon">
<img src="{{_res_path}}{{icon}}"/>
</div>
<div class="talent-info">
<div class="talent-name">{{ds.name}}</div>
<div class="talent-desc">
{{each ds.desc d}}
{{ if d[0] === "<" || game==='sr' }}
{{@d}}
{{else if d!=""}}
<p>{{d}}</p>
{{/if}}
{{/each}}
</div>
</div>
{{if ds.tables && ds.tables.length > 0}}
<div class="talent-common-info">
{{each ds.tables tr}}
{{if tr.isSame}}
<div>
<strong>{{tr.name}}{{if tr.unit}}({{tr.unit}}){{/if}}</strong>
<span>{{tr.values[0]}}</span>
</div>
{{/if}}
{{/each}}
{{if ds.tables && ds.tables.length > 0}}
<div class="talent-common-info">
{{each ds.tables tr}}
{{if tr.isSame}}
<div>
<strong>{{tr.name}}{{if tr.unit}}({{tr.unit}}){{/if}}</strong>
<span>{{tr.values[0]}}</span>
</div>
<table class="talent-table cont-table">
<tr class="tr">
<td class="th"></td>
{{each lvs lv idx}}
{{if (type=="a" && idx>4 && idx<11) || (type!="a" && idx>4 && idx < 13)}}
<td class="th lv">{{lv}}</td>
{{/if}}
{{/each}}
</tr>
{{each ds.tables tr}}
{{if !tr.isSame}}
<tr class="tr">
<td class="th talent-name">
{{tr.name}}
{{if tr.unit}}
<span class="unit">({{tr.unit}})</span>
{{/if}}
</td>
{{each tr.values v idx}}
{{if (type=="a" && idx>4 && idx<11) || (type!="a" && idx>4 && idx < 13)}}
<td class="td">{{v}}</td>
{{/if}}
{{/each}}
{{/if}}
</tr>
{{/each}}
</table>
{{/if}}
{{/each}}
</div>
<table class="talent-table cont-table">
<tr class="tr">
<td class="th">{{minLv}} {{maxLv}}</td>
{{each lvs lv idx}}
{{if idx+1 >= minLv && idx+1 <= maxLv }}
<td class="th lv">{{lv}}</td>
{{/if}}
{{/each}}
</tr>
{{each ds.tables tr}}
{{if !tr.isSame}}
<tr class="tr">
<td class="th talent-name">
{{tr.name}}
{{if tr.unit}}
<span class="unit">({{tr.unit}})</span>
{{/if}}
</td>
{{each tr.values v idx}}
{{if idx+1 >= minLv && idx+1 <= maxLv }}
<td class="td">{{v}}</td>
{{/if}}
{{/each}}
{{/if}}
</tr>
{{/each}}
</table>
{{/if}}
</div>

View File

@ -5,7 +5,7 @@
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: 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: 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 },
@ -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: 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: 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 = {}

View File

@ -5,18 +5,11 @@
{{/block}}
{{block 'main'}}
<div class="head-box" style="background-image:url('{{_res_path}}{{imgs.card}}')">
<div class="head">
<img src="{{_res_path}}{{imgs.qFace||imgs.face}}"/>
</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="name">{{title}}·{{name}}</div>
<div class="desc">{{@desc}}</div>
@ -43,12 +36,15 @@
{{/if}}
</div>
{{if mode == "talent"}}
{{each detail.talent talent type}}
<div class="talent-box elem-bg">
<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>
{{/each}}
@ -56,7 +52,7 @@
<div class="talent-box elem-bg">
<div class="talent-detail passive-talent">
{{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}}
</div>
</div>
@ -66,7 +62,7 @@
<div class="talent-box elem-bg">
<div class="talent-detail">
{{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}}
</div>
</div>