Война с отображением заявок.

This commit is contained in:
Igor Barkov [iwork] 2018-12-13 18:36:30 +02:00
parent 7972ce9a56
commit 168103042a

View File

@ -21,30 +21,6 @@ while ($zayavka) {
}
}
function delzayavka($id, $zay, $r, $f = 1)
{
$z = getlist($r, null, $zay);
if ($f != 1) {
if ($z[$zay]['level'] > 3) {
return 'Ай-ай-ай!';
}
}
if (mysql_query("DELETE FROM `zayavka` WHERE `id` = {$zay} AND (`team1` LIKE '{$id};%' OR `team2` LIKE '{$id};%') LIMIT 1")) {
if (count($z[$zay]['team1']) > 0) {
foreach ($z[$zay]['team1'] as $k => $v) {
mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `id` = {$v}");
}
}
if (count($z[$zay]['team2']) > 0) {
foreach ($z[$zay]['team2'] as $k => $v) {
mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `id` = {$v}");
}
}
}
}
function fteam($team)
{
$team = explode(";", $team);
@ -73,6 +49,23 @@ function getlist($razdel = 1, $level = null, $id = null)
return $zayavka;
}
function delzayavka($id, $zay, $r)
{
$z = getlist($r, null, $zay);
if ($z[$zay]['level'] > 3) return 'Ай-ай-ай!';
if (db::c()->query('DELETE FROM `zayavka` WHERE `id` = ?i AND (`team1` LIKE "?S" OR `team2` LIKE "?S")', $zay, $id.';%', $id.';%')) {
if (count($z[$zay]['team1']) > 0)
foreach ($z[$zay]['team1'] as $k => $v)
db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `id` = ?i', $v);
if (count($z[$zay]['team2']) > 0)
foreach ($z[$zay]['team2'] as $k => $v)
db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `id` = ?i', $v);
}
return true;
}
function startbattle($id, $zay, $r)
{
$z = getlist($r, null, $zay);
@ -83,7 +76,6 @@ function startbattle($id, $zay, $r)
$z = $z[$zay];
$count_users = count($z['team1']);
$bot = 0;
if ($z['bots'] > 0 && $count_users > 0) {
$bots_raw = [7 => [10962, 10964, 10965], 8 => [10962, 10964, 10965], 13 => [10962, 10964, 10965]];
$i = 0;
@ -96,16 +88,6 @@ function startbattle($id, $zay, $r)
}
}
if ($z['type'] == 4 || $z['type'] == 5) {
foreach ($z['team1'] as $k => $v) {
undressall($v);
}
foreach ($z['team2'] as $k => $v) {
undressall($v);
}
}
// Групповой/хаотический бой накрылся потому что меньше 4 человек.
if ($z['type'] == 3 || $z['type'] == 5) {
if ($count_users < 4) {