Skip to content

Commit

Permalink
Add pure fiction
Browse files Browse the repository at this point in the history
  • Loading branch information
ZM-J committed Jan 30, 2024
1 parent 3758864 commit 2519dfe
Show file tree
Hide file tree
Showing 8 changed files with 495 additions and 4 deletions.
103 changes: 101 additions & 2 deletions apps/challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ export class Challenge extends plugin {
priority: setting.getConfig('gachaHelp').noteFlag ? 5 : 500,
rule: [
{
reg: `^${rulePrefix}(上期|本期)?(深渊|忘却之庭|混沌)$`,
reg: `^${rulePrefix}(上期|本期)?(深渊|忘却|忘却之庭|混沌|混沌回忆)$`,
fnc: 'challenge'
},
{
reg: `^${rulePrefix}(上期|本期)?(虚构|虚构叙事)$`,
fnc: 'challengeStory'
}
]
})
Expand Down Expand Up @@ -83,7 +87,7 @@ export class Challenge extends plugin {
if (retcode === 0) {
challengeData = res
} else {
logger.warn('星铁深渊详细信息出现验证码,仅显示最后一层信息')
logger.warn('星铁忘却之庭详细信息出现验证码,仅显示最后一层信息')
}
// await api.checkCode(this.e, challengeData, 'srNote')
// if (challengeData.retcode !== 0) {
Expand Down Expand Up @@ -113,6 +117,101 @@ export class Challenge extends plugin {
})
}

async challengeStory (e) {
this.e.isSr = true
this.isSr = true
let user = this.e.user_id
let ats = e.message.filter(m => m.type === 'at')
if (ats.length > 0 && !e.atBot) {
user = ats[0].qq
this.e.user_id = user
this.User = new User(this.e)
}

let uid = e.msg.match(/\d+/)?.[0]
await this.miYoSummerGetUid()
uid = uid || (await redis.get(`STAR_RAILWAY:UID:${user}`)) || this.e.user?.getUid('sr')
if (!uid) {
await e.reply('尚未绑定uid,请发送#星铁绑定uid进行绑定')
return false
}

let ck = await getCk(e)
if (!ck || Object.keys(ck).filter(k => ck[k].ck).length === 0) {
let ckArr = GsCfg.getConfig('mys', 'pubCk') || []
ck = ckArr[0]
}
if (!ck) {
await e.reply(`尚未绑定Cookie,${this.app2config.docs}`)
return false
}

let scheduleType = '1'
if (e.msg.indexOf('上期') > -1) {
scheduleType = '2'
}

let api = new MysSRApi(uid, ck)
let sdk = api.getUrl('getFp')
let fpRes = await fetch(sdk.url, { headers: sdk.headers, method: 'POST', body: sdk.body })
fpRes = await fpRes.json()
let deviceFp = fpRes?.data?.device_fp
if (deviceFp) {
await redis.set(`STARRAIL:DEVICE_FP:${uid}`, deviceFp, { EX: 86400 * 7 })
}
// 先查simple,大概率simple不出验证码,详细才出
let simpleRes = await api.getData('srChallengeStorySimple', { deviceFp, schedule_type: scheduleType })
simpleRes = await api.checkCode(this.e, simpleRes, 'srChallengeStorySimple', { deviceFp, schedule_type: scheduleType })
if (simpleRes.retcode !== 0) {
// 连简单也出验证码,打住
return false
}
let challengeData = simpleRes
// 简单的没出验证码,试一下复杂的
let res = await api.getData('srChallengeStory', { deviceFp, schedule_type: scheduleType })
res = await api.checkCode(this.e, res, 'srChallengeStory', { deviceFp, schedule_type: scheduleType })
let retcode = Number(res.retcode)
if (retcode === 0) {
challengeData = res
} else {
logger.warn('星铁虚构叙事详细信息出现验证码,仅显示最后一层信息')
}
// await api.checkCode(this.e, challengeData, 'srNote')
// if (challengeData.retcode !== 0) {
// return false
// }
const data = { ...challengeData.data }
// data.beginTime = this.timeForamt(data.begin_time)
// data.endTime = this.timeForamt(data.end_time)
data.beginTime = this.timeForamt(data.groups[0].begin_time)
data.endTime = this.timeForamt(data.groups[0].end_time)
data.all_floor_detail = _.map(data.all_floor_detail, (floor) => {
return {
...floor,
node_1: {
...floor.node_1,
challengeTime: this.timeForamt(floor.node_1.challenge_time, 'YYYY.MM.DD HH:mm')
},
node_2: {
...floor.node_2,
challengeTime: this.timeForamt(floor.node_2.challenge_time, 'YYYY.MM.DD HH:mm')
}
}
})
// 虚构叙事:计算两边节点的总分
data.all_floor_detail = _.map(data.all_floor_detail, (floor) => {
return {
...floor,
score: (parseInt(floor.node_1.score) + parseInt(floor.node_2.score)).toString(),
}
})
await runtimeRender(e, '/challengestory/index.html', {
data,
uid,
type: scheduleType
})
}

