From a206a107609986476142dd799c862a7363f3e690 Mon Sep 17 00:00:00 2001 From: hakasenyang Date: Sat, 10 Dec 2016 17:25:30 +0900 Subject: [PATCH] Add osu! mode --- include/check.php | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/include/check.php b/include/check.php index 3df3896..bee161c 100644 --- a/include/check.php +++ b/include/check.php @@ -16,13 +16,45 @@ * @var [string] */ private $OsuID, $PlayCount, $Performance, $Rank, $Occupation; + /** + * [$mode osu! mode + * 0 = osu! standard (standard) + * 1 = Taiko (taiko) + * 2 = Catch The Beat (ctb) + * 3 = osu!mania (mania) + * ] + * @var [int] + */ + private $mode; /** * Other data * In production. */ - public function __construct() + public function __construct($mode) { + switch($mode) + { + case 0: + case 'standard': + $this->mode = 0; + break; + case 1: + case 'taiko': + $this->mode = 1; + break; + case 2: + case 'ctb': + $this->mode = 2; + break; + case 3: + case 'mania': + $this->mode = 3; + break; + default: + throw new Exception('Error Mode'); + break; + } $this->Parser = new Parser(); } public function CheckUser($osuid) @@ -35,7 +67,7 @@ } public function CheckPlayCount() { - $data = $this->Parser->WEBParsing('https://osu.ppy.sh/pages/include/profile-general.php?u='. $this->OsuID .'&m=0'); + $data = $this->Parser->WEBParsing('https://osu.ppy.sh/pages/include/profile-general.php?u=' . $this->OsuID .'&m=' . $this->mode); $this->PlayCount = $this->Parser->splits($data, 'Play Count: ', ''); return $this->PlayCount; }