* 增加#录入夜兰面板 命令,可手工录入角色面板信息,用于伤害计算及角色展示。具体可参见#角色面板帮助

* `关于面板更新服务`:由于2.7版本底层数据架构变更,角色面板服务受到影响。预计可能会花费较长时间升级适配,请见谅 (ಥ_ಥ)
This commit is contained in:
yoimiya-kokomi 2022-06-01 05:16:10 +08:00
parent 95ddcb59ff
commit 93c1509163
13 changed files with 277 additions and 79 deletions

View File

@ -1,15 +1,16 @@
# 1.6.2
# 1.6.3
* 增加`#录入夜兰面板` 命令,可手工录入角色面板信息,用于伤害计算及角色展示。具体可参见`#角色面板帮助`
* `关于面板更新服务`由于2.7版本底层数据架构变更,角色面板服务受到影响。预计可能会花费较长时间升级适配,请见谅 (ಥ_ಥ)
# 1.6.1 ~ 1.6.2
* 增加`#喵喵面板设置`命令,可更精细的设置是否允许好友/临时对话/群使用面板功能
* `#喵喵日历` 优化
* 对角色、武器UP的日历展示做合并优化
* 增强从活动详情解析日期的能力,使一些活动日期更加准确
* `#角色面板` 伤害计算增加 琴、莫娜
# 1.6.1
* `#角色面板` 伤害计算增加 皇女、温迪、夜兰
* `#角色面板` 部分细节样式调整
* `#角色面板` 伤害计算增加 琴、莫娜、皇女、温迪、夜兰
# 1.6.0

View File

