Новая уменьшенная кукла, +1 слот, автогенерация слотов по циклу.

This commit is contained in:
Igor Barkov (iwork)
2020-07-06 12:09:47 +03:00
parent 5ff23b7b26
commit 566d8356d0
2 changed files with 43 additions and 15 deletions

View File

@@ -66,7 +66,28 @@ EMPTY_SLOT;
}
}
public function UserInfo()
private function UserInfoDoll() {
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
while ($row = $dressed_items->fetch_assoc()) {
$dressed_item[$row['dressed_slot']] = $row;
}
echo '<div class="user-info-container">';
for ($i = 1; $i <= 12; $i++) {
echo sprintf('<div class="slot-%s">', $i);
if (isset($dressed_item[$i])) {
$this->showItem($dressed_item[$i]);
} else {
$this->showItem($i);
}
echo sprintf('</div><!-- slot-%s -->', $i);
}
echo '<div class="slot-image">';
echo sprintf('<img src="/i/shadow/%s" alt="%s">', $this->shadow, $this->login);
echo '</div><!-- slot-image -->';
echo '</div><!-- user-info-container -->';
}
private function UserInfo()
{
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
while ($row = $dressed_items->fetch_assoc()) {
@@ -223,7 +244,7 @@ EMPTY_SLOT;
}
throw new Exception('<span class="error">Персонаж ' . $this->login . ' обезличен ' . $date . '.</span>');
} else {
$this->UserInfo();
$this->UserInfoDoll();
}
}