remove deprecated
This commit is contained in:
parent
0eb5cbef31
commit
109cfc8d93
53
zayavka.php
53
zayavka.php
@ -93,7 +93,7 @@ class zayavka
|
||||
function addteam($team, $id, $zay, $r)
|
||||
{
|
||||
global $user;
|
||||
$owntravma = mysql_fetch_array(mysql_query("SELECT `id`, `type` FROM `effects` WHERE `owner` = " . $id . " AND (`type` = 12 OR `type` = 13)"));
|
||||
$owntravma = db::c()->query('SELECT `id`, `type` FROM `effects` WHERE (`type` = 12 OR `type` = 13) AND `owner` = ?i', $id)->fetch_assoc();
|
||||
$z = $this->getlist($r, null, $zay);
|
||||
if ($owntravma) {
|
||||
switch ($owntravma['type']) {
|
||||
@ -125,13 +125,8 @@ class zayavka
|
||||
}
|
||||
|
||||
if ($z[$zay]['t' . $team . 'min'] == 99) {
|
||||
$toper = $z[$zay]['team' . $team][0];
|
||||
$toper = mysql_fetch_array(mysql_query("SELECT `id`, `login`, `align`, `klan`, `level` FROM `users` WHERE `id` = '{$toper}' LIMIT 1"));
|
||||
if (!empty($toper['klan'])) {
|
||||
if ($user['klan'] != $toper['klan']) {
|
||||
return "Эта заявка не может быть принята Вами.";
|
||||
}
|
||||
}
|
||||
$toper = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $z[$zay]['team' . $team][0])->fetch_assoc();
|
||||
if ($user['klan'] != $toper['klan']) return "Эта заявка не может быть принята Вами.";
|
||||
} else {
|
||||
if ($user['level'] > 0 && !($z[$zay]['t' . $team . 'min'] <= $user['level'] && $z[$zay]['t' . $team . 'max'] >= $user['level'])) {
|
||||
return "Эта заявка не может быть принята Вами. - " . $z[$zay]['t' . $team . 'min'];
|
||||
@ -232,15 +227,13 @@ class zayavka
|
||||
|
||||
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}");
|
||||
}
|
||||
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) {
|
||||
mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `id` = {$v}");
|
||||
}
|
||||
foreach ($z[$zay]['team2'] as $k => $v)
|
||||
db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `id` = ?i', $v);
|
||||
}
|
||||
return 'Вы отозвали заявку.';
|
||||
} else return 'delzayavka(): database error!';
|
||||
@ -474,10 +467,10 @@ class zayavka
|
||||
// А ЭТО ещё что за хренотень?! О_о
|
||||
for ($i = 0; $i <= $all; $i++) {
|
||||
if ($z['team1'][$i] < _BOTSEPARATOR_) {
|
||||
$gamer = mysql_fetch_array(mysql_query("SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = '" . $z['team1'][$i] . "' LIMIT 1"));
|
||||
$gamer = db::c()->query('SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = ?i', $z['team1'][$i])->fetch_assoc();
|
||||
} else {
|
||||
$bt = mysql_fetch_array(mysql_query('SELECT `id`, `prototype` FROM `bots` WHERE `id` = "' . $z['team1'][$i] . '"'));
|
||||
$gamer = mysql_fetch_array(mysql_query("SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = '" . $bt['prototype'] . "' LIMIT 1"));
|
||||
$bt = db::c()->query('SELECT `prototype` FROM `bots` WHERE `id` = ?i', $z['team1'][$i])->fetch_assoc();
|
||||
$gamer = db::c()->query('SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = ?i', $bt['prototype'])->fetch_assoc();
|
||||
}
|
||||
|
||||
$cost[] = array($z['team1'][$i], $gamer[0]);
|
||||
@ -749,29 +742,24 @@ if (!empty($_POST['open'])) {
|
||||
if ($_GET['trainstart'] == 1 && $user['hp'] > $user['maxhp'] * 0.33 && $user['level'] <= 7) {
|
||||
unlink("/tmp/zayavka/" . $user['id'] . ".txt");
|
||||
$zay->delzayavka($user['id'], $user['zayavka'], 1, 0);
|
||||
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('" . $user['login'] . " (Клон 1)','" . $user['id'] . "','','" . $user['maxhp'] . "');");
|
||||
$bot = mysql_insert_id();
|
||||
db::c()->query('INSERT INTO `bots` (`name`,`prototype`,`hp`) VALUES ("?s",?i,?i)', $user['login'] . ' (Клон 1)', $user['id'], $user['maxhp']);
|
||||
$bot = db::c()->getLastInsertId();
|
||||
$teams = array();
|
||||
|
||||
$teams[$user['id']][$bot] = array(0, 0, time());
|
||||
$teams[$bot][$user['id']] = array(0, 0, time());
|
||||
|
||||
mysql_query("INSERT INTO `battle`
|
||||
(
|
||||
`id`,`coment`,`teams`,`timeout`,`type`,`status`,`t1`,`t2`,`to1`,`to2`, `clone`
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
NULL,'','" . serialize($teams) . "','3','1','0','" . $user['id'] . "','" . $bot . "','" . time() . "','" . time() . "', 1
|
||||
)");
|
||||
db::c()->query('INSERT INTO `battle` (`teams`,`timeout`, `type`, `t1`, `t2`, `to1`, `to2`, `clone`) VALUES ("?s", 3, 1, "?s", "?s", ?i, ?i, 1)', serialize($teams), $user['id'], $bot, time(), time());
|
||||
$id = db::c()->getLastInsertId();
|
||||
|
||||
$log_message = 'Часы показывали <span class=date>' . date("Y.m.d H.i") . '</span>, когда ' . $rr . ' бросили вызов друг другу. <BR>';
|
||||
db::c()->query('INSERT INTO `logs` (`id`, `log`) VALUES (?i,"?s")', $id, $log_message);
|
||||
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i', $id, $bot);
|
||||
|
||||
$id = mysql_insert_id();
|
||||
mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}','Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>');");
|
||||
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$bot} LIMIT 1;");
|
||||
$rr = "<b>" . nick::id($user['id'])->full(1) . "</b> и <b>" . nick::id($bot)->full(1) . "</b>";
|
||||
addlog($id, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>");
|
||||
|
||||
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$user['id']};");
|
||||
db::c()->query('UPDATE users SET `battle` = ?i, `zayavka`= 0 WHERE `id`= ?i', $id, $user['id']);
|
||||
|
||||
die("<script>location.href='fbattle.php';</script>");
|
||||
///=======================================================================================
|
||||
@ -829,8 +817,7 @@ if (!empty($_POST['open'])) {
|
||||
}
|
||||
if (!empty($_POST['confirm2']) AND empty($user['zayavka'])) {
|
||||
$z = $zay->getlist(2, null, $_REQUEST['gocombat']);
|
||||
$toper = $z[$_REQUEST['gocombat']]['team1'][0];
|
||||
$toper = mysql_fetch_array(mysql_query("SELECT `klan` FROM `users` WHERE `id`='{$toper}' LIMIT 1;"));
|
||||
$toper = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $z[$_REQUEST['gocombat']]['team1'][0])->fetch_assoc();
|
||||
if ($user['klan'] != $toper['klan'] || $user['klan'] == '') {
|
||||
AddChatSystem('Внимание!' . nick::id($user['id'])->short() . ' принял заявку, нужно принять вызов или отказать.');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user