@ -63,19 +63,28 @@ export async function character(e, { render, User }) {
let mode = 'card';
let name = msg.replace(/#|老婆|老公|[1|2|5][0-9]{8}/g, "").trim();
let dmgRet = /伤害(\d?)$/.exec(msg), dmgIdx = 0;
msg = msg.replace("面版", "面板")
if (/(详情|详细|面板|面版)$/.test(msg) && !/更新/.test(msg)) {
if (/(详情|详细|面板|面版)$/.test(msg) && !/更新|录入|输入/.test(msg)) {
mode = 'profile';
name = name.replace(/(详情|详细|面板|面版)/, "").trim();
name = name.replace(/(详情|详细|面板)/, "").trim();
} else if (dmgRet) {
mode = 'dmg';
name = name.replace(/伤害[0-5]?/, "").trim();
if (dmgRet[1]) {
dmgIdx = dmgRet[1] * 1;
}
} else if (/(详情|详细|面板|面版)更新$/.test(msg) || (/更新/.test(msg) && /(详情|详细|面板|面版)$/.test(msg))) {
} else if (/(详情|详细|面板)更新$/.test(msg) || (/更新/.test(msg) && /(详情|详细|面板)$/.test(msg))) {
mode = "refresh";
name = name.replace(/详情|详细|面板|面版|更新/g, "").trim();
name = name.replace(/详情|详细|面板|更新/g, "").trim();
} else if (/(录入|输入)/.test(msg) && /(详情|详细|面板)/.test(msg)) {
mode = "input";
let nameRet = /(?:录入|输入)(.+)(?:面板|详细|详情|数据)+/.exec(name);
if (nameRet) {
name = nameRet[1];
}
e.inputData = msg.replace(nameRet[0], "");
name = name.replace(/录入|输入|详情|详细|面板|数据|[0-9]|\.|\+/g, "").trim()
}
@ -111,9 +120,9 @@ export async function character(e, { render, User }) {
if (mode === "profile" || mode === "dmg") {
return renderProfile(e, char, render, mode, { dmgIdx });
} else if (mode === "refresh") {
} else if (mode === "refresh" || mode === "input") {
e.avatar = char.id;
await getProfile(e);
await getProfile(e, mode);
return true;
} else {
return renderAvatar(e, char.name, render);
@ -443,7 +452,7 @@ async function getTalent(e, avatars) {
return skill;
}
export async function getProfile(e) {
export async function getProfile(e, mode = "refresh") {
let MysApi = await e.getMysApi({
auth: "cookie",
targetType: "self",
@ -459,6 +468,26 @@ export async function getProfile(e) {
e.reply("此功能仅绑定cookie用户可用")
return true;
}
if (mode === "input") {
if (e.inputData.trim().length < 5) {
e.reply(`【输入示例】\n#录入夜兰面板 生命14450+25469, 攻击652+444, 防御548+144, 元素精通84, 暴击76.3, 爆伤194.2, 治疗0,充能112.3,元素伤害61.6,物伤0
`)
return await profileHelp(e);
}
let ret = Profile.inputProfile(selfUser.uid, e);
let char = Character.get(e.avatar);
if (ret) {
e.reply(`${char.name}信息手工录入完成,你可以使用 #角色名+面板 / #角色名+伤害 来查看详细角色面板属性了`)
} else {
e.reply(`${char.name}信息手工录入失败,请检查录入格式。回复 #角色面板帮助 可查看录入提示`);
e.reply(`【输入示例】\n#录入夜兰面板 生命14450+25469, 攻击652+444, 防御548+144, 元素精通84, 暴击76.3, 爆伤194.2, 治疗0,充能112.3,元素伤害61.6,物伤0
`)
}
return true;
}
// 数据更新
let data = await Profile.request(selfUser.uid, e);
if (!data) {
return true;
@ -484,6 +513,7 @@ export async function getProfile(e) {
}
}
return true;
}
@ -658,7 +688,7 @@ export async function renderProfile(e, char, render, mode = "profile", params =
lodash.forEach(avatar.reliquaries, (ds) => {
let pos = ds.pos_name;
let arti = profile.artis[`arti${posIdx[pos].idx}`];
let arti = profile.artis && profile.artis[`arti${posIdx[pos].idx}`];
if (arti) {
let mark = Reliquaries.getMark(avatar.name, arti.attrs);
let maxMark = Reliquaries.getMaxMark(char.name, arti.main[0] || "");
@ -727,6 +757,7 @@ export async function renderProfile(e, char, render, mode = "profile", params =
cons: char.cons,
name: char.name,
elem: char.elem,
dataSource: profile.dataSource,
dmgData,
dmgMsg,
dmgRet: dmgCalc.dmgRet,

View File

@ -11,7 +11,7 @@ const ignoreIds = [495,// 有奖问卷调查开启!
762, // 《原神》公平运营声明
]
const ignoreReg = /(内容专题页|版本更新说明|调研|防沉迷|米游社|专项意见|更新修复与优化|问卷调查|版本更新通知|更新时间说明|预下载功能|周边限时返场)/;
const ignoreReg = /(内容专题页|版本更新说明|调研|防沉迷|米游社|专项意见|更新修复与优化|问卷调查|版本更新通知|更新时间说明|预下载功能|周边限时|周边上新)/;
const fulltimeReg = /(魔神任务)/;
let Cal = {
@ -31,7 +31,9 @@ let Cal = {
let detailData = await request2.json();
timeMap = {}
if (detailData && detailData.data && detailData.data.list) {
let versionTime = {};
let versionTime = {
'2.7': "2022-05-31 11:00:00"
};
lodash.forEach(detailData.data.list, (ds) => {
let vRet = /(\d\.\d)版本更新通知/.exec(ds.title)
if (vRet && vRet[1]) {

View File

@ -397,6 +397,69 @@ let Profile = {
totalMaxMark,
markScore: Reliquaries.getMarkScore(totalMark * 1.05, totalMaxMark)
}
},
inputProfile(uid, e) {
let { avatar, inputData } = e;
inputData = inputData.replace(/||、|\n|\t/g, ",");
let attr = {};
let attrMap = {
hp: /生命/,
def: /防御/,
atk: /攻击/,
mastery: /精通/,
cRate: /(暴击率|爆率|暴击$)/,
cDmg: /(爆伤|暴击伤害)/,
hInc: /治疗/,
recharge: /充能/,
dmgBonus: /[火|水|雷|草|风|岩|冰|素|^]伤/,
phyBonus: /(物理|物伤)/
}
lodash.forEach(inputData.split(","), (ds, idx) => {
ds = ds.trim();
if (!ds) {
return;
}
let dRet = /(.*?)([0-9\.\+\s]+)/.exec(ds);
if (!dRet || !dRet[1] || !dRet[2]) {
return;
}
let name = dRet[1].trim(),
data = dRet[2].trim();
lodash.forEach(attrMap, (reg, key) => {
if (reg.test(name)) {
if (['hp', 'def', 'atk'].includes(key)) {
let tmp = data.split("+");
attr[key] = Math.max(0, Math.min(60000, tmp[0].trim() * 1 + tmp[1].trim() * 1 || 0));
attr[key + "Base"] = Math.max(0, Math.min(40000, tmp[0].trim() * 1 || 0));
} else {
attr[key] = Math.max(0, Math.min(400, data * 1 || 0));
}
return false;
}
})
})
if (lodash.keys(attr) < 3) {
return false;
}
let char = Character.get(avatar);
let data = {
id: char.id,
name: char.name,
dataSource: "input",
attr
}
let userData = {};
const userFile = `${userPath}/${uid}.json`;
if (fs.existsSync(userFile)) {
userData = JSON.parse(fs.readFileSync(userFile, "utf8")) || {};
}
userData.chars = userData.chars || {};
userData.chars[avatar] = data;
fs.writeFileSync(userFile, JSON.stringify(userData), "", " ");
return true;
}
};
export default Profile;

View File

@ -40,7 +40,7 @@ export {
let rule = {
character: {
reg: "^(#(.*)|#*(更新)?(.*)(详细|详情|面板|面版|伤害[1-7]?)(更新)?)$",
reg: "^(#(.*)|#*(更新|录入)?(.*)(详细|详情|面板|面版|伤害[1-7]?)(更新)?)$",
//reg: "noCheck",
describe: "【#角色】角色详情",
},

View File

@ -431,6 +431,28 @@ body {
.artis .head .mark {
font-family: Number, YS;
}
.artis.input-mode .item {
height: 100px;
margin: 5px 3px;
}
.artis.input-mode .item.weapon {
margin-left: 5px;
}
.artis.input-mode .item.arti {
width: 72px;
}
.artis.input-mode .item.arti .arti-icon,
.artis.input-mode .item.arti img {
width: 68px;
height: 68px;
}
.artis.input-mode .item.arti .head {
padding: 78px 0 0 0;
}
.artis.input-mode .item.arti .head strong {
font-size: 12px;
text-align: center;
}
.mark-ACE,
.mark-ACE² {
color: #e85656;

View File

@ -77,7 +77,7 @@
</div>
{{/if}}
{{if mode === "profile"}}
{{if mode === "profile" && dataSource !== "input"}}
<div class="artis">
<div>
<div class="item weapon">
@ -120,6 +120,41 @@
</div>
{{/if}}
{{if mode === "profile" && dataSource === "input"}}
<div class="cont">
<div class="cont-footer dmg-desc">
面板信息来源于手工输入,面板信息及伤害计算可能不准确。通过<strong>#录入{{name}}面板</strong>可录入面板数据
</div>
</div>
<div class="artis input-mode">
<div class="item weapon">
<img src="{{_sys_res_path}}/genshin/logo/weapon/{{weapon.name}}.png"/>
<div class="head">
<strong>{{weapon.name}}</strong>
<div class="star star-{{weapon.rarity}}"></div>
<span>Lv.{{weapon.level}} <span
class="affix affix-{{weapon.affix_level}}">精{{weapon.affix_level}}</span></span>
</div>
</div>
{{each reliquaries ds}}
<div class="item arti">
{{if ds.name }}
<div class="arti-icon">
<img src="{{_sys_res_path}}/genshin/logo/reliquaries/{{ds.name}}.png"/>
<span>+{{ds.level}}</span>
</div>
<div class="head">
<strong>{{ds.name}}</strong>
</div>
{{/if}}
</div>
{{/each}}
</div>
{{/if}}
{{if mode === "dmg"}}
{{if dmgCfg && dmgCfg.attr && dmgCfg.attr.length>0}}

View File

@ -459,68 +459,104 @@ body {
flex-wrap: wrap;
margin-bottom: 5px;
padding: 0 5px;
}
.artis .item {
width: 185px;
border-radius: 10px;
background: url("../common/cont/card-bg.png") top left repeat-x;
background-size: auto 100%;
margin: 5px;
height: 200px;
position: relative;
box-shadow: 0 0 1px 0 #ccc, 2px 2px 4px 0 rgba(50, 50, 50, .8);
overflow: hidden;
}
.artis .item .arti-icon {
width: 60px;
height: 60px;
position: absolute;
left: 2px;
top: 3px;
}
.item {
width: 185px;
border-radius: 10px;
background: url("../common/cont/card-bg.png") top left repeat-x;
background-size: auto 100%;
margin: 5px;
height: 200px;
position: relative;
box-shadow: 0 0 1px 0 #ccc, 2px 2px 4px 0 rgba(50, 50, 50, .8);
overflow: hidden;
.artis .item .arti-icon span {
position: absolute;
right: 2px;
bottom: 0;
margin-left: 5px;
background: rgba(0, 0, 0, .5);
border-radius: 5px;
height: 18px;
line-height: 18px;
padding: 0 3px;
color: #fff;
font-size: 12px;
display: block;
}
.artis .item .arti-icon img {
width: 60px;
height: 60px;
}
.arti-icon {
width: 60px;
height: 60px;
position: absolute;
left: 2px;
top: 3px;
}
.artis .head {
color: #fff;
padding: 12px 0 8px 68px;
}
.arti-icon span {
position: absolute;
right: 2px;
bottom: 0;
margin-left: 5px;
background: rgba(0, 0, 0, .5);
border-radius: 5px;
height: 18px;
line-height: 18px;
padding: 0 3px;
color: #fff;
font-size: 12px;
display: block;
}
.artis .head strong {
font-size: 15px;
display: block;
white-space: nowrap;
overflow: hidden;
font-font: YS;
}
.arti-icon img {
width: 60px;
height: 60px;
}
}
.artis .head span {
font-size: 14px;
}
.head {
color: #fff;
padding: 12px 0 8px 68px;
.artis .head .mark {
font-family: Number, YS;
strong {
font-size: 15px;
display: block;
white-space: nowrap;
overflow: hidden;
font-font: YS;
}
span {
font-size: 14px;
}
.mark {
font-family: Number, YS;
}
}
&.input-mode {
.item {
height: 100px;
margin: 5px 3px;
&.weapon {
margin-left: 5px;
}
&.arti {
width: 72px;
.arti-icon, img {
width: 68px;
height: 68px;
}
span {
}
.head {
padding: 78px 0 0 0;
strong {
font-size: 12px;
text-align: center;
}
}
}
}
}
}
.mark-ACE,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

After

Width:  |  Height:  |  Size: 298 KiB

View File

@ -3,6 +3,10 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<link rel="shortcut icon" href="#"/>
<link rel="preload" href="{{_res_path}}/common/font/HYWH-65W.ttf" as="font" crossorigin>
<link rel="preload" href="{{_res_path}}/common/font/HYWH-85W.ttf" as="font" crossorigin>
<link rel="preload" href="{{_res_path}}/common/font/NZBZ.ttf" as="font" crossorigin>
<link rel="preload" href="{{_res_path}}/common/font/tttgbnumber.ttf" as="font" crossorigin>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/common/common.css"/>
{{block 'css'}}
{{/block}}

View File

@ -3,6 +3,10 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<link rel="shortcut icon" href="#"/>
<link rel="preload" href="{{_res_path}}/common/font/HYWH-65W.ttf" as="font" crossorigin>
<link rel="preload" href="{{_res_path}}/common/font/HYWH-85W.ttf" as="font" crossorigin>
<link rel="preload" href="{{_res_path}}/common/font/NZBZ.ttf" as="font" crossorigin>
<link rel="preload" href="{{_res_path}}/common/font/tttgbnumber.ttf" as="font" crossorigin>
<link rel="stylesheet" type="text/css" href="{{_res_path}}/common/common.css"/>
{{block 'css'}}
{{/block}}

View File

@ -1,28 +1,28 @@
export const details = [{
title: "破局矢伤害",
dmg: ({ talent, attr, calc }, { basic }) => basic(calc(attr.hp) * talent.a['破局矢伤害'] / 100, 'a2')
}, {
title: "E络命丝伤害",
dmg: ({ talent, attr, calc }, { basic }) => basic(calc(attr.hp) * talent.e['技能伤害'] / 100, 'e')
}, {
title: "Q协同攻击伤害",
dmg: ({ talent, attr, calc, cons }, { basic }) =>
basic(calc(attr.hp) * (talent.q['玄掷玲珑伤害'] / 100 + (cons >= 2 ? 0.14 : 0)), 'q')
basic(calc(attr.hp) * (talent.q['玄掷玲珑伤害'] / 100), 'q')
}];
export const mainAttr = "hp,atk,cpct,cdmg";
export const buffs = [{
title: "夜兰被动有4个不同元素类型角色时夜兰生命值上线提高30%",
title: "夜兰被动有4个不同元素类型角色时夜兰生命值上提高30%",
data: {
hpPct: 30
}
}, {
title: "夜兰2命Q协同攻击额外发射水箭造成夜兰生命值上线14%的水元素伤害"
}, {
title: "夜兰4命E络命丝爆发提高生命值满Buff下提高40%",
cons: 4,
data: {
hpPct: 4
hpPct: 40
}
}];

View File

@ -401,9 +401,9 @@ let bow = {
}],
"若水": {
title: "生命值提高[hpPct]%,伤害提高[dmg]%",
title: "生命值提高[_hpPct]%,伤害提高[dmg]%",
refine: {
hpPct: step(16),
_hpPct: step(16),
dmg: step(20)
}
},