2022-06-17 15:10:02 +08:00
|
|
|
|
import {
|
|
|
|
|
segment
|
|
|
|
|
} from "oicq";
|
|
|
|
|
import fs from "fs";
|
2022-06-28 00:32:56 +08:00
|
|
|
|
import {
|
|
|
|
|
Cfg
|
|
|
|
|
} from "../components/index.js";
|
2022-06-20 21:43:24 +08:00
|
|
|
|
import Data from "../components/Data.js"
|
2022-06-17 15:10:02 +08:00
|
|
|
|
import path from 'path';
|
2022-06-20 21:43:24 +08:00
|
|
|
|
import fetch from "node-fetch";
|
2022-07-24 11:46:05 +08:00
|
|
|
|
import gsCfg from '../model/gsCfg.js'
|
2022-08-13 23:42:34 +08:00
|
|
|
|
import {
|
|
|
|
|
isV3
|
|
|
|
|
} from '../components/Changelog.js'
|
2022-06-17 15:10:02 +08:00
|
|
|
|
const _path = process.cwd();
|
|
|
|
|
const __dirname = path.resolve();
|
|
|
|
|
|
2022-08-13 23:42:34 +08:00
|
|
|
|
const list = ["wuqi_tujian", "shiwu_tujian", "yuanmo_tujian", "mijin_tujian", "shengyiwu_tujian", "daoju_tujian"]
|
2022-08-18 20:20:26 +08:00
|
|
|
|
const reglist=["(#|专武|武器|图鉴|突破)","(#|食物|特殊料理|特色|料理|食材|图鉴)","(#|原魔|怪物|图鉴|信息)","(#|秘境|信息|图鉴)","(#|圣遗物|图鉴)","(#|图鉴|道具)"]
|
2022-06-20 21:43:24 +08:00
|
|
|
|
export async function AtlasAlias(e) {
|
2022-06-28 23:33:05 +08:00
|
|
|
|
if (!Cfg.get("Atlas.all")) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-06-28 00:32:56 +08:00
|
|
|
|
let reg = /#(.*)/;
|
|
|
|
|
if (Cfg.get("sys.Atlas")) {
|
|
|
|
|
reg = /#*(.*)图鉴/;
|
2022-06-26 19:31:18 +08:00
|
|
|
|
}
|
2022-06-28 00:32:56 +08:00
|
|
|
|
if (!reg.test(e.msg)) {
|
2022-06-26 19:31:18 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-06-28 00:32:56 +08:00
|
|
|
|
if (await Atlas_list(e)) return true;
|
2022-06-20 21:43:24 +08:00
|
|
|
|
if (await roleInfo(e)) return true;
|
2022-08-16 22:07:56 +08:00
|
|
|
|
// var name = e.msg.replace(/#|#|信息|图鉴|圣遗物|食物|食材|特殊|特色|料理/g, "");
|
|
|
|
|
return send_Msg(e, "all", "");
|
2022-06-20 21:43:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 15:10:02 +08:00
|
|
|
|
export async function roleInfo(e) {
|
|
|
|
|
// let msg=e.msg.replace(/#|图鉴/g,"");
|
|
|
|
|
let msg = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破/g, "");
|
2022-08-13 23:42:34 +08:00
|
|
|
|
let Botcfg;
|
|
|
|
|
let id;
|
|
|
|
|
if (isV3) {
|
|
|
|
|
Botcfg = (await import(`file://${_path}/plugins/genshin/model/gsCfg.js`)).default;
|
2022-08-13 23:53:41 +08:00
|
|
|
|
id=Botcfg.roleNameToID(msg)
|
2022-08-13 23:42:34 +08:00
|
|
|
|
} else {
|
|
|
|
|
Botcfg = YunzaiApps.mysInfo
|
|
|
|
|
id = Botcfg.roleIdToName(msg);
|
|
|
|
|
}
|
2022-06-17 15:10:02 +08:00
|
|
|
|
let name;
|
|
|
|
|
if (["10000005", "10000007", "20000000"].includes(id)) {
|
2022-08-13 23:42:34 +08:00
|
|
|
|
if (!["风主", "岩主", "雷主", "草主"].includes(msg)) {
|
2022-07-26 21:33:33 +08:00
|
|
|
|
e.reply("请选择:风主图鉴、岩主图鉴、雷主图鉴、草主图鉴");
|
2022-06-17 15:10:02 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
name = msg;
|
|
|
|
|
} else {
|
2022-08-13 23:42:34 +08:00
|
|
|
|
name = Botcfg.roleIdToName(id, true);
|
2022-06-17 15:10:02 +08:00
|
|
|
|
if (!name) return false;
|
|
|
|
|
}
|
2022-06-18 21:30:24 +08:00
|
|
|
|
send_Msg(e, "juese_tujian", name)
|
2022-06-17 15:10:02 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-18 21:30:24 +08:00
|
|
|
|
const send_Msg = function(e, type, name) {
|
2022-08-02 21:13:04 +08:00
|
|
|
|
let path;
|
2022-06-20 21:43:24 +08:00
|
|
|
|
if (type == "all") {
|
2022-08-16 22:07:56 +08:00
|
|
|
|
for (let [index,val] of list.entries()) {
|
|
|
|
|
name=e.msg.replace(new RegExp(reglist[index],"g"),"");
|
2022-08-13 23:42:34 +08:00
|
|
|
|
path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${val}/${name}.png`
|
2022-08-02 20:20:34 +08:00
|
|
|
|
if (fs.existsSync(path)) {
|
|
|
|
|
e.reply(segment.image(`file:///${path}`));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-06-20 21:43:24 +08:00
|
|
|
|
let new_name = info_img(e, Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/Atlas_alias/`,
|
|
|
|
|
val), name)
|
|
|
|
|
if (new_name) {
|
|
|
|
|
name = new_name
|
|
|
|
|
type = val;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-26 19:31:18 +08:00
|
|
|
|
path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}/${name}.png`
|
2022-06-17 15:10:02 +08:00
|
|
|
|
if (!fs.existsSync(path)) {
|
2022-06-26 19:31:18 +08:00
|
|
|
|
return false;
|
2022-06-17 15:10:02 +08:00
|
|
|
|
}
|
|
|
|
|
e.reply(segment.image(`file:///${path}`));
|
2022-06-19 18:33:42 +08:00
|
|
|
|
return true;
|
2022-06-17 15:10:02 +08:00
|
|
|
|
}
|
2022-06-28 00:32:56 +08:00
|
|
|
|
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("|");
|
2022-08-13 23:42:34 +08:00
|
|
|
|
for (let j = 0; j < title.length; j++) {
|
2022-06-28 00:32:56 +08:00
|
|
|
|
if (title[j] == name) {
|
2022-08-13 23:42:34 +08:00
|
|
|
|
await e.reply("请选择:\n" + list[i].join("\n"))
|
2022-06-28 00:32:56 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-06-20 21:43:24 +08:00
|
|
|
|
const info_img = function(e, list, name) {
|
|
|
|
|
for (let i in list) {
|
|
|
|
|
for (let val of list[i]) {
|
2022-06-28 00:32:56 +08:00
|
|
|
|
if (val == name || i == name) {
|
2022-06-20 21:43:24 +08:00
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-19 18:33:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|