WIP: removing User::class public array $items for Stat()::class.
This commit is contained in:
@@ -5,6 +5,7 @@ namespace User;
|
||||
use Core\Config;
|
||||
use Core\Db;
|
||||
use Helper\Conversion;
|
||||
use Model\Constant\Stat;
|
||||
use User;
|
||||
|
||||
/**
|
||||
@@ -12,16 +13,11 @@ use User;
|
||||
*/
|
||||
class InfoBox
|
||||
{
|
||||
|
||||
private User $user;
|
||||
private array $info;
|
||||
private array $is;
|
||||
|
||||
public function __construct(User $user)
|
||||
public function __construct(private readonly User $user, private readonly Stat $statname = new Stat())
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->info = $user->info;
|
||||
$this->is = $user->is;
|
||||
}
|
||||
|
||||
public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0): array
|
||||
@@ -116,7 +112,7 @@ class InfoBox
|
||||
|
||||
$lvar = $this->getInfoItemInfo($pl, $td);
|
||||
|
||||
if (@isset($sn['items_img'][$tp_img[$pl['inOdet']]])) {
|
||||
if (isset($sn['items_img'][$tp_img[$pl['inOdet']]])) {
|
||||
$uimg = 'rimg/r' . $sn['items_img'][$tp_img[$pl['inOdet']]];
|
||||
} else {
|
||||
$uimg = 'i/items/' . $pl['img'];
|
||||
@@ -160,6 +156,7 @@ class InfoBox
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Шлем,Венок
|
||||
$wj1i = '';
|
||||
$br = '<div align=\\\'center\\\' style=\\\'margin:4px;\\\'><img src=\\\'' . Config::img() . '/1x1.gif\\\' height=\\\'1\\\' width=\\\'111\\\' style=\\\'background-color:black;\\\'></div>';
|
||||
@@ -387,17 +384,17 @@ class InfoBox
|
||||
|
||||
//Действие эффекта
|
||||
$tr = '';
|
||||
$t = $this->user->items['add'];
|
||||
$t = array_keys($this->statname->getBonusNames());
|
||||
$x = 0;
|
||||
$ed = Conversion::dataStringToArray($e['data']);
|
||||
while ($x < count($t)) {
|
||||
$n = $t[$x];
|
||||
if (isset($ed['add_' . $n], $this->is[$n])) {
|
||||
if (isset($ed['add_' . $n])) {
|
||||
$z = '';
|
||||
if ($ed['add_' . $n] > 0) {
|
||||
$z = '+';
|
||||
}
|
||||
$tr .= '<br>' . $this->is[$n] . ': ' . $z . $ed['add_' . $n];
|
||||
$tr .= '<br>' . $this->statname->getBonusNames()[$n] . ': ' . $z . $ed['add_' . $n];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
@@ -426,7 +423,7 @@ class InfoBox
|
||||
//здоровье
|
||||
|
||||
$hptop = 0;
|
||||
$lh = [0 => 'hp_none', 1 => 1];
|
||||
$lh = [0 => 'hp_none'];
|
||||
|
||||
if ($sn['hpNow'] == 0 || $sn['hpAll'] == 0) {
|
||||
$lh[1] = 0;
|
||||
@@ -444,8 +441,7 @@ class InfoBox
|
||||
}
|
||||
if ($sn['mpAll'] > 0) {
|
||||
//мана
|
||||
$lm = [0 => 'hp_none', 1 => 1];
|
||||
$lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 120);
|
||||
$lm = ['hp_none', floor($sn['mpNow'] / $sn['mpAll'] * 120)];
|
||||
if ($lm[1] > 0) {
|
||||
$lm[0] = 'hp_mp';
|
||||
}
|
||||
@@ -471,10 +467,10 @@ class InfoBox
|
||||
|
||||
$pb = '';
|
||||
if ($u['banned'] > 0) {
|
||||
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Персонаж заблокирован</strong></font></div>';
|
||||
$pb .= '<div style="margin:0 2px 0 2px; color: red; background-color: #fae0e0;"><strong>Персонаж заблокирован</strong></div>';
|
||||
}
|
||||
if ($u['allLock'] > time()) {
|
||||
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Временный запрет передач!</strong></font></div>';
|
||||
$pb .= '<div style="margin:0 2px 0 2px; color: red; background-color: #fae0e0;"><strong>Временный запрет передач!</strong></div>';
|
||||
}
|
||||
|
||||
$swm = 0; //свитки магии
|
||||
@@ -503,39 +499,39 @@ class InfoBox
|
||||
|
||||
if ($ssm > 0 && $i1 == 0) {
|
||||
$witmg .= '<table style="padding-top:2px;padding-bottom:2px;" width="240" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="60" height="60">' . $witm[59] . '</td>
|
||||
<td width="60">' . $witm[60] . '</td>
|
||||
<td width="60">' . $witm[61] . '</td>
|
||||
<td width="60">' . $witm[62] . '</td>
|
||||
</tr>
|
||||
</table>';
|
||||
<tr>
|
||||
<td width="60" height="60">' . $witm[59] . '</td>
|
||||
<td width="60">' . $witm[60] . '</td>
|
||||
<td width="60">' . $witm[61] . '</td>
|
||||
<td width="60">' . $witm[62] . '</td>
|
||||
</tr>
|
||||
</table>';
|
||||
}
|
||||
|
||||
if ($swm > 0 && $i1 == 0) {
|
||||
$witmg .= '<table width="240" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="40" height="25">' . $witm[40] . '</td>
|
||||
<td width="40">' . $witm[41] . '</td>
|
||||
<td width="40">' . $witm[42] . '</td>
|
||||
<td width="40">' . $witm[43] . '</td>
|
||||
<td width="40">' . $witm[44] . '</td>
|
||||
<td width="40">' . $witm[50] . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="25">' . $witm[45] . '</td>
|
||||
<td>' . $witm[46] . '</td>
|
||||
<td>' . $witm[47] . '</td>
|
||||
<td>' . $witm[48] . '</td>
|
||||
<td>' . $witm[49] . '</td>
|
||||
<td>' . $witm[51] . '</td>
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
<tr>
|
||||
<td width="40" height="25">' . $witm[40] . '</td>
|
||||
<td width="40">' . $witm[41] . '</td>
|
||||
<td width="40">' . $witm[42] . '</td>
|
||||
<td width="40">' . $witm[43] . '</td>
|
||||
<td width="40">' . $witm[44] . '</td>
|
||||
<td width="40">' . $witm[50] . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="25">' . $witm[45] . '</td>
|
||||
<td>' . $witm[46] . '</td>
|
||||
<td>' . $witm[47] . '</td>
|
||||
<td>' . $witm[48] . '</td>
|
||||
<td>' . $witm[49] . '</td>
|
||||
<td>' . $witm[51] . '</td>
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
}
|
||||
$zag = '';
|
||||
if ($u['zag'] != '' && $i1 == 1) {
|
||||
$rt[0] .= '<style> .inf2s { position:relative; filter: alpha(opacity=10); -moz-opacity: 0.10; -khtml-opacity: 0.10; opacity: 0.10; } .inf2s:hover { background-color:#e2e0e0;filter: alpha(opacity=70); -moz-opacity: 0.70; -khtml-opacity: 0.70; opacity: 0.70; } </style>';
|
||||
$rt[0] .= '<style> .inf2s { position:relative; filter: alpha(opacity=10); -moz-opacity: 0.10; opacity: 0.10; } .inf2s:hover { background-color:#e2e0e0;filter: alpha(opacity=70); -moz-opacity: 0.70; opacity: 0.70; } </style>';
|
||||
|
||||
$zag = '<img width="243" height="283" style="position:absolute;top:-1px;left:-1px;" src="' . Config::img() . '/i/zag/' . $u['zag'] . '">';
|
||||
|
||||
@@ -712,45 +708,28 @@ class InfoBox
|
||||
$lvar .= '<br>Урон: ' . $po['sv_yron_min'] . '-' . $po['sv_yron_max'];
|
||||
}
|
||||
|
||||
$t = $this->user->items['add'];
|
||||
$t = array_keys($this->statname->getBonusNames());
|
||||
$x = 0;
|
||||
while ($x < count($t)) {
|
||||
$n = $t[$x];
|
||||
if (isset($po['add_' . $n], $this->is[$n])) {
|
||||
if (isset($po['add_' . $n])) {
|
||||
$z = '+';
|
||||
if ($po['add_' . $n] < 0) {
|
||||
$z = '';
|
||||
}
|
||||
$lvar .= '<br>' . $this->is[$n] . ': ' . $z . $po['add_' . $n];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
//
|
||||
$x = 0;
|
||||
while ($x < count($t)) {
|
||||
$n = $t[$x];
|
||||
if (isset($po['sv_' . $n])) {
|
||||
$z = '+';
|
||||
if ($po['sv_' . $n] < 0) {
|
||||
$z = '';
|
||||
}
|
||||
if ($n != 'yron_min' && $n != 'yron_max') {
|
||||
$lvar .= '<br>' . $this->is[$n] . ': ' . $z . $po['sv_' . $n];
|
||||
}
|
||||
$lvar .= '<br>' . $this->statname->getBonusNames()[$n] . ': ' . $z . $po['add_' . $n];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
|
||||
|
||||
if (isset($pl['2h']) && $pl['2h'] == 1) {
|
||||
$lvar .= '<br>• Двуручное оружие';
|
||||
}
|
||||
if (isset($po['zonb'])) {
|
||||
$lvar .= '<br>Зоны блокирования: ';
|
||||
if ($po['zonb'] > 0) {
|
||||
$x = 1;
|
||||
while ($x <= $po['zonb']) {
|
||||
$lvar .= '+';
|
||||
$x++;
|
||||
}
|
||||
$lvar .= str_repeat('+', $po['zonb']);
|
||||
} else {
|
||||
$lvar .= '—';
|
||||
}
|
||||
@@ -772,7 +751,7 @@ class InfoBox
|
||||
|
||||
|
||||
if (isset($pl['iznosMAX']) && $pl['iznosMAX'] > 0) {
|
||||
$lvar .= '<br>Долговечность: ' . floor($pl['iznosNOW']) . DIRECTORY_SEPARATOR . ceil($pl['iznosMAX']);
|
||||
$lvar .= '<br>Долговечность: ' . (int)($pl['iznosMAX'] - $pl['iznosNOW']);
|
||||
}
|
||||
|
||||
if (!empty($po['battleUseZd']) && $po['battleUseZd'] > 0) {
|
||||
|
||||
Reference in New Issue
Block a user