Add osu! mode

This commit is contained in:
hakasenyang
2016-12-10 17:25:30 +09:00
parent 47107c52cb
commit a206a10760
+34 -2
View File
@@ -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, '<b>Play Count</b>: ', '</div>');
return $this->PlayCount;
}