<?php

define('_CONSTANT_', 1);

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

head();

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

$horseman = DB::$dbs->queryFetch("SELECT * FROM ". EVENT_HORSEMAN ." WHERE `id` = ?", [1]);

if ($horseman['time_start'] <= time() && $horseman['start'] == 0) 
{
    $exp        = 10000;
    $gold       = 10000;
    $max_health = 200000;
    $defend     = 100;
    $strike     = 50;
    $timeLeft   = 3600;

    DB::$dbs->query("UPDATE ". EVENT_HORSEMAN ." SET `start` = ?, `health` = ?, `max_health` = ?, `exp` = ?, `gold` = ?, `strike` = ?, `defend` = ?, `time_left` = ? WHERE `id` = ?", array(1, $max_health, $max_health, $exp, $gold, $strike, $defend, time() + $timeLeft, 1 ));
    DB::$dbs->query("TRUNCATE TABLE ". EVENT_HORSEMAN_LOG .""); 
    DB::$dbs->query("INSERT INTO ".CHAT." (`id_user`, `id_kont`, `time`, `text`) VALUES (?, ?, ?, ?)", [1, 0, time(), 'Внимание всем странникам! На Алерот напал Всадник Апокалипсиса. Просим помощи!.']);
}

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