async miYoSummerGetUid () {
let key = `STAR_RAILWAY:UID:${this.e.user_id}`
let ck = await getCk(this.e)
Expand Down
6 changes: 5 additions & 1 deletion config/system/help_system.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ export const helpList = [
desc: '角色卡片(仅支持绑定ck查询)'
}, {
icon: 110,
title: '*深渊',
title: '*忘却',
desc: '忘却之庭信息'
}, {
icon: 110,
title: '*虚构',
desc: '虚构叙事信息'
}, {
icon: 91,
title: '*在线时长',
Expand Down
2 changes: 1 addition & 1 deletion resources/challenge/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{{block 'main'}}

<h2 class="head" style="margin-bottom: 20px;text-align: center;">UID: {{ uid }} 的深渊数据 <span class="tag">{{ type == '1' ? '本期' : '上期' }}</span></h2>
<h2 class="head" style="margin-bottom: 20px;text-align: center;">UID: {{ uid }} 的忘却之庭数据 <span class="tag">{{ type == '1' ? '本期' : '上期' }}</span></h2>

<div class="body">
<div class="count">统计周期: {{ data.beginTime }}-{{ data.endTime }}</div>
Expand Down
Binary file added resources/challengestory/buff/3031302.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/challengestory/buff/3031303.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
242 changes: 242 additions & 0 deletions resources/challengestory/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
.container {
padding: 40px 40px 0 40px;
width: 800px;
overflow: hidden;
background: url('../common/cont/bkg.png') center no-repeat;
background-size: cover;
color: #f0eaca;
font-family: 'SR', sans-serif;
font-size: 1.2rem;
box-sizing: border-box;
}

.container * {
box-sizing: border-box;
}

img.rogue-star {
width: 60px;
height: 60px;
}

img.rogue-star-small {
width: 35px;
height: 35px;
}

.head {
display: flex;
justify-content: center;
align-items: center;
}

.head .tag {
margin-left: 20px;
padding: 0 6px;
border: 2px solid #f0eaca;
border-radius: 8px;
font-size: 18px;
}

.body {
margin-top: 20px;
}

.count {
color: #aaa;
}

.summar {
margin-top: 10px;
border-radius: 12px;
padding: 30px 30px;
background: url('../images/rogue-bg.png') no-repeat;
background-size: cover;
}

.summar h2 {
text-align: center;
color: #f3ca87;
}

.summar-content {
display: flex;
margin-top: 20px;
border: 1px #ddd solid;
color: #f0eaca;
}

.summar-star {
display: flex;
justify-content: center;
align-items: center;
border-right: 1px #ddd solid;
width: 25%;
}

.summar-info {
padding: 20px 30px;
}

.detail-list {

}

.detail-item {
margin-top: 20px;
border-top-right-radius: 36px;
padding: 4px;
background: url('../images/rogue-bg.png') no-repeat;
background-size: cover;
}

.detail-border {
border: 2px #ddd solid;
border-top-right-radius: 36px;
}

.detail-head {
display: flex;
justify-content: space-between;
border-top-right-radius: 36px;
padding: 20px 30px;
background-color: rgba(0, 0, 0, .4);
}

.detail-title {
color: #f0eaca;
font-size: 24px;
}

.detail-title p:last-of-type {
margin-top: 8px;
font-size: 18px;
opacity: .85;
}

.detail-score {
font-size: 18px;
opacity: .85;
}

.detail-score span {
font: bold;
}

.detail-body {
padding: 20px 30px;
color: #f0eaca;
}

.detail-bar {
display: flex;
justify-content: space-between;
}

.detail-node-title, .detail-node-score {
margin-top: 16px;
}

.detail-node-title span {
opacity: .85;
font-size: 16px;
}

.detail-avatars {
margin-top: 14px;
display: flex;
margin-left: 30px;
}

.detail-avatar {
position: relative;
margin-left: 20px;
border-top-right-radius: 20px;
padding: 4px;
width: 120px;
height: 140px;
}

.detail-avatar.rank5 {
background-image: url("../images/rank5bg.webp");
}

.detail-avatar.rank4 {
background-image: url("../images/rank4bg.webp");
}

.detail-avatar-border {
border: 2px #ddd solid;
border-top-right-radius: 20px;
/* width: 100%;
height: 100%; */
}

.detail-avatar img.element {
position: absolute;
top: 8px;
width: 20px;
height: 20px;
}

.detail-avatar img.char {
width: 112px;
height: 124px;
}

.detail-avatar .level {
position: absolute;
background-color: #000;
left: 0;
bottom: 4px;
width: 100%;
text-align: center;
}

.detail-buff {
margin-top: 14px;
display: flex;
margin-left: 30px;
margin-right: 30px;
}

.detail-buff-border {
border: 2px #ddd solid;
background-color: rgb(49, 54, 73);
display: flex;
/* width: 100%;
height: 100%; */
}

.buff-col {
width: 80px;
}

.buff-icon-container {
width: 60px;
height: 60px;
margin: 0 auto;
overflow: hidden;
}

img.buff-icon {
width: 100%;
height: 100%;
}

.description-col {
flex-grow: 1;
}

.buff-description {
margin: 10px;
}

.logo {
font-size: 24px;
font-family: 'tttgbnumber';
/* color: #f0eaca; */
text-align: center;
margin-top: 30px;
padding-bottom: 30px;
}
Loading

0 comments on commit 2519dfe

Please sign in to comment.