Функция nick4() переехала в класс Nick.

This commit is contained in:
Igor Barkov (iwork) 2020-08-27 15:31:35 +03:00
parent 782aa0632d
commit 0049b2d601
4 changed files with 20 additions and 21 deletions

View File

@ -90,4 +90,20 @@ class Nick extends User
{
return $this->getAlign().$this->getClan().sprintf('<b>%s</b> [%s] <a href="inf.php?%s" target="_blank"><img src="i/inf.gif" style="width:12px;height:11px"></a> <img src="i/herz.gif" alt="HP"> _hp_/_maxhp_', $this->login, $this->level, $this->login);
}
/**
* Возвращает строку с логином и здоровьем, выделяя строку определённым стилем.
* @param $textstyle - Название стиля отображения логина персонажа (main.css) для цветового разделения команд.
*
* @return string
*/
public function battleShort($textstyle)
{
if ($this->getInvisibilityStatus()) {
return '<i>невидимка</i>';
}
else {
return sprintf('<span style="%s">%s</span> [_hp_/_maxhp_]', $textstyle, $this->login);
}
}
}

View File

@ -376,7 +376,7 @@ $fbattle = new fbattle($user['battle']);
} else {
$cc = '';
}
$ffs .= $cc . nick4($v, "B1");
$ffs .= $cc . Nick::id($v)->battleShort('B1');
$zz .= "private [" . Nick::id($v)->short() . "] ";
}
}
@ -398,7 +398,7 @@ $fbattle = new fbattle($user['battle']);
} else {
$cc = '';
}
$ffs .= $cc . nick4($v, "B2");
$ffs .= $cc . Nick::id($v)->battleShort('B2');
$zz .= "private [" . Nick::id($v)->short() . "] ";
}
}

View File

@ -211,23 +211,6 @@ function topsethp()
return "top.setHP($user[hp], $user[maxhp], $delay);";
}
function nick4($id, $st)
{
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc();
if ($user[0]) {
$effect = db::c()->query('SELECT time FROM effects WHERE type = 1022 and owner = ?i', $id)->fetch_assoc_array();
if ($effect) {
$user['level'] = '??';
$user['login'] = '</a><b><i>невидимка</i></b>';
$user['hp'] = '??';
$user['maxhp'] = '??';
}
return "<span onclick=\"top.AddTo('" . $user['login'] . "')\" oncontextmenu=\"return OpenMenu(event," . $user['level'] . ")\" class={$st}>" . $user['login'] . "</span> [" . $user['hp'] . "/" . $user['maxhp'] . "]";
}
return false;
}
function check_proc($u)
{
$r = 100;

View File

@ -50,7 +50,7 @@ if($_GET['stat'] != '1') {
if(in_array($v, array_keys($battle))) {
++$i;
if($i > 1) { $cc = ', '; } else { $cc = ''; }
$ffs .= $cc.nick4($v, "B1");
$ffs .= $cc.Nick::id($v)->battleShort('B1');
}
}
@ -61,7 +61,7 @@ if($_GET['stat'] != '1') {
if(in_array($v, array_keys($battle))) {
++$i;
if($i > 1) { $cc = ', '; } else { $cc = ''; }
$ffs .= $cc.nick4($v, "B2");
$ffs .= $cc.Nick::id($v)->battleShort('B1');
}
}
$i = 0;