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",