From cd8a282483e2402a4efc2336fb4b29ec7326463e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Thu, 20 Apr 2023 02:36:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BAPADDB=E5=8A=9F=E8=83=BD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BF=9D=E6=8A=A4=EF=BC=8C=E9=81=BF=E5=85=8D=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E4=B8=8A=E4=BC=A0=E9=98=9F=E4=BC=8D=E5=90=8E=E4=BD=BF?= =?UTF-8?q?=E5=85=B6=E5=B4=A9=E6=BA=83=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- monsters-info/official-API/parseCard.js | 4 ++-- script-universal_function.js | 3 +++ script.js | 9 +++++++-- service-worker.js | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/monsters-info/official-API/parseCard.js b/monsters-info/official-API/parseCard.js index 2ef536ac..4719d570 100644 --- a/monsters-info/official-API/parseCard.js +++ b/monsters-info/official-API/parseCard.js @@ -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; diff --git a/script-universal_function.js b/script-universal_function.js index 0ab1b553..1f9ae2a1 100644 --- a/script-universal_function.js +++ b/script-universal_function.js @@ -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); } \ No newline at end of file diff --git a/script.js b/script.js index 5601493a..8dd20203 100644 --- a/script.js +++ b/script.js @@ -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"; diff --git a/service-worker.js b/service-worker.js index e411a728..51456eb3 100644 --- a/service-worker.js +++ b/service-worker.js @@ -11971,11 +11971,11 @@ const cachesMap = new Map([ ], [ "script-universal_function.js", - "b9a0719e5501f20dc509b5be06f39fc2" + "0c7921500706af51496d51b543ad642d" ], [ "script.js", - "bc576345dbede0d9dc8085377fdbcaf9" + "4c42f4e64a26d9f3b3404e2cb54e699e" ], [ "solo.html",