Mass update
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
<?php
|
||||
if (!defined('GAME')) {
|
||||
die();
|
||||
}
|
||||
|
||||
use Core\Db;
|
||||
|
||||
class Tournir
|
||||
{
|
||||
private $u;
|
||||
private $info;
|
||||
private $user;
|
||||
private $name = [0 => 'Âûæèòü ëþáîé öåíîé', 1 => 'Êàæäûé ñàì çà ñåáÿ', 2 => 'Çàõâàò êëþ÷à',];
|
||||
private User $u;
|
||||
private array $info;
|
||||
private array $user;
|
||||
private array $name = [0 => 'Âûæèòü ëþáîé öåíîé', 1 => 'Êàæäûé ñàì çà ñåáÿ', 2 => 'Çàõâàò êëþ÷à',];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -19,24 +18,24 @@ class Tournir
|
||||
|
||||
private function start()
|
||||
{
|
||||
$this->info = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $this->u->info['inTurnirnew'] . '" LIMIT 1'));
|
||||
$this->user = mysql_fetch_array(mysql_query('SELECT * FROM `users_turnirs` WHERE `turnir` = "' . $this->u->info['inTurnirnew'] . '" AND `bot` = "' . $this->u->info['id'] . '" LIMIT 1'));
|
||||
$this->info = Db::getRow('select * from turnirs where id = ?', [$this->u->info['inTurnirnew']]);
|
||||
$this->user = Db::getRow('select * from users_turnirs where turnir = ? and bot = ?', [$this->u->info['inTurnirnew'], $this->u->info['id']]);
|
||||
}
|
||||
|
||||
private function startTurnir()
|
||||
{
|
||||
$row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `win` = "0" AND `lose` = "0" AND `nich` = "0"'));
|
||||
if ($row[0] <= 0 || $this->info['status'] == 3) {
|
||||
$row = Db::getValue('select count(*) from users where win = 0 and lose = 0 and nich = 0');
|
||||
if (!$row || $this->info['status'] == 3) {
|
||||
if ($this->info['status'] == 3) {
|
||||
$this->finishTurnir();
|
||||
}
|
||||
} else {
|
||||
mysql_query('UPDATE `turnirs` SET `status` = "3" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
|
||||
Db::sql('update turnirs set status = 3 where id = ?', [$this->info['id']]);
|
||||
//Ñîçäàíèå ïîåäèíêà
|
||||
mysql_query('INSERT INTO `battle` (`city`,`time_start`,`timeout`,`type`,`turnir`) VALUES ("' . $this->u->info['city'] . '","' . time() . '","60","1","' . $this->info['id'] . '")');
|
||||
$uri = mysql_insert_id();
|
||||
Db::sql('insert into battle (city, time_start, timeout, type, turnir) values (?,unix_timestamp(),60,1,?)', [$this->u->info['city'], $this->info['id']]);
|
||||
$uri = Db::lastInsertId();
|
||||
//Çàêèäûâàåì ïåðñîíàæåé â ïîåäèíîê
|
||||
mysql_query('UPDATE `users` SET `battle` = "' . $uri . '" WHERE `inUser` = "0" AND `inTurnirnew` = "' . $this->info['id'] . '"');
|
||||
Db::sql('update users set battle = ? where inUser = 0 and inTurnirnew = ?', [$uri, $this->info['id']]);
|
||||
//Îáîçíà÷àåì çàâåðøåíèå òóðíèðà ïðè âûõîäå
|
||||
die('Ïåðåéòèäå â ðàçäåë "ïîåäèíêè"...');
|
||||
}
|
||||
@@ -62,9 +61,6 @@ class Tournir
|
||||
}
|
||||
|
||||
if ($pl['team'] == $this->info['winner'] && $this->info['winner'] != 0) {
|
||||
|
||||
$inf['add_expn'] = 3000;
|
||||
|
||||
$inf['add_expp'] = [0, 1, 5, 10, 15, 25, 35, 70, 100, 150, 200, 300, 500, 700, 1000];
|
||||
|
||||
//ïîëó÷àåì îïûò (ñ 0 ïî 12 ëâë)
|
||||
@@ -82,7 +78,6 @@ class Tournir
|
||||
mysql_query('UPDATE `users` SET `lose` = `lose` + 1,`lose_t` = `lose_t` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1');
|
||||
|
||||
$lose .= '<b>' . $inf['login'] . '</b>, ';
|
||||
|
||||
} else {
|
||||
mysql_query('UPDATE `users` SET `nich` = `nich` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1');
|
||||
}
|
||||
@@ -172,7 +167,6 @@ class Tournir
|
||||
}
|
||||
|
||||
if ($addi == 1) {
|
||||
|
||||
$i = 0;
|
||||
while ($i <= 17) {
|
||||
if ($i == 10) {
|
||||
@@ -468,7 +462,6 @@ class Tournir
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
}
|
||||
$r .= '<div align="left" style="height:1px; width:100%; margin:10px 0 10px 0; border-top:1px solid #999999;"></div>';
|
||||
$r .= '<table style="border:1px solid #99cccc" width="700" bgcolor="#bbdddd" border="0" align="center" cellpadding="5" cellspacing="0">
|
||||
|
||||
Reference in New Issue
Block a user