mirror of
https://github.com/hakasenyang/osu-tournament-php
synced 2026-08-23 19:43:09 +09:00
+24
-33
@@ -14,13 +14,14 @@
|
|||||||
*/
|
*/
|
||||||
public $RealID, $OsuID;
|
public $RealID, $OsuID;
|
||||||
/**
|
/**
|
||||||
* [$PlayCount User Playcount]
|
* [$Playcount User playcount]
|
||||||
* [$Performance User Performance]
|
* [$Performance User performance]
|
||||||
* [$Rank User Ranking]
|
* [$Rank User ranking]
|
||||||
* [$Occupation Check user occupation]
|
* [$Occupation Check user occupation]
|
||||||
|
* [$Occupation_Set Setting user occupation data]
|
||||||
* @var [string]
|
* @var [string]
|
||||||
*/
|
*/
|
||||||
private $PlayCount, $Performance, $Rank, $Occupation;
|
public $Playcount, $Performance, $Rank, $Occupation, $Occupation_Set;
|
||||||
/**
|
/**
|
||||||
* [$mode osu! mode
|
* [$mode osu! mode
|
||||||
* 0 = osu! standard (standard)
|
* 0 = osu! standard (standard)
|
||||||
@@ -29,11 +30,10 @@
|
|||||||
* 3 = osu!mania (mania)
|
* 3 = osu!mania (mania)
|
||||||
* ]
|
* ]
|
||||||
* @var [int]
|
* @var [int]
|
||||||
* [$occu User Occupation Data]
|
|
||||||
* @var [string]
|
|
||||||
*/
|
*/
|
||||||
private $mode, $occu;
|
private $mode;
|
||||||
/**
|
/**
|
||||||
|
* Temp data
|
||||||
* [$data_profile description]
|
* [$data_profile description]
|
||||||
* [$data_userdata description]
|
* [$data_userdata description]
|
||||||
* @var [string]
|
* @var [string]
|
||||||
@@ -100,21 +100,30 @@
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$this->Occupation = $this->Parser->splits($this->data_profile, '<div title=\'Occupation\'><i class=\'icon-pencil\'></i><div>', '</div></div>');
|
$this->Occupation = $this->Parser->splits($this->data_profile, '<div title=\'Occupation\'><i class=\'icon-pencil\'></i><div>', '</div></div>');
|
||||||
|
|
||||||
|
$this->GetOccupation();
|
||||||
|
$this->GetUserData();
|
||||||
|
|
||||||
return $this->OsuID;
|
return $this->OsuID;
|
||||||
}
|
}
|
||||||
public function CheckOccupation()
|
/**
|
||||||
|
* Not using this function.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
private function CheckOccupation()
|
||||||
{
|
{
|
||||||
if(empty($this->OsuID))
|
if(empty($this->OsuID))
|
||||||
throw new \Exception('Please, CheckUser(OsuID) first!');
|
throw new \Exception('Please, CheckUser(OsuID) first!');
|
||||||
if(empty($this->occu))
|
if(empty($this->Occupation_Set))
|
||||||
$this->GetOccupation();
|
$this->GetOccupation();
|
||||||
|
|
||||||
if ($this->occu === $this->Occupation)
|
if ($this->Occupation_Set === $this->Occupation)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return $this->Occupation;
|
return $this->Occupation;
|
||||||
}
|
}
|
||||||
public function GetOccupation()
|
*/
|
||||||
|
private function GetOccupation()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* md5 = $RealID / $OsuID / date('Ymd') / $mode
|
* md5 = $RealID / $OsuID / date('Ymd') / $mode
|
||||||
@@ -122,9 +131,9 @@
|
|||||||
*/
|
*/
|
||||||
if(empty($this->OsuID))
|
if(empty($this->OsuID))
|
||||||
throw new \Exception('Please, CheckUser(OsuID) first!');
|
throw new \Exception('Please, CheckUser(OsuID) first!');
|
||||||
if(empty($this->occu))
|
if(empty($this->Occupation_Set))
|
||||||
$this->occu = substr(md5($this->RealID . $this->OsuID . date('Ymd') . $this->mode), 0, 20);
|
$this->Occupation_Set = substr(md5($this->RealID . $this->OsuID . date('Ymd') . $this->mode), 0, 20);
|
||||||
return $this->occu;
|
return $this->Occupation_Set;
|
||||||
}
|
}
|
||||||
private function GetUserData()
|
private function GetUserData()
|
||||||
{
|
{
|
||||||
@@ -141,31 +150,13 @@
|
|||||||
|
|
||||||
if (strpos($this->data_userdata, 'This user has not played enough, or has not played recently.') === false)
|
if (strpos($this->data_userdata, 'This user has not played enough, or has not played recently.') === false)
|
||||||
{
|
{
|
||||||
$this->PlayCount = $this->Parser->splits($this->data_userdata, '<b>Play Count</b>: ', '</div>');
|
$this->Playcount = $this->Parser->splits($this->data_userdata, '<b>Play Count</b>: ', '</div>');
|
||||||
$this->Performance = str_replace(',', NULL, $this->Parser->splits($this->data_userdata, 'Performance</a>: ', 'pp'));
|
$this->Performance = str_replace(',', NULL, $this->Parser->splits($this->data_userdata, 'Performance</a>: ', 'pp'));
|
||||||
$this->Rank = str_replace(',', NULL, $this->Parser->splits($this->data_userdata, 'pp (#', ')'));
|
$this->Rank = str_replace(',', NULL, $this->Parser->splits($this->data_userdata, 'pp (#', ')'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* [CheckPlayCount Get PlayCount]
|
|
||||||
*/
|
|
||||||
public function CheckPlayCount()
|
|
||||||
{
|
|
||||||
$this->GetUserData();
|
|
||||||
return $this->PlayCount;
|
|
||||||
}
|
|
||||||
public function CheckPerformance()
|
|
||||||
{
|
|
||||||
$this->GetUserData();
|
|
||||||
return $this->Performance;
|
|
||||||
}
|
|
||||||
public function CheckRank()
|
|
||||||
{
|
|
||||||
$this->GetUserData();
|
|
||||||
return $this->Rank;
|
|
||||||
}
|
|
||||||
public function ResetObject()
|
public function ResetObject()
|
||||||
{
|
{
|
||||||
foreach ($this as $key => $value)
|
foreach ($this as $key => $value)
|
||||||
|
|||||||
@@ -6,23 +6,20 @@
|
|||||||
{
|
{
|
||||||
global $Check;
|
global $Check;
|
||||||
echo $Check->RealID . ' (' . $Check->OsuID . ')';
|
echo $Check->RealID . ' (' . $Check->OsuID . ')';
|
||||||
$occu = $Check->CheckOccupation();
|
|
||||||
|
|
||||||
if ($Check->CheckOccupation() === true)
|
if ($Check->Occupation_Set === $Check->Occupation)
|
||||||
echo '<br>You are applied!';
|
echo '<br>You are applied!';
|
||||||
elseif (empty($occu))
|
elseif (empty($Check->Occupation))
|
||||||
echo '<br>Please change occupation to ' . $Check->GetOccupation() . '<br>Your Occupation is blank.';
|
echo '<br>Please change occupation to ' . $Check->Occupation_Set . '<br>Your Occupation is blank.';
|
||||||
else
|
else
|
||||||
echo '<br>Please change occupation to ' . $Check->GetOccupation() . '<br>Your Occupation : ' . $occu;
|
echo '<br>Please change occupation to ' . $Check->Occupation_Set . '<br>Your Occupation : ' . $Check->Occupation;
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
|
|
||||||
if (empty($Check->CheckPerformance()))
|
echo 'Play Count : ' . $Check->Playcount;
|
||||||
echo 'Error<br>';
|
|
||||||
echo 'Play Count : ' . $Check->CheckPlayCount();
|
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
echo 'Performance : ' . $Check->CheckPerformance();
|
echo 'Performance : ' . $Check->Performance;
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
echo 'Ranking : ' . $Check->CheckRank();
|
echo 'Ranking : ' . $Check->Rank;
|
||||||
echo '<br><br>';
|
echo '<br><br>';
|
||||||
}
|
}
|
||||||
$Check->CheckUser(2558286, 0);
|
$Check->CheckUser(2558286, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user