Pre Merge pull request !64 from 帮帮/master

This commit is contained in:
帮帮 2023-07-08 16:01:02 +00:00 committed by Gitee
commit 9beeb55244
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
30 changed files with 678 additions and 1 deletions

View File

@ -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)
}
}

View File

@ -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 = `<style> .head_box { background: url(${this.screenData.pluResPath}img/roleIndex/namecard/${lodash.random(1, 8)}.png) #f5f5f5; background-position-x: 30px; background-repeat: no-repeat; border-radius: 15px; font-family: tttgbnumber; padding: 10px 20px; position: relative; background-size: auto 101%; }</style>`
}
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
}
}

View File

@ -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',

View File

@ -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) {

View File

@ -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;
}

View File

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="shortcut icon" href="#" />
<link rel="stylesheet" type="text/css" href="{{pluResPath}}html/deck/deck.css" />
<link rel="preload" href="{{pluResPath}}font/tttgbnumber.ttf" as="font">
<link rel="preload" href="{{pluResPath}}img/roleIndex/namecard/{{bg}}.png" as="image">
<link rel="preload" href="{{pluResPath}}img/other/bg5.png" as="image">
<link rel="preload" href="{{pluResPath}}img/other/bg4.png" as="image">
<link rel="preload" href="{{pluResPath}}img/other/bg105.png" as="image">
<link rel="preload" href="{{pluResPath}}img/abyss/bg.png" as="image">
{{@headIndexStyle}}
</head>
<body>
<div class="container" id="container">
<div class="head_box">
<div class="role-name">
{{nickname}} lv:{{level}}
</div>
<div class="id_text">
UID: {{uid}}
</div>
<img class="genshin_logo" src="{{pluResPath}}img/other/原神.png" />
</div>
<div style="height: 11px;"></div>
<div class="basicInfo">
<div class="tab_lable">角色牌详情</div>
<div style="height: 10px;"></div>
<div class="avatar_covers">
{{each Data.avatar_cards val}}
<div class="card-wrapper">
<div class="overlay">
<img src="{{pluResPath}}img/deck/边框.png" alt="">
</div>
<div class="overlay">
<div class="rq-container">
<img src="{{pluResPath}}img/deck/容器.png" alt="">
</div>
<div class="hp-container">
<img src="{{pluResPath}}img/deck/{{val.hp}}.png" alt="">
</div>
</div>
<img src="{{val.image}}" alt="">
</div>
{{/each}}
</div>
</div>
<div class="basicInfo">
<div class="tab_lable">行动牌详情</div>
<div style="height: 10px;"></div>
<div class="action_covers">
{{each Data.action_cards val}}
<div class="card-wrapper">
<div class="overlay">
<div class="num">
<img src="{{pluResPath}}img/deck/{{val.num}}.png" alt="">
</div>
<img src="{{pluResPath}}img/deck/边框.png" alt="">
</div>
<div class="cost-wrapper">
{{each val.action_cost vals}}
<div class="ty-container">
<img src="{{pluResPath}}img/deck/{{vals.cost_type}}.png" alt="" style="position: absolute; z-index: 1;">
</div>
<div class="va-container">
<img src="{{pluResPath}}img/deck/{{vals.cost_value}}.png" alt="" style="position: absolute; z-index: 2;">
</div>
<div style="height: 150px;"></div>
{{/each}}
</div>
<img src="{{val.image}}" alt="">
</div>
{{/each}}
</div>
</div>
<div class="logo">Created By Miao-Yunzai</div>
</div>
</body>
</html>

View File

@ -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;
}

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="shortcut icon" href="#" />
<link rel="stylesheet" type="text/css" href="{{pluResPath}}html/deckList/deckList.css" />
<link rel="preload" href="{{pluResPath}}font/tttgbnumber.ttf" as="font">
<link rel="preload" href="{{pluResPath}}img/roleIndex/namecard/{{bg}}.png" as="image">
<link rel="preload" href="{{pluResPath}}img/other/bg5.png" as="image">
<link rel="preload" href="{{pluResPath}}img/other/bg4.png" as="image">
<link rel="preload" href="{{pluResPath}}img/other/bg105.png" as="image">
<link rel="preload" href="{{pluResPath}}img/abyss/bg.png" as="image">
{{@headIndexStyle}}
</head>
<body>
<div class="container" id="container">
<div class="head_box">
<div class="role-name">
{{nickname}} lv:{{level}}
</div>
<div class="id_text">
UID: {{uid}}
</div>
<img class="genshin_logo" src="{{pluResPath}}img/other/原神.png" />
</div>
<div style="height: 12px;"></div>
{{each Data vals}}
<div class="basicInfo">
<div class="tab_lable">七圣卡组{{vals.id}} 使用#七圣卡组{{vals.id}}查看详情</div>
<div style="height: 10px;"></div>
<div class="avatar_covers">
{{each vals.avatar_cards val}}
<div class="card-wrapper">
<div class="overlay">
<img src="{{pluResPath}}img/deck/边框.png" alt="">
</div>
<div class="overlay">
<div class="rq-container">
<img src="{{pluResPath}}img/deck/容器.png" alt="">
</div>
<div class="hp-container">
<img src="{{pluResPath}}img/deck/{{val.hp}}.png" alt="">
</div>
</div>
<img src="{{val.image}}" alt="">
</div>
{{/each}}
</div>
</div>
{{/each}}
<div class="logo">Created By Miao-Yunzai</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB