修正MysAuth的鉴权

This commit is contained in:
yoimiya-kokomi 2022-09-22 03:28:33 +08:00
parent 62c943f3c2
commit 6b3aa006a9
11 changed files with 727 additions and 8 deletions

View File

@ -53,7 +53,7 @@ const checkAuth = async function (e) {
if (!e.isMaster) {
e.reply(`只有主人才能命令喵喵哦~
(*/ω*)`)
return true
return false
}
return await MysApi.initUser(e)
}

View File

@ -11,13 +11,14 @@ let action = {
keyword: '命座|天赋|技能|资料|照片|写真|图片|插画'
}
}
let wikiReg = /^(?:#|喵喵)?(.*)(天赋|技能|命座|命之座|资料|图鉴|照片|写真|图片|图像)$/
let app = App.init({
id: 'wiki',
name: '角色资料'
})
app.reg('wiki', wiki, {
rule: /^(#|喵喵)?.*(天赋|技能|命座|命之座|资料|图鉴|照片|写真|图片|图像)$/,
rule: wikiReg,
desc: '【#资料】 #神里天赋 #夜兰命座'
})
app.reg('calendar', calendar, {
@ -32,9 +33,8 @@ async function wiki (e) {
return false
}
let reg = /#?(.+)(命座|命之座|天赋|技能|资料|图鉴|照片|写真|图片|图像)$/
let msg = e.msg
let ret = reg.exec(msg)
let ret = wikiReg.exec(msg)
if (!ret || !ret[1] || !ret[2]) {
return false
@ -47,6 +47,8 @@ async function wiki (e) {
mode = 'wiki'
} else if (/图|画|写真|照片/.test(ret[2])) {
mode = 'pic'
} else if (/(材料|养成|成长)/.test(ret[2])) {
mode = 'material'
}
if ((mode === 'pic' && Common.isDisable(e, 'wiki.pic')) ||
@ -81,9 +83,11 @@ async function wiki (e) {
}
if (mode === 'wiki') {
return await renderWiki({ e, char })
} else if (mode === 'material') {
return await renderCharMaterial({ e, char })
}
return await Common.render('wiki/character-talent', {
// saveId: `${mode}-${char.id}-${char.elem}`,
saveId: `${mode}-${char.id}`,
...char.getData(),
detail: char.getDetail(),
imgs: char.getImgs(),
@ -115,6 +119,19 @@ async function renderWiki ({ e, char }) {
}, { e, scale: 1.4 })
}
async function renderCharMaterial ({ e, char }) {
let data = char.getData()
return await Common.render('wiki/character-material', {
// saveId: `info-${char.id}`,
data,
attr: char.getAttrList(),
detail: char.getDetail(),
imgs: char.getImgs(),
materials: char.getMaterials(),
elem: char.elem
}, { e, scale: 1.4 })
}
const getLineData = function (char) {
let ret = []
const attrMap = {

View File

@ -1,3 +1,7 @@
/*
* Mys深渊数据处理
* */
import lodash from 'lodash'
import moment from 'moment'
import Base from '../models/Base.js'

View File

@ -102,6 +102,10 @@ class Character extends Base {
return CharMeta.getMaterials(this)
}
getLvStat () {
return CharMeta.getLvStat(this)
}
get birthday () {
let birth = this.birth
if (!birth) {

View File

@ -58,6 +58,56 @@ const mKeys = [{
star: 5
}]
let item = (type, lv, num) => {
return { type, lv, num }
}
let gem = (lv = 1, num = 1) => item('gem', lv, num)
let sp = (num) => item('specialty', 1, num)
let normal = (lv, num) => item('normal', lv, num)
let boss = (num) => item('boss', 1, num)
let money = (num) => item('money', 1, num)
const lvKeys = [{
lv: '1'
}, {
lv: '20'
}, {
lv: '20+',
items: [gem(1, 1), sp(3), normal(1, 3), money(2)]
}, {
lv: '40',
total: [gem(1, 1), sp(3), normal(1, 3), money(2)]
}, {
lv: '40+',
items: [gem(2, 3), boss(2), sp(10), normal(1, 15), money(4)]
}, {
lv: '50',
total: [gem(1, 1), gem(2, 3), boss(2), sp(13), normal(1, 18), money(6)]
}, {
lv: '50+',
items: [gem(2, 6), boss(4), sp(20), normal(2, 12), money(6)],
}, {
lv: '60',
total: [gem(1, 1), gem(2, 9), boss(6), sp(33), normal(1, 18), normal(2, 12), money(12)]
}, {
lv: '60+',
items: [gem(3, 3), boss(8), sp(30), normal(2, 18), money(8)],
}, {
lv: '70',
total: [gem(1, 1), gem(2, 9), gem(3, 3), boss(14), sp(63), normal(1, 18), normal(2, 30), money(20)]
}, {
lv: '70+',
items: [gem(3, 6), boss(12), sp(45), normal(3, 12), money(10)],
}, {
lv: '80',
total: [gem(1, 1), gem(2, 9), gem(3, 9), boss(26), sp(108), normal(1, 18), normal(2, 30), normal(3, 12), money(30)]
}, {
lv: '80+',
items: [gem(4, 6), boss(20), sp(60), normal(3, 24), money(12)]
}, {
lv: '90',
total: [gem(1, 1), gem(2, 9), gem(3, 9), gem(4, 6), boss(46), sp(168), normal(1, 18), normal(2, 30), normal(3, 36), money(42)]
}]
const CharMeta = {
getAttrList (base, grow, elem = '') {
let ret = []
@ -93,6 +143,10 @@ const CharMeta = {
return ret
},
getLvStat (char) {
},
getDesc (desc) {
desc = desc.replace(/。$/, '')
desc = desc.replace('</br>', '')

View File

@ -530,5 +530,87 @@
"通过这种方式至多使丰穰之核造成的伤害提升400%。"
]
}
]
],
"attr": {
"keys": [
"hpBase",
"atkBase",
"defBase",
"hpPct"
],
"details": {
"1": [
"1182",
"17.88",
"56.72",
"0%"
],
"20": [
"3066",
"46.37",
"147.13",
"0%"
],
"50": [
"7852",
"118.74",
"376.76",
"7.2%"
],
"60": [
"9850",
"148.95",
"472.64",
"14.4%"
],
"70": [
"11618",
"175.68",
"557.44",
"14.4%"
],
"80": [
"13397",
"202.58",
"642.82",
"21.6%"
],
"90": [
"15185",
"229.61",
"728.59",
"28.8%"
],
"20+": [
"4080",
"61.69",
"195.76",
"0%"
],
"50+": [
"8813",
"133.25",
"422.84",
"14.4%"
],
"60+": [
"10571",
"159.84",
"507.19",
"14.4%"
],
"70+": [
"12338",
"186.56",
"592.0",
"21.6%"
],
"80+": [
"14117",
"213.47",
"677.37",
"28.8%"
]
}
}
}

View File

@ -0,0 +1,221 @@
.font-YS {
font-family: Number, "汉仪文黑-65W", YS, PingFangSC-Medium, "PingFang SC", sans-serif;
}
.font-NZBZ {
font-family: Number, "印品南征北战NZBZ体", NZBZ, "汉仪文黑-65W", YS, PingFangSC-Medium, "PingFang SC", sans-serif;
}
body {
width: 600px;
}
.container {
width: 600px;
padding: 0;
background-size: cover;
overflow: hidden;
}
.char-title {
height: 100px;
padding-right: 10px;
}
.char-title .char-name {
font-size: 40px;
}
.char-title .char-name span {
font-size: 28px;
padding-right: 10px;
}
.basic {
height: 500px;
}
.char-desc {
padding-left: 200px;
font-size: 14px;
}
.char-meta {
padding-left: 370px;
}
.detail {
right: 18px;
}
.detail .cont {
margin-right: 0;
}
.detail ul.char-attr li {
width: 250px;
padding-left: 20px;
}
.detail ul.char-attr li strong {
position: initial;
color: #d3bc8e;
}
.detail ul.char-attr li span {
color: #fff;
right: 20px;
text-align: right;
width: 150px;
}
.material-list {
display: flex;
padding: 5px;
position: absolute;
left: 10px;
bottom: 6px;
z-index: 5;
}
.material-list .num {
font-size: 12px;
text-align: center;
color: #fff;
text-shadow: 0 0 1px #000, 0 0 1px #000, 0 0 3px rgba(0, 0, 0, 0.8);
display: block;
height: 14px;
margin-left: -10px;
margin-right: -10px;
width: calc(100% + 20px);
}
.material-list .item-card {
width: 47px;
margin: 2px;
overflow: hidden;
}
.material-list .item-card .item-icon {
background-size: cover;
padding: 6px 4px 17px;
}
.material-list .item-card .item-bg {
background-size: contain;
background-position: center;
}
.material-list .item-card .item-title {
display: block;
font-size: 12px;
position: absolute;
color: #fff;
bottom: 0;
left: 0;
white-space: nowrap;
background: rgba(0, 0, 0, 0.5);
padding: 4px 0;
width: 68px;
text-align: center;
transform-origin: left bottom;
transform: scale(0.7);
text-shadow: 0 0 2px #000;
}
.talent-notice {
color: #fff;
font-size: 13px;
text-align: center;
padding: 3px;
text-shadow: 0 0 1px #000, 1px 1px 2px #000;
}
.talent-notice strong {
color: #d3bc8e;
font-weight: normal;
}
.cont .cont-title.border-less {
padding: 10px 15px 3px;
}
.talent-cont {
text-align: center;
}
.talent-cont strong {
color: #d3bc8e;
}
.weapon-list {
padding: 3px;
}
.weapon-list .item {
margin: 3px;
}
.char-holding {
display: flex;
padding: 8px;
}
.char-holding .cons-title {
height: 15px;
line-height: 15px;
font-size: 13px;
color: #d3bc8e;
text-shadow: 0 0 2px #000;
}
.char-pct {
width: 125px;
margin-right: 10px;
text-align: center;
position: relative;
}
.char-pct strong {
margin-top: 10px;
display: block;
height: 60px;
line-height: 60px;
font-size: 30px;
text-shadow: 0 0 1px #000, 1px 1px 3px #000;
}
.char-pct span {
display: block;
font-size: 13px;
color: #d3bc8e;
height: 15px;
line-height: 15px;
}
.char-pct:after {
content: "";
display: block;
width: 1px;
height: 50px;
position: absolute;
right: 1px;
top: 30px;
background: rgba(255, 255, 255, 0.8);
transform: scaleX(0.7);
}
.char-cons {
position: initial;
width: initial;
}
.char-cons .cons0 .talent-icon {
opacity: 0.3;
}
.char-cons .cons-item {
width: 60px;
text-align: center;
}
.char-cons .cons-item .talent-icon {
width: 60px;
height: 60px;
margin: 0 auto;
}
.char-cons .cons-num {
margin-top: -5px;
height: 25px;
line-height: 25px;
font-size: 16px;
text-shadow: 0 0 1px #000, 1px 1px 3px #000;
}
.item-value {
color: #000;
text-align: center;
line-height: 20px;
font-size: 15px;
}
.item-title {
font-size: 12px;
transform: scale(0.9);
margin-top: -3px;
}
.artis-list .artis-count2 {
position: relative;
}
.artis-list .artis-count2 .item-bg {
transform: scale(0.7);
transform-origin: left top;
}
.artis-list .artis-count2 .item-bg.artis2 {
position: absolute;
left: 0;
top: 0;
transform-origin: right bottom;
}
/*# sourceMappingURL=character-material.css.map */

View File

@ -0,0 +1,57 @@
{{extend elemLayout}}
{{block 'css'}}
<link rel="stylesheet" type="text/css" href="{{_res_path}}/common/tpl.css"/>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/character/profile-detail.css"/>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/wiki/character-wiki.css"/>
{{/block}}
{{set weapon = data.weapon}}
{{set dataSource = data.dataSource}}
{{block 'main'}}
<div class="basic">
<div class="main-pic"
style="background-image:url({{_res_path}}{{imgs.splash}})"></div>
<div class="detail">
<div class="char-title">
<div class="char-name"><span>{{data.title}} · </span>{{data.name}}</div>
<div class="char-lv char-desc">{{@data.desc}}</div>
</div>
<div class="char-meta">
<div class="cont">
<ul class="attr char-attr">
<li><strong>武器类型</strong> <span>{{data.weaponType}}</span></li>
<li><strong>命之座</strong> <span>{{data.astro}}</span></li>
<li><strong>生日</strong> <span>{{data.birthday}}</span></li>
<li><strong>归属</strong> <span>{{data.allegiance}}</span></li>
<li><strong>中文CV</strong> <span>{{data.cncv}}</span></li>
<li><strong>日文CV</strong> <span>{{data.jpcv}}</span></li>
</ul>
</div>
<div class="cont">
<div class="cont-title">90级基础属性</div>
<ul class="attr char-attr">
{{each attr ds}}
<li><strong>{{ds.title}}</strong> <span>{{ds.value}}</span></li>
{{/each}}
</ul>
</div>
</div>
</div>
<div class="material-list">
{{each materials ds}}
<div class="material-{{ds.type}}">
<div class="num">{{ds.num}}</div>
<div class="item-card material-card">
<div class="item-icon star{{ds.star}} opacity-bg">
<div class="item-bg" style="background-image:url({{_res_path}}{{ds.icon}})"></div>
</div>
<div class="item-title">{{ds.label}}</div>
</div>
</div>
{{/each}}
</div>
</div>
{{/block}}

View File

@ -0,0 +1,278 @@
@import "../common/base.less";
body {
width: 600px;
}
.container {
width: 600px;
padding: 0;
background-size: cover;
overflow: hidden;
& > .cont {
}
}
.char-title {
height: 100px;
padding-right: 10px;
.char-name {
font-size: 40px;
span {
font-size: 28px;
padding-right: 10px;
}
}
}
.basic {
height: 500px;
&:after {
}
}
.char-desc {
padding-left: 200px;
font-size: 14px;
}
.char-meta {
padding-left: 370px;
.title {
}
}
.detail {
right: 18px;
.cont {
margin-right: 0;
}
ul.char-attr {
li {
width: 250px;
padding-left: 20px;
strong {
position: initial;
color: #d3bc8e;
}
span {
color: #fff;
right: 20px;
text-align: right;
width: 150px;
}
}
}
}
.material-list {
display: flex;
padding: 5px;
position: absolute;
left: 10px;
bottom: 6px;
z-index: 5;
.num {
font-size: 12px;
text-align: center;
color: #fff;
text-shadow: 0 0 1px #000, 0 0 1px #000, 0 0 3px rgba(0, 0, 0, 0.8);
display: block;
height: 14px;
margin-left: -10px;
margin-right: -10px;
width: calc(100% + 20px)
}
.item-card {
width: 47px;
margin: 2px;
overflow: hidden;
.item-icon {
background-size: cover;
padding: 6px 4px 17px;
}
.item-bg {
background-size: contain;
background-position: center;
}
.item-title {
display: block;
font-size: 12px;
position: absolute;
color: #fff;
bottom: 0;
left: 0;
white-space: nowrap;
background: rgba(0, 0, 0, 0.5);
padding: 4px 0;
width: 68px;
text-align: center;
transform-origin: left bottom;
transform: scale(.7);
text-shadow: 0 0 2px #000;
}
}
}
.talent-notice {
color: #fff;
font-size: 13px;
text-align: center;
padding: 3px;
text-shadow: 0 0 1px #000, 1px 1px 2px #000;
strong {
color: #d3bc8e;
font-weight: normal;
}
}
.cont .cont-title.border-less {
padding: 10px 15px 3px;
}
.talent-cont {
text-align: center;
strong {
color: #d3bc8e;
}
}
.weapon-list {
padding: 3px;
.item {
margin: 3px;
}
}
.char-holding {
display: flex;
padding: 8px;
.cons-title {
height: 15px;
line-height: 15px;
font-size: 13px;
color: #d3bc8e;
text-shadow: 0 0 2px #000;
}
}
.char-pct {
width: 125px;
margin-right: 10px;
text-align: center;
position: relative;
strong {
margin-top: 10px;
display: block;
height: 60px;
line-height: 60px;
font-size: 30px;
text-shadow: 0 0 1px #000, 1px 1px 3px #000;
}
span {
display: block;
font-size: 13px;
color: #d3bc8e;
height: 15px;
line-height: 15px;
}
&:after {
content: "";
display: block;
width: 1px;
height: 50px;
position: absolute;
right: 1px;
top: 30px;
background: rgba(255, 255, 255, .8);
transform: scaleX(.7);
}
}
.char-cons {
position: initial;
width: initial;
.cons0 {
.talent-icon {
opacity: .3;
}
}
.cons-item {
width: 60px;
text-align: center;
.talent-icon {
width: 60px;
height: 60px;
margin: 0 auto;
}
}
.cons-num {
margin-top: -5px;
height: 25px;
line-height: 25px;
font-size: 16px;
text-shadow: 0 0 1px #000, 1px 1px 3px #000;
}
}
.item-value {
color: #000;
text-align: center;
line-height: 20px;
font-size: 15px;
}
.item-title {
font-size: 12px;
transform: scale(.9);
margin-top: -3px;
}
.artis-list {
.artis-count2 {
position: relative;
.item-bg {
transform: scale(.7);
transform-origin: left top;
&.artis2 {
position: absolute;
left: 0;
top: 0;
transform-origin: right bottom;
}
}
}
}

View File

@ -251,4 +251,4 @@ const charData = {
71: { key: 'cyno', name: '赛诺' },
72: { key: 'candace', name: '坎蒂丝' }
}
await down('70,71,72', true)
await down('70', true)

View File

@ -121,12 +121,14 @@ const CharData = {
let talent = CharData.getTalents($, cont, name, iconPath)
let passive = CharData.getPassive($, cont, name, iconPath)
let cons = CharData.getCons($, cont, iconPath)
let attr = CharData.getDetailAttr($)
return {
id,
name,
talent,
cons,
passive
passive,
attr
}
},