From 612cfa85d43e6c91d901916d339ed75c7b800282 Mon Sep 17 00:00:00 2001 From: ctrlcvs <1509167646@qq.com> Date: Sat, 13 Aug 2022 23:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=A7=92=E8=89=B2=E5=88=AB?= =?UTF-8?q?=E5=90=8D=E8=AF=BB=E5=8F=96=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Note.js | 12 ++-- apps/xiaoyao_image.js | 83 ++++++--------------------- resources/Atlas_alias/Atlas_list.json | 8 +-- 3 files changed, 30 insertions(+), 73 deletions(-) diff --git a/apps/Note.js b/apps/Note.js index cd42170..ec60edb 100644 --- a/apps/Note.js +++ b/apps/Note.js @@ -139,14 +139,18 @@ export async function Note(e, { val.percentage = 0; } if (val.remained_time > 0) { - // console.log(val.remained_time) val.dq_time = val.remained_time; val.remained_time = new Date().getTime() + val.remained_time * 1000; - // console.log(val.remained_time) var urls_avatar_side = val.avatar_side_icon.split("_"); - let id = gsCfg.roleIdToName(urls_avatar_side[urls_avatar_side.length - 1].replace( + let Botcfg; + if (isV3) { + Botcfg = (await import(`file://${_path}/plugins/genshin/model/gsCfg.js`)).default; + } else { + Botcfg = YunzaiApps.mysInfo + } + let id = Botcfg.roleIdToName(urls_avatar_side[urls_avatar_side.length - 1].replace( /(.png|.jpg)/g, "")); - let name = gsCfg.roleIdToName(id, true); + let name = Botcfg.roleIdToName(id, true); var time_cha = 20; if (role_user["12"].includes(name)) { time_cha = 15; diff --git a/apps/xiaoyao_image.js b/apps/xiaoyao_image.js index e95f977..b3908d2 100644 --- a/apps/xiaoyao_image.js +++ b/apps/xiaoyao_image.js @@ -9,10 +9,13 @@ import Data from "../components/Data.js" import path from 'path'; import fetch from "node-fetch"; import gsCfg from '../model/gsCfg.js' +import { + isV3 +} from '../components/Changelog.js' const _path = process.cwd(); const __dirname = path.resolve(); -const list = ["wuqi_tujian","shiwu_tujian", "yuanmo_tujian", "mijin_tujian", "shengyiwu_tujian","daoju_tujian"] +const list = ["wuqi_tujian", "shiwu_tujian", "yuanmo_tujian", "mijin_tujian", "shengyiwu_tujian", "daoju_tujian"] export async function AtlasAlias(e) { if (!Cfg.get("Atlas.all")) { return false; @@ -26,10 +29,6 @@ export async function AtlasAlias(e) { } if (await Atlas_list(e)) return true; if (await roleInfo(e)) return true; - // if (await weaponInfo(e)) return true; - // if (await foodInfo(e)) return true; - // if (await RelicsInfo(e)) return true; - // if (await monsterInfo(e)) return true; var name = e.msg.replace(/#|#|信息|图鉴|圣遗物|食物|食材|特殊|特色|料理/g, ""); return send_Msg(e, "all", name); } @@ -38,16 +37,24 @@ export async function AtlasAlias(e) { export async function roleInfo(e) { // let msg=e.msg.replace(/#|图鉴/g,""); let msg = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破/g, ""); - let id = gsCfg.roleNameToID(msg) + let Botcfg; + let id; + if (isV3) { + Botcfg = (await import(`file://${_path}/plugins/genshin/model/gsCfg.js`)).default; + Botcfg.roleNameToID(msg) + } else { + Botcfg = YunzaiApps.mysInfo + id = Botcfg.roleIdToName(msg); + } let name; if (["10000005", "10000007", "20000000"].includes(id)) { - if (!["风主", "岩主", "雷主","草主"].includes(msg)) { + if (!["风主", "岩主", "雷主", "草主"].includes(msg)) { e.reply("请选择:风主图鉴、岩主图鉴、雷主图鉴、草主图鉴"); return true; } name = msg; } else { - name = gsCfg.roleIdToName(id, true); + name = Botcfg.roleIdToName(id, true); if (!name) return false; } send_Msg(e, "juese_tujian", name) @@ -58,7 +65,7 @@ const send_Msg = function(e, type, name) { let path; if (type == "all") { for (let val of list) { - path= `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${val}/${name}.png` + path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${val}/${name}.png` if (fs.existsSync(path)) { e.reply(segment.image(`file:///${path}`)); return true; @@ -79,74 +86,20 @@ const send_Msg = function(e, type, name) { e.reply(segment.image(`file:///${path}`)); return true; } -// let weapon = new Map(); -// let weaponFile = []; -// await init(); -// export async function init(isUpdate = false) { -// let weaponJson = JSON.parse(fs.readFileSync("./config/genshin/weapon.json", "utf8")); -// for (let i in weaponJson) { -// for (let val of weaponJson[i]) { -// weapon.set(val, i); -// } -// } -// let paths = "./plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/wuqi_tujian"; -// if (!fs.existsSync(paths)) { -// return true; -// } -// weaponFile = fs.readdirSync(paths); -// for (let val of weaponFile) { -// let name = val.replace(".png", ""); -// weapon.set(name, name); -// } -// } - -// export async function weaponInfo(e) { -// let msg = e.msg || ''; -// if (e.atBot) { -// msg = "#" + msg.replace("#", ""); -// } -// if (!/(#*(.*)(信息|图鉴|突破|武器|材料)|#(.*))$/.test(msg)) return; - -// let name = weapon.get(msg.replace(/#|#|信息|图鉴|突破|武器|材料/g, "")); - -// if (name) { -// send_Msg(e, "wuqi_tujian", name) -// return true; -// } - -// return false; -// } export async function Atlas_list(e) { let list = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/Atlas_alias/`, "Atlas_list"); let name = e.msg.replace(/#|井/g, "") for (let i in list) { var title = i.split("|"); - for (let j = 0; j < title.length;j++) { + for (let j = 0; j < title.length; j++) { if (title[j] == name) { - await e.reply("请选择:\n"+list[i].join("\n")) + await e.reply("请选择:\n" + list[i].join("\n")) return true; } } } return false; } -// export async function RelicsInfo(e) { -// let msg = e.msg || ''; -// if (e.atBot) { -// msg = "#" + msg.replace("#", ""); -// } -// // if (!/(#*圣遗物(.*)|#(.*))$/.test(msg)) return; -// let name = msg.replace(/#|#|信息|副本|本|圣遗物|图鉴/g, ""); -// let response = await fetch(`https://info.minigg.cn/artifacts?query=${encodeURIComponent(name)}`); -// let res = await response.json(); -// if (res?.errcode == "10006") return false; -// name = res["name"]; -// if (name) { -// send_Msg(e, "shengyiwu_tujian", name) -// return true; -// } -// return false; -// } const info_img = function(e, list, name) { for (let i in list) { for (let val of list[i]) { diff --git a/resources/Atlas_alias/Atlas_list.json b/resources/Atlas_alias/Atlas_list.json index 28dc2b4..446f5ea 100644 --- a/resources/Atlas_alias/Atlas_list.json +++ b/resources/Atlas_alias/Atlas_list.json @@ -11,12 +11,12 @@ "蒙德角色图鉴|蒙德人物图鉴|蒙德英雄图鉴": ["#优菈图鉴", "#阿贝多图鉴", "#温迪图鉴", "#莫娜图鉴", "#可莉图鉴", "#琴图鉴", "#迪卢克图鉴", "#菲谢尔图鉴", "#班尼特图鉴", "#丽莎图鉴", "#迪奥娜图鉴", "#安柏图鉴", "#雷泽图鉴", "#芭芭拉图鉴", "#罗莎莉亚图鉴", "#凯亚图鉴", "#诺艾尔图鉴", "#砂糖图鉴"], "璃月角色图鉴|璃月人物图鉴|璃月英雄图鉴": ["#申鹤图鉴", "#胡桃图鉴", "#刻晴图鉴", "#七七图鉴", "#魈图鉴", "#钟离图鉴", "#甘雨图鉴", "#凝光图鉴", "#行秋图鉴", "#重云图鉴", "#香菱图鉴", "#北斗图鉴", "#辛焱图鉴", "#烟绯图鉴", "#云堇图鉴", "#夜兰图鉴"], "稻妻角色图鉴|稻妻人物图鉴|稻妻英雄图鉴": ["#神里绫人图鉴", "#神里绫华图鉴", "#八重神子图鉴", "#荒泷一斗图鉴", "#五郎图鉴", "#托马图鉴", "#雷电将军图鉴", "#珊瑚宫心海图鉴", "#宵宫图鉴", "#枫原万叶图鉴", "#早柚图鉴", "#九条裟罗图鉴", "#鹿野院平藏图鉴", "#久岐忍图鉴"], - "须弥角色图鉴|至冬人物图鉴|至冬英雄图鉴": ["#科莱图鉴", "#多莉图鉴", "#提纳里图鉴"], + "须弥角色图鉴|至冬人物图鉴|至冬英雄图鉴": ["#柯莱图鉴", "#多莉图鉴", "#提纳里图鉴"], "至冬角色图鉴|至冬人物图鉴|至冬英雄图鉴": ["#达达利亚图鉴"], "未知地区角色图鉴|未知地区人物图鉴|未知地区英雄图鉴": ["#风主图鉴", "#岩主图鉴", "#雷主图鉴", "#草主图鉴", "#埃洛伊图鉴"], "五星角色图鉴|五星人物图鉴|五星英雄图鉴": ["#风主图鉴", "#岩主图鉴", "#雷主图鉴", "#草主图鉴", "#神里绫人图鉴", "#八重神子图鉴", "#申鹤图鉴", "#荒泷一斗图鉴", "#优菈图鉴", "#阿贝多图鉴", "#胡桃图鉴", "#达达利亚图鉴", "#雷电将军图鉴", "#珊瑚宫心海图鉴", "#埃洛伊图鉴", "#宵宫图鉴", "#神里绫华图鉴", "#枫原万叶图鉴", "#温迪图鉴", "#刻晴图鉴", "#莫娜图鉴", "#可莉图鉴", "#琴图鉴", "#迪卢克图鉴", "#七七图鉴", "#魈图鉴", "#钟离图鉴", "#甘雨图鉴", "#夜兰图鉴", "#提纳里图鉴"], - "四星角色图鉴|四星人物图鉴|四星英雄图鉴": ["#云堇图鉴", "#五郎图鉴", "#托马图鉴", "#早柚图鉴", "#九条裟罗图鉴", "#凝光图鉴", "#菲谢尔图鉴", "#班尼特图鉴", "#丽莎图鉴", "#行秋图鉴", "#迪奥娜图鉴", "#安柏图鉴", "#重云图鉴", "#雷泽图鉴", "#芭芭拉图鉴", "#罗莎莉亚图鉴", "#香菱图鉴", "#凯亚图鉴", "#北斗图鉴", "#诺艾尔图鉴", "#砂糖图鉴", "#辛焱图鉴", "#烟绯图鉴", "#鹿野院平藏图鉴", "#久岐忍图鉴", "#科莱图鉴", "#多莉图鉴"], + "四星角色图鉴|四星人物图鉴|四星英雄图鉴": ["#云堇图鉴", "#五郎图鉴", "#托马图鉴", "#早柚图鉴", "#九条裟罗图鉴", "#凝光图鉴", "#菲谢尔图鉴", "#班尼特图鉴", "#丽莎图鉴", "#行秋图鉴", "#迪奥娜图鉴", "#安柏图鉴", "#重云图鉴", "#雷泽图鉴", "#芭芭拉图鉴", "#罗莎莉亚图鉴", "#香菱图鉴", "#凯亚图鉴", "#北斗图鉴", "#诺艾尔图鉴", "#砂糖图鉴", "#辛焱图鉴", "#烟绯图鉴", "#鹿野院平藏图鉴", "#久岐忍图鉴", "#柯莱图鉴", "#多莉图鉴"], "风系角色图鉴|风系人物图鉴|风系英雄图鉴": ["#风主图鉴", "#枫原万叶图鉴", "#温迪图鉴", "#琴图鉴", "#魈图鉴", "#早柚图鉴", "#砂糖图鉴", "#鹿野院平藏图鉴"], "火系角色图鉴|火系人物图鉴|火系英雄图鉴": ["#托马图鉴", "#胡桃图鉴", "#宵宫图鉴", "#可莉图鉴", "#迪卢克图鉴", "#班尼特图鉴", "#安柏图鉴", "#香菱图鉴", "#辛焱图鉴", "#烟绯图鉴"], @@ -24,11 +24,11 @@ "冰系角色图鉴|冰系人物图鉴|冰系英雄图鉴": ["#申鹤图鉴", "#优菈图鉴", "#埃洛伊图鉴", "#神里绫华图鉴", "#七七图鉴", "#甘雨图鉴", "#迪奥娜图鉴", "#重云图鉴", "#罗莎莉亚图鉴", "#凯亚图鉴"], "雷系角色图鉴|雷系人物图鉴|雷系英雄图鉴": ["#雷主图鉴", "#八重神子图鉴", "#雷电将军图鉴", "#刻晴图鉴", "#九条裟罗图鉴", "#菲谢尔图鉴", "#丽莎图鉴", "#雷泽图鉴", "#北斗图鉴", "#久岐忍图鉴", "#多莉图鉴"], "岩系角色图鉴|岩系人物图鉴|岩系英雄图鉴": ["#岩主图鉴", "#云堇图鉴", "#荒泷一斗图鉴", "#五郎图鉴", "#阿贝多图鉴", "#钟离图鉴", "#凝光图鉴", "#诺艾尔图鉴"], - "草系角色图鉴|草系人物图鉴|草系英雄图鉴": ["草主图鉴", "#科莱图鉴", "#提纳里图鉴"], + "草系角色图鉴|草系人物图鉴|草系英雄图鉴": ["草主图鉴", "#柯莱图鉴", "#提纳里图鉴"], "单手剑角色图鉴|单手剑人物图鉴|单手剑英雄图鉴": ["#风主图鉴", "#岩主图鉴", "#雷主图鉴", "#草主图鉴", "#神里绫人图鉴", "#阿贝多图鉴", "#神里绫华图鉴", "#枫原万叶图鉴", "#刻晴图鉴", "#琴图鉴", "#七七图鉴", "#班尼特图鉴", "#行秋图鉴", "#凯亚图鉴", "#久岐忍图鉴"], "双手剑角色图鉴|双手剑人物图鉴|双手剑英雄图鉴": ["#荒泷一斗图鉴", "#优菈图鉴", "#迪卢克图鉴", "#早柚图鉴", "#重云图鉴", "#雷泽图鉴", "#北斗图鉴", "#诺艾尔图鉴", "#辛焱图鉴", "#多莉图鉴"], - "弓系角色图鉴|弓系人物图鉴|弓系英雄图鉴": ["#五郎图鉴", "#达达利亚图鉴", "#埃洛伊图鉴", "#宵宫图鉴", "#温迪图鉴", "#甘雨图鉴", "#九条裟罗图鉴", "#菲谢尔图鉴", "#迪奥娜图鉴", "#安柏图鉴", "#夜兰图鉴", "#科莱图鉴", "#提纳里图鉴"], + "弓系角色图鉴|弓系人物图鉴|弓系英雄图鉴": ["#五郎图鉴", "#达达利亚图鉴", "#埃洛伊图鉴", "#宵宫图鉴", "#温迪图鉴", "#甘雨图鉴", "#九条裟罗图鉴", "#菲谢尔图鉴", "#迪奥娜图鉴", "#安柏图鉴", "#夜兰图鉴", "#柯莱图鉴", "#提纳里图鉴"], "长柄武器角色图鉴|长柄武器人物图鉴|长柄武器英雄图鉴": ["#云堇图鉴", "#申鹤图鉴", "#托马图鉴", "#胡桃图鉴", "#雷电将军图鉴", "#魈图鉴", "#钟离图鉴", "#罗莎莉亚图鉴", "#香菱图鉴"], "法器角色图鉴|法器人物图鉴|法器英雄图鉴": ["#八重神子图鉴", "#珊瑚宫心海图鉴", "#莫娜图鉴", "#可莉图鉴", "#凝光图鉴", "#丽莎图鉴", "#芭芭拉图鉴", "#砂糖图鉴", "#烟绯图鉴", "#鹿野院平藏图鉴"],