<?php
if (in_array($user->getRoom(), CAVE_ROOMS)) {
    $cavedata = CAVE_DATA ?? [];
    $floor = mysql_fetch_row(mysql_query("SELECT `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
    if (!isset($cavedata[$user->getRoom()]['x' . $floor])) {
        $floor = 1;
    }
}

$lomka1 = $lomka;

foreach ($lomka1 as $k => $v) {
    if ($v < _BOTSEPARATOR_) {
        if (in_array($user->getRoom(), CAVE_ROOMS)) {
            mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '" . $cavedata[$user->getRoom()]['x' . $floor] . "', `y` = '" . $cavedata[$user->getRoom()]['y' . $floor] . "', `dir` = '" . $cavedata[$user->getRoom()]['dir' . $floor] . "', `loses` = (`loses`+1) WHERE `user` = '$v' LIMIT 1");
        }
        if ($user['laba'] > 0) {
            mysql_query('UPDATE `users` SET `x` = `xf`, `y` = `yr` WHERE `id` = "' . $v . '" LIMIT 1');
            exit('Suka');
        }
    }
}
