diff --git a/plugins/genshin/apps/sevenSaints.js b/plugins/genshin/apps/sevenSaints.js new file mode 100644 index 0000000..5709100 --- /dev/null +++ b/plugins/genshin/apps/sevenSaints.js @@ -0,0 +1,45 @@ +import plugin from '../../../lib/plugins/plugin.js' +import puppeteer from '../../../lib/puppeteer/puppeteer.js' +import Deck from '../model/deck.js' + +export class sevenSaints extends plugin { + constructor() { + super({ + name: '七圣召唤卡组查询', + dsc: '原神角色信息查询', + event: 'message', + priority: 5000, + rule: [ + { + reg: '^#*七圣(召唤)?(牌|卡)组(列表)?[0-9]{0,2}$', + fnc: 'deckIndex' + }, + ] + }) + } + + async deckIndex() { + let index = this.e.msg.match(/[0-9]{1,2}/g) + if (index && index[0]) { + await this.deck(index[0]) + } else { + await this.deck_list() + } + } + + async deck(id) { + let data = await Deck.get(this.e, id) + if (!data) return + + let img = await puppeteer.screenshot('deck', data) + if (img) await this.reply(img) + } + + async deck_list(id = 0) { + let data = await Deck.get(this.e, id, true) + if (!data) return + + let img = await puppeteer.screenshot('deckList', data) + if (img) await this.reply(img) + } +} 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 diff --git a/plugins/genshin/model/mys/apiTool.js b/plugins/genshin/model/mys/apiTool.js index db5bc29..45ea7a6 100644 --- a/plugins/genshin/model/mys/apiTool.js +++ b/plugins/genshin/model/mys/apiTool.js @@ -87,6 +87,11 @@ export default class apiTool { url: `${hostRecord}game_record/app/genshin/api/gcg/basicInfo`, query: `role_id=${this.uid}&server=${this.server}` }, + /**七圣牌组 */ + deckList: { + url: `${hostRecord}game_record/app/genshin/api/gcg/deckList`, + query: `role_id=${this.uid}&server=${this.server}` + }, /**使用兑换码 目前仅限国际服,来自于国服的uid请求已在myinfo.js的init方法提前拦截 */ useCdk: { url: 'PLACE_HOLDER', diff --git a/plugins/genshin/model/mys/mysInfo.js b/plugins/genshin/model/mys/mysInfo.js index a63dce9..d6d6b8d 100644 --- a/plugins/genshin/model/mys/mysInfo.js +++ b/plugins/genshin/model/mys/mysInfo.js @@ -25,7 +25,7 @@ export default class MysInfo { } // ck对应MysUser对象 this.ckUser = null - this.auth = ['dailyNote', 'bbs_sign_info', 'bbs_sign_home', 'bbs_sign', 'ys_ledger', 'compute', 'avatarSkill', 'detail', 'blueprint', 'UserGame'] + this.auth = ['dailyNote', 'bbs_sign_info', 'bbs_sign_home', 'bbs_sign', 'ys_ledger', 'compute', 'avatarSkill', 'detail', 'blueprint', 'UserGame', 'deckList'] } static async init (e, api) { diff --git a/plugins/genshin/resources/html/deck/deck.css b/plugins/genshin/resources/html/deck/deck.css new file mode 100644 index 0000000..1283e2f --- /dev/null +++ b/plugins/genshin/resources/html/deck/deck.css @@ -0,0 +1,213 @@ +@font-face { + font-family: "tttgbnumber"; + src: url("../../font/tttgbnumber.ttf"); + font-weight: normal; + font-style: normal; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; + user-select: none; +} + +body { + font-size: 18px; + color: #1e1f20; + font-family: PingFangSC-Medium, PingFang SC, sans-serif; + transform: scale(2); + transform-origin: 0 0; +} + +.container { + width: 465px; + padding: 20px 15px 10px 15px; + background-color: #ececec; +} + +.head_box { + box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%); +} + +.head_box .id_text { + font-size: 24px; +} + +.head_box .role-name { + font-size: 24px; +} + +.head_box .genshin_logo { + position: absolute; + top: 1px; + right: 15px; + width: 97px; +} + +.basicInfo { + padding: 10px 5px 15px; + background: #f5f5f5; + box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%); + border-radius: 15px; + position: relative; + margin-bottom: 12px; +} + +.avatar_covers { + display: flex; + flex-wrap: wrap; +} + +.avatar_covers div { + flex: 0 0 33%; + padding: 10px; +} + +.avatar_covers img { + width: 100%; + height: 100%; + border: 2px solid #c3b6aa; + border-radius: 5px; +} + +.action_covers { + display: flex; + flex-wrap: wrap; +} + +.action_covers div { + flex: 0 0 25%; + padding: 5px; +} + +.action_covers img { + width: 100%; + height: 100%; + border: 2px solid #c3b6aa; + border-radius: 5px; +} + +.card-wrapper { + position: relative; + width: 25%; + padding: 5px; +} + +.card-wrapper img { + width: 100%; + height: 100%; + border: 2px solid #c3b6aa; + border-radius: 5px; +} + +.hp-container { + position: absolute; + top: 9%; + left: 12%; + transform: translate(-50%, -50%); +} + +.hp-container img { + position: absolute; + border: none; + top: 0; + left: 0; + width: 25px; + height: auto; +} + +.rq-container img { + position: absolute; + border: none; + top: 0; + left: 0; + width: 40px; + height: auto; +} + +.cost-wrapper { + display: flex; + flex-direction: column; + align-items: center; + position: absolute; + top: 0; + left: 0; +} + +.va-container { + position: relative; + top: -11px; + left: -2px; +} + +.va-container img { + position: relative; + border: none; + top: 0; + left: 0; + width: 20px; + height: auto; +} + +.ty-container { + position: relative; + top: -6px; + left: -7px; +} + +.ty-container img { + position: relative; + border: none; + top: 0; + left: 0; + width: 30px; + height: auto; +} +.num { + position: absolute; + bottom: 15px; + right: 15px; + transform: translate(50%, 50%); +} + +.num img { + border: none; + width: 30px; + height: auto; +} +.overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.logo { + font-size: 12px; + font-family: "tttgbnumber"; + text-align: center; + color: #7994a7; +} + +.bottom-msg { + font-size: 12px; + font-family: "tttgbnumber"; + text-align: center; + color: #7994a7; + margin-bottom: 5px; + margin-top: -5px; +} + +.tab_lable { + position: absolute; + top: -10px; + left: -8px; + background: #d4b98c; + color: #fff; + font-size: 14px; + padding: 3px 10px; + border-radius: 15px 0px 15px 15px; + z-index: 20; +} \ No newline at end of file diff --git a/plugins/genshin/resources/html/deck/deck.html b/plugins/genshin/resources/html/deck/deck.html new file mode 100644 index 0000000..d38e936 --- /dev/null +++ b/plugins/genshin/resources/html/deck/deck.html @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + {{@headIndexStyle}} + + + +
+
+
+ {{nickname}} lv:{{level}} +
+
+ UID: {{uid}} +
+ +
+
+ +
+
角色牌详情
+
+
+ {{each Data.avatar_cards val}} +
+
+ +
+
+
+ +
+
+ +
+
+ +
+ {{/each}} +
+
+
+
行动牌详情
+
+
+ {{each Data.action_cards val}} +
+
+
+ +
+ +
+
+ {{each val.action_cost vals}} +
+ +
+
+ +
+
+ {{/each}} +
+ +
+ {{/each}} +
+
+ + +
+ + + \ No newline at end of file diff --git a/plugins/genshin/resources/html/deckList/deckList.css b/plugins/genshin/resources/html/deckList/deckList.css new file mode 100644 index 0000000..1283e2f --- /dev/null +++ b/plugins/genshin/resources/html/deckList/deckList.css @@ -0,0 +1,213 @@ +@font-face { + font-family: "tttgbnumber"; + src: url("../../font/tttgbnumber.ttf"); + font-weight: normal; + font-style: normal; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; + user-select: none; +} + +body { + font-size: 18px; + color: #1e1f20; + font-family: PingFangSC-Medium, PingFang SC, sans-serif; + transform: scale(2); + transform-origin: 0 0; +} + +.container { + width: 465px; + padding: 20px 15px 10px 15px; + background-color: #ececec; +} + +.head_box { + box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%); +} + +.head_box .id_text { + font-size: 24px; +} + +.head_box .role-name { + font-size: 24px; +} + +.head_box .genshin_logo { + position: absolute; + top: 1px; + right: 15px; + width: 97px; +} + +.basicInfo { + padding: 10px 5px 15px; + background: #f5f5f5; + box-shadow: 0 5px 10px 0 rgb(0 0 0 / 15%); + border-radius: 15px; + position: relative; + margin-bottom: 12px; +} + +.avatar_covers { + display: flex; + flex-wrap: wrap; +} + +.avatar_covers div { + flex: 0 0 33%; + padding: 10px; +} + +.avatar_covers img { + width: 100%; + height: 100%; + border: 2px solid #c3b6aa; + border-radius: 5px; +} + +.action_covers { + display: flex; + flex-wrap: wrap; +} + +.action_covers div { + flex: 0 0 25%; + padding: 5px; +} + +.action_covers img { + width: 100%; + height: 100%; + border: 2px solid #c3b6aa; + border-radius: 5px; +} + +.card-wrapper { + position: relative; + width: 25%; + padding: 5px; +} + +.card-wrapper img { + width: 100%; + height: 100%; + border: 2px solid #c3b6aa; + border-radius: 5px; +} + +.hp-container { + position: absolute; + top: 9%; + left: 12%; + transform: translate(-50%, -50%); +} + +.hp-container img { + position: absolute; + border: none; + top: 0; + left: 0; + width: 25px; + height: auto; +} + +.rq-container img { + position: absolute; + border: none; + top: 0; + left: 0; + width: 40px; + height: auto; +} + +.cost-wrapper { + display: flex; + flex-direction: column; + align-items: center; + position: absolute; + top: 0; + left: 0; +} + +.va-container { + position: relative; + top: -11px; + left: -2px; +} + +.va-container img { + position: relative; + border: none; + top: 0; + left: 0; + width: 20px; + height: auto; +} + +.ty-container { + position: relative; + top: -6px; + left: -7px; +} + +.ty-container img { + position: relative; + border: none; + top: 0; + left: 0; + width: 30px; + height: auto; +} +.num { + position: absolute; + bottom: 15px; + right: 15px; + transform: translate(50%, 50%); +} + +.num img { + border: none; + width: 30px; + height: auto; +} +.overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.logo { + font-size: 12px; + font-family: "tttgbnumber"; + text-align: center; + color: #7994a7; +} + +.bottom-msg { + font-size: 12px; + font-family: "tttgbnumber"; + text-align: center; + color: #7994a7; + margin-bottom: 5px; + margin-top: -5px; +} + +.tab_lable { + position: absolute; + top: -10px; + left: -8px; + background: #d4b98c; + color: #fff; + font-size: 14px; + padding: 3px 10px; + border-radius: 15px 0px 15px 15px; + z-index: 20; +} \ No newline at end of file diff --git a/plugins/genshin/resources/html/deckList/deckList.html b/plugins/genshin/resources/html/deckList/deckList.html new file mode 100644 index 0000000..e795843 --- /dev/null +++ b/plugins/genshin/resources/html/deckList/deckList.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + {{@headIndexStyle}} + + + +
+
+
+ {{nickname}} lv:{{level}} +
+
+ UID: {{uid}} +
+ +
+
+ + {{each Data vals}} +
+
七圣卡组{{vals.id}} 使用#七圣卡组{{vals.id}}查看详情
+
+
+ {{each vals.avatar_cards val}} +
+
+ +
+
+
+ +
+
+ +
+
+ +
+ {{/each}} +
+
+ {{/each}} + +
+ + + \ No newline at end of file diff --git a/plugins/genshin/resources/img/deck/0.png b/plugins/genshin/resources/img/deck/0.png new file mode 100644 index 0000000..72ee2bb Binary files /dev/null and b/plugins/genshin/resources/img/deck/0.png differ diff --git a/plugins/genshin/resources/img/deck/1.png b/plugins/genshin/resources/img/deck/1.png new file mode 100644 index 0000000..e0765f5 Binary files /dev/null and b/plugins/genshin/resources/img/deck/1.png differ diff --git a/plugins/genshin/resources/img/deck/10.png b/plugins/genshin/resources/img/deck/10.png new file mode 100644 index 0000000..2feaf7a Binary files /dev/null and b/plugins/genshin/resources/img/deck/10.png differ diff --git a/plugins/genshin/resources/img/deck/2.png b/plugins/genshin/resources/img/deck/2.png new file mode 100644 index 0000000..5a11004 Binary files /dev/null and b/plugins/genshin/resources/img/deck/2.png differ diff --git a/plugins/genshin/resources/img/deck/3.png b/plugins/genshin/resources/img/deck/3.png new file mode 100644 index 0000000..dc0e445 Binary files /dev/null and b/plugins/genshin/resources/img/deck/3.png differ diff --git a/plugins/genshin/resources/img/deck/4.png b/plugins/genshin/resources/img/deck/4.png new file mode 100644 index 0000000..9d4b7b3 Binary files /dev/null and b/plugins/genshin/resources/img/deck/4.png differ diff --git a/plugins/genshin/resources/img/deck/5.png b/plugins/genshin/resources/img/deck/5.png new file mode 100644 index 0000000..6a44078 Binary files /dev/null and b/plugins/genshin/resources/img/deck/5.png differ diff --git a/plugins/genshin/resources/img/deck/6.png b/plugins/genshin/resources/img/deck/6.png new file mode 100644 index 0000000..70b664f Binary files /dev/null and b/plugins/genshin/resources/img/deck/6.png differ diff --git a/plugins/genshin/resources/img/deck/7.png b/plugins/genshin/resources/img/deck/7.png new file mode 100644 index 0000000..02aa7e6 Binary files /dev/null and b/plugins/genshin/resources/img/deck/7.png differ diff --git a/plugins/genshin/resources/img/deck/8.png b/plugins/genshin/resources/img/deck/8.png new file mode 100644 index 0000000..dc665cc Binary files /dev/null and b/plugins/genshin/resources/img/deck/8.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypeAnemo.png b/plugins/genshin/resources/img/deck/CostTypeAnemo.png new file mode 100644 index 0000000..6c3a2ba Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypeAnemo.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypeCryo.png b/plugins/genshin/resources/img/deck/CostTypeCryo.png new file mode 100644 index 0000000..4296aa4 Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypeCryo.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypeDenro.png b/plugins/genshin/resources/img/deck/CostTypeDenro.png new file mode 100644 index 0000000..07076a6 Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypeDenro.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypeElectro.png b/plugins/genshin/resources/img/deck/CostTypeElectro.png new file mode 100644 index 0000000..12eb958 Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypeElectro.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypeEnergy.png b/plugins/genshin/resources/img/deck/CostTypeEnergy.png new file mode 100644 index 0000000..f3f60ee Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypeEnergy.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypeGeo.png b/plugins/genshin/resources/img/deck/CostTypeGeo.png new file mode 100644 index 0000000..485c21f Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypeGeo.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypeHydro.png b/plugins/genshin/resources/img/deck/CostTypeHydro.png new file mode 100644 index 0000000..d1b4173 Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypeHydro.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypePyro.png b/plugins/genshin/resources/img/deck/CostTypePyro.png new file mode 100644 index 0000000..e65c512 Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypePyro.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypeSame.png b/plugins/genshin/resources/img/deck/CostTypeSame.png new file mode 100644 index 0000000..b926e76 Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypeSame.png differ diff --git a/plugins/genshin/resources/img/deck/CostTypeVoid.png b/plugins/genshin/resources/img/deck/CostTypeVoid.png new file mode 100644 index 0000000..024c778 Binary files /dev/null and b/plugins/genshin/resources/img/deck/CostTypeVoid.png differ diff --git a/plugins/genshin/resources/img/deck/容器.png b/plugins/genshin/resources/img/deck/容器.png new file mode 100644 index 0000000..ee66bb6 Binary files /dev/null and b/plugins/genshin/resources/img/deck/容器.png differ diff --git a/plugins/genshin/resources/img/deck/边框.png b/plugins/genshin/resources/img/deck/边框.png new file mode 100644 index 0000000..3ac866a Binary files /dev/null and b/plugins/genshin/resources/img/deck/边框.png differ