From 0322bb64851590106754aefdb89fb73125a88642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=AE=E5=B8=AE?= <11372541+bbaban@user.noreply.gitee.com> Date: Sat, 8 Jul 2023 15:43:58 +0000 Subject: [PATCH] pull MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 帮帮 <11372541+bbaban@user.noreply.gitee.com> --- plugins/genshin/model/deck.js | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 plugins/genshin/model/deck.js diff --git a/plugins/genshin/model/deck.js b/plugins/genshin/model/deck.js new file mode 100644 index 0000000..c79a445 --- /dev/null +++ b/plugins/genshin/model/deck.js @@ -0,0 +1,58 @@ +import base from './base.js' +import MysInfo from './mys/mysInfo.js' +import lodash from 'lodash' + +export default class Deck extends base { + constructor(e) { + super(e) + this.model = 'deck' + + this.headIndexStyle = `` + } + + static async get(e, id, list = false) { + let deck = new Deck(e) + return await deck.getIndex(id, list) + } + + async getIndex(id, list) { + let seed_id = lodash.sample('abcdefghijklmnopqrstuvwxyz0123456789', 16).replace(/,/g, '') + let device_fp = await MysInfo.get(this.e, 'getFp', { + seed_id + }) + let res = await MysInfo.get(this.e, 'deckList', { + headers: { + 'x-rpc-device_fp': device_fp?.data?.device_fp + } + }) + if (res?.retcode !== 0) return false + + let Data + if (!list) { + for (let i of res.data.deck_list) { + if (i.id == id) Data = i + } + if (!Data) { + this.e.reply(`无牌组${id},请查看#七圣卡组列表`) + return false + } + } else { + this.model = 'deckList' + Data = res.data.deck_list + } + + /** 截图数据 */ + let data = { + quality: 80, + ...this.screenData, + uid: this.e.uid, + saveId: this.e.uid, + nickname: res.data.nickname, + level: res.data.level, + Data, + headIndexStyle: this.headIndexStyle + } + return data + } + +} \ No newline at end of file