dev #41

Merged
lopar merged 29 commits from dev into master 2021-05-25 15:28:14 +00:00
4 changed files with 56 additions and 35 deletions
Showing only changes of commit 591e896968 - Show all commits

View File

@ -49,4 +49,40 @@ trait UserEffects
1022 => 'невидимость', 1022 => 'невидимость',
9994 => 'Антидот/Путы (Эликсир?)', 9994 => 'Антидот/Путы (Эликсир?)',
]; ];
public static $effectImage = [
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',
10 => 'magic/chains.gif',
11 => 'travma.gif',
12 => 'travma.gif',
13 => 'travma.gif',
14 => 'travma.gif',
20 => 'check.gif',
21 => 'magic/al_neut_power.gif',
22 => 'magic/fist_def.gif',
201 => 'magic/defence.gif',
202 => 'magic/devastate.gif',
203 => 'magic/spell_luck.gif',
215 => 'magic/wis_air_def1.gif',
216 => 'magic/wis_air_def2.gif',
217 => 'magic/wis_air_def3.gif',
218 => 'magic/wis_earth_def1.gif',
219 => 'magic/wis_earth_def2.gif',
220 => 'magic/wis_earth_def3.gif',
221 => 'magic/wis_fire_def1.gif',
222 => 'magic/wis_fire_def2.gif',
223 => 'magic/wis_fire_def3.gif',
224 => 'magic/wis_water_def1.gif',
225 => 'magic/wis_water_def2.gif',
226 => 'magic/wis_water_def3.gif',
227 => 'magic/attack_defence.gif',
1022 => 'sh/hidden.gif',
];
} }

View File

@ -1,5 +1,6 @@
<?php <?php
namespace Battles; namespace Battles;
use Battles\Database\DBPDO;
use Battles\Models\EffectsModel; use Battles\Models\EffectsModel;
class UserInfo extends UserStats class UserInfo extends UserStats
@ -206,4 +207,22 @@ INFO;
echo '</div><!-- user-info-container -->'; echo '</div><!-- user-info-container -->';
} }
public function showUserEffects(): string
{
$effs = DBPDO::INIT()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $this->id);
$img = UserEffects::$effectImage;
$r = '';
foreach ($effs as $effect) {
$timeleft = timeOut($effect->remaining_time - time());
$r .= "
<div>
<img class='image' src='/i/{$img[$effect->type]}' alt='{$effect->name}'>
<span class='title'>{$effect->name}</span>
<div class='timeleft'>$timeleft</div>
</div>
";
}
return $r;
}
} }

View File

@ -399,40 +399,6 @@ function timeOut($ttm)
return $out; return $out;
} }
function show_eff_inf(int $u): string
{
$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",
10 => "magic/chains.gif", 11 => "travma.gif", 12 => "travma.gif", 13 => "travma.gif",
14 => "travma.gif", 20 => "check.gif", 21 => "magic/al_neut_power.gif", 22 => "magic/fist_def.gif",
201 => "magic/defence.gif", 202 => "magic/devastate.gif", 203 => "magic/spell_luck.gif", 215 => "magic/wis_air_def1.gif",
216 => "magic/wis_air_def2.gif", 217 => "magic/wis_air_def3.gif", 218 => "magic/wis_earth_def1.gif", 219 => "magic/wis_earth_def2.gif",
220 => "magic/wis_earth_def3.gif", 221 => "magic/wis_fire_def1.gif", 222 => "magic/wis_fire_def2.gif", 223 => "magic/wis_fire_def3.gif",
224 => "magic/wis_water_def1.gif", 225 => "magic/wis_water_def2.gif", 226 => "magic/wis_water_def3.gif", 227 => "magic/attack_defence.gif",
1022 => "sh/hidden.gif",
];
$r = '';
$effs = DBPDO::INIT()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $u);
$i = 0;
while ($i < count($effs)) {
$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;
}
/** /**
* @param $time * @param $time
* @param $vars * @param $vars

View File

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