From d737425189c85a981eb645806a0e045368990f80 Mon Sep 17 00:00:00 2001 From: zyr17 Date: Mon, 22 Apr 2019 23:07:26 +0700 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=A0=BC=E5=BC=8F=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=87=BA=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ SimpleMahjong/paipu.js | 48 ++++++++++++++++++++++++++---------------- appveyor-linux.yml | 2 +- appveyor-win.yml | 2 +- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 8463377..67ec3d9 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,8 @@ Ubuntu高版本中可能会出现GUI将可执行文件当做动态链接库的 由于设计时从未参加过比赛场,发现问题后开了个比赛场测试并发现比赛场数据和想象中有较大出入,目前会直接忽略比赛场牌谱数据,在以后做了相关实现后加入。 +出现部分牌谱的和牌数据采用新格式,出现原因和时机不明。目前先忽略这些牌谱。 + 由于本人较菜没有上圣没法打王座,相关牌谱可能会出现bug。 ## 联系 diff --git a/SimpleMahjong/paipu.js b/SimpleMahjong/paipu.js index 2866fa6..35c9a11 100644 --- a/SimpleMahjong/paipu.js +++ b/SimpleMahjong/paipu.js @@ -528,22 +528,29 @@ class majsoulpaipuanalyze{ } else if (arr[start] == 0x62){ //番种 + ////TODO: 出现牌谱使用编号代替役名。找到役和编号对应列表。 let len6, len, name; [len6, start] = this.getnumber(arr, start + 1); - [len, start] = this.getnumber(arr, start + 1); - [name, start] = this.decodeUTF8(arr, start, len); - let han = arr[start + 1]; - if ( - name == '四暗刻单骑' || - name == '国士无双十三面' || - name == '大四喜' || - name == '纯正九莲宝灯' - ) - han = 2; - if (yakumanyaku) - han *= 13; - agarires.han.push([name, han]); - start += 2; + if (arr[start] == 0x0a){ + [len, start] = this.getnumber(arr, start + 1); + [name, start] = this.decodeUTF8(arr, start, len); + let han = arr[start + 1]; + if ( + name == '四暗刻单骑' || + name == '国士无双十三面' || + name == '大四喜' || + name == '纯正九莲宝灯' + ) + han = 2; + if (yakumanyaku) + han *= 13; + agarires.han.push([name, han]); + start += 2; + } + else{ + start += len6; + this.rawdata = undefined; + } } else if (arr[start] == 0x68){ //符 @@ -863,20 +870,25 @@ class majsoulpaipuanalyze{ arr.push(data[i]); //console.log(arr, this.nowgamedata, this.gamedatas[this.nowgamedata].extra.id, this.gamedatas[this.nowgamedata]); let d = new Date(); - d.setTime(this.gamedatas[this.nowgamedata].endtime * 1000); + if (this.paipus != undefined) d.setTime(this.gamedatas[this.nowgamedata].endtime * 1000); if (arr.length > 99){ //太短是因为牌谱未被归档导致返回错误信息 this.paipuanalyze(arr); - this.onepaipu.record = JSON.parse(JSON.stringify(View.gamerecord)); - this.paipus.push(JSON.parse(JSON.stringify(this.onepaipu))); + if (this.paipus != undefined){ + this.onepaipu.record = JSON.parse(JSON.stringify(View.gamerecord)); + this.paipus.push(JSON.parse(JSON.stringify(this.onepaipu))); + } console.log('paipu #' + this.nowgamedata + ' complete. ' + d.toString()); + if (this.rawdata == undefined){ + console.log("but it's new type paipu, skip it for now."); + } } else{ this.rawdata = undefined; console.log('paipu #' + this.nowgamedata + ' download failed. ' + d.toString()); } this.nowgamedata ++ ; - this.converttoonepaipu(); + if (this.paipus != undefined) this.converttoonepaipu(); } reader.onload = rloadfunc.bind(this); } diff --git a/appveyor-linux.yml b/appveyor-linux.yml index b9ebfaf..d04de19 100644 --- a/appveyor-linux.yml +++ b/appveyor-linux.yml @@ -1,4 +1,4 @@ -version: 0.1.4.{build} +version: 0.1.5.{build} image: Ubuntu1804 branches: only: diff --git a/appveyor-win.yml b/appveyor-win.yml index b4d3551..cef0768 100644 --- a/appveyor-win.yml +++ b/appveyor-win.yml @@ -1,4 +1,4 @@ -version: 0.1.4.{build} +version: 0.1.5.{build} branches: only: - master