add getAccountId function
This commit is contained in:
		| @@ -196,6 +196,23 @@ class Player implements Dumpable, UsageInformationAble { | |||||||
| 		return ($this->pid <= 0 || substr($this->login, 0, 1) === '*'); | 		return ($this->pid <= 0 || substr($this->login, 0, 1) === '*'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Get AccountId from Login | ||||||
|  | 	 * | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return string | ||||||
|  | 	 */ | ||||||
|  | 	public function getAccountId() { | ||||||
|  | 		if (strlen($this->login) !== 22) return $this->login; | ||||||
|  |  | ||||||
|  | 		$login = str_pad($this->login, 24, "=", STR_PAD_RIGHT); | ||||||
|  |  | ||||||
|  | 		$login = str_replace("_","/", str_replace("-","+", $login)); | ||||||
|  | 		$login = base64_decode($login); | ||||||
|  |  | ||||||
|  | 		return vsprintf("%s%s-%s-%s-%s-%s%s%s", str_split(bin2hex($login), 4)); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Get province | 	 * Get province | ||||||
| 	 * | 	 * | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user