mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-12-04 04:07:25 +00:00
修复命令 #202410幻想角色列表
(#819)
* Display info in role character query * Add range hint * Reduce the number of message sent by bot * Fix range display bug * Add command help
This commit is contained in:
parent
d618ee7814
commit
e37b545aff
@ -138,6 +138,44 @@ const ProfileStat = {
|
|||||||
return overallMazeInfo
|
return overallMazeInfo
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sendRoleCombatInfo(e, elements, initialCharacterIds, invitationCharacterIds) {
|
||||||
|
const response = [
|
||||||
|
ProfileStat.getElementInfo(elements),
|
||||||
|
ProfileStat.getInitialCharacterInfo(initialCharacterIds),
|
||||||
|
ProfileStat.getInvitationCharacterInfo(invitationCharacterIds),
|
||||||
|
].join('\n')
|
||||||
|
e.reply(response)
|
||||||
|
},
|
||||||
|
|
||||||
|
getElementInfo(elements) {
|
||||||
|
// 让我们说中文!
|
||||||
|
const englishToChineseElements = {
|
||||||
|
'anemo': '风',
|
||||||
|
'geo': '岩',
|
||||||
|
'electro': '雷',
|
||||||
|
'dendro': '草',
|
||||||
|
'hydro': '水',
|
||||||
|
'pyro': '火',
|
||||||
|
'cryo': '冰'
|
||||||
|
}
|
||||||
|
// 使用 lodash 将元素转换为中文名称,并用'、'组合成'风、岩'
|
||||||
|
const chineseElements = lodash.map(elements, (element) => englishToChineseElements[element]).join('、');
|
||||||
|
return `限制元素:${chineseElements}`
|
||||||
|
},
|
||||||
|
|
||||||
|
getInitialCharacterInfo(initialCharacterIds) {
|
||||||
|
let characters = lodash.compact(lodash.map(initialCharacterIds, (id) => Character.get(id)))
|
||||||
|
let characterNames = lodash.map(characters, (character) => character.name).join('、')
|
||||||
|
return `开幕角色:${characterNames}`
|
||||||
|
},
|
||||||
|
|
||||||
|
getInvitationCharacterInfo(invitationCharacterIds) {
|
||||||
|
let characters = lodash.compact(lodash.map(invitationCharacterIds, (id) => Character.get(id)))
|
||||||
|
let characterNames = lodash.map(characters, (character) => character.name).join('、')
|
||||||
|
return `特邀角色:${characterNames}`
|
||||||
|
},
|
||||||
|
|
||||||
|
// TODO: BWiki 源的数据暂时没弄完,没接入逻辑中,暂时没啥必要?
|
||||||
async getOverallMazeLinkFromBWiki() {
|
async getOverallMazeLinkFromBWiki() {
|
||||||
const request_url = 'https://wiki.biligame.com/ys/%E5%B9%BB%E6%83%B3%E7%9C%9F%E5%A2%83%E5%89%A7%E8%AF%97'
|
const request_url = 'https://wiki.biligame.com/ys/%E5%B9%BB%E6%83%B3%E7%9C%9F%E5%A2%83%E5%89%A7%E8%AF%97'
|
||||||
try {
|
try {
|
||||||
@ -303,7 +341,8 @@ const ProfileStat = {
|
|||||||
mergedAvatars = Array.from(avatarMap.values());
|
mergedAvatars = Array.from(avatarMap.values());
|
||||||
|
|
||||||
// 排序
|
// 排序
|
||||||
let sortKey = 'level,star,aeq,cons,weapon.level,weapon.star,weapon.affix,fetter'.split(',')
|
// 按照元素进行区分
|
||||||
|
let sortKey = 'elem,level,star,aeq,cons,weapon.level,weapon.star,weapon.affix,fetter'.split(',')
|
||||||
mergedAvatars = lodash.orderBy(mergedAvatars, sortKey)
|
mergedAvatars = lodash.orderBy(mergedAvatars, sortKey)
|
||||||
mergedAvatars = mergedAvatars.reverse()
|
mergedAvatars = mergedAvatars.reverse()
|
||||||
|
|
||||||
@ -360,13 +399,24 @@ const ProfileStat = {
|
|||||||
}
|
}
|
||||||
let currentMazeData = ProfileStat.extractRequestedMazeData(e, overallMazeData)
|
let currentMazeData = ProfileStat.extractRequestedMazeData(e, overallMazeData)
|
||||||
if (!currentMazeData) {
|
if (!currentMazeData) {
|
||||||
e.reply(`当前月份不在 HomDGCat 数据库中`)
|
const n = overallMazeData.length - 1 + 4 * 12 + 7 - 1
|
||||||
|
const maxYear = Math.floor(n / 12)
|
||||||
|
const maxMonth = n % 12 + 1
|
||||||
|
const formattedMonth = String(maxMonth).padStart(2, '0'); // 将月份格式化为两位数
|
||||||
|
const response = [
|
||||||
|
`当前月份不在 HomDGCat 数据库中`,
|
||||||
|
`可供查询的月份:202407 - 202${maxYear}${formattedMonth}`
|
||||||
|
].join('\n')
|
||||||
|
e.reply(response)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
let initialCharacterIds = ProfileStat.extractInitialCharacterIds(currentMazeData)
|
let initialCharacterIds = ProfileStat.extractInitialCharacterIds(currentMazeData)
|
||||||
let invitationCharacterIds = ProfileStat.extractInvitationCharacterIds(currentMazeData)
|
let invitationCharacterIds = ProfileStat.extractInvitationCharacterIds(currentMazeData)
|
||||||
let elements = ProfileStat.extractElements(currentMazeData)
|
let elements = ProfileStat.extractElements(currentMazeData)
|
||||||
|
|
||||||
|
// 发送简要的信息
|
||||||
|
ProfileStat.sendRoleCombatInfo(e, elements, initialCharacterIds, invitationCharacterIds)
|
||||||
|
|
||||||
avatarRet = ProfileStat.mergeStart(avatarRet, initialCharacterIds)
|
avatarRet = ProfileStat.mergeStart(avatarRet, initialCharacterIds)
|
||||||
filterFunc = ProfileStat.getRoleFilterFunc(e, elements, invitationCharacterIds)
|
filterFunc = ProfileStat.getRoleFilterFunc(e, elements, invitationCharacterIds)
|
||||||
} else {
|
} else {
|
||||||
|
@ -69,6 +69,10 @@ export const helpList = [{
|
|||||||
icon: 64,
|
icon: 64,
|
||||||
title: '#幻想 #幻想真境剧诗',
|
title: '#幻想 #幻想真境剧诗',
|
||||||
desc: '幻想真境剧诗数据'
|
desc: '幻想真境剧诗数据'
|
||||||
|
}, {
|
||||||
|
icon: 55,
|
||||||
|
title: '#202407幻想角色列表',
|
||||||
|
desc: '幻想真境剧诗入场角色查询'
|
||||||
}, {
|
}, {
|
||||||
icon: 67,
|
icon: 67,
|
||||||
title: '#五星 #武器 #今日素材',
|
title: '#五星 #武器 #今日素材',
|
||||||
|
@ -53,6 +53,10 @@ export const helpList = [{
|
|||||||
icon: 64,
|
icon: 64,
|
||||||
title: '#幻想 #幻想真境剧诗',
|
title: '#幻想 #幻想真境剧诗',
|
||||||
desc: '幻想真境剧诗数据'
|
desc: '幻想真境剧诗数据'
|
||||||
|
}, {
|
||||||
|
icon: 55,
|
||||||
|
title: '#202407幻想角色列表',
|
||||||
|
desc: '幻想真境剧诗入场角色查询'
|
||||||
}, {
|
}, {
|
||||||
icon: 67,
|
icon: 67,
|
||||||
title: '#五星 #武器 #今日素材',
|
title: '#五星 #武器 #今日素材',
|
||||||
|
Loading…
Reference in New Issue
Block a user