From 0e3fab7b8da1eb23932a88e7da32edd7ae3131e0 Mon Sep 17 00:00:00 2001 From: __stdcall Date: Tue, 16 Apr 2024 10:28:33 +0800 Subject: [PATCH] Fix SRGacha rankings UP% calculation --- apps/starrail_gacha.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/starrail_gacha.ts b/apps/starrail_gacha.ts index 1f68083..fc228d6 100644 --- a/apps/starrail_gacha.ts +++ b/apps/starrail_gacha.ts @@ -39,7 +39,7 @@ export class SRGachaPlugin extends Plugin { fnc: 'single' }, { - reg: '^#星铁抽卡排名.*$', + reg: '^#星铁抽卡(排名|排行).*$', fnc: 'showrank' } ] @@ -164,8 +164,10 @@ export class SRGachaPlugin extends Plugin { } getUpPercentage(rankData: RankData): number { - if (rankData.star5 == 0) return 0; - return rankData.up / rankData.star5; + if (rankData.up == 0) return 0; + const wai = rankData.star5 - rankData.up; + const buwai = rankData.up - wai; + return buwai / rankData.up; } getAverageUpCount(rankData: RankData): number { @@ -181,7 +183,7 @@ export class SRGachaPlugin extends Plugin { msg.push(""); msg.push("排行榜 (小保底不歪): "); let top1 = Object.values(rank) - .filter(r => r.star5 > 0).sort((a, b) => this.getUpPercentage(b) - this.getUpPercentage(a)); + .filter(r => r.up > 0).sort((a, b) => this.getUpPercentage(b) - this.getUpPercentage(a)); let top2 = Object.values(rank) .filter(r => r.star5 > 0).sort((a, b) => this.getAverageUpCount(a) - this.getAverageUpCount(b));