为PADDB功能添加保护,避免出现上传队伍后使其崩溃的情况
This commit is contained in:
parent
20eed80b20
commit
cd8a282483
|
@ -1,7 +1,7 @@
|
|||
//分析卡片的函数,Code From https://github.com/kiootic/pad-rikuu
|
||||
class Card{
|
||||
static fixId(id){
|
||||
return id >= 10000 ? id - 100 : id;
|
||||
static fixId(id, reverse = false){
|
||||
return reverse ? (id >= 9900 ? id + 100 : id) : (id >= 10000 ? id - 100 : id);
|
||||
}
|
||||
constructor(data){
|
||||
let card = this;
|
||||
|
|
|
@ -1625,4 +1625,7 @@ function getReduceScales(leaderid) {
|
|||
return reduce;
|
||||
}
|
||||
return lss.map(leaderReduceScale).filter(re=>re.scale > 0);
|
||||
}
|
||||
function cardFixId(id, reverse = false) {
|
||||
return reverse ? (id >= 9900 ? id + 100 : id) : (id >= 10000 ? id - 100 : id);
|
||||
}
|
|
@ -541,6 +541,10 @@ Formation.prototype.getPdcQrStr = function()
|
|||
}
|
||||
Formation.prototype.getPaddbQrObj = function(keepDataSource = true)
|
||||
{
|
||||
//PadDb服务器出现没有的怪物就会崩溃,在这里主动保护一下,转换为 1319
|
||||
function protectPadDbId(cardid) {
|
||||
return cardid > 9934 ? 1319 : cardFixId(cardid, true);
|
||||
}
|
||||
//PADDB目前只支持单人队伍
|
||||
const t = this.teams[0];
|
||||
let teamObj = {
|
||||
|
@ -563,7 +567,7 @@ Formation.prototype.getPaddbQrObj = function(keepDataSource = true)
|
|||
for (let i = 0; i < t[0].length; i++) {
|
||||
const m = t[0][i], a = t[1][i];
|
||||
//计算基底的变身情况
|
||||
let num = m.id, transform = null;
|
||||
let num = protectPadDbId(m.id, true), transform = null;
|
||||
if (m.card?.henshinFrom?.length > 0 //是变身
|
||||
&& m.level <= m.card.maxLevel //等级不超过99
|
||||
) {
|
||||
|
@ -592,7 +596,7 @@ Formation.prototype.getPaddbQrObj = function(keepDataSource = true)
|
|||
// password:"",
|
||||
name: this.title,
|
||||
// "tags":[""],
|
||||
mons: t[0].concat(t[1]).map(m=>m.id > 0 ? m.id : ""),
|
||||
mons: t[0].concat(t[1]).map(m=>m.id > 0 ? protectPadDbId(m.id, true) : ""),
|
||||
team: JSON.stringify(teamObj),
|
||||
};
|
||||
return qrObj;
|
||||
|
@ -1590,6 +1594,7 @@ async function inputFromQrString(string)
|
|||
let obj = {
|
||||
d: JSON.parse(url.searchParams.get('d')),
|
||||
s: url.searchParams.get('s'),
|
||||
paddbId: url.searchParams.get('_id'),
|
||||
}
|
||||
re.type = "PADDF";
|
||||
//re.message = "发现队伍数据 | Formation data founded";
|
||||
|
|
|
@ -11971,11 +11971,11 @@ const cachesMap = new Map([
|
|||
],
|
||||
[
|
||||
"script-universal_function.js",
|
||||
"b9a0719e5501f20dc509b5be06f39fc2"
|
||||
"0c7921500706af51496d51b543ad642d"
|
||||
],
|
||||
[
|
||||
"script.js",
|
||||
"bc576345dbede0d9dc8085377fdbcaf9"
|
||||
"4c42f4e64a26d9f3b3404e2cb54e699e"
|
||||
],
|
||||
[
|
||||
"solo.html",
|
||||
|
|
Loading…
Reference in New Issue