nick7() functions replaced by nick class
This commit is contained in:
+23
-7
@@ -16,12 +16,25 @@ class nick
|
||||
private function __construct($playerId)
|
||||
{
|
||||
if (!$this->user_data) {
|
||||
$user = db::c()->query('SELECT `login`, `level`, `align`, (SELECT `short` FROM `clans` WHERE `clans`.`id` = `klan`) AS `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i', $playerId)->fetch_assoc();
|
||||
$user = db::c()->query('
|
||||
SELECT
|
||||
`login`,
|
||||
`level`,
|
||||
`align`,
|
||||
(SELECT `short` FROM `clans` WHERE `clans`.`id` = `klan`) AS `klan`,
|
||||
(SELECT 1 FROM `effects` WHERE `owner` = `users`.`id` AND `type` = 1022) AS `invis`,
|
||||
`hp`,
|
||||
`maxhp`
|
||||
FROM `users` WHERE `id` = ?i', $playerId)->fetch_assoc();
|
||||
$this->user_data = $user;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $playerId
|
||||
* @return nick
|
||||
*/
|
||||
public static function id($playerId)
|
||||
{
|
||||
return new self($playerId);
|
||||
@@ -29,15 +42,13 @@ class nick
|
||||
|
||||
/**
|
||||
* @param int $showInvisibility
|
||||
* @return string
|
||||
*/
|
||||
public function full($showInvisibility = 0)
|
||||
{
|
||||
$n ='';
|
||||
if ($showInvisibility) {
|
||||
// db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = ?i', $id, 1022)->fetch_assoc();
|
||||
$this->user_data['login'] = '<i>невидимка</i>';
|
||||
$this->user_data['level'] = '??';
|
||||
|
||||
if ($showInvisibility && $this->user_data['invis']) {
|
||||
return '<i>невидимка</i>';
|
||||
} else {
|
||||
if ($this->user_data['align']) {
|
||||
$n .= sprintf('<img src="i/align_%s.gif">', $this->user_data['align']);
|
||||
@@ -51,8 +62,13 @@ class nick
|
||||
return htmlspecialchars($n);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function short()
|
||||
{
|
||||
return htmlspecialchars($this->user_data['login']);
|
||||
if ($this->user_data['invis']) {
|
||||
return '<i>невидимка</i>';
|
||||
} else return htmlspecialchars($this->user_data['login']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user