<?php
define('_CONSTANT_', 1);

require_once '../../core/start.php';

head();

?> 
<div class="wrap">
    Запрашиваемая страница отсутствует.
</div>
<?php

$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM " . NPC . " WHERE `dead` = ?", [1]);
$sql = DB::$dbs->query("SELECT * FROM " . NPC . " WHERE `dead` = ?", [1]);

if (!empty($all)) 
{
    while ($npc = $sql -> fetch()) 
    {
        $timeToResp = $Filter->clearInt($npc['lvl'] * 60);
        $timeResp = time() - $Filter->clearInt($npc['dead_time']);
        
        if ($timeResp >= $timeToResp) 
        {
            DB::$dbs->query("UPDATE " . NPC . " SET `health` = ?, `dead` = ?, `dead_time` = ? WHERE `id` = ?", [$npc['max_health'], 0, 0, $npc['id']]);
        }
    }
}

require_once '../../core/foot.php';