2018-01-28 16:40:49 +00:00
|
|
|
<?php
|
2021-08-26 14:44:14 +00:00
|
|
|
|
|
|
|
use Battles\GameLogs;
|
|
|
|
|
2020-10-29 23:30:05 +00:00
|
|
|
if ($_SESSION['uid'] == null) {
|
|
|
|
header("Location: index.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$vip = mysql_fetch_array(mysql_query('SELECT `id`, `klan`, `clone` FROM `abils_klan` WHERE `klan` = "' . $user['klan'] . '" LIMIT 1'));
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2020-10-29 23:30:05 +00:00
|
|
|
if ($user['battle'] == 0) {
|
|
|
|
echo "Это боевая магия...";
|
2018-01-28 16:40:49 +00:00
|
|
|
} else {
|
2020-10-29 23:30:05 +00:00
|
|
|
if ($vip['clone'] >= 1) {
|
|
|
|
if ($user['invis'] == 1) {
|
|
|
|
$user['login'] = 'невидимка';
|
|
|
|
}
|
|
|
|
$nb = mysql_fetch_array(mysql_query("SELECT COUNT(`id`) FROM `bots` WHERE `name` LIKE '" . $user['login'] . " (клон%' AND `battle` = $user[battle]"));
|
|
|
|
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`, `owner`) values ('" . $user['login'] . " (клон " . ($nb[0] + 1) . ")', '" . $user['id'] . "', '" . $user['battle'] . "', '" . $user['hp'] . "', '" . $user['id'] . "')");
|
|
|
|
$bot = mysql_insert_id();
|
|
|
|
|
|
|
|
$bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . $user['battle'] . ' LIMIT 1'));
|
|
|
|
$battle = unserialize($bd['teams']);
|
|
|
|
$battle[$bot] = $battle[$user['id']];
|
|
|
|
foreach ($battle[$bot] as $k => $v) {
|
|
|
|
$battle[$k][$bot] = [0, 0, time()];
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2020-10-29 23:30:05 +00:00
|
|
|
$t1 = explode(";", $bd['t1']);
|
|
|
|
if (in_array($user['id'], $t1)) {
|
|
|
|
$ttt = 1;
|
|
|
|
} else {
|
|
|
|
$ttt = 2;
|
|
|
|
}
|
|
|
|
$lo = Nick::id($user['id'])->short();
|
|
|
|
$los = Nick::id($bot)->short();
|
2021-08-26 14:44:14 +00:00
|
|
|
GameLogs::addBattleLog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $lo . ' породил своего клона ' . $los . '.<BR>');
|
2020-10-29 23:30:05 +00:00
|
|
|
mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '` = CONCAT(`t' . $ttt . '`,\';' . $bot . '\') WHERE `id` = "' . $user['battle'] . '" LIMIT 1');
|
|
|
|
mysql_query("UPDATE `battle` SET `to1` = '" . time() . "', `to2` = '" . time() . "' WHERE `id` = " . $user['battle'] . " LIMIT 1");
|
|
|
|
echo "Клон создан";
|
|
|
|
$vip['clone'] -= 1;
|
|
|
|
mysql_query('UPDATE `abils_klan` SET `clone` = "' . $vip['clone'] . '" WHERE `klan` = "' . $vip['klan'] . '" LIMIT 1');
|
|
|
|
} else {
|
|
|
|
echo "Свиток рассыпался в ваших руках...";
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
}
|