mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
fix: *刷新排名 误重置原神排名问题,星铁排名伤害与面板不一致问题。新增*重置排名,*群最强xx
This commit is contained in:
parent
95049d23d9
commit
eecaefabe1
@ -36,17 +36,17 @@ app.reg({
|
||||
groupProfile: {
|
||||
name: '群内最强',
|
||||
fn: groupRank,
|
||||
rule: /^#(群|群内)?(排名|排行)?(最强|最高|最高分|最牛|第一|极限)+.+/
|
||||
rule: /^#(星铁|原神)?(群|群内)?(排名|排行)?(最强|最高|最高分|最牛|第一|极限)+.+/
|
||||
},
|
||||
|
||||
resetRank: {
|
||||
name: '重置排名',
|
||||
fn: resetRank,
|
||||
rule: /^#(重置|重设)(.*)(排名|排行)$/
|
||||
rule: /^#(星铁|原神)?(重置|重设)(.*)(排名|排行)$/
|
||||
},
|
||||
|
||||
refreshRank: {
|
||||
name: '重置排名',
|
||||
name: '刷新排名',
|
||||
fn: refreshRank,
|
||||
rule: /^#(星铁|原神)?(刷新|更新|重新加载)(群内|群|全部)*(排名|排行)$/
|
||||
},
|
||||
@ -60,7 +60,7 @@ app.reg({
|
||||
rankList: {
|
||||
name: '面板排名榜',
|
||||
fn: groupRank,
|
||||
rule: /^#(群|群内)?.+(排名|排行)(榜)?$/
|
||||
rule: /^#(星铁|原神)?(群|群内)?.+(排名|排行)(榜)?$/
|
||||
},
|
||||
|
||||
artisList: {
|
||||
@ -80,7 +80,7 @@ app.reg({
|
||||
talentStat: {
|
||||
name: '天赋统计',
|
||||
fn: ProfileStat.stat,
|
||||
rule: /^#*(我的)*(今日|今天|明日|明天|周.*)?(五|四|5|4|星)?(技能|天赋)+(汇总|统计|列表)?[ |0-9]*$/,
|
||||
rule: /^#*(我的)*(今日|今天|明日|明天|周.*)?(五|四|5|4|星)?(技能|天赋)+(汇总|统计|列表)?[ |0-9]*$/
|
||||
},
|
||||
|
||||
avatarList: {
|
||||
|
@ -18,7 +18,7 @@ export async function groupRank (e) {
|
||||
if (!type || (!groupId && type !== 'super')) {
|
||||
return false
|
||||
}
|
||||
let mode = /(分|圣遗物|评分|ACE)/.test(msg) ? 'mark' : 'dmg'
|
||||
let mode = /(分|圣遗物|遗器|评分|ACE)/.test(msg) ? 'mark' : 'dmg'
|
||||
mode = /(词条)/.test(msg) ? 'valid' : mode
|
||||
mode = /(双爆)/.test(msg) ? 'crit' : mode
|
||||
let name = msg.replace(/(#|星铁|最强|最高分|第一|词条|双爆|极限|最高|最多|最牛|圣遗物|评分|群内|群|排名|排行|面板|面版|详情|榜)/g, '')
|
||||
@ -101,6 +101,7 @@ export async function resetRank (e) {
|
||||
e.reply('只有管理员可重置排名')
|
||||
return true
|
||||
}
|
||||
let game = e.isSr ? 'sr' : 'gs'
|
||||
let msg = e.original_msg || e.msg
|
||||
let name = msg.replace(/(#|重置|重设|排名|排行|群|群内|面板|详情|面版)/g, '').trim()
|
||||
let charId = ''
|
||||
@ -114,7 +115,7 @@ export async function resetRank (e) {
|
||||
charId = char.id
|
||||
charName = char.name
|
||||
}
|
||||
await ProfileRank.resetRank(groupId, charId)
|
||||
await ProfileRank.resetRank(groupId, charId, game)
|
||||
e.reply(`本群${charName}排名已重置...`)
|
||||
}
|
||||
|
||||
@ -134,7 +135,7 @@ export async function refreshRank (e) {
|
||||
}
|
||||
e.reply('面板数据刷新中,等待时间可能较长,请耐心等待...')
|
||||
let game = e.isSr ? 'sr' : 'gs'
|
||||
await ProfileRank.resetRank(groupId)
|
||||
await ProfileRank.resetRank({ groupId, game })
|
||||
let uidMap = await ProfileRank.getUserUidMap(e, game)
|
||||
let count = 0
|
||||
for (let uid in uidMap) {
|
||||
@ -206,7 +207,7 @@ async function renderCharRankList ({ e, uids, char, mode, groupId }) {
|
||||
}
|
||||
title = title.length > 10 ? title.replace(/伤害$/, '') : title
|
||||
tmp.dmg = {
|
||||
title: title,
|
||||
title,
|
||||
avg: Format.comma(dmg.avg, 1)
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class Character extends Base {
|
||||
get sName () {
|
||||
let name = this.name
|
||||
let abbr = this.abbr
|
||||
return name.length <= 4 ? name : (abbr || name)
|
||||
return name.length < 4 ? name : (abbr || name)
|
||||
}
|
||||
|
||||
// 是否是旅行者
|
||||
|
@ -69,10 +69,10 @@ export default class ProfileRank {
|
||||
* @param charId
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async resetRank (groupId, charId = '') {
|
||||
static async resetRank (groupId, charId = '', game = 'gs') {
|
||||
let keys = await redis.keys(`miao:rank:${groupId}:*`)
|
||||
for (let key of keys) {
|
||||
let charRet = /^miao:rank:\d+:(?:mark|dmg|crit|valid):(\d{8})$/.exec(key)
|
||||
let charRet = game === 'gs' ? /^miao:rank:\d+:(?:mark|dmg|crit|valid):(\d{8})$/.exec(key) : /^miao:rank:\d+:(?:mark|dmg|crit|valid):(\d{4})$/.exec(key)
|
||||
if (charRet) {
|
||||
if (charId === '' || charId * 1 === charRet[1] * 1) {
|
||||
await redis.del(key)
|
||||
@ -398,7 +398,8 @@ export default class ProfileRank {
|
||||
}
|
||||
}
|
||||
if (type === 'dmg' && profile.hasDmg) {
|
||||
let dmg = await profile.calcDmg({ mode: 'single' })
|
||||
let enemyLv = profile.game === 'gs' ? 91 : 80
|
||||
let dmg = await profile.calcDmg({ enemyLv, mode: 'single' })
|
||||
if (dmg && dmg.avg) {
|
||||
return {
|
||||
score: dmg.avg,
|
||||
@ -408,6 +409,4 @@ export default class ProfileRank {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ let ArtisMark = {
|
||||
mark: Format.comma(totalMark, 1),
|
||||
_mark: artis.mark,
|
||||
markClass: artis.markClass,
|
||||
...Data.getData(setData, 'sets,names,imgs'),
|
||||
...Data.getData(setData, 'sets,names,imgs')
|
||||
}
|
||||
if (withDetail) {
|
||||
ret.charWeight = lodash.mapValues(charCfg.attrs, ds => ds.weight)
|
||||
|
Loading…
Reference in New Issue
Block a user