Optimising Stat()::class.

This commit is contained in:
2024-01-16 09:13:15 +02:00
parent 68ef35d14a
commit 7dc27047b6
9 changed files with 43 additions and 65 deletions
+7 -8
View File
@@ -18,6 +18,7 @@ class InfoBox
public function __construct(private readonly User $user, private readonly Stat $statname = new Stat())
{
$this->info = $user->info;
$this->statname->getBonus();
}
public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0): array
@@ -384,17 +385,16 @@ class InfoBox
//Действие эффекта
$tr = '';
$t = array_keys($this->statname->getBonusNames());
$x = 0;
$ed = Conversion::dataStringToArray($e['data']);
while ($x < count($t)) {
$n = $t[$x];
while ($x < count($this->statname->sysBonusNames)) {
$n = $this->statname->sysBonusNames[$x];
if (isset($ed['add_' . $n])) {
$z = '';
if ($ed['add_' . $n] > 0) {
$z = '+';
}
$tr .= '<br>' . $this->statname->getBonusNames()[$n] . ': ' . $z . $ed['add_' . $n];
$tr .= '<br>' . $this->statname->bonusNames[$n] . ': ' . $z . $ed['add_' . $n];
}
$x++;
}
@@ -708,16 +708,15 @@ class InfoBox
$lvar .= '<br>Урон: ' . $po['sv_yron_min'] . '-' . $po['sv_yron_max'];
}
$t = array_keys($this->statname->getBonusNames());
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
while ($x < count($this->statname->sysBonusNames)) {
$n = $this->statname->sysBonusNames[$x];
if (isset($po['add_' . $n])) {
$z = '+';
if ($po['add_' . $n] < 0) {
$z = '';
}
$lvar .= '<br>' . $this->statname->getBonusNames()[$n] . ': ' . $z . $po['add_' . $n];
$lvar .= '<br>' . $this->statname->bonusNames[$n] . ': ' . $z . $po['add_' . $n];
}
$x++;
}