dev #38

Merged
lopar merged 22 commits from dev into master 2021-02-03 08:56:49 +00:00
2 changed files with 14 additions and 14 deletions
Showing only changes of commit da410d57c8 - Show all commits

View File

@ -5,6 +5,7 @@
* Project name: Battles-Game
*/
use Battles\Database\DBPDO;
use Battles\Travel;
use Battles\User;
@ -398,9 +399,8 @@ function timeOut($ttm)
return $out;
}
function show_eff_inf($u)
function show_eff_inf(int $u): string
{
global $db;
$img = [
1 => "travma.gif", 2 => "magic/sleep.gif", 3 => "magic/sleepf.gif", 4 => "magic/haos.gif",
5 => "magic/obezl.gif", 6 => "expx15.gif", 7 => "euphoria.png", 8 => "sleep_obj.gif",
@ -414,22 +414,22 @@ function show_eff_inf($u)
];
$r = '';
$effs = $db->ofetchAll('SELECT * FROM users_effects WHERE type != 20 AND owner_id = ?', $u);
$effs = DBPDO::INIT()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $u);
$i = 0;
while ($i < count($effs)) {
$r .= '<div>';
$r .= '<img class="image" src="/i/' . $img[$effs->type] . '" /> <a href=\'main.php?edit=1&del=1&efid=' . $effs->effect_id . '\' onclick=\'return confirm("Удалить ' . $effs->name . '?")\'><img src=\'i/clear.gif\' style=\'float: right;\' /></a>';
$r .= '<span class="title">' . $effs->name . '</span>';
if ($effs['sleep'] != 0) {
$r .= '<div class="timeleft">Эффект заморожен</div>';
} else {
$r .= '<div class="timeleft">' . timeOut($effs->remaining_time - time()) . '</div>';
}
$r .= '</div>';
$timeleft = timeOut($effs[$i]->remaining_time - time());
$r .= <<<HTML
<div>
<img class="image" src="/i/{$img[$effs[$i]->type]}">
<span class="title">{$effs[$i]->name}</span>
<div class="timeleft">$timeleft</div>
</div>
HTML;
$i++;
}
unset($i);
return $r;
}

View File

@ -371,7 +371,7 @@ Template::header('Игра');
<div align="center">
<a href='main.php?edit=1&undress=all' class="button">Снять все</a><BR>
<div class="effectList" style="padding-top: 15px; max-height: 150px; width: 220px;">
<?= show_eff_inf($user->id, 2) ?>
<?= show_eff_inf($user->id) ?>
</div>
</div>
<br>